本文整理汇总了Python中importlib.machinery.__name__方法的典型用法代码示例。如果您正苦于以下问题:Python machinery.__name__方法的具体用法?Python machinery.__name__怎么用?Python machinery.__name__使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类importlib.machinery
的用法示例。
在下文中一共展示了machinery.__name__方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __repr__
# 需要导入模块: from importlib import machinery [as 别名]
# 或者: from importlib.machinery import __name__ [as 别名]
def __repr__(self):
return self.__class__.__name__ + repr(self.args)
示例2: run_script
# 需要导入模块: from importlib import machinery [as 别名]
# 或者: from importlib.machinery import __name__ [as 别名]
def run_script(dist_spec, script_name):
"""Locate distribution `dist_spec` and run its `script_name` script"""
ns = sys._getframe(1).f_globals
name = ns['__name__']
ns.clear()
ns['__name__'] = name
require(dist_spec)[0].run_script(script_name, ns)
# backward compatibility
示例3: resolve
# 需要导入模块: from importlib import machinery [as 别名]
# 或者: from importlib.machinery import __name__ [as 别名]
def resolve(self):
"""
Resolve the entry point from its module and attrs.
"""
module = __import__(self.module_name, fromlist=['__name__'], level=0)
try:
return functools.reduce(getattr, self.attrs, module)
except AttributeError as exc:
raise ImportError(str(exc))
示例4: __repr__
# 需要导入模块: from importlib import machinery [as 别名]
# 或者: from importlib.machinery import __name__ [as 别名]
def __repr__(self):
return self.__class__.__name__+repr(self.args)
示例5: run_script
# 需要导入模块: from importlib import machinery [as 别名]
# 或者: from importlib.machinery import __name__ [as 别名]
def run_script(dist_spec, script_name):
"""Locate distribution `dist_spec` and run its `script_name` script"""
ns = sys._getframe(1).f_globals
name = ns['__name__']
ns.clear()
ns['__name__'] = name
require(dist_spec)[0].run_script(script_name, ns)
# backward compatibility
示例6: run_script
# 需要导入模块: from importlib import machinery [as 别名]
# 或者: from importlib.machinery import __name__ [as 别名]
def run_script(self, requires, script_name):
"""Locate distribution for `requires` and run `script_name` script"""
ns = sys._getframe(1).f_globals
name = ns['__name__']
ns.clear()
ns['__name__'] = name
self.require(requires)[0].run_script(script_name, ns)