Executed by Sphinx.

        :returns: Single DisqusNode instance with config values passed as arguments.
        :rtype: list
174238
def run(self):
        
        disqus_shortname = self.get_shortname()
        disqus_identifier = self.get_identifier()
        return [DisqusNode(disqus_shortname, disqus_identifier)]
1054125
def _build_intermediate_node_dict(self, config, node_dict, node_path,
                                      package_project_config, tags, fqn,
                                      agate_table, archive_config,
                                      column_name):
        
        # because this takes and returns dicts, subclasses can safely override
        # this and mutate its results using super() both before and after.
        if agate_table is not None:
            node_dict['agate_table'] = agate_table

        # Set this temporarily. Not the full config yet (as config() hasn't
        # been called from jinja yet). But the Var() call below needs info
        # about project level configs b/c they might contain refs.
        # TODO: Restructure this?
        config_dict = coalesce(archive_config, {})
        config_dict.update(config.config)

        empty = (
            'raw_sql' in node_dict and len(node_dict['raw_sql'].strip()) == 0
        )

        node_dict.update({
            'refs': [],
            'sources': [],
            'depends_on': {
                'nodes': [],
                'macros': [],
            },
            'unique_id': node_path,
            'empty': empty,
            'fqn': fqn,
            'tags': tags,
            'config': config_dict,
            # Set these temporarily so get_rendered() has access to a schema,
            # database, and alias.
            'schema': self.default_schema,
            'database': self.default_database,
            'alias': node_dict.get('name'),
        })

        # if there's a column, it should end up part of the ParsedNode
        if column_name is not None:
            node_dict['column_name'] = column_name

        return node_dict
1341705
def generate_docs(app):
    
    config = app.config
    config_dir = app.env.srcdir
    source_root = os.path.join(config_dir, config.apidoc_source_root)
    output_root = os.path.join(config_dir, config.apidoc_output_root)
    execution_dir = os.path.join(config_dir, '..')

    # Remove any files generated by earlier builds
    cleanup(output_root)

    command = ['sphinx-apidoc', '-f', '-o', output_root, source_root]
    # Exclude anything else we were specifically asked to
    for exclude in config.apidoc_exclude:
        command.append(os.path.join(source_root, exclude))
    process = Popen(command, cwd=execution_dir)
    process.wait()
463547
def sphinx_dir(self):
        
        # search for sphinx dir doc/ or docs/ under the first directory in
        # archive (e.g. spam-1.0.0/doc)
        candidate_dirs = self.archive.get_directories_re(
            settings.SPHINX_DIR_RE, full_path=True)

        # search for conf.py in the dirs (TODO: what if more are found?)
        for directory in candidate_dirs:
            contains_conf_py = self.archive.get_files_re(
                r'{0}/conf.py$'.format(re.escape(directory)), full_path=True)
            in_tests = 'tests' in directory.split(os.sep)
            if contains_conf_py and not in_tests:
                return directory
676642
def parse_sphinx_docopts(index):
    

    pos = index.find('var DOCUMENTATION_OPTIONS')
    if pos < 0:
        raise ValueError('Documentation options could not be found in index.')
    pos = index.find('{', pos)
    if pos < 0:
        raise ValueError('Documentation options could not be found in index.')
    endpos = index.find('};', pos)
    if endpos < 0:
        raise ValueError('Documentation options could not be found in index.')
    block = index[pos + 1:endpos].strip()
    docopts = {}
    for line in block.splitlines():
        key, value = line.split(':', 1)
        key = key.strip().strip('"')

        value = value.strip()
        if value[-1] == ',':
            value = value[:-1].rstrip()
        if value[0] in '"\'':
            value = value[1:-1]
        elif value == 'false':
            value = False
        elif value == 'true':
            value = True
        else:
            try:
                value = int(value)
            except ValueError:
                # In Sphinx 1.7.5, URL_ROOT is a JavaScript fragment.
                # Ignoring this entry since URL_ROOT is not used
                # elsewhere.
                # https://github.com/sphinx-gallery/sphinx-gallery/issues/382
                continue

        docopts[key] = value

    return docopts
