rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
elif data[-3] == ' ': | elif data[-3] in ' \n': | def paragraph(self, lines, lineno): """ Return a list (paragraph & messages) & a boolean: literal_block next? """ data = '\n'.join(lines).rstrip() if data[-2:] == '::': if len(data) == 2: return [], 1 elif data[-3] == ' ': text = data[:-3].rstrip() else: text = data[:-1] literalnext = 1 else: text = data literalnext = ... |
identity = string.maketrans('', '') null2backslash = string.maketrans('\x00', '\\') | def parse(self, text, lineno, memo, parent): """ Return 2 lists: nodes (text and inline elements), and system_messages. | |
'%r (sequence %r)' % (self.state_machine.abs_line_number(), text, sequence))) | '"%s" (sequence %r)' % (self.state_machine.abs_line_number(), text, sequence))) | def enumerator(self, match, context, next_state): """Enumerated List Item""" format, sequence, text, ordinal = self.parse_enumerator(match) if ordinal is None: msg = self.reporter.error( ('Enumerated list start value invalid at line %s: ' '%r (sequence %r)' % (self.state_machine.abs_line_number(), text, sequence))) sel... |
'%r (ordinal %s)' % (self.state_machine.abs_line_number(), text, ordinal))) | '"%s" (ordinal %s)' % (self.state_machine.abs_line_number(), text, ordinal))) | def enumerator(self, match, context, next_state): """Enumerated List Item""" format, sequence, text, ordinal = self.parse_enumerator(match) if ordinal is None: msg = self.reporter.error( ('Enumerated list start value invalid at line %s: ' '%r (sequence %r)' % (self.state_machine.abs_line_number(), text, sequence))) sel... |
'should be 1 or 2: %r' % (len(tokens), optionstring)) | 'should be 1 or 2: "%s"' % (len(tokens), optionstring)) | def parse_option_marker(self, match): """ Return a list of `node.option` and `node.option_argument` objects, parsed from an option marker match. |
pass self.body.append('\n.TP\n\B %s\n' % str(self._list_char[-1])) | self.body.append('\n.TP 2\n\\(bu\n') else: self.body.append('\n.TP 2\n%s\n' % str(self._list_char[-1])) | def visit_list_item(self, node): try: self._list_char[-1] += 1 except: pass self.body.append('\n.TP\n\B %s\n' % str(self._list_char[-1])) |
self.transform() | def read(self, source, parser, settings): self.source = source if not self.parser: self.parser = parser self.settings = settings # we want the input as the filename, not the file content self.source.source.close() self.input = self.source.source_path self.parse() self.transform() return self.document | |
simplename = r'(?!_)\w([-.\w]*(?!_)\w)?' | simplename = r'(?:(?!_)\w)+(?:[-._](?:(?!_)\w)+)*' | def parse(self, text, lineno, memo, parent): """ Return 2 lists: nodes (text and inline elements), and system_messages. |
include_text = include_file.read() | try: include_text = include_file.read() except UnicodeError, error: severe = state_machine.reporter.severe( 'Problem with "%s" directive:\n%s: %s' % (name, error.__class__.__name__, error), nodes.literal_block(block_text, block_text), line=lineno) return [severe] | def include(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine): """Include a reST file as part of the content of this reST file.""" source = state_machine.input_lines.source( lineno - state_machine.input_offset - 1) source_dir = os.path.dirname(os.path.abspath(source)) path = '... |
text = raw_file.read() | try: text = raw_file.read() except UnicodeError, error: severe = state_machine.reporter.severe( 'Problem with "%s" directive:\n%s: %s' % (name, error.__class__.__name__, error), nodes.literal_block(block_text, block_text), line=lineno) return [severe] | def raw(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine): """ Pass through content unchanged Content is included in output based on type argument Content may be included inline (content section of directive) or imported from a file or url. """ attributes = {'format': ' '.jo... |
Traverse a tree of `Node` objects, calling ``visit_...`` methods of `visitor` when entering each node. If there is no ``visit_particular_node`` method for a node of type ``particular_node``, the ``unknown_visit`` method is called. (The `walkabout()` method is similar, except it also calls ``depart_...`` methods before... | Traverse a tree of `Node` objects, calling the `dispatch_visit()` method of `visitor` when entering each node. (The `walkabout()` method is similar, except it also calls the `dispatch_departure()` method before exiting each node.) | def walk(self, visitor): """ Traverse a tree of `Node` objects, calling ``visit_...`` methods of `visitor` when entering each node. If there is no ``visit_particular_node`` method for a node of type ``particular_node``, the ``unknown_visit`` method is called. (The `walkabout()` method is similar, except it also calls ... |
Within ``visit_...`` methods (and ``depart_...`` methods for | Within ``visit`` methods (and ``depart`` methods for | def walk(self, visitor): """ Traverse a tree of `Node` objects, calling ``visit_...`` methods of `visitor` when entering each node. If there is no ``visit_particular_node`` method for a node of type ``particular_node``, the ``unknown_visit`` method is called. (The `walkabout()` method is similar, except it also calls ... |
``visit_...`` method for each `Node` subclass encountered. | ``visit`` implementation for each `Node` subclass encountered. | def walk(self, visitor): """ Traverse a tree of `Node` objects, calling ``visit_...`` methods of `visitor` when entering each node. If there is no ``visit_particular_node`` method for a node of type ``particular_node``, the ``unknown_visit`` method is called. (The `walkabout()` method is similar, except it also calls ... |
Perform a tree traversal similarly to `Node.walk()` (which see), except also call ``depart_...`` methods before exiting each node. If there is no ``depart_particular_node`` method for a node of type ``particular_node``, the ``unknown_departure`` method is called. Parameter `visitor`: A `NodeVisitor` object, containing... | Perform a tree traversal similarly to `Node.walk()` (which see), except also call the `dispatch_departure()` method before exiting each node. Parameter `visitor`: A `NodeVisitor` object, containing a ``visit`` and ``depart`` implementation for each `Node` subclass encountered. | def walkabout(self, visitor): """ Perform a tree traversal similarly to `Node.walk()` (which see), except also call ``depart_...`` methods before exiting each node. If there is no ``depart_particular_node`` method for a node of type ``particular_node``, the ``unknown_departure`` method is called. |
"Visitor" pattern [GoF95]_ abstract superclass implementation for document tree traversals. Each node class has corresponding methods, doing nothing by default; override individual methods for specific and useful behaviour. The "``visit_`` + node class name" method is called by `Node.walk()` upon entering a node. `N... | "Visitor" pattern [GoF95]_ abstract superclass implementation for document tree traversals. Each node class has corresponding methods, doing nothing by default; override individual methods for specific and useful behaviour. The `dispatch_visit()` method is called by `Node.walk()` upon entering a node. `Node.walkabou... | def astext(self): return self.get('alt', '') |
if not p: p = os.curdir | def loadTestModules(path, name='', packages=None): """ Return a test suite composed of all the tests from modules in a directory. Search for modules in directory `path`, beginning with `name`. If `packages` is true, search subdirectories (also beginning with `name`) recursively. Subdirectories must be Python packages... | |
if fullpath[0:2] == '.' + os.sep: fullpath = fullpath[2:] else: fullpath = fullpath[len(path)+1:] | fullpath = fullpath[len(path)+1:] | def loadTestModules(path, name='', packages=None): """ Return a test suite composed of all the tests from modules in a directory. Search for modules in directory `path`, beginning with `name`. If `packages` is true, search subdirectories (also beginning with `name`) recursively. Subdirectories must be Python packages... |
self.dirCtrl.SetHelpText('This is the project's default ' + \ | self.dirCtrl.SetHelpText('This is the default ' + \ | def __init__(self, parent, project, invalid_names): wxDialog.__init__(self, parent, -1, title = 'Project Settings') |
if self._use_latex_citations: | if self._use_latex_citations and len(self._bibitems)>0: | def depart_document(self, node): if self._use_latex_citations: widest_label = "" for bi in self._bibitems: if len(widest_label)<len(bi[0]): widest_label = bi[0] self.body.append('\n\\begin{thebibliography}{%s}\n'%widest_label) for bi in self._bibitems: self.body.append('\\bibitem[%s]{%s}{%s}\n' % (bi[0], bi[0], bi[1]))... |
self.set_defaults(component.option_default_overrides) | self.defaults.update(component.option_default_overrides) | def populate_from_components(self, components): for component in components: if component is None: continue i = 0 cmdline_options = component.cmdline_options self.relative_path_options.extend(component.relative_path_options) while i < len(cmdline_options): title, description, option_spec = cmdline_options[i:i+3] if tit... |
nodelist = [] | def literal_block(self): """Return a list of nodes.""" indented, indent, offset, blank_finish = \ self.state_machine.get_indented() while indented and not indented[-1].strip(): indented.trim_end() if not indented: return self.quoted_literal_block() nodelist = [] data = '\n'.join(indented) nodelist.append(nodes.literal_... | |
nodelist.append(nodes.literal_block(data, data)) | literal_block = nodes.literal_block(data, data) literal_block.line = offset + 1 nodelist = [literal_block] | def literal_block(self): """Return a list of nodes.""" indented, indent, offset, blank_finish = \ self.state_machine.get_indented() while indented and not indented[-1].strip(): indented.trim_end() if not indented: return self.quoted_literal_block() nodelist = [] data = '\n'.join(indented) nodelist.append(nodes.literal_... |
def graphicx_package(): if self.settings.graphicx_option == '': return '\\usepackage{graphicx}\n' if self.settings.graphicx_option.lower() == 'auto': return '\n'.join(('%Check if we are compiling under latex or pdflatex', '\\ifx\\pdftexversion\\undefined', ' \\usepackage{graphicx}', '\\else', ' \\usepackage[pdftex]{g... | if self.settings.graphicx_option == '': self.graphicx_package = '\\usepackage{graphicx}\n' elif self.settings.graphicx_option.lower() == 'auto': self.graphicx_package = '\n'.join( ('%Check if we are compiling under latex or pdflatex', '\\ifx\\pdftexversion\\undefined', ' \\usepackage{graphicx}', '\\else', ' \\usepack... | def graphicx_package(): if self.settings.graphicx_option == '': return '\\usepackage{graphicx}\n' if self.settings.graphicx_option.lower() == 'auto': return '\n'.join(('%Check if we are compiling under latex or pdflatex', '\\ifx\\pdftexversion\\undefined', ' \\usepackage{graphicx}', '\\else', ' \\usepackage[pdftex]{g... |
graphicx_package(), | self.graphicx_package, | def graphicx_package(): if self.settings.graphicx_option == '': return '\\usepackage{graphicx}\n' if self.settings.graphicx_option.lower() == 'auto': return '\n'.join(('%Check if we are compiling under latex or pdflatex', '\\ifx\\pdftexversion\\undefined', ' \\usepackage{graphicx}', '\\else', ' \\usepackage[pdftex]{g... |
\\usepackage{graphicx} \\usepackage{color} | %Check if we are compiling under latex or pdflatex \\ifx\\pdftexversion\\undefined \\usepackage[dvips]{graphicx} \\else \\usepackage[pdftex]{graphicx} \\fi \\usepackage{color} | def suite(): s = DocutilsTestSupport.PublishTestSuite('latex') s.generateTests(totest) return s |
["""\ | ] class SpecialIncludeTestCase(DocutilsTestSupport.ParserTestCase): def test_parser(self): if self.run_in_debugger: pdb.set_trace() document = DocutilsTestSupport.utils.new_document( 'test data', self.settings) DocutilsTestSupport.roles._roles = {} self.parser.parse(self.input, document) output = document.pformat()... | def suite(): s = DocutilsTestSupport.ParserTestSuite() s.generateTests(totest) return s |
\ <document source="test data"> | ^<document source="test data"> | def suite(): s = DocutilsTestSupport.ParserTestSuite() s.generateTests(totest) return s |
IOError: [Errno 2] No such file or directory: '../docutils/parsers/rst/include/nonexistent'. | IOError: \[Errno 2\] No such file or directory: .*\. | def suite(): s = DocutilsTestSupport.ParserTestSuite() s.generateTests(totest) return s |
.. include:: <nonexistent> """], ] | \.\. include:: <nonexistent> $""" | def suite(): s = DocutilsTestSupport.ParserTestSuite() s.generateTests(totest) return s |
return [table_node] | return [table_node] + messages | def table(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine): if not content: warning = state_machine.reporter.warning( 'Content block expected for the "%s" directive; none found.' % name, nodes.literal_block(block_text, block_text), line=lineno) return [warning] if arguments: ... |
source_dir = os.path.dirname( os.path.abspath(state.document.current_source)) | source = state_machine.input_lines.source( lineno - state_machine.input_offset - 1) source_dir = os.path.dirname(os.path.abspath(source)) | def include(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine): """Include a reST file as part of the content of this reST file.""" source_dir = os.path.dirname( os.path.abspath(state.document.current_source)) path = ''.join(arguments[0].splitlines()) if path.find(' ') != -1: e... |
include_file = open(path) | include_file = io.FileInput(state.document.settings, source_path=path) | def include(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine): """Include a reST file as part of the content of this reST file.""" source_dir = os.path.dirname( os.path.abspath(state.document.current_source)) path = ''.join(arguments[0].splitlines()) if path.find(' ') != -1: e... |
include_file.close() | def include(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine): """Include a reST file as part of the content of this reST file.""" source_dir = os.path.dirname( os.path.abspath(state.document.current_source)) path = ''.join(arguments[0].splitlines()) if path.find(' ') != -1: e... | |
'', title, CLASS='normedname', *field[1].children) | '', title, CLASS=normedname, *field[1].children) | def extract_bibliographic(self, field_list): docinfo = nodes.docinfo() bibliofields = self.language.bibliographic_fields labels = self.language.labels topics = {'dedication': None, 'abstract': None} for field in field_list: try: name = field[0][0].astext() normedname = utils.normalize_name(name) if not (len(field) == 2... |
totest['empty file'] = [ [ """\ """, latex_head + """\ \\title{} \\author{} \\date{} \\raggedbottom \\begin{document} \\maketitle Document empty; must have contents. \\end{document} """ ], ] totest['tables_of_contents'] = [ | totest['table_of_contents'] = [ | def suite(): s = DocutilsTestSupport.LatexPublishTestSuite() s.generateTests(totest) return s |
\\hypertarget{table-of-contents}{}\\begin{center} \\subsection*{Table of Contents} \\end{center} | \\hypertarget{table-of-contents}{}\\subsection*{~\\hfill Table of Contents\\hfill ~} | def suite(): s = DocutilsTestSupport.LatexPublishTestSuite() s.generateTests(totest) return s |
self.usageExit(msg) | usageExit(msg) | def parseArgs(argv=sys.argv): """Parse command line arguments and set TestFramework state. State is to be acquired by test_* modules by a grotty hack: ``from TestFramework import *``. For this stylistic transgression, I expect to be first up against the wall when the revolution comes. --Garth""" global verbosity, debu... |
<meta name="defaultView" content="slideshow" /> <meta name="controlVis" content="hidden" /> | <meta name="defaultView" content="%(view_mode)s" /> <meta name="controlVis" content="%(control_visibility)s" /> | def __init__(self): html4css1.Writer.__init__(self) self.translator_class = S5HTMLTranslator |
% {'path': self.theme_file_path}) | % {'path': self.theme_file_path, 'view_mode': view_mode, 'control_visibility': control_visibility}) | def __init__(self, *args): html4css1.HTMLTranslator.__init__(self, *args) #insert S5-specific stylesheet and script stuff: self.theme_file_path = None self.setup_theme() self.stylesheet.append(self.s5_stylesheet_template % {'path': self.theme_file_path}) if not self.document.settings.current_slide: self.stylesheet.appe... |
'data_files': [('docutils/parsers/rst/include', glob.glob('docutils/parsers/rst/include/*.txt')), ('docutils/writers/html4css1', ['docutils/writers/html4css1/html4css1.css']), ('docutils/writers/latex2e', ['docutils/writers/latex2e/latex2e.tex']), ('docutils/writers/newlatex2e', ['docutils/writers/newlatex2e/base.tex']... | 'data_files': ([('docutils/parsers/rst/include', glob.glob('docutils/parsers/rst/include/*.txt')), ('docutils/writers/html4css1', ['docutils/writers/html4css1/html4css1.css']), ('docutils/writers/latex2e', ['docutils/writers/latex2e/latex2e.tex']), ('docutils/writers/newlatex2e', ['docutils/writers/newlatex2e/base.tex'... | def do_setup(): kwargs = package_data.copy() extras = get_extras() if extras: kwargs['py_modules'] = extras if sys.hexversion >= 0x02030000: # Python 2.3 kwargs['classifiers'] = classifiers else: kwargs['cmdclass'] = {'build_py': dual_build_py} dist = setup(**kwargs) return dist |
'<col />\n' | def visit_citation(self, node): self.body.append(self.starttag(node, 'table', CLASS='citation', frame="void", rules="none")) self.body.append('<colgroup><col class="label" /><col /></colgroup>\n' '<col />\n' '<tbody valign="top">\n' '<tr>') self.footnote_backrefs(node) | |
self.starttag(node, 'table', CLASS="table", border=None)) | self.starttag(node, 'table', CLASS="table", border="1")) | def visit_table(self, node): self.body.append( # "border=None" is a boolean attribute; # it means "standard border", not "no border": self.starttag(node, 'table', CLASS="table", border=None)) |
text = publish_string(source = self.raw, writer = MoinWriter(formatter, self.request), enable_exit = None, settings_overrides = {'traceback': 1}) | parts = publish_parts(source = self.raw, writer = MoinWriter(formatter, self.request), settings_overrides = {'traceback': 1}) text = '<h2>' + parts['title'] + '</h2>' text += '<h3>' + parts['subtitle'] + '</h3>' text += parts['fragment'] | def format(self, formatter): text = publish_string(source = self.raw, writer = MoinWriter(formatter, self.request), enable_exit = None, settings_overrides = {'traceback': 1}) self.request.write(html_escape_unicode(text)) |
node.astext()) | node_text) | def visit_reference(self, node): target = None if 'refuri' in node.attributes: if (node['refuri'].find('wiki:') != -1) or \ (node['refuri'].find('attachment:') != -1): target = node['refuri'] elif ('name' in node.attributes and fully_normalize_name(node['name']) == node['refuri']): target = ':%s:' % (node['name']) # Th... |
counter += 1 | def __pair_arg_with_option(self): | |
print arguments | def __get_just_options(self): | |
colwidth='%i%%' % colwidth)) | width='%i%%' % colwidth)) | def write_colspecs(self): width = 0 for node in self.colspecs: width += node['colwidth'] for node in self.colspecs: colwidth = int(node['colwidth'] * 100.0 / width + 0.5) self.body.append(self.emptytag(node, 'col', colwidth='%i%%' % colwidth)) self.colspecs = [] |
\\usepackage[colorlinks,linkcolor=blue]{hyperref} | \\usepackage[colorlinks=true,linkcolor=blue,urlcolor=blue]{hyperref} | def suite(): s = DocutilsTestSupport.LatexPublishTestSuite() s.generateTests(totest) return s |
item.parent = self | self.setup_child(item) | def __setitem__(self, key, item): if isinstance(key, UnicodeType) or isinstance(key, StringType): self.attributes[str(key)] = item elif isinstance(key, IntType): item.parent = self self.children[key] = item elif isinstance(key, SliceType): assert key.step is None, 'cannot handle slice with stride' for node in item: nod... |
node.parent = self | self.setup_child(node) | def __setitem__(self, key, item): if isinstance(key, UnicodeType) or isinstance(key, StringType): self.attributes[str(key)] = item elif isinstance(key, IntType): item.parent = self self.children[key] = item elif isinstance(key, SliceType): assert key.step is None, 'cannot handle slice with stride' for node in item: nod... |
other.parent = self | self.setup_child(other) | def __iadd__(self, other): """Append a node or a list of nodes to `self.children`.""" if isinstance(other, Node): other.parent = self self.children.append(other) elif other is not None: for node in other: node.parent = self self.children.extend(other) return self |
node.parent = self | self.setup_child(node) | def __iadd__(self, other): """Append a node or a list of nodes to `self.children`.""" if isinstance(other, Node): other.parent = self self.children.append(other) elif other is not None: for node in other: node.parent = self self.children.extend(other) return self |
item.parent = self | self.setup_child(item) | def append(self, item): item.parent = self self.children.append(item) |
node.parent = self | self.setup_child(node) | def extend(self, item): for node in item: node.parent = self self.children.extend(item) |
item.parent = self | self.setup_child(item) | def insert(self, index, item): if isinstance(item, Node): item.parent = self self.children.insert(index, item) elif item is not None: self[index:index] = item |
new.parent = self | self.setup_child(new) | def replace(self, old, new): """Replace one child `Node` with another child or children.""" index = self.index(old) if isinstance(new, Node): new.parent = self self[index] = new elif new is not None: self[index:index+1] = new |
self.attributes['xml:space'] = 1 | self.attributes['xml:space'] = 'preserve' | def __init__(self, rawsource='', text='', *children, **attributes): TextElement.__init__(self, rawsource, text, *children, **attributes) self.attributes['xml:space'] = 1 |
self.language = languages.getlanguage(document.language_code) | self.language = languages.get_language(document.language_code) | def run(self, input_lines, document, input_offset=0, match_titles=1, inliner=None): """ Parse `input_lines` and return a `docutils.nodes.document` instance. |
self.goto_line(newline_offset) | def bullet(self, match, context, next_state): """Bullet list item.""" bulletlist = nodes.bullet_list() self.parent += bulletlist bulletlist['bullet'] = match.string[0] i, blank_finish = self.list_item(match.end()) bulletlist += i offset = self.state_machine.line_offset + 1 # next line newline_offset, blank_finish = s... | |
self.goto_line(newline_offset) | def enumerator(self, match, context, next_state): """Enumerated List Item""" format, sequence, text, ordinal = self.parse_enumerator(match) if ordinal is None: msg = self.reporter.error( ('Enumerated list start value invalid at line %s: ' '%r (sequence %r)' % (self.state_machine.abs_line_number(), text, sequence))) sel... | |
self.goto_line(newline_offset) | def field_marker(self, match, context, next_state): """Field list item.""" fieldlist = nodes.field_list() self.parent += fieldlist field, blank_finish = self.field(match) fieldlist += field offset = self.state_machine.line_offset + 1 # next line newline_offset, blank_finish = self.nested_list_parse( self.state_machin... | |
self.goto_line(newline_offset) | def option_marker(self, match, context, next_state): """Option list item.""" optionlist = nodes.option_list() try: listitem, blank_finish = self.option_list_item(match) except MarkupError, detail: # shouldn't happen; won't match pattern msg = self.reporter.error( ('Invalid option list marker at line %s: %s' % (self.s... | |
self.goto_line(newline_offset) | def rfc2822(self, match, context, next_state): """RFC2822-style field list item.""" fieldlist = nodes.field_list(CLASS='rfc2822') self.parent += fieldlist field, blank_finish = self.rfc2822_field(match) fieldlist += field offset = self.state_machine.line_offset + 1 # next line newline_offset, blank_finish = self.nest... | |
self.goto_line(newline_offset) | def indent(self, match, context, next_state): """Definition list item.""" definitionlist = nodes.definition_list() definitionlistitem, blank_finish = self.definition_list_item(context) definitionlist += definitionlistitem self.parent += definitionlist offset = self.state_machine.line_offset + 1 # next line newline_of... | |
msgid = self.set_id(msg) | msgid = self.document.set_id(msg) | def symbolize_footnotes(self): """Add symbols indexes to "[*]"-style footnotes and references.""" labels = [] for footnote in self.document.symbol_footnotes: reps, index = divmod(self.document.symbol_footnote_start, len(self.symbols)) labeltext = self.symbols[index] * (reps + 1) labels.append(labeltext) footnote.insert... |
print >>sys.stderr, '%s: %s' % (error.__class__.__name__, error) try: print >>sys.stderr, """ The specified output encoding (%s) cannot handle all of the output.""" % error.encoding except AttributeError: print >>sys.stderr, """ The specified output encoding cannot handle all of the output.""" print """\ Try setting... | sys.stderr.write( '%s: %s\n' '\n' 'The specified output encoding (%s) cannot\n' 'handle all of the output.\n' 'Try setting "--output-encoding-error-handler" to\n' '\n' '* "xmlcharrefreplace" (for HTML & XML output);\n' % (error.__class__.__name__, error, self.settings.output_encoding)) | def report_UnicodeError(self, error): print >>sys.stderr, '%s: %s' % (error.__class__.__name__, error) |
print >>sys.stderr, """\ the output will contain "%s" and should be usable. * "backslashreplace" (for other output formats, Python 2.3+); look for "%s" in the output.""" % ( data.encode('ascii', 'xmlcharrefreplace'), data.encode('ascii', 'backslashreplace')) | sys.stderr.write( ' the output will contain "%s" and should be usable.\n' '* "backslashreplace" (for other output formats, Python 2.3+);\n' ' look for "%s" in the output.\n' % (data.encode('ascii', 'xmlcharrefreplace'), data.encode('ascii', 'backslashreplace'))) | def report_UnicodeError(self, error): print >>sys.stderr, '%s: %s' % (error.__class__.__name__, error) |
print >>sys.stderr, """\ the output should be usable as-is.""" print >>sys.stderr, ("""\ * "replace"; look for "?" in the output. "--output-encoding-error-handler" is currently set to "%s". Exiting due to error. Use "--traceback" to diagnose. If the advice above doesn't eliminate the error, please report it to <doc... | sys.stderr.write(' the output should be usable as-is.\n') sys.stderr.write( '* "replace"; look for "?" in the output.\n' '\n' '"--output-encoding-error-handler" is currently set to "%s".\n' '\n' 'Exiting due to error. Use "--traceback" to diagnose.\n' 'If the advice above doesn\'t eliminate the error,\n' 'please repo... | def report_UnicodeError(self, error): print >>sys.stderr, '%s: %s' % (error.__class__.__name__, error) |
text = node.astext().replace("_","\\_") | text = self.encode(node.astext()) | def bookmark(self, node): """Append latex href and pdfbookmarks for titles. """ if node.parent.hasattr('id'): self.body.append('\\hypertarget{%s}{}\n' % node.parent['id']) if not self.use_latex_toc: # BUG level depends on style. pdflatex allows level 0 to 3 # ToC would be the only on level 0 so i choose to decrement th... |
settings_defaults = {} | settings_defaults = {'output_encoding': 'latin-1'} | def setMode(self, mode): self.mode = mode |
self.body_prefix.append('\\chapter*{Front Matter\label{front}}\n') | self.body_prefix.append('\\chapter*{Front Matter\\label{front}}\n') | def astext(self): title = '\\title{%s}\n' % self.title if self.docinfo.has_key('revision'): self.head.append('\\release{%s}\n' % self.docinfo['revision']) if self.docinfo.has_key('date'): self.head.append('\\date{%s}\n' % self.docinfo['date']) if self.docinfo.has_key('author'): self.head.append('\\author{%s}\n' % self.... |
self.body.append( '\\begin{quote}\n') | done = 0 if len(node.children) == 1: child = node.children[0] if isinstance(child, nodes.bullet_list) or \ isinstance(child, nodes.enumerated_list): done = 1 if not done: self.body.append('\\begin{quote}\n') | def visit_block_quote(self, node): self.body.append( '\\begin{quote}\n') |
self.body.append( '\\end{quote}\n') | done = 0 if len(node.children) == 1: child = node.children[0] if isinstance(child, nodes.bullet_list) or \ isinstance(child, nodes.enumerated_list): done = 1 if not done: self.body.append('\\end{quote}\n') | def depart_block_quote(self, node): self.body.append( '\\end{quote}\n') |
if node.has_key('refuri'): self.href = node['refuri'] elif node.has_key('refid'): self.href = ' elif node.has_key('refname'): self.href = ' self.href = self.cleanHref(self.href) | def visit_reference(self, node): if node.has_key('refuri'): self.href = node['refuri'] elif node.has_key('refid'): self.href = '#' + node['refid'] elif node.has_key('refname'): self.href = '#' + self.document.nameids[node['refname']] self.href = self.cleanHref(self.href) if self.seealso: self.body.append('\\seeurl{%s}{... | |
self.body.append('\\seeurl{%s}{' % self.href) | if node.has_key('refuri'): href = node['refuri'] href = self.cleanHref(href) self.body.append('\\seeurl{%s}{' % href) | def visit_reference(self, node): if node.has_key('refuri'): self.href = node['refuri'] elif node.has_key('refid'): self.href = '#' + node['refid'] elif node.has_key('refname'): self.href = '#' + self.document.nameids[node['refname']] self.href = self.cleanHref(self.href) if self.seealso: self.body.append('\\seeurl{%s}{... |
self.body.append('\\ulink{') | if node.has_key('refuri'): self.body.append('\\ulink{') elif node.has_key('refid'): href = node['refid'] href = self.cleanHref(href) self.body.append('\\ref{%s}' % href) raise nodes.SkipNode | def visit_reference(self, node): if node.has_key('refuri'): self.href = node['refuri'] elif node.has_key('refid'): self.href = '#' + node['refid'] elif node.has_key('refname'): self.href = '#' + self.document.nameids[node['refname']] self.href = self.cleanHref(self.href) if self.seealso: self.body.append('\\seeurl{%s}{... |
self.body.append('}{%s}' % self.href) | if node.has_key('refuri'): href = node['refuri'] href = self.cleanHref(href) self.body.append('}{%s}' % href) elif node.has_key('refid'): pass | def depart_reference(self, node): if self.seealso: self.body.append('}') else: self.body.append('}{%s}' % self.href) |
if not (node.has_key('refuri') or node.has_key('refid') or node.has_key('refname')): self.body.append('\\hypertarget{%s}{' % node['name']) self.context.append('}') else: self.context.append('') | pass | def visit_target(self, node): if not (node.has_key('refuri') or node.has_key('refid') or node.has_key('refname')): self.body.append('\\hypertarget{%s}{' % node['name']) self.context.append('}') else: self.context.append('') |
self.body.append(self.context.pop()) | pass | def depart_target(self, node): self.body.append(self.context.pop()) |
def string_to_label(self, text): text = text.replace(' ', '-') text = text.replace('_', '-') return text | def string_to_label(self, text): text = text.replace(' ', '-') text = text.replace('_', '-') return text | |
s2 = self.string_to_label(node.astext()) | s2 = nodes.make_id(node.astext()) | def visit_title(self, node): #self.pdebug('%% [(visit_title) section_level: %d node: "%s"]\n' % \ # (self.section_level, node.astext().lower())) if self.section_level == 0: self.title_before_section = 1 if self.seealso: self.body.append('\\end{seealso}\n') self.seealso = 0 if node.astext().lower() == 'see also': se... |
self.body.append('\\section{%s\label{%s}}\n' % (s1, s2)) | self.body.append('\\section{%s\\label{%s}}\n' % (s1, s2)) | def visit_title(self, node): #self.pdebug('%% [(visit_title) section_level: %d node: "%s"]\n' % \ # (self.section_level, node.astext().lower())) if self.section_level == 0: self.title_before_section = 1 if self.seealso: self.body.append('\\end{seealso}\n') self.seealso = 0 if node.astext().lower() == 'see also': se... |
self.body.append('\\subsection{%s\label{%s}}\n' % (s1, s2)) | self.body.append('\\subsection{%s\\label{%s}}\n' % (s1, s2)) | def visit_title(self, node): #self.pdebug('%% [(visit_title) section_level: %d node: "%s"]\n' % \ # (self.section_level, node.astext().lower())) if self.section_level == 0: self.title_before_section = 1 if self.seealso: self.body.append('\\end{seealso}\n') self.seealso = 0 if node.astext().lower() == 'see also': se... |
self.body.append('\\subsubsection{%s\label{%s}}\n' % (s1, s2)) | self.body.append('\\subsubsection{%s\\label{%s}}\n' % (s1, s2)) | def visit_title(self, node): #self.pdebug('%% [(visit_title) section_level: %d node: "%s"]\n' % \ # (self.section_level, node.astext().lower())) if self.section_level == 0: self.title_before_section = 1 if self.seealso: self.body.append('\\end{seealso}\n') self.seealso = 0 if node.astext().lower() == 'see also': se... |
self.body.append('\\paragraph{%s\label{%s}}\n' % (s1, s2)) | self.body.append('\\paragraph{%s\\label{%s}}\n' % (s1, s2)) | def visit_title(self, node): #self.pdebug('%% [(visit_title) section_level: %d node: "%s"]\n' % \ # (self.section_level, node.astext().lower())) if self.section_level == 0: self.title_before_section = 1 if self.seealso: self.body.append('\\end{seealso}\n') self.seealso = 0 if node.astext().lower() == 'see also': se... |
self.body.append('\\subparagraph{%s\label{%s}}\n' % (s1, s2)) | self.body.append('\\subparagraph{%s\\label{%s}}\n' % (s1, s2)) | def visit_title(self, node): #self.pdebug('%% [(visit_title) section_level: %d node: "%s"]\n' % \ # (self.section_level, node.astext().lower())) if self.section_level == 0: self.title_before_section = 1 if self.seealso: self.body.append('\\end{seealso}\n') self.seealso = 0 if node.astext().lower() == 'see also': se... |
from distutils.command.install import INSTALL_SCHEMES for scheme in INSTALL_SCHEMES.values(): scheme['data'] = scheme['purelib'] | def run(self): if not self.py_modules and not self.packages: return if self.py_modules: self.build_modules() if self.packages: self.build_packages() self.byte_compile(self.get_outputs(include_bytecode=0)) | |
self.body.insert(0, self.starttag(node, 'div', CLASS='document')) self.body.append('</div>\n') | self.body_prefix.append(self.starttag(node, 'div', CLASS='document')) self.body_suffix.insert(0, '</div>\n') | def depart_document(self, node): self.fragment.extend(self.body) self.body.insert(0, self.starttag(node, 'div', CLASS='document')) self.body.append('</div>\n') |
if atts.has_key('align'): self.body.append('<p align="%s">' % (self.attval(atts['align'],))) else: self.body.append('<p>') self.context.append('</p>\n') | div_atts = self.image_div_atts(node) self.body.append(self.starttag({}, 'div', '', **div_atts)) self.context.append('</div>\n') | def visit_image(self, node): atts = node.attributes.copy() if atts.has_key('class'): del atts['class'] # prevent duplication with node attrs atts['src'] = atts['uri'] del atts['uri'] if atts.has_key('scale'): if Image and not (atts.has_key('width') and atts.has_key('height')): try: im = Image.open(str(atts['s... |
else: self.body.append('<p>') self.context.append('</p>\n') | else: assert len(node) == 1 and isinstance(node[0], nodes.image) div_atts = self.image_div_atts(node[0]) div_atts['class'] += ' image-reference' self.body.append(self.starttag({}, 'div', '', **div_atts)) self.context.append('</div>\n') | def visit_reference(self, node): if isinstance(node.parent, nodes.TextElement): self.context.append('') else: self.body.append('<p>') self.context.append('</p>\n') href = '' if node.has_key('refuri'): href = node['refuri'] elif node.has_key('refid'): href = '#' + node['refid'] elif node.has_key('refname'): href = '#' +... |
self.body_pre_docinfo + self.docinfo + self.bodyContent + | self.body_pre_docinfo + self.docinfo + self.bodyContent + self.bodySuffix + | def astext(self): return ''.join([DocArticleText.contentStart, DocArticleText.headerStart] + self.headerContent + [DocArticleText.headerEnd, DocArticleText.bodyStart] + self.body_pre_docinfo + self.docinfo + self.bodyContent + [DocArticleText.bodyEnd, DocArticleText.contentEnd]) |
def visit_admonition(self, node, name, admonitionCellAtts={}): | def visit_admonition(self, node, name='', admonitionCellAtts={}): | def visit_admonition(self, node, name, admonitionCellAtts={}): baseAdmonitionCellAtts = {"width" : "15%"} baseAdmonitionCellAtts.update(admonitionCellAtts) self.bodyContent.append('<table width="90%" border="1" align="center">\n' '<tbody><tr><td><table width="100%"><tbody><tr>\n') self.bodyContent.append(self.starttag(... |
self.bodyContent.append(self.language.labels[name.lower()]) | if name: self.bodyContent.append(self.language.labels[name.lower()]) | def visit_admonition(self, node, name, admonitionCellAtts={}): baseAdmonitionCellAtts = {"width" : "15%"} baseAdmonitionCellAtts.update(admonitionCellAtts) self.bodyContent.append('<table width="90%" border="1" align="center">\n' '<tbody><tr><td><table width="100%"><tbody><tr>\n') self.bodyContent.append(self.starttag(... |
print >> sys.stderr, __doc__ % globals() | if code == 0: out = sys.stdout else: out = sys.stderr print >> out, __doc__ % globals() | def usage(code, msg=''): print >> sys.stderr, __doc__ % globals() if msg: print >> sys.stderr, msg sys.exit(code) |
print >> sys.stderr, msg | print >> out, msg | def usage(code, msg=''): print >> sys.stderr, __doc__ % globals() if msg: print >> sys.stderr, msg sys.exit(code) |
visitor.document.reporter.debug('visit_' + self.__class__.__name__, category='nodes.Node.walk') | visitor.document.reporter.debug( 'calling dispatch_visit for %s' % self.__class__.__name__, category='nodes.Node.walk') | def walk(self, visitor): """ Traverse a tree of `Node` objects, calling ``visit_...`` methods of `visitor` when entering each node. If there is no ``visit_particular_node`` method for a node of type ``particular_node``, the ``unknown_visit`` method is called. (The `walkabout()` method is similar, except it also calls ... |
visitor.document.reporter.debug('visit_' + self.__class__.__name__, category='nodes.Node.walkabout') | visitor.document.reporter.debug( 'calling dispatch_visit for %s' % self.__class__.__name__, category='nodes.Node.walkabout') | def walkabout(self, visitor): """ Perform a tree traversal similarly to `Node.walk()` (which see), except also call ``depart_...`` methods before exiting each node. If there is no ``depart_particular_node`` method for a node of type ``particular_node``, the ``unknown_departure`` method is called. |
visitor.dispatch_visit(self, self.__class__.__name__) | visitor.dispatch_visit(self) | def walkabout(self, visitor): """ Perform a tree traversal similarly to `Node.walk()` (which see), except also call ``depart_...`` methods before exiting each node. If there is no ``depart_particular_node`` method for a node of type ``particular_node``, the ``unknown_departure`` method is called. |
'depart_' + self.__class__.__name__, | 'calling dispatch_departure for %s' % self.__class__.__name__, | def walkabout(self, visitor): """ Perform a tree traversal similarly to `Node.walk()` (which see), except also call ``depart_...`` methods before exiting each node. If there is no ``depart_particular_node`` method for a node of type ``particular_node``, the ``unknown_departure`` method is called. |
visitor.dispatch_departure(self, self.__class__.__name__) | visitor.dispatch_departure(self) | def walkabout(self, visitor): """ Perform a tree traversal similarly to `Node.walk()` (which see), except also call ``depart_...`` methods before exiting each node. If there is no ``depart_particular_node`` method for a node of type ``particular_node``, the ``unknown_departure`` method is called. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.