body_hash stringlengths 64 64 | body stringlengths 23 109k | docstring stringlengths 1 57k | path stringlengths 4 198 | name stringlengths 1 115 | repository_name stringlengths 7 111 | repository_stars float64 0 191k | lang stringclasses 1 value | body_without_docstring stringlengths 14 108k | unified stringlengths 45 133k |
|---|---|---|---|---|---|---|---|---|---|
8479cc6f04c737504184b5ca1f066f3c49a9299ce9fe853314b4f448391d0d31 | def parse(self, reader):
'Parse the formula until the end'
formula = self.parseformula(reader)
while (not reader.currentline().startswith(self.ending)):
stripped = reader.currentline().strip()
if (len(stripped) > 0):
Trace.error(('Unparsed formula line ' + stripped))
reader.nextline()
reader.nextline()
return formula | Parse the formula until the end | Lib/site-packages/docutils/utils/math/math2html.py | parse | edupyter/EDUPYTER | 2 | python | def parse(self, reader):
formula = self.parseformula(reader)
while (not reader.currentline().startswith(self.ending)):
stripped = reader.currentline().strip()
if (len(stripped) > 0):
Trace.error(('Unparsed formula line ' + stripped))
reader.nextline()
reader.nextline()
return formula | def parse(self, reader):
formula = self.parseformula(reader)
while (not reader.currentline().startswith(self.ending)):
stripped = reader.currentline().strip()
if (len(stripped) > 0):
Trace.error(('Unparsed formula line ' + stripped))
reader.nextline()
reader.nextline()
return formula<|docstring|>Parse the formula until the end<|endoftext|> |
0f804d73bfc30f2f594f840b6af5444f8950872c5c3e98b85aa400873e3bc7d0 | def parseformula(self, reader):
'Parse the formula contents'
simple = FormulaConfig.starts['simple']
if (simple in reader.currentline()):
rest = reader.currentline().split(simple, 1)[1]
if (simple in rest):
return self.parsesingleliner(reader, simple, simple)
return self.parsemultiliner(reader, simple, simple)
if (FormulaConfig.starts['complex'] in reader.currentline()):
return self.parsemultiliner(reader, FormulaConfig.starts['complex'], FormulaConfig.endings['complex'])
beginbefore = FormulaConfig.starts['beginbefore']
beginafter = FormulaConfig.starts['beginafter']
if (beginbefore in reader.currentline()):
if reader.currentline().strip().endswith(beginafter):
current = reader.currentline().strip()
endsplit = current.split(beginbefore)[1].split(beginafter)
startpiece = ((beginbefore + endsplit[0]) + beginafter)
endbefore = FormulaConfig.endings['endbefore']
endafter = FormulaConfig.endings['endafter']
endpiece = ((endbefore + endsplit[0]) + endafter)
return ((startpiece + self.parsemultiliner(reader, startpiece, endpiece)) + endpiece)
Trace.error(((('Missing ' + beginafter) + ' in ') + reader.currentline()))
return ''
begincommand = FormulaConfig.starts['command']
beginbracket = FormulaConfig.starts['bracket']
if ((begincommand in reader.currentline()) and (beginbracket in reader.currentline())):
endbracket = FormulaConfig.endings['bracket']
return self.parsemultiliner(reader, beginbracket, endbracket)
Trace.error((('Formula beginning ' + reader.currentline()) + ' is unknown'))
return '' | Parse the formula contents | Lib/site-packages/docutils/utils/math/math2html.py | parseformula | edupyter/EDUPYTER | 2 | python | def parseformula(self, reader):
simple = FormulaConfig.starts['simple']
if (simple in reader.currentline()):
rest = reader.currentline().split(simple, 1)[1]
if (simple in rest):
return self.parsesingleliner(reader, simple, simple)
return self.parsemultiliner(reader, simple, simple)
if (FormulaConfig.starts['complex'] in reader.currentline()):
return self.parsemultiliner(reader, FormulaConfig.starts['complex'], FormulaConfig.endings['complex'])
beginbefore = FormulaConfig.starts['beginbefore']
beginafter = FormulaConfig.starts['beginafter']
if (beginbefore in reader.currentline()):
if reader.currentline().strip().endswith(beginafter):
current = reader.currentline().strip()
endsplit = current.split(beginbefore)[1].split(beginafter)
startpiece = ((beginbefore + endsplit[0]) + beginafter)
endbefore = FormulaConfig.endings['endbefore']
endafter = FormulaConfig.endings['endafter']
endpiece = ((endbefore + endsplit[0]) + endafter)
return ((startpiece + self.parsemultiliner(reader, startpiece, endpiece)) + endpiece)
Trace.error(((('Missing ' + beginafter) + ' in ') + reader.currentline()))
return
begincommand = FormulaConfig.starts['command']
beginbracket = FormulaConfig.starts['bracket']
if ((begincommand in reader.currentline()) and (beginbracket in reader.currentline())):
endbracket = FormulaConfig.endings['bracket']
return self.parsemultiliner(reader, beginbracket, endbracket)
Trace.error((('Formula beginning ' + reader.currentline()) + ' is unknown'))
return | def parseformula(self, reader):
simple = FormulaConfig.starts['simple']
if (simple in reader.currentline()):
rest = reader.currentline().split(simple, 1)[1]
if (simple in rest):
return self.parsesingleliner(reader, simple, simple)
return self.parsemultiliner(reader, simple, simple)
if (FormulaConfig.starts['complex'] in reader.currentline()):
return self.parsemultiliner(reader, FormulaConfig.starts['complex'], FormulaConfig.endings['complex'])
beginbefore = FormulaConfig.starts['beginbefore']
beginafter = FormulaConfig.starts['beginafter']
if (beginbefore in reader.currentline()):
if reader.currentline().strip().endswith(beginafter):
current = reader.currentline().strip()
endsplit = current.split(beginbefore)[1].split(beginafter)
startpiece = ((beginbefore + endsplit[0]) + beginafter)
endbefore = FormulaConfig.endings['endbefore']
endafter = FormulaConfig.endings['endafter']
endpiece = ((endbefore + endsplit[0]) + endafter)
return ((startpiece + self.parsemultiliner(reader, startpiece, endpiece)) + endpiece)
Trace.error(((('Missing ' + beginafter) + ' in ') + reader.currentline()))
return
begincommand = FormulaConfig.starts['command']
beginbracket = FormulaConfig.starts['bracket']
if ((begincommand in reader.currentline()) and (beginbracket in reader.currentline())):
endbracket = FormulaConfig.endings['bracket']
return self.parsemultiliner(reader, beginbracket, endbracket)
Trace.error((('Formula beginning ' + reader.currentline()) + ' is unknown'))
return <|docstring|>Parse the formula contents<|endoftext|> |
7624757e00c4f429b11bdf1b24b029a8781b69c3277c1142e2b3510617deea42 | def parsesingleliner(self, reader, start, ending):
'Parse a formula in one line'
line = reader.currentline().strip()
if (not (start in line)):
Trace.error(((('Line ' + line) + ' does not contain formula start ') + start))
return ''
if (not line.endswith(ending)):
Trace.error(((('Formula ' + line) + ' does not end with ') + ending))
return ''
index = line.index(start)
rest = line[(index + len(start)):(- len(ending))]
reader.nextline()
return rest | Parse a formula in one line | Lib/site-packages/docutils/utils/math/math2html.py | parsesingleliner | edupyter/EDUPYTER | 2 | python | def parsesingleliner(self, reader, start, ending):
line = reader.currentline().strip()
if (not (start in line)):
Trace.error(((('Line ' + line) + ' does not contain formula start ') + start))
return
if (not line.endswith(ending)):
Trace.error(((('Formula ' + line) + ' does not end with ') + ending))
return
index = line.index(start)
rest = line[(index + len(start)):(- len(ending))]
reader.nextline()
return rest | def parsesingleliner(self, reader, start, ending):
line = reader.currentline().strip()
if (not (start in line)):
Trace.error(((('Line ' + line) + ' does not contain formula start ') + start))
return
if (not line.endswith(ending)):
Trace.error(((('Formula ' + line) + ' does not end with ') + ending))
return
index = line.index(start)
rest = line[(index + len(start)):(- len(ending))]
reader.nextline()
return rest<|docstring|>Parse a formula in one line<|endoftext|> |
b43ffa01f00359d9e8b736b890e03a966c655342560d9c6dad85ccbe4ec0f86b | def parsemultiliner(self, reader, start, ending):
'Parse a formula in multiple lines'
formula = ''
line = reader.currentline()
if (not (start in line)):
Trace.error(((('Line ' + line.strip()) + ' does not contain formula start ') + start))
return ''
index = line.index(start)
line = line[(index + len(start)):].strip()
while (not line.endswith(ending)):
formula += (line + '\n')
reader.nextline()
line = reader.currentline()
formula += line[:(- len(ending))]
reader.nextline()
return formula | Parse a formula in multiple lines | Lib/site-packages/docutils/utils/math/math2html.py | parsemultiliner | edupyter/EDUPYTER | 2 | python | def parsemultiliner(self, reader, start, ending):
formula =
line = reader.currentline()
if (not (start in line)):
Trace.error(((('Line ' + line.strip()) + ' does not contain formula start ') + start))
return
index = line.index(start)
line = line[(index + len(start)):].strip()
while (not line.endswith(ending)):
formula += (line + '\n')
reader.nextline()
line = reader.currentline()
formula += line[:(- len(ending))]
reader.nextline()
return formula | def parsemultiliner(self, reader, start, ending):
formula =
line = reader.currentline()
if (not (start in line)):
Trace.error(((('Line ' + line.strip()) + ' does not contain formula start ') + start))
return
index = line.index(start)
line = line[(index + len(start)):].strip()
while (not line.endswith(ending)):
formula += (line + '\n')
reader.nextline()
line = reader.currentline()
formula += line[:(- len(ending))]
reader.nextline()
return formula<|docstring|>Parse a formula in multiple lines<|endoftext|> |
c3cca7e958d1317c765214b35c3953782b48ed6469ca27eb8bc780e510f4c10a | def __init__(self):
"The formula bit type can be 'alpha', 'number', 'font'."
self.contents = []
self.output = ContentsOutput() | The formula bit type can be 'alpha', 'number', 'font'. | Lib/site-packages/docutils/utils/math/math2html.py | __init__ | edupyter/EDUPYTER | 2 | python | def __init__(self):
self.contents = []
self.output = ContentsOutput() | def __init__(self):
self.contents = []
self.output = ContentsOutput()<|docstring|>The formula bit type can be 'alpha', 'number', 'font'.<|endoftext|> |
aad46914568402f8e7623dea20f794065195a5ba12df716795a7f41d9a8af65c | def setfactory(self, factory):
'Set the internal formula factory.'
self.factory = factory
return self | Set the internal formula factory. | Lib/site-packages/docutils/utils/math/math2html.py | setfactory | edupyter/EDUPYTER | 2 | python | def setfactory(self, factory):
self.factory = factory
return self | def setfactory(self, factory):
self.factory = factory
return self<|docstring|>Set the internal formula factory.<|endoftext|> |
ed030a6a20415875d55081302d575a74f545a4aca5506a1dd62a3543e219e6ad | def add(self, bit):
'Add any kind of formula bit already processed'
self.contents.append(bit)
self.original += bit.original
bit.parent = self | Add any kind of formula bit already processed | Lib/site-packages/docutils/utils/math/math2html.py | add | edupyter/EDUPYTER | 2 | python | def add(self, bit):
self.contents.append(bit)
self.original += bit.original
bit.parent = self | def add(self, bit):
self.contents.append(bit)
self.original += bit.original
bit.parent = self<|docstring|>Add any kind of formula bit already processed<|endoftext|> |
9329a3451de563b4e7b663e9186d660d950b5c3a14bb3f4a516a36e1fd1c50e3 | def skiporiginal(self, string, pos):
'Skip a string and add it to the original formula'
self.original += string
if (not pos.checkskip(string)):
Trace.error(((('String ' + string) + ' not at ') + pos.identifier())) | Skip a string and add it to the original formula | Lib/site-packages/docutils/utils/math/math2html.py | skiporiginal | edupyter/EDUPYTER | 2 | python | def skiporiginal(self, string, pos):
self.original += string
if (not pos.checkskip(string)):
Trace.error(((('String ' + string) + ' not at ') + pos.identifier())) | def skiporiginal(self, string, pos):
self.original += string
if (not pos.checkskip(string)):
Trace.error(((('String ' + string) + ' not at ') + pos.identifier()))<|docstring|>Skip a string and add it to the original formula<|endoftext|> |
aa3e3457778e2762da302d8d2680499b4f4e13673e0009b294839bea6d2bfcee | def computesize(self):
'Compute the size of the bit as the max of the sizes of all contents.'
if (len(self.contents) == 0):
return 1
self.size = max([element.size for element in self.contents])
return self.size | Compute the size of the bit as the max of the sizes of all contents. | Lib/site-packages/docutils/utils/math/math2html.py | computesize | edupyter/EDUPYTER | 2 | python | def computesize(self):
if (len(self.contents) == 0):
return 1
self.size = max([element.size for element in self.contents])
return self.size | def computesize(self):
if (len(self.contents) == 0):
return 1
self.size = max([element.size for element in self.contents])
return self.size<|docstring|>Compute the size of the bit as the max of the sizes of all contents.<|endoftext|> |
41292ef5f7a1db62462a7ca79d563e444bd5602ea45c1c0ae2b23699d504ca8b | def clone(self):
'Return a copy of itself.'
return self.factory.parseformula(self.original) | Return a copy of itself. | Lib/site-packages/docutils/utils/math/math2html.py | clone | edupyter/EDUPYTER | 2 | python | def clone(self):
return self.factory.parseformula(self.original) | def clone(self):
return self.factory.parseformula(self.original)<|docstring|>Return a copy of itself.<|endoftext|> |
a4c69599b9c575c28de7f047c41f91b55fdae08fd2124aa47b347bbd2e53b38f | def __unicode__(self):
'Get a string representation'
return ((self.__class__.__name__ + ' read in ') + self.original) | Get a string representation | Lib/site-packages/docutils/utils/math/math2html.py | __unicode__ | edupyter/EDUPYTER | 2 | python | def __unicode__(self):
return ((self.__class__.__name__ + ' read in ') + self.original) | def __unicode__(self):
return ((self.__class__.__name__ + ' read in ') + self.original)<|docstring|>Get a string representation<|endoftext|> |
6c7300a3c04aa2cff9b526c8145ccaecf59eddc453332e94a05b1fa83e2f4cc1 | def constant(self, constant, tag):
'Set the constant and the tag'
self.output = TaggedOutput().settag(tag)
self.add(FormulaConstant(constant))
return self | Set the constant and the tag | Lib/site-packages/docutils/utils/math/math2html.py | constant | edupyter/EDUPYTER | 2 | python | def constant(self, constant, tag):
self.output = TaggedOutput().settag(tag)
self.add(FormulaConstant(constant))
return self | def constant(self, constant, tag):
self.output = TaggedOutput().settag(tag)
self.add(FormulaConstant(constant))
return self<|docstring|>Set the constant and the tag<|endoftext|> |
d51653bfbf0e2ab8fa03d32e3036a2054d662338ebf9d49fa29514117f40c9df | def complete(self, contents, tag, breaklines=False):
'Set the constant and the tag'
self.contents = contents
self.output = TaggedOutput().settag(tag, breaklines)
return self | Set the constant and the tag | Lib/site-packages/docutils/utils/math/math2html.py | complete | edupyter/EDUPYTER | 2 | python | def complete(self, contents, tag, breaklines=False):
self.contents = contents
self.output = TaggedOutput().settag(tag, breaklines)
return self | def complete(self, contents, tag, breaklines=False):
self.contents = contents
self.output = TaggedOutput().settag(tag, breaklines)
return self<|docstring|>Set the constant and the tag<|endoftext|> |
bfe1679a2ee9e640b38796ac9165915a12f6c36788d379668be87fbf7480e01f | def selfcomplete(self, tag):
'Set the self-closing tag, no contents (as in <hr/>).'
self.output = TaggedOutput().settag(tag, empty=True)
return self | Set the self-closing tag, no contents (as in <hr/>). | Lib/site-packages/docutils/utils/math/math2html.py | selfcomplete | edupyter/EDUPYTER | 2 | python | def selfcomplete(self, tag):
self.output = TaggedOutput().settag(tag, empty=True)
return self | def selfcomplete(self, tag):
self.output = TaggedOutput().settag(tag, empty=True)
return self<|docstring|>Set the self-closing tag, no contents (as in <hr/>).<|endoftext|> |
03f7cef5b7dee1a1d7e6092c74eb87935b39f67aec220dbf5cd85b49c34be2f6 | def __init__(self, string):
'Set the constant string'
Constant.__init__(self, string)
self.original = string
self.size = 1
self.type = None | Set the constant string | Lib/site-packages/docutils/utils/math/math2html.py | __init__ | edupyter/EDUPYTER | 2 | python | def __init__(self, string):
Constant.__init__(self, string)
self.original = string
self.size = 1
self.type = None | def __init__(self, string):
Constant.__init__(self, string)
self.original = string
self.size = 1
self.type = None<|docstring|>Set the constant string<|endoftext|> |
b7a9fcbdfe6c57760e7432f75d3bac4878fd56058d56787f42634b1b4e9960e1 | def computesize(self):
'Compute the size of the constant: always 1.'
return self.size | Compute the size of the constant: always 1. | Lib/site-packages/docutils/utils/math/math2html.py | computesize | edupyter/EDUPYTER | 2 | python | def computesize(self):
return self.size | def computesize(self):
return self.size<|docstring|>Compute the size of the constant: always 1.<|endoftext|> |
ba3cfc1e1475af9586bb2116ff314675ad0e83275e56cbbf9005e0243e86955c | def clone(self):
'Return a copy of itself.'
return FormulaConstant(self.original) | Return a copy of itself. | Lib/site-packages/docutils/utils/math/math2html.py | clone | edupyter/EDUPYTER | 2 | python | def clone(self):
return FormulaConstant(self.original) | def clone(self):
return FormulaConstant(self.original)<|docstring|>Return a copy of itself.<|endoftext|> |
4c6b5f842439aa313c2fd53bde1c6f29229245ec1610a477df490649a2c3e6bd | def __unicode__(self):
'Return a printable representation.'
return ('Formula constant: ' + self.string) | Return a printable representation. | Lib/site-packages/docutils/utils/math/math2html.py | __unicode__ | edupyter/EDUPYTER | 2 | python | def __unicode__(self):
return ('Formula constant: ' + self.string) | def __unicode__(self):
return ('Formula constant: ' + self.string)<|docstring|>Return a printable representation.<|endoftext|> |
26c93847dfeda919c9ae50e131dbb6f58cd80b237a061ff1b18bb886c415dcf5 | def detect(self, pos):
'Detect a bit of raw text'
return pos.current().isalpha() | Detect a bit of raw text | Lib/site-packages/docutils/utils/math/math2html.py | detect | edupyter/EDUPYTER | 2 | python | def detect(self, pos):
return pos.current().isalpha() | def detect(self, pos):
return pos.current().isalpha()<|docstring|>Detect a bit of raw text<|endoftext|> |
4aa3d118ed75abd272b2fc8971a23f19b3ec6b2c379fd19aba59dd6240bbea08 | def parsebit(self, pos):
'Parse alphabetic text'
alpha = pos.globalpha()
self.add(FormulaConstant(alpha))
self.type = 'alpha' | Parse alphabetic text | Lib/site-packages/docutils/utils/math/math2html.py | parsebit | edupyter/EDUPYTER | 2 | python | def parsebit(self, pos):
alpha = pos.globalpha()
self.add(FormulaConstant(alpha))
self.type = 'alpha' | def parsebit(self, pos):
alpha = pos.globalpha()
self.add(FormulaConstant(alpha))
self.type = 'alpha'<|docstring|>Parse alphabetic text<|endoftext|> |
bd98aa3e1d28eb76d3fd81435603d31cf6fe87dedfad00c6c0f0799b515f1a3a | def detect(self, pos):
'Detect a symbol'
if (pos.current() in FormulaSymbol.unmodified):
return True
if (pos.current() in FormulaSymbol.modified):
return True
return False | Detect a symbol | Lib/site-packages/docutils/utils/math/math2html.py | detect | edupyter/EDUPYTER | 2 | python | def detect(self, pos):
if (pos.current() in FormulaSymbol.unmodified):
return True
if (pos.current() in FormulaSymbol.modified):
return True
return False | def detect(self, pos):
if (pos.current() in FormulaSymbol.unmodified):
return True
if (pos.current() in FormulaSymbol.modified):
return True
return False<|docstring|>Detect a symbol<|endoftext|> |
0d6a8730b9a199cb02134551a26a413efe8a16e67ddbb582f2ece8497e63e639 | def parsebit(self, pos):
'Parse the symbol'
if (pos.current() in FormulaSymbol.unmodified):
self.addsymbol(pos.current(), pos)
return
if (pos.current() in FormulaSymbol.modified):
self.addsymbol(FormulaSymbol.modified[pos.current()], pos)
return
Trace.error((('Symbol ' + pos.current()) + ' not found')) | Parse the symbol | Lib/site-packages/docutils/utils/math/math2html.py | parsebit | edupyter/EDUPYTER | 2 | python | def parsebit(self, pos):
if (pos.current() in FormulaSymbol.unmodified):
self.addsymbol(pos.current(), pos)
return
if (pos.current() in FormulaSymbol.modified):
self.addsymbol(FormulaSymbol.modified[pos.current()], pos)
return
Trace.error((('Symbol ' + pos.current()) + ' not found')) | def parsebit(self, pos):
if (pos.current() in FormulaSymbol.unmodified):
self.addsymbol(pos.current(), pos)
return
if (pos.current() in FormulaSymbol.modified):
self.addsymbol(FormulaSymbol.modified[pos.current()], pos)
return
Trace.error((('Symbol ' + pos.current()) + ' not found'))<|docstring|>Parse the symbol<|endoftext|> |
ad1bd326c96091fdbf71c8881f58d8783f9c06027abacfe005c2586d786882dd | def addsymbol(self, symbol, pos):
'Add a symbol'
self.skiporiginal(pos.current(), pos)
self.contents.append(FormulaConstant(symbol)) | Add a symbol | Lib/site-packages/docutils/utils/math/math2html.py | addsymbol | edupyter/EDUPYTER | 2 | python | def addsymbol(self, symbol, pos):
self.skiporiginal(pos.current(), pos)
self.contents.append(FormulaConstant(symbol)) | def addsymbol(self, symbol, pos):
self.skiporiginal(pos.current(), pos)
self.contents.append(FormulaConstant(symbol))<|docstring|>Add a symbol<|endoftext|> |
748b47034288adb0a93b6df3b39fda24d5e32d3492e121f029863cdc32e36a92 | def detect(self, pos):
'Detect a digit'
return pos.current().isdigit() | Detect a digit | Lib/site-packages/docutils/utils/math/math2html.py | detect | edupyter/EDUPYTER | 2 | python | def detect(self, pos):
return pos.current().isdigit() | def detect(self, pos):
return pos.current().isdigit()<|docstring|>Detect a digit<|endoftext|> |
59193c2cfc61eb641ad7948ca43afe74ffa4831d66137c0ba3988cf4ad7fee36 | def parsebit(self, pos):
'Parse a bunch of digits'
digits = pos.glob((lambda : pos.current().isdigit()))
self.add(FormulaConstant(digits))
self.type = 'number' | Parse a bunch of digits | Lib/site-packages/docutils/utils/math/math2html.py | parsebit | edupyter/EDUPYTER | 2 | python | def parsebit(self, pos):
digits = pos.glob((lambda : pos.current().isdigit()))
self.add(FormulaConstant(digits))
self.type = 'number' | def parsebit(self, pos):
digits = pos.glob((lambda : pos.current().isdigit()))
self.add(FormulaConstant(digits))
self.type = 'number'<|docstring|>Parse a bunch of digits<|endoftext|> |
7df1d654f6c48781605547d31bcded2e9c5408088130e45dfe1f49bee0b8ba21 | def detect(self, pos):
'Detect the %.'
return (pos.current() == self.start) | Detect the %. | Lib/site-packages/docutils/utils/math/math2html.py | detect | edupyter/EDUPYTER | 2 | python | def detect(self, pos):
return (pos.current() == self.start) | def detect(self, pos):
return (pos.current() == self.start)<|docstring|>Detect the %.<|endoftext|> |
18025397f90d665c6ec5e24bd040babc1861df77415580e94af156d80bd284b5 | def parsebit(self, pos):
'Parse to the end of the line.'
self.original += pos.globincluding('\n') | Parse to the end of the line. | Lib/site-packages/docutils/utils/math/math2html.py | parsebit | edupyter/EDUPYTER | 2 | python | def parsebit(self, pos):
self.original += pos.globincluding('\n') | def parsebit(self, pos):
self.original += pos.globincluding('\n')<|docstring|>Parse to the end of the line.<|endoftext|> |
872acbb4a4a1f2b3e93e40de81cafa5ef4986a09b20386b4b146dfe2716cf78e | def detect(self, pos):
'Detect the white space.'
return pos.current().isspace() | Detect the white space. | Lib/site-packages/docutils/utils/math/math2html.py | detect | edupyter/EDUPYTER | 2 | python | def detect(self, pos):
return pos.current().isspace() | def detect(self, pos):
return pos.current().isspace()<|docstring|>Detect the white space.<|endoftext|> |
1980dd4b13179f23c23635dc0f6ffd1cf3c14a5f7f20ec80c2bd369c9d04040f | def parsebit(self, pos):
'Parse all whitespace.'
self.original += pos.skipspace() | Parse all whitespace. | Lib/site-packages/docutils/utils/math/math2html.py | parsebit | edupyter/EDUPYTER | 2 | python | def parsebit(self, pos):
self.original += pos.skipspace() | def parsebit(self, pos):
self.original += pos.skipspace()<|docstring|>Parse all whitespace.<|endoftext|> |
b400507ebc45b045115e649b9d260ef3479d3baa8371083701c81eb18bd5941b | def __unicode__(self):
'Return a printable representation.'
return (('Whitespace: *' + self.original) + '*') | Return a printable representation. | Lib/site-packages/docutils/utils/math/math2html.py | __unicode__ | edupyter/EDUPYTER | 2 | python | def __unicode__(self):
return (('Whitespace: *' + self.original) + '*') | def __unicode__(self):
return (('Whitespace: *' + self.original) + '*')<|docstring|>Return a printable representation.<|endoftext|> |
c631767756aff225e294a63cb90089b91bf56642492271213583f84393803152 | def __init__(self):
'Create a (possibly literal) new bracket'
FormulaBit.__init__(self)
self.inner = None | Create a (possibly literal) new bracket | Lib/site-packages/docutils/utils/math/math2html.py | __init__ | edupyter/EDUPYTER | 2 | python | def __init__(self):
FormulaBit.__init__(self)
self.inner = None | def __init__(self):
FormulaBit.__init__(self)
self.inner = None<|docstring|>Create a (possibly literal) new bracket<|endoftext|> |
7a9ac46e95c1a39aa982101d60a9fe329de91107b8045830b3aeb7eed01e87f4 | def detect(self, pos):
'Detect the start of a bracket'
return pos.checkfor(self.start) | Detect the start of a bracket | Lib/site-packages/docutils/utils/math/math2html.py | detect | edupyter/EDUPYTER | 2 | python | def detect(self, pos):
return pos.checkfor(self.start) | def detect(self, pos):
return pos.checkfor(self.start)<|docstring|>Detect the start of a bracket<|endoftext|> |
dc9e94fed4030d31252455cb60d6a50aa854449544ec8cae16ae5f84d0ef1030 | def parsebit(self, pos):
'Parse the bracket'
self.parsecomplete(pos, self.innerformula)
return self | Parse the bracket | Lib/site-packages/docutils/utils/math/math2html.py | parsebit | edupyter/EDUPYTER | 2 | python | def parsebit(self, pos):
self.parsecomplete(pos, self.innerformula)
return self | def parsebit(self, pos):
self.parsecomplete(pos, self.innerformula)
return self<|docstring|>Parse the bracket<|endoftext|> |
94d73189a0a8042e2712dfbaf6bbff4b885c0b61c888d6be4e8e4d7010625f95 | def parsetext(self, pos):
'Parse a text bracket'
self.parsecomplete(pos, self.innertext)
return self | Parse a text bracket | Lib/site-packages/docutils/utils/math/math2html.py | parsetext | edupyter/EDUPYTER | 2 | python | def parsetext(self, pos):
self.parsecomplete(pos, self.innertext)
return self | def parsetext(self, pos):
self.parsecomplete(pos, self.innertext)
return self<|docstring|>Parse a text bracket<|endoftext|> |
a883611bd441bd0d227e301a78f8e769176091133f43891b4f2f84b9476e5e77 | def parseliteral(self, pos):
'Parse a literal bracket'
self.parsecomplete(pos, self.innerliteral)
return self | Parse a literal bracket | Lib/site-packages/docutils/utils/math/math2html.py | parseliteral | edupyter/EDUPYTER | 2 | python | def parseliteral(self, pos):
self.parsecomplete(pos, self.innerliteral)
return self | def parseliteral(self, pos):
self.parsecomplete(pos, self.innerliteral)
return self<|docstring|>Parse a literal bracket<|endoftext|> |
dbfc4779d306843499cd223dea47d05d29a92a1ac2952dd545bb36cebf6e792d | def parsecomplete(self, pos, innerparser):
'Parse the start and end marks'
if (not pos.checkfor(self.start)):
Trace.error(((('Bracket should start with ' + self.start) + ' at ') + pos.identifier()))
return None
self.skiporiginal(self.start, pos)
pos.pushending(self.ending)
innerparser(pos)
self.original += pos.popending(self.ending)
self.computesize() | Parse the start and end marks | Lib/site-packages/docutils/utils/math/math2html.py | parsecomplete | edupyter/EDUPYTER | 2 | python | def parsecomplete(self, pos, innerparser):
if (not pos.checkfor(self.start)):
Trace.error(((('Bracket should start with ' + self.start) + ' at ') + pos.identifier()))
return None
self.skiporiginal(self.start, pos)
pos.pushending(self.ending)
innerparser(pos)
self.original += pos.popending(self.ending)
self.computesize() | def parsecomplete(self, pos, innerparser):
if (not pos.checkfor(self.start)):
Trace.error(((('Bracket should start with ' + self.start) + ' at ') + pos.identifier()))
return None
self.skiporiginal(self.start, pos)
pos.pushending(self.ending)
innerparser(pos)
self.original += pos.popending(self.ending)
self.computesize()<|docstring|>Parse the start and end marks<|endoftext|> |
2459ee6c9e36d7ecfe6daeef4b8f7bf4c2f6f05ecc60ad2f5c1da24a30bac870 | def innerformula(self, pos):
'Parse a whole formula inside the bracket'
while (not pos.finished()):
self.add(self.factory.parseany(pos)) | Parse a whole formula inside the bracket | Lib/site-packages/docutils/utils/math/math2html.py | innerformula | edupyter/EDUPYTER | 2 | python | def innerformula(self, pos):
while (not pos.finished()):
self.add(self.factory.parseany(pos)) | def innerformula(self, pos):
while (not pos.finished()):
self.add(self.factory.parseany(pos))<|docstring|>Parse a whole formula inside the bracket<|endoftext|> |
de598ada10b9d97b6ccc638ee58b1634f8bbbef16cfc287b7b8f4bab1314f178 | def innertext(self, pos):
'Parse some text inside the bracket, following textual rules.'
specialchars = list(FormulaConfig.symbolfunctions.keys())
specialchars.append(FormulaConfig.starts['command'])
specialchars.append(FormulaConfig.starts['bracket'])
specialchars.append(Comment.start)
while (not pos.finished()):
if (pos.current() in specialchars):
self.add(self.factory.parseany(pos))
if pos.checkskip(' '):
self.original += ' '
else:
self.add(FormulaConstant(pos.skipcurrent())) | Parse some text inside the bracket, following textual rules. | Lib/site-packages/docutils/utils/math/math2html.py | innertext | edupyter/EDUPYTER | 2 | python | def innertext(self, pos):
specialchars = list(FormulaConfig.symbolfunctions.keys())
specialchars.append(FormulaConfig.starts['command'])
specialchars.append(FormulaConfig.starts['bracket'])
specialchars.append(Comment.start)
while (not pos.finished()):
if (pos.current() in specialchars):
self.add(self.factory.parseany(pos))
if pos.checkskip(' '):
self.original += ' '
else:
self.add(FormulaConstant(pos.skipcurrent())) | def innertext(self, pos):
specialchars = list(FormulaConfig.symbolfunctions.keys())
specialchars.append(FormulaConfig.starts['command'])
specialchars.append(FormulaConfig.starts['bracket'])
specialchars.append(Comment.start)
while (not pos.finished()):
if (pos.current() in specialchars):
self.add(self.factory.parseany(pos))
if pos.checkskip(' '):
self.original += ' '
else:
self.add(FormulaConstant(pos.skipcurrent()))<|docstring|>Parse some text inside the bracket, following textual rules.<|endoftext|> |
a037bd649796b134d92fc633b9524d2da88d8631a6f31cb8eb60ea6eccf83a44 | def innerliteral(self, pos):
'Parse a literal inside the bracket, which does not generate HTML.'
self.literal = ''
while ((not pos.finished()) and (not (pos.current() == self.ending))):
if (pos.current() == self.start):
self.parseliteral(pos)
else:
self.literal += pos.skipcurrent()
self.original += self.literal | Parse a literal inside the bracket, which does not generate HTML. | Lib/site-packages/docutils/utils/math/math2html.py | innerliteral | edupyter/EDUPYTER | 2 | python | def innerliteral(self, pos):
self.literal =
while ((not pos.finished()) and (not (pos.current() == self.ending))):
if (pos.current() == self.start):
self.parseliteral(pos)
else:
self.literal += pos.skipcurrent()
self.original += self.literal | def innerliteral(self, pos):
self.literal =
while ((not pos.finished()) and (not (pos.current() == self.ending))):
if (pos.current() == self.start):
self.parseliteral(pos)
else:
self.literal += pos.skipcurrent()
self.original += self.literal<|docstring|>Parse a literal inside the bracket, which does not generate HTML.<|endoftext|> |
bc8b62547007cae42e38a6fceebe6139bb641408404817b845b1b4bb7e58db5e | def clone(self):
'Return a new square bracket with the same contents.'
bracket = SquareBracket()
bracket.contents = self.contents
return bracket | Return a new square bracket with the same contents. | Lib/site-packages/docutils/utils/math/math2html.py | clone | edupyter/EDUPYTER | 2 | python | def clone(self):
bracket = SquareBracket()
bracket.contents = self.contents
return bracket | def clone(self):
bracket = SquareBracket()
bracket.contents = self.contents
return bracket<|docstring|>Return a new square bracket with the same contents.<|endoftext|> |
273ea611ef20293bb085e0832b760c65daf21fc04cbb4d353438b32ad435ca61 | def process(self, contents, index):
'Process an element inside a formula.'
Trace.error(('Unimplemented process() in ' + unicode(self))) | Process an element inside a formula. | Lib/site-packages/docutils/utils/math/math2html.py | process | edupyter/EDUPYTER | 2 | python | def process(self, contents, index):
Trace.error(('Unimplemented process() in ' + unicode(self))) | def process(self, contents, index):
Trace.error(('Unimplemented process() in ' + unicode(self)))<|docstring|>Process an element inside a formula.<|endoftext|> |
fb87db5039c5825132c9d28e8388d4dbdad87ce58e189e27423aeb2e08cec326 | def __unicode__(self):
'Return a printable description.'
return ('Maths processor ' + self.__class__.__name__) | Return a printable description. | Lib/site-packages/docutils/utils/math/math2html.py | __unicode__ | edupyter/EDUPYTER | 2 | python | def __unicode__(self):
return ('Maths processor ' + self.__class__.__name__) | def __unicode__(self):
return ('Maths processor ' + self.__class__.__name__)<|docstring|>Return a printable description.<|endoftext|> |
5f3d9d1d906755297eb941a2c0f8d463da2dbdedd59c240f4f73ae0665fe2cbf | def process(self, bit):
'Process the contents of every formula bit, recursively.'
self.processcontents(bit)
self.processinsides(bit)
self.traversewhole(bit) | Process the contents of every formula bit, recursively. | Lib/site-packages/docutils/utils/math/math2html.py | process | edupyter/EDUPYTER | 2 | python | def process(self, bit):
self.processcontents(bit)
self.processinsides(bit)
self.traversewhole(bit) | def process(self, bit):
self.processcontents(bit)
self.processinsides(bit)
self.traversewhole(bit)<|docstring|>Process the contents of every formula bit, recursively.<|endoftext|> |
7038216b8e41fe1ebe5cf6dc0a1b3104497050cea734cd66c1ddf63a8bfb55dd | def processcontents(self, bit):
'Process the contents of a formula bit.'
if (not isinstance(bit, FormulaBit)):
return
bit.process()
for element in bit.contents:
self.processcontents(element) | Process the contents of a formula bit. | Lib/site-packages/docutils/utils/math/math2html.py | processcontents | edupyter/EDUPYTER | 2 | python | def processcontents(self, bit):
if (not isinstance(bit, FormulaBit)):
return
bit.process()
for element in bit.contents:
self.processcontents(element) | def processcontents(self, bit):
if (not isinstance(bit, FormulaBit)):
return
bit.process()
for element in bit.contents:
self.processcontents(element)<|docstring|>Process the contents of a formula bit.<|endoftext|> |
c1a4cef006139ae9791d0176d3e02e65b96806533d001c6c9bf75abc2b1252e0 | def processinsides(self, bit):
'Process the insides (limits, brackets) in a formula bit.'
if (not isinstance(bit, FormulaBit)):
return
for (index, element) in enumerate(bit.contents):
for processor in self.processors:
processor.process(bit.contents, index)
self.processinsides(element) | Process the insides (limits, brackets) in a formula bit. | Lib/site-packages/docutils/utils/math/math2html.py | processinsides | edupyter/EDUPYTER | 2 | python | def processinsides(self, bit):
if (not isinstance(bit, FormulaBit)):
return
for (index, element) in enumerate(bit.contents):
for processor in self.processors:
processor.process(bit.contents, index)
self.processinsides(element) | def processinsides(self, bit):
if (not isinstance(bit, FormulaBit)):
return
for (index, element) in enumerate(bit.contents):
for processor in self.processors:
processor.process(bit.contents, index)
self.processinsides(element)<|docstring|>Process the insides (limits, brackets) in a formula bit.<|endoftext|> |
fa6d8da11b616ec21ce127dc3b0c9c675b98d0f8b6bf2986a01e201cd7b08d38 | def traversewhole(self, formula):
'Traverse over the contents to alter variables and space units.'
last = None
for (bit, contents) in self.traverse(formula):
if (bit.type == 'alpha'):
self.italicize(bit, contents)
elif ((bit.type == 'font') and last and (last.type == 'number')):
bit.contents.insert(0, FormulaConstant(u'\u2009'))
last = bit | Traverse over the contents to alter variables and space units. | Lib/site-packages/docutils/utils/math/math2html.py | traversewhole | edupyter/EDUPYTER | 2 | python | def traversewhole(self, formula):
last = None
for (bit, contents) in self.traverse(formula):
if (bit.type == 'alpha'):
self.italicize(bit, contents)
elif ((bit.type == 'font') and last and (last.type == 'number')):
bit.contents.insert(0, FormulaConstant(u'\u2009'))
last = bit | def traversewhole(self, formula):
last = None
for (bit, contents) in self.traverse(formula):
if (bit.type == 'alpha'):
self.italicize(bit, contents)
elif ((bit.type == 'font') and last and (last.type == 'number')):
bit.contents.insert(0, FormulaConstant(u'\u2009'))
last = bit<|docstring|>Traverse over the contents to alter variables and space units.<|endoftext|> |
abf53438a770b0c6cd53b89fbb4c88774ad720c56b8a494db90080f4ba4a44d9 | def traverse(self, bit):
'Traverse a formula and yield a flattened structure of (bit, list) pairs.'
for element in bit.contents:
if (hasattr(element, 'type') and element.type):
(yield (element, bit.contents))
elif isinstance(element, FormulaBit):
for pair in self.traverse(element):
(yield pair) | Traverse a formula and yield a flattened structure of (bit, list) pairs. | Lib/site-packages/docutils/utils/math/math2html.py | traverse | edupyter/EDUPYTER | 2 | python | def traverse(self, bit):
for element in bit.contents:
if (hasattr(element, 'type') and element.type):
(yield (element, bit.contents))
elif isinstance(element, FormulaBit):
for pair in self.traverse(element):
(yield pair) | def traverse(self, bit):
for element in bit.contents:
if (hasattr(element, 'type') and element.type):
(yield (element, bit.contents))
elif isinstance(element, FormulaBit):
for pair in self.traverse(element):
(yield pair)<|docstring|>Traverse a formula and yield a flattened structure of (bit, list) pairs.<|endoftext|> |
1093803da65c4025e377fdbb40349ab8a64e1b3beab19816793d2b04f49ffc0b | def italicize(self, bit, contents):
'Italicize the given bit of text.'
index = contents.index(bit)
contents[index] = TaggedBit().complete([bit], 'i') | Italicize the given bit of text. | Lib/site-packages/docutils/utils/math/math2html.py | italicize | edupyter/EDUPYTER | 2 | python | def italicize(self, bit, contents):
index = contents.index(bit)
contents[index] = TaggedBit().complete([bit], 'i') | def italicize(self, bit, contents):
index = contents.index(bit)
contents[index] = TaggedBit().complete([bit], 'i')<|docstring|>Italicize the given bit of text.<|endoftext|> |
d218df46aea11a698c8a7b02587251006548e3fcb5b374c06e5188b089d9c238 | def process(self):
'Convert the formula to tags'
if (self.header[0] == 'inline'):
DocumentParameters.displaymode = False
else:
DocumentParameters.displaymode = True
self.output.settag('div class="formula"', True)
self.classic() | Convert the formula to tags | Lib/site-packages/docutils/utils/math/math2html.py | process | edupyter/EDUPYTER | 2 | python | def process(self):
if (self.header[0] == 'inline'):
DocumentParameters.displaymode = False
else:
DocumentParameters.displaymode = True
self.output.settag('div class="formula"', True)
self.classic() | def process(self):
if (self.header[0] == 'inline'):
DocumentParameters.displaymode = False
else:
DocumentParameters.displaymode = True
self.output.settag('div class="formula"', True)
self.classic()<|docstring|>Convert the formula to tags<|endoftext|> |
0dc6fe62a0e9ec3c8377d69b9d40a8e18a84852ac5387c96be2a0e1d78abb4c5 | def classic(self):
'Make the contents using classic output generation with XHTML and CSS.'
whole = FormulaFactory().parseformula(self.parsed)
FormulaProcessor().process(whole)
whole.parent = self
self.contents = [whole] | Make the contents using classic output generation with XHTML and CSS. | Lib/site-packages/docutils/utils/math/math2html.py | classic | edupyter/EDUPYTER | 2 | python | def classic(self):
whole = FormulaFactory().parseformula(self.parsed)
FormulaProcessor().process(whole)
whole.parent = self
self.contents = [whole] | def classic(self):
whole = FormulaFactory().parseformula(self.parsed)
FormulaProcessor().process(whole)
whole.parent = self
self.contents = [whole]<|docstring|>Make the contents using classic output generation with XHTML and CSS.<|endoftext|> |
3e386e47041472d5db1e913178f264e64e63af9031e852de2d32a0791ef5505c | def parse(self, pos):
'Parse using a parse position instead of self.parser.'
if pos.checkskip('$$'):
self.parsedollarblock(pos)
elif pos.checkskip('$'):
self.parsedollarinline(pos)
elif pos.checkskip('\\('):
self.parseinlineto(pos, '\\)')
elif pos.checkskip('\\['):
self.parseblockto(pos, '\\]')
else:
pos.error('Unparseable formula')
self.process()
return self | Parse using a parse position instead of self.parser. | Lib/site-packages/docutils/utils/math/math2html.py | parse | edupyter/EDUPYTER | 2 | python | def parse(self, pos):
if pos.checkskip('$$'):
self.parsedollarblock(pos)
elif pos.checkskip('$'):
self.parsedollarinline(pos)
elif pos.checkskip('\\('):
self.parseinlineto(pos, '\\)')
elif pos.checkskip('\\['):
self.parseblockto(pos, '\\]')
else:
pos.error('Unparseable formula')
self.process()
return self | def parse(self, pos):
if pos.checkskip('$$'):
self.parsedollarblock(pos)
elif pos.checkskip('$'):
self.parsedollarinline(pos)
elif pos.checkskip('\\('):
self.parseinlineto(pos, '\\)')
elif pos.checkskip('\\['):
self.parseblockto(pos, '\\]')
else:
pos.error('Unparseable formula')
self.process()
return self<|docstring|>Parse using a parse position instead of self.parser.<|endoftext|> |
289534f87de9bb871b69c793341b98dbfe224db90b3b22bfd0b7265526ce28c2 | def parsedollarinline(self, pos):
'Parse a $...$ formula.'
self.header = ['inline']
self.parsedollar(pos) | Parse a $...$ formula. | Lib/site-packages/docutils/utils/math/math2html.py | parsedollarinline | edupyter/EDUPYTER | 2 | python | def parsedollarinline(self, pos):
self.header = ['inline']
self.parsedollar(pos) | def parsedollarinline(self, pos):
self.header = ['inline']
self.parsedollar(pos)<|docstring|>Parse a $...$ formula.<|endoftext|> |
865511ab1cefd3c50e47d1b7f061682afa2712abff14379ab8d0c7f9c1cf82fc | def parsedollarblock(self, pos):
'Parse a $$...$$ formula.'
self.header = ['block']
self.parsedollar(pos)
if (not pos.checkskip('$')):
pos.error('Formula should be $$...$$, but last $ is missing.') | Parse a $$...$$ formula. | Lib/site-packages/docutils/utils/math/math2html.py | parsedollarblock | edupyter/EDUPYTER | 2 | python | def parsedollarblock(self, pos):
self.header = ['block']
self.parsedollar(pos)
if (not pos.checkskip('$')):
pos.error('Formula should be $$...$$, but last $ is missing.') | def parsedollarblock(self, pos):
self.header = ['block']
self.parsedollar(pos)
if (not pos.checkskip('$')):
pos.error('Formula should be $$...$$, but last $ is missing.')<|docstring|>Parse a $$...$$ formula.<|endoftext|> |
3f850bac3a9cc43cca234c91e2b87b2d1cd334e3983666726b4cd7ce36b248f6 | def parsedollar(self, pos):
'Parse to the next $.'
pos.pushending('$')
self.parsed = pos.globexcluding('$')
pos.popending('$') | Parse to the next $. | Lib/site-packages/docutils/utils/math/math2html.py | parsedollar | edupyter/EDUPYTER | 2 | python | def parsedollar(self, pos):
pos.pushending('$')
self.parsed = pos.globexcluding('$')
pos.popending('$') | def parsedollar(self, pos):
pos.pushending('$')
self.parsed = pos.globexcluding('$')
pos.popending('$')<|docstring|>Parse to the next $.<|endoftext|> |
515f6e61f12e817d6a49aec2d9848178e7d398e3c1347ce8d0d027956531ceb4 | def parseinlineto(self, pos, limit):
'Parse a \\(...\\) formula.'
self.header = ['inline']
self.parseupto(pos, limit) | Parse a \(...\) formula. | Lib/site-packages/docutils/utils/math/math2html.py | parseinlineto | edupyter/EDUPYTER | 2 | python | def parseinlineto(self, pos, limit):
'Parse a \\(...\\) formula.'
self.header = ['inline']
self.parseupto(pos, limit) | def parseinlineto(self, pos, limit):
'Parse a \\(...\\) formula.'
self.header = ['inline']
self.parseupto(pos, limit)<|docstring|>Parse a \(...\) formula.<|endoftext|> |
26b7e051c2e162e1fa1d5d5cd7632015bd8fe2b3c72cb0d21d24d979a4739181 | def parseblockto(self, pos, limit):
'Parse a \\[...\\] formula.'
self.header = ['block']
self.parseupto(pos, limit) | Parse a \[...\] formula. | Lib/site-packages/docutils/utils/math/math2html.py | parseblockto | edupyter/EDUPYTER | 2 | python | def parseblockto(self, pos, limit):
'Parse a \\[...\\] formula.'
self.header = ['block']
self.parseupto(pos, limit) | def parseblockto(self, pos, limit):
'Parse a \\[...\\] formula.'
self.header = ['block']
self.parseupto(pos, limit)<|docstring|>Parse a \[...\] formula.<|endoftext|> |
7ea90d039ab08f3bfbcd10a169f4156aa7c2b5568783e7a3871746148d69f6c6 | def parseupto(self, pos, limit):
'Parse a formula that ends with the given command.'
pos.pushending(limit)
self.parsed = pos.glob((lambda : True))
pos.popending(limit) | Parse a formula that ends with the given command. | Lib/site-packages/docutils/utils/math/math2html.py | parseupto | edupyter/EDUPYTER | 2 | python | def parseupto(self, pos, limit):
pos.pushending(limit)
self.parsed = pos.glob((lambda : True))
pos.popending(limit) | def parseupto(self, pos, limit):
pos.pushending(limit)
self.parsed = pos.glob((lambda : True))
pos.popending(limit)<|docstring|>Parse a formula that ends with the given command.<|endoftext|> |
0f841d904888149d7d029620629d380465cbc5d13d399d7b69bdb2b841f832a8 | def __unicode__(self):
'Return a printable representation.'
if (self.partkey and self.partkey.number):
return (('Formula (' + self.partkey.number) + ')')
return 'Unnumbered formula' | Return a printable representation. | Lib/site-packages/docutils/utils/math/math2html.py | __unicode__ | edupyter/EDUPYTER | 2 | python | def __unicode__(self):
if (self.partkey and self.partkey.number):
return (('Formula (' + self.partkey.number) + ')')
return 'Unnumbered formula' | def __unicode__(self):
if (self.partkey and self.partkey.number):
return (('Formula (' + self.partkey.number) + ')')
return 'Unnumbered formula'<|docstring|>Return a printable representation.<|endoftext|> |
0fa81b5622f563ec7be635a5e979ff31e4dc52ee0bd9ac1209802a5eca8312ff | def detect(self, pos):
'Not outside the formula is enough.'
return (not pos.finished()) | Not outside the formula is enough. | Lib/site-packages/docutils/utils/math/math2html.py | detect | edupyter/EDUPYTER | 2 | python | def detect(self, pos):
return (not pos.finished()) | def detect(self, pos):
return (not pos.finished())<|docstring|>Not outside the formula is enough.<|endoftext|> |
fae28b1aacfd519ad25cda001f07b4760321a7ddeedcb49d452d7f951ea17be8 | def parsebit(self, pos):
'Parse with any formula bit'
while (not pos.finished()):
self.add(self.factory.parseany(pos)) | Parse with any formula bit | Lib/site-packages/docutils/utils/math/math2html.py | parsebit | edupyter/EDUPYTER | 2 | python | def parsebit(self, pos):
while (not pos.finished()):
self.add(self.factory.parseany(pos)) | def parsebit(self, pos):
while (not pos.finished()):
self.add(self.factory.parseany(pos))<|docstring|>Parse with any formula bit<|endoftext|> |
95bf4ae5aff23ff496ca77763f23ab050b5fca63e55cbed2a68e35d17912b8ea | def __init__(self):
'Initialize the map of instances.'
self.instances = dict() | Initialize the map of instances. | Lib/site-packages/docutils/utils/math/math2html.py | __init__ | edupyter/EDUPYTER | 2 | python | def __init__(self):
self.instances = dict() | def __init__(self):
self.instances = dict()<|docstring|>Initialize the map of instances.<|endoftext|> |
c6936ed6ab610933f5a514b2a9ff9e44479eebd8807ce170e3fc290f39bf1df9 | def detecttype(self, type, pos):
'Detect a bit of a given type.'
if pos.finished():
return False
return self.instance(type).detect(pos) | Detect a bit of a given type. | Lib/site-packages/docutils/utils/math/math2html.py | detecttype | edupyter/EDUPYTER | 2 | python | def detecttype(self, type, pos):
if pos.finished():
return False
return self.instance(type).detect(pos) | def detecttype(self, type, pos):
if pos.finished():
return False
return self.instance(type).detect(pos)<|docstring|>Detect a bit of a given type.<|endoftext|> |
0bd742fd24b75b9602c607b87ef945133daa657f75e1cf3be4973c5f4111dd1e | def instance(self, type):
'Get an instance of the given type.'
if ((not (type in self.instances)) or (not self.instances[type])):
self.instances[type] = self.create(type)
return self.instances[type] | Get an instance of the given type. | Lib/site-packages/docutils/utils/math/math2html.py | instance | edupyter/EDUPYTER | 2 | python | def instance(self, type):
if ((not (type in self.instances)) or (not self.instances[type])):
self.instances[type] = self.create(type)
return self.instances[type] | def instance(self, type):
if ((not (type in self.instances)) or (not self.instances[type])):
self.instances[type] = self.create(type)
return self.instances[type]<|docstring|>Get an instance of the given type.<|endoftext|> |
6e5e81d0de6e577991d47addd79e5cfb9132306b372155c09b091cd89c8ab613 | def create(self, type):
'Create a new formula bit of the given type.'
return Cloner.create(type).setfactory(self) | Create a new formula bit of the given type. | Lib/site-packages/docutils/utils/math/math2html.py | create | edupyter/EDUPYTER | 2 | python | def create(self, type):
return Cloner.create(type).setfactory(self) | def create(self, type):
return Cloner.create(type).setfactory(self)<|docstring|>Create a new formula bit of the given type.<|endoftext|> |
3ac8e30996b49a30176d0b2ef572c7848bcdac0cf3a1b2d011ed436cff977f4c | def clearskipped(self, pos):
'Clear any skipped types.'
while (not pos.finished()):
if (not self.skipany(pos)):
return
return | Clear any skipped types. | Lib/site-packages/docutils/utils/math/math2html.py | clearskipped | edupyter/EDUPYTER | 2 | python | def clearskipped(self, pos):
while (not pos.finished()):
if (not self.skipany(pos)):
return
return | def clearskipped(self, pos):
while (not pos.finished()):
if (not self.skipany(pos)):
return
return<|docstring|>Clear any skipped types.<|endoftext|> |
ce256a9298be86e7b71261e93caf88b8bc515a6398bb0d2a09980d1cceea42eb | def skipany(self, pos):
'Skip any skipped types.'
for type in self.skippedtypes:
if self.instance(type).detect(pos):
return self.parsetype(type, pos)
return None | Skip any skipped types. | Lib/site-packages/docutils/utils/math/math2html.py | skipany | edupyter/EDUPYTER | 2 | python | def skipany(self, pos):
for type in self.skippedtypes:
if self.instance(type).detect(pos):
return self.parsetype(type, pos)
return None | def skipany(self, pos):
for type in self.skippedtypes:
if self.instance(type).detect(pos):
return self.parsetype(type, pos)
return None<|docstring|>Skip any skipped types.<|endoftext|> |
580d516e727740c82f19f22496230997983c8474555dab439ae7acfa5953b8d0 | def parseany(self, pos):
'Parse any formula bit at the current location.'
for type in (self.types + self.skippedtypes):
if self.detecttype(type, pos):
return self.parsetype(type, pos)
Trace.error(('Unrecognized formula at ' + pos.identifier()))
return FormulaConstant(pos.skipcurrent()) | Parse any formula bit at the current location. | Lib/site-packages/docutils/utils/math/math2html.py | parseany | edupyter/EDUPYTER | 2 | python | def parseany(self, pos):
for type in (self.types + self.skippedtypes):
if self.detecttype(type, pos):
return self.parsetype(type, pos)
Trace.error(('Unrecognized formula at ' + pos.identifier()))
return FormulaConstant(pos.skipcurrent()) | def parseany(self, pos):
for type in (self.types + self.skippedtypes):
if self.detecttype(type, pos):
return self.parsetype(type, pos)
Trace.error(('Unrecognized formula at ' + pos.identifier()))
return FormulaConstant(pos.skipcurrent())<|docstring|>Parse any formula bit at the current location.<|endoftext|> |
b840a24ee0d6a1a654ad6e3da1af93c585c2959a5acdcc20e6f01dfb45c15745 | def parsetype(self, type, pos):
'Parse the given type and return it.'
bit = self.instance(type)
self.instances[type] = None
returnedbit = bit.parsebit(pos)
if returnedbit:
return returnedbit.setfactory(self)
return bit | Parse the given type and return it. | Lib/site-packages/docutils/utils/math/math2html.py | parsetype | edupyter/EDUPYTER | 2 | python | def parsetype(self, type, pos):
bit = self.instance(type)
self.instances[type] = None
returnedbit = bit.parsebit(pos)
if returnedbit:
return returnedbit.setfactory(self)
return bit | def parsetype(self, type, pos):
bit = self.instance(type)
self.instances[type] = None
returnedbit = bit.parsebit(pos)
if returnedbit:
return returnedbit.setfactory(self)
return bit<|docstring|>Parse the given type and return it.<|endoftext|> |
77ea2a0e6ccdc6a3d65ef8cf8377e07e65b4c8ad31fcbd031f1e336005eef026 | def parseformula(self, formula):
'Parse a string of text that contains a whole formula.'
pos = TextPosition(formula)
whole = self.create(WholeFormula)
if whole.detect(pos):
whole.parsebit(pos)
return whole
if (not pos.finished()):
Trace.error(('Unknown formula at: ' + pos.identifier()))
whole.add(TaggedBit().constant(formula, 'span class="unknown"'))
return whole | Parse a string of text that contains a whole formula. | Lib/site-packages/docutils/utils/math/math2html.py | parseformula | edupyter/EDUPYTER | 2 | python | def parseformula(self, formula):
pos = TextPosition(formula)
whole = self.create(WholeFormula)
if whole.detect(pos):
whole.parsebit(pos)
return whole
if (not pos.finished()):
Trace.error(('Unknown formula at: ' + pos.identifier()))
whole.add(TaggedBit().constant(formula, 'span class="unknown"'))
return whole | def parseformula(self, formula):
pos = TextPosition(formula)
whole = self.create(WholeFormula)
if whole.detect(pos):
whole.parsebit(pos)
return whole
if (not pos.finished()):
Trace.error(('Unknown formula at: ' + pos.identifier()))
whole.add(TaggedBit().constant(formula, 'span class="unknown"'))
return whole<|docstring|>Parse a string of text that contains a whole formula.<|endoftext|> |
08583b264289a334093c764ec4ac515f7e5ff653fef256b09935a9ac8a6b1361 | def detect(self, pos):
'Find the current command.'
return pos.checkfor(FormulaCommand.start) | Find the current command. | Lib/site-packages/docutils/utils/math/math2html.py | detect | edupyter/EDUPYTER | 2 | python | def detect(self, pos):
return pos.checkfor(FormulaCommand.start) | def detect(self, pos):
return pos.checkfor(FormulaCommand.start)<|docstring|>Find the current command.<|endoftext|> |
9dd06b47459e757be42fd2e8b8b99b503d2f62c57be3c626568b567410dd6118 | def parsebit(self, pos):
'Parse the command.'
command = self.extractcommand(pos)
bit = self.parsewithcommand(command, pos)
if bit:
return bit
if (command.startswith('\\up') or command.startswith('\\Up')):
upgreek = self.parseupgreek(command, pos)
if upgreek:
return upgreek
if (not self.factory.defining):
Trace.error(('Unknown command ' + command))
self.output = TaggedOutput().settag('span class="unknown"')
self.add(FormulaConstant(command))
return None | Parse the command. | Lib/site-packages/docutils/utils/math/math2html.py | parsebit | edupyter/EDUPYTER | 2 | python | def parsebit(self, pos):
command = self.extractcommand(pos)
bit = self.parsewithcommand(command, pos)
if bit:
return bit
if (command.startswith('\\up') or command.startswith('\\Up')):
upgreek = self.parseupgreek(command, pos)
if upgreek:
return upgreek
if (not self.factory.defining):
Trace.error(('Unknown command ' + command))
self.output = TaggedOutput().settag('span class="unknown"')
self.add(FormulaConstant(command))
return None | def parsebit(self, pos):
command = self.extractcommand(pos)
bit = self.parsewithcommand(command, pos)
if bit:
return bit
if (command.startswith('\\up') or command.startswith('\\Up')):
upgreek = self.parseupgreek(command, pos)
if upgreek:
return upgreek
if (not self.factory.defining):
Trace.error(('Unknown command ' + command))
self.output = TaggedOutput().settag('span class="unknown"')
self.add(FormulaConstant(command))
return None<|docstring|>Parse the command.<|endoftext|> |
8139cd46bd45d40bb80e046e4cd8d0ee9eb9b32460cf5bee20e867911d9f6afd | def parsewithcommand(self, command, pos):
'Parse the command type once we have the command.'
for type in FormulaCommand.types:
if (command in type.commandmap):
return self.parsecommandtype(command, type, pos)
return None | Parse the command type once we have the command. | Lib/site-packages/docutils/utils/math/math2html.py | parsewithcommand | edupyter/EDUPYTER | 2 | python | def parsewithcommand(self, command, pos):
for type in FormulaCommand.types:
if (command in type.commandmap):
return self.parsecommandtype(command, type, pos)
return None | def parsewithcommand(self, command, pos):
for type in FormulaCommand.types:
if (command in type.commandmap):
return self.parsecommandtype(command, type, pos)
return None<|docstring|>Parse the command type once we have the command.<|endoftext|> |
878517cb94a01b97bfe67fd0514f599c9a8d30550b46d5ae255e14a0c68db8a2 | def parsecommandtype(self, command, type, pos):
'Parse a given command type.'
bit = self.factory.create(type)
bit.setcommand(command)
returned = bit.parsebit(pos)
if returned:
return returned
return bit | Parse a given command type. | Lib/site-packages/docutils/utils/math/math2html.py | parsecommandtype | edupyter/EDUPYTER | 2 | python | def parsecommandtype(self, command, type, pos):
bit = self.factory.create(type)
bit.setcommand(command)
returned = bit.parsebit(pos)
if returned:
return returned
return bit | def parsecommandtype(self, command, type, pos):
bit = self.factory.create(type)
bit.setcommand(command)
returned = bit.parsebit(pos)
if returned:
return returned
return bit<|docstring|>Parse a given command type.<|endoftext|> |
168f283c4e61849321a85628f28037a9040b91873be7fc125947d5b94673db24 | def extractcommand(self, pos):
'Extract the command from the current position.'
if (not pos.checkskip(FormulaCommand.start)):
pos.error(('Missing command start ' + FormulaCommand.start))
return
if pos.finished():
return self.emptycommand(pos)
if pos.current().isalpha():
command = (FormulaCommand.start + pos.globalpha())
pos.checkskip('*')
return command
return (FormulaCommand.start + pos.skipcurrent()) | Extract the command from the current position. | Lib/site-packages/docutils/utils/math/math2html.py | extractcommand | edupyter/EDUPYTER | 2 | python | def extractcommand(self, pos):
if (not pos.checkskip(FormulaCommand.start)):
pos.error(('Missing command start ' + FormulaCommand.start))
return
if pos.finished():
return self.emptycommand(pos)
if pos.current().isalpha():
command = (FormulaCommand.start + pos.globalpha())
pos.checkskip('*')
return command
return (FormulaCommand.start + pos.skipcurrent()) | def extractcommand(self, pos):
if (not pos.checkskip(FormulaCommand.start)):
pos.error(('Missing command start ' + FormulaCommand.start))
return
if pos.finished():
return self.emptycommand(pos)
if pos.current().isalpha():
command = (FormulaCommand.start + pos.globalpha())
pos.checkskip('*')
return command
return (FormulaCommand.start + pos.skipcurrent())<|docstring|>Extract the command from the current position.<|endoftext|> |
00edf9980e8e6dcb5b753364e0e7caa54e412f214bb083ef4169448b75a4c0dd | def emptycommand(self, pos):
"Check for an empty command: look for command disguised as ending.\n Special case against '{ \\{ \\} }' situation."
command = ''
if (not pos.isout()):
ending = pos.nextending()
if (ending and pos.checkskip(ending)):
command = ending
return (FormulaCommand.start + command) | Check for an empty command: look for command disguised as ending.
Special case against '{ \{ \} }' situation. | Lib/site-packages/docutils/utils/math/math2html.py | emptycommand | edupyter/EDUPYTER | 2 | python | def emptycommand(self, pos):
"Check for an empty command: look for command disguised as ending.\n Special case against '{ \\{ \\} }' situation."
command =
if (not pos.isout()):
ending = pos.nextending()
if (ending and pos.checkskip(ending)):
command = ending
return (FormulaCommand.start + command) | def emptycommand(self, pos):
"Check for an empty command: look for command disguised as ending.\n Special case against '{ \\{ \\} }' situation."
command =
if (not pos.isout()):
ending = pos.nextending()
if (ending and pos.checkskip(ending)):
command = ending
return (FormulaCommand.start + command)<|docstring|>Check for an empty command: look for command disguised as ending.
Special case against '{ \{ \} }' situation.<|endoftext|> |
da2da5b9a7b311b8bb3e9496700dc08742322472d71374dbac858fcffeb23759 | def parseupgreek(self, command, pos):
'Parse the Greek \\up command..'
if (len(command) < 4):
return None
if command.startswith('\\up'):
upcommand = ('\\' + command[3:])
elif pos.checkskip('\\Up'):
upcommand = (('\\' + command[3:4].upper()) + command[4:])
else:
Trace.error(('Impossible upgreek command: ' + command))
return
upgreek = self.parsewithcommand(upcommand, pos)
if upgreek:
upgreek.type = 'font'
return upgreek | Parse the Greek \up command.. | Lib/site-packages/docutils/utils/math/math2html.py | parseupgreek | edupyter/EDUPYTER | 2 | python | def parseupgreek(self, command, pos):
'Parse the Greek \\up command..'
if (len(command) < 4):
return None
if command.startswith('\\up'):
upcommand = ('\\' + command[3:])
elif pos.checkskip('\\Up'):
upcommand = (('\\' + command[3:4].upper()) + command[4:])
else:
Trace.error(('Impossible upgreek command: ' + command))
return
upgreek = self.parsewithcommand(upcommand, pos)
if upgreek:
upgreek.type = 'font'
return upgreek | def parseupgreek(self, command, pos):
'Parse the Greek \\up command..'
if (len(command) < 4):
return None
if command.startswith('\\up'):
upcommand = ('\\' + command[3:])
elif pos.checkskip('\\Up'):
upcommand = (('\\' + command[3:4].upper()) + command[4:])
else:
Trace.error(('Impossible upgreek command: ' + command))
return
upgreek = self.parsewithcommand(upcommand, pos)
if upgreek:
upgreek.type = 'font'
return upgreek<|docstring|>Parse the Greek \up command..<|endoftext|> |
17d6e0667a572a4e6d87e0a6dbf4fe74eb845aa17fce4d3eb18d9ce7629abe8e | def setcommand(self, command):
'Set the command in the bit'
self.command = command
if self.commandmap:
self.original += command
self.translated = self.commandmap[self.command] | Set the command in the bit | Lib/site-packages/docutils/utils/math/math2html.py | setcommand | edupyter/EDUPYTER | 2 | python | def setcommand(self, command):
self.command = command
if self.commandmap:
self.original += command
self.translated = self.commandmap[self.command] | def setcommand(self, command):
self.command = command
if self.commandmap:
self.original += command
self.translated = self.commandmap[self.command]<|docstring|>Set the command in the bit<|endoftext|> |
a3d057e5b100f669d00c74152169a03d34764d5c325ff165c9583f34f8e3d520 | def parseparameter(self, pos):
'Parse a parameter at the current position'
self.factory.clearskipped(pos)
if pos.finished():
return None
parameter = self.factory.parseany(pos)
self.add(parameter)
return parameter | Parse a parameter at the current position | Lib/site-packages/docutils/utils/math/math2html.py | parseparameter | edupyter/EDUPYTER | 2 | python | def parseparameter(self, pos):
self.factory.clearskipped(pos)
if pos.finished():
return None
parameter = self.factory.parseany(pos)
self.add(parameter)
return parameter | def parseparameter(self, pos):
self.factory.clearskipped(pos)
if pos.finished():
return None
parameter = self.factory.parseany(pos)
self.add(parameter)
return parameter<|docstring|>Parse a parameter at the current position<|endoftext|> |
e065bbbb49579ba0b11329f91d06b9ee6694cb79b3be0710df2d8e8f9af9b693 | def parsesquare(self, pos):
'Parse a square bracket'
self.factory.clearskipped(pos)
if (not self.factory.detecttype(SquareBracket, pos)):
return None
bracket = self.factory.parsetype(SquareBracket, pos)
self.add(bracket)
return bracket | Parse a square bracket | Lib/site-packages/docutils/utils/math/math2html.py | parsesquare | edupyter/EDUPYTER | 2 | python | def parsesquare(self, pos):
self.factory.clearskipped(pos)
if (not self.factory.detecttype(SquareBracket, pos)):
return None
bracket = self.factory.parsetype(SquareBracket, pos)
self.add(bracket)
return bracket | def parsesquare(self, pos):
self.factory.clearskipped(pos)
if (not self.factory.detecttype(SquareBracket, pos)):
return None
bracket = self.factory.parsetype(SquareBracket, pos)
self.add(bracket)
return bracket<|docstring|>Parse a square bracket<|endoftext|> |
e240611be7b3204c51718783d7d7376095b8ae3489f8a70010f8518db9d1b31f | def parseliteral(self, pos):
'Parse a literal bracket.'
self.factory.clearskipped(pos)
if (not self.factory.detecttype(Bracket, pos)):
if (not pos.isvalue()):
Trace.error(('No literal parameter found at: ' + pos.identifier()))
return None
return pos.globvalue()
bracket = Bracket().setfactory(self.factory)
self.add(bracket.parseliteral(pos))
return bracket.literal | Parse a literal bracket. | Lib/site-packages/docutils/utils/math/math2html.py | parseliteral | edupyter/EDUPYTER | 2 | python | def parseliteral(self, pos):
self.factory.clearskipped(pos)
if (not self.factory.detecttype(Bracket, pos)):
if (not pos.isvalue()):
Trace.error(('No literal parameter found at: ' + pos.identifier()))
return None
return pos.globvalue()
bracket = Bracket().setfactory(self.factory)
self.add(bracket.parseliteral(pos))
return bracket.literal | def parseliteral(self, pos):
self.factory.clearskipped(pos)
if (not self.factory.detecttype(Bracket, pos)):
if (not pos.isvalue()):
Trace.error(('No literal parameter found at: ' + pos.identifier()))
return None
return pos.globvalue()
bracket = Bracket().setfactory(self.factory)
self.add(bracket.parseliteral(pos))
return bracket.literal<|docstring|>Parse a literal bracket.<|endoftext|> |
0a4fa89c189530c5ba20d34d2b320cad9d0cddc7b09f0f9afb92a3021ad2ed24 | def parsesquareliteral(self, pos):
'Parse a square bracket literally.'
self.factory.clearskipped(pos)
if (not self.factory.detecttype(SquareBracket, pos)):
return None
bracket = SquareBracket().setfactory(self.factory)
self.add(bracket.parseliteral(pos))
return bracket.literal | Parse a square bracket literally. | Lib/site-packages/docutils/utils/math/math2html.py | parsesquareliteral | edupyter/EDUPYTER | 2 | python | def parsesquareliteral(self, pos):
self.factory.clearskipped(pos)
if (not self.factory.detecttype(SquareBracket, pos)):
return None
bracket = SquareBracket().setfactory(self.factory)
self.add(bracket.parseliteral(pos))
return bracket.literal | def parsesquareliteral(self, pos):
self.factory.clearskipped(pos)
if (not self.factory.detecttype(SquareBracket, pos)):
return None
bracket = SquareBracket().setfactory(self.factory)
self.add(bracket.parseliteral(pos))
return bracket.literal<|docstring|>Parse a square bracket literally.<|endoftext|> |
6a8c8ce78310c3b68c0ee46e7fa2307e14fc8a50133963419630a7a55e101be8 | def parsetext(self, pos):
'Parse a text parameter.'
self.factory.clearskipped(pos)
if (not self.factory.detecttype(Bracket, pos)):
Trace.error(('No text parameter for ' + self.command))
return None
bracket = Bracket().setfactory(self.factory).parsetext(pos)
self.add(bracket)
return bracket | Parse a text parameter. | Lib/site-packages/docutils/utils/math/math2html.py | parsetext | edupyter/EDUPYTER | 2 | python | def parsetext(self, pos):
self.factory.clearskipped(pos)
if (not self.factory.detecttype(Bracket, pos)):
Trace.error(('No text parameter for ' + self.command))
return None
bracket = Bracket().setfactory(self.factory).parsetext(pos)
self.add(bracket)
return bracket | def parsetext(self, pos):
self.factory.clearskipped(pos)
if (not self.factory.detecttype(Bracket, pos)):
Trace.error(('No text parameter for ' + self.command))
return None
bracket = Bracket().setfactory(self.factory).parsetext(pos)
self.add(bracket)
return bracket<|docstring|>Parse a text parameter.<|endoftext|> |
533dff0913c4f99a131c1c65b6403fbbb4dec7e408ae0dc593457dff266a61cc | def parsebit(self, pos):
'Parse a command without parameters'
self.contents = [FormulaConstant(self.translated)] | Parse a command without parameters | Lib/site-packages/docutils/utils/math/math2html.py | parsebit | edupyter/EDUPYTER | 2 | python | def parsebit(self, pos):
self.contents = [FormulaConstant(self.translated)] | def parsebit(self, pos):
self.contents = [FormulaConstant(self.translated)]<|docstring|>Parse a command without parameters<|endoftext|> |
d2e3122af96ae8446e3481ff4bfca06e26e402953136f85cd45e1dedf1cba435 | def parsebit(self, pos):
'Place as contents the command translated and spaced.'
self.contents = [FormulaConstant(((u'\u2009' + self.translated) + u'\u2009'))] | Place as contents the command translated and spaced. | Lib/site-packages/docutils/utils/math/math2html.py | parsebit | edupyter/EDUPYTER | 2 | python | def parsebit(self, pos):
self.contents = [FormulaConstant(((u'\u2009' + self.translated) + u'\u2009'))] | def parsebit(self, pos):
self.contents = [FormulaConstant(((u'\u2009' + self.translated) + u'\u2009'))]<|docstring|>Place as contents the command translated and spaced.<|endoftext|> |
eab07f13606ff3b31e332116717adcd353c88e7151c8c443979240c0481ae867 | def parsebit(self, pos):
'Parse the command and set type to alpha'
EmptyCommand.parsebit(self, pos)
if (self.command not in self.greek_capitals):
self.type = 'alpha' | Parse the command and set type to alpha | Lib/site-packages/docutils/utils/math/math2html.py | parsebit | edupyter/EDUPYTER | 2 | python | def parsebit(self, pos):
EmptyCommand.parsebit(self, pos)
if (self.command not in self.greek_capitals):
self.type = 'alpha' | def parsebit(self, pos):
EmptyCommand.parsebit(self, pos)
if (self.command not in self.greek_capitals):
self.type = 'alpha'<|docstring|>Parse the command and set type to alpha<|endoftext|> |
15e9f607cdca23f12bc1e8c30ed02e424fe06a0202909678aa85bba2524024b9 | def parsebit(self, pos):
'Parse a function with one parameter'
self.output = TaggedOutput().settag(self.translated)
self.parseparameter(pos)
self.simplifyifpossible() | Parse a function with one parameter | Lib/site-packages/docutils/utils/math/math2html.py | parsebit | edupyter/EDUPYTER | 2 | python | def parsebit(self, pos):
self.output = TaggedOutput().settag(self.translated)
self.parseparameter(pos)
self.simplifyifpossible() | def parsebit(self, pos):
self.output = TaggedOutput().settag(self.translated)
self.parseparameter(pos)
self.simplifyifpossible()<|docstring|>Parse a function with one parameter<|endoftext|> |
2a9c3ec6a519447bdcdf5801b80c09c248885ad019c6c68c1b023a73cda0b55b | def simplifyifpossible(self):
'Try to simplify to a single character.'
if (self.original in self.commandmap):
self.output = FixedOutput()
self.html = [self.commandmap[self.original]]
self.simplified = True | Try to simplify to a single character. | Lib/site-packages/docutils/utils/math/math2html.py | simplifyifpossible | edupyter/EDUPYTER | 2 | python | def simplifyifpossible(self):
if (self.original in self.commandmap):
self.output = FixedOutput()
self.html = [self.commandmap[self.original]]
self.simplified = True | def simplifyifpossible(self):
if (self.original in self.commandmap):
self.output = FixedOutput()
self.html = [self.commandmap[self.original]]
self.simplified = True<|docstring|>Try to simplify to a single character.<|endoftext|> |
053fba50bdb5853b37724bdeee49fed7ea3a4655880dcaeed66fe5b01e487293 | def detect(self, pos):
'Find the symbol'
return (pos.current() in SymbolFunction.commandmap) | Find the symbol | Lib/site-packages/docutils/utils/math/math2html.py | detect | edupyter/EDUPYTER | 2 | python | def detect(self, pos):
return (pos.current() in SymbolFunction.commandmap) | def detect(self, pos):
return (pos.current() in SymbolFunction.commandmap)<|docstring|>Find the symbol<|endoftext|> |
85fd42debd129c9ad7d03ff5127d5488df210e4f08045e7e2ab5e5a233710e41 | def parsebit(self, pos):
'Parse the symbol'
self.setcommand(pos.current())
pos.skip(self.command)
self.output = TaggedOutput().settag(self.translated)
self.parseparameter(pos) | Parse the symbol | Lib/site-packages/docutils/utils/math/math2html.py | parsebit | edupyter/EDUPYTER | 2 | python | def parsebit(self, pos):
self.setcommand(pos.current())
pos.skip(self.command)
self.output = TaggedOutput().settag(self.translated)
self.parseparameter(pos) | def parsebit(self, pos):
self.setcommand(pos.current())
pos.skip(self.command)
self.output = TaggedOutput().settag(self.translated)
self.parseparameter(pos)<|docstring|>Parse the symbol<|endoftext|> |
3f8da8776c242ec4b5c4499393dc435afe6e3cca3cc9fddaf3ccb6c12c7a678f | def parsebit(self, pos):
'Parse a text parameter'
self.output = TaggedOutput().settag(self.translated)
self.parsetext(pos) | Parse a text parameter | Lib/site-packages/docutils/utils/math/math2html.py | parsebit | edupyter/EDUPYTER | 2 | python | def parsebit(self, pos):
self.output = TaggedOutput().settag(self.translated)
self.parsetext(pos) | def parsebit(self, pos):
self.output = TaggedOutput().settag(self.translated)
self.parsetext(pos)<|docstring|>Parse a text parameter<|endoftext|> |
2dfe06e86704a7dae7fb1d3719f94d8d59789daf0d9faf09eddfd1b2f099b5d4 | def process(self):
'Set the type to font'
self.type = 'font' | Set the type to font | Lib/site-packages/docutils/utils/math/math2html.py | process | edupyter/EDUPYTER | 2 | python | def process(self):
self.type = 'font' | def process(self):
self.type = 'font'<|docstring|>Set the type to font<|endoftext|> |
f3ed1d65b2f10e8dc8f1bda106abedc2c462ccfe0c691b2284041e617eee8ae7 | def parsebit(self, pos):
'Parse a literal parameter'
self.key = self.parseliteral(pos) | Parse a literal parameter | Lib/site-packages/docutils/utils/math/math2html.py | parsebit | edupyter/EDUPYTER | 2 | python | def parsebit(self, pos):
self.key = self.parseliteral(pos) | def parsebit(self, pos):
self.key = self.parseliteral(pos)<|docstring|>Parse a literal parameter<|endoftext|> |
9fcc7e6ba96b11f1c12236bf566f296057732eba3a3a874d695ae9a89c12f37c | def process(self):
'Add an anchor with the label contents.'
self.type = 'font'
self.label = Label().create(' ', self.key, type='eqnumber')
self.contents = [self.label]
Label.names[self.key] = self.label | Add an anchor with the label contents. | Lib/site-packages/docutils/utils/math/math2html.py | process | edupyter/EDUPYTER | 2 | python | def process(self):
self.type = 'font'
self.label = Label().create(' ', self.key, type='eqnumber')
self.contents = [self.label]
Label.names[self.key] = self.label | def process(self):
self.type = 'font'
self.label = Label().create(' ', self.key, type='eqnumber')
self.contents = [self.label]
Label.names[self.key] = self.label<|docstring|>Add an anchor with the label contents.<|endoftext|> |
67e9f6790a978a8ab7698847c148d83999170bc7e30abb29495468db23333ba3 | def process(self):
'Simplify if possible using a single character.'
self.type = 'font'
self.simplifyifpossible() | Simplify if possible using a single character. | Lib/site-packages/docutils/utils/math/math2html.py | process | edupyter/EDUPYTER | 2 | python | def process(self):
self.type = 'font'
self.simplifyifpossible() | def process(self):
self.type = 'font'
self.simplifyifpossible()<|docstring|>Simplify if possible using a single character.<|endoftext|> |
6940248a8d9aae43f5c7e2e16f31962bfcb3f4b747408d55186c4c1d2a531616 | def __init__(self, size, bracket, alignment='l'):
'Set the size and symbol for the bracket.'
self.size = size
self.original = bracket
self.alignment = alignment
self.pieces = None
if (bracket in FormulaConfig.bigbrackets):
self.pieces = FormulaConfig.bigbrackets[bracket] | Set the size and symbol for the bracket. | Lib/site-packages/docutils/utils/math/math2html.py | __init__ | edupyter/EDUPYTER | 2 | python | def __init__(self, size, bracket, alignment='l'):
self.size = size
self.original = bracket
self.alignment = alignment
self.pieces = None
if (bracket in FormulaConfig.bigbrackets):
self.pieces = FormulaConfig.bigbrackets[bracket] | def __init__(self, size, bracket, alignment='l'):
self.size = size
self.original = bracket
self.alignment = alignment
self.pieces = None
if (bracket in FormulaConfig.bigbrackets):
self.pieces = FormulaConfig.bigbrackets[bracket]<|docstring|>Set the size and symbol for the bracket.<|endoftext|> |
1ed9a9e1e5965947864e41805943207d9ec8786cc11c8a18c8004ee929fa0eed | def getpiece(self, index):
'Return the nth piece for the bracket.'
function = getattr(self, ('getpiece' + unicode(len(self.pieces))))
return function(index) | Return the nth piece for the bracket. | Lib/site-packages/docutils/utils/math/math2html.py | getpiece | edupyter/EDUPYTER | 2 | python | def getpiece(self, index):
function = getattr(self, ('getpiece' + unicode(len(self.pieces))))
return function(index) | def getpiece(self, index):
function = getattr(self, ('getpiece' + unicode(len(self.pieces))))
return function(index)<|docstring|>Return the nth piece for the bracket.<|endoftext|> |
b42ef937c35ea84802f8fcc6c9d5f5601960970f3b7b7a6111860b23f4af3361 | def getpiece1(self, index):
'Return the only piece for a single-piece bracket.'
return self.pieces[0] | Return the only piece for a single-piece bracket. | Lib/site-packages/docutils/utils/math/math2html.py | getpiece1 | edupyter/EDUPYTER | 2 | python | def getpiece1(self, index):
return self.pieces[0] | def getpiece1(self, index):
return self.pieces[0]<|docstring|>Return the only piece for a single-piece bracket.<|endoftext|> |
13c0514932e50234bde9e4e421c9986befaa4cd03699ee4fc7ba3d4a366a6bd1 | def getpiece3(self, index):
'Get the nth piece for a 3-piece bracket: parenthesis or square bracket.'
if (index == 0):
return self.pieces[0]
if (index == (self.size - 1)):
return self.pieces[(- 1)]
return self.pieces[1] | Get the nth piece for a 3-piece bracket: parenthesis or square bracket. | Lib/site-packages/docutils/utils/math/math2html.py | getpiece3 | edupyter/EDUPYTER | 2 | python | def getpiece3(self, index):
if (index == 0):
return self.pieces[0]
if (index == (self.size - 1)):
return self.pieces[(- 1)]
return self.pieces[1] | def getpiece3(self, index):
if (index == 0):
return self.pieces[0]
if (index == (self.size - 1)):
return self.pieces[(- 1)]
return self.pieces[1]<|docstring|>Get the nth piece for a 3-piece bracket: parenthesis or square bracket.<|endoftext|> |
ca6cf89325c730deaf6ec7fbc9d1b16ae3a828663958f9ed5b0dabf3edae7656 | def getpiece4(self, index):
'Get the nth piece for a 4-piece bracket: curly bracket.'
if (index == 0):
return self.pieces[0]
if (index == (self.size - 1)):
return self.pieces[3]
if (index == ((self.size - 1) / 2)):
return self.pieces[2]
return self.pieces[1] | Get the nth piece for a 4-piece bracket: curly bracket. | Lib/site-packages/docutils/utils/math/math2html.py | getpiece4 | edupyter/EDUPYTER | 2 | python | def getpiece4(self, index):
if (index == 0):
return self.pieces[0]
if (index == (self.size - 1)):
return self.pieces[3]
if (index == ((self.size - 1) / 2)):
return self.pieces[2]
return self.pieces[1] | def getpiece4(self, index):
if (index == 0):
return self.pieces[0]
if (index == (self.size - 1)):
return self.pieces[3]
if (index == ((self.size - 1) / 2)):
return self.pieces[2]
return self.pieces[1]<|docstring|>Get the nth piece for a 4-piece bracket: curly bracket.<|endoftext|> |
b94b40e7157e92c4c48222101739c5c8431b1441308a9d92849a5597d61135d2 | def getcell(self, index):
'Get the bracket piece as an array cell.'
piece = self.getpiece(index)
span = (('span class="bracket align-' + self.alignment) + '"')
return TaggedBit().constant(piece, span) | Get the bracket piece as an array cell. | Lib/site-packages/docutils/utils/math/math2html.py | getcell | edupyter/EDUPYTER | 2 | python | def getcell(self, index):
piece = self.getpiece(index)
span = (('span class="bracket align-' + self.alignment) + '"')
return TaggedBit().constant(piece, span) | def getcell(self, index):
piece = self.getpiece(index)
span = (('span class="bracket align-' + self.alignment) + '"')
return TaggedBit().constant(piece, span)<|docstring|>Get the bracket piece as an array cell.<|endoftext|> |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.