6642
def __generate_dependency_tree(self):
        
        dependency_dict = {}
        for s in self.manifest.sections():
            if s != "config":
                if self.manifest.has_option(s, 'depends'):
                    dependency_list = [d.strip() for d in re.split('\n|,', self.manifest.get(s, 'depends'))]
                    dependency_dict[s] = dependency_list
                else:
                    dependency_dict[s] = []
        try:
            return DependencyTree(dependency_dict)
        except DependencyTreeException:
            dte = sys.exc_info()[1]
            raise ManifestException("Dependency tree for manifest is invalid! %s" % str(dte))
873030
def convert_disp_quote_elements(self):
        
        for disp_quote in self.main.getroot().findall('.//disp-quote'):
            if disp_quote.getparent().tag == 'p':
                elevate_element(disp_quote)
            disp_quote.tag = 'div'
            disp_quote.attrib['class'] = 'disp-quote'
513026
def cfg2dict(cfg):
    
    d = {}
    for section in cfg.sections():
        d[section] = dict(cfg.items(section))
    return d
431401
def nsDefs(self):
        
        ret = libxml2mod.xmlNodeGetNsDefs(self._o)
        if ret is None:return None
        __tmp = xmlNs(_obj=ret)
        return __tmp
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)
837588
def to_etree(self):
        
        attribs = {
            '{{{pre}}}type'.format(pre=NAMESPACES['xsi']): self.xsi_type,
            'namespace': self.namespace, 'name': self.name,
            'value': self.hexvalue, 'valueString': self.value}
        non_empty_attribs = {key: val for (key, val) in attribs.items()
                             if val is not None}
        E = ElementMaker()
        return E('labels', non_empty_attribs)
11872
def fixup_parse_tree(cls_node):
    
    for node in cls_node.children:
        if node.type == syms.suite:
            # already in the preferred format, do nothing
            return

    # !%@#! oneliners have no suite node, we have to fake one up
    for i, node in enumerate(cls_node.children):
        if node.type == token.COLON:
            break
    else:
        raise ValueError("No class suite and no ':'!")

    # move everything into a suite node
    suite = Node(syms.suite, [])
    while cls_node.children[i+1:]:
        move_node = cls_node.children[i+1]
        suite.append_child(move_node.clone())
        move_node.remove()
    cls_node.append_child(suite)
    node = suite
972100
def disqus_recent_comments(context, shortname='', num_items=5, excerpt_length=200, hide_avatars=0, avatar_size=32):
    
    shortname = getattr(settings, 'DISQUS_WEBSITE_SHORTNAME', shortname)

    return {
        'shortname': shortname,
        'num_items': num_items,
        'hide_avatars': hide_avatars,
        'avatar_size': avatar_size,
        'excerpt_length': excerpt_length,
        'config': get_config(context),
    }
130623
def transcripts(self, contig=None, strand=None):
        
        transcript_ids = self.transcript_ids(contig=contig, strand=strand)
        return [
            self.transcript_by_id(transcript_id)
            for transcript_id in transcript_ids
        ]
163853
def execute_by_options(args):
    
    if args['subcommand'] == 'sphinx':
        s = Sphinx(proj_info)
        if args['quickstart']:
            s.quickstart()
        elif args['gen_code_api']:
            s.gen_code_api()
        elif args['rst2html']:
            s.rst2html()
        pass
    elif args['subcommand'] == 'offline_dist':
        pod = PyOfflineDist()
        if args['freeze_deps']:
            pod.freeze_deps()
        elif args['download_deps']:
            pod.download_deps()
        elif args['install_deps']:
            pod.install_deps()
        elif args['clean_deps']:
            pod.clean_deps()
        elif args['mkbinary']:
            pod.pyinstaller_mkbinary(args['mkbinary'])
        elif args['clean_binary']:
            pod.clean_binary()

    pass
1180862
def ConfigSectionMap(Config, section):
    
    cfg = {}
    options = Config.options(section)
    for option in options:
        try:
            cfg[option] = Config.get(section, option)
            if cfg[option] == -1:
                logging.debug("skip: {0}".format(option))
        except:
            logging.debug("exception on {0}!".format(option))
            cfg[option] = None
    return cfg
32508
def configuration(self):
        
        if self._configuration is None:
            self._configuration = ConfigurationList(self)
        return self._configuration