Return a tuple of Sphinx directive and roles.
979455
def _get_directives_and_roles_from_sphinx():
    """"""
    if SPHINX_INSTALLED:
        sphinx_directives = list(sphinx.domains.std.StandardDomain.directives)
        sphinx_roles = list(sphinx.domains.std.StandardDomain.roles)

        for domain in [sphinx.domains.c.CDomain,
                       sphinx.domains.cpp.CPPDomain,
                       sphinx.domains.javascript.JavaScriptDomain,
                       sphinx.domains.python.PythonDomain]:

            sphinx_directives += list(domain.directives) + [
                '{}:{}'.format(domain.name, item)
                for item in list(domain.directives)]

            sphinx_roles += list(domain.roles) + [
                '{}:{}'.format(domain.name, item)
                for item in list(domain.roles)]
    else:
        sphinx_roles = [
            'abbr',
            'command',
            'dfn',
            'doc',
            'download',
            'envvar',
            'file',
            'guilabel',
            'kbd',
            'keyword',
            'mailheader',
            'makevar',
            'manpage',
            'menuselection',
            'mimetype',
            'newsgroup',
            'option',
            'program',
            'py:func',
            'ref',
            'regexp',
            'samp',
            'term',
            'token']

        sphinx_directives = [
            'autosummary',
            'currentmodule',
            'centered',
            'c:function',
            'c:type',
            'include',
            'deprecated',
            'envvar',
            'glossary',
            'index',
            'no-code-block',
            'literalinclude',
            'hlist',
            'option',
            'productionlist',
            'py:function',
            'seealso',
            'toctree',
            'todo',
            'versionadded',
            'versionchanged']

    return (sphinx_directives, sphinx_roles)
229499
def _bse_cli_list_roles(args):
    ''''''
    all_roles = api.get_roles()

    if args.no_description:
        liststr = all_roles.keys()
    else:
        liststr = format_columns(all_roles.items())

    return '\n'.join(liststr)
777261
def directives():
    '''
    
    '''
    cmd = '{0} -L'.format(_detect_os())
    ret = {}
    out = __salt__['cmd.run'](cmd)
    out = out.replace('\n\t', '\t')
    for line in out.splitlines():
        if not line:
            continue
        comps = line.split('\t')
        desc = '\n'.join(comps[1:])
        ret[comps[0]] = desc
    return ret
252593
def from_dict(cls, d):
        """"""
        synopses = [tuple(map(Role.from_dict, synopsis))
                    for synopsis in d.get('synopses', [])]
        return cls(d['predicate'], tuple(d['parents']), synopses)
751983
def autodoc_tuple2doc(module):
    """"""
    modulename = module.__name__
    for membername, member in inspect.getmembers(module):
        for tuplename, descr in _name2descr.items():
            tuple_ = getattr(member, tuplename, None)
            if tuple_:
                logstring = f'{modulename}.{membername}.{tuplename}'
                if logstring not in _loggedtuples:
                    _loggedtuples.add(logstring)
                    lst = [f'\n\n\n    {descr}:']
                    if tuplename == 'CLASSES':
                        type_ = 'func'
                    else:
                        type_ = 'class'
                    for cls in tuple_:
                        lst.append(
                            f'      * '
                            f':{type_}:`{cls.__module__}.{cls.__name__}`'
                            f' {objecttools.description(cls)}')
                    doc = getattr(member, '__doc__')
                    if doc is None:
                        doc = ''
                    member.__doc__ = doc + '\n'.join(l for l in lst)
1006411
def get_role_types(self):
    
    resp = self._get_resource_root().get(self._path() + '/roleTypes')
    return resp[ApiList.LIST_KEY]
819078
def role_list(auth=None, **kwargs):
    '''
    
    '''
    cloud = get_operator_cloud(auth)
    kwargs = _clean_kwargs(**kwargs)
    return cloud.list_roles(**kwargs)
432106
def getcoordinates(self, tree, location):
        """"""
        return tuple(float(x) for x in tree.xpath('.//%s/*/text()' % location))
1182804
def sphinx_class(self):
        """"""
        classdoc = ':class:`{cls} <{pref}.{cls}>`'.format(
            cls=self.instance_class.__name__,
            pref=self.instance_class.__module__,
        )
        return classdoc
1368582
def roles_dict(path, repo_prefix="", repo_sub_dir=""):
    
    exit_if_path_not_found(path)

    aggregated_roles = {}

    roles = os.walk(path).next()[1]

    # First scan all directories
    for role in roles:
        for sub_role in roles_dict(path + "/" + role, repo_prefix="",
                                   repo_sub_dir=role + "/"):
            aggregated_roles[role + "/" + sub_role] = role + "/" + sub_role

    # Then format them
    for role in roles:
        if is_role(os.path.join(path, role)):
            if isinstance(role, basestring):
                role_repo = "{0}{1}".format(repo_prefix, role_name(role))

                aggregated_roles[role] = role_repo

    return aggregated_roles
82739
def _sphinx_build(self, kind):
        
        if kind not in ('html', 'latex'):
            raise ValueError('kind must be html or latex, '
                             'not {}'.format(kind))

        cmd = ['sphinx-build', '-b', kind]
        if self.num_jobs:
            cmd += ['-j', str(self.num_jobs)]
        if self.warnings_are_errors:
            cmd += ['-W', '--keep-going']
        if self.verbosity:
            cmd.append('-{}'.format('v' * self.verbosity))
        cmd += ['-d', os.path.join(BUILD_PATH, 'doctrees'),
                SOURCE_PATH, os.path.join(BUILD_PATH, kind)]
        return subprocess.call(cmd)
1047361
def get_roles_paths(self):
        '''
        
        '''
        roles  = []

        for path in self.config.ROLES:
            roles.append(self.get_absolute_path(path))

        return roles
1076990
def enable_sphinx_if_possible():
    """"""
    if SPHINX_INSTALLED:
        srcdir = tempfile.mkdtemp()
        outdir = os.path.join(srcdir, '_build')
        try:
            sphinx.application.Sphinx(srcdir=srcdir,
                                      confdir=None,
                                      outdir=outdir,
                                      doctreedir=outdir,
                                      buildername='dummy',
                                      status=None)
            yield
        finally:
            shutil.rmtree(srcdir)
    else:
        yield
163175
def role_list(profile=None, **connection_args):
    '''
    
    '''
    kstone = auth(profile, **connection_args)
    ret = {}
    for role in kstone.roles.list():
        ret[role.name] = dict((value, getattr(role, value)) for value in dir(role)
                              if not value.startswith('_') and
                              isinstance(getattr(role, value), (six.string_types, dict, bool)))
    return ret
90492
def _get_guidelines(self):
        
        return tuple([self._getitem__guidelines(i) for
                     i in range(self._len__guidelines())])
987611
def get_roles(server_context, container_path=None):
    
    url = server_context.build_url(security_controller, 'getRoles.api', container_path=container_path)
    return server_context.make_request(url, None)
100781
def get_queryset(self):
        ""
        qs = super().get_queryset()

        qs = qs.select_related('publication__series') \
                .prefetch_related('publication__roles__creator')

        return qs