rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
text = utils.unescape(text) | text = utils.unescape(text)[1:] | def __call__(self, typ, rawtext, text, lineno, inliner, options={}, content=[]): env = inliner.document.settings.env if not typ: typ = env.config.default_role else: typ = typ.lower() if ':' not in typ: domain, role = '', typ classes = ['xref', role] else: domain, role = typ.split(':', 1) classes = ['xref', domain, '%s-... |
text, tgt = self._fix_parens(env, False, text[1:], "") | text, tgt = self._fix_parens(env, False, text, "") | def __call__(self, typ, rawtext, text, lineno, inliner, options={}, content=[]): env = inliner.document.settings.env if not typ: typ = env.config.default_role else: typ = typ.lower() if ':' not in typ: domain, role = '', typ classes = ['xref', role] else: domain, role = typ.split(':', 1) classes = ['xref', domain, '%s-... |
def fix_fragment(self, match): """Return a href attribute with colons replaced by hyphens. """ return match.group(1) + match.group(2).replace(':', '-') | def fix_fragment(self, prefix, fragment): """Return a href/id attribute with colons replaced by hyphens. """ return prefix + fragment.replace(':', '-') | def fix_fragment(self, match): """Return a href attribute with colons replaced by hyphens. """ return match.group(1) + match.group(2).replace(':', '-') |
node['refuri'] = self.fix_fragment(m) | node['refuri'] = self.fix_fragment(m.group(1), m.group(2)) | def fix_ids(self, tree): """Replace colons with hyphens in href and id attributes. Some readers crash because they interpret the part as a transport protocol specification. """ for node in tree.traverse(nodes.reference): if 'refuri' in node: m = _refuri_re.match(node['refuri']) if m: node['refuri'] = self.fix_fragment(... |
node['refid'] = node['refid'].replace(':', '-') | node['refid'] = self.fix_fragment('', node['refid']) | def fix_ids(self, tree): """Replace colons with hyphens in href and id attributes. Some readers crash because they interpret the part as a transport protocol specification. """ for node in tree.traverse(nodes.reference): if 'refuri' in node: m = _refuri_re.match(node['refuri']) if m: node['refuri'] = self.fix_fragment(... |
newids.append(id.replace(':', '-')) | newids.append(self.fix_fragment('', id)) | def fix_ids(self, tree): """Replace colons with hyphens in href and id attributes. Some readers crash because they interpret the part as a transport protocol specification. """ for node in tree.traverse(nodes.reference): if 'refuri' in node: m = _refuri_re.match(node['refuri']) if m: node['refuri'] = self.fix_fragment(... |
links[i] = self.fix_fragment(m) | links[i] = self.fix_fragment(m.group(1), m.group(2)) | def fix_genindex(self, tree): """Fix href attributes for genindex pages. """ # XXX: modifies tree inline # Logic modeled from themes/basic/genindex.html for key, columns in tree: for entryname, (links, subitems) in columns: for (i, link) in enumerate(links): m = _refuri_re.match(link) if m: links[i] = self.fix_fragment... |
subentrylinks[i] = self.fix_fragment(m) | subentrylinks[i] = \ self.fix_fragment(m.group(1), m.group(2)) | def fix_genindex(self, tree): """Fix href attributes for genindex pages. """ # XXX: modifies tree inline # Logic modeled from themes/basic/genindex.html for key, columns in tree: for entryname, (links, subitems) in columns: for (i, link) in enumerate(links): m = _refuri_re.match(link) if m: links[i] = self.fix_fragment... |
return unicode(self.encode('utf-8')) | return unicode(self).encode('utf-8') | def __str__(self): return unicode(self.encode('utf-8')) |
'\\emph{\\DUspan{accelerator}{F}oo -\\&- \\DUspan{accelerator}{B}ar}') | r'\emph{\DUspan{accelerator}{F}oo -\&- \DUspan{accelerator}{B}ar}') | def test_inline(): # correct interpretation of code with whitespace _html = ('<p><tt class="(samp )?docutils literal"><span class="pre">' 'code</span> <span class="pre">sample</span></tt></p>') yield verify_re, '``code sample``', _html, r'\\code{code sample}' yield verify_re, ':samp:`code sample`', _h... |
comment_urls = [ ('addCommentURL', 'add_comment'), ('getCommentsURL', 'get_comments'), ('processVoteURL', 'process_vote'), ('acceptCommentURL', 'accept_comment'), ('rejectCommentURL', 'reject_comment'), ('deleteCommentURL', 'delete_comment') ] static_urls = [ ('commentImage', 'comment.png'), ('loadingImage', 'ajax-load... | def _make_base_comment_options(self): """Helper method to create the part of the COMMENT_OPTIONS javascript that remains the same throughout the lifetime of the :class:`~sphinx.websupport.WebSupport` object. """ comment_urls = [ ('addCommentURL', 'add_comment'), ('getCommentsURL', 'get_comments'), ('processVoteURL', 'p... | |
for key, value in comment_urls: self.base_comment_opts[key] = posixpath.join(self.docroot, value) for key, value in static_urls: self.base_comment_opts[key] = posixpath.join(self.staticdir, value) | if self.docroot is not '': comment_urls = [ ('addCommentURL', 'add_comment'), ('getCommentsURL', 'get_comments'), ('processVoteURL', 'process_vote'), ('acceptCommentURL', 'accept_comment'), ('rejectCommentURL', 'reject_comment'), ('deleteCommentURL', 'delete_comment') ] for key, value in comment_urls: self.base_comment... | def _make_base_comment_options(self): """Helper method to create the part of the COMMENT_OPTIONS javascript that remains the same throughout the lifetime of the :class:`~sphinx.websupport.WebSupport` object. """ comment_urls = [ ('addCommentURL', 'add_comment'), ('getCommentsURL', 'get_comments'), ('processVoteURL', 'p... |
try: fname, outfn = render_dot(self, code, options, 'png', prefix) | format = self.builder.config.graphviz_output_format try: if format not in ('png', 'svg'): raise GraphvizError("graphviz_output_format must be one of 'png', " "'svg', but is %r" % format) fname, outfn = render_dot(self, code, options, format, prefix) | def render_dot_html(self, node, code, options, prefix='graphviz', imgcls=None): try: fname, outfn = render_dot(self, code, options, 'png', prefix) except GraphvizError, exc: self.builder.warn('dot code %r: ' % code + str(exc)) raise nodes.SkipNode self.body.append(self.starttag(node, 'p', CLASS='graphviz')) if fname i... |
mapfile = open(outfn + '.map', 'rb') try: imgmap = mapfile.readlines() finally: mapfile.close() imgcss = imgcls and 'class="%s"' % imgcls or '' if len(imgmap) == 2: self.body.append('<img src="%s" alt="%s" %s/>\n' % (fname, self.encode(code).strip(), imgcss)) | if format == 'svg': svgtag = get_svg_tag(fname, outfn, imgcls) self.body.append(svgtag) | def render_dot_html(self, node, code, options, prefix='graphviz', imgcls=None): try: fname, outfn = render_dot(self, code, options, 'png', prefix) except GraphvizError, exc: self.builder.warn('dot code %r: ' % code + str(exc)) raise nodes.SkipNode self.body.append(self.starttag(node, 'p', CLASS='graphviz')) if fname i... |
mapname = mapname_re.match(imgmap[0]).group(1) self.body.append('<img src="%s" alt="%s" usemap=" (fname, self.encode(code).strip(), mapname, imgcss)) self.body.extend(imgmap) | mapfile = open(outfn + '.map', 'rb') try: imgmap = mapfile.readlines() finally: mapfile.close() imgcss = imgcls and 'class="%s"' % imgcls or '' if len(imgmap) == 2: self.body.append('<img src="%s" alt="%s" %s/>\n' % (fname, self.encode(code).strip(), imgcss)) else: mapname = mapname_re.match(imgmap[0]).group(1) self.... | def render_dot_html(self, node, code, options, prefix='graphviz', imgcls=None): try: fname, outfn = render_dot(self, code, options, 'png', prefix) except GraphvizError, exc: self.builder.warn('dot code %r: ' % code + str(exc)) raise nodes.SkipNode self.body.append(self.starttag(node, 'p', CLASS='graphviz')) if fname i... |
self.body.append('\\hyperlink{%s}{' % uri[1:]) | self.body.append('\\hyperlink{%s}{' % self.idescape(uri[1:])) | def visit_reference(self, node): uri = node.get('refuri', '') if self.in_title or not uri: self.context.append('') elif uri.startswith('mailto:') or uri.startswith('http:') or \ uri.startswith('https:') or uri.startswith('ftp:'): self.body.append('\\href{%s}{' % self.encode_uri(uri)) self.context.append('}') elif uri.s... |
self.body.append('\\hyperlink{%s}{' % targetname) | self.body.append('\\hyperlink{%s}{' % self.idescape(targetname)) | def visit_reference(self, node): uri = node.get('refuri', '') if self.in_title or not uri: self.context.append('') elif uri.startswith('mailto:') or uri.startswith('http:') or \ uri.startswith('https:') or uri.startswith('ftp:'): self.body.append('\\href{%s}{' % self.encode_uri(uri)) self.context.append('}') elif uri.s... |
return text.ljust(_tw + len(text) - len(_strip_core_re.sub('', text))) + '\r' | return text.ljust(_tw + len(text) - len(_ansi_re.sub('', text))) + '\r' | def term_width_line(text): if not codes: # if no coloring, don't output fancy backspaces return text + '\n' else: # codes are not displayed and must be taken into account by introducing the correction factor return text.ljust(_tw + len(text) - len(_strip_core_re.sub('', text))) + '\r' |
shutil.move(path.join(self.outdir, '_images'), path.join(self.app.builddir, self.app.staticdir, '_images')) shutil.move(path.join(self.outdir, '_static'), path.join(self.app.builddir, self.app.staticdir, '_static')) | directories = ['_images', '_static'] for directory in directories: try: shutil.move(path.join(self.outdir, directory), path.join(self.app.builddir, self.app.staticdir, directory)) except IOError: pass | def handle_finish(self): StandaloneHTMLBuilder.handle_finish(self) shutil.move(path.join(self.outdir, '_images'), path.join(self.app.builddir, self.app.staticdir, '_images')) shutil.move(path.join(self.outdir, '_static'), path.join(self.app.builddir, self.app.staticdir, '_static')) for f in glob(path.join(self.doctreed... |
self._list_counter = -1 | self.list_counter.append(-1) | def visit_bullet_list(self, node): self._list_counter = -1 |
pass | self.list_counter.pop() | def depart_bullet_list(self, node): pass |
self._list_counter = 0 | self.list_counter.append(0) | def visit_enumerated_list(self, node): self._list_counter = 0 |
pass | self.list_counter.pop() | def depart_enumerated_list(self, node): pass |
self._list_counter = -2 | self.list_counter.append(-2) | def visit_definition_list(self, node): self._list_counter = -2 |
pass | self.list_counter.pop() | def depart_definition_list(self, node): pass |
if self._list_counter == -1: | if self.list_counter[-1] == -1: | def visit_list_item(self, node): if self._list_counter == -1: # bullet list self.new_state(2) elif self._list_counter == -2: # definition list pass else: # enumerated list self._list_counter += 1 self.new_state(len(str(self._list_counter)) + 2) |
elif self._list_counter == -2: | elif self.list_counter[-1] == -2: | def visit_list_item(self, node): if self._list_counter == -1: # bullet list self.new_state(2) elif self._list_counter == -2: # definition list pass else: # enumerated list self._list_counter += 1 self.new_state(len(str(self._list_counter)) + 2) |
self._list_counter += 1 self.new_state(len(str(self._list_counter)) + 2) | self.list_counter[-1] += 1 self.new_state(len(str(self.list_counter[-1])) + 2) | def visit_list_item(self, node): if self._list_counter == -1: # bullet list self.new_state(2) elif self._list_counter == -2: # definition list pass else: # enumerated list self._list_counter += 1 self.new_state(len(str(self._list_counter)) + 2) |
if self._list_counter == -1: | if self.list_counter[-1] == -1: | def depart_list_item(self, node): if self._list_counter == -1: self.end_state(first='* ', end=None) elif self._list_counter == -2: pass else: self.end_state(first='%s. ' % self._list_counter, end=None) |
elif self._list_counter == -2: | elif self.list_counter[-1] == -2: | def depart_list_item(self, node): if self._list_counter == -1: self.end_state(first='* ', end=None) elif self._list_counter == -2: pass else: self.end_state(first='%s. ' % self._list_counter, end=None) |
self.end_state(first='%s. ' % self._list_counter, end=None) | self.end_state(first='%s. ' % self.list_counter[-1], end=None) | def depart_list_item(self, node): if self._list_counter == -1: self.end_state(first='* ', end=None) elif self._list_counter == -2: pass else: self.end_state(first='%s. ' % self._list_counter, end=None) |
modname = signode['module'] | modname = signode.get('module') | def has_tag(modname, fullname, docname): entry = env._viewcode_modules.get(modname, None) if entry is None: try: analyzer = ModuleAnalyzer.for_module(modname) except Exception: env._viewcode_modules[modname] = False return analyzer.find_tags() entry = analyzer.code.decode(analyzer.encoding), analyzer.tags, {} env._view... |
encoding = sys.getdefaultencoding() | def parse(self): """Parse the generated source tokens.""" if self.parsetree is not None: return self.tokenize() try: self.parsetree = pydriver.parse_tokens(self.tokens) except parse.ParseError, err: raise PycodeError('parsing failed', err) # find the source code encoding encoding = sys.getdefaultencoding() comments = s... | |
encoding = match.group(1) | self.encoding = match.group(1) | def parse(self): """Parse the generated source tokens.""" if self.parsetree is not None: return self.tokenize() try: self.parsetree = pydriver.parse_tokens(self.tokens) except parse.ParseError, err: raise PycodeError('parsing failed', err) # find the source code encoding encoding = sys.getdefaultencoding() comments = s... |
self.encoding = encoding | def parse(self): """Parse the generated source tokens.""" if self.parsetree is not None: return self.tokenize() try: self.parsetree = pydriver.parse_tokens(self.tokens) except parse.ParseError, err: raise PycodeError('parsing failed', err) # find the source code encoding encoding = sys.getdefaultencoding() comments = s... | |
signode += addnodes.desc_type('', '') | signode += addnodes.desc_annotation('class ', 'class ') | def describe_signature(self, signode, typename): signode += addnodes.desc_type('', '') self.attach_type(signode, typename) return typename |
elif self.objtype == 'var': return _('%s (C++ variable)') % name | def get_index_text(self, name): if self.objtype == 'member': return _('%s (C++ member)') % name elif self.objtype == 'type': return _('%s (C++ type)') % name elif self.objtype == 'var': return _('%s (C++ variable)') % name return '' | |
signode += addnodes.desc_type('', '') | def describe_signature(self, signode, (rv, var)): signode += addnodes.desc_type('', '') self.attach_type(signode, rv) signode += nodes.Text(' ') self._attach_var(signode, var) return var.name | |
signode += addnodes.desc_type('', '') | def describe_signature(self, signode, (rv, func)): signode += addnodes.desc_type('', '') self.attach_type(signode, rv) signode += nodes.Text(u' ') self._attach_function(signode, func) return func.name | |
'type': ObjType(l_('C++ type'), 'type'), 'var': ObjType(l_('C++ variable'), 'data'), | 'type': ObjType(l_('C++ type'), 'type') | def describe_signature(self, signode, (rv, func)): signode += addnodes.desc_type('', '') self.attach_type(signode, rv) signode += nodes.Text(u' ') self._attach_function(signode, func) return func.name |
'type': CPPTypedObject, 'var': CPPTypedObject, | 'type': CPPTypedObject | def describe_signature(self, signode, (rv, func)): signode += addnodes.desc_type('', '') self.attach_type(signode, rv) signode += nodes.Text(u' ') self._attach_function(signode, func) return func.name |
'macro': XRefRole(), 'data': XRefRole(), 'type': XRefRole(), | 'type': XRefRole() | def describe_signature(self, signode, (rv, func)): signode += addnodes.desc_type('', '') self.attach_type(signode, rv) signode += nodes.Text(u' ') self._attach_function(signode, func) return func.name |
target = target.rstrip(' *') | target = target.rstrip(' *&') | def resolve_xref(self, env, fromdocname, builder, typ, target, node, contnode): # strip pointer asterisk target = target.rstrip(' *') if target not in self.data['objects']: return None obj = self.data['objects'][target] return make_refnode(builder, fromdocname, obj[0], target, contnode, target) |
target, contnode, target) | objtype + '-' + target, contnode, target + ' ' + objtype) | def resolve_xref(self, env, fromdocname, builder, typ, target, node, contnode): objects = self.data['objects'] objtypes = self.objtypes_for_role(typ) for objtype in objtypes: if (objtype, target) in objects: return make_refnode(builder, fromdocname, objects[objtype, target], target, contnode, target) |
for index in self.domain_indices: item = section_template % {'title': index[2], 'ref': '%s-%s.html' % index[0:2]} | for indexname, indexcls, content, collapse in self.domain_indices: item = section_template % {'title': indexcls.localname, 'ref': '%s.html' % indexname} | def build_qhp(self, outdir, outname): self.info('writing project file...') |
return text.ljust(_tw) + '\r' | return text.ljust(_tw + len(text) - len(_strip_core_re.sub('', text))) + '\r' | def term_width_line(text): if not codes: # if no coloring, don't output fancy backspaces return text + '\n' else: return text.ljust(_tw) + '\r' |
raise SkipTest( 'test is broken, relies on order of test execution and numeric ids') accepted = support.add_comment('Accepted Comment', node_id=3, | session = Session() nodes = session.query(Node).all() node = nodes[7] session.close() accepted = support.add_comment('Accepted Comment', node_id=node.id, | def test_moderation(support): raise SkipTest( 'test is broken, relies on order of test execution and numeric ids') accepted = support.add_comment('Accepted Comment', node_id=3, displayed=False) rejected = support.add_comment('Rejected comment', node_id=3, displayed=False) # Make sure the moderation_callback is called. ... |
rejected = support.add_comment('Rejected comment', node_id=3, | rejected = support.add_comment('Rejected comment', node_id=node.id, | def test_moderation(support): raise SkipTest( 'test is broken, relies on order of test execution and numeric ids') accepted = support.add_comment('Accepted Comment', node_id=3, displayed=False) rejected = support.add_comment('Rejected comment', node_id=3, displayed=False) # Make sure the moderation_callback is called. ... |
comments = support.get_data(3)['comments'] assert len(comments) == 1 comments = support.get_data(3, moderator=True)['comments'] | comments = support.get_data(node.id)['comments'] assert len(comments) == 1 comments = support.get_data(node.id, moderator=True)['comments'] | def test_moderation(support): raise SkipTest( 'test is broken, relies on order of test execution and numeric ids') accepted = support.add_comment('Accepted Comment', node_id=3, displayed=False) rejected = support.add_comment('Rejected comment', node_id=3, displayed=False) # Make sure the moderation_callback is called. ... |
if (self.objtype, name) in objects: | key = (self.objtype, name) if key in objects: | def add_target_and_index(self, name, sig, signode): if name not in self.state.document.ids: signode['names'].append(name) signode['ids'].append(name) signode['first'] = (not self.names) self.state.document.note_explicit_target(signode) |
self.env.doc2path(objects[name][0]), | self.env.doc2path(objects[key]), | def add_target_and_index(self, name, sig, signode): if name not in self.state.document.ids: signode['names'].append(name) signode['ids'].append(name) signode['first'] = (not self.names) self.state.document.note_explicit_target(signode) |
objects[self.objtype, name] = self.env.docname | objects[key] = self.env.docname | def add_target_and_index(self, name, sig, signode): if name not in self.state.document.ids: signode['names'].append(name) signode['ids'].append(name) signode['first'] = (not self.names) self.state.document.note_explicit_target(signode) |
if not (typ, target) in objects: return None return make_refnode(builder, fromdocname, objects[typ, target], target, contnode, target) | objtypes = self.objtypes_for_role(typ) for objtype in objtypes: if (objtype, target) in objects: return make_refnode(builder, fromdocname, objects[objtype, target], target, contnode, target) | def resolve_xref(self, env, fromdocname, builder, typ, target, node, contnode): objects = self.data['objects'] |
def _fixtext(self, text): try: return text.encode("ascii") except UnicodeError: | if sys.version_info >= (3, 0): def _fixtext(self, text): | def _fixtext(self, text): # convert text string to ascii, if possible try: return text.encode("ascii") except UnicodeError: return text |
self.implementation.dump(context, f, 2) | self.implementation.dump(context, f, *self.additional_dump_args) | def dump_context(self, context, filename): if self.implementation_dumps_unicode: f = codecs.open(filename, 'w', encoding='utf-8') else: f = open(filename, 'wb') try: # XXX: the third argument is pickle-specific! self.implementation.dump(context, f, 2) finally: f.close() |
qdirs = enumerate(path.join(relativeroot, dir).replace(os.path.sep, SEP) for dir in dirs) qfiles = enumerate(path.join(relativeroot, file).replace(os.path.sep, SEP) for file in files) | qdirs = enumerate(path.join(relativeroot, dn).replace(os.path.sep, SEP) for dn in dirs) qfiles = enumerate(path.join(relativeroot, fn).replace(os.path.sep, SEP) for fn in files) | def get_matching_files(dirname, exclude_patterns=()): """ Get all file names in a directory, recursively. Exclude files and dirs matching a pattern in *exclude_patterns*. """ # dirname is a normalized absolute path. dirname = path.normpath(path.abspath(dirname)) dirlen = len(dirname) + 1 # exclude final os.path.sep... |
typ = self.objtype if typ == 'function': typ = 'func' | def add_target_and_index(self, sigobj, sig, signode): theid = sigobj.get_id() name = unicode(sigobj.name) signode['names'].append(theid) signode['ids'].append(theid) signode['first'] = (not self.names) self.state.document.note_explicit_target(signode) | |
(self.env.docname, typ, theid)) | (self.env.docname, self.objtype, theid)) | def add_target_and_index(self, sigobj, sig, signode): theid = sigobj.get_id() name = unicode(sigobj.name) signode['names'].append(theid) signode['ids'].append(theid) signode['first'] = (not self.names) self.state.document.note_explicit_target(signode) |
if obj[1] != typ: | if obj[1] not in self.objtypes_for_role(typ): | def _create_refnode(expr): name = unicode(expr) if name not in self.data['objects']: return None obj = self.data['objects'][name] if obj[1] != typ: return None return make_refnode(builder, fromdocname, obj[0], obj[2], contnode, name) |
if invdata: env.intersphinx_inventory.update(invdata) | for type, objects in invdata.iteritems(): env.intersphinx_inventory.setdefault( type, {}).update(objects) | def load_mappings(app): """Load all intersphinx mappings into the environment.""" now = int(time.time()) cache_time = now - app.config.intersphinx_cache_limit * 86400 env = app.builder.env if not hasattr(env, 'intersphinx_cache'): env.intersphinx_cache = {} cache = env.intersphinx_cache update = False for uri, inv in a... |
return self.typename | return self.typename.get_name() | def get_name(self): return self.typename |
return self.name | return self.name.get_name() | def get_name(self): return self.name |
target = unicode(expr) if target not in self.data['objects']: | name = unicode(expr) if name not in self.data['objects']: | def _create_refnode(expr): target = unicode(expr) if target not in self.data['objects']: return None obj = self.data['objects'][target] if obj[1] != typ: return None return make_refnode(builder, fromdocname, obj[0], target, contnode, target) |
obj = self.data['objects'][target] | obj = self.data['objects'][name] | def _create_refnode(expr): target = unicode(expr) if target not in self.data['objects']: return None obj = self.data['objects'][target] if obj[1] != typ: return None return make_refnode(builder, fromdocname, obj[0], target, contnode, target) |
return make_refnode(builder, fromdocname, obj[0], target, contnode, target) | return make_refnode(builder, fromdocname, obj[0], expr.get_id(), contnode, name) | def _create_refnode(expr): target = unicode(expr) if target not in self.data['objects']: return None obj = self.data['objects'][target] if obj[1] != typ: return None return make_refnode(builder, fromdocname, obj[0], target, contnode, target) |
parent = node.get('cpp:parent') | parent = node['cpp:parent'] | def _create_refnode(expr): target = unicode(expr) if target not in self.data['objects']: return None obj = self.data['objects'][target] if obj[1] != typ: return None return make_refnode(builder, fromdocname, obj[0], target, contnode, target) |
self.fix_refuris(toc) toc = self.render_partial(toc)['fragment'] | if toc: self.fix_refuris(toc) toc = self.render_partial(toc)['fragment'] display_toc = True else: toc = '' display_toc = False | def get_doc_context(self, docname, body, metatags): # no relation links... toc = self.env.get_toctree_for(self.config.master_doc, self, False) self.fix_refuris(toc) toc = self.render_partial(toc)['fragment'] return dict( parents = [], prev = None, next = None, docstitle = None, title = self.config.html_title, meta = No... |
display_toc = True, | display_toc = display_toc, | def get_doc_context(self, docname, body, metatags): # no relation links... toc = self.env.get_toctree_for(self.config.master_doc, self, False) self.fix_refuris(toc) toc = self.render_partial(toc)['fragment'] return dict( parents = [], prev = None, next = None, docstitle = None, title = self.config.html_title, meta = No... |
result = (app.outdir / 'bom.txt').text('utf-8') | result = (app.outdir / 'bom.txt').text(encoding='utf-8') | def test_patch(app): app.builder.build(['bom']) result = (app.outdir / 'bom.txt').text('utf-8') expect = (u"\nDatei mit UTF-8" u"\n***************\n" # underline matches new translation u"\nThis file has umlauts: äöü.\n") assert result == expect |
self.build_qhcp(self.outdir, self.config.qthelp_basename) | def handle_finish(self): self.build_qhcp(self.outdir, self.config.qthelp_basename) self.build_qhp(self.outdir, self.config.qthelp_basename) | |
def build_qhcp(self, outdir, outname): self.info('writing collection project file...') f = codecs.open(path.join(outdir, outname+'.qhcp'), 'w', 'utf-8') try: f.write(collection_template % {'outname': outname}) finally: f.close() | def handle_finish(self): self.build_qhcp(self.outdir, self.config.qthelp_basename) self.build_qhp(self.outdir, self.config.qthelp_basename) | |
nversion = self.config.version.replace('.', '_') nversion = nversion.replace(' ', '_') | def build_qhp(self, outdir, outname): self.info('writing project file...') | |
'nversion': nversion, | 'namespace': nspace, | def build_qhp(self, outdir, outname): self.info('writing project file...') |
%(root)s/includes.txt:4: WARNING: download file not readable: nonexisting.png | %(root)s/includes.txt:4: WARNING: download file not readable: .*?nonexisting.png | def teardown_module(): (test_root / '_build').rmtree(True) |
typename = u''.join(n.astext() for n in types[fieldarg]) | def make_field(self, types, domain, items): fieldname = nodes.field_name('', self.label) listnode = self.list_type() for fieldarg, content in items: par = nodes.paragraph() par += self.make_xref(self.rolename, domain, fieldarg, nodes.strong) if fieldarg in types: typename = u''.join(n.astext() for n in types[fieldarg])... | |
par += self.make_xref(self.typerolename, domain, typename) | if len(fieldtype) == 1 and isinstance(fieldtype[0], nodes.Text): typename = u''.join(n.astext() for n in types[fieldarg]) par += self.make_xref(self.typerolename, domain, typename) else: par += fieldtype | def make_field(self, types, domain, items): fieldname = nodes.field_name('', self.label) listnode = self.list_type() for fieldarg, content in items: par = nodes.paragraph() par += self.make_xref(self.rolename, domain, fieldarg, nodes.strong) if fieldarg in types: typename = u''.join(n.astext() for n in types[fieldarg])... |
".//dd": r'Return spam\.', | ".//dd/p": r'Return spam\.', | def teardown_module(): (test_root / '_build').rmtree(True) |
self.env.domaindata['cpp']['objects'][name] = \ (self.env.docname, self.objtype) | typ = self.objtype if typ == 'function': typ = 'func' self.env.domaindata['cpp']['objects'].setdefault(name, (self.env.docname, typ, theid)) | def add_target_and_index(self, sigobj, sig, signode): theid = sigobj.get_id() name = unicode(sigobj.name) signode['names'].append(theid) signode['ids'].append(theid) signode['first'] = (not self.names) self.state.document.note_explicit_target(signode) self.env.domaindata['cpp']['objects'][name] = \ (self.env.docname, s... |
for fullname, (fn, _) in self.data['objects'].items(): | for fullname, (fn, _, _) in self.data['objects'].items(): | def clear_doc(self, docname): for fullname, (fn, _) in self.data['objects'].items(): if fn == docname: del self.data['objects'][fullname] |
return make_refnode(builder, fromdocname, obj[0], expr.get_id(), | return make_refnode(builder, fromdocname, obj[0], obj[2], | def _create_refnode(expr): name = unicode(expr) if name not in self.data['objects']: return None obj = self.data['objects'][name] if obj[1] != typ: return None return make_refnode(builder, fromdocname, obj[0], expr.get_id(), contnode, name) |
:encoding: option | :encoding: option\n? | def teardown_module(): (test_root / '_build').rmtree(True) |
self._handle_line(line) | html.append(self._handle_line(line)) | def make_html(self, source, proposal): """Return the HTML representation of the differences between `source` and `proposal`. |
return ''.join(html) | return ''.join(html).rstrip() | def make_html(self, source, proposal): """Return the HTML representation of the differences between `source` and `proposal`. |
f = open(outfilename, 'wb') try: self.implementation.dump(ctx, f, 2) finally: f.close() | self.dump_context(ctx, outfilename) | def handle_page(self, pagename, ctx, templatename='page.html', outfilename=None, event_arg=None): ctx['current_page_name'] = pagename self.add_sidebars(pagename, ctx) |
f = open(outfilename, 'wb') try: self.implementation.dump(self.globalcontext, f, 2) finally: f.close() | self.dump_context(self.globalcontext, outfilename) | def handle_finish(self): # dump the global context outfilename = path.join(self.outdir, self.globalcontext_filename) f = open(outfilename, 'wb') try: self.implementation.dump(self.globalcontext, f, 2) finally: f.close() |
return inspect.formatargspec(*argspec) | args = inspect.formatargspec(*argspec) args = args.replace('\\', '\\\\') return args | def format_args(self): if inspect.isbuiltin(self.object) or \ inspect.ismethoddescriptor(self.object): # can never get arguments of a C function or method return None try: argspec = inspect.getargspec(self.object) except TypeError: # if a class should be documented as function (yay duck # typing) we try to use the cons... |
match = js_sig_re.match(sig) if match is None: raise ValueError() nameprefix, name, arglist = match.groups() | sig = sig.strip() if '(' in sig and sig[-1:] == ')': prefix, arglist = sig.split('(', 1) arglist = arglist[:-1].strip() else: prefix = sig arglist = None if '.' in prefix: nameprefix, name = prefix.rsplit('.', 1) else: nameprefix = None name = prefix | def handle_signature(self, sig, signode): match = js_sig_re.match(sig) if match is None: raise ValueError() nameprefix, name, arglist = match.groups() |
fullname = nameprefix + name | fullname = nameprefix + '.' + name | def handle_signature(self, sig, signode): match = js_sig_re.match(sig) if match is None: raise ValueError() nameprefix, name, arglist = match.groups() |
signode += addnodes.desc_addname(nameprefix, nameprefix) | signode += addnodes.desc_addname(nameprefix + '.', nameprefix + '.') | def handle_signature(self, sig, signode): match = js_sig_re.match(sig) if match is None: raise ValueError() nameprefix, name, arglist = match.groups() |
self.visit_paragraph(self, node) | self.visit_paragraph(node) | def texinfo_visit_displaymath(self, node): self.visit_paragraph(self, node) |
self.depart_paragraph(self, node) | self.depart_paragraph(node) | def texinfo_depart_displaymath(self, node): self.depart_paragraph(self, node) |
_ = gettext.translation('test_root', app.outdir, languages=['en']).ugettext | _ = gettext.translation('test_root', app.outdir, languages=['en']).gettext | def test_gettext(app): app.builder.build(['markup']) (app.outdir / 'en' / 'LC_MESSAGES').makedirs() cwd = os.getcwd() os.chdir(app.outdir) try: try: p = Popen(['msginit', '--no-translator', '-i', 'markup.pot'], stdout=PIPE, stderr=PIPE) except OSError: return # most likely msginit was not found else: stdout, stderr =... |
assert "no matching candidate for image URI u'foo.*'" in \ app._warning.content[-1] | image_uri_message = "no matching candidate for image URI u'foo.*'" if sys.version_info >= (3, 0): image_uri_message = remove_unicode_literals(image_uri_message) assert image_uri_message in app._warning.content[-1] | def test_images(): assert warning_emitted('images.txt', 'image file not readable: foo.png') assert warning_emitted('images.txt', 'nonlocal image URI found: ' 'http://www.python.org/logo.png') tree = env.get_doctree('images') app._warning.reset() htmlbuilder = StandaloneHTMLBuilder(app) htmlbuilder.post_process_images(... |
assert "no matching candidate for image URI u'foo.*'" in \ app._warning.content[-1] | assert image_uri_message in app._warning.content[-1] | def test_images(): assert warning_emitted('images.txt', 'image file not readable: foo.png') assert warning_emitted('images.txt', 'nonlocal image URI found: ' 'http://www.python.org/logo.png') tree = env.get_doctree('images') app._warning.reset() htmlbuilder = StandaloneHTMLBuilder(app) htmlbuilder.post_process_images(... |
if (collapse and depth > 1 and 'current' not in subnode.parent['classes']): | if (collapse and depth > 1 and 'iscurrent' not in subnode.parent): | def _walk_depth(node, depth, maxdepth): """Utility: Cut a TOC at a specified depth.""" for subnode in node.children[:]: if isinstance(subnode, (addnodes.compact_paragraph, nodes.list_item)): subnode['classes'].append('toctree-l%d' % (depth-1)) _walk_depth(subnode, depth, maxdepth) elif isinstance(subnode, nodes.bullet_... |
if subnode['refuri'] == docname and \ not subnode['anchorname']: p = subnode while p: p['classes'].append('current') p = p.parent | if subnode['refuri'] == docname: if not subnode['anchorname']: branchnode = subnode while branchnode: branchnode['classes'].append('current') branchnode = branchnode.parent if subnode.parent.parent.get('iscurrent'): return while subnode: subnode['iscurrent'] = True subnode = subnode.parent | def _walk_depth(node, depth, maxdepth): """Utility: Cut a TOC at a specified depth.""" for subnode in node.children[:]: if isinstance(subnode, (addnodes.compact_paragraph, nodes.list_item)): subnode['classes'].append('toctree-l%d' % (depth-1)) _walk_depth(subnode, depth, maxdepth) elif isinstance(subnode, nodes.bullet_... |
for signode in objnode.traverse(addnodes.desc_signature): | for signode in objnode: if not isinstance(signode, addnodes.desc_signature): continue | def has_tag(modname, fullname, docname): entry = env._viewcode_modules.get(modname, None) if entry is None: try: analyzer = ModuleAnalyzer.for_module(modname) except Exception: env._viewcode_modules[modname] = False return analyzer.find_tags() entry = analyzer.code, analyzer.tags, {} env._viewcode_modules[modname] = en... |
hyper = '\\hypertarget{%s}{}' % node['ids'][0] | hyper = '\\hypertarget{%s}{}' % self.idescape(node['ids'][0]) | def depart_desc_signature(self, node): d = self.descstack[-1] d.cls = d.cls.rstrip('.') if node.parent['desctype'] != 'describe' and node['ids']: hyper = '\\hypertarget{%s}{}' % node['ids'][0] else: hyper = '' if d.count == 0: t1 = "\n\n%s\\begin{%s}" % (hyper, d.env) else: t1 = "\n%s\\%sline" % (hyper, d.env[:-4]) d.c... |
ctx += '\\hypertarget{%s}{}' % node['ids'][0] | ctx += '\\hypertarget{%s}{}' % self.idescape(node['ids'][0]) | def visit_term(self, node): ctx = '] \\leavevmode' if node.has_key('ids') and node['ids']: ctx += '\\hypertarget{%s}{}' % node['ids'][0] self.body.append('\\item[') self.context.append(ctx) |
appendices=((docclass == 'manual') and | appendices=((docclass != 'howto') and | def write(self, *ignored): docwriter = LaTeXWriter(self) docsettings = OptionParser( defaults=self.env.settings, components=(docwriter,)).get_default_values() |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.