Search is not available for this dataset
identifier stringlengths 1 155 | parameters stringlengths 2 6.09k | docstring stringlengths 11 63.4k | docstring_summary stringlengths 0 63.4k | function stringlengths 29 99.8k | function_tokens list | start_point list | end_point list | language stringclasses 1
value | docstring_language stringlengths 2 7 | docstring_language_predictions stringlengths 18 23 | is_langid_reliable stringclasses 2
values |
|---|---|---|---|---|---|---|---|---|---|---|---|
nullDebugAction | (*args) | Do-nothing' debug action, to suppress debugging output during parsing. | Do-nothing' debug action, to suppress debugging output during parsing. | def nullDebugAction(*args):
"""'Do-nothing' debug action, to suppress debugging output during parsing."""
pass | [
"def",
"nullDebugAction",
"(",
"*",
"args",
")",
":",
"pass"
] | [
1011,
0
] | [
1013,
8
] | python | en | ['en', 'jv', 'en'] | True |
ParseBaseException._from_exception | (cls, pe) |
internal factory method to simplify creating one type of ParseException
from another - avoids having __init__ signature conflicts among subclasses
|
internal factory method to simplify creating one type of ParseException
from another - avoids having __init__ signature conflicts among subclasses
| def _from_exception(cls, pe):
"""
internal factory method to simplify creating one type of ParseException
from another - avoids having __init__ signature conflicts among subclasses
"""
return cls(pe.pstr, pe.loc, pe.msg, pe.parserElement) | [
"def",
"_from_exception",
"(",
"cls",
",",
"pe",
")",
":",
"return",
"cls",
"(",
"pe",
".",
"pstr",
",",
"pe",
".",
"loc",
",",
"pe",
".",
"msg",
",",
"pe",
".",
"parserElement",
")"
] | [
220,
4
] | [
225,
61
] | python | en | ['en', 'ja', 'th'] | False |
ParseBaseException.__getattr__ | ( self, aname ) | supported attributes by name are:
- lineno - returns the line number of the exception text
- col - returns the column number of the exception text
- line - returns the line containing the exception text
| supported attributes by name are:
- lineno - returns the line number of the exception text
- col - returns the column number of the exception text
- line - returns the line containing the exception text
| def __getattr__( self, aname ):
"""supported attributes by name are:
- lineno - returns the line number of the exception text
- col - returns the column number of the exception text
- line - returns the line containing the exception text
"""
if( aname ==... | [
"def",
"__getattr__",
"(",
"self",
",",
"aname",
")",
":",
"if",
"(",
"aname",
"==",
"\"lineno\"",
")",
":",
"return",
"lineno",
"(",
"self",
".",
"loc",
",",
"self",
".",
"pstr",
")",
"elif",
"(",
"aname",
"in",
"(",
"\"col\"",
",",
"\"column\"",
... | [
227,
4
] | [
240,
39
] | python | en | ['en', 'en', 'en'] | True |
ParseBaseException.markInputline | ( self, markerString = ">!<" ) | Extracts the exception line from the input string, and marks
the location of the exception with a special symbol.
| Extracts the exception line from the input string, and marks
the location of the exception with a special symbol.
| def markInputline( self, markerString = ">!<" ):
"""Extracts the exception line from the input string, and marks
the location of the exception with a special symbol.
"""
line_str = self.line
line_column = self.column - 1
if markerString:
line_str = "... | [
"def",
"markInputline",
"(",
"self",
",",
"markerString",
"=",
"\">!<\"",
")",
":",
"line_str",
"=",
"self",
".",
"line",
"line_column",
"=",
"self",
".",
"column",
"-",
"1",
"if",
"markerString",
":",
"line_str",
"=",
"\"\"",
".",
"join",
"(",
"(",
"l... | [
247,
4
] | [
256,
31
] | python | en | ['en', 'en', 'en'] | True |
ParseResults.haskeys | ( self ) | Since keys() returns an iterator, this method is helpful in bypassing
code that looks for the existence of any defined results names. | Since keys() returns an iterator, this method is helpful in bypassing
code that looks for the existence of any defined results names. | def haskeys( self ):
"""Since keys() returns an iterator, this method is helpful in bypassing
code that looks for the existence of any defined results names."""
return bool(self.__tokdict) | [
"def",
"haskeys",
"(",
"self",
")",
":",
"return",
"bool",
"(",
"self",
".",
"__tokdict",
")"
] | [
505,
4
] | [
508,
35
] | python | en | ['en', 'en', 'en'] | True |
ParseResults.pop | ( self, *args, **kwargs) |
Removes and returns item at specified index (default=C{last}).
Supports both C{list} and C{dict} semantics for C{pop()}. If passed no
argument or an integer argument, it will use C{list} semantics
and pop tokens from the list of parsed tokens. If passed a
non-integer argum... |
Removes and returns item at specified index (default=C{last}).
Supports both C{list} and C{dict} semantics for C{pop()}. If passed no
argument or an integer argument, it will use C{list} semantics
and pop tokens from the list of parsed tokens. If passed a
non-integer argum... | def pop( self, *args, **kwargs):
"""
Removes and returns item at specified index (default=C{last}).
Supports both C{list} and C{dict} semantics for C{pop()}. If passed no
argument or an integer argument, it will use C{list} semantics
and pop tokens from the list of parsed to... | [
"def",
"pop",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"args",
":",
"args",
"=",
"[",
"-",
"1",
"]",
"for",
"k",
",",
"v",
"in",
"kwargs",
".",
"items",
"(",
")",
":",
"if",
"k",
"==",
"'default'",
":",... | [
510,
4
] | [
560,
31
] | python | en | ['en', 'ja', 'th'] | False |
ParseResults.get | (self, key, defaultValue=None) |
Returns named result matching the given key, or if there is no
such name, then returns the given C{defaultValue} or C{None} if no
C{defaultValue} is specified.
Similar to C{dict.get()}.
Example::
integer = Word(nums)
date_str = integer(... |
Returns named result matching the given key, or if there is no
such name, then returns the given C{defaultValue} or C{None} if no
C{defaultValue} is specified.
Similar to C{dict.get()}.
Example::
integer = Word(nums)
date_str = integer(... | def get(self, key, defaultValue=None):
"""
Returns named result matching the given key, or if there is no
such name, then returns the given C{defaultValue} or C{None} if no
C{defaultValue} is specified.
Similar to C{dict.get()}.
Example::
in... | [
"def",
"get",
"(",
"self",
",",
"key",
",",
"defaultValue",
"=",
"None",
")",
":",
"if",
"key",
"in",
"self",
":",
"return",
"self",
"[",
"key",
"]",
"else",
":",
"return",
"defaultValue"
] | [
562,
4
] | [
582,
31
] | python | en | ['en', 'ja', 'th'] | False |
ParseResults.insert | ( self, index, insStr ) |
Inserts new element at location index in the list of parsed tokens.
Similar to C{list.insert()}.
Example::
print(OneOrMore(Word(nums)).parseString("0 123 321")) # -> ['0', '123', '321']
# use a parse action to insert the parse location in the front of ... |
Inserts new element at location index in the list of parsed tokens.
Similar to C{list.insert()}.
Example::
print(OneOrMore(Word(nums)).parseString("0 123 321")) # -> ['0', '123', '321']
# use a parse action to insert the parse location in the front of ... | def insert( self, index, insStr ):
"""
Inserts new element at location index in the list of parsed tokens.
Similar to C{list.insert()}.
Example::
print(OneOrMore(Word(nums)).parseString("0 123 321")) # -> ['0', '123', '321']
# use a parse actio... | [
"def",
"insert",
"(",
"self",
",",
"index",
",",
"insStr",
")",
":",
"self",
".",
"__toklist",
".",
"insert",
"(",
"index",
",",
"insStr",
")",
"# fixup indices in token dictionary\r",
"for",
"name",
",",
"occurrences",
"in",
"self",
".",
"__tokdict",
".",
... | [
584,
4
] | [
602,
94
] | python | en | ['en', 'ja', 'th'] | False |
ParseResults.append | ( self, item ) |
Add single element to end of ParseResults list of elements.
Example::
print(OneOrMore(Word(nums)).parseString("0 123 321")) # -> ['0', '123', '321']
# use a parse action to compute the sum of the parsed integers, and add it to the end
def append_... |
Add single element to end of ParseResults list of elements.
Example::
print(OneOrMore(Word(nums)).parseString("0 123 321")) # -> ['0', '123', '321']
# use a parse action to compute the sum of the parsed integers, and add it to the end
def append_... | def append( self, item ):
"""
Add single element to end of ParseResults list of elements.
Example::
print(OneOrMore(Word(nums)).parseString("0 123 321")) # -> ['0', '123', '321']
# use a parse action to compute the sum of the parsed integers, and add ... | [
"def",
"append",
"(",
"self",
",",
"item",
")",
":",
"self",
".",
"__toklist",
".",
"append",
"(",
"item",
")"
] | [
604,
4
] | [
616,
35
] | python | en | ['en', 'ja', 'th'] | False |
ParseResults.extend | ( self, itemseq ) |
Add sequence of elements to end of ParseResults list of elements.
Example::
patt = OneOrMore(Word(alphas))
# use a parse action to append the reverse of the matched strings, to make a palindrome
def make_palindrome(tokens):
token... |
Add sequence of elements to end of ParseResults list of elements.
Example::
patt = OneOrMore(Word(alphas))
# use a parse action to append the reverse of the matched strings, to make a palindrome
def make_palindrome(tokens):
token... | def extend( self, itemseq ):
"""
Add sequence of elements to end of ParseResults list of elements.
Example::
patt = OneOrMore(Word(alphas))
# use a parse action to append the reverse of the matched strings, to make a palindrome
def make_p... | [
"def",
"extend",
"(",
"self",
",",
"itemseq",
")",
":",
"if",
"isinstance",
"(",
"itemseq",
",",
"ParseResults",
")",
":",
"self",
"+=",
"itemseq",
"else",
":",
"self",
".",
"__toklist",
".",
"extend",
"(",
"itemseq",
")"
] | [
618,
4
] | [
634,
42
] | python | en | ['en', 'ja', 'th'] | False |
ParseResults.clear | ( self ) |
Clear all elements and results names.
|
Clear all elements and results names.
| def clear( self ):
"""
Clear all elements and results names.
"""
del self.__toklist[:]
self.__tokdict.clear() | [
"def",
"clear",
"(",
"self",
")",
":",
"del",
"self",
".",
"__toklist",
"[",
":",
"]",
"self",
".",
"__tokdict",
".",
"clear",
"(",
")"
] | [
636,
4
] | [
641,
30
] | python | en | ['en', 'ja', 'th'] | False |
ParseResults.asList | ( self ) |
Returns the parse results as a nested list of matching tokens, all converted to strings.
Example::
patt = OneOrMore(Word(alphas))
result = patt.parseString("sldkj lsdkj sldkj")
# even though the result prints in string-like form, it is actually a pyparsing Par... |
Returns the parse results as a nested list of matching tokens, all converted to strings.
Example::
patt = OneOrMore(Word(alphas))
result = patt.parseString("sldkj lsdkj sldkj")
# even though the result prints in string-like form, it is actually a pyparsing Par... | def asList( self ):
"""
Returns the parse results as a nested list of matching tokens, all converted to strings.
Example::
patt = OneOrMore(Word(alphas))
result = patt.parseString("sldkj lsdkj sldkj")
# even though the result prints in string-like form... | [
"def",
"asList",
"(",
"self",
")",
":",
"return",
"[",
"res",
".",
"asList",
"(",
")",
"if",
"isinstance",
"(",
"res",
",",
"ParseResults",
")",
"else",
"res",
"for",
"res",
"in",
"self",
".",
"__toklist",
"]"
] | [
703,
4
] | [
717,
96
] | python | en | ['en', 'ja', 'th'] | False |
ParseResults.asDict | ( self ) |
Returns the named parse results as a nested dictionary.
Example::
integer = Word(nums)
date_str = integer("year") + '/' + integer("month") + '/' + integer("day")
result = date_str.parseString('12/31/1999')
print(type(result), repr(re... |
Returns the named parse results as a nested dictionary.
Example::
integer = Word(nums)
date_str = integer("year") + '/' + integer("month") + '/' + integer("day")
result = date_str.parseString('12/31/1999')
print(type(result), repr(re... | def asDict( self ):
"""
Returns the named parse results as a nested dictionary.
Example::
integer = Word(nums)
date_str = integer("year") + '/' + integer("month") + '/' + integer("day")
result = date_str.parseString('12/31/1999')
... | [
"def",
"asDict",
"(",
"self",
")",
":",
"if",
"PY_3",
":",
"item_fn",
"=",
"self",
".",
"items",
"else",
":",
"item_fn",
"=",
"self",
".",
"iteritems",
"def",
"toItem",
"(",
"obj",
")",
":",
"if",
"isinstance",
"(",
"obj",
",",
"ParseResults",
")",
... | [
719,
4
] | [
752,
55
] | python | en | ['en', 'ja', 'th'] | False |
ParseResults.copy | ( self ) |
Returns a new copy of a C{ParseResults} object.
|
Returns a new copy of a C{ParseResults} object.
| def copy( self ):
"""
Returns a new copy of a C{ParseResults} object.
"""
ret = ParseResults( self.__toklist )
ret.__tokdict = self.__tokdict.copy()
ret.__parent = self.__parent
ret.__accumNames.update( self.__accumNames )
ret.__name = self.__name
... | [
"def",
"copy",
"(",
"self",
")",
":",
"ret",
"=",
"ParseResults",
"(",
"self",
".",
"__toklist",
")",
"ret",
".",
"__tokdict",
"=",
"self",
".",
"__tokdict",
".",
"copy",
"(",
")",
"ret",
".",
"__parent",
"=",
"self",
".",
"__parent",
"ret",
".",
"... | [
754,
4
] | [
763,
18
] | python | en | ['en', 'ja', 'th'] | False |
ParseResults.asXML | ( self, doctag=None, namedItemsOnly=False, indent="", formatted=True ) |
(Deprecated) Returns the parse results as XML. Tags are created for tokens and lists that have defined results names.
|
(Deprecated) Returns the parse results as XML. Tags are created for tokens and lists that have defined results names.
| def asXML( self, doctag=None, namedItemsOnly=False, indent="", formatted=True ):
"""
(Deprecated) Returns the parse results as XML. Tags are created for tokens and lists that have defined results names.
"""
nl = "\n"
out = []
namedItems = dict((v[1],k) for (k,vlist)... | [
"def",
"asXML",
"(",
"self",
",",
"doctag",
"=",
"None",
",",
"namedItemsOnly",
"=",
"False",
",",
"indent",
"=",
"\"\"",
",",
"formatted",
"=",
"True",
")",
":",
"nl",
"=",
"\"\\n\"",
"out",
"=",
"[",
"]",
"namedItems",
"=",
"dict",
"(",
"(",
"v",... | [
765,
4
] | [
824,
27
] | python | en | ['en', 'ja', 'th'] | False |
ParseResults.getName | (self) | r"""
Returns the results name for this token expression. Useful when several
different expressions might match at a particular location.
Example::
integer = Word(nums)
ssn_expr = Regex(r"\d\d\d-\d\d-\d\d\d\d")
house_number_expr = Suppress('#') + Word(... | r"""
Returns the results name for this token expression. Useful when several
different expressions might match at a particular location.
Example::
integer = Word(nums)
ssn_expr = Regex(r"\d\d\d-\d\d-\d\d\d\d")
house_number_expr = Suppress('#') + Word(... | def getName(self):
r"""
Returns the results name for this token expression. Useful when several
different expressions might match at a particular location.
Example::
integer = Word(nums)
ssn_expr = Regex(r"\d\d\d-\d\d-\d\d\d\d")
house_number_... | [
"def",
"getName",
"(",
"self",
")",
":",
"if",
"self",
".",
"__name",
":",
"return",
"self",
".",
"__name",
"elif",
"self",
".",
"__parent",
":",
"par",
"=",
"self",
".",
"__parent",
"(",
")",
"if",
"par",
":",
"return",
"par",
".",
"__lookup",
"("... | [
833,
4
] | [
868,
23
] | python | cy | ['en', 'cy', 'hi'] | False |
ParseResults.dump | (self, indent='', depth=0, full=True) |
Diagnostic method for listing out the contents of a C{ParseResults}.
Accepts an optional C{indent} argument so that this string can be embedded
in a nested display of other data.
Example::
integer = Word(nums)
date_str = integer("year") + '/' + integer("m... |
Diagnostic method for listing out the contents of a C{ParseResults}.
Accepts an optional C{indent} argument so that this string can be embedded
in a nested display of other data.
Example::
integer = Word(nums)
date_str = integer("year") + '/' + integer("m... | def dump(self, indent='', depth=0, full=True):
"""
Diagnostic method for listing out the contents of a C{ParseResults}.
Accepts an optional C{indent} argument so that this string can be embedded
in a nested display of other data.
Example::
integer = Word(nums)... | [
"def",
"dump",
"(",
"self",
",",
"indent",
"=",
"''",
",",
"depth",
"=",
"0",
",",
"full",
"=",
"True",
")",
":",
"out",
"=",
"[",
"]",
"NL",
"=",
"'\\n'",
"out",
".",
"append",
"(",
"indent",
"+",
"_ustr",
"(",
"self",
".",
"asList",
"(",
")... | [
870,
4
] | [
913,
27
] | python | en | ['en', 'ja', 'th'] | False |
ParseResults.pprint | (self, *args, **kwargs) |
Pretty-printer for parsed results as a list, using the C{pprint} module.
Accepts additional positional or keyword args as defined for the
C{pprint.pprint} method. (U{http://docs.python.org/3/library/pprint.html#pprint.pprint})
Example::
ident = Word(alphas, alphanums... |
Pretty-printer for parsed results as a list, using the C{pprint} module.
Accepts additional positional or keyword args as defined for the
C{pprint.pprint} method. (U{http://docs.python.org/3/library/pprint.html#pprint.pprint})
Example::
ident = Word(alphas, alphanums... | def pprint(self, *args, **kwargs):
"""
Pretty-printer for parsed results as a list, using the C{pprint} module.
Accepts additional positional or keyword args as defined for the
C{pprint.pprint} method. (U{http://docs.python.org/3/library/pprint.html#pprint.pprint})
Exampl... | [
"def",
"pprint",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"pprint",
".",
"pprint",
"(",
"self",
".",
"asList",
"(",
")",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | [
915,
4
] | [
936,
53
] | python | en | ['en', 'ja', 'th'] | False |
ParserElement.setDefaultWhitespaceChars | ( chars ) | r"""
Overrides the default whitespace chars
Example::
# default whitespace chars are space, <TAB> and newline
OneOrMore(Word(alphas)).parseString("abc def\nghi jkl") # -> ['abc', 'def', 'ghi', 'jkl']
# change to just treat newline as significant
... | r"""
Overrides the default whitespace chars
Example::
# default whitespace chars are space, <TAB> and newline
OneOrMore(Word(alphas)).parseString("abc def\nghi jkl") # -> ['abc', 'def', 'ghi', 'jkl']
# change to just treat newline as significant
... | def setDefaultWhitespaceChars( chars ):
r"""
Overrides the default whitespace chars
Example::
# default whitespace chars are space, <TAB> and newline
OneOrMore(Word(alphas)).parseString("abc def\nghi jkl") # -> ['abc', 'def', 'ghi', 'jkl']
... | [
"def",
"setDefaultWhitespaceChars",
"(",
"chars",
")",
":",
"ParserElement",
".",
"DEFAULT_WHITE_CHARS",
"=",
"chars"
] | [
1108,
4
] | [
1120,
49
] | python | cy | ['en', 'cy', 'hi'] | False |
ParserElement.inlineLiteralsUsing | (cls) |
Set class to be used for inclusion of string literals into a parser.
Example::
# default literal class used is Literal
integer = Word(nums)
date_str = integer("year") + '/' + integer("month") + '/' + integer("day")
date_str.pa... |
Set class to be used for inclusion of string literals into a parser.
Example::
# default literal class used is Literal
integer = Word(nums)
date_str = integer("year") + '/' + integer("month") + '/' + integer("day")
date_str.pa... | def inlineLiteralsUsing(cls):
"""
Set class to be used for inclusion of string literals into a parser.
Example::
# default literal class used is Literal
integer = Word(nums)
date_str = integer("year") + '/' + integer("month") + '/' + integer("d... | [
"def",
"inlineLiteralsUsing",
"(",
"cls",
")",
":",
"ParserElement",
".",
"_literalStringClass",
"=",
"cls"
] | [
1123,
4
] | [
1141,
47
] | python | en | ['en', 'ja', 'th'] | False |
ParserElement.copy | ( self ) |
Make a copy of this C{ParserElement}. Useful for defining different parse actions
for the same parsing pattern, using copies of the original parse element.
Example::
integer = Word(nums).setParseAction(lambda toks: int(toks[0]))
integerK = integer.copy().... |
Make a copy of this C{ParserElement}. Useful for defining different parse actions
for the same parsing pattern, using copies of the original parse element.
Example::
integer = Word(nums).setParseAction(lambda toks: int(toks[0]))
integerK = integer.copy().... | def copy( self ):
"""
Make a copy of this C{ParserElement}. Useful for defining different parse actions
for the same parsing pattern, using copies of the original parse element.
Example::
integer = Word(nums).setParseAction(lambda toks: int(toks[0]))
... | [
"def",
"copy",
"(",
"self",
")",
":",
"cpy",
"=",
"copy",
".",
"copy",
"(",
"self",
")",
"cpy",
".",
"parseAction",
"=",
"self",
".",
"parseAction",
"[",
":",
"]",
"cpy",
".",
"ignoreExprs",
"=",
"self",
".",
"ignoreExprs",
"[",
":",
"]",
"if",
"... | [
1166,
4
] | [
1187,
18
] | python | en | ['en', 'ja', 'th'] | False |
ParserElement.setName | ( self, name ) |
Define name for this expression, makes debugging and exception messages clearer.
Example::
Word(nums).parseString("ABC") # -> Exception: Expected W:(0123...) (at char 0), (line:1, col:1)
Word(nums).setName("integer").parseString("ABC") # -> Exception: Expected in... |
Define name for this expression, makes debugging and exception messages clearer.
Example::
Word(nums).parseString("ABC") # -> Exception: Expected W:(0123...) (at char 0), (line:1, col:1)
Word(nums).setName("integer").parseString("ABC") # -> Exception: Expected in... | def setName( self, name ):
"""
Define name for this expression, makes debugging and exception messages clearer.
Example::
Word(nums).parseString("ABC") # -> Exception: Expected W:(0123...) (at char 0), (line:1, col:1)
Word(nums).setName("integer").parseStr... | [
"def",
"setName",
"(",
"self",
",",
"name",
")",
":",
"self",
".",
"name",
"=",
"name",
"self",
".",
"errmsg",
"=",
"\"Expected \"",
"+",
"self",
".",
"name",
"if",
"hasattr",
"(",
"self",
",",
"\"exception\"",
")",
":",
"self",
".",
"exception",
"."... | [
1189,
4
] | [
1201,
19
] | python | en | ['en', 'ja', 'th'] | False |
ParserElement.setResultsName | ( self, name, listAllMatches=False ) |
Define name for referencing matching tokens as a nested attribute
of the returned parse results.
NOTE: this returns a *copy* of the original C{ParserElement} object;
this is so that the client can define a basic element, such as an
integer, and reference it in multiple plac... |
Define name for referencing matching tokens as a nested attribute
of the returned parse results.
NOTE: this returns a *copy* of the original C{ParserElement} object;
this is so that the client can define a basic element, such as an
integer, and reference it in multiple plac... | def setResultsName( self, name, listAllMatches=False ):
"""
Define name for referencing matching tokens as a nested attribute
of the returned parse results.
NOTE: this returns a *copy* of the original C{ParserElement} object;
this is so that the client can define a basic ele... | [
"def",
"setResultsName",
"(",
"self",
",",
"name",
",",
"listAllMatches",
"=",
"False",
")",
":",
"newself",
"=",
"self",
".",
"copy",
"(",
")",
"if",
"name",
".",
"endswith",
"(",
"\"*\"",
")",
":",
"name",
"=",
"name",
"[",
":",
"-",
"1",
"]",
... | [
1203,
4
] | [
1229,
22
] | python | en | ['en', 'ja', 'th'] | False |
ParserElement.setBreak | (self,breakFlag = True) | Method to invoke the Python pdb debugger when this element is
about to be parsed. Set C{breakFlag} to True to enable, False to
disable.
| Method to invoke the Python pdb debugger when this element is
about to be parsed. Set C{breakFlag} to True to enable, False to
disable.
| def setBreak(self,breakFlag = True):
"""Method to invoke the Python pdb debugger when this element is
about to be parsed. Set C{breakFlag} to True to enable, False to
disable.
"""
if breakFlag:
_parseMethod = self._parse
def breaker(instring, ... | [
"def",
"setBreak",
"(",
"self",
",",
"breakFlag",
"=",
"True",
")",
":",
"if",
"breakFlag",
":",
"_parseMethod",
"=",
"self",
".",
"_parse",
"def",
"breaker",
"(",
"instring",
",",
"loc",
",",
"doActions",
"=",
"True",
",",
"callPreParse",
"=",
"True",
... | [
1231,
4
] | [
1247,
19
] | python | en | ['en', 'en', 'en'] | True |
ParserElement.setParseAction | ( self, *fns, **kwargs ) |
Define one or more actions to perform when successfully matching parse element definition.
Parse action fn is a callable method with 0-3 arguments, called as C{fn(s,loc,toks)},
C{fn(loc,toks)}, C{fn(toks)}, or just C{fn()}, where:
- s = the original string being parsed (see note ... |
Define one or more actions to perform when successfully matching parse element definition.
Parse action fn is a callable method with 0-3 arguments, called as C{fn(s,loc,toks)},
C{fn(loc,toks)}, C{fn(toks)}, or just C{fn()}, where:
- s = the original string being parsed (see note ... | def setParseAction( self, *fns, **kwargs ):
"""
Define one or more actions to perform when successfully matching parse element definition.
Parse action fn is a callable method with 0-3 arguments, called as C{fn(s,loc,toks)},
C{fn(loc,toks)}, C{fn(toks)}, or just C{fn()}, where:
... | [
"def",
"setParseAction",
"(",
"self",
",",
"*",
"fns",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"parseAction",
"=",
"list",
"(",
"map",
"(",
"_trim_arity",
",",
"list",
"(",
"fns",
")",
")",
")",
"self",
".",
"callDuringTry",
"=",
"kwargs",
... | [
1249,
4
] | [
1285,
19
] | python | en | ['en', 'ja', 'th'] | False |
ParserElement.addParseAction | ( self, *fns, **kwargs ) |
Add one or more parse actions to expression's list of parse actions. See L{I{setParseAction}<setParseAction>}.
See examples in L{I{copy}<copy>}.
|
Add one or more parse actions to expression's list of parse actions. See L{I{setParseAction}<setParseAction>}.
See examples in L{I{copy}<copy>}.
| def addParseAction( self, *fns, **kwargs ):
"""
Add one or more parse actions to expression's list of parse actions. See L{I{setParseAction}<setParseAction>}.
See examples in L{I{copy}<copy>}.
"""
self.parseAction += list(map(_trim_arity, list(fns)))
self.... | [
"def",
"addParseAction",
"(",
"self",
",",
"*",
"fns",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"parseAction",
"+=",
"list",
"(",
"map",
"(",
"_trim_arity",
",",
"list",
"(",
"fns",
")",
")",
")",
"self",
".",
"callDuringTry",
"=",
"self",
"... | [
1287,
4
] | [
1295,
19
] | python | en | ['en', 'ja', 'th'] | False |
ParserElement.addCondition | (self, *fns, **kwargs) | Add a boolean predicate function to expression's list of parse actions. See
L{I{setParseAction}<setParseAction>} for function call signatures. Unlike C{setParseAction},
functions passed to C{addCondition} need to return boolean success/fail of the condition.
Optional keyword arguments:
... | Add a boolean predicate function to expression's list of parse actions. See
L{I{setParseAction}<setParseAction>} for function call signatures. Unlike C{setParseAction},
functions passed to C{addCondition} need to return boolean success/fail of the condition.
Optional keyword arguments:
... | def addCondition(self, *fns, **kwargs):
"""Add a boolean predicate function to expression's list of parse actions. See
L{I{setParseAction}<setParseAction>} for function call signatures. Unlike C{setParseAction},
functions passed to C{addCondition} need to return boolean success/fail of the ... | [
"def",
"addCondition",
"(",
"self",
",",
"*",
"fns",
",",
"*",
"*",
"kwargs",
")",
":",
"msg",
"=",
"kwargs",
".",
"get",
"(",
"\"message\"",
",",
"\"failed user-defined condition\"",
")",
"exc_type",
"=",
"ParseFatalException",
"if",
"kwargs",
".",
"get",
... | [
1297,
4
] | [
1322,
19
] | python | en | ['en', 'en', 'en'] | True |
ParserElement.setFailAction | ( self, fn ) | Define action to perform if parsing fails at this expression.
Fail acton fn is a callable function that takes the arguments
C{fn(s,loc,expr,err)} where:
- s = string being parsed
- loc = location where expression match was attempted and failed
- expr = the ... | Define action to perform if parsing fails at this expression.
Fail acton fn is a callable function that takes the arguments
C{fn(s,loc,expr,err)} where:
- s = string being parsed
- loc = location where expression match was attempted and failed
- expr = the ... | def setFailAction( self, fn ):
"""Define action to perform if parsing fails at this expression.
Fail acton fn is a callable function that takes the arguments
C{fn(s,loc,expr,err)} where:
- s = string being parsed
- loc = location where expression match was atte... | [
"def",
"setFailAction",
"(",
"self",
",",
"fn",
")",
":",
"self",
".",
"failAction",
"=",
"fn",
"return",
"self"
] | [
1324,
4
] | [
1335,
19
] | python | en | ['en', 'en', 'en'] | True |
ParserElement.enablePackrat | (cache_size_limit=128) | Enables "packrat" parsing, which adds memoizing to the parsing logic.
Repeated parse attempts at the same string location (which happens
often in many complex grammars) can immediately return a cached value,
instead of re-executing parsing/validating code. Memoizing is done of
... | Enables "packrat" parsing, which adds memoizing to the parsing logic.
Repeated parse attempts at the same string location (which happens
often in many complex grammars) can immediately return a cached value,
instead of re-executing parsing/validating code. Memoizing is done of
... | def enablePackrat(cache_size_limit=128):
"""Enables "packrat" parsing, which adds memoizing to the parsing logic.
Repeated parse attempts at the same string location (which happens
often in many complex grammars) can immediately return a cached value,
instead of re-executing... | [
"def",
"enablePackrat",
"(",
"cache_size_limit",
"=",
"128",
")",
":",
"if",
"not",
"ParserElement",
".",
"_packratEnabled",
":",
"ParserElement",
".",
"_packratEnabled",
"=",
"True",
"if",
"cache_size_limit",
"is",
"None",
":",
"ParserElement",
".",
"packrat_cach... | [
1573,
4
] | [
1605,
60
] | python | en | ['en', 'en', 'en'] | True |
ParserElement.parseString | ( self, instring, parseAll=False ) |
Execute the parse expression with the given string.
This is the main interface to the client code, once the complete
expression has been built.
If you want the grammar to require that the entire input string be
successfully parsed, then set C{parseAll} to True (equivalent... |
Execute the parse expression with the given string.
This is the main interface to the client code, once the complete
expression has been built.
If you want the grammar to require that the entire input string be
successfully parsed, then set C{parseAll} to True (equivalent... | def parseString( self, instring, parseAll=False ):
"""
Execute the parse expression with the given string.
This is the main interface to the client code, once the complete
expression has been built.
If you want the grammar to require that the entire input string be
... | [
"def",
"parseString",
"(",
"self",
",",
"instring",
",",
"parseAll",
"=",
"False",
")",
":",
"ParserElement",
".",
"resetCache",
"(",
")",
"if",
"not",
"self",
".",
"streamlined",
":",
"self",
".",
"streamline",
"(",
")",
"#~ self.saveAsList = True\r",
"for"... | [
1607,
4
] | [
1655,
25
] | python | en | ['en', 'ja', 'th'] | False |
ParserElement.scanString | ( self, instring, maxMatches=_MAX_INT, overlap=False ) |
Scan the input string for expression matches. Each match will return the
matching tokens, start location, and end location. May be called with optional
C{maxMatches} argument, to clip scanning after 'n' matches are found. If
C{overlap} is specified, then overlapping matches will ... |
Scan the input string for expression matches. Each match will return the
matching tokens, start location, and end location. May be called with optional
C{maxMatches} argument, to clip scanning after 'n' matches are found. If
C{overlap} is specified, then overlapping matches will ... | def scanString( self, instring, maxMatches=_MAX_INT, overlap=False ):
"""
Scan the input string for expression matches. Each match will return the
matching tokens, start location, and end location. May be called with optional
C{maxMatches} argument, to clip scanning after 'n' match... | [
"def",
"scanString",
"(",
"self",
",",
"instring",
",",
"maxMatches",
"=",
"_MAX_INT",
",",
"overlap",
"=",
"False",
")",
":",
"if",
"not",
"self",
".",
"streamlined",
":",
"self",
".",
"streamline",
"(",
")",
"for",
"e",
"in",
"self",
".",
"ignoreExpr... | [
1657,
4
] | [
1726,
25
] | python | en | ['en', 'ja', 'th'] | False |
ParserElement.transformString | ( self, instring ) |
Extension to C{L{scanString}}, to modify matching text with modified tokens that may
be returned from a parse action. To use C{transformString}, define a grammar and
attach a parse action to it that modifies the returned token list.
Invoking C{transformString()} on a target string ... |
Extension to C{L{scanString}}, to modify matching text with modified tokens that may
be returned from a parse action. To use C{transformString}, define a grammar and
attach a parse action to it that modifies the returned token list.
Invoking C{transformString()} on a target string ... | def transformString( self, instring ):
"""
Extension to C{L{scanString}}, to modify matching text with modified tokens that may
be returned from a parse action. To use C{transformString}, define a grammar and
attach a parse action to it that modifies the returned token list.
... | [
"def",
"transformString",
"(",
"self",
",",
"instring",
")",
":",
"out",
"=",
"[",
"]",
"lastE",
"=",
"0",
"# force preservation of <TAB>s, to minimize unwanted transformation of string, and to\r",
"# keep string locs straight between transformString and scanString\r",
"self",
".... | [
1728,
4
] | [
1769,
25
] | python | en | ['en', 'ja', 'th'] | False |
ParserElement.searchString | ( self, instring, maxMatches=_MAX_INT ) |
Another extension to C{L{scanString}}, simplifying the access to the tokens found
to match the given parse expression. May be called with optional
C{maxMatches} argument, to clip searching after 'n' matches are found.
Example::
# a capitalized word starts wit... |
Another extension to C{L{scanString}}, simplifying the access to the tokens found
to match the given parse expression. May be called with optional
C{maxMatches} argument, to clip searching after 'n' matches are found.
Example::
# a capitalized word starts wit... | def searchString( self, instring, maxMatches=_MAX_INT ):
"""
Another extension to C{L{scanString}}, simplifying the access to the tokens found
to match the given parse expression. May be called with optional
C{maxMatches} argument, to clip searching after 'n' matches are found.
... | [
"def",
"searchString",
"(",
"self",
",",
"instring",
",",
"maxMatches",
"=",
"_MAX_INT",
")",
":",
"try",
":",
"return",
"ParseResults",
"(",
"[",
"t",
"for",
"t",
",",
"s",
",",
"e",
"in",
"self",
".",
"scanString",
"(",
"instring",
",",
"maxMatches",... | [
1771,
4
] | [
1796,
25
] | python | en | ['en', 'ja', 'th'] | False |
ParserElement.split | (self, instring, maxsplit=_MAX_INT, includeSeparators=False) |
Generator method to split a string using the given expression as a separator.
May be called with optional C{maxsplit} argument, to limit the number of splits;
and the optional C{includeSeparators} argument (default=C{False}), if the separating
matching text should be included in the... |
Generator method to split a string using the given expression as a separator.
May be called with optional C{maxsplit} argument, to limit the number of splits;
and the optional C{includeSeparators} argument (default=C{False}), if the separating
matching text should be included in the... | def split(self, instring, maxsplit=_MAX_INT, includeSeparators=False):
"""
Generator method to split a string using the given expression as a separator.
May be called with optional C{maxsplit} argument, to limit the number of splits;
and the optional C{includeSeparators} argument (de... | [
"def",
"split",
"(",
"self",
",",
"instring",
",",
"maxsplit",
"=",
"_MAX_INT",
",",
"includeSeparators",
"=",
"False",
")",
":",
"splits",
"=",
"0",
"last",
"=",
"0",
"for",
"t",
",",
"s",
",",
"e",
"in",
"self",
".",
"scanString",
"(",
"instring",
... | [
1798,
4
] | [
1818,
29
] | python | en | ['en', 'ja', 'th'] | False |
ParserElement.__add__ | (self, other ) |
Implementation of + operator - returns C{L{And}}. Adding strings to a ParserElement
converts them to L{Literal}s by default.
Example::
greet = Word(alphas) + "," + Word(alphas) + "!"
hello = "Hello, World!"
print (hello, "->", greet.parseStrin... |
Implementation of + operator - returns C{L{And}}. Adding strings to a ParserElement
converts them to L{Literal}s by default.
Example::
greet = Word(alphas) + "," + Word(alphas) + "!"
hello = "Hello, World!"
print (hello, "->", greet.parseStrin... | def __add__(self, other ):
"""
Implementation of + operator - returns C{L{And}}. Adding strings to a ParserElement
converts them to L{Literal}s by default.
Example::
greet = Word(alphas) + "," + Word(alphas) + "!"
hello = "Hello, World!"
... | [
"def",
"__add__",
"(",
"self",
",",
"other",
")",
":",
"if",
"isinstance",
"(",
"other",
",",
"basestring",
")",
":",
"other",
"=",
"ParserElement",
".",
"_literalStringClass",
"(",
"other",
")",
"if",
"not",
"isinstance",
"(",
"other",
",",
"ParserElement... | [
1820,
4
] | [
1838,
37
] | python | en | ['en', 'ja', 'th'] | False |
ParserElement.__radd__ | (self, other ) |
Implementation of + operator when left operand is not a C{L{ParserElement}}
|
Implementation of + operator when left operand is not a C{L{ParserElement}}
| def __radd__(self, other ):
"""
Implementation of + operator when left operand is not a C{L{ParserElement}}
"""
if isinstance( other, basestring ):
other = ParserElement._literalStringClass( other )
if not isinstance( other, ParserElement ):
warning... | [
"def",
"__radd__",
"(",
"self",
",",
"other",
")",
":",
"if",
"isinstance",
"(",
"other",
",",
"basestring",
")",
":",
"other",
"=",
"ParserElement",
".",
"_literalStringClass",
"(",
"other",
")",
"if",
"not",
"isinstance",
"(",
"other",
",",
"ParserElemen... | [
1840,
4
] | [
1850,
27
] | python | en | ['en', 'ja', 'th'] | False |
ParserElement.__sub__ | (self, other) |
Implementation of - operator, returns C{L{And}} with error stop
|
Implementation of - operator, returns C{L{And}} with error stop
| def __sub__(self, other):
"""
Implementation of - operator, returns C{L{And}} with error stop
"""
if isinstance( other, basestring ):
other = ParserElement._literalStringClass( other )
if not isinstance( other, ParserElement ):
warnings.warn("Cannot... | [
"def",
"__sub__",
"(",
"self",
",",
"other",
")",
":",
"if",
"isinstance",
"(",
"other",
",",
"basestring",
")",
":",
"other",
"=",
"ParserElement",
".",
"_literalStringClass",
"(",
"other",
")",
"if",
"not",
"isinstance",
"(",
"other",
",",
"ParserElement... | [
1852,
4
] | [
1862,
46
] | python | en | ['en', 'ja', 'th'] | False |
ParserElement.__rsub__ | (self, other ) |
Implementation of - operator when left operand is not a C{L{ParserElement}}
|
Implementation of - operator when left operand is not a C{L{ParserElement}}
| def __rsub__(self, other ):
"""
Implementation of - operator when left operand is not a C{L{ParserElement}}
"""
if isinstance( other, basestring ):
other = ParserElement._literalStringClass( other )
if not isinstance( other, ParserElement ):
warning... | [
"def",
"__rsub__",
"(",
"self",
",",
"other",
")",
":",
"if",
"isinstance",
"(",
"other",
",",
"basestring",
")",
":",
"other",
"=",
"ParserElement",
".",
"_literalStringClass",
"(",
"other",
")",
"if",
"not",
"isinstance",
"(",
"other",
",",
"ParserElemen... | [
1864,
4
] | [
1874,
27
] | python | en | ['en', 'ja', 'th'] | False |
ParserElement.__mul__ | (self,other) |
Implementation of * operator, allows use of C{expr * 3} in place of
C{expr + expr + expr}. Expressions may also me multiplied by a 2-integer
tuple, similar to C{{min,max}} multipliers in regular expressions. Tuples
may also include C{None} as in:
- C{expr*(n,None)} or C{... |
Implementation of * operator, allows use of C{expr * 3} in place of
C{expr + expr + expr}. Expressions may also me multiplied by a 2-integer
tuple, similar to C{{min,max}} multipliers in regular expressions. Tuples
may also include C{None} as in:
- C{expr*(n,None)} or C{... | def __mul__(self,other):
"""
Implementation of * operator, allows use of C{expr * 3} in place of
C{expr + expr + expr}. Expressions may also me multiplied by a 2-integer
tuple, similar to C{{min,max}} multipliers in regular expressions. Tuples
may also include C{None} as i... | [
"def",
"__mul__",
"(",
"self",
",",
"other",
")",
":",
"if",
"isinstance",
"(",
"other",
",",
"int",
")",
":",
"minElements",
",",
"optElements",
"=",
"other",
",",
"0",
"elif",
"isinstance",
"(",
"other",
",",
"tuple",
")",
":",
"other",
"=",
"(",
... | [
1876,
4
] | [
1942,
18
] | python | en | ['en', 'ja', 'th'] | False |
ParserElement.__or__ | (self, other ) |
Implementation of | operator - returns C{L{MatchFirst}}
|
Implementation of | operator - returns C{L{MatchFirst}}
| def __or__(self, other ):
"""
Implementation of | operator - returns C{L{MatchFirst}}
"""
if isinstance( other, basestring ):
other = ParserElement._literalStringClass( other )
if not isinstance( other, ParserElement ):
warnings.warn("Cannot combine... | [
"def",
"__or__",
"(",
"self",
",",
"other",
")",
":",
"if",
"isinstance",
"(",
"other",
",",
"basestring",
")",
":",
"other",
"=",
"ParserElement",
".",
"_literalStringClass",
"(",
"other",
")",
"if",
"not",
"isinstance",
"(",
"other",
",",
"ParserElement"... | [
1947,
4
] | [
1957,
44
] | python | en | ['en', 'ja', 'th'] | False |
ParserElement.__ror__ | (self, other ) |
Implementation of | operator when left operand is not a C{L{ParserElement}}
|
Implementation of | operator when left operand is not a C{L{ParserElement}}
| def __ror__(self, other ):
"""
Implementation of | operator when left operand is not a C{L{ParserElement}}
"""
if isinstance( other, basestring ):
other = ParserElement._literalStringClass( other )
if not isinstance( other, ParserElement ):
warnings... | [
"def",
"__ror__",
"(",
"self",
",",
"other",
")",
":",
"if",
"isinstance",
"(",
"other",
",",
"basestring",
")",
":",
"other",
"=",
"ParserElement",
".",
"_literalStringClass",
"(",
"other",
")",
"if",
"not",
"isinstance",
"(",
"other",
",",
"ParserElement... | [
1959,
4
] | [
1969,
27
] | python | en | ['en', 'ja', 'th'] | False |
ParserElement.__xor__ | (self, other ) |
Implementation of ^ operator - returns C{L{Or}}
|
Implementation of ^ operator - returns C{L{Or}}
| def __xor__(self, other ):
"""
Implementation of ^ operator - returns C{L{Or}}
"""
if isinstance( other, basestring ):
other = ParserElement._literalStringClass( other )
if not isinstance( other, ParserElement ):
warnings.warn("Cannot combine elemen... | [
"def",
"__xor__",
"(",
"self",
",",
"other",
")",
":",
"if",
"isinstance",
"(",
"other",
",",
"basestring",
")",
":",
"other",
"=",
"ParserElement",
".",
"_literalStringClass",
"(",
"other",
")",
"if",
"not",
"isinstance",
"(",
"other",
",",
"ParserElement... | [
1971,
4
] | [
1981,
36
] | python | en | ['en', 'ja', 'th'] | False |
ParserElement.__rxor__ | (self, other ) |
Implementation of ^ operator when left operand is not a C{L{ParserElement}}
|
Implementation of ^ operator when left operand is not a C{L{ParserElement}}
| def __rxor__(self, other ):
"""
Implementation of ^ operator when left operand is not a C{L{ParserElement}}
"""
if isinstance( other, basestring ):
other = ParserElement._literalStringClass( other )
if not isinstance( other, ParserElement ):
warning... | [
"def",
"__rxor__",
"(",
"self",
",",
"other",
")",
":",
"if",
"isinstance",
"(",
"other",
",",
"basestring",
")",
":",
"other",
"=",
"ParserElement",
".",
"_literalStringClass",
"(",
"other",
")",
"if",
"not",
"isinstance",
"(",
"other",
",",
"ParserElemen... | [
1983,
4
] | [
1993,
27
] | python | en | ['en', 'ja', 'th'] | False |
ParserElement.__and__ | (self, other ) |
Implementation of & operator - returns C{L{Each}}
|
Implementation of & operator - returns C{L{Each}}
| def __and__(self, other ):
"""
Implementation of & operator - returns C{L{Each}}
"""
if isinstance( other, basestring ):
other = ParserElement._literalStringClass( other )
if not isinstance( other, ParserElement ):
warnings.warn("Cannot combine elem... | [
"def",
"__and__",
"(",
"self",
",",
"other",
")",
":",
"if",
"isinstance",
"(",
"other",
",",
"basestring",
")",
":",
"other",
"=",
"ParserElement",
".",
"_literalStringClass",
"(",
"other",
")",
"if",
"not",
"isinstance",
"(",
"other",
",",
"ParserElement... | [
1995,
4
] | [
2005,
38
] | python | en | ['en', 'ja', 'th'] | False |
ParserElement.__rand__ | (self, other ) |
Implementation of & operator when left operand is not a C{L{ParserElement}}
|
Implementation of & operator when left operand is not a C{L{ParserElement}}
| def __rand__(self, other ):
"""
Implementation of & operator when left operand is not a C{L{ParserElement}}
"""
if isinstance( other, basestring ):
other = ParserElement._literalStringClass( other )
if not isinstance( other, ParserElement ):
warning... | [
"def",
"__rand__",
"(",
"self",
",",
"other",
")",
":",
"if",
"isinstance",
"(",
"other",
",",
"basestring",
")",
":",
"other",
"=",
"ParserElement",
".",
"_literalStringClass",
"(",
"other",
")",
"if",
"not",
"isinstance",
"(",
"other",
",",
"ParserElemen... | [
2007,
4
] | [
2017,
27
] | python | en | ['en', 'ja', 'th'] | False |
ParserElement.__invert__ | ( self ) |
Implementation of ~ operator - returns C{L{NotAny}}
|
Implementation of ~ operator - returns C{L{NotAny}}
| def __invert__( self ):
"""
Implementation of ~ operator - returns C{L{NotAny}}
"""
return NotAny( self ) | [
"def",
"__invert__",
"(",
"self",
")",
":",
"return",
"NotAny",
"(",
"self",
")"
] | [
2019,
4
] | [
2023,
29
] | python | en | ['en', 'ja', 'th'] | False |
ParserElement.__call__ | (self, name=None) |
Shortcut for C{L{setResultsName}}, with C{listAllMatches=False}.
If C{name} is given with a trailing C{'*'} character, then C{listAllMatches} will be
passed as C{True}.
If C{name} is omitted, same as calling C{L{copy}}.
Example::
# thes... |
Shortcut for C{L{setResultsName}}, with C{listAllMatches=False}.
If C{name} is given with a trailing C{'*'} character, then C{listAllMatches} will be
passed as C{True}.
If C{name} is omitted, same as calling C{L{copy}}.
Example::
# thes... | def __call__(self, name=None):
"""
Shortcut for C{L{setResultsName}}, with C{listAllMatches=False}.
If C{name} is given with a trailing C{'*'} character, then C{listAllMatches} will be
passed as C{True}.
If C{name} is omitted, same as calling C{L{copy}... | [
"def",
"__call__",
"(",
"self",
",",
"name",
"=",
"None",
")",
":",
"if",
"name",
"is",
"not",
"None",
":",
"return",
"self",
".",
"setResultsName",
"(",
"name",
")",
"else",
":",
"return",
"self",
".",
"copy",
"(",
")"
] | [
2025,
4
] | [
2042,
30
] | python | en | ['en', 'ja', 'th'] | False |
ParserElement.suppress | ( self ) |
Suppresses the output of this C{ParserElement}; useful to keep punctuation from
cluttering up returned output.
|
Suppresses the output of this C{ParserElement}; useful to keep punctuation from
cluttering up returned output.
| def suppress( self ):
"""
Suppresses the output of this C{ParserElement}; useful to keep punctuation from
cluttering up returned output.
"""
return Suppress( self ) | [
"def",
"suppress",
"(",
"self",
")",
":",
"return",
"Suppress",
"(",
"self",
")"
] | [
2044,
4
] | [
2049,
31
] | python | en | ['en', 'ja', 'th'] | False |
ParserElement.leaveWhitespace | ( self ) |
Disables the skipping of whitespace before matching the characters in the
C{ParserElement}'s defined pattern. This is normally only used internally by
the pyparsing module, but may be needed in some whitespace-sensitive grammars.
|
Disables the skipping of whitespace before matching the characters in the
C{ParserElement}'s defined pattern. This is normally only used internally by
the pyparsing module, but may be needed in some whitespace-sensitive grammars.
| def leaveWhitespace( self ):
"""
Disables the skipping of whitespace before matching the characters in the
C{ParserElement}'s defined pattern. This is normally only used internally by
the pyparsing module, but may be needed in some whitespace-sensitive grammars.
"""
... | [
"def",
"leaveWhitespace",
"(",
"self",
")",
":",
"self",
".",
"skipWhitespace",
"=",
"False",
"return",
"self"
] | [
2051,
4
] | [
2058,
19
] | python | en | ['en', 'ja', 'th'] | False |
ParserElement.setWhitespaceChars | ( self, chars ) |
Overrides the default whitespace chars
|
Overrides the default whitespace chars
| def setWhitespaceChars( self, chars ):
"""
Overrides the default whitespace chars
"""
self.skipWhitespace = True
self.whiteChars = chars
self.copyDefaultWhiteChars = False
return self | [
"def",
"setWhitespaceChars",
"(",
"self",
",",
"chars",
")",
":",
"self",
".",
"skipWhitespace",
"=",
"True",
"self",
".",
"whiteChars",
"=",
"chars",
"self",
".",
"copyDefaultWhiteChars",
"=",
"False",
"return",
"self"
] | [
2060,
4
] | [
2067,
19
] | python | en | ['en', 'ja', 'th'] | False |
ParserElement.parseWithTabs | ( self ) |
Overrides default behavior to expand C{<TAB>}s to spaces before parsing the input string.
Must be called before C{parseString} when the input grammar contains elements that
match C{<TAB>} characters.
|
Overrides default behavior to expand C{<TAB>}s to spaces before parsing the input string.
Must be called before C{parseString} when the input grammar contains elements that
match C{<TAB>} characters.
| def parseWithTabs( self ):
"""
Overrides default behavior to expand C{<TAB>}s to spaces before parsing the input string.
Must be called before C{parseString} when the input grammar contains elements that
match C{<TAB>} characters.
"""
self.keepTabs = True
r... | [
"def",
"parseWithTabs",
"(",
"self",
")",
":",
"self",
".",
"keepTabs",
"=",
"True",
"return",
"self"
] | [
2069,
4
] | [
2076,
19
] | python | en | ['en', 'ja', 'th'] | False |
ParserElement.ignore | ( self, other ) |
Define expression to be ignored (e.g., comments) while doing pattern
matching; may be called repeatedly, to define multiple comment or other
ignorable patterns.
Example::
patt = OneOrMore(Word(alphas))
patt.parseString('ablaj /* comment */ lskjd')... |
Define expression to be ignored (e.g., comments) while doing pattern
matching; may be called repeatedly, to define multiple comment or other
ignorable patterns.
Example::
patt = OneOrMore(Word(alphas))
patt.parseString('ablaj /* comment */ lskjd')... | def ignore( self, other ):
"""
Define expression to be ignored (e.g., comments) while doing pattern
matching; may be called repeatedly, to define multiple comment or other
ignorable patterns.
Example::
patt = OneOrMore(Word(alphas))
patt.p... | [
"def",
"ignore",
"(",
"self",
",",
"other",
")",
":",
"if",
"isinstance",
"(",
"other",
",",
"basestring",
")",
":",
"other",
"=",
"Suppress",
"(",
"other",
")",
"if",
"isinstance",
"(",
"other",
",",
"Suppress",
")",
":",
"if",
"other",
"not",
"in",... | [
2078,
4
] | [
2099,
19
] | python | en | ['en', 'ja', 'th'] | False |
ParserElement.setDebugActions | ( self, startAction, successAction, exceptionAction ) |
Enable display of debugging messages while doing pattern matching.
|
Enable display of debugging messages while doing pattern matching.
| def setDebugActions( self, startAction, successAction, exceptionAction ):
"""
Enable display of debugging messages while doing pattern matching.
"""
self.debugActions = (startAction or _defaultStartDebugAction,
successAction or _defaultSuccessDebugAction... | [
"def",
"setDebugActions",
"(",
"self",
",",
"startAction",
",",
"successAction",
",",
"exceptionAction",
")",
":",
"self",
".",
"debugActions",
"=",
"(",
"startAction",
"or",
"_defaultStartDebugAction",
",",
"successAction",
"or",
"_defaultSuccessDebugAction",
",",
... | [
2101,
4
] | [
2109,
19
] | python | en | ['en', 'ja', 'th'] | False |
ParserElement.setDebug | ( self, flag=True ) |
Enable display of debugging messages while doing pattern matching.
Set C{flag} to True to enable, False to disable.
Example::
wd = Word(alphas).setName("alphaword")
integer = Word(nums).setName("numword")
term = wd | integer
... |
Enable display of debugging messages while doing pattern matching.
Set C{flag} to True to enable, False to disable.
Example::
wd = Word(alphas).setName("alphaword")
integer = Word(nums).setName("numword")
term = wd | integer
... | def setDebug( self, flag=True ):
"""
Enable display of debugging messages while doing pattern matching.
Set C{flag} to True to enable, False to disable.
Example::
wd = Word(alphas).setName("alphaword")
integer = Word(nums).setName("numword")
t... | [
"def",
"setDebug",
"(",
"self",
",",
"flag",
"=",
"True",
")",
":",
"if",
"flag",
":",
"self",
".",
"setDebugActions",
"(",
"_defaultStartDebugAction",
",",
"_defaultSuccessDebugAction",
",",
"_defaultExceptionDebugAction",
")",
"else",
":",
"self",
".",
"debug"... | [
2111,
4
] | [
2150,
19
] | python | en | ['en', 'ja', 'th'] | False |
ParserElement.validate | ( self, validateTrace=[] ) |
Check defined expressions for valid structure, check for infinite recursive definitions.
|
Check defined expressions for valid structure, check for infinite recursive definitions.
| def validate( self, validateTrace=[] ):
"""
Check defined expressions for valid structure, check for infinite recursive definitions.
"""
self.checkRecursion( [] ) | [
"def",
"validate",
"(",
"self",
",",
"validateTrace",
"=",
"[",
"]",
")",
":",
"self",
".",
"checkRecursion",
"(",
"[",
"]",
")"
] | [
2166,
4
] | [
2170,
33
] | python | en | ['en', 'ja', 'th'] | False |
ParserElement.parseFile | ( self, file_or_filename, parseAll=False ) |
Execute the parse expression on the given file or filename.
If a filename is specified (instead of a file object),
the entire file is opened, read, and closed before parsing.
|
Execute the parse expression on the given file or filename.
If a filename is specified (instead of a file object),
the entire file is opened, read, and closed before parsing.
| def parseFile( self, file_or_filename, parseAll=False ):
"""
Execute the parse expression on the given file or filename.
If a filename is specified (instead of a file object),
the entire file is opened, read, and closed before parsing.
"""
try:
file_con... | [
"def",
"parseFile",
"(",
"self",
",",
"file_or_filename",
",",
"parseAll",
"=",
"False",
")",
":",
"try",
":",
"file_contents",
"=",
"file_or_filename",
".",
"read",
"(",
")",
"except",
"AttributeError",
":",
"with",
"open",
"(",
"file_or_filename",
",",
"\"... | [
2172,
4
] | [
2190,
25
] | python | en | ['en', 'ja', 'th'] | False |
ParserElement.matches | (self, testString, parseAll=True) |
Method for quick testing of a parser against a test string. Good for simple
inline microtests of sub expressions while building up larger parser.
Parameters:
- testString - to test against this expression for a match
- parseAll - (default=C{True}) - flag to ... |
Method for quick testing of a parser against a test string. Good for simple
inline microtests of sub expressions while building up larger parser.
Parameters:
- testString - to test against this expression for a match
- parseAll - (default=C{True}) - flag to ... | def matches(self, testString, parseAll=True):
"""
Method for quick testing of a parser against a test string. Good for simple
inline microtests of sub expressions while building up larger parser.
Parameters:
- testString - to test against this expression for a... | [
"def",
"matches",
"(",
"self",
",",
"testString",
",",
"parseAll",
"=",
"True",
")",
":",
"try",
":",
"self",
".",
"parseString",
"(",
"_ustr",
"(",
"testString",
")",
",",
"parseAll",
"=",
"parseAll",
")",
"return",
"True",
"except",
"ParseBaseException",... | [
2212,
4
] | [
2229,
24
] | python | en | ['en', 'ja', 'th'] | False |
ParserElement.runTests | (self, tests, parseAll=True, comment='#', fullDump=True, printResults=True, failureTests=False) |
Execute the parse expression on a series of test strings, showing each
test, the parsed results or where the parse failed. Quick and easy way to
run a parse expression against a list of sample strings.
Parameters:
- tests - a list of separate test strings, or ... |
Execute the parse expression on a series of test strings, showing each
test, the parsed results or where the parse failed. Quick and easy way to
run a parse expression against a list of sample strings.
Parameters:
- tests - a list of separate test strings, or ... | def runTests(self, tests, parseAll=True, comment='#', fullDump=True, printResults=True, failureTests=False):
"""
Execute the parse expression on a series of test strings, showing each
test, the parsed results or where the parse failed. Quick and easy way to
run a parse expression aga... | [
"def",
"runTests",
"(",
"self",
",",
"tests",
",",
"parseAll",
"=",
"True",
",",
"comment",
"=",
"'#'",
",",
"fullDump",
"=",
"True",
",",
"printResults",
"=",
"True",
",",
"failureTests",
"=",
"False",
")",
":",
"if",
"isinstance",
"(",
"tests",
",",
... | [
2231,
4
] | [
2360,
34
] | python | en | ['en', 'ja', 'th'] | False |
build_instance | (Model, data, db) |
Build a model instance.
If the model instance doesn't have a primary key and the model supports
natural keys, try to retrieve it from the database.
|
Build a model instance. | def build_instance(Model, data, db):
"""
Build a model instance.
If the model instance doesn't have a primary key and the model supports
natural keys, try to retrieve it from the database.
"""
default_manager = Model._meta.default_manager
pk = data.get(Model._meta.pk.name)
if (pk is Non... | [
"def",
"build_instance",
"(",
"Model",
",",
"data",
",",
"db",
")",
":",
"default_manager",
"=",
"Model",
".",
"_meta",
".",
"default_manager",
"pk",
"=",
"data",
".",
"get",
"(",
"Model",
".",
"_meta",
".",
"pk",
".",
"name",
")",
"if",
"(",
"pk",
... | [
251,
0
] | [
269,
24
] | python | en | ['en', 'error', 'th'] | False |
DeserializationError.WithData | (cls, original_exc, model, fk, field_value) |
Factory method for creating a deserialization error which has a more
explanatory message.
|
Factory method for creating a deserialization error which has a more
explanatory message.
| def WithData(cls, original_exc, model, fk, field_value):
"""
Factory method for creating a deserialization error which has a more
explanatory message.
"""
return cls("%s: (%s:pk=%s) field_value was '%s'" % (original_exc, model, fk, field_value)) | [
"def",
"WithData",
"(",
"cls",
",",
"original_exc",
",",
"model",
",",
"fk",
",",
"field_value",
")",
":",
"return",
"cls",
"(",
"\"%s: (%s:pk=%s) field_value was '%s'\"",
"%",
"(",
"original_exc",
",",
"model",
",",
"fk",
",",
"field_value",
")",
")"
] | [
25,
4
] | [
30,
98
] | python | en | ['en', 'error', 'th'] | False |
Serializer.serialize | (self, queryset, *, stream=None, fields=None, use_natural_foreign_keys=False,
use_natural_primary_keys=False, progress_output=None, object_count=0, **options) |
Serialize a queryset.
|
Serialize a queryset.
| def serialize(self, queryset, *, stream=None, fields=None, use_natural_foreign_keys=False,
use_natural_primary_keys=False, progress_output=None, object_count=0, **options):
"""
Serialize a queryset.
"""
self.options = options
self.stream = stream if stream is n... | [
"def",
"serialize",
"(",
"self",
",",
"queryset",
",",
"*",
",",
"stream",
"=",
"None",
",",
"fields",
"=",
"None",
",",
"use_natural_foreign_keys",
"=",
"False",
",",
"use_natural_primary_keys",
"=",
"False",
",",
"progress_output",
"=",
"None",
",",
"objec... | [
74,
4
] | [
118,
30
] | python | en | ['en', 'error', 'th'] | False |
Serializer.start_serialization | (self) |
Called when serializing of the queryset starts.
|
Called when serializing of the queryset starts.
| def start_serialization(self):
"""
Called when serializing of the queryset starts.
"""
raise NotImplementedError('subclasses of Serializer must provide a start_serialization() method') | [
"def",
"start_serialization",
"(",
"self",
")",
":",
"raise",
"NotImplementedError",
"(",
"'subclasses of Serializer must provide a start_serialization() method'",
")"
] | [
120,
4
] | [
124,
105
] | python | en | ['en', 'error', 'th'] | False |
Serializer.end_serialization | (self) |
Called when serializing of the queryset ends.
|
Called when serializing of the queryset ends.
| def end_serialization(self):
"""
Called when serializing of the queryset ends.
"""
pass | [
"def",
"end_serialization",
"(",
"self",
")",
":",
"pass"
] | [
126,
4
] | [
130,
12
] | python | en | ['en', 'error', 'th'] | False |
Serializer.start_object | (self, obj) |
Called when serializing of an object starts.
|
Called when serializing of an object starts.
| def start_object(self, obj):
"""
Called when serializing of an object starts.
"""
raise NotImplementedError('subclasses of Serializer must provide a start_object() method') | [
"def",
"start_object",
"(",
"self",
",",
"obj",
")",
":",
"raise",
"NotImplementedError",
"(",
"'subclasses of Serializer must provide a start_object() method'",
")"
] | [
132,
4
] | [
136,
98
] | python | en | ['en', 'error', 'th'] | False |
Serializer.end_object | (self, obj) |
Called when serializing of an object ends.
|
Called when serializing of an object ends.
| def end_object(self, obj):
"""
Called when serializing of an object ends.
"""
pass | [
"def",
"end_object",
"(",
"self",
",",
"obj",
")",
":",
"pass"
] | [
138,
4
] | [
142,
12
] | python | en | ['en', 'error', 'th'] | False |
Serializer.handle_field | (self, obj, field) |
Called to handle each individual (non-relational) field on an object.
|
Called to handle each individual (non-relational) field on an object.
| def handle_field(self, obj, field):
"""
Called to handle each individual (non-relational) field on an object.
"""
raise NotImplementedError('subclasses of Serializer must provide a handle_field() method') | [
"def",
"handle_field",
"(",
"self",
",",
"obj",
",",
"field",
")",
":",
"raise",
"NotImplementedError",
"(",
"'subclasses of Serializer must provide a handle_field() method'",
")"
] | [
144,
4
] | [
148,
98
] | python | en | ['en', 'error', 'th'] | False |
Serializer.handle_fk_field | (self, obj, field) |
Called to handle a ForeignKey field.
|
Called to handle a ForeignKey field.
| def handle_fk_field(self, obj, field):
"""
Called to handle a ForeignKey field.
"""
raise NotImplementedError('subclasses of Serializer must provide a handle_fk_field() method') | [
"def",
"handle_fk_field",
"(",
"self",
",",
"obj",
",",
"field",
")",
":",
"raise",
"NotImplementedError",
"(",
"'subclasses of Serializer must provide a handle_fk_field() method'",
")"
] | [
150,
4
] | [
154,
101
] | python | en | ['en', 'error', 'th'] | False |
Serializer.handle_m2m_field | (self, obj, field) |
Called to handle a ManyToManyField.
|
Called to handle a ManyToManyField.
| def handle_m2m_field(self, obj, field):
"""
Called to handle a ManyToManyField.
"""
raise NotImplementedError('subclasses of Serializer must provide a handle_m2m_field() method') | [
"def",
"handle_m2m_field",
"(",
"self",
",",
"obj",
",",
"field",
")",
":",
"raise",
"NotImplementedError",
"(",
"'subclasses of Serializer must provide a handle_m2m_field() method'",
")"
] | [
156,
4
] | [
160,
102
] | python | en | ['en', 'error', 'th'] | False |
Serializer.getvalue | (self) |
Return the fully serialized queryset (or None if the output stream is
not seekable).
|
Return the fully serialized queryset (or None if the output stream is
not seekable).
| def getvalue(self):
"""
Return the fully serialized queryset (or None if the output stream is
not seekable).
"""
if callable(getattr(self.stream, 'getvalue', None)):
return self.stream.getvalue() | [
"def",
"getvalue",
"(",
"self",
")",
":",
"if",
"callable",
"(",
"getattr",
"(",
"self",
".",
"stream",
",",
"'getvalue'",
",",
"None",
")",
")",
":",
"return",
"self",
".",
"stream",
".",
"getvalue",
"(",
")"
] | [
162,
4
] | [
168,
41
] | python | en | ['en', 'error', 'th'] | False |
Deserializer.__init__ | (self, stream_or_string, **options) |
Init this serializer given a stream or a string
|
Init this serializer given a stream or a string
| def __init__(self, stream_or_string, **options):
"""
Init this serializer given a stream or a string
"""
self.options = options
if isinstance(stream_or_string, str):
self.stream = StringIO(stream_or_string)
else:
self.stream = stream_or_string | [
"def",
"__init__",
"(",
"self",
",",
"stream_or_string",
",",
"*",
"*",
"options",
")",
":",
"self",
".",
"options",
"=",
"options",
"if",
"isinstance",
"(",
"stream_or_string",
",",
"str",
")",
":",
"self",
".",
"stream",
"=",
"StringIO",
"(",
"stream_o... | [
176,
4
] | [
184,
42
] | python | en | ['en', 'error', 'th'] | False |
Deserializer.__next__ | (self) | Iteration interface -- return the next item in the stream | Iteration interface -- return the next item in the stream | def __next__(self):
"""Iteration interface -- return the next item in the stream"""
raise NotImplementedError('subclasses of Deserializer must provide a __next__() method') | [
"def",
"__next__",
"(",
"self",
")",
":",
"raise",
"NotImplementedError",
"(",
"'subclasses of Deserializer must provide a __next__() method'",
")"
] | [
189,
4
] | [
191,
96
] | python | en | ['en', 'en', 'en'] | True |
DebugLexer.tokenize | (self) | Return a list of tokens from a given template_string | Return a list of tokens from a given template_string | def tokenize(self):
"Return a list of tokens from a given template_string"
result, upto = [], 0
for match in tag_re.finditer(self.template_string):
start, end = match.span()
if start > upto:
result.append(self.create_token(self.template_string[upto:start],... | [
"def",
"tokenize",
"(",
"self",
")",
":",
"result",
",",
"upto",
"=",
"[",
"]",
",",
"0",
"for",
"match",
"in",
"tag_re",
".",
"finditer",
"(",
"self",
".",
"template_string",
")",
":",
"start",
",",
"end",
"=",
"match",
".",
"span",
"(",
")",
"i... | [
12,
4
] | [
25,
21
] | python | en | ['en', 'en', 'en'] | True |
sentence | () |
Return a randomly generated sentence of lorem ipsum text.
The first word is capitalized, and the sentence ends in either a period or
question mark. Commas are added at random.
|
Return a randomly generated sentence of lorem ipsum text. | def sentence():
"""
Return a randomly generated sentence of lorem ipsum text.
The first word is capitalized, and the sentence ends in either a period or
question mark. Commas are added at random.
"""
# Determine the number of comma-separated sections and number of words in
# each section fo... | [
"def",
"sentence",
"(",
")",
":",
"# Determine the number of comma-separated sections and number of words in",
"# each section for this sentence.",
"sections",
"=",
"[",
"' '",
".",
"join",
"(",
"random",
".",
"sample",
"(",
"WORDS",
",",
"random",
".",
"randint",
"(",
... | [
55,
0
] | [
67,
64
] | python | en | ['en', 'error', 'th'] | False |
paragraph | () |
Return a randomly generated paragraph of lorem ipsum text.
The paragraph consists of between 1 and 4 sentences, inclusive.
|
Return a randomly generated paragraph of lorem ipsum text. | def paragraph():
"""
Return a randomly generated paragraph of lorem ipsum text.
The paragraph consists of between 1 and 4 sentences, inclusive.
"""
return ' '.join(sentence() for i in range(random.randint(1, 4))) | [
"def",
"paragraph",
"(",
")",
":",
"return",
"' '",
".",
"join",
"(",
"sentence",
"(",
")",
"for",
"i",
"in",
"range",
"(",
"random",
".",
"randint",
"(",
"1",
",",
"4",
")",
")",
")"
] | [
70,
0
] | [
76,
68
] | python | en | ['en', 'error', 'th'] | False |
paragraphs | (count, common=True) |
Return a list of paragraphs as returned by paragraph().
If `common` is True, then the first paragraph will be the standard
'lorem ipsum' paragraph. Otherwise, the first paragraph will be random
Latin text. Either way, subsequent paragraphs will be random Latin text.
|
Return a list of paragraphs as returned by paragraph(). | def paragraphs(count, common=True):
"""
Return a list of paragraphs as returned by paragraph().
If `common` is True, then the first paragraph will be the standard
'lorem ipsum' paragraph. Otherwise, the first paragraph will be random
Latin text. Either way, subsequent paragraphs will be random Lati... | [
"def",
"paragraphs",
"(",
"count",
",",
"common",
"=",
"True",
")",
":",
"paras",
"=",
"[",
"]",
"for",
"i",
"in",
"range",
"(",
"count",
")",
":",
"if",
"common",
"and",
"i",
"==",
"0",
":",
"paras",
".",
"append",
"(",
"COMMON_P",
")",
"else",
... | [
79,
0
] | [
93,
16
] | python | en | ['en', 'error', 'th'] | False |
words | (count, common=True) |
Return a string of `count` lorem ipsum words separated by a single space.
If `common` is True, then the first 19 words will be the standard
'lorem ipsum' words. Otherwise, all words will be selected randomly.
|
Return a string of `count` lorem ipsum words separated by a single space. | def words(count, common=True):
"""
Return a string of `count` lorem ipsum words separated by a single space.
If `common` is True, then the first 19 words will be the standard
'lorem ipsum' words. Otherwise, all words will be selected randomly.
"""
word_list = list(COMMON_WORDS) if common else [... | [
"def",
"words",
"(",
"count",
",",
"common",
"=",
"True",
")",
":",
"word_list",
"=",
"list",
"(",
"COMMON_WORDS",
")",
"if",
"common",
"else",
"[",
"]",
"c",
"=",
"len",
"(",
"word_list",
")",
"if",
"count",
">",
"c",
":",
"count",
"-=",
"c",
"w... | [
96,
0
] | [
113,
30
] | python | en | ['en', 'error', 'th'] | False |
_placeholdes_from_input_spec | (input_spec, input_prefix="INPUT_API") | Creates tf.placeholder for each of the entries in the input_spec. Returns a dictionary with the
mapping neuropod input name to the fully qualified tensorflow tensor name | Creates tf.placeholder for each of the entries in the input_spec. Returns a dictionary with the
mapping neuropod input name to the fully qualified tensorflow tensor name | def _placeholdes_from_input_spec(input_spec, input_prefix="INPUT_API"):
"""Creates tf.placeholder for each of the entries in the input_spec. Returns a dictionary with the
mapping neuropod input name to the fully qualified tensorflow tensor name"""
node_name_mapping = dict()
with tf.name_scope(input_pref... | [
"def",
"_placeholdes_from_input_spec",
"(",
"input_spec",
",",
"input_prefix",
"=",
"\"INPUT_API\"",
")",
":",
"node_name_mapping",
"=",
"dict",
"(",
")",
"with",
"tf",
".",
"name_scope",
"(",
"input_prefix",
")",
":",
"for",
"tensor_spec",
"in",
"input_spec",
"... | [
23,
0
] | [
45,
28
] | python | en | ['en', 'en', 'en'] | True |
_random_from_output_spec | (output_spec, output_prefix="OUTPUT_API") | Adds random matrix generators based on the output spec. Symbolic dimensions in shape definition are respected. | Adds random matrix generators based on the output spec. Symbolic dimensions in shape definition are respected. | def _random_from_output_spec(output_spec, output_prefix="OUTPUT_API"):
"""Adds random matrix generators based on the output spec. Symbolic dimensions in shape definition are respected."""
node_name_mapping = dict()
# Arbitrary choice of the number of elements in a variable size dimension: 1 to 100
def ... | [
"def",
"_random_from_output_spec",
"(",
"output_spec",
",",
"output_prefix",
"=",
"\"OUTPUT_API\"",
")",
":",
"node_name_mapping",
"=",
"dict",
"(",
")",
"# Arbitrary choice of the number of elements in a variable size dimension: 1 to 100",
"def",
"toss_random_dim",
"(",
")",
... | [
48,
0
] | [
104,
28
] | python | en | ['en', 'en', 'en'] | True |
randomify_neuropod | (output_path, input_spec, output_spec) | Uses neuropod input and output specs to automatically generate a neuropod package that complies to the spec and
produces random outputs.
This neuropod can be used as a stub, for testing purposes. A Tensorflow engine is used in the neuropod generated.
:param output_path: Output path where the neuropod will... | Uses neuropod input and output specs to automatically generate a neuropod package that complies to the spec and
produces random outputs. | def randomify_neuropod(output_path, input_spec, output_spec):
"""Uses neuropod input and output specs to automatically generate a neuropod package that complies to the spec and
produces random outputs.
This neuropod can be used as a stub, for testing purposes. A Tensorflow engine is used in the neuropod ge... | [
"def",
"randomify_neuropod",
"(",
"output_path",
",",
"input_spec",
",",
"output_spec",
")",
":",
"g",
"=",
"tf",
".",
"Graph",
"(",
")",
"with",
"g",
".",
"as_default",
"(",
")",
":",
"# Create a placeholder of a corresponding shape for each of the inputs in the inpu... | [
107,
0
] | [
137,
22
] | python | en | ['en', 'en', 'en'] | True |
GeoFeedMixin.georss_coords | (self, coords) |
In GeoRSS coordinate pairs are ordered by lat/lon and separated by
a single white space. Given a tuple of coordinates, return a string
GeoRSS representation.
|
In GeoRSS coordinate pairs are ordered by lat/lon and separated by
a single white space. Given a tuple of coordinates, return a string
GeoRSS representation.
| def georss_coords(self, coords):
"""
In GeoRSS coordinate pairs are ordered by lat/lon and separated by
a single white space. Given a tuple of coordinates, return a string
GeoRSS representation.
"""
return ' '.join('%f %f' % (coord[1], coord[0]) for coord in coords) | [
"def",
"georss_coords",
"(",
"self",
",",
"coords",
")",
":",
"return",
"' '",
".",
"join",
"(",
"'%f %f'",
"%",
"(",
"coord",
"[",
"1",
"]",
",",
"coord",
"[",
"0",
"]",
")",
"for",
"coord",
"in",
"coords",
")"
] | [
10,
4
] | [
16,
75
] | python | en | ['en', 'error', 'th'] | False |
GeoFeedMixin.add_georss_point | (self, handler, coords, w3c_geo=False) |
Adds a GeoRSS point with the given coords using the given handler.
Handles the differences between simple GeoRSS and the more popular
W3C Geo specification.
|
Adds a GeoRSS point with the given coords using the given handler.
Handles the differences between simple GeoRSS and the more popular
W3C Geo specification.
| def add_georss_point(self, handler, coords, w3c_geo=False):
"""
Adds a GeoRSS point with the given coords using the given handler.
Handles the differences between simple GeoRSS and the more popular
W3C Geo specification.
"""
if w3c_geo:
lon, lat = coords[:2]
... | [
"def",
"add_georss_point",
"(",
"self",
",",
"handler",
",",
"coords",
",",
"w3c_geo",
"=",
"False",
")",
":",
"if",
"w3c_geo",
":",
"lon",
",",
"lat",
"=",
"coords",
"[",
":",
"2",
"]",
"handler",
".",
"addQuickElement",
"(",
"'geo:lat'",
",",
"'%f'",... | [
18,
4
] | [
29,
82
] | python | en | ['en', 'error', 'th'] | False |
GeoFeedMixin.add_georss_element | (self, handler, item, w3c_geo=False) | Add a GeoRSS XML element using the given item and handler. | Add a GeoRSS XML element using the given item and handler. | def add_georss_element(self, handler, item, w3c_geo=False):
"""Add a GeoRSS XML element using the given item and handler."""
# Getting the Geometry object.
geom = item.get('geometry')
if geom is not None:
if isinstance(geom, (list, tuple)):
# Special case if a... | [
"def",
"add_georss_element",
"(",
"self",
",",
"handler",
",",
"item",
",",
"w3c_geo",
"=",
"False",
")",
":",
"# Getting the Geometry object.",
"geom",
"=",
"item",
".",
"get",
"(",
"'geometry'",
")",
"if",
"geom",
"is",
"not",
"None",
":",
"if",
"isinsta... | [
31,
4
] | [
76,
94
] | python | en | ['en', 'en', 'en'] | True |
test_passthrough_context | () |
Test to ensure that context is passed through implicitly from outside of
the crispy form into the crispy form templates.
|
Test to ensure that context is passed through implicitly from outside of
the crispy form into the crispy form templates.
| def test_passthrough_context():
"""
Test to ensure that context is passed through implicitly from outside of
the crispy form into the crispy form templates.
"""
form = SampleForm()
form.helper = FormHelper()
form.helper.template = "custom_form_template_with_context.html"
c = {"... | [
"def",
"test_passthrough_context",
"(",
")",
":",
"form",
"=",
"SampleForm",
"(",
")",
"form",
".",
"helper",
"=",
"FormHelper",
"(",
")",
"form",
".",
"helper",
".",
"template",
"=",
"\"custom_form_template_with_context.html\"",
"c",
"=",
"{",
"\"prefix\"",
"... | [
905,
0
] | [
918,
36
] | python | en | ['en', 'ja', 'th'] | False |
Storage.open | (self, name, mode='rb') |
Retrieves the specified file from storage.
|
Retrieves the specified file from storage.
| def open(self, name, mode='rb'):
"""
Retrieves the specified file from storage.
"""
return self._open(name, mode) | [
"def",
"open",
"(",
"self",
",",
"name",
",",
"mode",
"=",
"'rb'",
")",
":",
"return",
"self",
".",
"_open",
"(",
"name",
",",
"mode",
")"
] | [
30,
4
] | [
34,
37
] | python | en | ['en', 'error', 'th'] | False |
Storage.save | (self, name, content) |
Saves new content to the file specified by name. The content should be
a proper File object or any python file-like object, ready to be read
from the beginning.
|
Saves new content to the file specified by name. The content should be
a proper File object or any python file-like object, ready to be read
from the beginning.
| def save(self, name, content):
"""
Saves new content to the file specified by name. The content should be
a proper File object or any python file-like object, ready to be read
from the beginning.
"""
# Get the proper name for the file, as it will actually be saved.
... | [
"def",
"save",
"(",
"self",
",",
"name",
",",
"content",
")",
":",
"# Get the proper name for the file, as it will actually be saved.",
"if",
"name",
"is",
"None",
":",
"name",
"=",
"content",
".",
"name",
"if",
"not",
"hasattr",
"(",
"content",
",",
"'chunks'",... | [
36,
4
] | [
53,
50
] | python | en | ['en', 'error', 'th'] | False |
Storage.get_valid_name | (self, name) |
Returns a filename, based on the provided filename, that's suitable for
use in the target storage system.
|
Returns a filename, based on the provided filename, that's suitable for
use in the target storage system.
| def get_valid_name(self, name):
"""
Returns a filename, based on the provided filename, that's suitable for
use in the target storage system.
"""
return get_valid_filename(name) | [
"def",
"get_valid_name",
"(",
"self",
",",
"name",
")",
":",
"return",
"get_valid_filename",
"(",
"name",
")"
] | [
57,
4
] | [
62,
39
] | python | en | ['en', 'error', 'th'] | False |
Storage.get_available_name | (self, name) |
Returns a filename that's free on the target storage system, and
available for new content to be written to.
|
Returns a filename that's free on the target storage system, and
available for new content to be written to.
| def get_available_name(self, name):
"""
Returns a filename that's free on the target storage system, and
available for new content to be written to.
"""
dir_name, file_name = os.path.split(name)
file_root, file_ext = os.path.splitext(file_name)
# If the filename a... | [
"def",
"get_available_name",
"(",
"self",
",",
"name",
")",
":",
"dir_name",
",",
"file_name",
"=",
"os",
".",
"path",
".",
"split",
"(",
"name",
")",
"file_root",
",",
"file_ext",
"=",
"os",
".",
"path",
".",
"splitext",
"(",
"file_name",
")",
"# If t... | [
64,
4
] | [
78,
19
] | python | en | ['en', 'error', 'th'] | False |
Storage.path | (self, name) |
Returns a local filesystem path where the file can be retrieved using
Python's built-in open() function. Storage systems that can't be
accessed using open() should *not* implement this method.
|
Returns a local filesystem path where the file can be retrieved using
Python's built-in open() function. Storage systems that can't be
accessed using open() should *not* implement this method.
| def path(self, name):
"""
Returns a local filesystem path where the file can be retrieved using
Python's built-in open() function. Storage systems that can't be
accessed using open() should *not* implement this method.
"""
raise NotImplementedError("This backend doesn't s... | [
"def",
"path",
"(",
"self",
",",
"name",
")",
":",
"raise",
"NotImplementedError",
"(",
"\"This backend doesn't support absolute paths.\"",
")"
] | [
80,
4
] | [
86,
81
] | python | en | ['en', 'error', 'th'] | False |
Storage.delete | (self, name) |
Deletes the specified file from the storage system.
|
Deletes the specified file from the storage system.
| def delete(self, name):
"""
Deletes the specified file from the storage system.
"""
raise NotImplementedError('subclasses of Storage must provide a delete() method') | [
"def",
"delete",
"(",
"self",
",",
"name",
")",
":",
"raise",
"NotImplementedError",
"(",
"'subclasses of Storage must provide a delete() method'",
")"
] | [
91,
4
] | [
95,
89
] | python | en | ['en', 'error', 'th'] | False |
Storage.exists | (self, name) |
Returns True if a file referenced by the given name already exists in the
storage system, or False if the name is available for a new file.
|
Returns True if a file referenced by the given name already exists in the
storage system, or False if the name is available for a new file.
| def exists(self, name):
"""
Returns True if a file referenced by the given name already exists in the
storage system, or False if the name is available for a new file.
"""
raise NotImplementedError('subclasses of Storage must provide an exists() method') | [
"def",
"exists",
"(",
"self",
",",
"name",
")",
":",
"raise",
"NotImplementedError",
"(",
"'subclasses of Storage must provide an exists() method'",
")"
] | [
97,
4
] | [
102,
90
] | python | en | ['en', 'error', 'th'] | False |
Storage.listdir | (self, path) |
Lists the contents of the specified path, returning a 2-tuple of lists;
the first item being directories, the second item being files.
|
Lists the contents of the specified path, returning a 2-tuple of lists;
the first item being directories, the second item being files.
| def listdir(self, path):
"""
Lists the contents of the specified path, returning a 2-tuple of lists;
the first item being directories, the second item being files.
"""
raise NotImplementedError('subclasses of Storage must provide a listdir() method') | [
"def",
"listdir",
"(",
"self",
",",
"path",
")",
":",
"raise",
"NotImplementedError",
"(",
"'subclasses of Storage must provide a listdir() method'",
")"
] | [
104,
4
] | [
109,
90
] | python | en | ['en', 'error', 'th'] | False |
Storage.size | (self, name) |
Returns the total size, in bytes, of the file specified by name.
|
Returns the total size, in bytes, of the file specified by name.
| def size(self, name):
"""
Returns the total size, in bytes, of the file specified by name.
"""
raise NotImplementedError('subclasses of Storage must provide a size() method') | [
"def",
"size",
"(",
"self",
",",
"name",
")",
":",
"raise",
"NotImplementedError",
"(",
"'subclasses of Storage must provide a size() method'",
")"
] | [
111,
4
] | [
115,
87
] | python | en | ['en', 'error', 'th'] | False |
Storage.url | (self, name) |
Returns an absolute URL where the file's contents can be accessed
directly by a Web browser.
|
Returns an absolute URL where the file's contents can be accessed
directly by a Web browser.
| def url(self, name):
"""
Returns an absolute URL where the file's contents can be accessed
directly by a Web browser.
"""
raise NotImplementedError('subclasses of Storage must provide a url() method') | [
"def",
"url",
"(",
"self",
",",
"name",
")",
":",
"raise",
"NotImplementedError",
"(",
"'subclasses of Storage must provide a url() method'",
")"
] | [
117,
4
] | [
122,
86
] | python | en | ['en', 'error', 'th'] | False |
Storage.accessed_time | (self, name) |
Returns the last accessed time (as datetime object) of the file
specified by name.
|
Returns the last accessed time (as datetime object) of the file
specified by name.
| def accessed_time(self, name):
"""
Returns the last accessed time (as datetime object) of the file
specified by name.
"""
raise NotImplementedError('subclasses of Storage must provide an accessed_time() method') | [
"def",
"accessed_time",
"(",
"self",
",",
"name",
")",
":",
"raise",
"NotImplementedError",
"(",
"'subclasses of Storage must provide an accessed_time() method'",
")"
] | [
124,
4
] | [
129,
97
] | python | en | ['en', 'error', 'th'] | False |
Storage.created_time | (self, name) |
Returns the creation time (as datetime object) of the file
specified by name.
|
Returns the creation time (as datetime object) of the file
specified by name.
| def created_time(self, name):
"""
Returns the creation time (as datetime object) of the file
specified by name.
"""
raise NotImplementedError('subclasses of Storage must provide a created_time() method') | [
"def",
"created_time",
"(",
"self",
",",
"name",
")",
":",
"raise",
"NotImplementedError",
"(",
"'subclasses of Storage must provide a created_time() method'",
")"
] | [
131,
4
] | [
136,
95
] | python | en | ['en', 'error', 'th'] | False |
Storage.modified_time | (self, name) |
Returns the last modified time (as datetime object) of the file
specified by name.
|
Returns the last modified time (as datetime object) of the file
specified by name.
| def modified_time(self, name):
"""
Returns the last modified time (as datetime object) of the file
specified by name.
"""
raise NotImplementedError('subclasses of Storage must provide a modified_time() method') | [
"def",
"modified_time",
"(",
"self",
",",
"name",
")",
":",
"raise",
"NotImplementedError",
"(",
"'subclasses of Storage must provide a modified_time() method'",
")"
] | [
138,
4
] | [
143,
96
] | python | en | ['en', 'error', 'th'] | False |
MicroPy.setup | (self) | Creates necessary directories for micropy. | Creates necessary directories for micropy. | def setup(self):
"""Creates necessary directories for micropy."""
self.log.debug("Running first time setup...")
self.log.debug(f"Creating .micropy directory @ {data.FILES}")
data.FILES.mkdir(exist_ok=True)
data.STUB_DIR.mkdir() | [
"def",
"setup",
"(",
"self",
")",
":",
"self",
".",
"log",
".",
"debug",
"(",
"\"Running first time setup...\"",
")",
"self",
".",
"log",
".",
"debug",
"(",
"f\"Creating .micropy directory @ {data.FILES}\"",
")",
"data",
".",
"FILES",
".",
"mkdir",
"(",
"exist... | [
27,
4
] | [
32,
29
] | python | en | ['en', 'en', 'en'] | True |
MicroPy.stubs | (self) | Primary Stub Manager for MicroPy.
Returns:
StubManager: StubManager Instance
| Primary Stub Manager for MicroPy. | def stubs(self):
"""Primary Stub Manager for MicroPy.
Returns:
StubManager: StubManager Instance
"""
repo_list = data.REPO_SOURCES.read_text()
repos = source.StubRepo.from_json(repo_list)
return StubManager(resource=data.STUB_DIR, repos=repos) | [
"def",
"stubs",
"(",
"self",
")",
":",
"repo_list",
"=",
"data",
".",
"REPO_SOURCES",
".",
"read_text",
"(",
")",
"repos",
"=",
"source",
".",
"StubRepo",
".",
"from_json",
"(",
"repo_list",
")",
"return",
"StubManager",
"(",
"resource",
"=",
"data",
"."... | [
35,
4
] | [
44,
63
] | python | en | ['en', 'en', 'en'] | True |
MicroPy.project | (self) | Current active project if available.
Returns:
Project: Instance of Current Project
| Current active project if available. | def project(self):
"""Current active project if available.
Returns:
Project: Instance of Current Project
"""
proj = self.resolve_project(".", verbose=self.verbose)
return proj | [
"def",
"project",
"(",
"self",
")",
":",
"proj",
"=",
"self",
".",
"resolve_project",
"(",
"\".\"",
",",
"verbose",
"=",
"self",
".",
"verbose",
")",
"return",
"proj"
] | [
47,
4
] | [
55,
19
] | python | en | ['en', 'en', 'en'] | True |
MicroPy.resolve_project | (self, path, verbose=True) | Returns project from path if it exists.
Args:
path (str): Path to test
verbose (bool): Log to stdout. Defaults to True.
Returns:
Project if it exists
| Returns project from path if it exists. | def resolve_project(self, path, verbose=True):
"""Returns project from path if it exists.
Args:
path (str): Path to test
verbose (bool): Log to stdout. Defaults to True.
Returns:
Project if it exists
"""
path = Path(path).absolute()
... | [
"def",
"resolve_project",
"(",
"self",
",",
"path",
",",
"verbose",
"=",
"True",
")",
":",
"path",
"=",
"Path",
"(",
"path",
")",
".",
"absolute",
"(",
")",
"proj",
"=",
"Project",
"(",
"path",
")",
"proj",
".",
"add",
"(",
"modules",
".",
"StubsMo... | [
57,
4
] | [
81,
19
] | python | en | ['en', 'en', 'en'] | True |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.