Get (filtered) public/total members of the module or package `mod`.


    Returns:
        lists `public` and `items`. The lists contains the public and private +
        public members, as strings.
778028
def _get_members(
        mod, typ=None, include_imported=False, out_format='names',
        in_list=None, known_refs=None):
    
    roles = {'function': 'func', 'module': 'mod', 'class': 'class',
             'exception': 'exc', 'data': 'data'}
    # not included, because they cannot occur at modul level:
    #   'method': 'meth', 'attribute': 'attr', 'instanceattribute': 'attr'

    out_formats = ['names', 'fullnames', 'refs', 'table']
    if out_format not in out_formats:
        raise ValueError("out_format %s not in %r" % (out_format, out_formats))

    def check_typ(typ, mod, member):
        """Check if mod.member is of the desired typ"""
        if inspect.ismodule(member):
            return False
        documenter = _get_documenter(APP, member, mod)
        if typ is None:
            return True
        if typ == getattr(documenter, 'objtype', None):
            return True
        if hasattr(documenter, 'directivetype'):
            return roles[typ] == getattr(documenter, 'directivetype')

    def is_local(mod, member, name):
        """Check whether mod.member is defined locally in module mod"""
        if hasattr(member, '__module__'):
            return getattr(member, '__module__') == mod.__name__
        else:
            # we take missing __module__ to mean the member is a data object
            # it is recommended to filter data by e.g. __all__
            return True

    if typ is not None and typ not in roles:
        raise ValueError("typ must be None or one of %s"
                         % str(list(roles.keys())))
    items = []
    public = []
    if known_refs is None:
        known_refs = {}
    elif isinstance(known_refs, str):
        known_refs = getattr(mod, known_refs)
    if in_list is not None:
        try:
            in_list = getattr(mod, in_list)
        except AttributeError:
            in_list = []
    for name in dir(mod):
        if name.startswith('__'):
            continue
        try:
            member = safe_getattr(mod, name)
        except AttributeError:
            continue
        if check_typ(typ, mod, member):
            if in_list is not None:
                if name not in in_list:
                    continue
            if not (include_imported or is_local(mod, member, name)):
                continue
            if out_format in ['table', 'refs']:
                documenter = _get_documenter(APP, member, mod)
                role = roles.get(documenter.objtype, 'obj')
                ref = _get_member_ref_str(
                        name, obj=member, role=role,
                        known_refs=known_refs)
            if out_format == 'table':
                docsummary = extract_summary(member)
                items.append((ref, docsummary))
                if not name.startswith('_'):
                    public.append((ref, docsummary))
            elif out_format == 'refs':
                items.append(ref)
                if not name.startswith('_'):
                    public.append(ref)
            elif out_format == 'fullnames':
                fullname = _get_fullname(name, obj=member)
                items.append(fullname)
                if not name.startswith('_'):
                    public.append(fullname)
            else:
                assert out_format == 'names', str(out_format)
                items.append(name)
                if not name.startswith('_'):
                    public.append(name)
    if out_format == 'table':
        return _assemble_table(public), _assemble_table(items)
    else:
        return public, items
27441
def get_submodule_list(package_path: str) -> Tuple[ModuleDescription, ...]:
    """"""
    pkg = importlib.import_module(package_path)

    subs = (
        ModuleDescription(
            name=modname,
            path="{}.{}".format(package_path, modname), is_package=ispkg
        )
        for importer, modname, ispkg in pkgutil.iter_modules(pkg.__path__)
    )
    result = tuple(subs)
    return result
986270
def _get_package_data():
    
    moddata = []
    modlist = (
        "click",
        "configobj",
        "cryptography",
        "globus_cli",
        "globus_sdk",
        "jmespath",
        "requests",
        "six",
    )
    if verbosity() < 2:
        modlist = ("globus_cli", "globus_sdk", "requests")

    for mod in modlist:
        cur = [mod]
        try:
            loaded_mod = __import__(mod)
        except ImportError:
            loaded_mod = None

        for attr in ("__version__", "__file__", "__path__"):
            # if loading failed, be sure to pad with error messages
            if loaded_mod is None:
                cur.append("[import failed]")
                continue

            try:
                attrval = getattr(loaded_mod, attr)
            except AttributeError:
                attrval = ""
            cur.append(attrval)
        moddata.append(cur)

    return moddata
1238793
def get_tops(extra_mods='', so_mods=''):
    '''
    
    '''
    tops = []
    for mod in [salt, jinja2, yaml, tornado, msgpack, certifi, singledispatch, concurrent,
                singledispatch_helpers, ssl_match_hostname, markupsafe, backports_abc]:
        if mod:
            log.debug('Adding module to the tops: "%s"', mod.__name__)
            _add_dependency(tops, mod)

    for mod in [m for m in extra_mods.split(',') if m]:
        if mod not in locals() and mod not in globals():
            try:
                locals()[mod] = __import__(mod)
                moddir, modname = os.path.split(locals()[mod].__file__)
                base, _ = os.path.splitext(modname)
                if base == '__init__':
                    tops.append(moddir)
                else:
                    tops.append(os.path.join(moddir, base + '.py'))
            except ImportError as err:
                log.exception(err)
                log.error('Unable to import extra-module "%s"', mod)

    for mod in [m for m in so_mods.split(',') if m]:
        try:
            locals()[mod] = __import__(mod)
            tops.append(locals()[mod].__file__)
        except ImportError as err:
            log.exception(err)
            log.error('Unable to import so-module "%s"', mod)

    return tops
