Collect all symbols from a list of modules.

  Args:
    module_to_name: Dictionary mapping modules to short names.

  Returns:
    Dictionary mapping name to (fullname, member) pairs.
353515
def collect_members(module_to_name):
  
  members = {}
  for module, module_name in module_to_name.items():
    all_names = getattr(module, "__all__", None)
    for name, member in inspect.getmembers(module):
      if ((inspect.isfunction(member) or inspect.isclass(member)) and
          not _always_drop_symbol_re.match(name) and
          (all_names is None or name in all_names)):
        fullname = '%s.%s' % (module_name, name)
        if name in members:
          other_fullname, other_member = members[name]
          if member is not other_member:
            raise RuntimeError("Short name collision between %s and %s" %
                               (fullname, other_fullname))
          if len(fullname) == len(other_fullname):
            raise RuntimeError("Can't decide whether to use %s or %s for %s: "
                               "both full names have length %d" %
                               (fullname, other_fullname, name, len(fullname)))
          if len(fullname) > len(other_fullname):
            continue  # Use the shorter full name
        members[name] = fullname, member
  return members
427241
private List<String> extractIndexNames() {

        List<String> modules = new ArrayList<String>();

        if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(getParamIndexes())) {
            StringTokenizer tok = new StringTokenizer(getParamIndexes(), ",");
            while (tok.hasMoreTokens()) {
                String module = tok.nextToken();
                modules.add(module);
            }
        }
        return modules;
    }
201029
def module_to_dict(module):
    

    lot = [(key, module.__getattribute__(key)) for key in module.__all__]
    ret = dict(lot)
    return ret
712483
def _get_package_name(module):
    
    try:
        # if __package__ is defined, use it
        package_name = module.__package__
    except AttributeError:
        package_name = None  
        
    if package_name is None:
        # if __path__ is defined, the package name is the module name
        package_name = module.__name__
        if not hasattr(module, '__path__'):
            # if __path__ is not defined, the package name is the
            # string before the last "." of the fully-qualified module name
            package_name = package_name.rpartition('.')[0]
           
    return package_name
1177849
def get_modules(self, name):
        """"""
        result = []
        for module in self.names:
            if name in self.names[module]:
                result.append(module)
        return result
949434
def iterate_symbols():
    
    for prefix in search_prefixes():
        package = importlib.import_module(prefix)
        for importer, modname, ispkg in pkgutil.walk_packages(path=package.__path__, onerror=lambda x: None):
            network = network_for_netcode(modname)
            if network:
                yield network.symbol.upper()
1267317
def get_pydoc_completions(modulename):
    
    modulename = compat.ensure_not_unicode(modulename)
    modulename = modulename.rstrip(".")
    if modulename == "":
        return sorted(get_modules())
    candidates = get_completions(modulename)
    if candidates:
        return sorted(candidates)
    needle = modulename
    if "." in needle:
        modulename, part = needle.rsplit(".", 1)
        candidates = get_completions(modulename)
    else:
        candidates = get_modules()
    return sorted(candidate for candidate in candidates
                  if candidate.startswith(needle))
562716
def _module_to_generators(pb_module):
    '''
    
    '''
    if not pb_module:
        return None
    message_types = pb_module.DESCRIPTOR.message_types_by_name
    return {k: ProtobufGenerator(v) for k, v in message_types.items()}
392275
def filename_to_module(filename):
    
    find = re.compile(r"^[^.|-]*")
    name = re.search(find, filename).group(0)
    return name
753035
def _str_member_list(self, name):
        
        out = []
        if self[name]:
            out += ['.. rubric:: %s' % name, '']
            prefix = getattr(self, '_name', '')

            if prefix:
                prefix = '~%s.' % prefix

            autosum = []
            others = []
            for param, param_type, desc in self[name]:
                param = param.strip()
                if not self._obj or hasattr(self._obj, param):
                    autosum += ["   %s%s" % (prefix, param)]
                else:
                    others.append((param, param_type, desc))

            if autosum:
                # GAEL: Toctree commented out below because it creates
                # hundreds of sphinx warnings
                # out += ['.. autosummary::', '   :toctree:', '']
                out += ['.. autosummary::', '']
                out += autosum

            if others:
                maxlen_0 = max([len(x[0]) for x in others])
                maxlen_1 = max([len(x[1]) for x in others])
                hdr = "=" * maxlen_0 + "  " + "=" * maxlen_1 + "  " + "=" * 10
                fmt = '%%%ds  %%%ds  ' % (maxlen_0, maxlen_1)
                n_indent = maxlen_0 + maxlen_1 + 4
                out += [hdr]
                for param, param_type, desc in others:
                    out += [fmt % (param.strip(), param_type)]
                    out += self._str_indent(desc, n_indent)
                out += [hdr]
            out += ['']
        return out
859086
def _full_class_name(obj):
    
    module = obj.__class__.__module__
    if module is None or module == str.__class__.__module__:
        return obj.__class__.__name__
    return module + "." + obj.__class__.__name__
1099593
def to_constant_name(desc) #:nodoc:
      name = case desc
        when String then desc.starts_with?('::') ? desc[2..-1] : desc
        when Symbol then desc.to_s
        when Module
          raise ArgumentError, "Anonymous modules have no name to be referenced by" if desc.name.blank?
          desc.name
        else raise TypeError, "Not a valid constant descriptor: #{desc.inspect}"
      end
    end
368715
def names(self):
        """"""
        #This is where the context information is extremely useful in 
        #limiting the extent of the search space we need to examine.
        if self._names is None:
            attribute = self.get_attribute()
            if self.context.module is not None:
                symbol = self.context.symbol
                fullsymbol = self.context.full_symbol
                self._names = self._complete_el(symbol, attribute, fullsymbol)
            else:
                self._names = []

        return self._names
415652
def resolve_name(name):
    

    parts = name.split('.')
    cursor = len(parts) - 1
    module_name = parts[:cursor]
    attr_name = parts[-1]

    while cursor > 0:
        try:
            ret = __import__('.'.join(module_name), fromlist=[attr_name])
            break
        except ImportError:
            if cursor == 0:
                raise
            cursor -= 1
            module_name = parts[:cursor]
            attr_name = parts[cursor]
            ret = ''

    for part in parts[cursor:]:
        try:
            ret = getattr(ret, part)
        except AttributeError:
            raise ImportError(name)

    return ret
204623
def _split_module_dicts():
    '''
    
    '''
    if not isinstance(__salt__, dict):
        return __salt__
    mod_dict = dict(__salt__)
    for module_func_name, mod_fun in six.iteritems(mod_dict.copy()):
        mod, fun = module_func_name.split('.', 1)
        if mod not in mod_dict:
            # create an empty object that we can add attributes to
            mod_dict[mod] = lambda: None
        setattr(mod_dict[mod], fun, mod_fun)
    return mod_dict
615244
def get_module_text(self, module_name, event):
        
        index = event.get("index")
        module_info = self.py3_wrapper.output_modules.get(module_name)
        output = module_info["module"].get_latest()
        full_text = u"".join([out["full_text"] for out in output])

        partial = None
        if index is not None:
            if isinstance(index, int):
                partial = output[index]
            else:
                for item in output:
                    if item.get("index") == index:
                        partial = item
                        break
        if partial:
            partial_text = partial["full_text"]
        else:
            partial_text = full_text
        return full_text, partial_text
1326997
def _find_symbol(self, module, name, fallback=None):
        
        if not hasattr(module, name) and fallback:
            return self._find_symbol(module, fallback, None)
        return getattr(module, name)