Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions boxx/tool/toolFunction.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def interFun():
maxTimes[0] -= 1
if maxTimes[0] <= 0:
return
setTimeOut(interFun, inter)
setTimeout(interFun, inter)
interFun()

from multiprocessing import Pool as PoolMp
Expand Down Expand Up @@ -239,7 +239,7 @@ def f():
r = fun(*l,**kv)
finally:
self.left += 1
self.l.append(setTimeOut(f))
self.l.append(setTimeout(f))
if len(self.l)>100:
self.l = self.l[-90:]
f = lambda fun,*l,**kv:fun(*l,**kv) #用于测试单线程的性能
Expand Down
20 changes: 19 additions & 1 deletion boxx/tool/toolLog.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@
from __future__ import unicode_literals
from __future__ import print_function

import executing

from .toolStructObj import addCall, dicto, FunAddMagicMethod, getfathers, typeNameOf, typestr
from .toolSystem import getRootFrame, getFatherFrames
from ..ylsys import py2
from ..ylcompat import printf, unicode
from ..ylcompat import istype

import os,sys,time
import ast
import math
import re
from collections import defaultdict
Expand Down Expand Up @@ -931,6 +934,17 @@ def __setattr__(self, name, v):
log = global_g_paras[id(self)].log
transport = TransportToRootFrame(name,log)
transport(v)

def __pow__(self, v):
ex = executing.Source.executing(sys._getframe(1))
op = ex.node.right
if not isinstance(op, ast.Name):
raise TypeError('Only variables can be transported directly')
self.__setattr__(op.id, v)

__sub__ = __truediv__ = __div__ = __mul__ = __add__ = __eq__ = __pow__


g = GlobalG()
gg = GlobalG(log=True)

Expand Down Expand Up @@ -1170,7 +1184,11 @@ def printt(self, x=None):
else:
pass
# pblue('%s: %s'%(clf.p%'As pp by p', x))
print(x)
try:
ex = executing.Source.executing(sys._getframe(1))
print(ex.source.asttokens().get_text(ex.node.right), '=', x)
except:
print(x)
return x
__sub__ = printt
__lshift__ = printt
Expand Down
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ snakeviz
fn
pyopengl
seaborn
executing
asttokens