506133
def get_hidden_members(self, user=None):
        
        hidden_members = []
        for member in self.members.all():
            show = False
            if member.can_view_eighth:
                show = member.can_view_eighth

            if not show and user and user.is_eighth_admin:
                show = True
            if not show and user and user.is_teacher:
                show = True
            if not show and member == user:
                show = True

            if not show:
                hidden_members.append(member)

        return hidden_members
968822
def submodules(self):
        
        p = lambda o: isinstance(o, Module) and self._docfilter(o)
        return sorted(filter(p, self.doc.values()))
1273066
def public(self, *args, **kwargs):
        
        kwargs['public'] = True
        return self.filter(*args, **kwargs)
826450
def get_module_owned_functions(module):
    
    import utool as ut
    list_ = []
    for key, val in ut.iter_module_doctestable(module):
        belongs = False
        if hasattr(val, '__module__'):
            belongs = val.__module__ == module.__name__
        elif hasattr(val, 'func_globals'):
            belongs = val.func_globals['__name__'] == module.__name__
        if belongs:
            list_.append(val)
    return list_
1137416
def _get_loaded_modules():
        """"""
        output = subprocess.check_output(['apache2ctl', '-M'])
        if six.PY3:
            output = output.decode('utf-8')
        modules = []
        for line in output.splitlines():
            # Each line of the enabled module output looks like:
            #  module_name (static|shared)
            # Plus a header line at the top of the output which is stripped
            # out by the regex.
            matcher = re.search(r'^ (\S*)_module (\S*)', line)
            if matcher:
                modules.append(matcher.group(1))
        return modules
418051
public static DataDescriptor[] listMembers() {
        if (disabled)
            return null;
        ModuleItem[] modItems = moduleRoot.children();
        if (modItems == null)
            return null;
        DataDescriptor[] res = new DataDescriptor[modItems.length];
        for (int i = 0; i < res.length; i++) {
            // root level
            res[i] = new DataDescriptor(new String[] { modItems[i].getInstance().getName() }); // replaced getModuleID: customPMI
        }
        return res;
    }
450937
def get_collectors_from_module(mod):
    
    for attrname in dir(mod):
        attr = getattr(mod, attrname)
        # Only attempt to load classes that are infact classes
        # are Collectors but are not the base Collector class
        if ((inspect.isclass(attr) and
             issubclass(attr, Collector) and
             attr != Collector)):
            if attrname.startswith('parent_'):
                continue
            # Get class name
            fqcn = '.'.join([mod.__name__, attrname])
            try:
                # Load Collector class
                cls = load_dynamic_class(fqcn, Collector)
                # Add Collector class
                yield cls.__name__, cls
            except Exception:
                # Log error
                logger.error(
                    "Failed to load Collector: %s. %s",
                    fqcn, traceback.format_exc())
                continue
905357
def get_members(self, role=github.GithubObject.NotSet):
        
        assert role is github.GithubObject.NotSet or isinstance(role, (str, unicode)), role
        url_parameters = dict()
        if role is not github.GithubObject.NotSet:
            assert role in ['member', 'maintainer', 'all']
            url_parameters["role"] = role
        return github.PaginatedList.PaginatedList(
            github.NamedUser.NamedUser,
            self._requester,
            self.url + "/members",
            url_parameters
        )
13524
def all_to_public(self):
        
        if "private" not in self.modifiers:
            def public_collection(attribute):
                for key in self.collection(attribute):
                    if key not in self.publics:
                        self.publics[key.lower()] = 1
            public_collection("members")
            public_collection("types")
            public_collection("executables")
1316576
def get_viewable_members(self, user=None):
        
        members = []
        for member in self.members.all():
            show = False
            if member.can_view_eighth:
                show = member.can_view_eighth

            if not show and user and user.is_eighth_admin:
                show = True
            if not show and user and user.is_teacher:
                show = True
            if not show and member == user:
                show = True

            if show:
                members.append(member)

        return sorted(members, key=lambda u: (u.last_name, u.first_name))
1142480
def members(self):
        
        if self._members is None:
            self._members = MemberList(
                self._version,
                service_sid=self._solution['service_sid'],
                channel_sid=self._solution['sid'],
            )
        return self._members
823746
def has_in_public_members(self, public_member):
        
        assert isinstance(public_member, github.NamedUser.NamedUser), public_member
        status, headers, data = self._requester.requestJson(
            "GET",
            self.url + "/public_members/" + public_member._identity
        )
        return status == 204
708798
def list_public_methods(obj: Any):
    
    return [member for member in dir(obj)
            if not member.startswith('_') and
            callable(getattr(obj, member))]