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
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', 'error', '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 ParseResu...
Returns the parse results as a nested list of matching tokens, all converted to strings.
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, it is...
[ "def", "asList", "(", "self", ")", ":", "return", "[", "res", ".", "asList", "(", ")", "if", "isinstance", "(", "res", ",", "ParseResults", ")", "else", "res", "for", "res", "in", "self", ".", "__toklist", "]" ]
[ 703, 4 ]
[ 717, 96 ]
python
en
['en', 'error', '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(result)) #...
Returns the named parse results as a nested dictionary.
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') prin...
[ "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', 'error', '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', 'error', '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) in se...
[ "def", "asXML", "(", "self", ",", "doctag", "=", "None", ",", "namedItemsOnly", "=", "False", ",", "indent", "=", "\"\"", ",", "formatted", "=", "True", ")", ":", "nl", "=", "\"\\n\"", "out", "=", "[", "]", "namedItems", "=", "dict", "(", "(", "v",...
[ 765, 4 ]
[ 824, 27 ]
python
en
['en', 'error', '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(nums, a...
r""" Returns the results name for this token expression. Useful when several different expressions might match at a particular location.
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_expr = S...
[ "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("month") ...
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.
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', 'error', '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})
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}) Example:: ...
[ "def", "pprint", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "pprint", ".", "pprint", "(", "self", ".", "asList", "(", ")", ",", "*", "args", ",", "*", "*", "kwargs", ")" ]
[ 915, 4 ]
[ 936, 53 ]
python
en
['en', 'error', '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
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'] # cha...
[ "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.parseStrin...
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")
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("day") ...
[ "def", "inlineLiteralsUsing", "(", "cls", ")", ":", "ParserElement", ".", "_literalStringClass", "=", "cls" ]
[ 1123, 4 ]
[ 1141, 47 ]
python
en
['en', 'error', '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().addPar...
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().addPar...
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])) int...
[ "def", "copy", "(", "self", ")", ":", "cpy", "=", "copy", ".", "copy", "(", "self", ")", "cpy", ".", "parseAction", "=", "self", ".", "parseAction", "[", ":", "]", "cpy", ".", "ignoreExprs", "=", "self", ".", "ignoreExprs", "[", ":", "]", "if", "...
[ 1166, 4 ]
[ 1187, 18 ]
python
en
['en', 'error', '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 integer...
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 integer...
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").parseString("A...
[ "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', 'error', '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 places wi...
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 places wi...
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 element,...
[ "def", "setResultsName", "(", "self", ",", "name", ",", "listAllMatches", "=", "False", ")", ":", "newself", "=", "self", ".", "copy", "(", ")", "if", "name", ".", "endswith", "(", "\"*\"", ")", ":", "name", "=", "name", "[", ":", "-", "1", "]", ...
[ 1203, 4 ]
[ 1229, 22 ]
python
en
['en', 'error', '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, loc, do...
[ "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 belo...
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 belo...
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', 'error', '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.callDur...
[ "def", "addParseAction", "(", "self", ",", "*", "fns", ",", "*", "*", "kwargs", ")", ":", "self", ".", "parseAction", "+=", "list", "(", "map", "(", "_trim_arity", ",", "list", "(", "fns", ")", ")", ")", "self", ".", "callDuringTry", "=", "self", "...
[ 1287, 4 ]
[ 1295, 19 ]
python
en
['en', 'error', '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.
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 con...
[ "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 parse...
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 parse...
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 attempted...
[ "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 par...
[ "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 to en...
Execute the parse expression with the given string. This is the main interface to the client code, once the complete expression has been built.
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 succe...
[ "def", "parseString", "(", "self", ",", "instring", ",", "parseAll", "=", "False", ")", ":", "ParserElement", ".", "resetCache", "(", ")", "if", "not", "self", ".", "streamlined", ":", "self", ".", "streamline", "(", ")", "#~ self.saveAsList = True", "for", ...
[ 1607, 4 ]
[ 1655, 25 ]
python
en
['en', 'error', '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 be r...
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 be r...
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' matches a...
[ "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', 'error', '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 will...
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 will...
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. Inv...
[ "def", "transformString", "(", "self", ",", "instring", ")", ":", "out", "=", "[", "]", "lastE", "=", "0", "# force preservation of <TAB>s, to minimize unwanted transformation of string, and to", "# keep string locs straight between transformString and scanString", "self", ".", ...
[ 1728, 4 ]
[ 1769, 25 ]
python
en
['en', 'error', '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 with an u...
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 with an u...
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', 'error', '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 spl...
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 spl...
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 (defaul...
[ "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', 'error', '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.parseString(hello...
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.parseString(hello...
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!" print...
[ "def", "__add__", "(", "self", ",", "other", ")", ":", "if", "isinstance", "(", "other", ",", "basestring", ")", ":", "other", "=", "ParserElement", ".", "_literalStringClass", "(", "other", ")", "if", "not", "isinstance", "(", "other", ",", "ParserElement...
[ 1820, 4 ]
[ 1838, 37 ]
python
en
['en', 'error', '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 ): warnings.warn(...
[ "def", "__radd__", "(", "self", ",", "other", ")", ":", "if", "isinstance", "(", "other", ",", "basestring", ")", ":", "other", "=", "ParserElement", ".", "_literalStringClass", "(", "other", ")", "if", "not", "isinstance", "(", "other", ",", "ParserElemen...
[ 1840, 4 ]
[ 1850, 27 ]
python
en
['en', 'error', '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 combin...
[ "def", "__sub__", "(", "self", ",", "other", ")", ":", "if", "isinstance", "(", "other", ",", "basestring", ")", ":", "other", "=", "ParserElement", ".", "_literalStringClass", "(", "other", ")", "if", "not", "isinstance", "(", "other", ",", "ParserElement...
[ 1852, 4 ]
[ 1862, 46 ]
python
en
['en', 'error', '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 ): warnings.warn(...
[ "def", "__rsub__", "(", "self", ",", "other", ")", ":", "if", "isinstance", "(", "other", ",", "basestring", ")", ":", "other", "=", "ParserElement", ".", "_literalStringClass", "(", "other", ")", "if", "not", "isinstance", "(", "other", ",", "ParserElemen...
[ 1864, 4 ]
[ 1874, 27 ]
python
en
['en', 'error', '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{expr*...
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{expr*...
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 in: ...
[ "def", "__mul__", "(", "self", ",", "other", ")", ":", "if", "isinstance", "(", "other", ",", "int", ")", ":", "minElements", ",", "optElements", "=", "other", ",", "0", "elif", "isinstance", "(", "other", ",", "tuple", ")", ":", "other", "=", "(", ...
[ 1876, 4 ]
[ 1942, 18 ]
python
en
['en', 'error', '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 elemen...
[ "def", "__or__", "(", "self", ",", "other", ")", ":", "if", "isinstance", "(", "other", ",", "basestring", ")", ":", "other", "=", "ParserElement", ".", "_literalStringClass", "(", "other", ")", "if", "not", "isinstance", "(", "other", ",", "ParserElement"...
[ 1947, 4 ]
[ 1957, 44 ]
python
en
['en', 'error', '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.warn("...
[ "def", "__ror__", "(", "self", ",", "other", ")", ":", "if", "isinstance", "(", "other", ",", "basestring", ")", ":", "other", "=", "ParserElement", ".", "_literalStringClass", "(", "other", ")", "if", "not", "isinstance", "(", "other", ",", "ParserElement...
[ 1959, 4 ]
[ 1969, 27 ]
python
en
['en', 'error', '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 element of ty...
[ "def", "__xor__", "(", "self", ",", "other", ")", ":", "if", "isinstance", "(", "other", ",", "basestring", ")", ":", "other", "=", "ParserElement", ".", "_literalStringClass", "(", "other", ")", "if", "not", "isinstance", "(", "other", ",", "ParserElement...
[ 1971, 4 ]
[ 1981, 36 ]
python
en
['en', 'error', '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 ): warnings.warn(...
[ "def", "__rxor__", "(", "self", ",", "other", ")", ":", "if", "isinstance", "(", "other", ",", "basestring", ")", ":", "other", "=", "ParserElement", ".", "_literalStringClass", "(", "other", ")", "if", "not", "isinstance", "(", "other", ",", "ParserElemen...
[ 1983, 4 ]
[ 1993, 27 ]
python
en
['en', 'error', '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 element of ...
[ "def", "__and__", "(", "self", ",", "other", ")", ":", "if", "isinstance", "(", "other", ",", "basestring", ")", ":", "other", "=", "ParserElement", ".", "_literalStringClass", "(", "other", ")", "if", "not", "isinstance", "(", "other", ",", "ParserElement...
[ 1995, 4 ]
[ 2005, 38 ]
python
en
['en', 'error', '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 ): warnings.warn(...
[ "def", "__rand__", "(", "self", ",", "other", ")", ":", "if", "isinstance", "(", "other", ",", "basestring", ")", ":", "other", "=", "ParserElement", ".", "_literalStringClass", "(", "other", ")", "if", "not", "isinstance", "(", "other", ",", "ParserElemen...
[ 2007, 4 ]
[ 2017, 27 ]
python
en
['en', 'error', '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', 'error', '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:: # these are equ...
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): """ 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', 'error', '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', 'error', '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. """ self...
[ "def", "leaveWhitespace", "(", "self", ")", ":", "self", ".", "skipWhitespace", "=", "False", "return", "self" ]
[ 2051, 4 ]
[ 2058, 19 ]
python
en
['en', 'error', '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', 'error', '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 return s...
[ "def", "parseWithTabs", "(", "self", ")", ":", "self", ".", "keepTabs", "=", "True", "return", "self" ]
[ 2069, 4 ]
[ 2076, 19 ]
python
en
['en', 'error', '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.parseStri...
[ "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', 'error', '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', 'error', '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 # turn o...
Enable display of debugging messages while doing pattern matching. Set C{flag} to True to enable, False to disable.
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") term = wd...
[ "def", "setDebug", "(", "self", ",", "flag", "=", "True", ")", ":", "if", "flag", ":", "self", ".", "setDebugActions", "(", "_defaultStartDebugAction", ",", "_defaultSuccessDebugAction", ",", "_defaultExceptionDebugAction", ")", "else", ":", "self", ".", "debug"...
[ 2111, 4 ]
[ 2150, 19 ]
python
en
['en', 'error', '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', 'error', '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_contents =...
[ "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', 'error', '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 pass t...
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 pass t...
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 match...
[ "def", "matches", "(", "self", ",", "testString", ",", "parseAll", "=", "True", ")", ":", "try", ":", "self", ".", "parseString", "(", "_ustr", "(", "testString", ")", ",", "parseAll", "=", "parseAll", ")", "return", "True", "except", "ParseBaseException",...
[ 2212, 4 ]
[ 2229, 24 ]
python
en
['en', 'error', '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 a mult...
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 a mult...
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 against...
[ "def", "runTests", "(", "self", ",", "tests", ",", "parseAll", "=", "True", ",", "comment", "=", "'#'", ",", "fullDump", "=", "True", ",", "printResults", "=", "True", ",", "failureTests", "=", "False", ")", ":", "if", "isinstance", "(", "tests", ",", ...
[ 2231, 4 ]
[ 2360, 34 ]
python
en
['en', 'error', 'th']
False
flavor_list
(request)
Utility method to retrieve a list of flavors.
Utility method to retrieve a list of flavors.
def flavor_list(request): """Utility method to retrieve a list of flavors.""" try: return api.nova.flavor_list(request) except Exception: exceptions.handle(request, _('Unable to retrieve instance flavors.')) return []
[ "def", "flavor_list", "(", "request", ")", ":", "try", ":", "return", "api", ".", "nova", ".", "flavor_list", "(", "request", ")", "except", "Exception", ":", "exceptions", ".", "handle", "(", "request", ",", "_", "(", "'Unable to retrieve instance flavors.'",...
[ 26, 0 ]
[ 33, 17 ]
python
en
['en', 'en', 'en']
True
sort_flavor_list
(request, flavors, with_menu_label=True)
Utility method to sort a list of flavors. By default, returns the available flavors, sorted by RAM usage (ascending). Override these behaviours with a ``CREATE_INSTANCE_FLAVOR_SORT`` dict in ``local_settings.py``.
Utility method to sort a list of flavors.
def sort_flavor_list(request, flavors, with_menu_label=True): """Utility method to sort a list of flavors. By default, returns the available flavors, sorted by RAM usage (ascending). Override these behaviours with a ``CREATE_INSTANCE_FLAVOR_SORT`` dict in ``local_settings.py``. """ def get_key(...
[ "def", "sort_flavor_list", "(", "request", ",", "flavors", ",", "with_menu_label", "=", "True", ")", ":", "def", "get_key", "(", "flavor", ",", "sort_key", ")", ":", "try", ":", "return", "getattr", "(", "flavor", ",", "sort_key", ")", "except", "Attribute...
[ 36, 0 ]
[ 69, 17 ]
python
en
['en', 'en', 'en']
True
server_group_list
(request)
Utility method to retrieve a list of server groups.
Utility method to retrieve a list of server groups.
def server_group_list(request): """Utility method to retrieve a list of server groups.""" try: return api.nova.server_group_list(request) except Exception: exceptions.handle(request, _('Unable to retrieve Nova server groups.')) return []
[ "def", "server_group_list", "(", "request", ")", ":", "try", ":", "return", "api", ".", "nova", ".", "server_group_list", "(", "request", ")", "except", "Exception", ":", "exceptions", ".", "handle", "(", "request", ",", "_", "(", "'Unable to retrieve Nova ser...
[ 72, 0 ]
[ 79, 17 ]
python
en
['en', 'pt', 'en']
True
network_field_data
(request, include_empty_option=False, with_cidr=False, for_launch=False)
Returns a list of tuples of all networks. Generates a list of networks available to the user (request). And returns a list of (id, name) tuples. :param request: django http request object :param include_empty_option: flag to include a empty tuple in the front of the list :param with_cidr:...
Returns a list of tuples of all networks.
def network_field_data(request, include_empty_option=False, with_cidr=False, for_launch=False): """Returns a list of tuples of all networks. Generates a list of networks available to the user (request). And returns a list of (id, name) tuples. :param request: django http request...
[ "def", "network_field_data", "(", "request", ",", "include_empty_option", "=", "False", ",", "with_cidr", "=", "False", ",", "for_launch", "=", "False", ")", ":", "tenant_id", "=", "request", ".", "user", ".", "tenant_id", "networks", "=", "[", "]", "if", ...
[ 82, 0 ]
[ 130, 19 ]
python
en
['en', 'en', 'en']
True
keypair_field_data
(request, include_empty_option=False)
Returns a list of tuples of all keypairs. Generates a list of keypairs available to the user (request). And returns a list of (id, name) tuples. :param request: django http request object :param include_empty_option: flag to include a empty tuple in the front of the list :return: list of (...
Returns a list of tuples of all keypairs.
def keypair_field_data(request, include_empty_option=False): """Returns a list of tuples of all keypairs. Generates a list of keypairs available to the user (request). And returns a list of (id, name) tuples. :param request: django http request object :param include_empty_option: flag to include a...
[ "def", "keypair_field_data", "(", "request", ",", "include_empty_option", "=", "False", ")", ":", "keypair_list", "=", "[", "]", "try", ":", "keypairs", "=", "api", ".", "nova", ".", "keypair_list", "(", "request", ")", "keypair_list", "=", "[", "(", "kp",...
[ 133, 0 ]
[ 158, 23 ]
python
en
['en', 'en', 'en']
True
flavor_field_data
(request, include_empty_option=False)
Returns a list of tuples of all image flavors. Generates a list of image flavors available. And returns a list of (id, name) tuples. :param request: django http request object :param include_empty_option: flag to include a empty tuple in the front of the list :return: list of (id, name) tu...
Returns a list of tuples of all image flavors.
def flavor_field_data(request, include_empty_option=False): """Returns a list of tuples of all image flavors. Generates a list of image flavors available. And returns a list of (id, name) tuples. :param request: django http request object :param include_empty_option: flag to include a empty tuple ...
[ "def", "flavor_field_data", "(", "request", ",", "include_empty_option", "=", "False", ")", ":", "flavors", "=", "flavor_list", "(", "request", ")", "if", "flavors", ":", "flavors_list", "=", "sort_flavor_list", "(", "request", ",", "flavors", ")", "if", "incl...
[ 161, 0 ]
[ 181, 13 ]
python
en
['en', 'en', 'en']
True
port_field_data
(request, with_network=False)
Returns a list of tuples of all ports available for the tenant. Generates a list of ports that have no device_owner based on the networks available to the tenant doing the request. :param request: django http request object :param with_network: include network name in field name :return: list of (...
Returns a list of tuples of all ports available for the tenant.
def port_field_data(request, with_network=False): """Returns a list of tuples of all ports available for the tenant. Generates a list of ports that have no device_owner based on the networks available to the tenant doing the request. :param request: django http request object :param with_network: ...
[ "def", "port_field_data", "(", "request", ",", "with_network", "=", "False", ")", ":", "def", "add_more_info_port_name", "(", "port", ",", "network", ")", ":", "# add more info to the port for the display", "port_name", "=", "\"{} ({})\"", ".", "format", "(", "port"...
[ 184, 0 ]
[ 217, 16 ]
python
en
['en', 'en', 'en']
True
server_group_field_data
(request)
Returns a list of tuples of all server groups. Generates a list of server groups available. And returns a list of (id, name) tuples. :param request: django http request object :return: list of (id, name) tuples
Returns a list of tuples of all server groups.
def server_group_field_data(request): """Returns a list of tuples of all server groups. Generates a list of server groups available. And returns a list of (id, name) tuples. :param request: django http request object :return: list of (id, name) tuples """ server_groups = server_group_list(...
[ "def", "server_group_field_data", "(", "request", ")", ":", "server_groups", "=", "server_group_list", "(", "request", ")", "if", "server_groups", ":", "server_groups_list", "=", "[", "(", "sg", ".", "id", ",", "sg", ".", "name", ")", "for", "sg", "in", "s...
[ 220, 0 ]
[ 235, 52 ]
python
en
['en', 'en', 'en']
True
interactive_debug
(sig: int, frame: FrameType)
Interrupt running process, and provide a python prompt for interactive debugging.
Interrupt running process, and provide a python prompt for interactive debugging.
def interactive_debug(sig: int, frame: FrameType) -> None: """Interrupt running process, and provide a python prompt for interactive debugging.""" d = {"_frame": frame} # Allow access to frame object. d.update(frame.f_globals) # Unless shadowed by global d.update(frame.f_locals) message = "Si...
[ "def", "interactive_debug", "(", "sig", ":", "int", ",", "frame", ":", "FrameType", ")", "->", "None", ":", "d", "=", "{", "\"_frame\"", ":", "frame", "}", "# Allow access to frame object.", "d", ".", "update", "(", "frame", ".", "f_globals", ")", "# Unles...
[ 22, 0 ]
[ 32, 23 ]
python
en
['en', 'en', 'en']
True
maybe_tracemalloc_listen
()
If tracemalloc tracing enabled, listen for requests to dump a snapshot. To trigger once this is listening: echo | socat -u stdin unix-sendto:/tmp/tracemalloc.$pid To enable in the Zulip web server: edit /etc/zulip/uwsgi.ini , and add e.g. ` PYTHONTRACEMALLOC=5` to the `env=` line. This function ...
If tracemalloc tracing enabled, listen for requests to dump a snapshot.
def maybe_tracemalloc_listen() -> None: """If tracemalloc tracing enabled, listen for requests to dump a snapshot. To trigger once this is listening: echo | socat -u stdin unix-sendto:/tmp/tracemalloc.$pid To enable in the Zulip web server: edit /etc/zulip/uwsgi.ini , and add e.g. ` PYTHONTRACEM...
[ "def", "maybe_tracemalloc_listen", "(", ")", "->", "None", ":", "if", "os", ".", "environ", ".", "get", "(", "\"PYTHONTRACEMALLOC\"", ")", ":", "# If the server was started with `tracemalloc` tracing on, then", "# listen for a signal to dump `tracemalloc` snapshots.", "tracemal...
[ 93, 0 ]
[ 112, 28 ]
python
en
['en', 'en', 'en']
True
render_curl_example
( function: str, api_url: str, exclude: Optional[List[str]] = None, include: Optional[List[str]] = None, )
A simple wrapper around generate_curl_example.
A simple wrapper around generate_curl_example.
def render_curl_example( function: str, api_url: str, exclude: Optional[List[str]] = None, include: Optional[List[str]] = None, ) -> List[str]: """A simple wrapper around generate_curl_example.""" parts = function.split(":") endpoint = parts[0] method = parts[1] kwargs: Dict[str, Any...
[ "def", "render_curl_example", "(", "function", ":", "str", ",", "api_url", ":", "str", ",", "exclude", ":", "Optional", "[", "List", "[", "str", "]", "]", "=", "None", ",", "include", ":", "Optional", "[", "List", "[", "str", "]", "]", "=", "None", ...
[ 333, 0 ]
[ 351, 60 ]
python
en
['de', 'en', 'en']
True
process_non_api_filters
(search_opts, non_api_filter_info)
Process filters by non-API fields There are cases where it is useful to provide a filter field which does not exist in a resource in a backend service. For example, nova server list provides 'image' field with image ID but 'image name' is more useful for GUI users. This function replaces fake field...
Process filters by non-API fields
def process_non_api_filters(search_opts, non_api_filter_info): """Process filters by non-API fields There are cases where it is useful to provide a filter field which does not exist in a resource in a backend service. For example, nova server list provides 'image' field with image ID but 'image nam...
[ "def", "process_non_api_filters", "(", "search_opts", ",", "non_api_filter_info", ")", ":", "for", "fake_field", ",", "real_field", ",", "resources", "in", "non_api_filter_info", ":", "if", "not", "_swap_filter", "(", "resources", ",", "search_opts", ",", "fake_fiel...
[ 226, 0 ]
[ 245, 15 ]
python
en
['en', 'en', 'en']
True
TestMetadataDefinitions.namespace_create_with_checks
( self, namespace_name, page, template_json_container, expected_namespace_res=None, template_source_type='raw', is_public=True, is_protected=False, template_path=None, checks=(PUBLIC, PROTECTED))
Create NameSpace and run checks :param namespace_name: Display name of namespace in template :param page: Connection point :param template_json_container: JSON container with NameSpace content :param expected_namespace_res: Resources from template :param template_source_type: 'r...
Create NameSpace and run checks
def namespace_create_with_checks( self, namespace_name, page, template_json_container, expected_namespace_res=None, template_source_type='raw', is_public=True, is_protected=False, template_path=None, checks=(PUBLIC, PROTECTED)): """Create NameSpace and run checks ...
[ "def", "namespace_create_with_checks", "(", "self", ",", "namespace_name", ",", "page", ",", "template_json_container", ",", "expected_namespace_res", "=", "None", ",", "template_source_type", "=", "'raw'", ",", "is_public", "=", "True", ",", "is_protected", "=", "F...
[ 27, 4 ]
[ 70, 61 ]
python
en
['en', 'mi', 'en']
True
TestMetadataDefinitions.namespace_delete_with_checks
(self, namespace_name, page)
Delete NameSpace and run checks :param namespace_name: Display name of namespace in template :param page: Connection point :return: Nothing
Delete NameSpace and run checks
def namespace_delete_with_checks(self, namespace_name, page): """Delete NameSpace and run checks :param namespace_name: Display name of namespace in template :param page: Connection point :return: Nothing """ page.delete_namespace(name=namespace_name) # Checks ...
[ "def", "namespace_delete_with_checks", "(", "self", ",", "namespace_name", ",", "page", ")", ":", "page", ".", "delete_namespace", "(", "name", "=", "namespace_name", ")", "# Checks", "self", ".", "assertTrue", "(", "page", ".", "find_message_and_dismiss", "(", ...
[ 72, 4 ]
[ 83, 67 ]
python
en
['en', 'it', 'en']
True
TestMetadataDefinitions.test_namespace_create_delete
(self)
Tests the NameSpace creation and deletion functionality: * Actions: * 1) Login to Horizon Dashboard as admin user. * 2) Navigate to Admin -> System -> Metadata Definitions. * 3) Click "Import Namespace" button. Wait for Create Network dialog. * 4) Enter settings for new Namespac...
Tests the NameSpace creation and deletion functionality:
def test_namespace_create_delete(self): """Tests the NameSpace creation and deletion functionality: * Actions: * 1) Login to Horizon Dashboard as admin user. * 2) Navigate to Admin -> System -> Metadata Definitions. * 3) Click "Import Namespace" button. Wait for Create Network d...
[ "def", "test_namespace_create_delete", "(", "self", ")", ":", "namespaces_page", "=", "self", ".", "home_pg", ".", "go_to_admin_system_metadatadefinitionspage", "(", ")", "template_json_container", "=", "namespaces_page", ".", "json_load_template", "(", "namespace_template_...
[ 85, 4 ]
[ 161, 74 ]
python
en
['en', 'en', 'en']
True
extract_angular
(fileobj, keywords, comment_tags, options)
Extract messages from angular template (HTML) files. It extract messages from angular template (HTML) files that use angular-gettext translate directive as per https://angular-gettext.rocketeer.be/ :param fileobj: the file-like object the messages should be extracted from :para...
Extract messages from angular template (HTML) files.
def extract_angular(fileobj, keywords, comment_tags, options): """Extract messages from angular template (HTML) files. It extract messages from angular template (HTML) files that use angular-gettext translate directive as per https://angular-gettext.rocketeer.be/ :param fileobj: the file-like obje...
[ "def", "extract_angular", "(", "fileobj", ",", "keywords", ",", "comment_tags", ",", "options", ")", ":", "parser", "=", "AngularGettextHTMLParser", "(", ")", "for", "line", "in", "fileobj", ":", "parser", ".", "feed", "(", "encodeutils", ".", "safe_decode", ...
[ 148, 0 ]
[ 173, 21 ]
python
en
['en', 'en', 'en']
True
SourceMap._index_for
(self, minified_src: str)
Return the source map index for minified_src, loading it if not already loaded.
Return the source map index for minified_src, loading it if not already loaded.
def _index_for(self, minified_src: str) -> Optional[sourcemap.SourceMapDecoder]: """Return the source map index for minified_src, loading it if not already loaded.""" # Prevent path traversal assert ".." not in minified_src and "/" not in minified_src if minified_src not in sel...
[ "def", "_index_for", "(", "self", ",", "minified_src", ":", "str", ")", "->", "Optional", "[", "sourcemap", ".", "SourceMapDecoder", "]", ":", "# Prevent path traversal", "assert", "\"..\"", "not", "in", "minified_src", "and", "\"/\"", "not", "in", "minified_src...
[ 16, 4 ]
[ 41, 46 ]
python
en
['en', 'en', 'en']
True
Wheel.__init__
(self, filename)
:raises InvalidWheelFilename: when the filename is invalid for a wheel
:raises InvalidWheelFilename: when the filename is invalid for a wheel
def __init__(self, filename): # type: (str) -> None """ :raises InvalidWheelFilename: when the filename is invalid for a wheel """ wheel_info = self.wheel_file_re.match(filename) if not wheel_info: raise InvalidWheelFilename( "{} is not a valid...
[ "def", "__init__", "(", "self", ",", "filename", ")", ":", "# type: (str) -> None", "wheel_info", "=", "self", ".", "wheel_file_re", ".", "match", "(", "filename", ")", "if", "not", "wheel_info", ":", "raise", "InvalidWheelFilename", "(", "\"{} is not a valid whee...
[ 24, 4 ]
[ 48, 9 ]
python
en
['en', 'error', 'th']
False
Wheel.get_formatted_file_tags
(self)
Return the wheel's tags as a sorted list of strings.
Return the wheel's tags as a sorted list of strings.
def get_formatted_file_tags(self): # type: () -> List[str] """Return the wheel's tags as a sorted list of strings.""" return sorted(str(tag) for tag in self.file_tags)
[ "def", "get_formatted_file_tags", "(", "self", ")", ":", "# type: () -> List[str]", "return", "sorted", "(", "str", "(", "tag", ")", "for", "tag", "in", "self", ".", "file_tags", ")" ]
[ 50, 4 ]
[ 53, 57 ]
python
en
['en', 'en', 'en']
True
Wheel.support_index_min
(self, tags)
Return the lowest index that one of the wheel's file_tag combinations achieves in the given list of supported tags. For example, if there are 8 supported tags and one of the file tags is first in the list, then return 0. :param tags: the PEP 425 tags to check the wheel against, in orde...
Return the lowest index that one of the wheel's file_tag combinations achieves in the given list of supported tags.
def support_index_min(self, tags): # type: (List[Tag]) -> int """Return the lowest index that one of the wheel's file_tag combinations achieves in the given list of supported tags. For example, if there are 8 supported tags and one of the file tags is first in the list, then ret...
[ "def", "support_index_min", "(", "self", ",", "tags", ")", ":", "# type: (List[Tag]) -> int", "return", "min", "(", "tags", ".", "index", "(", "tag", ")", "for", "tag", "in", "self", ".", "file_tags", "if", "tag", "in", "tags", ")" ]
[ 55, 4 ]
[ 69, 76 ]
python
en
['en', 'en', 'en']
True
Wheel.supported
(self, tags)
Return whether the wheel is compatible with one of the given tags. :param tags: the PEP 425 tags to check the wheel against.
Return whether the wheel is compatible with one of the given tags.
def supported(self, tags): # type: (List[Tag]) -> bool """Return whether the wheel is compatible with one of the given tags. :param tags: the PEP 425 tags to check the wheel against. """ return not self.file_tags.isdisjoint(tags)
[ "def", "supported", "(", "self", ",", "tags", ")", ":", "# type: (List[Tag]) -> bool", "return", "not", "self", ".", "file_tags", ".", "isdisjoint", "(", "tags", ")" ]
[ 71, 4 ]
[ 77, 50 ]
python
en
['en', 'en', 'en']
True
_find_all_simple
(path)
Find all files under 'path'
Find all files under 'path'
def _find_all_simple(path): """ Find all files under 'path' """ results = ( os.path.join(base, file) for base, dirs, files in os.walk(path, followlinks=True) for file in files ) return filter(os.path.isfile, results)
[ "def", "_find_all_simple", "(", "path", ")", ":", "results", "=", "(", "os", ".", "path", ".", "join", "(", "base", ",", "file", ")", "for", "base", ",", "dirs", ",", "files", "in", "os", ".", "walk", "(", "path", ",", "followlinks", "=", "True", ...
[ 211, 0 ]
[ 220, 42 ]
python
en
['en', 'error', 'th']
False
findall
(dir=os.curdir)
Find all files under 'dir' and return the list of full filenames. Unless dir is '.', return full filenames with dir prepended.
Find all files under 'dir' and return the list of full filenames. Unless dir is '.', return full filenames with dir prepended.
def findall(dir=os.curdir): """ Find all files under 'dir' and return the list of full filenames. Unless dir is '.', return full filenames with dir prepended. """ files = _find_all_simple(dir) if dir == os.curdir: make_rel = functools.partial(os.path.relpath, start=dir) files = m...
[ "def", "findall", "(", "dir", "=", "os", ".", "curdir", ")", ":", "files", "=", "_find_all_simple", "(", "dir", ")", "if", "dir", "==", "os", ".", "curdir", ":", "make_rel", "=", "functools", ".", "partial", "(", "os", ".", "path", ".", "relpath", ...
[ 223, 0 ]
[ 232, 22 ]
python
en
['en', 'error', 'th']
False
PackageFinder.find
(cls, where='.', exclude=(), include=('*',))
Return a list all Python packages found within directory 'where' 'where' is the root directory which will be searched for packages. It should be supplied as a "cross-platform" (i.e. URL-style) path; it will be converted to the appropriate local path syntax. 'exclude' is a sequence of ...
Return a list all Python packages found within directory 'where'
def find(cls, where='.', exclude=(), include=('*',)): """Return a list all Python packages found within directory 'where' 'where' is the root directory which will be searched for packages. It should be supplied as a "cross-platform" (i.e. URL-style) path; it will be converted to the ap...
[ "def", "find", "(", "cls", ",", "where", "=", "'.'", ",", "exclude", "=", "(", ")", ",", "include", "=", "(", "'*'", ",", ")", ")", ":", "return", "list", "(", "cls", ".", "_find_packages_iter", "(", "convert_path", "(", "where", ")", ",", "cls", ...
[ 45, 4 ]
[ 65, 41 ]
python
en
['en', 'en', 'en']
True
PackageFinder._find_packages_iter
(cls, where, exclude, include)
All the packages found in 'where' that pass the 'include' filter, but not the 'exclude' filter.
All the packages found in 'where' that pass the 'include' filter, but not the 'exclude' filter.
def _find_packages_iter(cls, where, exclude, include): """ All the packages found in 'where' that pass the 'include' filter, but not the 'exclude' filter. """ for root, dirs, files in os.walk(where, followlinks=True): # Copy dirs to iterate over it, then empty dirs. ...
[ "def", "_find_packages_iter", "(", "cls", ",", "where", ",", "exclude", ",", "include", ")", ":", "for", "root", ",", "dirs", ",", "files", "in", "os", ".", "walk", "(", "where", ",", "followlinks", "=", "True", ")", ":", "# Copy dirs to iterate over it, t...
[ 68, 4 ]
[ 93, 32 ]
python
en
['en', 'error', 'th']
False
PackageFinder._looks_like_package
(path)
Does a directory look like a package?
Does a directory look like a package?
def _looks_like_package(path): """Does a directory look like a package?""" return os.path.isfile(os.path.join(path, '__init__.py'))
[ "def", "_looks_like_package", "(", "path", ")", ":", "return", "os", ".", "path", ".", "isfile", "(", "os", ".", "path", ".", "join", "(", "path", ",", "'__init__.py'", ")", ")" ]
[ 96, 4 ]
[ 98, 64 ]
python
en
['en', 'en', 'en']
True
PackageFinder._build_filter
(*patterns)
Given a list of patterns, return a callable that will be true only if the input matches at least one of the patterns.
Given a list of patterns, return a callable that will be true only if the input matches at least one of the patterns.
def _build_filter(*patterns): """ Given a list of patterns, return a callable that will be true only if the input matches at least one of the patterns. """ return lambda name: any(fnmatchcase(name, pat=pat) for pat in patterns)
[ "def", "_build_filter", "(", "*", "patterns", ")", ":", "return", "lambda", "name", ":", "any", "(", "fnmatchcase", "(", "name", ",", "pat", "=", "pat", ")", "for", "pat", "in", "patterns", ")" ]
[ 101, 4 ]
[ 106, 79 ]
python
en
['en', 'error', 'th']
False
Command.__init__
(self, dist, **kw)
Construct the command for dist, updating vars(self) with any keyword parameters.
Construct the command for dist, updating vars(self) with any keyword parameters.
def __init__(self, dist, **kw): """ Construct the command for dist, updating vars(self) with any keyword parameters. """ _Command.__init__(self, dist) vars(self).update(kw)
[ "def", "__init__", "(", "self", ",", "dist", ",", "*", "*", "kw", ")", ":", "_Command", ".", "__init__", "(", "self", ",", "dist", ")", "vars", "(", "self", ")", ".", "update", "(", "kw", ")" ]
[ 166, 4 ]
[ 172, 29 ]
python
en
['en', 'error', 'th']
False
Command.ensure_string_list
(self, option)
r"""Ensure that 'option' is a list of strings. If 'option' is currently a string, we split it either on /,\s*/ or /\s+/, so "foo bar baz", "foo,bar,baz", and "foo, bar baz" all become ["foo", "bar", "baz"].
r"""Ensure that 'option' is a list of strings. If 'option' is currently a string, we split it either on /,\s*/ or /\s+/, so "foo bar baz", "foo,bar,baz", and "foo, bar baz" all become ["foo", "bar", "baz"].
def ensure_string_list(self, option): r"""Ensure that 'option' is a list of strings. If 'option' is currently a string, we split it either on /,\s*/ or /\s+/, so "foo bar baz", "foo,bar,baz", and "foo, bar baz" all become ["foo", "bar", "baz"]. """ val = getattr(self, ...
[ "def", "ensure_string_list", "(", "self", ",", "option", ")", ":", "val", "=", "getattr", "(", "self", ",", "option", ")", "if", "val", "is", "None", ":", "return", "elif", "isinstance", "(", "val", ",", "str", ")", ":", "setattr", "(", "self", ",", ...
[ 184, 4 ]
[ 203, 36 ]
python
en
['en', 'en', 'en']
True
VendorImporter.search_path
(self)
Search first the vendor package then as a natural package.
Search first the vendor package then as a natural package.
def search_path(self): """ Search first the vendor package then as a natural package. """ yield self.vendor_pkg + '.' yield ''
[ "def", "search_path", "(", "self", ")", ":", "yield", "self", ".", "vendor_pkg", "+", "'.'", "yield", "''" ]
[ 15, 4 ]
[ 20, 16 ]
python
en
['en', 'error', 'th']
False
VendorImporter.find_module
(self, fullname, path=None)
Return self when fullname starts with root_name and the target module is one vendored through this importer.
Return self when fullname starts with root_name and the target module is one vendored through this importer.
def find_module(self, fullname, path=None): """ Return self when fullname starts with root_name and the target module is one vendored through this importer. """ root, base, target = fullname.partition(self.root_name + '.') if root: return if not any(ma...
[ "def", "find_module", "(", "self", ",", "fullname", ",", "path", "=", "None", ")", ":", "root", ",", "base", ",", "target", "=", "fullname", ".", "partition", "(", "self", ".", "root_name", "+", "'.'", ")", "if", "root", ":", "return", "if", "not", ...
[ 22, 4 ]
[ 32, 19 ]
python
en
['en', 'error', 'th']
False
VendorImporter.load_module
(self, fullname)
Iterate over the search path to locate and load fullname.
Iterate over the search path to locate and load fullname.
def load_module(self, fullname): """ Iterate over the search path to locate and load fullname. """ root, base, target = fullname.partition(self.root_name + '.') for prefix in self.search_path: try: extant = prefix + target __import__(ex...
[ "def", "load_module", "(", "self", ",", "fullname", ")", ":", "root", ",", "base", ",", "target", "=", "fullname", ".", "partition", "(", "self", ".", "root_name", "+", "'.'", ")", "for", "prefix", "in", "self", ".", "search_path", ":", "try", ":", "...
[ 34, 4 ]
[ 54, 13 ]
python
en
['en', 'error', 'th']
False
VendorImporter.install
(self)
Install this importer into sys.meta_path if not already present.
Install this importer into sys.meta_path if not already present.
def install(self): """ Install this importer into sys.meta_path if not already present. """ if self not in sys.meta_path: sys.meta_path.append(self)
[ "def", "install", "(", "self", ")", ":", "if", "self", "not", "in", "sys", ".", "meta_path", ":", "sys", ".", "meta_path", ".", "append", "(", "self", ")" ]
[ 56, 4 ]
[ 61, 38 ]
python
en
['en', 'error', 'th']
False
set_log_policies
(filehandle)
Set policy logging.
Set policy logging.
def set_log_policies(filehandle): """ Set policy logging. """ jeevesState.set_log_policies(filehandle)
[ "def", "set_log_policies", "(", "filehandle", ")", ":", "jeevesState", ".", "set_log_policies", "(", "filehandle", ")" ]
[ 18, 0 ]
[ 22, 44 ]
python
en
['en', 'error', 'th']
False
log_policies
()
Write policies to the policy files.
Write policies to the policy files.
def log_policies(): """ Write policies to the policy files. """ jeevesState.log_policies()
[ "def", "log_policies", "(", ")", ":", "jeevesState", ".", "log_policies", "(", ")" ]
[ 23, 0 ]
[ 27, 30 ]
python
en
['en', 'error', 'th']
False
init
()
Initialization function for Jeeves library. You should always call this before you do anything Jeeves-y.
Initialization function for Jeeves library.
def init(): """Initialization function for Jeeves library. You should always call this before you do anything Jeeves-y. """ jeevesState.init()
[ "def", "init", "(", ")", ":", "jeevesState", ".", "init", "(", ")" ]
[ 39, 0 ]
[ 45, 22 ]
python
en
['en', 'en', 'en']
True
mkLabel
(varName = "", uniquify=True)
Makes a label to associate with policies and sensitive values. :param varName: Optional variable name (to help with debugging). :type varName: string :returns: Var - fresh label.
Makes a label to associate with policies and sensitive values.
def mkLabel(varName = "", uniquify=True): """Makes a label to associate with policies and sensitive values. :param varName: Optional variable name (to help with debugging). :type varName: string :returns: Var - fresh label. """ label = jeevesState.policyenv.mkLabel(varName, uniquify) jeeves...
[ "def", "mkLabel", "(", "varName", "=", "\"\"", ",", "uniquify", "=", "True", ")", ":", "label", "=", "jeevesState", ".", "policyenv", ".", "mkLabel", "(", "varName", ",", "uniquify", ")", "jeevesState", ".", "all_labels", "[", "label", ".", "name", "]", ...
[ 54, 0 ]
[ 63, 16 ]
python
en
['en', 'en', 'en']
True
restrict
(varLabel, pred, use_empty_env=False)
Associates a policy with a label. :param varLabel: Label to associate with policy. :type varLabel: string :param pred: Policy: function taking output channel and returning Boolean result. :type pred: T -> bool, where T is the type of the output channel
Associates a policy with a label.
def restrict(varLabel, pred, use_empty_env=False): """Associates a policy with a label. :param varLabel: Label to associate with policy. :type varLabel: string :param pred: Policy: function taking output channel and returning Boolean result. :type pred: T -> bool, where T is the type of the output ...
[ "def", "restrict", "(", "varLabel", ",", "pred", ",", "use_empty_env", "=", "False", ")", ":", "jeevesState", ".", "policyenv", ".", "restrict", "(", "varLabel", ",", "pred", ",", "use_empty_env", ")" ]
[ 74, 0 ]
[ 82, 65 ]
python
en
['en', 'en', 'en']
True
mkSensitive
(varLabel, vHigh, vLow)
Creates a sensitive value with two facets. :param varLabel: Label to associate with sensitive value. :type varLabel: Var :param vHigh: High-confidentiality facet for viewers with restricted access. :type vHigh: T :param vLow: Low-confidentiality facet for other viewers. :type vLow: T
Creates a sensitive value with two facets.
def mkSensitive(varLabel, vHigh, vLow): """Creates a sensitive value with two facets. :param varLabel: Label to associate with sensitive value. :type varLabel: Var :param vHigh: High-confidentiality facet for viewers with restricted access. :type vHigh: T :param vLow: Low-confidentiality facet for other viewers....
[ "def", "mkSensitive", "(", "varLabel", ",", "vHigh", ",", "vLow", ")", ":", "if", "isinstance", "(", "varLabel", ",", "Var", ")", ":", "return", "Facet", "(", "varLabel", ",", "fexpr_cast", "(", "vHigh", ")", ",", "fexpr_cast", "(", "vLow", ")", ")", ...
[ 85, 0 ]
[ 99, 59 ]
python
en
['en', 'en', 'en']
True
concretize
(ctxt, v)
Projects out a single value to the viewer. :param ctxt: Output channel (viewer). :type ctxt: T, where policies have type T -> bool :param v: Value to concretize. :type v: FExpr :returns: The concrete (non-faceted) version of T under the policies in the environment.
Projects out a single value to the viewer.
def concretize(ctxt, v): """Projects out a single value to the viewer. :param ctxt: Output channel (viewer). :type ctxt: T, where policies have type T -> bool :param v: Value to concretize. :type v: FExpr :returns: The concrete (non-faceted) version of T under the policies in the environment. """ pathvars = je...
[ "def", "concretize", "(", "ctxt", ",", "v", ")", ":", "pathvars", "=", "jeevesState", ".", "pathenv", ".", "getEnv", "(", ")", "# Check to see if the value is in the cache.", "cache_key", "=", "jeevesState", ".", "concretecache", ".", "get_cache_key", "(", "ctxt",...
[ 102, 0 ]
[ 119, 12 ]
python
en
['en', 'en', 'en']
True
get_supported
( version=None, # type: Optional[str] platform=None, # type: Optional[str] impl=None, # type: Optional[str] abi=None # type: Optional[str] )
Return a list of supported tags for each version specified in `versions`. :param version: a string version, of the form "33" or "32", or None. The version will be assumed to support our ABI. :param platform: specify the exact platform you want valid tags for, or None. If None, use the local...
Return a list of supported tags for each version specified in `versions`.
def get_supported( version=None, # type: Optional[str] platform=None, # type: Optional[str] impl=None, # type: Optional[str] abi=None # type: Optional[str] ): # type: (...) -> List[Tag] """Return a list of supported tags for each version specified in `versions`. :param version: a st...
[ "def", "get_supported", "(", "version", "=", "None", ",", "# type: Optional[str]", "platform", "=", "None", ",", "# type: Optional[str]", "impl", "=", "None", ",", "# type: Optional[str]", "abi", "=", "None", "# type: Optional[str]", ")", ":", "# type: (...) -> List[T...
[ 105, 0 ]
[ 165, 20 ]
python
en
['en', 'en', 'en']
True
test_error_during_readouterr
(testdir)
Make sure we suspend capturing if errors occur during readouterr
Make sure we suspend capturing if errors occur during readouterr
def test_error_during_readouterr(testdir): """Make sure we suspend capturing if errors occur during readouterr""" testdir.makepyfile(pytest_xyz=""" from _pytest.capture import FDCapture def bad_snap(self): raise Exception('boom') assert FDCapture.snap FDCapture.snap =...
[ "def", "test_error_during_readouterr", "(", "testdir", ")", ":", "testdir", ".", "makepyfile", "(", "pytest_xyz", "=", "\"\"\"\n from _pytest.capture import FDCapture\n def bad_snap(self):\n raise Exception('boom')\n assert FDCapture.snap\n FDCapture.sn...
[ 687, 0 ]
[ 703, 6 ]
python
en
['en', 'en', 'en']
True
test_py36_windowsconsoleio_workaround_non_standard_streams
()
Ensure _py36_windowsconsoleio_workaround function works with objects that do not implement the full ``io``-based stream protocol, for example execnet channels (#2666).
Ensure _py36_windowsconsoleio_workaround function works with objects that do not implement the full ``io``-based stream protocol, for example execnet channels (#2666).
def test_py36_windowsconsoleio_workaround_non_standard_streams(): """ Ensure _py36_windowsconsoleio_workaround function works with objects that do not implement the full ``io``-based stream protocol, for example execnet channels (#2666). """ from _pytest.capture import _py36_windowsconsoleio_workaro...
[ "def", "test_py36_windowsconsoleio_workaround_non_standard_streams", "(", ")", ":", "from", "_pytest", ".", "capture", "import", "_py36_windowsconsoleio_workaround", "class", "DummyStream", "(", "object", ")", ":", "def", "write", "(", "self", ",", "s", ")", ":", "p...
[ 1240, 0 ]
[ 1252, 45 ]
python
en
['en', 'error', 'th']
False
TestCaptureFixture.test_capturing_getfixturevalue
(self, testdir)
Test that asking for "capfd" and "capsys" using request.getfixturevalue in the same test is an error.
Test that asking for "capfd" and "capsys" using request.getfixturevalue in the same test is an error.
def test_capturing_getfixturevalue(self, testdir): """Test that asking for "capfd" and "capsys" using request.getfixturevalue in the same test is an error. """ testdir.makepyfile(""" def test_one(capsys, request): request.getfixturevalue("capfd") d...
[ "def", "test_capturing_getfixturevalue", "(", "self", ",", "testdir", ")", ":", "testdir", ".", "makepyfile", "(", "\"\"\"\n def test_one(capsys, request):\n request.getfixturevalue(\"capfd\")\n def test_two(capfd, request):\n request.getfi...
[ 405, 4 ]
[ 422, 10 ]
python
en
['en', 'en', 'en']
True
TestCaptureFixture.test_fixture_use_by_other_fixtures
(self, testdir, fixture)
Ensure that capsys and capfd can be used by other fixtures during setup and teardown.
Ensure that capsys and capfd can be used by other fixtures during setup and teardown.
def test_fixture_use_by_other_fixtures(self, testdir, fixture): """ Ensure that capsys and capfd can be used by other fixtures during setup and teardown. """ testdir.makepyfile(""" from __future__ import print_function import sys import pytest ...
[ "def", "test_fixture_use_by_other_fixtures", "(", "self", ",", "testdir", ",", "fixture", ")", ":", "testdir", ".", "makepyfile", "(", "\"\"\"\n from __future__ import print_function\n import sys\n import pytest\n\n @pytest.fixture\n ...
[ 566, 4 ]
[ 597, 65 ]
python
en
['en', 'error', 'th']
False
TestCaptureIO.test_write_bytes_to_buffer
(self)
In python3, stdout / stderr are text io wrappers (exposing a buffer property of the underlying bytestream). See issue #1407
In python3, stdout / stderr are text io wrappers (exposing a buffer property of the underlying bytestream). See issue #1407
def test_write_bytes_to_buffer(self): """In python3, stdout / stderr are text io wrappers (exposing a buffer property of the underlying bytestream). See issue #1407 """ f = capture.CaptureIO() f.buffer.write(b'foo\r\n') assert f.getvalue() == 'foo\r\n'
[ "def", "test_write_bytes_to_buffer", "(", "self", ")", ":", "f", "=", "capture", ".", "CaptureIO", "(", ")", "f", ".", "buffer", ".", "write", "(", "b'foo\\r\\n'", ")", "assert", "f", ".", "getvalue", "(", ")", "==", "'foo\\r\\n'" ]
[ 730, 4 ]
[ 736, 40 ]
python
en
['en', 'en', 'en']
True
recwarn
()
Return a WarningsRecorder instance that provides these methods: * ``pop(category=None)``: return last warning matching the category. * ``clear()``: clear list of warnings See http://docs.python.org/library/warnings.html for information on warning categories.
Return a WarningsRecorder instance that provides these methods:
def recwarn(): """Return a WarningsRecorder instance that provides these methods: * ``pop(category=None)``: return last warning matching the category. * ``clear()``: clear list of warnings See http://docs.python.org/library/warnings.html for information on warning categories. """ wrec = Wa...
[ "def", "recwarn", "(", ")", ":", "wrec", "=", "WarningsRecorder", "(", ")", "with", "wrec", ":", "warnings", ".", "simplefilter", "(", "'default'", ")", "yield", "wrec" ]
[ 17, 0 ]
[ 29, 18 ]
python
en
['en', 'en', 'en']
True
deprecated_call
(func=None, *args, **kwargs)
context manager that can be used to ensure a block of code triggers a ``DeprecationWarning`` or ``PendingDeprecationWarning``:: >>> import warnings >>> def api_call_v2(): ... warnings.warn('use v3 of this api', DeprecationWarning) ... return 200 >>> with deprecated_...
context manager that can be used to ensure a block of code triggers a ``DeprecationWarning`` or ``PendingDeprecationWarning``::
def deprecated_call(func=None, *args, **kwargs): """context manager that can be used to ensure a block of code triggers a ``DeprecationWarning`` or ``PendingDeprecationWarning``:: >>> import warnings >>> def api_call_v2(): ... warnings.warn('use v3 of this api', DeprecationWarning) ...
[ "def", "deprecated_call", "(", "func", "=", "None", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "not", "func", ":", "return", "_DeprecatedCallContext", "(", ")", "else", ":", "__tracebackhide__", "=", "True", "with", "_DeprecatedCallContext", ...
[ 32, 0 ]
[ 53, 40 ]
python
en
['en', 'en', 'en']
True
warns
(expected_warning, *args, **kwargs)
Assert that code raises a particular class of warning. Specifically, the input @expected_warning can be a warning class or tuple of warning classes, and the code must return that warning (if a single class) or one of those warnings (if a tuple). This helper produces a list of ``warnings.WarningMessage...
Assert that code raises a particular class of warning.
def warns(expected_warning, *args, **kwargs): """Assert that code raises a particular class of warning. Specifically, the input @expected_warning can be a warning class or tuple of warning classes, and the code must return that warning (if a single class) or one of those warnings (if a tuple). Thi...
[ "def", "warns", "(", "expected_warning", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "match_expr", "=", "None", "if", "not", "args", ":", "if", "\"match\"", "in", "kwargs", ":", "match_expr", "=", "kwargs", ".", "pop", "(", "\"match\"", ")", ...
[ 87, 0 ]
[ 137, 44 ]
python
en
['en', 'lb', 'en']
True
WarningsRecorder.list
(self)
The list of recorded warnings.
The list of recorded warnings.
def list(self): """The list of recorded warnings.""" return self._list
[ "def", "list", "(", "self", ")", ":", "return", "self", ".", "_list" ]
[ 152, 4 ]
[ 154, 25 ]
python
en
['en', 'en', 'en']
True
WarningsRecorder.__getitem__
(self, i)
Get a recorded warning by index.
Get a recorded warning by index.
def __getitem__(self, i): """Get a recorded warning by index.""" return self._list[i]
[ "def", "__getitem__", "(", "self", ",", "i", ")", ":", "return", "self", ".", "_list", "[", "i", "]" ]
[ 156, 4 ]
[ 158, 28 ]
python
en
['en', 'en', 'en']
True
WarningsRecorder.__iter__
(self)
Iterate through the recorded warnings.
Iterate through the recorded warnings.
def __iter__(self): """Iterate through the recorded warnings.""" return iter(self._list)
[ "def", "__iter__", "(", "self", ")", ":", "return", "iter", "(", "self", ".", "_list", ")" ]
[ 160, 4 ]
[ 162, 31 ]
python
en
['en', 'en', 'en']
True