rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
s.tk.call( s.f.plf._w, CMD, 'plssym', dflt, scale ) | s.cmd( 'plssym', dflt, scale ) | def plssym( s, dflt, scale ): |
s.tk.call( s.f.plf._w, CMD, 'plsvpa', xmin, xmax, ymin, ymax ) | s.cmd( 'plsvpa', xmin, xmax, ymin, ymax ) | def plsvpa( s, xmin, xmax, ymin, ymax ): |
s.tk.call( s.f.plf._w, CMD, 'plsxax', digmax, digits ) | s.cmd( 'plsxax', digmax, digits ) | def plsxax( s, digmax, digits ): |
s.tk.call( s.f.plf._w, CMD, 'plsyax', digmax, digits ) | s.cmd( 'plsyax', digmax, digits ) | def plsyax( s, digmax, digits ): |
s.tk.call( s.f.plf._w, CMD, 'plszax', digmax, digits ) | s.cmd( 'plszax', digmax, digits ) | def plszax( s, digmax, digits ): |
s.tk.call( s.f.plf._w, CMD, 'plvasp', aspect ) | s.cmd( 'plvasp', aspect ) | def plvasp( s, aspect ): |
s.tk.call( s.f.plf._w, CMD, 'plvpas', xmin, xmax, ymin, ymax, aspect ) | s.cmd( 'plvpas', xmin, xmax, ymin, ymax, aspect ) | def plvpas( s, xmin, xmax, ymin, ymax, aspect ): |
s.tk.call( s.f.plf._w, CMD, 'plvpor', xmin, xmax, ymin, ymax ) | s.cmd( 'plvpor', xmin, xmax, ymin, ymax ) | def plvpor( s, xmin, xmax, ymin, ymax ): |
s.tk.call( s.f.plf._w, CMD, 'plvsta' ) | s.cmd( 'plvsta' ) | def plvsta(s): |
s.tk.call( s.f.plf._w, CMD, 'plw3d', basex, basey, height, xmin0, xmax0, ymin0, ymax0, zmin0, zmax0, alt, az) | s.cmd( 'plw3d', basex, basey, height, xmin0, xmax0, ymin0, ymax0, zmin0, zmax0, alt, az) | def plw3d( s, basex, basey, height, xmin0, xmax0, ymin0, ymax0, zmin0, zmax0, alt, az): |
s.tk.call( s.f.plf._w, CMD, 'plwid', width ) | s.cmd( 'plwid', width ) | def plwid( s, width ): |
s.tk.call( s.f.plf._w, CMD, 'plwind', xmin, xmax, ymin, ymax ) | s.cmd( 'plwind', xmin, xmax, ymin, ymax ) | def plwind( s, xmin, xmax, ymin, ymax ): |
x1 = cosi1*sinj0 y1 = sini1*sinj0 z1 = cosj0 | x1 = cosi0*sinj1 y1 = sini0*sinj1 z1 = cosj1 | def test_poly(k): draw = [ [ 1, 1, 1, 1 ], [ 1, 0, 1, 0 ], [ 0, 1, 0, 1 ], [ 1, 1, 0, 0 ] ] pladv(0) plvpor(0.0, 1.0, 0.0, 0.9) plwind(-1.0, 1.0, -0.9, 1.1) plcol0(1) plw3d(1.0, 1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, alt[k], az[k]) plbox3("bnstu", "x axis", 0.0, 0, "bnstu", "y axis", 0.0, 0, "bcdmnstuv", "z axis"... |
x3 = cosi0*sinj1 y3 = sini0*sinj1 z3 = cosj1 | x3 = cosi1*sinj0 y3 = sini1*sinj0 z3 = cosj0 | def test_poly(k): draw = [ [ 1, 1, 1, 1 ], [ 1, 0, 1, 0 ], [ 0, 1, 0, 1 ], [ 1, 1, 0, 0 ] ] pladv(0) plvpor(0.0, 1.0, 0.0, 0.9) plwind(-1.0, 1.0, -0.9, 1.1) plcol0(1) plw3d(1.0, 1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, alt[k], az[k]) plbox3("bnstu", "x axis", 0.0, 0, "bnstu", "y axis", 0.0, 0, "bcdmnstuv", "z axis"... |
plpoly3(x, y, z, draw[k]) | plpoly3(x, y, z, draw[k], 1) | def test_poly(k): draw = [ [ 1, 1, 1, 1 ], [ 1, 0, 1, 0 ], [ 0, 1, 0, 1 ], [ 1, 1, 0, 0 ] ] pladv(0) plvpor(0.0, 1.0, 0.0, 0.9) plwind(-1.0, 1.0, -0.9, 1.1) plcol0(1) plw3d(1.0, 1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, alt[k], az[k]) plbox3("bnstu", "x axis", 0.0, 0, "bnstu", "y axis", 0.0, 0, "bcdmnstuv", "z axis"... |
m = re.match('[ \t]+\{[ \t]\(char \*\)"([a-zA-Z_0-9]+)"(.*)\, NULL \},', line) | m = re.match('[ \t]+\{[ \t]\(char \*\)"([a-zA-Z_0-9]+)"(.*)\,[ ]*NULL[ ]*\},', line) | def main(): if len(sys.argv) != 3: print 'usage: makedocstrings infile outfile' infile = open(sys.argv[1], 'rt') outfile = open(sys.argv[2], 'wt') docstrings = {} while 1: line = infile.readline() if not line: break m = re.match(r'#define _doc_([a-zA-Z_0-9]+)', line) if m: name = m.group(1) value = '_doc_'+name docs... |
default_range = 1 | ifdefault_range = 1 | def plcont(z, *args): z = Numeric.asarray(z) if len(z.shape) != 2: raise ValueError, 'Expected 2D z array' if len(args) > 4 and type(args[0]) == types.IntType: for i in range(1,4): if type(args[i]) != types.IntType: raise ValueError, 'Expected 4 ints for kx,lx,ky,ly' else: # these 4 args are the kx, lx, ky, ly ints i... |
if default_range: | if ifdefault_range: | def plcont(z, *args): z = Numeric.asarray(z) if len(z.shape) != 2: raise ValueError, 'Expected 2D z array' if len(args) > 4 and type(args[0]) == types.IntType: for i in range(1,4): if type(args[i]) != types.IntType: raise ValueError, 'Expected 4 ints for kx,lx,ky,ly' else: # these 4 args are the kx, lx, ky, ly ints i... |
theta = (2.*pi/float(THETAPTS-1))*arange(THETAPTS) | theta = (2.*pi/float(THETAPTS-1))*arange(THETAPTS-1) | def polar(): #polar contour plot example. plenv(-1., 1., -1., 1., 0, -2,) plcol0(1) # Perimeter t = (2.*pi/(PERIMETERPTS-1))*arange(PERIMETERPTS) px = cos(t) py = sin(t) plline(px, py) # create data to be contoured. r = arange(RPTS)/float(RPTS-1) r.shape = (-1,1) theta = (2.*pi/float(THETAPTS-1))*arange(THETAPTS) xg ... |
zg = r*ones(THETAPTS) | zg = r*ones(THETAPTS-1) | def polar(): #polar contour plot example. plenv(-1., 1., -1., 1., 0, -2,) plcol0(1) # Perimeter t = (2.*pi/(PERIMETERPTS-1))*arange(PERIMETERPTS) px = cos(t) py = sin(t) plline(px, py) # create data to be contoured. r = arange(RPTS)/float(RPTS-1) r.shape = (-1,1) theta = (2.*pi/float(THETAPTS-1))*arange(THETAPTS) xg ... |
theta = (2.*pi/float(PTHETAPTS))*(0.5+arange(PTHETAPTS)) | theta = (2.*pi/float(PTHETAPTS-1))*(0.5+arange(PTHETAPTS-1)) | def potential(): #shielded potential contour plot example. # create data to be contoured. r = 0.5 + arange(PRPTS) r.shape = (-1,1) theta = (2.*pi/float(PTHETAPTS))*(0.5+arange(PTHETAPTS)) xg = r*cos(theta) yg = r*sin(theta) rmax = max(r.flat) xmin = min(xg.flat) xmax = max(xg.flat) ymin = min(yg.flat) ymax = max(yg.f... |
success = False; | def run_batch_test(testfile, expected_output): '''Run gameswf on a test file, and compare its output to the given expected output. Return an error code and a report string summarizing the results''' report = ""; success = True; [status, output] = commands.getstatusoutput(GAMESWF + BATCH_ARGS + testfile) # Clean up t... | |
customMsgBox(self, 'This file is already part of your project.', 'wakeup') | customMsgBox(self, 'This file is already part of your ' 'project.', 'wakeup') | def on_file_add(self, event): if self.project <> None: dlg = wxFileDialog (self, "Choose a file to add", self.project.directory, '', '*.txt', wxOPEN|wxFILE_MUST_EXIST) if dlg.ShowModal() == wxID_OK: file = dlg.GetPath() if file not in self.project.files: self.tree.AppendItem(self.root, file, self.im2) self.tree.Expand(... |
self.editor.InsertText(self.editor.GetCurrentPos(), quote(relative_uri(self.htmlfile(source), target))) | self.editor.InsertText( self.editor.GetCurrentPos(), quote(relative_path(self.htmlfile(source), target))) | def on_insert_path(self, event): if self.project <> None: item = self.activeitem if item != self.root: source = self.tree.GetItemText(item) dlg = wxFileDialog (self, "Choose file", self.project.directory, '', '*.*', wxOPEN|wxFILE_MUST_EXIST) if dlg.ShowModal() == wxID_OK: target = dlg.GetPath() self.editor.InsertText(s... |
dlg=wxMessageDialog(self, '%s does not exist.\nRemove from project?' % file, | dlg=wxMessageDialog(self, '%s does not exist.\nRemove ' 'from project?' % file, | def on_tree_item_activated(self, event): go_ahead = true |
self.body.append('}') | self.body.append('}\n') | def depart_footnote(self, node): if self.use_latex_footnotes: self.body.append('}') else: self.body.append('\\end{figure}\n') |
self.body.append('<a href=" | self.body.append('<a href=" node['id'])) | def visit_problematic(self, node): if node.hasattr('refid'): self.body.append('<a href="#%s">' % node['refid']) self.context.append('</a>') else: self.context.append('') self.body.append(self.starttag(node, 'span', '', CLASS='problematic')) |
self.body.append('<a href=" '(level %s system message)</p>\n' % (backrefs[0], node['type'], node['level'])) | attr['href'] = ' | def visit_system_message(self, node): if node['level'] < self.document.reporter['writer'].report_level: raise nodes.SkipNode self.body.append(self.starttag(node, 'div', CLASS='system-message')) self.body.append('<p class="system-message-title">') if node.hasattr('backrefs'): backrefs = node['backrefs'] if len(backrefs)... |
self.body.append('%s (%s; level %s system message)</p>\n' % (node['type'], ', '.join(backlinks), node['level'])) else: self.body.append('%s (level %s system message)</p>\n' % (node['type'], node['level'])) | backref_text = '%s; ' % ', '.join(backlinks) if attr: self.body.append(self.starttag({}, 'a', attr, '')) a_end = '</a>' self.body.append('%s%s (%slevel %s system message)</p>\n' % (node['type'], a_end, backref_text, node['level'])) | def visit_system_message(self, node): if node['level'] < self.document.reporter['writer'].report_level: raise nodes.SkipNode self.body.append(self.starttag(node, 'div', CLASS='system-message')) self.body.append('<p class="system-message-title">') if node.hasattr('backrefs'): backrefs = node['backrefs'] if len(backrefs)... |
elif self.active_table.is_open(): self.body.append('\n}\n') else: self.body.append('\n') self.body.append('\\end{flushleft}') self.body.append('\\end{ttfamily}\n') | else: if self.active_table.is_open(): self.body.append('\n}\n') else: self.body.append('\n') self.body.append('\\end{flushleft}') self.body.append('\\end{ttfamily}\n') | def depart_literal_block(self, node): if self.verbatim: self.body.append('\n\\end{verbatim}\n') self.verbatim = 0 elif self.active_table.is_open(): self.body.append('\n}\n') else: self.body.append('\n') self.body.append('\\end{flushleft}') self.body.append('\\end{ttfamily}\n') self.insert_none_breaking_blanks = 0 # obe... |
self.literal_block = 0 | def depart_literal_block(self, node): if self.verbatim: self.body.append('\n\\end{verbatim}\n') self.verbatim = 0 elif self.active_table.is_open(): self.body.append('\n}\n') else: self.body.append('\n') self.body.append('\\end{flushleft}') self.body.append('\\end{ttfamily}\n') self.insert_none_breaking_blanks = 0 # obe... | |
def setUp(self): os.chdir(os.path.join(DocutilsTestSupport.testroot, 'data')) def get_record(self, inputfile=None, **settings): | def get_record(self, **settings): | def setUp(self): os.chdir(os.path.join(DocutilsTestSupport.testroot, 'data')) |
settings.setdefault('source_path', 'dependencies.txt') | settings.setdefault('source_path', os.path.join('data', 'dependencies.txt')) | def get_record(self, inputfile=None, **settings): |
['include.txt', 'raw.txt']) | [os.path.join('data', 'include.txt'), os.path.join('data', 'raw.txt')]) | def test_dependencies(self): self.assertEqual(self.get_record(), ['include.txt', 'raw.txt']) self.assertEqual(self.get_record(writer_name='latex'), ['include.txt', 'raw.txt', 'some_image.png']) |
['include.txt', 'raw.txt', | [os.path.join('data', 'include.txt'), os.path.join('data', 'raw.txt'), | def test_dependencies(self): self.assertEqual(self.get_record(), ['include.txt', 'raw.txt']) self.assertEqual(self.get_record(writer_name='latex'), ['include.txt', 'raw.txt', 'some_image.png']) |
self.assertEqual(self.get_record(source_path='csv_dep.txt'), ['csv_data.txt']) | self.assertEqual( self.get_record(source_path=os.path.join('data', 'csv_dep.txt')), ['data/csv_data.txt']) | def test_csv_dependencies(self): try: import csv self.assertEqual(self.get_record(source_path='csv_dep.txt'), ['csv_data.txt']) except ImportError: pass |
so['stylesheet_path'] = 'stylesheet.txt' | so['stylesheet_path'] = os.path.join('data', 'stylesheet.txt') | def test_stylesheet_dependencies(self): # Parameters to publish_file. s = {'settings_overrides': {}} so = s['settings_overrides'] so['embed_stylesheet'] = 0 so['stylesheet_path'] = 'stylesheet.txt' so['stylesheet'] = None s['writer_name'] = 'html' self.assert_('stylesheet.txt' not in self.get_record(**s)) so['embed_sty... |
self.assert_('stylesheet.txt' not in | self.assert_(os.path.join('data', 'stylesheet.txt') not in | def test_stylesheet_dependencies(self): # Parameters to publish_file. s = {'settings_overrides': {}} so = s['settings_overrides'] so['embed_stylesheet'] = 0 so['stylesheet_path'] = 'stylesheet.txt' so['stylesheet'] = None s['writer_name'] = 'html' self.assert_('stylesheet.txt' not in self.get_record(**s)) so['embed_sty... |
self.assert_('stylesheet.txt' in | self.assert_(os.path.join('data', 'stylesheet.txt') in | def test_stylesheet_dependencies(self): # Parameters to publish_file. s = {'settings_overrides': {}} so = s['settings_overrides'] so['embed_stylesheet'] = 0 so['stylesheet_path'] = 'stylesheet.txt' so['stylesheet'] = None s['writer_name'] = 'html' self.assert_('stylesheet.txt' not in self.get_record(**s)) so['embed_sty... |
self.body.append( '\\docutilsrole%s{' % node.get('class')) | if node.get('class'): cls = node['class'] elif node.get('classes'): cls = node['classes'][0] else: cls = 'Unknown' self.body.append( '\\docutilsrole%s{' % cls) | def visit_inline(self, node): # titlereference self.body.append( '\\docutilsrole%s{' % node.get('class')) |
href = node['refuri'] | href = node['refuri'].replace(' | def visit_reference(self, node): # BUG: hash_char "#" is trouble some in LaTeX. # mbox and other environment do not like the '#'. hash_char = '\\#' |
writer = MoinWriter(formatter, self.request), settings_overrides = {'traceback': 1}) text = '<h2>' + parts['title'] + '</h2>' | writer = MoinWriter(formatter, self.request)) text = '' if parts['title']: text += '<h2>' + parts['title'] + '</h2>' | def format(self, formatter): parts = publish_parts(source = self.raw, writer = MoinWriter(formatter, self.request), settings_overrides = {'traceback': 1}) text = '<h2>' + parts['title'] + '</h2>' # If there is only one subtitle then it is held in parts['subtitle']. # However, if there is more than one subtitle then th... |
text += '<h3>' + parts['subtitle'] + '</h3>' | if parts['subtitle']: text += '<h3>' + parts['subtitle'] + '</h3>' | def format(self, formatter): parts = publish_parts(source = self.raw, writer = MoinWriter(formatter, self.request), settings_overrides = {'traceback': 1}) text = '<h2>' + parts['title'] + '</h2>' # If there is only one subtitle then it is held in parts['subtitle']. # However, if there is more than one subtitle then th... |
self.level = 0 | def __init__(self, document, formatter, request, parser, writer): html4css1.HTMLTranslator.__init__(self, document) self.formatter = formatter self.request = request # MMG: Do we need this? Not sure what its doing. self.level = 0 # We supply our own request.write so that the html is added to the # html4css1 body list i... | |
self.body.append(self.starttag({}, 'a', '', attr)) | self.body.append(self.starttag({}, 'a', '', **attr)) | def visit_system_message(self, node): if node['level'] < self.document.reporter['writer'].report_level: raise nodes.SkipNode self.body.append(self.starttag(node, 'div', CLASS='system-message')) self.body.append('<p class="system-message-title">') attr = {} a_end = '' backref_text = '' if node.hasattr('id'): attr['name'... |
'docutils/writers/latex2e/latex2e.tex']), | ['docutils/writers/latex2e/latex2e.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 |
self.body.append('\\bibitem[%s]{%s}{%s}\n' % (bi[0], bi[0], bi[1])) | cite_key = bi[0].replace(r"{\_}","_") self.body.append('\\bibitem[%s]{%s}{%s}\n' % (bi[0], cite_key, bi[1])) | def depart_document(self, node): # TODO insertion point of bibliography should none automatic. if self._use_latex_citations and len(self._bibitems)>0: 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 b... |
self.title = self.title + \ | if isinstance(node.parent, nodes.sidebar): self.body.append('~\\\\\n\\textbf{') self.context.append('}\n\\smallskip\n') else: self.title = self.title + \ | def visit_subtitle(self, node): self.title = self.title + \ '\\\\\n\\large{%s}\n' % self.encode(node.astext()) raise nodes.SkipNode |
pass | if isinstance(node.parent, nodes.sidebar): self.body.append(self.context.pop()) | def depart_subtitle(self, node): pass |
if node.parent.hasattr('id') and not self.use_latex_toc: | elif node.parent.hasattr('id') and not self.use_latex_toc: | def depart_title(self, node): self.body.append(self.context.pop()) # BUG level depends on style. if node.parent.hasattr('id') and not self.use_latex_toc: # pdflatex allows level 0 to 3 # ToC would be the only on level 0 so i choose to decrement the rest. # "Table of contents" bookmark to see the ToC. To avoid this # we... |
elif isinstance(node.parent, nodes.sidebar): | elif isinstance(node.parent, nodes.sidebar) \ or isinstance(node.parent, nodes.admonition): | def visit_title(self, node): """Only 3 section levels are supported by LaTeX article (AFAIR).""" |
def extract_extension_options(field_list, option_spec): | def extract_extension_options(field_list, options_spec): | def extract_extension_options(field_list, option_spec): """ Return a dictionary mapping extension option names to converted values. :Parameters: - `field_list`: A flat field list without field arguments, where each field body consists of a single paragraph only. - `option_spec`: Dictionary mapping known option names t... |
- `option_spec`: Dictionary mapping known option names to a | - `options_spec`: Dictionary mapping known option names to a | def extract_extension_options(field_list, option_spec): """ Return a dictionary mapping extension option names to converted values. :Parameters: - `field_list`: A flat field list without field arguments, where each field body consists of a single paragraph only. - `option_spec`: Dictionary mapping known option names t... |
option_dict = assemble_option_dict(option_list, option_spec) | option_dict = assemble_option_dict(option_list, options_spec) | def extract_extension_options(field_list, option_spec): """ Return a dictionary mapping extension option names to converted values. :Parameters: - `field_list`: A flat field list without field arguments, where each field body consists of a single paragraph only. - `option_spec`: Dictionary mapping known option names t... |
def assemble_option_dict(option_list, option_spec): | def assemble_option_dict(option_list, options_spec): | def assemble_option_dict(option_list, option_spec): """ Return a mapping of option names to values. :Parameters: - `option_list`: A list of (name, value) pairs (the output of `extract_options()`). - `option_spec`: Dictionary mapping known option names to a conversion function such as `int` or `float`. :Exceptions: - ... |
- `option_spec`: Dictionary mapping known option names to a | - `options_spec`: Dictionary mapping known option names to a | def assemble_option_dict(option_list, option_spec): """ Return a mapping of option names to values. :Parameters: - `option_list`: A list of (name, value) pairs (the output of `extract_options()`). - `option_spec`: Dictionary mapping known option names to a conversion function such as `int` or `float`. :Exceptions: - ... |
convertor = option_spec[name] | convertor = options_spec[name] | def assemble_option_dict(option_list, option_spec): """ Return a mapping of option names to values. :Parameters: - `option_list`: A list of (name, value) pairs (the output of `extract_options()`). - `option_spec`: Dictionary mapping known option names to a conversion function such as `int` or `float`. :Exceptions: - ... |
def new_document(source, options=None): if options is None: options = frontend.OptionParser().get_default_values() reporter = Reporter(source, options.report_level, options.halt_level, options.warning_stream, options.debug) document = nodes.document(options, reporter, source=source) | def new_document(source, settings=None): if settings is None: settings = frontend.OptionParser().get_default_values() reporter = Reporter(source, settings.report_level, settings.halt_level, settings.warning_stream, settings.debug) document = nodes.document(settings, reporter, source=source) | def new_document(source, options=None): if options is None: options = frontend.OptionParser().get_default_values() reporter = Reporter(source, options.report_level, options.halt_level, options.warning_stream, options.debug) document = nodes.document(options, reporter, source=source) document.note_source(source) return ... |
if source_parts[:1] != target_parts[:1]: | if source_parts[:2] != target_parts[:2]: | def relative_path(source, target): """ Build and return a path to `target`, relative to `source`. If there is no common prefix, return the absolute path to `target`. """ source_parts = os.path.abspath(source or '').split(os.sep) target_parts = os.path.abspath(target).split(os.sep) if source_parts[:1] != target_parts[:... |
unicode_comment_pattern = re.compile(r'( |\n|^).. ') | unicode_comment_pattern = re.compile(r'( |\n|^)\.\. ') | def unicode_directive(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine): r""" Convert Unicode character codes (numbers) to characters. Codes may be decimal numbers, hexadecimal numbers (prefixed by ``0x``, ``x``, ``\x``, ``U+``, ``u``, or ``\u``; e.g. ``U+262E``), or XML-styl... |
Its children are all `Text` or `TextElement` subclass nodes. You can | Its children are all `Text` or `Inline` subclass nodes. You can | def set_class(self, name): """Add a new name to the "class" attribute.""" self.attributes['class'] = (self.attributes.get('class', '') + ' ' + name.lower()).strip() |
backlinks = [] | def footnote_backrefs(self, node): if self.settings.footnote_backlinks and node.hasattr('backrefs'): backrefs = node['backrefs'] if len(backrefs) == 1: self.context.append('') self.context.append('<a class="fn-backref" href="#%s" ' 'name="%s">' % (backrefs[0], node['id'])) else: i = 1 backlinks = [] for backref in back... | |
topic['name'] = title.astext() | name = title.astext() | def transform(self): topic = nodes.topic(CLASS='contents') title = self.startnode.details['title'] if self.startnode.details.has_key('local'): startnode = self.startnode.parent # @@@ generate an error if the startnode (directive) not at # section/document top-level? Drag it up until it is? while not isinstance(startnod... |
topic['name'] = self.language.labels['contents'] | name = self.language.labels['contents'] | def transform(self): topic = nodes.topic(CLASS='contents') title = self.startnode.details['title'] if self.startnode.details.has_key('local'): startnode = self.startnode.parent # @@@ generate an error if the startnode (directive) not at # section/document top-level? Drag it up until it is? while not isinstance(startnod... |
pass | self.body.append(self.context.pop()) | def depart_image(self, node): pass |
self.language = languages.get_language(document.language_code) | self.language = languages.get_language(document.options.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. |
start_string_prefix = (r'(?:(?<=^)|(?<=[ \n%s]))' | start_string_prefix = (r'(?:(?<=^)|(?<=[-/: \n%s]))' | def parse(self, text, lineno, memo, parent): """ Return 2 lists: nodes (text and inline elements), and system_messages. |
end_string_suffix = (r'(?:(?=$)|(?=[- \n.,:;!?%s]))' | end_string_suffix = (r'(?:(?=$)|(?=[-/:.,;!? \n%s]))' | def parse(self, text, lineno, memo, parent): """ Return 2 lists: nodes (text and inline elements), and system_messages. |
if self.use_latex_footnotes: | if isinstance(node.parent, nodes.footnote) and self.use_latex_footnotes: | def visit_label(self, node): if self.use_latex_footnotes: raise nodes.SkipNode self.body.append('[') |
if not node.attributes.has_key('align'): | if (not node.attributes.has_key('align') or node.attributes['align'] == 'center'): | def visit_figure(self, node): if not node.attributes.has_key('align'): align = 'center' else: align = 'flush'+node.attributes['align'] self.body.append( '\\begin{figure}[htbp]\\begin{%s}\n' % align ) self.context.append( '\\end{%s}\\end{figure}\n' % align ) |
('Don't report any system messages. (Same as "--report=none".)', | ('Do not report any system messages. (Same as "--report=none".)', | def make_paths_absolute(dictionary, base_path=None): """ Interpret filesystem path settings relative to the `base_path` given. """ if base_path is None: base_path = os.getcwd() for option in relative_path_options: if dictionary.has_key(option) and dictionary[option]: dictionary[option] = os.path.normpath( os.path.join(... |
body = self.docinfo + self.body + self.body_suffix[:-1] | body = self.body_pre_docinfo + self.docinfo + self.body + \ self.body_suffix[:-1] | def astext(self): headers = ''.join(['%s: %s\n' % (k,v) \ for (k,v) in self.headers.items()]) # kludge! want footer, but not '</body></html>' body = self.docinfo + self.body + self.body_suffix[:-1] |
if 'scale' in attrs: | if attrs.has_key('scale'): | def visit_image(self, node): attrs = node.attributes pre = [] # in reverse order post = ['\\includegraphics{%s}' % attrs['uri']] inline = isinstance(node.parent, nodes.TextElement) if 'scale' in attrs: # Could also be done with ``scale`` option to # ``\includegraphics``; doing it this way for con... |
if 'align' in attrs: | if attrs.has_key('align'): | def visit_image(self, node): attrs = node.attributes pre = [] # in reverse order post = ['\\includegraphics{%s}' % attrs['uri']] inline = isinstance(node.parent, nodes.TextElement) if 'scale' in attrs: # Could also be done with ``scale`` option to # ``\includegraphics``; doing it this way for con... |
special.append(make_parameter(argnames[-1], excess_keyword=True)) | special.append(make_parameter(argnames[-1], excess_keyword=1)) | def parse_parameter_list(self, node): parameters = [] special = [] argnames = list(node.argnames) if node.kwargs: special.append(make_parameter(argnames[-1], excess_keyword=True)) argnames.pop() if node.varargs: special.append(make_parameter(argnames[-1], excess_positional=True)) argnames.pop() defaults = list(node.def... |
excess_positional=True)) | excess_positional=1)) | def parse_parameter_list(self, node): parameters = [] special = [] argnames = list(node.argnames) if node.kwargs: special.append(make_parameter(argnames[-1], excess_keyword=True)) argnames.pop() if node.varargs: special.append(make_parameter(argnames[-1], excess_positional=True)) argnames.pop() defaults = list(node.def... |
def make_parameter(name, excess_keyword=False, excess_positional=False): | def make_parameter(name, excess_keyword=0, excess_positional=0): """ excess_keyword and excess_positional must be either 1 or 0, and not both of them can be 1. """ | def make_parameter(name, excess_keyword=False, excess_positional=False): n = pynodes.parameter() n.append(make_object_name(name)) assert not excess_keyword or not excess_positional if excess_keyword: n['excess_keyword'] = 1 if excess_positional: n['excess_positional'] = 1 return n |
except ValueError, err: error = state_machine.reporter.error( 'Invalid character code: %s\n%s' % (code, err), | except (ValueError, OverflowError), err: error = state_machine.reporter.error( 'Invalid character code: %s\n%s: %s' % (code, err.__class__.__name__, err), | def unicode_directive(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine): r""" Convert Unicode character codes (numbers) to characters. Codes may be decimal numbers, hexadecimal numbers (prefixed by ``0x``, ``x``, ``\x``, ``U+``, ``u``, or ``\u``; e.g. ``U+262E``), or XML-styl... |
value = ' '.join(value) element.setAttribute(attribute, str(value)) | value = ' '.join(['%s' % v for v in value]) element.setAttribute(attribute, '%s' % value) | def _dom_node(self, domroot): element = domroot.createElement(self.tagname) for attribute, value in self.attributes.items(): if isinstance(value, ListType): value = ' '.join(value) element.setAttribute(attribute, str(value)) for child in self.children: element.appendChild(child._dom_node(domroot)) return element |
return '%s%s%s' % (self.starttag(), ''.join([str(c) for c in self.children]), self.endtag()) | return u'%s%s%s' % (self.starttag(), ''.join([str(c) for c in self.children]), self.endtag()) | def __str__(self): if self.children: return '%s%s%s' % (self.starttag(), ''.join([str(c) for c in self.children]), self.endtag()) else: return self.emptytag() |
values = [str(v) for v in value] | values = ['%s' % v for v in value] | def starttag(self): parts = [self.tagname] for name, value in self.attlist(): if value is None: # boolean attribute parts.append(name) elif isinstance(value, ListType): values = [str(v) for v in value] parts.append('%s="%s"' % (name, ' '.join(values))) else: parts.append('%s="%s"' % (name, str(value))) return... |
parts.append('%s="%s"' % (name, str(value))) | parts.append('%s="%s"' % (name, value)) | def starttag(self): parts = [self.tagname] for name, value in self.attlist(): if value is None: # boolean attribute parts.append(name) elif isinstance(value, ListType): values = [str(v) for v in value] parts.append('%s="%s"' % (name, ' '.join(values))) else: parts.append('%s="%s"' % (name, str(value))) return... |
return '<%s/>' % ' '.join([self.tagname] + ['%s="%s"' % (n, v) for n, v in self.attlist()]) | return u'<%s/>' % ' '.join([self.tagname] + ['%s="%s"' % (n, v) for n, v in self.attlist()]) | def emptytag(self): return '<%s/>' % ' '.join([self.tagname] + ['%s="%s"' % (n, v) for n, v in self.attlist()]) |
(ename, email) = rfc822.parseaddr(node.astext()) | (ename, email) = rfc822.parseaddr(node[1].astext()) | def visit_field(self, node): if isinstance(node.parent, nodes.docinfo): name = node[0].astext().lower().replace(" ","") if name == "moduleauthor": (ename, email) = rfc822.parseaddr(node[1].astext()) self.docinfo["moduleauthor"] = ename self.docinfo["moduleauthoremail"] = email elif name in ("author", "sectionauthor") :... |
self.headers = {} | self.headers = {'title': 'None'} | def __init__(self, document): |
title = '<h1 class="title">%(title)s</h1>\n' % self.headers body = [title,] + self.docinfo + self.body | body = self.docinfo + self.body + self.body_suffix[:-1] | def astext(self): headers = ''.join(['%s: %s\n' % (k,v) \ for (k,v) in self.headers.items()]) title = '<h1 class="title">%(title)s</h1>\n' % self.headers body = [title,] + self.docinfo + self.body |
self.context.append('\n') | def visit_title(self, node): """Only 6 section levels are supported by HTML.""" if isinstance(node.parent, nodes.topic): HTMLTranslator.visit_title(self, node) elif self.section_level == 0: # document title title = node.astext() self.headers['title'] = self.encode(title) self.context.append('\n') else: HTMLTranslator.v... | |
r'\|'] | r'\|(?!\|)'] | def parse(self, text, lineno, memo, parent): """ Return 2 lists: nodes (text and inline elements), and system_messages. |
return os.path.abspath(os.path.join(mydir, *(path.split('/')))) mydir = os.path.dirname(fixpath.func_code.co_filename) | return os.path.abspath(os.path.join(*(path.split('/')))) | def fixpath(path): return os.path.abspath(os.path.join(mydir, *(path.split('/')))) |
if isinstance(node[0], nodes.Element): | if isinstance(node[-1], nodes.Element): | def visit_docinfo_item(self, node, name, meta=1): if meta: self.head.append('<meta name="%s" content="%s" />\n' % (name, self.attval(node.astext()))) self.body.append(self.starttag(node, 'tr', '')) self.body.append('<th class="docinfo-name">%s:</th>\n<td>' % self.language.labels[name]) if len(node): if isinstance(node[... |
def insert(self, i, item): assert isinstance(item, Node) item.parent = self self.children.insert(i, 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 | def insert(self, i, item): assert isinstance(item, Node) item.parent = self self.children.insert(i, item) |
Parse `input_lines` and return a `docutils.nodes.document` instance. Extend `StateMachineWS.run()`: set up parse-global data, run the StateMachine, and return the resulting document. | Parse `input_lines` and modify the `document` node in place. Extend `StateMachineWS.run()`: set up parse-global data and run the StateMachine. | def run(self, input_lines, document, input_offset=0, match_titles=1, inliner=None): """ Parse `input_lines` and return a `docutils.nodes.document` instance. |
`block`. Also keep track of optional intermdediate blank lines and the | `block`. Also keep track of optional intermediate blank lines and the | def nested_list_parse(self, block, input_offset, node, initial_state, blank_finish, blank_finish_state=None, extra_settings={}, match_titles=0, state_machine_class=None, state_machine_kwargs=None): """ Create a new StateMachine rooted at `node` and run it over the input `block`. Also keep track of optional intermdediat... |
docv = [int(part) for part in docutils.__version__.split('.')] reqv = [int(part) for part in REQUIRES['docutils'].split('.')] if docutils.__version__ < REQUIRES['docutils']: | installed = [int(part) for part in docutils.__version__.split('.')] required = [int(part) for part in REQUIRES['docutils'].split('.')] if installed < required: | def check_requirements(): # Check Python: try: from email.Utils import parseaddr except ImportError: PEP_TYPE_DISPATCH['text/plain'] = None PEP_TYPE_MESSAGES['text/plain'] = ( 'Python %s or better required for "%%(pep_type)s" PEP ' 'processing; %s present (%%(inpath)s).' % (REQUIRES['python'], sys.version.split()[0])) ... |
self.parse_row(rowlines, line) | self.parse_row(rowlines, (line.rstrip(), offset)) | def parse_table(self): """ First determine the column boundaries from the top border, then process rows. Each row may consist of multiple lines; accumulate lines until a row is complete. Call `self.parse_row` to finish the job. """ # Top border must fully describe all table columns. self.columns = self.parse_columns(... |
rowlines = [(line, offset)] | rowlines = [(line.rstrip(), offset)] | def parse_table(self): """ First determine the column boundaries from the top border, then process rows. Each row may consist of multiple lines; accumulate lines until a row is complete. Call `self.parse_row` to finish the job. """ # Top border must fully describe all table columns. self.columns = self.parse_columns(... |
rowlines.append((line, offset)) | rowlines.append((line.rstrip(), offset)) | def parse_table(self): """ First determine the column boundaries from the top border, then process rows. Each row may consist of multiple lines; accumulate lines until a row is complete. Call `self.parse_row` to finish the job. """ # Top border must fully describe all table columns. self.columns = self.parse_columns(... |
columns = self.parse_columns(spanline) | columns = self.parse_columns(spanline[0]) | def parse_row(self, lines, spanline=None): """ Given the text `lines` of a row, parse it and append to `self.table`. |
row = self.init_row(columns, lines[0][1]) | while lines and not lines[-1][0]: lines.pop() if lines: offset = lines[0][1] elif spanline: offset = spanline[1] else: return row = self.init_row(columns, offset) | def parse_row(self, lines, spanline=None): """ Given the text `lines` of a row, parse it and append to `self.table`. |
raise MarkupMismatch | raise rst.states.MarkupMismatch | def standalone_refs(self, match, lineno): text = match.group(0) if text.startswith('pep-'): ref = os.path.splitext(text)[0] + ".html" elif text.startswith('PEP'): pepnum = int(match.group('pepnum')) ref = self.pep_url % pepnum elif text.startswith('RFC'): rfcnum = int(match.group('rfcnum')) ref = self.rfc_url % rfcnum ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.