Builds a list of python modules in the current directory.
180040
def _build_module_list(source_module, index_filename, ignore_modules):
    ''''''
    out = []
    dirs_with_init = set()
    module_prefix = '' if source_module == '.' else source_module

    for root, _, filenames in walk('.'):
        root = root[2:]
        module_root = root.replace('/', '.')
        file_names = [filename[:-3] for filename in filenames if filename.endswith('.py')]

        for filename in file_names:
            if filename == '__init__':
                dirs_with_init.add(root)
                module_name = '.'.join([module_prefix, module_root]) if module_root else source_module
            elif not root:
                module_name = '.'.join([module_prefix, filename])
            else:
                module_name = '.'.join([module_prefix, root.replace('/', '.'), filename])

            if module_name.startswith('.'):
                module_name = module_name[1:]

            if module_name in ignore_modules:
                print 'Ignored file: {}{}.py'.format('{}/'.format(root), filename)
                continue

            if root and root not in dirs_with_init:
                print 'No __init__.py, skipping: {}{}.py'.format('{}/'.format(root), filename)
                continue

            source_name = '{}.py'.format(filename)
            if root:
                source_name = '{}/{}'.format(root, source_name)

            if filename == '__init__':
                output_name = '{}.md'.format(index_filename)
            else:
                output_name = '{}.md'.format(filename)
            if root:
                output_name = '{}/{}'.format(root, output_name)

            out.append({
                'directory': root,
                'file': filename,
                'module': module_name,
                'output': output_name,
                'source': source_name
            })

    return out
174613
def find_missing_modules():
    
    missing_modules = []

    for module in MODULES:
        try:
            __import__(module[1])
        except ImportError:
            missing_modules.append(module)
    return missing_modules
1188279
def python_modules():
        
        imported = {}
        results = {"builtins": sys.builtin_module_names, "imported": imported}
        for module_name, module_ in sys.modules.items():
            if module_name not in sys.builtin_module_names:
                try:
                    imported[module_name] = inspect.getfile(module_)
                except TypeError:
                    imported[
                        module_name
                    ] = "<no file information :: {0}>".format(repr(module_))

        return results
234387
def get_modules(self, type_name):
        '''
        '''
        modules = []
        for module in self:
            if module.__class__.__name__ == type_name:
                modules.append(module)
        return modules
1112451
def get_modules(self):
        
        plugins = []
        for path in self.package.__path__:
            if os.path.isdir(path):
                plugins.extend(self._find_plugins_in_dir(path))

        return plugins
197192
def main(directories):
    ''''''
    msg = 'Checking module "{}" from directory "{}" for coding errors.'
    api_checker = ApiChecker()
    resource_checker = ResourceChecker()
    errors = []
    modules = []
    for loader, mname, _ in pkgutil.walk_packages(directories):
        sys.path.append(os.path.abspath(loader.path))
        log.info(msg.format(mname, loader.path))
        modules.append(mname)
        import_module(mname)
    for api in Api:
        if api.__module__.split('.')[-1] not in modules:
            continue
        log.debug('Anlysing Api class: {}'.format(api.__name__))
        errors.extend(api_checker(api))
    for res in Resource:
        if res.__module__.split('.')[-1] not in modules:
            continue
        log.debug('Anlysing Resource class: {}'.format(res.__name__))
        errors.extend(resource_checker(res))
    else:
        log.info('All modules tested, no problem detected.')
    return errors
483914
def collect_modules(self):
        """"""
        for path, dirlist, filelist in os.walk(self.root):
            for name in fnmatch.filter(filelist, self.filter):
                if self.is_git_file(path, name):
                    yield (os.path.join(path, name), [])
1344757
def build(self, build_dir, **kwargs):
        """"""
        # pylint: disable=no-self-use
        del kwargs
        args = ["cmake", "--build", build_dir]
        args.extend(self._get_build_flags())
        return [{"args": args}]
