예제 #1
0
    def _sub_modules_dict(self):
        """
        Lists modules in the directory of this module (if this module is a
        package).
        """
        names = {}
        try:
            method = self.py__path__
        except AttributeError:
            pass
        else:
            for path in method():
                mods = iter_modules([path])
                for module_loader, name, is_pkg in mods:
                    # It's obviously a relative import to the current module.
                    names[name] = SubModuleName(self, name)

        # TODO add something like this in the future, its cleaner than the
        #   import hacks.
        # ``os.path`` is a hardcoded exception, because it's a
        # ``sys.modules`` modification.
        # if str(self.name) == 'os':
        #     names.append(Name('path', parent_context=self))

        return names
예제 #2
0
파일: module.py 프로젝트: Marslo/VimConfig
    def _sub_modules_dict(self):
        """
        Lists modules in the directory of this module (if this module is a
        package).
        """
        names = {}
        try:
            method = self.py__path__
        except AttributeError:
            pass
        else:
            for path in method():
                mods = iter_modules([path])
                for module_loader, name, is_pkg in mods:
                    # It's obviously a relative import to the current module.
                    names[name] = SubModuleName(self, name)

        # TODO add something like this in the future, its cleaner than the
        #   import hacks.
        # ``os.path`` is a hardcoded exception, because it's a
        # ``sys.modules`` modification.
        # if str(self.name) == 'os':
        #     names.append(Name('path', parent_context=self))

        return names
예제 #3
0
파일: module.py 프로젝트: syntonym/jedi
    def _sub_modules_dict(self):
        """
        Lists modules in the directory of this module (if this module is a
        package).
        """
        path = self._path
        names = {}
        if path is not None and path.endswith(os.path.sep + '__init__.py'):
            mods = iter_modules([os.path.dirname(path)])
            for module_loader, name, is_pkg in mods:
                # It's obviously a relative import to the current module.
                names[name] = SubModuleName(self, name)

        # TODO add something like this in the future, its cleaner than the
        #   import hacks.
        # ``os.path`` is a hardcoded exception, because it's a
        # ``sys.modules`` modification.
        # if str(self.name) == 'os':
        #     names.append(Name('path', parent_context=self))

        return names
예제 #4
0
파일: module.py 프로젝트: andrewgu12/config
    def _sub_modules_dict(self):
        """
        Lists modules in the directory of this module (if this module is a
        package).
        """
        path = self._path
        names = {}
        if path is not None and path.endswith(os.path.sep + '__init__.py'):
            mods = iter_modules([os.path.dirname(path)])
            for module_loader, name, is_pkg in mods:
                # It's obviously a relative import to the current module.
                names[name] = SubModuleName(self, name)

        # TODO add something like this in the future, its cleaner than the
        #   import hacks.
        # ``os.path`` is a hardcoded exception, because it's a
        # ``sys.modules`` modification.
        # if str(self.name) == 'os':
        #     names.append(Name('path', parent_context=self))

        return names
예제 #5
0
def list_module_names(inference_state, search_path):
    return [
        force_unicode(name)
        for module_loader, name, is_pkg in iter_modules(search_path)
    ]
예제 #6
0
def list_module_names(evaluator, search_path):
    return [
        force_unicode(name)
        for module_loader, name, is_pkg in iter_modules(search_path)
    ]
예제 #7
0
def list_module_names(evaluator, search_path):
    return [name for module_loader, name, is_pkg in iter_modules(search_path)]
예제 #8
0
def list_module_names(evaluator, search_path):
    return [
        name
        for module_loader, name, is_pkg in iter_modules(search_path)
    ]
예제 #9
0
def list_module_names(evaluator, search_path):
    return [
        force_unicode(name)
        for module_loader, name, is_pkg in iter_modules(search_path)
    ]