kopia lustrzana https://github.com/micropython/micropython-lib
pickle: Very rough implementation of pickle loads from imported modules.
Allows to implement minimal pickling for datetime objects.pull/208/merge
rodzic
96a6033715
commit
693b229f8d
|
@ -12,5 +12,11 @@ def load(f):
|
||||||
|
|
||||||
def loads(s):
|
def loads(s):
|
||||||
d = {}
|
d = {}
|
||||||
|
if "(" in s:
|
||||||
|
qualname = s.split("(", 1)[0]
|
||||||
|
if "." in qualname:
|
||||||
|
pkg = qualname.rsplit(".", 1)[0]
|
||||||
|
mod = __import__(pkg)
|
||||||
|
d[pkg] = mod
|
||||||
exec("v=" + s, d)
|
exec("v=" + s, d)
|
||||||
return d["v"]
|
return d["v"]
|
||||||
|
|
Ładowanie…
Reference in New Issue