600360
def load_modules(self):
        
        module_folder = os.path.join(os.path.dirname(__file__),
                                     '..', 'modules')
        module_dirs = {
            'gandi.cli': module_folder
        }

        if 'GANDICLI_PATH' in os.environ:
            for _path in os.environ.get('GANDICLI_PATH').split(':'):
                # remove trailing separator if any
                path = _path.rstrip(os.sep)
                module_dirs[os.path.basename(path)] = os.path.join(path,
                                                                   'modules')

        for module_basename, dir in list(module_dirs.items()):
            for filename in sorted(os.listdir(dir)):
                if filename.endswith('.py') and '__init__' not in filename:
                    submod = filename[:-3]
                    module_name = module_basename + '.modules.' + submod
                    __import__(module_name, fromlist=[module_name])

        # save internal map of loaded module classes
        for subclass in GandiModule.__subclasses__():
            self._modules[subclass.__name__.lower()] = subclass
683070
def load_module(name, globals_dict=None, symb_list=None):
    
    _load("scapy.modules." + name,
          globals_dict=globals_dict, symb_list=symb_list)
1341578
def buildmod(*modules):
    '''
    
    '''
    # Check if module files are missing
    missing = [module for module in modules if not os.path.exists(module)]
    if missing:
        return 'Error: The file ({0}) does not exist.'.format(', '.join(missing))

    cmd = ['znc-buildmod']
    cmd.extend(modules)
    out = __salt__['cmd.run'](cmd, python_shell=False).splitlines()
    return out[-1]
1229118
def build_indices

      @info.each do |toplevel|
        @files << HtmlFile.new(toplevel, @options, FILE_DIR)
      end

      RDoc::TopLevel.all_classes_and_modules.each do |cls|
        build_class_list(cls, @files[0], CLASS_DIR)
      end
    end
423777
def build(
    root, source_module, output_dir,
    json_dump=False, ignore_modules=None, index_filename='index'
):
    '''
    
    '''
    if root.endswith('/'):
        root = root[:-1]

    if ignore_modules is None:
        ignore_modules = []
    elif isinstance(ignore_modules, str):
        ignore_modules = ignore_modules.split(',')

    # Ensure output_dir format (no / at start, / at end)
    if output_dir.startswith('/'):
        output_dir = output_dir[1:]

    if not output_dir.endswith('/'):
        output_dir = '{}/'.format(output_dir)

    # Apply root to it, make the directory if not exists
    output_dir = '{}/{}'.format(root, output_dir)
    if not path.isdir(output_dir):
            makedirs(output_dir)

    if source_module == '.':
        source_dir = '{}/'.format(root)
    else:
        source_dir = '{}/{}/'.format(root, source_module.replace('.', os.sep))

    # Cd into the source directory
    chdir(source_dir)
    # And build the module list
    module_list = _build_module_list(
        source_module,
        index_filename=index_filename,
        ignore_modules=ignore_modules
    )

    # Cd back to old directory
    chdir(root)
    # And parse all the modules
    _parse_module_list(module_list)

    # Cd inot the target directory
    chdir(output_dir)
    # Finally, write the module list to our output dir
    _write_docs(module_list, output_dir)

    if json_dump:
        print json.dumps(module_list, indent=4)
362160
def dlls_in_subdirs(directory):
    """"""
    files = []
    for root, dirs, files in os.walk(directory):
        files.extend(dlls_in_dir(root))
472312
function(dir) {
    var dirParts = dir.split(path.sep);
    var nodeModules = dirParts.indexOf('node_modules');
    return path.join(dirParts[nodeModules], dirParts[nodeModules + 1], '**');
  }
512969
def filtered_dir(module_name, *, additions={}, **kwargs):
    
    module = importlib.import_module(module_name)

    def __dir__():
        attr_names = set(filtered_attrs(module, **kwargs))
        attr_names.update(additions)
        return sorted(attr_names)

    return __dir__
406194
def get_module_names(p):
    '''
    '''
    mods = list()
    mods = [f.split('.')[0] for f in listdir(p)
            if isfile(join(p, f)) and not f.endswith('.pyc') and not f.startswith('__')]
    print len(mods)
    return mods