Use types instead of imp.new_module.

I can follow up with https://docs.python.org/3/library/importlib.html#importlib.util.module_from_spec if need be.
This commit is contained in:
Joshua Li 2020-06-02 19:44:41 -07:00
parent ec2018d664
commit ff45dd86fb

View File

@ -1,6 +1,6 @@
import sys
import zlib
import imp
import types
verbosity = verbosity # noqa: F821 must be a previously defined global
z = zlib.decompressobj()
@ -15,7 +15,7 @@ while 1:
% (name, nbytes))
content = z.decompress(sys.stdin.read(nbytes))
module = imp.new_module(name)
module = types.ModuleType(name)
parents = name.rsplit(".", 1)
if len(parents) == 2:
parent, parent_name = parents