Dolda2000 GitWeb
/
pdm.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix simplefunc return bug.
[pdm.git]
/
pdm
/
perf.py
diff --git
a/pdm/perf.py
b/pdm/perf.py
index
7aef95a
..
307dccb
100644
(file)
--- a/
pdm/perf.py
+++ b/
pdm/perf.py
@@
-51,6
+51,13
@@
__all__ = ["attrinfo", "simpleattr", "valueattr", "eventobj",
"staticdir", "event", "procevent", "startevent",
"finishevent"]
"staticdir", "event", "procevent", "startevent",
"finishevent"]
+class error(Exception):
+ pass
+class nosuchname(LookupError, error):
+ pass
+class nosuchproto(error):
+ pass
+
class attrinfo(object):
"""The return value of the `attrinfo' method on `attr' objects as
described in L{pdm.srv.perf}.
class attrinfo(object):
"""The return value of the `attrinfo' method on `attr' objects as
described in L{pdm.srv.perf}.
@@
-186,7
+193,7
@@
class simplefunc(perfobj):
def invoke(self, method, *args, **kwargs):
if method not in self.map:
raise AttributeError(method)
def invoke(self, method, *args, **kwargs):
if method not in self.map:
raise AttributeError(method)
- self.map[method](*args, **kwargs)
+
return
self.map[method](*args, **kwargs)
def pdm_protocols(self):
return super().pdm_protocols() + ["invoke"]
def pdm_protocols(self):
return super().pdm_protocols() + ["invoke"]
@@
-278,4
+285,12
@@
sysinfo["uname"] = simpleattr(func = os.uname)
sysinfo["hostname"] = simpleattr(func = socket.gethostname)
sysinfo["platform"] = valueattr(init = sys.platform)
sysinfo["hostname"] = simpleattr(func = socket.gethostname)
sysinfo["platform"] = valueattr(init = sys.platform)
-sysctl = simplefunc(exit=lambda status=0: os._exit(status))
+def reload(modname):
+ mod = sys.modules.get(modname)
+ if mod is None:
+ raise ValueError(modname)
+ import importlib
+ importlib.reload(mod)
+
+sysctl = simplefunc(exit=lambda status=0: os._exit(status),
+ reload=reload)