Python importlib.machinery.__name__() Examples

The following are 30 code examples of importlib.machinery.__name__(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module importlib.machinery , or try the search function .
Example #1
Source File: __init__.py    From FuYiSpider with Apache License 2.0 5 votes vote down vote up
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)) 
Example #2
Source File: __init__.py    From anpr with Creative Commons Attribution 4.0 International 5 votes vote down vote up
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) 
Example #3
Source File: __init__.py    From Mastering-Elasticsearch-7.0 with MIT License 5 votes vote down vote up
def __repr__(self):
        return self.__class__.__name__ + repr(self.args) 
Example #4
Source File: __init__.py    From anpr with Creative Commons Attribution 4.0 International 5 votes vote down vote up
def __repr__(self):
        return self.__class__.__name__ + repr(self.args) 
Example #5
Source File: __init__.py    From anpr with Creative Commons Attribution 4.0 International 5 votes vote down vote up
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) 
Example #6
Source File: __init__.py    From anpr with Creative Commons Attribution 4.0 International 5 votes vote down vote up
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)) 
Example #7
Source File: __init__.py    From anpr with Creative Commons Attribution 4.0 International 5 votes vote down vote up
def __repr__(self):
        return self.__class__.__name__ + repr(self.args) 
Example #8
Source File: __init__.py    From Mastering-Elasticsearch-7.0 with MIT License 5 votes vote down vote up
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)) 
Example #9
Source File: __init__.py    From Mastering-Elasticsearch-7.0 with MIT License 5 votes vote down vote up
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) 
Example #10
Source File: __init__.py    From Mastering-Elasticsearch-7.0 with MIT License 5 votes vote down vote up
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 
Example #11
Source File: __init__.py    From anpr with Creative Commons Attribution 4.0 International 5 votes vote down vote up
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 
Example #12
Source File: __init__.py    From pkg_resources with MIT License 5 votes vote down vote up
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)) 
Example #13
Source File: __init__.py    From pkg_resources with MIT License 5 votes vote down vote up
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) 
Example #14
Source File: __init__.py    From pkg_resources with MIT License 5 votes vote down vote up
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 
Example #15
Source File: __init__.py    From pkg_resources with MIT License 5 votes vote down vote up
def __repr__(self):
        return self.__class__.__name__ + repr(self.args) 
Example #16
Source File: __init__.py    From Mastering-Elasticsearch-7.0 with MIT License 5 votes vote down vote up
def __repr__(self):
        return self.__class__.__name__+repr(self.args) 
Example #17
Source File: __init__.py    From FuYiSpider with Apache License 2.0 5 votes vote down vote up
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) 
Example #18
Source File: __init__.py    From FuYiSpider with Apache License 2.0 5 votes vote down vote up
def __repr__(self):
        return self.__class__.__name__ + repr(self.args) 
Example #19
Source File: __init__.py    From FuYiSpider with Apache License 2.0 5 votes vote down vote up
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)) 
Example #20
Source File: __init__.py    From FuYiSpider with Apache License 2.0 5 votes vote down vote up
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) 
Example #21
Source File: __init__.py    From FuYiSpider with Apache License 2.0 5 votes vote down vote up
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 
Example #22
Source File: __init__.py    From FuYiSpider with Apache License 2.0 5 votes vote down vote up
def __repr__(self):
        return self.__class__.__name__ + repr(self.args) 
Example #23
Source File: __init__.py    From vnpy_crypto with MIT License 5 votes vote down vote up
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)) 
Example #24
Source File: __init__.py    From vnpy_crypto with MIT License 5 votes vote down vote up
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) 
Example #25
Source File: __init__.py    From vnpy_crypto with MIT License 5 votes vote down vote up
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 
Example #26
Source File: __init__.py    From vnpy_crypto with MIT License 5 votes vote down vote up
def __repr__(self):
        return self.__class__.__name__ + repr(self.args) 
Example #27
Source File: __init__.py    From kobo-predict with BSD 2-Clause "Simplified" License 5 votes vote down vote up
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)) 
Example #28
Source File: __init__.py    From kobo-predict with BSD 2-Clause "Simplified" License 5 votes vote down vote up
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) 
Example #29
Source File: __init__.py    From kobo-predict with BSD 2-Clause "Simplified" License 5 votes vote down vote up
def __repr__(self):
        return self.__class__.__name__+repr(self.args) 
Example #30
Source File: __init__.py    From kobo-predict with BSD 2-Clause "Simplified" License 5 votes vote down vote up
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))