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 |
|---|---|---|---|---|---|---|---|---|---|
541b0221f8b17f16dbe5f71d106d514ea06b3877a87221d57d59b474ae4c4074 | def create(cls, type):
'Create an object of a given class.'
clone = type.__new__(type)
clone.__init__()
return clone | Create an object of a given class. | Lib/site-packages/docutils/utils/math/math2html.py | create | edupyter/EDUPYTER | 2 | python | def create(cls, type):
clone = type.__new__(type)
clone.__init__()
return clone | def create(cls, type):
clone = type.__new__(type)
clone.__init__()
return clone<|docstring|>Create an object of a given class.<|endoftext|> |
34801a03910a6a80da7673ad7345718d0af4a5474469c9276815c92058cf772b | def extract(self, container):
'Extract a group of selected containers from a container.'
list = []
locate = (lambda c: (c.__class__.__name__ in self.allowed))
recursive = (lambda c: (c.__class__.__name__ in self.extracted))
process = (lambda c: self.process(c, list))
container.recursivesearch(locate, recursive, process)
return list | Extract a group of selected containers from a container. | Lib/site-packages/docutils/utils/math/math2html.py | extract | edupyter/EDUPYTER | 2 | python | def extract(self, container):
list = []
locate = (lambda c: (c.__class__.__name__ in self.allowed))
recursive = (lambda c: (c.__class__.__name__ in self.extracted))
process = (lambda c: self.process(c, list))
container.recursivesearch(locate, recursive, process)
return list | def extract(self, container):
list = []
locate = (lambda c: (c.__class__.__name__ in self.allowed))
recursive = (lambda c: (c.__class__.__name__ in self.extracted))
process = (lambda c: self.process(c, list))
container.recursivesearch(locate, recursive, process)
return list<|docstring|>Extract a group of selected containers from a container.<|endoftext|> |
1372a9d6595ea6100121e1865a6d1a2b28eb3e7a40caa457afc5babe636abc89 | def process(self, container, list):
'Add allowed containers.'
name = container.__class__.__name__
if (name in self.allowed):
list.append(container)
else:
Trace.error(('Unknown container class ' + name)) | Add allowed containers. | Lib/site-packages/docutils/utils/math/math2html.py | process | edupyter/EDUPYTER | 2 | python | def process(self, container, list):
name = container.__class__.__name__
if (name in self.allowed):
list.append(container)
else:
Trace.error(('Unknown container class ' + name)) | def process(self, container, list):
name = container.__class__.__name__
if (name in self.allowed):
list.append(container)
else:
Trace.error(('Unknown container class ' + name))<|docstring|>Add allowed containers.<|endoftext|> |
e53305bcdd8b99efde019d3af2a22d1dcd50dc2287c8fbd029147cc8cab9cdcb | def safeclone(self, container):
'Return a new container with contents only in a safe list, recursively.'
clone = Cloner.clone(container)
clone.output = container.output
clone.contents = self.extract(container)
return clone | Return a new container with contents only in a safe list, recursively. | Lib/site-packages/docutils/utils/math/math2html.py | safeclone | edupyter/EDUPYTER | 2 | python | def safeclone(self, container):
clone = Cloner.clone(container)
clone.output = container.output
clone.contents = self.extract(container)
return clone | def safeclone(self, container):
clone = Cloner.clone(container)
clone.output = container.output
clone.contents = self.extract(container)
return clone<|docstring|>Return a new container with contents only in a safe list, recursively.<|endoftext|> |
234cdb136f8f01c20a6cb35507406ba57d80ac021a521f77a9f31854598495a0 | def parseheader(self, reader):
'Parse the header'
header = reader.currentline().split()
reader.nextline()
self.begin = reader.linenumber
return header | Parse the header | Lib/site-packages/docutils/utils/math/math2html.py | parseheader | edupyter/EDUPYTER | 2 | python | def parseheader(self, reader):
header = reader.currentline().split()
reader.nextline()
self.begin = reader.linenumber
return header | def parseheader(self, reader):
header = reader.currentline().split()
reader.nextline()
self.begin = reader.linenumber
return header<|docstring|>Parse the header<|endoftext|> |
3238812b9a85d0e4f70e6464338aa517a4d41e2384f002cbc4fe0ab0dc0acc10 | def parseparameter(self, reader):
'Parse a parameter'
split = reader.currentline().strip().split(' ', 1)
reader.nextline()
if (len(split) == 0):
return
key = split[0]
if (len(split) == 1):
self.parameters[key] = True
return
if (not ('"' in split[1])):
self.parameters[key] = split[1].strip()
return
doublesplit = split[1].split('"')
self.parameters[key] = doublesplit[1] | Parse a parameter | Lib/site-packages/docutils/utils/math/math2html.py | parseparameter | edupyter/EDUPYTER | 2 | python | def parseparameter(self, reader):
split = reader.currentline().strip().split(' ', 1)
reader.nextline()
if (len(split) == 0):
return
key = split[0]
if (len(split) == 1):
self.parameters[key] = True
return
if (not ('"' in split[1])):
self.parameters[key] = split[1].strip()
return
doublesplit = split[1].split('"')
self.parameters[key] = doublesplit[1] | def parseparameter(self, reader):
split = reader.currentline().strip().split(' ', 1)
reader.nextline()
if (len(split) == 0):
return
key = split[0]
if (len(split) == 1):
self.parameters[key] = True
return
if (not ('"' in split[1])):
self.parameters[key] = split[1].strip()
return
doublesplit = split[1].split('"')
self.parameters[key] = doublesplit[1]<|docstring|>Parse a parameter<|endoftext|> |
60926a582840c44a146b421005a07cb37ee382cdd539df8222957680e2e9ef52 | def parseending(self, reader, process):
'Parse until the current ending is found'
if (not self.ending):
Trace.error(('No ending for ' + unicode(self)))
return
while (not reader.currentline().startswith(self.ending)):
process() | Parse until the current ending is found | Lib/site-packages/docutils/utils/math/math2html.py | parseending | edupyter/EDUPYTER | 2 | python | def parseending(self, reader, process):
if (not self.ending):
Trace.error(('No ending for ' + unicode(self)))
return
while (not reader.currentline().startswith(self.ending)):
process() | def parseending(self, reader, process):
if (not self.ending):
Trace.error(('No ending for ' + unicode(self)))
return
while (not reader.currentline().startswith(self.ending)):
process()<|docstring|>Parse until the current ending is found<|endoftext|> |
2844ad9c6c812e8384acdd077ed22c2286fdcf26ac34e999f366b3e92dceb3b1 | def __unicode__(self):
'Return a description'
return (((self.__class__.__name__ + ' (') + unicode(self.begin)) + ')') | Return a description | Lib/site-packages/docutils/utils/math/math2html.py | __unicode__ | edupyter/EDUPYTER | 2 | python | def __unicode__(self):
return (((self.__class__.__name__ + ' (') + unicode(self.begin)) + ')') | def __unicode__(self):
return (((self.__class__.__name__ + ' (') + unicode(self.begin)) + ')')<|docstring|>Return a description<|endoftext|> |
1f16b0cfa36947fa2a2b9121a2705c6f30dbd524840d916743fa513ec887a7bb | def parse(self, reader):
'Read nothing'
return [] | Read nothing | Lib/site-packages/docutils/utils/math/math2html.py | parse | edupyter/EDUPYTER | 2 | python | def parse(self, reader):
return [] | def parse(self, reader):
return []<|docstring|>Read nothing<|endoftext|> |
8e9da17b92f11494599641099d684710b44e03aa6615a9092c3b2193fbb7c490 | def parse(self, reader):
'Parse lines as long as they are text'
TextParser.stack.append(self.ending)
self.endings = (TextParser.stack + [ContainerConfig.endings['Layout'], ContainerConfig.endings['Inset'], self.ending])
contents = []
while (not self.isending(reader)):
self.parsecontainer(reader, contents)
return contents | Parse lines as long as they are text | Lib/site-packages/docutils/utils/math/math2html.py | parse | edupyter/EDUPYTER | 2 | python | def parse(self, reader):
TextParser.stack.append(self.ending)
self.endings = (TextParser.stack + [ContainerConfig.endings['Layout'], ContainerConfig.endings['Inset'], self.ending])
contents = []
while (not self.isending(reader)):
self.parsecontainer(reader, contents)
return contents | def parse(self, reader):
TextParser.stack.append(self.ending)
self.endings = (TextParser.stack + [ContainerConfig.endings['Layout'], ContainerConfig.endings['Inset'], self.ending])
contents = []
while (not self.isending(reader)):
self.parsecontainer(reader, contents)
return contents<|docstring|>Parse lines as long as they are text<|endoftext|> |
c5a4275f5681da7d54a7399986c36f7aafa2dd2cd01404d62730a5bcaa539214 | def isending(self, reader):
'Check if text is ending'
current = reader.currentline().split()
if (len(current) == 0):
return False
if (current[0] in self.endings):
if (current[0] in TextParser.stack):
TextParser.stack.remove(current[0])
else:
TextParser.stack = []
return True
return False | Check if text is ending | Lib/site-packages/docutils/utils/math/math2html.py | isending | edupyter/EDUPYTER | 2 | python | def isending(self, reader):
current = reader.currentline().split()
if (len(current) == 0):
return False
if (current[0] in self.endings):
if (current[0] in TextParser.stack):
TextParser.stack.remove(current[0])
else:
TextParser.stack = []
return True
return False | def isending(self, reader):
current = reader.currentline().split()
if (len(current) == 0):
return False
if (current[0] in self.endings):
if (current[0] in TextParser.stack):
TextParser.stack.remove(current[0])
else:
TextParser.stack = []
return True
return False<|docstring|>Check if text is ending<|endoftext|> |
b6549809dfc86561107887a483348a7ae546daf0f620867bca864de4c492fd65 | def parse(self, reader):
'Parse everything up to (and excluding) the final line'
contents = []
self.parseending(reader, (lambda : self.parsecontainer(reader, contents)))
return contents | Parse everything up to (and excluding) the final line | Lib/site-packages/docutils/utils/math/math2html.py | parse | edupyter/EDUPYTER | 2 | python | def parse(self, reader):
contents = []
self.parseending(reader, (lambda : self.parsecontainer(reader, contents)))
return contents | def parse(self, reader):
contents = []
self.parseending(reader, (lambda : self.parsecontainer(reader, contents)))
return contents<|docstring|>Parse everything up to (and excluding) the final line<|endoftext|> |
9e68531a28e97132ec8d103897db9ff90a24c9f2dd3cbb8b3dbcbb7c95a4ddd9 | def parse(self, reader):
'Parse everything, including the final line'
contents = ExcludingParser.parse(self, reader)
reader.nextline()
return contents | Parse everything, including the final line | Lib/site-packages/docutils/utils/math/math2html.py | parse | edupyter/EDUPYTER | 2 | python | def parse(self, reader):
contents = ExcludingParser.parse(self, reader)
reader.nextline()
return contents | def parse(self, reader):
contents = ExcludingParser.parse(self, reader)
reader.nextline()
return contents<|docstring|>Parse everything, including the final line<|endoftext|> |
94facf2f296070775a9fd0dd914170720a5ce10a239ba43f439700efcea69d20 | def parse(self, reader):
'Parse the contents of the container'
self.parseending(reader, (lambda : reader.nextline()))
reader.nextline()
return [] | Parse the contents of the container | Lib/site-packages/docutils/utils/math/math2html.py | parse | edupyter/EDUPYTER | 2 | python | def parse(self, reader):
self.parseending(reader, (lambda : reader.nextline()))
reader.nextline()
return [] | def parse(self, reader):
self.parseending(reader, (lambda : reader.nextline()))
reader.nextline()
return []<|docstring|>Parse the contents of the container<|endoftext|> |
eb6933000b01e0c04b18bcfdc72f5ba5fa2c9b35a273537e5f9dd759a762138e | def parseheader(self, reader):
'Do nothing, just take note'
self.begin = (reader.linenumber + 1)
return [] | Do nothing, just take note | Lib/site-packages/docutils/utils/math/math2html.py | parseheader | edupyter/EDUPYTER | 2 | python | def parseheader(self, reader):
self.begin = (reader.linenumber + 1)
return [] | def parseheader(self, reader):
self.begin = (reader.linenumber + 1)
return []<|docstring|>Do nothing, just take note<|endoftext|> |
1865f10e84c679e641bb65a29c6edfadf26407c6589fd842975e047f3bb84ade | def parse(self, reader):
'Parse a single line'
contents = reader.currentline()
reader.nextline()
return contents | Parse a single line | Lib/site-packages/docutils/utils/math/math2html.py | parse | edupyter/EDUPYTER | 2 | python | def parse(self, reader):
contents = reader.currentline()
reader.nextline()
return contents | def parse(self, reader):
contents = reader.currentline()
reader.nextline()
return contents<|docstring|>Parse a single line<|endoftext|> |
08c107e9cb0e200463d60916ffaced53fb2914b0f8b67735b8c5cce86752da82 | def gethtml(self, container):
'Show an error.'
Trace.error(('gethtml() not implemented for ' + unicode(self))) | Show an error. | Lib/site-packages/docutils/utils/math/math2html.py | gethtml | edupyter/EDUPYTER | 2 | python | def gethtml(self, container):
Trace.error(('gethtml() not implemented for ' + unicode(self))) | def gethtml(self, container):
Trace.error(('gethtml() not implemented for ' + unicode(self)))<|docstring|>Show an error.<|endoftext|> |
e7866cf6c3ebbf189de9395010cb35dfa4b4ee1673bf5d5edf8e70724b000a86 | def isempty(self):
'Decide if the output is empty: by default, not empty.'
return False | Decide if the output is empty: by default, not empty. | Lib/site-packages/docutils/utils/math/math2html.py | isempty | edupyter/EDUPYTER | 2 | python | def isempty(self):
return False | def isempty(self):
return False<|docstring|>Decide if the output is empty: by default, not empty.<|endoftext|> |
dc6c1cd054b7270418f08741c2d1589ab7862a735a05d740250d27ee4c0d2d8c | def gethtml(self, container):
'Return empty HTML code.'
return [] | Return empty HTML code. | Lib/site-packages/docutils/utils/math/math2html.py | gethtml | edupyter/EDUPYTER | 2 | python | def gethtml(self, container):
return [] | def gethtml(self, container):
return []<|docstring|>Return empty HTML code.<|endoftext|> |
6156176621be83563654b41391fc978c2368e2f23fcdf441b905febd1ff31c99 | def isempty(self):
'This output is particularly empty.'
return True | This output is particularly empty. | Lib/site-packages/docutils/utils/math/math2html.py | isempty | edupyter/EDUPYTER | 2 | python | def isempty(self):
return True | def isempty(self):
return True<|docstring|>This output is particularly empty.<|endoftext|> |
d36135d245fd74745f69d97e479641db8dd9ab24acd9f736647efeda354ac326 | def gethtml(self, container):
'Return constant HTML code'
return container.html | Return constant HTML code | Lib/site-packages/docutils/utils/math/math2html.py | gethtml | edupyter/EDUPYTER | 2 | python | def gethtml(self, container):
return container.html | def gethtml(self, container):
return container.html<|docstring|>Return constant HTML code<|endoftext|> |
1567fcb6fcfb41791deb952849bc5777473a1429e8932198aab228d1d7ed649f | def gethtml(self, container):
'Return the HTML code'
html = []
if (container.contents == None):
return html
for element in container.contents:
if (not hasattr(element, 'gethtml')):
Trace.error(((('No html in ' + element.__class__.__name__) + ': ') + unicode(element)))
return html
html += element.gethtml()
return html | Return the HTML code | Lib/site-packages/docutils/utils/math/math2html.py | gethtml | edupyter/EDUPYTER | 2 | python | def gethtml(self, container):
html = []
if (container.contents == None):
return html
for element in container.contents:
if (not hasattr(element, 'gethtml')):
Trace.error(((('No html in ' + element.__class__.__name__) + ': ') + unicode(element)))
return html
html += element.gethtml()
return html | def gethtml(self, container):
html = []
if (container.contents == None):
return html
for element in container.contents:
if (not hasattr(element, 'gethtml')):
Trace.error(((('No html in ' + element.__class__.__name__) + ': ') + unicode(element)))
return html
html += element.gethtml()
return html<|docstring|>Return the HTML code<|endoftext|> |
101572f504c68021c7cc0ab7af4ee330a23b69c899848aa79a35f50a839dbcc9 | def settag(self, tag, breaklines=False, empty=False):
'Set the value for the tag and other attributes.'
self.tag = tag
if breaklines:
self.breaklines = breaklines
if empty:
self.empty = empty
return self | Set the value for the tag and other attributes. | Lib/site-packages/docutils/utils/math/math2html.py | settag | edupyter/EDUPYTER | 2 | python | def settag(self, tag, breaklines=False, empty=False):
self.tag = tag
if breaklines:
self.breaklines = breaklines
if empty:
self.empty = empty
return self | def settag(self, tag, breaklines=False, empty=False):
self.tag = tag
if breaklines:
self.breaklines = breaklines
if empty:
self.empty = empty
return self<|docstring|>Set the value for the tag and other attributes.<|endoftext|> |
878f622abf727e3ec8f8c980c2a35f8d6ede73bc28f804baf0c687ee08e1a453 | def setbreaklines(self, breaklines):
'Set the value for breaklines.'
self.breaklines = breaklines
return self | Set the value for breaklines. | Lib/site-packages/docutils/utils/math/math2html.py | setbreaklines | edupyter/EDUPYTER | 2 | python | def setbreaklines(self, breaklines):
self.breaklines = breaklines
return self | def setbreaklines(self, breaklines):
self.breaklines = breaklines
return self<|docstring|>Set the value for breaklines.<|endoftext|> |
90d3c70ebce22f0098f796b450e8cb354ae406b268455e28f0bbc425e38e9fae | def gethtml(self, container):
'Return the HTML code.'
if self.empty:
return [self.selfclosing(container)]
html = [self.open(container)]
html += ContentsOutput.gethtml(self, container)
html.append(self.close(container))
return html | Return the HTML code. | Lib/site-packages/docutils/utils/math/math2html.py | gethtml | edupyter/EDUPYTER | 2 | python | def gethtml(self, container):
if self.empty:
return [self.selfclosing(container)]
html = [self.open(container)]
html += ContentsOutput.gethtml(self, container)
html.append(self.close(container))
return html | def gethtml(self, container):
if self.empty:
return [self.selfclosing(container)]
html = [self.open(container)]
html += ContentsOutput.gethtml(self, container)
html.append(self.close(container))
return html<|docstring|>Return the HTML code.<|endoftext|> |
11e26601d954989b9a805cc1a428637c6ba36c027c2ddd989438dd59f341af93 | def open(self, container):
'Get opening line.'
if (not self.checktag(container)):
return ''
open = (('<' + self.tag) + '>')
if self.breaklines:
return (open + '\n')
return open | Get opening line. | Lib/site-packages/docutils/utils/math/math2html.py | open | edupyter/EDUPYTER | 2 | python | def open(self, container):
if (not self.checktag(container)):
return
open = (('<' + self.tag) + '>')
if self.breaklines:
return (open + '\n')
return open | def open(self, container):
if (not self.checktag(container)):
return
open = (('<' + self.tag) + '>')
if self.breaklines:
return (open + '\n')
return open<|docstring|>Get opening line.<|endoftext|> |
4b6d99125f83f8a17963f606dd38b5e8b2adca82d850b2f03195863702184bdd | def close(self, container):
'Get closing line.'
if (not self.checktag(container)):
return ''
close = (('</' + self.tag.split()[0]) + '>')
if self.breaklines:
return (('\n' + close) + '\n')
return close | Get closing line. | Lib/site-packages/docutils/utils/math/math2html.py | close | edupyter/EDUPYTER | 2 | python | def close(self, container):
if (not self.checktag(container)):
return
close = (('</' + self.tag.split()[0]) + '>')
if self.breaklines:
return (('\n' + close) + '\n')
return close | def close(self, container):
if (not self.checktag(container)):
return
close = (('</' + self.tag.split()[0]) + '>')
if self.breaklines:
return (('\n' + close) + '\n')
return close<|docstring|>Get closing line.<|endoftext|> |
3e37587ea6be66cf639cad0b693c754eb330262084196b45ff255f2f6c2214c5 | def selfclosing(self, container):
'Get self-closing line.'
if (not self.checktag(container)):
return ''
selfclosing = (('<' + self.tag) + '/>')
if self.breaklines:
return (selfclosing + '\n')
return selfclosing | Get self-closing line. | Lib/site-packages/docutils/utils/math/math2html.py | selfclosing | edupyter/EDUPYTER | 2 | python | def selfclosing(self, container):
if (not self.checktag(container)):
return
selfclosing = (('<' + self.tag) + '/>')
if self.breaklines:
return (selfclosing + '\n')
return selfclosing | def selfclosing(self, container):
if (not self.checktag(container)):
return
selfclosing = (('<' + self.tag) + '/>')
if self.breaklines:
return (selfclosing + '\n')
return selfclosing<|docstring|>Get self-closing line.<|endoftext|> |
616ed6ab041bc0b1098a20d8ca275b69b2f9243f7b138a7685ed5798db3c899b | def checktag(self, container):
'Check that the tag is valid.'
if (not self.tag):
Trace.error(('No tag in ' + unicode(container)))
return False
if (self.tag == ''):
return False
return True | Check that the tag is valid. | Lib/site-packages/docutils/utils/math/math2html.py | checktag | edupyter/EDUPYTER | 2 | python | def checktag(self, container):
if (not self.tag):
Trace.error(('No tag in ' + unicode(container)))
return False
if (self.tag == ):
return False
return True | def checktag(self, container):
if (not self.tag):
Trace.error(('No tag in ' + unicode(container)))
return False
if (self.tag == ):
return False
return True<|docstring|>Check that the tag is valid.<|endoftext|> |
73674f33bee10af2ec0a0fb09c9c3dfef1cc94a0a85479b2de2cf619333e3a6c | def __init__(self):
'Initialize the filters.'
self.filters = [] | Initialize the filters. | Lib/site-packages/docutils/utils/math/math2html.py | __init__ | edupyter/EDUPYTER | 2 | python | def __init__(self):
self.filters = [] | def __init__(self):
self.filters = []<|docstring|>Initialize the filters.<|endoftext|> |
ade16b5f1850b8ad11b6f1afa7ea865123806693b89e3d3b7b4a512491006fca | def addfilter(self, original, replacement):
'Add a new filter: replace the original by the replacement.'
self.filters.append((original, replacement)) | Add a new filter: replace the original by the replacement. | Lib/site-packages/docutils/utils/math/math2html.py | addfilter | edupyter/EDUPYTER | 2 | python | def addfilter(self, original, replacement):
self.filters.append((original, replacement)) | def addfilter(self, original, replacement):
self.filters.append((original, replacement))<|docstring|>Add a new filter: replace the original by the replacement.<|endoftext|> |
985879958553b83cf188c1faf7aeea2522d949e1454298167b882bdfcf335651 | def gethtml(self, container):
'Return the HTML code'
result = []
html = ContentsOutput.gethtml(self, container)
for line in html:
result.append(self.filter(line))
return result | Return the HTML code | Lib/site-packages/docutils/utils/math/math2html.py | gethtml | edupyter/EDUPYTER | 2 | python | def gethtml(self, container):
result = []
html = ContentsOutput.gethtml(self, container)
for line in html:
result.append(self.filter(line))
return result | def gethtml(self, container):
result = []
html = ContentsOutput.gethtml(self, container)
for line in html:
result.append(self.filter(line))
return result<|docstring|>Return the HTML code<|endoftext|> |
68a1fb804d24335df6e7604fffd55d94b421e911e41118eafe58e3f2343a83ca | def filter(self, line):
'Filter a single line with all available filters.'
for (original, replacement) in self.filters:
if (original in line):
line = line.replace(original, replacement)
return line | Filter a single line with all available filters. | Lib/site-packages/docutils/utils/math/math2html.py | filter | edupyter/EDUPYTER | 2 | python | def filter(self, line):
for (original, replacement) in self.filters:
if (original in line):
line = line.replace(original, replacement)
return line | def filter(self, line):
for (original, replacement) in self.filters:
if (original in line):
line = line.replace(original, replacement)
return line<|docstring|>Filter a single line with all available filters.<|endoftext|> |
4d5cd95f04a8b721e30b3c75721391ee6b7cb742a0514a0bcc97f7be5f42b1f7 | def gethtml(self, container):
'Return a bare string'
return [container.string] | Return a bare string | Lib/site-packages/docutils/utils/math/math2html.py | gethtml | edupyter/EDUPYTER | 2 | python | def gethtml(self, container):
return [container.string] | def gethtml(self, container):
return [container.string]<|docstring|>Return a bare string<|endoftext|> |
d49a5a9562483cd7771f9daaedbd2e3971d9271c528b7cfc62be3e875e700737 | def checkbytemark(self):
'Check for a Unicode byte mark and skip it.'
if self.finished():
return
if (ord(self.current()) == 65279):
self.skipcurrent() | Check for a Unicode byte mark and skip it. | Lib/site-packages/docutils/utils/math/math2html.py | checkbytemark | edupyter/EDUPYTER | 2 | python | def checkbytemark(self):
if self.finished():
return
if (ord(self.current()) == 65279):
self.skipcurrent() | def checkbytemark(self):
if self.finished():
return
if (ord(self.current()) == 65279):
self.skipcurrent()<|docstring|>Check for a Unicode byte mark and skip it.<|endoftext|> |
785ccb1db8fcb617cd04aedc159597e7fa94045e8eb63180699ffeab6b39e66d | def isout(self):
'Find out if we are out of the position yet.'
Trace.error('Unimplemented isout()')
return True | Find out if we are out of the position yet. | Lib/site-packages/docutils/utils/math/math2html.py | isout | edupyter/EDUPYTER | 2 | python | def isout(self):
Trace.error('Unimplemented isout()')
return True | def isout(self):
Trace.error('Unimplemented isout()')
return True<|docstring|>Find out if we are out of the position yet.<|endoftext|> |
55335748d14b0d92d40e0f7ec7883a4908f1ca4344928caaf862b19afddfee5b | def current(self):
'Return the current character.'
Trace.error('Unimplemented current()')
return '' | Return the current character. | Lib/site-packages/docutils/utils/math/math2html.py | current | edupyter/EDUPYTER | 2 | python | def current(self):
Trace.error('Unimplemented current()')
return | def current(self):
Trace.error('Unimplemented current()')
return <|docstring|>Return the current character.<|endoftext|> |
d79199237d13228bbb95779338bb80692a8ac7059adf353b32977bc0df6e0ef3 | def checkfor(self, string):
'Check for the given string in the current position.'
Trace.error('Unimplemented checkfor()')
return False | Check for the given string in the current position. | Lib/site-packages/docutils/utils/math/math2html.py | checkfor | edupyter/EDUPYTER | 2 | python | def checkfor(self, string):
Trace.error('Unimplemented checkfor()')
return False | def checkfor(self, string):
Trace.error('Unimplemented checkfor()')
return False<|docstring|>Check for the given string in the current position.<|endoftext|> |
2c16214fa64ad1860c2047c5eaaec99b85b0016ea437b7b9fc438bf1da9339f9 | def finished(self):
'Find out if the current text has finished.'
if self.isout():
if (not self.leavepending):
self.endinglist.checkpending()
return True
return self.endinglist.checkin(self) | Find out if the current text has finished. | Lib/site-packages/docutils/utils/math/math2html.py | finished | edupyter/EDUPYTER | 2 | python | def finished(self):
if self.isout():
if (not self.leavepending):
self.endinglist.checkpending()
return True
return self.endinglist.checkin(self) | def finished(self):
if self.isout():
if (not self.leavepending):
self.endinglist.checkpending()
return True
return self.endinglist.checkin(self)<|docstring|>Find out if the current text has finished.<|endoftext|> |
1b8152b030e597e5c78d313840d2bbccf2fe2585577f59a3f49efe5fd7e7d166 | def skipcurrent(self):
'Return the current character and skip it.'
Trace.error('Unimplemented skipcurrent()')
return '' | Return the current character and skip it. | Lib/site-packages/docutils/utils/math/math2html.py | skipcurrent | edupyter/EDUPYTER | 2 | python | def skipcurrent(self):
Trace.error('Unimplemented skipcurrent()')
return | def skipcurrent(self):
Trace.error('Unimplemented skipcurrent()')
return <|docstring|>Return the current character and skip it.<|endoftext|> |
661b3f8dab097a1f6f2b5f1154e2af7042f6523e3ea02a59dd3621341c68dd44 | def glob(self, currentcheck):
'Glob a bit of text that satisfies a check on the current char.'
glob = ''
while ((not self.finished()) and currentcheck()):
glob += self.skipcurrent()
return glob | Glob a bit of text that satisfies a check on the current char. | Lib/site-packages/docutils/utils/math/math2html.py | glob | edupyter/EDUPYTER | 2 | python | def glob(self, currentcheck):
glob =
while ((not self.finished()) and currentcheck()):
glob += self.skipcurrent()
return glob | def glob(self, currentcheck):
glob =
while ((not self.finished()) and currentcheck()):
glob += self.skipcurrent()
return glob<|docstring|>Glob a bit of text that satisfies a check on the current char.<|endoftext|> |
c63c97cba1b56d7fe4b817a25091c4ca4199068cc4ff34c1c8d9a349e1ceed57 | def globalpha(self):
'Glob a bit of alpha text'
return self.glob((lambda : self.current().isalpha())) | Glob a bit of alpha text | Lib/site-packages/docutils/utils/math/math2html.py | globalpha | edupyter/EDUPYTER | 2 | python | def globalpha(self):
return self.glob((lambda : self.current().isalpha())) | def globalpha(self):
return self.glob((lambda : self.current().isalpha()))<|docstring|>Glob a bit of alpha text<|endoftext|> |
2a84f89c5a05c8191a1632f3da92e2dfe784c835f5ae06da3c7fa2f3db75fcac | def globnumber(self):
'Glob a row of digits.'
return self.glob((lambda : self.current().isdigit())) | Glob a row of digits. | Lib/site-packages/docutils/utils/math/math2html.py | globnumber | edupyter/EDUPYTER | 2 | python | def globnumber(self):
return self.glob((lambda : self.current().isdigit())) | def globnumber(self):
return self.glob((lambda : self.current().isdigit()))<|docstring|>Glob a row of digits.<|endoftext|> |
260e3eb0af491a86746cedac55905283e34a381a74be2a021b2bb60de0257ac1 | def isidentifier(self):
'Return if the current character is alphanumeric or _.'
if (self.current().isalnum() or (self.current() == '_')):
return True
return False | Return if the current character is alphanumeric or _. | Lib/site-packages/docutils/utils/math/math2html.py | isidentifier | edupyter/EDUPYTER | 2 | python | def isidentifier(self):
if (self.current().isalnum() or (self.current() == '_')):
return True
return False | def isidentifier(self):
if (self.current().isalnum() or (self.current() == '_')):
return True
return False<|docstring|>Return if the current character is alphanumeric or _.<|endoftext|> |
f5b0b6595b55dc4e0932a63168646cfd28ff2f233312233ab2832fedac53d601 | def globidentifier(self):
'Glob alphanumeric and _ symbols.'
return self.glob(self.isidentifier) | Glob alphanumeric and _ symbols. | Lib/site-packages/docutils/utils/math/math2html.py | globidentifier | edupyter/EDUPYTER | 2 | python | def globidentifier(self):
return self.glob(self.isidentifier) | def globidentifier(self):
return self.glob(self.isidentifier)<|docstring|>Glob alphanumeric and _ symbols.<|endoftext|> |
dfa24a2b1254de0ec37d3f29d030d2c1f0ce66931f8d90ae5d69f4ce6c9d5cb3 | def isvalue(self):
'Return if the current character is a value character:'
'not a bracket or a space.'
if self.current().isspace():
return False
if (self.current() in '{}()'):
return False
return True | Return if the current character is a value character: | Lib/site-packages/docutils/utils/math/math2html.py | isvalue | edupyter/EDUPYTER | 2 | python | def isvalue(self):
'not a bracket or a space.'
if self.current().isspace():
return False
if (self.current() in '{}()'):
return False
return True | def isvalue(self):
'not a bracket or a space.'
if self.current().isspace():
return False
if (self.current() in '{}()'):
return False
return True<|docstring|>Return if the current character is a value character:<|endoftext|> |
f86e0a6dd67b9686ae945ea828dc8050b7eacbaa43f6ce9abf6be87dfe2b3fab | def globvalue(self):
'Glob a value: any symbols but brackets.'
return self.glob(self.isvalue) | Glob a value: any symbols but brackets. | Lib/site-packages/docutils/utils/math/math2html.py | globvalue | edupyter/EDUPYTER | 2 | python | def globvalue(self):
return self.glob(self.isvalue) | def globvalue(self):
return self.glob(self.isvalue)<|docstring|>Glob a value: any symbols but brackets.<|endoftext|> |
034efc0e498601619ed003f5c9193b946c509854ae731e557c30deaba522c073 | def skipspace(self):
'Skip all whitespace at current position.'
return self.glob((lambda : self.current().isspace())) | Skip all whitespace at current position. | Lib/site-packages/docutils/utils/math/math2html.py | skipspace | edupyter/EDUPYTER | 2 | python | def skipspace(self):
return self.glob((lambda : self.current().isspace())) | def skipspace(self):
return self.glob((lambda : self.current().isspace()))<|docstring|>Skip all whitespace at current position.<|endoftext|> |
7543b6a43a7c960e1f859d74909d7cfb6b868b3ced0f718e1539dadb0edf5ec0 | def globincluding(self, magicchar):
'Glob a bit of text up to (including) the magic char.'
glob = (self.glob((lambda : (self.current() != magicchar))) + magicchar)
self.skip(magicchar)
return glob | Glob a bit of text up to (including) the magic char. | Lib/site-packages/docutils/utils/math/math2html.py | globincluding | edupyter/EDUPYTER | 2 | python | def globincluding(self, magicchar):
glob = (self.glob((lambda : (self.current() != magicchar))) + magicchar)
self.skip(magicchar)
return glob | def globincluding(self, magicchar):
glob = (self.glob((lambda : (self.current() != magicchar))) + magicchar)
self.skip(magicchar)
return glob<|docstring|>Glob a bit of text up to (including) the magic char.<|endoftext|> |
fcf42ac5a32ab7171d38e2a1bfc78286e58e95c282e46d96292463347af1e81a | def globexcluding(self, excluded):
'Glob a bit of text up until (excluding) any excluded character.'
return self.glob((lambda : (self.current() not in excluded))) | Glob a bit of text up until (excluding) any excluded character. | Lib/site-packages/docutils/utils/math/math2html.py | globexcluding | edupyter/EDUPYTER | 2 | python | def globexcluding(self, excluded):
return self.glob((lambda : (self.current() not in excluded))) | def globexcluding(self, excluded):
return self.glob((lambda : (self.current() not in excluded)))<|docstring|>Glob a bit of text up until (excluding) any excluded character.<|endoftext|> |
c4aca7ac553675d628eebdd0b8dcaf2af63d6464379704cd8040ada25b0d239a | def pushending(self, ending, optional=False):
'Push a new ending to the bottom'
self.endinglist.add(ending, optional) | Push a new ending to the bottom | Lib/site-packages/docutils/utils/math/math2html.py | pushending | edupyter/EDUPYTER | 2 | python | def pushending(self, ending, optional=False):
self.endinglist.add(ending, optional) | def pushending(self, ending, optional=False):
self.endinglist.add(ending, optional)<|docstring|>Push a new ending to the bottom<|endoftext|> |
014fab25f6629df3032f0a266d3dbbf686459779888f04de4c61ef4adc55d15a | def popending(self, expected=None):
'Pop the ending found at the current position'
if (self.isout() and self.leavepending):
return expected
ending = self.endinglist.pop(self)
if (expected and (expected != ending)):
Trace.error(((('Expected ending ' + expected) + ', got ') + ending))
self.skip(ending)
return ending | Pop the ending found at the current position | Lib/site-packages/docutils/utils/math/math2html.py | popending | edupyter/EDUPYTER | 2 | python | def popending(self, expected=None):
if (self.isout() and self.leavepending):
return expected
ending = self.endinglist.pop(self)
if (expected and (expected != ending)):
Trace.error(((('Expected ending ' + expected) + ', got ') + ending))
self.skip(ending)
return ending | def popending(self, expected=None):
if (self.isout() and self.leavepending):
return expected
ending = self.endinglist.pop(self)
if (expected and (expected != ending)):
Trace.error(((('Expected ending ' + expected) + ', got ') + ending))
self.skip(ending)
return ending<|docstring|>Pop the ending found at the current position<|endoftext|> |
b1a1c8054ace204d113e27b5a7e000b67a174565380ad0c506d811b5d6b1381e | def nextending(self):
'Return the next ending in the queue.'
nextending = self.endinglist.findending(self)
if (not nextending):
return None
return nextending.ending | Return the next ending in the queue. | Lib/site-packages/docutils/utils/math/math2html.py | nextending | edupyter/EDUPYTER | 2 | python | def nextending(self):
nextending = self.endinglist.findending(self)
if (not nextending):
return None
return nextending.ending | def nextending(self):
nextending = self.endinglist.findending(self)
if (not nextending):
return None
return nextending.ending<|docstring|>Return the next ending in the queue.<|endoftext|> |
86f5de63c1a6b79d7d3d39161cb23f5f279fb1b95ad695cec6d38b0bf39f9e59 | def add(self, ending, optional=False):
'Add a new ending to the list'
self.endings.append(PositionEnding(ending, optional)) | Add a new ending to the list | Lib/site-packages/docutils/utils/math/math2html.py | add | edupyter/EDUPYTER | 2 | python | def add(self, ending, optional=False):
self.endings.append(PositionEnding(ending, optional)) | def add(self, ending, optional=False):
self.endings.append(PositionEnding(ending, optional))<|docstring|>Add a new ending to the list<|endoftext|> |
193b507bef68f0541d2f4b2e989b291237933b1404faa414d4f625048c2931a5 | def pickpending(self, pos):
'Pick any pending endings from a parse position.'
self.endings += pos.endinglist.endings | Pick any pending endings from a parse position. | Lib/site-packages/docutils/utils/math/math2html.py | pickpending | edupyter/EDUPYTER | 2 | python | def pickpending(self, pos):
self.endings += pos.endinglist.endings | def pickpending(self, pos):
self.endings += pos.endinglist.endings<|docstring|>Pick any pending endings from a parse position.<|endoftext|> |
c81c9ac327d9f0a2ad9a4bfafaa2364a7c3d17c3e904f3ba83c5f39b6bad5682 | def checkin(self, pos):
'Search for an ending'
if self.findending(pos):
return True
return False | Search for an ending | Lib/site-packages/docutils/utils/math/math2html.py | checkin | edupyter/EDUPYTER | 2 | python | def checkin(self, pos):
if self.findending(pos):
return True
return False | def checkin(self, pos):
if self.findending(pos):
return True
return False<|docstring|>Search for an ending<|endoftext|> |
743f1a6023e455604564fcaded840d39ba3f286bd3702bbe9c08e36b37147329 | def pop(self, pos):
'Remove the ending at the current position'
if pos.isout():
Trace.error('No ending out of bounds')
return ''
ending = self.findending(pos)
if (not ending):
Trace.error(('No ending at ' + pos.current()))
return ''
for each in reversed(self.endings):
self.endings.remove(each)
if (each == ending):
return each.ending
elif (not each.optional):
Trace.error(('Removed non-optional ending ' + each))
Trace.error('No endings left')
return '' | Remove the ending at the current position | Lib/site-packages/docutils/utils/math/math2html.py | pop | edupyter/EDUPYTER | 2 | python | def pop(self, pos):
if pos.isout():
Trace.error('No ending out of bounds')
return
ending = self.findending(pos)
if (not ending):
Trace.error(('No ending at ' + pos.current()))
return
for each in reversed(self.endings):
self.endings.remove(each)
if (each == ending):
return each.ending
elif (not each.optional):
Trace.error(('Removed non-optional ending ' + each))
Trace.error('No endings left')
return | def pop(self, pos):
if pos.isout():
Trace.error('No ending out of bounds')
return
ending = self.findending(pos)
if (not ending):
Trace.error(('No ending at ' + pos.current()))
return
for each in reversed(self.endings):
self.endings.remove(each)
if (each == ending):
return each.ending
elif (not each.optional):
Trace.error(('Removed non-optional ending ' + each))
Trace.error('No endings left')
return <|docstring|>Remove the ending at the current position<|endoftext|> |
4a72632e98a2f3b90c5d2b8821618492c86aa8550e0a882742f80559519eb747 | def findending(self, pos):
'Find the ending at the current position'
if (len(self.endings) == 0):
return None
for (index, ending) in enumerate(reversed(self.endings)):
if ending.checkin(pos):
return ending
if (not ending.optional):
return None
return None | Find the ending at the current position | Lib/site-packages/docutils/utils/math/math2html.py | findending | edupyter/EDUPYTER | 2 | python | def findending(self, pos):
if (len(self.endings) == 0):
return None
for (index, ending) in enumerate(reversed(self.endings)):
if ending.checkin(pos):
return ending
if (not ending.optional):
return None
return None | def findending(self, pos):
if (len(self.endings) == 0):
return None
for (index, ending) in enumerate(reversed(self.endings)):
if ending.checkin(pos):
return ending
if (not ending.optional):
return None
return None<|docstring|>Find the ending at the current position<|endoftext|> |
263b8e1a00e1d7e794581c5caee145d7f2f7f34e4bffd6266cc5151c5185d65b | def checkpending(self):
'Check if there are any pending endings'
if (len(self.endings) != 0):
Trace.error((('Pending ' + unicode(self)) + ' left open')) | Check if there are any pending endings | Lib/site-packages/docutils/utils/math/math2html.py | checkpending | edupyter/EDUPYTER | 2 | python | def checkpending(self):
if (len(self.endings) != 0):
Trace.error((('Pending ' + unicode(self)) + ' left open')) | def checkpending(self):
if (len(self.endings) != 0):
Trace.error((('Pending ' + unicode(self)) + ' left open'))<|docstring|>Check if there are any pending endings<|endoftext|> |
4fd38f90417a437bc97d38d83ec056ad03b8d973f38ae584f80cd742f632d32e | def __unicode__(self):
'Printable representation'
string = 'endings ['
for ending in self.endings:
string += (unicode(ending) + ',')
if (len(self.endings) > 0):
string = string[:(- 1)]
return (string + ']') | Printable representation | Lib/site-packages/docutils/utils/math/math2html.py | __unicode__ | edupyter/EDUPYTER | 2 | python | def __unicode__(self):
string = 'endings ['
for ending in self.endings:
string += (unicode(ending) + ',')
if (len(self.endings) > 0):
string = string[:(- 1)]
return (string + ']') | def __unicode__(self):
string = 'endings ['
for ending in self.endings:
string += (unicode(ending) + ',')
if (len(self.endings) > 0):
string = string[:(- 1)]
return (string + ']')<|docstring|>Printable representation<|endoftext|> |
e2fe03bb353dc4129db916e91dd91a1b1550b4382cdeb40eddafcac51d49cfa3 | def checkin(self, pos):
'Check for the ending'
return pos.checkfor(self.ending) | Check for the ending | Lib/site-packages/docutils/utils/math/math2html.py | checkin | edupyter/EDUPYTER | 2 | python | def checkin(self, pos):
return pos.checkfor(self.ending) | def checkin(self, pos):
return pos.checkfor(self.ending)<|docstring|>Check for the ending<|endoftext|> |
77bc294dab9d3bcb9c2ec5002904ffa286b1a598ac115a1b6177fbf5e7731dd6 | def __unicode__(self):
'Printable representation'
string = ('Ending ' + self.ending)
if self.optional:
string += ' (optional)'
return string | Printable representation | Lib/site-packages/docutils/utils/math/math2html.py | __unicode__ | edupyter/EDUPYTER | 2 | python | def __unicode__(self):
string = ('Ending ' + self.ending)
if self.optional:
string += ' (optional)'
return string | def __unicode__(self):
string = ('Ending ' + self.ending)
if self.optional:
string += ' (optional)'
return string<|docstring|>Printable representation<|endoftext|> |
310187927630b5963131ff6304955ba13b7ab7d50da898d2679386e8009228a0 | def skip(self, string):
'Skip a string'
Trace.error('Unimplemented skip()') | Skip a string | Lib/site-packages/docutils/utils/math/math2html.py | skip | edupyter/EDUPYTER | 2 | python | def skip(self, string):
Trace.error('Unimplemented skip()') | def skip(self, string):
Trace.error('Unimplemented skip()')<|docstring|>Skip a string<|endoftext|> |
730c30177570946c5f1eec5da04f5403f5d603755865a3e33515bd9c8c47481c | def identifier(self):
'Return an identifier for the current position.'
Trace.error('Unimplemented identifier()')
return 'Error' | Return an identifier for the current position. | Lib/site-packages/docutils/utils/math/math2html.py | identifier | edupyter/EDUPYTER | 2 | python | def identifier(self):
Trace.error('Unimplemented identifier()')
return 'Error' | def identifier(self):
Trace.error('Unimplemented identifier()')
return 'Error'<|docstring|>Return an identifier for the current position.<|endoftext|> |
9cf8bf29c105c566c18c260714107d8e2fb0e2ef377c92b5470d3cd1dca2fe8c | def extract(self, length):
'Extract the next string of the given length, or None if not enough text,'
'without advancing the parse position.'
Trace.error('Unimplemented extract()')
return None | Extract the next string of the given length, or None if not enough text, | Lib/site-packages/docutils/utils/math/math2html.py | extract | edupyter/EDUPYTER | 2 | python | def extract(self, length):
'without advancing the parse position.'
Trace.error('Unimplemented extract()')
return None | def extract(self, length):
'without advancing the parse position.'
Trace.error('Unimplemented extract()')
return None<|docstring|>Extract the next string of the given length, or None if not enough text,<|endoftext|> |
716b21952b2b8b74ed7d5ea46c921ebf16dccc1a404a7232c30623c1158717e0 | def checkfor(self, string):
'Check for a string at the given position.'
return (string == self.extract(len(string))) | Check for a string at the given position. | Lib/site-packages/docutils/utils/math/math2html.py | checkfor | edupyter/EDUPYTER | 2 | python | def checkfor(self, string):
return (string == self.extract(len(string))) | def checkfor(self, string):
return (string == self.extract(len(string)))<|docstring|>Check for a string at the given position.<|endoftext|> |
64c0d18433e2f8cddfa2adbf53fcd86e755bf1f35581892804f761af578bf1de | def checkforlower(self, string):
'Check for a string in lower case.'
extracted = self.extract(len(string))
if (not extracted):
return False
return (string.lower() == self.extract(len(string)).lower()) | Check for a string in lower case. | Lib/site-packages/docutils/utils/math/math2html.py | checkforlower | edupyter/EDUPYTER | 2 | python | def checkforlower(self, string):
extracted = self.extract(len(string))
if (not extracted):
return False
return (string.lower() == self.extract(len(string)).lower()) | def checkforlower(self, string):
extracted = self.extract(len(string))
if (not extracted):
return False
return (string.lower() == self.extract(len(string)).lower())<|docstring|>Check for a string in lower case.<|endoftext|> |
f132f811b6916fb837080865e25031f7597795e2bf50874b2371fdaf5a7ae3b9 | def skipcurrent(self):
'Return the current character and skip it.'
current = self.current()
self.skip(current)
return current | Return the current character and skip it. | Lib/site-packages/docutils/utils/math/math2html.py | skipcurrent | edupyter/EDUPYTER | 2 | python | def skipcurrent(self):
current = self.current()
self.skip(current)
return current | def skipcurrent(self):
current = self.current()
self.skip(current)
return current<|docstring|>Return the current character and skip it.<|endoftext|> |
88c50da117ce765e0209f9d54149f2cdaab9150825d3d32bb5c1a007808a2143 | def __next__(self):
'Advance the position and return the next character.'
self.skipcurrent()
return self.current() | Advance the position and return the next character. | Lib/site-packages/docutils/utils/math/math2html.py | __next__ | edupyter/EDUPYTER | 2 | python | def __next__(self):
self.skipcurrent()
return self.current() | def __next__(self):
self.skipcurrent()
return self.current()<|docstring|>Advance the position and return the next character.<|endoftext|> |
c6887dcac3056bc1a82d64cd323976246e16d681425c092c98bdd1743b563fa2 | def checkskip(self, string):
'Check for a string at the given position; if there, skip it'
if (not self.checkfor(string)):
return False
self.skip(string)
return True | Check for a string at the given position; if there, skip it | Lib/site-packages/docutils/utils/math/math2html.py | checkskip | edupyter/EDUPYTER | 2 | python | def checkskip(self, string):
if (not self.checkfor(string)):
return False
self.skip(string)
return True | def checkskip(self, string):
if (not self.checkfor(string)):
return False
self.skip(string)
return True<|docstring|>Check for a string at the given position; if there, skip it<|endoftext|> |
d4d0abbc0e25fa47199cb1dd69f8ee198d6153556356972b2bfa709295559db1 | def error(self, message):
'Show an error message and the position identifier.'
Trace.error(((message + ': ') + self.identifier())) | Show an error message and the position identifier. | Lib/site-packages/docutils/utils/math/math2html.py | error | edupyter/EDUPYTER | 2 | python | def error(self, message):
Trace.error(((message + ': ') + self.identifier())) | def error(self, message):
Trace.error(((message + ': ') + self.identifier()))<|docstring|>Show an error message and the position identifier.<|endoftext|> |
9b39f661e39e0d93f4aa34ac05bf2c0d56e76cfb486cdb89bf9ac78373944f38 | def __init__(self, text):
'Create the position from some text.'
Position.__init__(self)
self.pos = 0
self.text = text
self.checkbytemark() | Create the position from some text. | Lib/site-packages/docutils/utils/math/math2html.py | __init__ | edupyter/EDUPYTER | 2 | python | def __init__(self, text):
Position.__init__(self)
self.pos = 0
self.text = text
self.checkbytemark() | def __init__(self, text):
Position.__init__(self)
self.pos = 0
self.text = text
self.checkbytemark()<|docstring|>Create the position from some text.<|endoftext|> |
7c31a3fbefc45789e6e5a54797920f721eb28e72e88ccd7b4298760a814a4299 | def skip(self, string):
'Skip a string of characters.'
self.pos += len(string) | Skip a string of characters. | Lib/site-packages/docutils/utils/math/math2html.py | skip | edupyter/EDUPYTER | 2 | python | def skip(self, string):
self.pos += len(string) | def skip(self, string):
self.pos += len(string)<|docstring|>Skip a string of characters.<|endoftext|> |
016ec1ab443576b4f39906f8bb16db6f5003d2b8bf29dd7f0d832da24e7cee7e | def identifier(self):
'Return a sample of the remaining text.'
length = 30
if ((self.pos + length) > len(self.text)):
length = (len(self.text) - self.pos)
return (('*' + self.text[self.pos:(self.pos + length)]) + '*') | Return a sample of the remaining text. | Lib/site-packages/docutils/utils/math/math2html.py | identifier | edupyter/EDUPYTER | 2 | python | def identifier(self):
length = 30
if ((self.pos + length) > len(self.text)):
length = (len(self.text) - self.pos)
return (('*' + self.text[self.pos:(self.pos + length)]) + '*') | def identifier(self):
length = 30
if ((self.pos + length) > len(self.text)):
length = (len(self.text) - self.pos)
return (('*' + self.text[self.pos:(self.pos + length)]) + '*')<|docstring|>Return a sample of the remaining text.<|endoftext|> |
3117bb8ec06b19dc844dd8098a15cc7b4c71160d6a1f0d56616f3973443892dc | def isout(self):
'Find out if we are out of the text yet.'
return (self.pos >= len(self.text)) | Find out if we are out of the text yet. | Lib/site-packages/docutils/utils/math/math2html.py | isout | edupyter/EDUPYTER | 2 | python | def isout(self):
return (self.pos >= len(self.text)) | def isout(self):
return (self.pos >= len(self.text))<|docstring|>Find out if we are out of the text yet.<|endoftext|> |
7804f9e29aade8764f07f69d4f3687434b182626a162e43756b08547573daa6a | def current(self):
'Return the current character, assuming we are not out.'
return self.text[self.pos] | Return the current character, assuming we are not out. | Lib/site-packages/docutils/utils/math/math2html.py | current | edupyter/EDUPYTER | 2 | python | def current(self):
return self.text[self.pos] | def current(self):
return self.text[self.pos]<|docstring|>Return the current character, assuming we are not out.<|endoftext|> |
a2635be8c2636fb4110c30e0489fdf74627c19b03d29ea22f156d97d96cbf20d | def extract(self, length):
'Extract the next string of the given length, or None if not enough text.'
if ((self.pos + length) > len(self.text)):
return None
return self.text[self.pos:(self.pos + length)] | Extract the next string of the given length, or None if not enough text. | Lib/site-packages/docutils/utils/math/math2html.py | extract | edupyter/EDUPYTER | 2 | python | def extract(self, length):
if ((self.pos + length) > len(self.text)):
return None
return self.text[self.pos:(self.pos + length)] | def extract(self, length):
if ((self.pos + length) > len(self.text)):
return None
return self.text[self.pos:(self.pos + length)]<|docstring|>Extract the next string of the given length, or None if not enough text.<|endoftext|> |
5bee7a87af4c469c1f7af4fc6dcf613152397049edb9c5903e99b66b70e86327 | def process(self):
'Process contents'
pass | Process contents | Lib/site-packages/docutils/utils/math/math2html.py | process | edupyter/EDUPYTER | 2 | python | def process(self):
pass | def process(self):
pass<|docstring|>Process contents<|endoftext|> |
88a6d2bac06fe2edf934091ff5d86b47ce3e6bfbe287b1ff1cedd63ba8d5018a | def gethtml(self):
'Get the resulting HTML'
html = self.output.gethtml(self)
if isinstance(html, basestring):
Trace.error(('Raw string ' + html))
html = [html]
return html | Get the resulting HTML | Lib/site-packages/docutils/utils/math/math2html.py | gethtml | edupyter/EDUPYTER | 2 | python | def gethtml(self):
html = self.output.gethtml(self)
if isinstance(html, basestring):
Trace.error(('Raw string ' + html))
html = [html]
return html | def gethtml(self):
html = self.output.gethtml(self)
if isinstance(html, basestring):
Trace.error(('Raw string ' + html))
html = [html]
return html<|docstring|>Get the resulting HTML<|endoftext|> |
3fc5d385107a36679a3723187285482afd5284f0a599ce0a5334bb0dcc6199a3 | def escape(self, line, replacements=EscapeConfig.entities):
'Escape a line with replacements from a map'
pieces = sorted(replacements.keys())
for piece in pieces:
if (piece in line):
line = line.replace(piece, replacements[piece])
return line | Escape a line with replacements from a map | Lib/site-packages/docutils/utils/math/math2html.py | escape | edupyter/EDUPYTER | 2 | python | def escape(self, line, replacements=EscapeConfig.entities):
pieces = sorted(replacements.keys())
for piece in pieces:
if (piece in line):
line = line.replace(piece, replacements[piece])
return line | def escape(self, line, replacements=EscapeConfig.entities):
pieces = sorted(replacements.keys())
for piece in pieces:
if (piece in line):
line = line.replace(piece, replacements[piece])
return line<|docstring|>Escape a line with replacements from a map<|endoftext|> |
dccd5efc3264751627fdacee4c6da0ff0485f71abae00c8460ac3ddc89c66286 | def escapeentities(self, line):
'Escape all Unicode characters to HTML entities.'
result = ''
pos = TextPosition(line)
while (not pos.finished()):
if (ord(pos.current()) > 128):
codepoint = hex(ord(pos.current()))
if (codepoint == '0xd835'):
codepoint = hex((ord(next(pos)) + 63488))
result += (('&#' + codepoint[1:]) + ';')
else:
result += pos.current()
pos.skipcurrent()
return result | Escape all Unicode characters to HTML entities. | Lib/site-packages/docutils/utils/math/math2html.py | escapeentities | edupyter/EDUPYTER | 2 | python | def escapeentities(self, line):
result =
pos = TextPosition(line)
while (not pos.finished()):
if (ord(pos.current()) > 128):
codepoint = hex(ord(pos.current()))
if (codepoint == '0xd835'):
codepoint = hex((ord(next(pos)) + 63488))
result += (('&#' + codepoint[1:]) + ';')
else:
result += pos.current()
pos.skipcurrent()
return result | def escapeentities(self, line):
result =
pos = TextPosition(line)
while (not pos.finished()):
if (ord(pos.current()) > 128):
codepoint = hex(ord(pos.current()))
if (codepoint == '0xd835'):
codepoint = hex((ord(next(pos)) + 63488))
result += (('&#' + codepoint[1:]) + ';')
else:
result += pos.current()
pos.skipcurrent()
return result<|docstring|>Escape all Unicode characters to HTML entities.<|endoftext|> |
9bf2508f34e0ed6926ea8f6f435ca6e64cb889c8f94a8a3f1b3a14bd196260fa | def searchall(self, type):
'Search for all embedded containers of a given type'
list = []
self.searchprocess(type, (lambda container: list.append(container)))
return list | Search for all embedded containers of a given type | Lib/site-packages/docutils/utils/math/math2html.py | searchall | edupyter/EDUPYTER | 2 | python | def searchall(self, type):
list = []
self.searchprocess(type, (lambda container: list.append(container)))
return list | def searchall(self, type):
list = []
self.searchprocess(type, (lambda container: list.append(container)))
return list<|docstring|>Search for all embedded containers of a given type<|endoftext|> |
ef52c25b7fc6adb9473576da5cafa748201f28a75e0fd046d0346ebcdf8942de | def searchremove(self, type):
'Search for all containers of a type and remove them'
list = self.searchall(type)
for container in list:
container.parent.contents.remove(container)
return list | Search for all containers of a type and remove them | Lib/site-packages/docutils/utils/math/math2html.py | searchremove | edupyter/EDUPYTER | 2 | python | def searchremove(self, type):
list = self.searchall(type)
for container in list:
container.parent.contents.remove(container)
return list | def searchremove(self, type):
list = self.searchall(type)
for container in list:
container.parent.contents.remove(container)
return list<|docstring|>Search for all containers of a type and remove them<|endoftext|> |
fd894f7a4374fca29c58a093b16066ec0d3397558587b130052f6524005b548a | def searchprocess(self, type, process):
'Search for elements of a given type and process them'
self.locateprocess((lambda container: isinstance(container, type)), process) | Search for elements of a given type and process them | Lib/site-packages/docutils/utils/math/math2html.py | searchprocess | edupyter/EDUPYTER | 2 | python | def searchprocess(self, type, process):
self.locateprocess((lambda container: isinstance(container, type)), process) | def searchprocess(self, type, process):
self.locateprocess((lambda container: isinstance(container, type)), process)<|docstring|>Search for elements of a given type and process them<|endoftext|> |
39d8a1bf943d0ea3d35746ed026b32f1b22b438a1d062cefc108e687b166c498 | def locateprocess(self, locate, process):
'Search for all embedded containers and process them'
for container in self.contents:
container.locateprocess(locate, process)
if locate(container):
process(container) | Search for all embedded containers and process them | Lib/site-packages/docutils/utils/math/math2html.py | locateprocess | edupyter/EDUPYTER | 2 | python | def locateprocess(self, locate, process):
for container in self.contents:
container.locateprocess(locate, process)
if locate(container):
process(container) | def locateprocess(self, locate, process):
for container in self.contents:
container.locateprocess(locate, process)
if locate(container):
process(container)<|docstring|>Search for all embedded containers and process them<|endoftext|> |
e8cffff0f9677d1c212cf632de31b09c43a0bbb0d1fbd69f5a8ef88312f92755 | def recursivesearch(self, locate, recursive, process):
'Perform a recursive search in the container.'
for container in self.contents:
if recursive(container):
container.recursivesearch(locate, recursive, process)
if locate(container):
process(container) | Perform a recursive search in the container. | Lib/site-packages/docutils/utils/math/math2html.py | recursivesearch | edupyter/EDUPYTER | 2 | python | def recursivesearch(self, locate, recursive, process):
for container in self.contents:
if recursive(container):
container.recursivesearch(locate, recursive, process)
if locate(container):
process(container) | def recursivesearch(self, locate, recursive, process):
for container in self.contents:
if recursive(container):
container.recursivesearch(locate, recursive, process)
if locate(container):
process(container)<|docstring|>Perform a recursive search in the container.<|endoftext|> |
94d1c45106faa94446bd46bd2ef8b3ab9a1d8f978aa0938a5984914f31ad9a73 | def extracttext(self):
'Extract all text from allowed containers.'
result = ''
constants = ContainerExtractor(ContainerConfig.extracttext).extract(self)
return ''.join((constant.string for constant in constants)) | Extract all text from allowed containers. | Lib/site-packages/docutils/utils/math/math2html.py | extracttext | edupyter/EDUPYTER | 2 | python | def extracttext(self):
result =
constants = ContainerExtractor(ContainerConfig.extracttext).extract(self)
return .join((constant.string for constant in constants)) | def extracttext(self):
result =
constants = ContainerExtractor(ContainerConfig.extracttext).extract(self)
return .join((constant.string for constant in constants))<|docstring|>Extract all text from allowed containers.<|endoftext|> |
ec823d4badc460c265c9b370b3ec62903e211459a822a1b98ee390483f7d55e2 | def group(self, index, group, isingroup):
'Group some adjoining elements into a group'
if (index >= len(self.contents)):
return
if hasattr(self.contents[index], 'grouped'):
return
while ((index < len(self.contents)) and isingroup(self.contents[index])):
self.contents[index].grouped = True
group.contents.append(self.contents[index])
self.contents.pop(index)
self.contents.insert(index, group) | Group some adjoining elements into a group | Lib/site-packages/docutils/utils/math/math2html.py | group | edupyter/EDUPYTER | 2 | python | def group(self, index, group, isingroup):
if (index >= len(self.contents)):
return
if hasattr(self.contents[index], 'grouped'):
return
while ((index < len(self.contents)) and isingroup(self.contents[index])):
self.contents[index].grouped = True
group.contents.append(self.contents[index])
self.contents.pop(index)
self.contents.insert(index, group) | def group(self, index, group, isingroup):
if (index >= len(self.contents)):
return
if hasattr(self.contents[index], 'grouped'):
return
while ((index < len(self.contents)) and isingroup(self.contents[index])):
self.contents[index].grouped = True
group.contents.append(self.contents[index])
self.contents.pop(index)
self.contents.insert(index, group)<|docstring|>Group some adjoining elements into a group<|endoftext|> |
749e407d83b6601952a7e0d7fa31e7887a0a34f95dc240b2423dce1fcff892a0 | def remove(self, index):
'Remove a container but leave its contents'
container = self.contents[index]
self.contents.pop(index)
while (len(container.contents) > 0):
self.contents.insert(index, container.contents.pop()) | Remove a container but leave its contents | Lib/site-packages/docutils/utils/math/math2html.py | remove | edupyter/EDUPYTER | 2 | python | def remove(self, index):
container = self.contents[index]
self.contents.pop(index)
while (len(container.contents) > 0):
self.contents.insert(index, container.contents.pop()) | def remove(self, index):
container = self.contents[index]
self.contents.pop(index)
while (len(container.contents) > 0):
self.contents.insert(index, container.contents.pop())<|docstring|>Remove a container but leave its contents<|endoftext|> |
345776b8d8457a972cb3715cabdb10ea4ce921ec0b49ca74849193b9e5242a6a | def tree(self, level=0):
'Show in a tree'
Trace.debug(((' ' * level) + unicode(self)))
for container in self.contents:
container.tree((level + 1)) | Show in a tree | Lib/site-packages/docutils/utils/math/math2html.py | tree | edupyter/EDUPYTER | 2 | python | def tree(self, level=0):
Trace.debug(((' ' * level) + unicode(self)))
for container in self.contents:
container.tree((level + 1)) | def tree(self, level=0):
Trace.debug(((' ' * level) + unicode(self)))
for container in self.contents:
container.tree((level + 1))<|docstring|>Show in a tree<|endoftext|> |
a8889cf202d8e441bf54643b1be0b6492e583b67844701690fa6b8987465a0f4 | def getparameter(self, name):
'Get the value of a parameter, if present.'
if (not (name in self.parameters)):
return None
return self.parameters[name] | Get the value of a parameter, if present. | Lib/site-packages/docutils/utils/math/math2html.py | getparameter | edupyter/EDUPYTER | 2 | python | def getparameter(self, name):
if (not (name in self.parameters)):
return None
return self.parameters[name] | def getparameter(self, name):
if (not (name in self.parameters)):
return None
return self.parameters[name]<|docstring|>Get the value of a parameter, if present.<|endoftext|> |
e1e5d13435cf8d92e0982b6de004a8b1a1562b2671b96f26d3590832a0a82e91 | def getparameterlist(self, name):
'Get the value of a comma-separated parameter as a list.'
paramtext = self.getparameter(name)
if (not paramtext):
return []
return paramtext.split(',') | Get the value of a comma-separated parameter as a list. | Lib/site-packages/docutils/utils/math/math2html.py | getparameterlist | edupyter/EDUPYTER | 2 | python | def getparameterlist(self, name):
paramtext = self.getparameter(name)
if (not paramtext):
return []
return paramtext.split(',') | def getparameterlist(self, name):
paramtext = self.getparameter(name)
if (not paramtext):
return []
return paramtext.split(',')<|docstring|>Get the value of a comma-separated parameter as a list.<|endoftext|> |
90c9b6c259029830263015524e5c2bce77e73d0efe2c1270e7a9c922a56708d3 | def hasemptyoutput(self):
"Check if the parent's output is empty."
current = self.parent
while current:
if current.output.isempty():
return True
current = current.parent
return False | Check if the parent's output is empty. | Lib/site-packages/docutils/utils/math/math2html.py | hasemptyoutput | edupyter/EDUPYTER | 2 | python | def hasemptyoutput(self):
current = self.parent
while current:
if current.output.isempty():
return True
current = current.parent
return False | def hasemptyoutput(self):
current = self.parent
while current:
if current.output.isempty():
return True
current = current.parent
return False<|docstring|>Check if the parent's output is empty.<|endoftext|> |
ab0a560f2bc8a91cab55baa5cd1ac6852341625166c1e7d4274d376b368fc3d9 | def __unicode__(self):
'Get a description'
if (not self.begin):
return self.__class__.__name__
return ((self.__class__.__name__ + '@') + unicode(self.begin)) | Get a description | Lib/site-packages/docutils/utils/math/math2html.py | __unicode__ | edupyter/EDUPYTER | 2 | python | def __unicode__(self):
if (not self.begin):
return self.__class__.__name__
return ((self.__class__.__name__ + '@') + unicode(self.begin)) | def __unicode__(self):
if (not self.begin):
return self.__class__.__name__
return ((self.__class__.__name__ + '@') + unicode(self.begin))<|docstring|>Get a description<|endoftext|> |
7891d3377e14d21c0f547f1d973f43b0ea62b80059d8f25464fc9abc76432343 | def process(self):
'Replace special chars from the contents.'
if self.parsed:
self.string = self.replacespecial(self.parsed)
self.parsed = None | Replace special chars from the contents. | Lib/site-packages/docutils/utils/math/math2html.py | process | edupyter/EDUPYTER | 2 | python | def process(self):
if self.parsed:
self.string = self.replacespecial(self.parsed)
self.parsed = None | def process(self):
if self.parsed:
self.string = self.replacespecial(self.parsed)
self.parsed = None<|docstring|>Replace special chars from the contents.<|endoftext|> |
aa4d102d7cc51dc60d4c0257873484ac2bcf5594d938963b8e95e5fa3f57216e | def replacespecial(self, line):
'Replace all special chars from a line'
replaced = self.escape(line, EscapeConfig.entities)
replaced = self.changeline(replaced)
if ((ContainerConfig.string['startcommand'] in replaced) and (len(replaced) > 1)):
if self.begin:
message = (('Unknown command at ' + unicode(self.begin)) + ': ')
else:
message = 'Unknown command: '
Trace.error((message + replaced.strip()))
return replaced | Replace all special chars from a line | Lib/site-packages/docutils/utils/math/math2html.py | replacespecial | edupyter/EDUPYTER | 2 | python | def replacespecial(self, line):
replaced = self.escape(line, EscapeConfig.entities)
replaced = self.changeline(replaced)
if ((ContainerConfig.string['startcommand'] in replaced) and (len(replaced) > 1)):
if self.begin:
message = (('Unknown command at ' + unicode(self.begin)) + ': ')
else:
message = 'Unknown command: '
Trace.error((message + replaced.strip()))
return replaced | def replacespecial(self, line):
replaced = self.escape(line, EscapeConfig.entities)
replaced = self.changeline(replaced)
if ((ContainerConfig.string['startcommand'] in replaced) and (len(replaced) > 1)):
if self.begin:
message = (('Unknown command at ' + unicode(self.begin)) + ': ')
else:
message = 'Unknown command: '
Trace.error((message + replaced.strip()))
return replaced<|docstring|>Replace all special chars from a line<|endoftext|> |
e54652e42509d643a6a1daed8c7d6959d828eb836590f22ea6378a0ea8f66d28 | def extracttext(self):
'Return all text.'
return self.string | Return all text. | Lib/site-packages/docutils/utils/math/math2html.py | extracttext | edupyter/EDUPYTER | 2 | python | def extracttext(self):
return self.string | def extracttext(self):
return self.string<|docstring|>Return all text.<|endoftext|> |
33c8dc47ab23338b35513aee57ea3ae7af1a3c0cd32a48249ef4cadc450a619e | def __unicode__(self):
'Return a printable representation.'
result = 'StringContainer'
if self.begin:
result += ('@' + unicode(self.begin))
ellipsis = '...'
if (len(self.string.strip()) <= 15):
ellipsis = ''
return ((((result + ' (') + self.string.strip()[:15]) + ellipsis) + ')') | Return a printable representation. | Lib/site-packages/docutils/utils/math/math2html.py | __unicode__ | edupyter/EDUPYTER | 2 | python | def __unicode__(self):
result = 'StringContainer'
if self.begin:
result += ('@' + unicode(self.begin))
ellipsis = '...'
if (len(self.string.strip()) <= 15):
ellipsis =
return ((((result + ' (') + self.string.strip()[:15]) + ellipsis) + ')') | def __unicode__(self):
result = 'StringContainer'
if self.begin:
result += ('@' + unicode(self.begin))
ellipsis = '...'
if (len(self.string.strip()) <= 15):
ellipsis =
return ((((result + ' (') + self.string.strip()[:15]) + ellipsis) + ')')<|docstring|>Return a printable representation.<|endoftext|> |
1f33bb855aa0dc851ccfd4259bef47dc4e6a534f0043395b99b89ef2e5996788 | def parseheader(self, reader):
'See if the formula is inlined'
self.begin = (reader.linenumber + 1)
type = self.parsetype(reader)
if (not type):
reader.nextline()
type = self.parsetype(reader)
if (not type):
Trace.error(('Unknown formula type in ' + reader.currentline().strip()))
return ['unknown']
return [type] | See if the formula is inlined | Lib/site-packages/docutils/utils/math/math2html.py | parseheader | edupyter/EDUPYTER | 2 | python | def parseheader(self, reader):
self.begin = (reader.linenumber + 1)
type = self.parsetype(reader)
if (not type):
reader.nextline()
type = self.parsetype(reader)
if (not type):
Trace.error(('Unknown formula type in ' + reader.currentline().strip()))
return ['unknown']
return [type] | def parseheader(self, reader):
self.begin = (reader.linenumber + 1)
type = self.parsetype(reader)
if (not type):
reader.nextline()
type = self.parsetype(reader)
if (not type):
Trace.error(('Unknown formula type in ' + reader.currentline().strip()))
return ['unknown']
return [type]<|docstring|>See if the formula is inlined<|endoftext|> |
fd03b1b2d5ff0850dbd05d7a08c38d4cc294c8c1842b277f7350e26d82cf62df | def parsetype(self, reader):
'Get the formula type from the first line.'
if (reader.currentline().find(FormulaConfig.starts['simple']) >= 0):
return 'inline'
if (reader.currentline().find(FormulaConfig.starts['complex']) >= 0):
return 'block'
if (reader.currentline().find(FormulaConfig.starts['unnumbered']) >= 0):
return 'block'
if (reader.currentline().find(FormulaConfig.starts['beginbefore']) >= 0):
return 'numbered'
return None | Get the formula type from the first line. | Lib/site-packages/docutils/utils/math/math2html.py | parsetype | edupyter/EDUPYTER | 2 | python | def parsetype(self, reader):
if (reader.currentline().find(FormulaConfig.starts['simple']) >= 0):
return 'inline'
if (reader.currentline().find(FormulaConfig.starts['complex']) >= 0):
return 'block'
if (reader.currentline().find(FormulaConfig.starts['unnumbered']) >= 0):
return 'block'
if (reader.currentline().find(FormulaConfig.starts['beginbefore']) >= 0):
return 'numbered'
return None | def parsetype(self, reader):
if (reader.currentline().find(FormulaConfig.starts['simple']) >= 0):
return 'inline'
if (reader.currentline().find(FormulaConfig.starts['complex']) >= 0):
return 'block'
if (reader.currentline().find(FormulaConfig.starts['unnumbered']) >= 0):
return 'block'
if (reader.currentline().find(FormulaConfig.starts['beginbefore']) >= 0):
return 'numbered'
return None<|docstring|>Get the formula type from the first line.<|endoftext|> |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.