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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
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... | 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... | 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",
"]",
... | [
909,
4
] | [
926,
22
] | python | en | ['en', 'en', 'en'] | True |
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",
... | [
928,
4
] | [
944,
19
] | python | en | ['en', 'en', 'en'] | True |
ParserElement.setParseAction | ( self, *fns, **kwargs ) | Define action 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 below)
... | Define action 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 below)
... | def setParseAction( self, *fns, **kwargs ):
"""Define action 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 o... | [
"def",
"setParseAction",
"(",
"self",
",",
"*",
"fns",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"parseAction",
"=",
"list",
"(",
"map",
"(",
"_trim_arity",
",",
"list",
"(",
"fns",
")",
")",
")",
"self",
".",
"callDuringTry",
"=",
"kwargs",
... | [
946,
4
] | [
968,
19
] | python | en | ['en', 'en', 'en'] | True |
ParserElement.addParseAction | ( self, *fns, **kwargs ) | Add parse action to expression's list of parse actions. See L{I{setParseAction}<setParseAction>}. | Add parse action to expression's list of parse actions. See L{I{setParseAction}<setParseAction>}. | def addParseAction( self, *fns, **kwargs ):
"""Add parse action to expression's list of parse actions. See L{I{setParseAction}<setParseAction>}."""
self.parseAction += list(map(_trim_arity, list(fns)))
self.callDuringTry = self.callDuringTry or kwargs.get("callDuringTry", False)
return s... | [
"def",
"addParseAction",
"(",
"self",
",",
"*",
"fns",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"parseAction",
"+=",
"list",
"(",
"map",
"(",
"_trim_arity",
",",
"list",
"(",
"fns",
")",
")",
")",
"self",
".",
"callDuringTry",
"=",
"self",
"... | [
970,
4
] | [
974,
19
] | python | en | ['en', 'en', 'en'] | True |
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",
... | [
976,
4
] | [
993,
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"
] | [
995,
4
] | [
1006,
19
] | python | en | ['en', 'en', 'en'] | True |
ParserElement.enablePackrat | () | 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():
"""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... | [
"def",
"enablePackrat",
"(",
")",
":",
"if",
"not",
"ParserElement",
".",
"_packratEnabled",
":",
"ParserElement",
".",
"_packratEnabled",
"=",
"True",
"ParserElement",
".",
"_parse",
"=",
"ParserElement",
".",
"_parseCache"
] | [
1155,
4
] | [
1173,
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... | 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
su... | [
"def",
"parseString",
"(",
"self",
",",
"instring",
",",
"parseAll",
"=",
"False",
")",
":",
"ParserElement",
".",
"resetCache",
"(",
")",
"if",
"not",
"self",
".",
"streamlined",
":",
"self",
".",
"streamline",
"(",
")",
"#~ self.saveAsList = True",
"for",
... | [
1175,
4
] | [
1218,
25
] | python | en | ['en', 'en', 'en'] | True |
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 are ... | [
"def",
"scanString",
"(",
"self",
",",
"instring",
",",
"maxMatches",
"=",
"_MAX_INT",
",",
"overlap",
"=",
"False",
")",
":",
"if",
"not",
"self",
".",
"streamlined",
":",
"self",
".",
"streamline",
"(",
")",
"for",
"e",
"in",
"self",
".",
"ignoreExpr... | [
1220,
4
] | [
1268,
25
] | python | en | ['en', 'en', 'en'] | True |
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",
".",
... | [
1270,
4
] | [
1301,
25
] | python | en | ['en', 'en', 'en'] | True |
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.
| 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 ):
"""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",... | [
1303,
4
] | [
1315,
25
] | python | en | ['en', 'en', 'en'] | True |
ParserElement.__add__ | (self, other ) | Implementation of + operator - returns C{L{And}} | Implementation of + operator - returns C{L{And}} | def __add__(self, other ):
"""Implementation of + operator - returns C{L{And}}"""
if isinstance( other, basestring ):
other = ParserElement.literalStringClass( other )
if not isinstance( other, ParserElement ):
warnings.warn("Cannot combine element of type %s with ParserE... | [
"def",
"__add__",
"(",
"self",
",",
"other",
")",
":",
"if",
"isinstance",
"(",
"other",
",",
"basestring",
")",
":",
"other",
"=",
"ParserElement",
".",
"literalStringClass",
"(",
"other",
")",
"if",
"not",
"isinstance",
"(",
"other",
",",
"ParserElement"... | [
1317,
4
] | [
1325,
37
] | python | en | ['en', 'en', 'en'] | True |
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("Cannot combine ele... | [
"def",
"__radd__",
"(",
"self",
",",
"other",
")",
":",
"if",
"isinstance",
"(",
"other",
",",
"basestring",
")",
":",
"other",
"=",
"ParserElement",
".",
"literalStringClass",
"(",
"other",
")",
"if",
"not",
"isinstance",
"(",
"other",
",",
"ParserElement... | [
1327,
4
] | [
1335,
27
] | python | en | ['en', 'en', 'en'] | True |
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 combine element of type %... | [
"def",
"__sub__",
"(",
"self",
",",
"other",
")",
":",
"if",
"isinstance",
"(",
"other",
",",
"basestring",
")",
":",
"other",
"=",
"ParserElement",
".",
"literalStringClass",
"(",
"other",
")",
"if",
"not",
"isinstance",
"(",
"other",
",",
"ParserElement"... | [
1337,
4
] | [
1345,
55
] | python | en | ['en', 'en', 'en'] | True |
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("Cannot combine ele... | [
"def",
"__rsub__",
"(",
"self",
",",
"other",
")",
":",
"if",
"isinstance",
"(",
"other",
",",
"basestring",
")",
":",
"other",
"=",
"ParserElement",
".",
"literalStringClass",
"(",
"other",
")",
"if",
"not",
"isinstance",
"(",
"other",
",",
"ParserElement... | [
1347,
4
] | [
1355,
27
] | python | en | ['en', 'en', 'en'] | True |
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{ex... | 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{ex... | 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",
"=",
"(",
... | [
1357,
4
] | [
1423,
18
] | python | en | ['en', 'en', 'en'] | True |
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 element of type %s with P... | [
"def",
"__or__",
"(",
"self",
",",
"other",
")",
":",
"if",
"isinstance",
"(",
"other",
",",
"basestring",
")",
":",
"other",
"=",
"ParserElement",
".",
"literalStringClass",
"(",
"other",
")",
"if",
"not",
"isinstance",
"(",
"other",
",",
"ParserElement",... | [
1428,
4
] | [
1436,
44
] | python | en | ['en', 'en', 'en'] | True |
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("Cannot combine elem... | [
"def",
"__ror__",
"(",
"self",
",",
"other",
")",
":",
"if",
"isinstance",
"(",
"other",
",",
"basestring",
")",
":",
"other",
"=",
"ParserElement",
".",
"literalStringClass",
"(",
"other",
")",
"if",
"not",
"isinstance",
"(",
"other",
",",
"ParserElement"... | [
1438,
4
] | [
1446,
27
] | python | en | ['en', 'en', 'en'] | True |
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 type %s with ParserEl... | [
"def",
"__xor__",
"(",
"self",
",",
"other",
")",
":",
"if",
"isinstance",
"(",
"other",
",",
"basestring",
")",
":",
"other",
"=",
"ParserElement",
".",
"literalStringClass",
"(",
"other",
")",
"if",
"not",
"isinstance",
"(",
"other",
",",
"ParserElement"... | [
1448,
4
] | [
1456,
36
] | python | en | ['en', 'en', 'en'] | True |
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("Cannot combine ele... | [
"def",
"__rxor__",
"(",
"self",
",",
"other",
")",
":",
"if",
"isinstance",
"(",
"other",
",",
"basestring",
")",
":",
"other",
"=",
"ParserElement",
".",
"literalStringClass",
"(",
"other",
")",
"if",
"not",
"isinstance",
"(",
"other",
",",
"ParserElement... | [
1458,
4
] | [
1466,
27
] | python | en | ['en', 'en', 'en'] | True |
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 type %s with Parser... | [
"def",
"__and__",
"(",
"self",
",",
"other",
")",
":",
"if",
"isinstance",
"(",
"other",
",",
"basestring",
")",
":",
"other",
"=",
"ParserElement",
".",
"literalStringClass",
"(",
"other",
")",
"if",
"not",
"isinstance",
"(",
"other",
",",
"ParserElement"... | [
1468,
4
] | [
1476,
38
] | python | en | ['en', 'en', 'en'] | True |
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("Cannot combine ele... | [
"def",
"__rand__",
"(",
"self",
",",
"other",
")",
":",
"if",
"isinstance",
"(",
"other",
",",
"basestring",
")",
":",
"other",
"=",
"ParserElement",
".",
"literalStringClass",
"(",
"other",
")",
"if",
"not",
"isinstance",
"(",
"other",
",",
"ParserElement... | [
1478,
4
] | [
1486,
27
] | python | en | ['en', 'en', 'en'] | True |
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",
")"
] | [
1488,
4
] | [
1490,
29
] | python | en | ['en', 'en', 'en'] | True |
ParserElement.__call__ | (self, name=None) | Shortcut for C{L{setResultsName}}, with C{listAllMatches=default}::
userdata = Word(alphas).setResultsName("name") + Word(nums+"-").setResultsName("socsecno")
could be written as::
userdata = Word(alphas)("name") + Word(nums+"-")("socsecno")
If C{name} is gi... | Shortcut for C{L{setResultsName}}, with C{listAllMatches=default}::
userdata = Word(alphas).setResultsName("name") + Word(nums+"-").setResultsName("socsecno")
could be written as::
userdata = Word(alphas)("name") + Word(nums+"-")("socsecno")
If C{name} is gi... | def __call__(self, name=None):
"""Shortcut for C{L{setResultsName}}, with C{listAllMatches=default}::
userdata = Word(alphas).setResultsName("name") + Word(nums+"-").setResultsName("socsecno")
could be written as::
userdata = Word(alphas)("name") + Word(nums+"-")("socsecno")... | [
"def",
"__call__",
"(",
"self",
",",
"name",
"=",
"None",
")",
":",
"if",
"name",
"is",
"not",
"None",
":",
"return",
"self",
".",
"setResultsName",
"(",
"name",
")",
"else",
":",
"return",
"self",
".",
"copy",
"(",
")"
] | [
1492,
4
] | [
1506,
30
] | python | en | ['en', 'en', 'en'] | True |
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",
")"
] | [
1508,
4
] | [
1512,
31
] | python | en | ['en', 'en', 'en'] | True |
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.sk... | [
"def",
"leaveWhitespace",
"(",
"self",
")",
":",
"self",
".",
"skipWhitespace",
"=",
"False",
"return",
"self"
] | [
1514,
4
] | [
1520,
19
] | python | en | ['en', 'en', 'en'] | True |
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"
] | [
1522,
4
] | [
1528,
19
] | python | en | ['en', 'en', 'en'] | True |
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 self | [
"def",
"parseWithTabs",
"(",
"self",
")",
":",
"self",
".",
"keepTabs",
"=",
"True",
"return",
"self"
] | [
1530,
4
] | [
1535,
19
] | python | en | ['en', 'en', 'en'] | True |
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.
| Define expression to be ignored (e.g., comments) while doing pattern
matching; may be called repeatedly, to define multiple comment or other
ignorable patterns.
| 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.
"""
if isinstance(other, basestring):
other = Suppress(other)
... | [
"def",
"ignore",
"(",
"self",
",",
"other",
")",
":",
"if",
"isinstance",
"(",
"other",
",",
"basestring",
")",
":",
"other",
"=",
"Suppress",
"(",
"other",
")",
"if",
"isinstance",
"(",
"other",
",",
"Suppress",
")",
":",
"if",
"other",
"not",
"in",... | [
1537,
4
] | [
1550,
19
] | python | en | ['en', 'en', 'en'] | True |
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",
",",
... | [
1552,
4
] | [
1558,
19
] | python | en | ['en', 'en', 'en'] | True |
ParserElement.setDebug | ( self, flag=True ) | Enable display of debugging messages while doing pattern matching.
Set C{flag} to True to enable, False to disable. | 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."""
if flag:
self.setDebugActions( _defaultStartDebugAction, _defaultSuccessDebugAction, _defaultExceptionDebugAction )
el... | [
"def",
"setDebug",
"(",
"self",
",",
"flag",
"=",
"True",
")",
":",
"if",
"flag",
":",
"self",
".",
"setDebugActions",
"(",
"_defaultStartDebugAction",
",",
"_defaultSuccessDebugAction",
",",
"_defaultExceptionDebugAction",
")",
"else",
":",
"self",
".",
"debug"... | [
1560,
4
] | [
1567,
19
] | python | en | ['en', 'en', 'en'] | True |
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",
"(",
"[",
"]",
")"
] | [
1583,
4
] | [
1585,
33
] | python | en | ['en', 'en', 'en'] | True |
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 = fi... | [
"def",
"parseFile",
"(",
"self",
",",
"file_or_filename",
",",
"parseAll",
"=",
"False",
")",
":",
"try",
":",
"file_contents",
"=",
"file_or_filename",
".",
"read",
"(",
")",
"except",
"AttributeError",
":",
"f",
"=",
"open",
"(",
"file_or_filename",
",",
... | [
1587,
4
] | [
1605,
25
] | python | en | ['en', 'en', 'en'] | True |
ParserElement.matches | (self, s, 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, as in:
expr = Word(nums)
assert expr.matches("100")
Parameters:
- testString - string
... | Method for quick testing of a parser against a test string. Good for simple
inline microtests of sub expressions while building up larger parser, as in:
expr = Word(nums)
assert expr.matches("100")
Parameters:
- testString - string
... | def matches(self, s, 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, as in:
expr = Word(nums)
assert expr.matches("100")
Param... | [
"def",
"matches",
"(",
"self",
",",
"s",
",",
"parseAll",
"=",
"True",
")",
":",
"try",
":",
"self",
".",
"parseString",
"(",
"_ustr",
"(",
"s",
")",
",",
"parseAll",
"=",
"parseAll",
")",
"return",
"True",
"except",
"ParseBaseException",
":",
"return"... | [
1627,
4
] | [
1641,
24
] | python | en | ['en', 'en', 'en'] | True |
ParserElement.runTests | (self, tests, parseAll=False, comment='#', printResults=True) | 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 m... | 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 m... | def runTests(self, tests, parseAll=False, comment='#', printResults=True):
"""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.
... | [
"def",
"runTests",
"(",
"self",
",",
"tests",
",",
"parseAll",
"=",
"False",
",",
"comment",
"=",
"'#'",
",",
"printResults",
"=",
"True",
")",
":",
"if",
"isinstance",
"(",
"tests",
",",
"basestring",
")",
":",
"tests",
"=",
"list",
"(",
"map",
"(",... | [
1643,
4
] | [
1692,
38
] | python | en | ['en', 'en', 'en'] | True |
Keyword.setDefaultKeywordChars | ( chars ) | Overrides the default Keyword chars
| Overrides the default Keyword chars
| def setDefaultKeywordChars( chars ):
"""Overrides the default Keyword chars
"""
Keyword.DEFAULT_KEYWORD_CHARS = chars | [
"def",
"setDefaultKeywordChars",
"(",
"chars",
")",
":",
"Keyword",
".",
"DEFAULT_KEYWORD_CHARS",
"=",
"chars"
] | [
1803,
4
] | [
1806,
45
] | python | en | ['en', 'en', 'en'] | True |
Regex.__init__ | ( self, pattern, flags=0) | The parameters C{pattern} and C{flags} are passed to the C{re.compile()} function as-is. See the Python C{re} module for an explanation of the acceptable patterns and flags. | The parameters C{pattern} and C{flags} are passed to the C{re.compile()} function as-is. See the Python C{re} module for an explanation of the acceptable patterns and flags. | def __init__( self, pattern, flags=0):
"""The parameters C{pattern} and C{flags} are passed to the C{re.compile()} function as-is. See the Python C{re} module for an explanation of the acceptable patterns and flags."""
super(Regex,self).__init__()
if isinstance(pattern, basestring):
... | [
"def",
"__init__",
"(",
"self",
",",
"pattern",
",",
"flags",
"=",
"0",
")",
":",
"super",
"(",
"Regex",
",",
"self",
")",
".",
"__init__",
"(",
")",
"if",
"isinstance",
"(",
"pattern",
",",
"basestring",
")",
":",
"if",
"not",
"pattern",
":",
"war... | [
1964,
4
] | [
1996,
34
] | python | en | ['en', 'en', 'en'] | True |
QuotedString.__init__ | ( self, quoteChar, escChar=None, escQuote=None, multiline=False, unquoteResults=True, endQuoteChar=None, convertWhitespaceEscapes=True) | r"""Defined with the following parameters:
- quoteChar - string of one or more characters defining the quote delimiting string
- escChar - character to escape quotes, typically backslash (default=None)
- escQuote - special quote sequence to escape an embedded quote string (such as SQ... | r"""Defined with the following parameters:
- quoteChar - string of one or more characters defining the quote delimiting string
- escChar - character to escape quotes, typically backslash (default=None)
- escQuote - special quote sequence to escape an embedded quote string (such as SQ... | def __init__( self, quoteChar, escChar=None, escQuote=None, multiline=False, unquoteResults=True, endQuoteChar=None, convertWhitespaceEscapes=True):
r"""Defined with the following parameters:
- quoteChar - string of one or more characters defining the quote delimiting string
- escChar - ... | [
"def",
"__init__",
"(",
"self",
",",
"quoteChar",
",",
"escChar",
"=",
"None",
",",
"escQuote",
"=",
"None",
",",
"multiline",
"=",
"False",
",",
"unquoteResults",
"=",
"True",
",",
"endQuoteChar",
"=",
"None",
",",
"convertWhitespaceEscapes",
"=",
"True",
... | [
2026,
4
] | [
2098,
34
] | python | en | ['en', 'en', 'en'] | True |
sh_quote | (arg) |
will do shell style quoting for a single shell argument
such that it can be recombined back into a single string (rather than an array of strings)
such that shlex.split would resplit the string back into the same array.
The characters that need quoting within an argument are: double-quote, single-q... |
will do shell style quoting for a single shell argument
such that it can be recombined back into a single string (rather than an array of strings)
such that shlex.split would resplit the string back into the same array.
The characters that need quoting within an argument are: double-quote, single-q... | def sh_quote(arg):
"""
will do shell style quoting for a single shell argument
such that it can be recombined back into a single string (rather than an array of strings)
such that shlex.split would resplit the string back into the same array.
The characters that need quoting within an argument a... | [
"def",
"sh_quote",
"(",
"arg",
")",
":",
"double_count",
"=",
"arg",
".",
"count",
"(",
"'\"'",
")",
"single_count",
"=",
"arg",
".",
"count",
"(",
"\"'\"",
")",
"space_count",
"=",
"arg",
".",
"count",
"(",
"' '",
")",
"+",
"arg",
".",
"count",
"(... | [
24,
0
] | [
77,
35
] | python | en | ['en', 'error', 'th'] | False |
TestAdditionalPropertiesArray.testAdditionalPropertiesArray | (self) | Test AdditionalPropertiesArray | Test AdditionalPropertiesArray | def testAdditionalPropertiesArray(self):
"""Test AdditionalPropertiesArray"""
# can make model without additional properties
model = AdditionalPropertiesArray()
# can make one with additional properties
import datetime
some_val = []
model = AdditionalPropertiesAr... | [
"def",
"testAdditionalPropertiesArray",
"(",
"self",
")",
":",
"# can make model without additional properties",
"model",
"=",
"AdditionalPropertiesArray",
"(",
")",
"# can make one with additional properties",
"import",
"datetime",
"some_val",
"=",
"[",
"]",
"model",
"=",
... | [
29,
4
] | [
45,
69
] | python | en | ['en', 'lb', 'en'] | False |
async_setup | (hass) | Activate Alexa component. | Activate Alexa component. | def async_setup(hass):
"""Activate Alexa component."""
hass.http.register_view(AlexaIntentsView) | [
"def",
"async_setup",
"(",
"hass",
")",
":",
"hass",
".",
"http",
".",
"register_view",
"(",
"AlexaIntentsView",
")"
] | [
37,
0
] | [
39,
45
] | python | ca | ['ro', 'ca', 'en'] | False |
async_setup_intents | (hass) |
Do intents setup.
Right now this module does not expose any, but the intent component breaks
without it.
|
Do intents setup. | async def async_setup_intents(hass):
"""
Do intents setup.
Right now this module does not expose any, but the intent component breaks
without it.
"""
pass | [
"async",
"def",
"async_setup_intents",
"(",
"hass",
")",
":",
"pass"
] | [
42,
0
] | [
49,
8
] | python | en | ['en', 'error', 'th'] | False |
intent_error_response | (hass, message, error) | Return an Alexa response that will speak the error message. | Return an Alexa response that will speak the error message. | def intent_error_response(hass, message, error):
"""Return an Alexa response that will speak the error message."""
alexa_intent_info = message.get("request").get("intent")
alexa_response = AlexaResponse(hass, alexa_intent_info)
alexa_response.add_speech(SpeechType.plaintext, error)
return alexa_resp... | [
"def",
"intent_error_response",
"(",
"hass",
",",
"message",
",",
"error",
")",
":",
"alexa_intent_info",
"=",
"message",
".",
"get",
"(",
"\"request\"",
")",
".",
"get",
"(",
"\"intent\"",
")",
"alexa_response",
"=",
"AlexaResponse",
"(",
"hass",
",",
"alex... | [
101,
0
] | [
106,
35
] | python | en | ['en', 'de', 'en'] | True |
async_handle_message | (hass, message) | Handle an Alexa intent.
Raises:
- UnknownRequest
- intent.UnknownIntent
- intent.InvalidSlotInfo
- intent.IntentError
| Handle an Alexa intent. | async def async_handle_message(hass, message):
"""Handle an Alexa intent.
Raises:
- UnknownRequest
- intent.UnknownIntent
- intent.InvalidSlotInfo
- intent.IntentError
"""
req = message.get("request")
req_type = req["type"]
handler = HANDLERS.get(req_type)
if not hand... | [
"async",
"def",
"async_handle_message",
"(",
"hass",
",",
"message",
")",
":",
"req",
"=",
"message",
".",
"get",
"(",
"\"request\"",
")",
"req_type",
"=",
"req",
"[",
"\"type\"",
"]",
"handler",
"=",
"HANDLERS",
".",
"get",
"(",
"req_type",
")",
"if",
... | [
109,
0
] | [
127,
39
] | python | en | ['en', 'lb', 'en'] | True |
async_handle_session_end | (hass, message) | Handle a session end request. | Handle a session end request. | async def async_handle_session_end(hass, message):
"""Handle a session end request."""
return None | [
"async",
"def",
"async_handle_session_end",
"(",
"hass",
",",
"message",
")",
":",
"return",
"None"
] | [
131,
0
] | [
133,
15
] | python | en | ['en', 'en', 'en'] | True |
async_handle_intent | (hass, message) | Handle an intent request.
Raises:
- intent.UnknownIntent
- intent.InvalidSlotInfo
- intent.IntentError
| Handle an intent request. | async def async_handle_intent(hass, message):
"""Handle an intent request.
Raises:
- intent.UnknownIntent
- intent.InvalidSlotInfo
- intent.IntentError
"""
req = message.get("request")
alexa_intent_info = req.get("intent")
alexa_response = AlexaResponse(hass, alexa_intent_info)
... | [
"async",
"def",
"async_handle_intent",
"(",
"hass",
",",
"message",
")",
":",
"req",
"=",
"message",
".",
"get",
"(",
"\"request\"",
")",
"alexa_intent_info",
"=",
"req",
".",
"get",
"(",
"\"intent\"",
")",
"alexa_response",
"=",
"AlexaResponse",
"(",
"hass"... | [
138,
0
] | [
179,
35
] | python | en | ['en', 'en', 'en'] | True |
resolve_slot_synonyms | (key, request) | Check slot request for synonym resolutions. | Check slot request for synonym resolutions. | def resolve_slot_synonyms(key, request):
"""Check slot request for synonym resolutions."""
# Default to the spoken slot value if more than one or none are found. For
# reference to the request object structure, see the Alexa docs:
# https://tinyurl.com/ybvm7jhs
resolved_value = request["value"]
... | [
"def",
"resolve_slot_synonyms",
"(",
"key",
",",
"request",
")",
":",
"# Default to the spoken slot value if more than one or none are found. For",
"# reference to the request object structure, see the Alexa docs:",
"# https://tinyurl.com/ybvm7jhs",
"resolved_value",
"=",
"request",
"[",... | [
182,
0
] | [
216,
25
] | python | en | ['en', 'en', 'en'] | True |
AlexaIntentsView.post | (self, request) | Handle Alexa. | Handle Alexa. | async def post(self, request):
"""Handle Alexa."""
hass = request.app["hass"]
message = await request.json()
_LOGGER.debug("Received Alexa request: %s", message)
try:
response = await async_handle_message(hass, message)
return b"" if response is None els... | [
"async",
"def",
"post",
"(",
"self",
",",
"request",
")",
":",
"hass",
"=",
"request",
".",
"app",
"[",
"\"hass\"",
"]",
"message",
"=",
"await",
"request",
".",
"json",
"(",
")",
"_LOGGER",
".",
"debug",
"(",
"\"Received Alexa request: %s\"",
",",
"mess... | [
62,
4
] | [
98,
13
] | python | en | ['en', 'xh', 'en'] | False |
AlexaResponse.__init__ | (self, hass, intent_info) | Initialize the response. | Initialize the response. | def __init__(self, hass, intent_info):
"""Initialize the response."""
self.hass = hass
self.speech = None
self.card = None
self.reprompt = None
self.session_attributes = {}
self.should_end_session = True
self.variables = {}
# Intent is None if req... | [
"def",
"__init__",
"(",
"self",
",",
"hass",
",",
"intent_info",
")",
":",
"self",
".",
"hass",
"=",
"hass",
"self",
".",
"speech",
"=",
"None",
"self",
".",
"card",
"=",
"None",
"self",
".",
"reprompt",
"=",
"None",
"self",
".",
"session_attributes",
... | [
222,
4
] | [
241,
72
] | python | en | ['en', 'en', 'en'] | True |
AlexaResponse.add_card | (self, card_type, title, content) | Add a card to the response. | Add a card to the response. | def add_card(self, card_type, title, content):
"""Add a card to the response."""
assert self.card is None
card = {"type": card_type.value}
if card_type == CardType.link_account:
self.card = card
return
card["title"] = title
card["content"] = con... | [
"def",
"add_card",
"(",
"self",
",",
"card_type",
",",
"title",
",",
"content",
")",
":",
"assert",
"self",
".",
"card",
"is",
"None",
"card",
"=",
"{",
"\"type\"",
":",
"card_type",
".",
"value",
"}",
"if",
"card_type",
"==",
"CardType",
".",
"link_ac... | [
243,
4
] | [
255,
24
] | python | en | ['en', 'en', 'en'] | True |
AlexaResponse.add_speech | (self, speech_type, text) | Add speech to the response. | Add speech to the response. | def add_speech(self, speech_type, text):
"""Add speech to the response."""
assert self.speech is None
key = "ssml" if speech_type == SpeechType.ssml else "text"
self.speech = {"type": speech_type.value, key: text} | [
"def",
"add_speech",
"(",
"self",
",",
"speech_type",
",",
"text",
")",
":",
"assert",
"self",
".",
"speech",
"is",
"None",
"key",
"=",
"\"ssml\"",
"if",
"speech_type",
"==",
"SpeechType",
".",
"ssml",
"else",
"\"text\"",
"self",
".",
"speech",
"=",
"{",... | [
257,
4
] | [
263,
60
] | python | en | ['en', 'zh', 'en'] | True |
AlexaResponse.add_reprompt | (self, speech_type, text) | Add reprompt if user does not answer. | Add reprompt if user does not answer. | def add_reprompt(self, speech_type, text):
"""Add reprompt if user does not answer."""
assert self.reprompt is None
key = "ssml" if speech_type == SpeechType.ssml else "text"
self.reprompt = {
"type": speech_type.value,
key: text.async_render(self.variables, par... | [
"def",
"add_reprompt",
"(",
"self",
",",
"speech_type",
",",
"text",
")",
":",
"assert",
"self",
".",
"reprompt",
"is",
"None",
"key",
"=",
"\"ssml\"",
"if",
"speech_type",
"==",
"SpeechType",
".",
"ssml",
"else",
"\"text\"",
"self",
".",
"reprompt",
"=",
... | [
265,
4
] | [
274,
9
] | python | en | ['en', 'en', 'en'] | True |
AlexaResponse.as_dict | (self) | Return response in an Alexa valid dict. | Return response in an Alexa valid dict. | def as_dict(self):
"""Return response in an Alexa valid dict."""
response = {"shouldEndSession": self.should_end_session}
if self.card is not None:
response["card"] = self.card
if self.speech is not None:
response["outputSpeech"] = self.speech
if self.r... | [
"def",
"as_dict",
"(",
"self",
")",
":",
"response",
"=",
"{",
"\"shouldEndSession\"",
":",
"self",
".",
"should_end_session",
"}",
"if",
"self",
".",
"card",
"is",
"not",
"None",
":",
"response",
"[",
"\"card\"",
"]",
"=",
"self",
".",
"card",
"if",
"... | [
276,
4
] | [
293,
9
] | python | en | ['en', 'en', 'en'] | True |
async_setup | (hass, config) | Set up the NSW Fuel Station platform. | Set up the NSW Fuel Station platform. | async def async_setup(hass, config):
"""Set up the NSW Fuel Station platform."""
client = FuelCheckClient()
async def async_update_data():
return await hass.async_add_executor_job(fetch_station_price_data, client)
coordinator = DataUpdateCoordinator(
hass,
_LOGGER,
name... | [
"async",
"def",
"async_setup",
"(",
"hass",
",",
"config",
")",
":",
"client",
"=",
"FuelCheckClient",
"(",
")",
"async",
"def",
"async_update_data",
"(",
")",
":",
"return",
"await",
"hass",
".",
"async_add_executor_job",
"(",
"fetch_station_price_data",
",",
... | [
19,
0
] | [
37,
15
] | python | en | ['en', 'da', 'en'] | True |
fetch_station_price_data | (client: FuelCheckClient) | Fetch fuel price and station data. | Fetch fuel price and station data. | def fetch_station_price_data(client: FuelCheckClient) -> StationPriceData | None:
"""Fetch fuel price and station data."""
try:
raw_price_data = client.get_fuel_prices()
# Restructure prices and station details to be indexed by station code
# for O(1) lookup
return StationPriceDa... | [
"def",
"fetch_station_price_data",
"(",
"client",
":",
"FuelCheckClient",
")",
"->",
"StationPriceData",
"|",
"None",
":",
"try",
":",
"raw_price_data",
"=",
"client",
".",
"get_fuel_prices",
"(",
")",
"# Restructure prices and station details to be indexed by station code"... | [
48,
0
] | [
64,
18
] | python | en | ['en', 'en', 'en'] | True |
test_setup_missing_basic_config | (hass) | Test setup with configuration missing required entries. | Test setup with configuration missing required entries. | async def test_setup_missing_basic_config(hass):
"""Test setup with configuration missing required entries."""
assert await async_setup_component(
hass, binary_sensor.DOMAIN, {"binary_sensor": {"platform": "rest"}}
)
await hass.async_block_till_done()
assert len(hass.states.async_all()) == 0 | [
"async",
"def",
"test_setup_missing_basic_config",
"(",
"hass",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"binary_sensor",
".",
"DOMAIN",
",",
"{",
"\"binary_sensor\"",
":",
"{",
"\"platform\"",
":",
"\"rest\"",
"}",
"}",
")",
"awai... | [
22,
0
] | [
28,
44
] | python | en | ['en', 'en', 'en'] | True |
test_setup_missing_config | (hass) | Test setup with configuration missing required entries. | Test setup with configuration missing required entries. | async def test_setup_missing_config(hass):
"""Test setup with configuration missing required entries."""
assert await async_setup_component(
hass,
binary_sensor.DOMAIN,
{
"binary_sensor": {
"platform": "rest",
"resource": "localhost",
... | [
"async",
"def",
"test_setup_missing_config",
"(",
"hass",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"binary_sensor",
".",
"DOMAIN",
",",
"{",
"\"binary_sensor\"",
":",
"{",
"\"platform\"",
":",
"\"rest\"",
",",
"\"resource\"",
":",
... | [
31,
0
] | [
45,
44
] | python | en | ['en', 'en', 'en'] | True |
test_setup_failed_connect | (hass, caplog) | Test setup when connection error occurs. | Test setup when connection error occurs. | async def test_setup_failed_connect(hass, caplog):
"""Test setup when connection error occurs."""
respx.get("http://localhost").mock(
side_effect=httpx.RequestError("server offline", request=MagicMock())
)
assert await async_setup_component(
hass,
binary_sensor.DOMAIN,
{... | [
"async",
"def",
"test_setup_failed_connect",
"(",
"hass",
",",
"caplog",
")",
":",
"respx",
".",
"get",
"(",
"\"http://localhost\"",
")",
".",
"mock",
"(",
"side_effect",
"=",
"httpx",
".",
"RequestError",
"(",
"\"server offline\"",
",",
"request",
"=",
"Magic... | [
49,
0
] | [
68,
42
] | python | en | ['en', 'en', 'en'] | True |
test_setup_timeout | (hass) | Test setup when connection timeout occurs. | Test setup when connection timeout occurs. | async def test_setup_timeout(hass):
"""Test setup when connection timeout occurs."""
respx.get("http://localhost").mock(side_effect=asyncio.TimeoutError())
assert await async_setup_component(
hass,
binary_sensor.DOMAIN,
{
"binary_sensor": {
"platform": "re... | [
"async",
"def",
"test_setup_timeout",
"(",
"hass",
")",
":",
"respx",
".",
"get",
"(",
"\"http://localhost\"",
")",
".",
"mock",
"(",
"side_effect",
"=",
"asyncio",
".",
"TimeoutError",
"(",
")",
")",
"assert",
"await",
"async_setup_component",
"(",
"hass",
... | [
72,
0
] | [
87,
44
] | python | en | ['en', 'en', 'en'] | True |
test_setup_minimum | (hass) | Test setup with minimum configuration. | Test setup with minimum configuration. | async def test_setup_minimum(hass):
"""Test setup with minimum configuration."""
respx.get("http://localhost") % 200
assert await async_setup_component(
hass,
binary_sensor.DOMAIN,
{
"binary_sensor": {
"platform": "rest",
"resource": "http:... | [
"async",
"def",
"test_setup_minimum",
"(",
"hass",
")",
":",
"respx",
".",
"get",
"(",
"\"http://localhost\"",
")",
"%",
"200",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"binary_sensor",
".",
"DOMAIN",
",",
"{",
"\"binary_sensor\"",
":",
"{... | [
91,
0
] | [
106,
44
] | python | en | ['en', 'zu', 'en'] | True |
test_setup_minimum_resource_template | (hass) | Test setup with minimum configuration (resource_template). | Test setup with minimum configuration (resource_template). | async def test_setup_minimum_resource_template(hass):
"""Test setup with minimum configuration (resource_template)."""
respx.get("http://localhost") % 200
assert await async_setup_component(
hass,
binary_sensor.DOMAIN,
{
"binary_sensor": {
"platform": "res... | [
"async",
"def",
"test_setup_minimum_resource_template",
"(",
"hass",
")",
":",
"respx",
".",
"get",
"(",
"\"http://localhost\"",
")",
"%",
"200",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"binary_sensor",
".",
"DOMAIN",
",",
"{",
"\"binary_sens... | [
110,
0
] | [
124,
44
] | python | en | ['en', 'en', 'en'] | True |
test_setup_duplicate_resource_template | (hass) | Test setup with duplicate resources. | Test setup with duplicate resources. | async def test_setup_duplicate_resource_template(hass):
"""Test setup with duplicate resources."""
respx.get("http://localhost") % 200
assert await async_setup_component(
hass,
binary_sensor.DOMAIN,
{
"binary_sensor": {
"platform": "rest",
... | [
"async",
"def",
"test_setup_duplicate_resource_template",
"(",
"hass",
")",
":",
"respx",
".",
"get",
"(",
"\"http://localhost\"",
")",
"%",
"200",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"binary_sensor",
".",
"DOMAIN",
",",
"{",
"\"binary_se... | [
128,
0
] | [
143,
44
] | python | en | ['en', 'en', 'en'] | True |
test_setup_get | (hass) | Test setup with valid configuration. | Test setup with valid configuration. | async def test_setup_get(hass):
"""Test setup with valid configuration."""
respx.get("http://localhost").respond(status_code=200, json={})
assert await async_setup_component(
hass,
"binary_sensor",
{
"binary_sensor": {
"platform": "rest",
"... | [
"async",
"def",
"test_setup_get",
"(",
"hass",
")",
":",
"respx",
".",
"get",
"(",
"\"http://localhost\"",
")",
".",
"respond",
"(",
"status_code",
"=",
"200",
",",
"json",
"=",
"{",
"}",
")",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
... | [
147,
0
] | [
171,
44
] | python | en | ['en', 'en', 'en'] | True |
test_setup_get_digest_auth | (hass) | Test setup with valid configuration. | Test setup with valid configuration. | async def test_setup_get_digest_auth(hass):
"""Test setup with valid configuration."""
respx.get("http://localhost").respond(status_code=200, json={})
assert await async_setup_component(
hass,
"binary_sensor",
{
"binary_sensor": {
"platform": "rest",
... | [
"async",
"def",
"test_setup_get_digest_auth",
"(",
"hass",
")",
":",
"respx",
".",
"get",
"(",
"\"http://localhost\"",
")",
".",
"respond",
"(",
"status_code",
"=",
"200",
",",
"json",
"=",
"{",
"}",
")",
"assert",
"await",
"async_setup_component",
"(",
"has... | [
175,
0
] | [
199,
44
] | python | en | ['en', 'en', 'en'] | True |
test_setup_post | (hass) | Test setup with valid configuration. | Test setup with valid configuration. | async def test_setup_post(hass):
"""Test setup with valid configuration."""
respx.post("http://localhost").respond(status_code=200, json={})
assert await async_setup_component(
hass,
"binary_sensor",
{
"binary_sensor": {
"platform": "rest",
... | [
"async",
"def",
"test_setup_post",
"(",
"hass",
")",
":",
"respx",
".",
"post",
"(",
"\"http://localhost\"",
")",
".",
"respond",
"(",
"status_code",
"=",
"200",
",",
"json",
"=",
"{",
"}",
")",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",... | [
203,
0
] | [
227,
44
] | python | en | ['en', 'en', 'en'] | True |
test_setup_get_off | (hass) | Test setup with valid off configuration. | Test setup with valid off configuration. | async def test_setup_get_off(hass):
"""Test setup with valid off configuration."""
respx.get("http://localhost").respond(
status_code=200,
headers={"content-type": "text/json"},
json={"dog": False},
)
assert await async_setup_component(
hass,
"binary_sensor",
... | [
"async",
"def",
"test_setup_get_off",
"(",
"hass",
")",
":",
"respx",
".",
"get",
"(",
"\"http://localhost\"",
")",
".",
"respond",
"(",
"status_code",
"=",
"200",
",",
"headers",
"=",
"{",
"\"content-type\"",
":",
"\"text/json\"",
"}",
",",
"json",
"=",
"... | [
231,
0
] | [
257,
35
] | python | en | ['en', 'en', 'en'] | True |
test_setup_get_on | (hass) | Test setup with valid on configuration. | Test setup with valid on configuration. | async def test_setup_get_on(hass):
"""Test setup with valid on configuration."""
respx.get("http://localhost").respond(
status_code=200,
headers={"content-type": "text/json"},
json={"dog": True},
)
assert await async_setup_component(
hass,
"binary_sensor",
... | [
"async",
"def",
"test_setup_get_on",
"(",
"hass",
")",
":",
"respx",
".",
"get",
"(",
"\"http://localhost\"",
")",
".",
"respond",
"(",
"status_code",
"=",
"200",
",",
"headers",
"=",
"{",
"\"content-type\"",
":",
"\"text/json\"",
"}",
",",
"json",
"=",
"{... | [
261,
0
] | [
287,
34
] | python | en | ['en', 'en', 'en'] | True |
test_setup_with_exception | (hass) | Test setup with exception. | Test setup with exception. | async def test_setup_with_exception(hass):
"""Test setup with exception."""
respx.get("http://localhost").respond(status_code=200, json={})
assert await async_setup_component(
hass,
"binary_sensor",
{
"binary_sensor": {
"platform": "rest",
... | [
"async",
"def",
"test_setup_with_exception",
"(",
"hass",
")",
":",
"respx",
".",
"get",
"(",
"\"http://localhost\"",
")",
".",
"respond",
"(",
"status_code",
"=",
"200",
",",
"json",
"=",
"{",
"}",
")",
"assert",
"await",
"async_setup_component",
"(",
"hass... | [
291,
0
] | [
329,
43
] | python | en | ['en', 'en', 'en'] | True |
test_reload | (hass) | Verify we can reload reset sensors. | Verify we can reload reset sensors. | async def test_reload(hass):
"""Verify we can reload reset sensors."""
respx.get("http://localhost") % 200
await async_setup_component(
hass,
"binary_sensor",
{
"binary_sensor": {
"platform": "rest",
"method": "GET",
"name... | [
"async",
"def",
"test_reload",
"(",
"hass",
")",
":",
"respx",
".",
"get",
"(",
"\"http://localhost\"",
")",
"%",
"200",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"binary_sensor\"",
",",
"{",
"\"binary_sensor\"",
":",
"{",
"\"platform\"",
":",
"\"r... | [
333,
0
] | [
373,
51
] | python | en | ['en', 'ca', 'en'] | True |
test_setup_query_params | (hass) | Test setup with query params. | Test setup with query params. | async def test_setup_query_params(hass):
"""Test setup with query params."""
respx.get("http://localhost", params={"search": "something"}) % 200
assert await async_setup_component(
hass,
binary_sensor.DOMAIN,
{
"binary_sensor": {
"platform": "rest",
... | [
"async",
"def",
"test_setup_query_params",
"(",
"hass",
")",
":",
"respx",
".",
"get",
"(",
"\"http://localhost\"",
",",
"params",
"=",
"{",
"\"search\"",
":",
"\"something\"",
"}",
")",
"%",
"200",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",... | [
377,
0
] | [
393,
44
] | python | en | ['en', 'en', 'en'] | True |
ActivityStream.__init__ | (self, hass, api, august_gateway, house_ids, pubnub) | Init August activity stream object. | Init August activity stream object. | def __init__(self, hass, api, august_gateway, house_ids, pubnub):
"""Init August activity stream object."""
super().__init__(hass, ACTIVITY_UPDATE_INTERVAL)
self._hass = hass
self._schedule_updates = {}
self._august_gateway = august_gateway
self._api = api
self._h... | [
"def",
"__init__",
"(",
"self",
",",
"hass",
",",
"api",
",",
"august_gateway",
",",
"house_ids",
",",
"pubnub",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"hass",
",",
"ACTIVITY_UPDATE_INTERVAL",
")",
"self",
".",
"_hass",
"=",
"hass",
"self",
... | [
23,
4
] | [
34,
34
] | python | en | ['en', 'en', 'en'] | True |
ActivityStream.async_setup | (self) | Token refresh check and catch up the activity stream. | Token refresh check and catch up the activity stream. | async def async_setup(self):
"""Token refresh check and catch up the activity stream."""
for house_id in self._house_ids:
self._update_debounce[house_id] = self._async_create_debouncer(house_id)
await self._async_refresh(utcnow()) | [
"async",
"def",
"async_setup",
"(",
"self",
")",
":",
"for",
"house_id",
"in",
"self",
".",
"_house_ids",
":",
"self",
".",
"_update_debounce",
"[",
"house_id",
"]",
"=",
"self",
".",
"_async_create_debouncer",
"(",
"house_id",
")",
"await",
"self",
".",
"... | [
36,
4
] | [
41,
43
] | python | en | ['en', 'en', 'en'] | True |
ActivityStream._async_create_debouncer | (self, house_id) | Create a debouncer for the house id. | Create a debouncer for the house id. | def _async_create_debouncer(self, house_id):
"""Create a debouncer for the house id."""
async def _async_update_house_id():
await self._async_update_house_id(house_id)
return Debouncer(
self._hass,
_LOGGER,
cooldown=ACTIVITY_UPDATE_INTERVAL.total... | [
"def",
"_async_create_debouncer",
"(",
"self",
",",
"house_id",
")",
":",
"async",
"def",
"_async_update_house_id",
"(",
")",
":",
"await",
"self",
".",
"_async_update_house_id",
"(",
"house_id",
")",
"return",
"Debouncer",
"(",
"self",
".",
"_hass",
",",
"_LO... | [
44,
4
] | [
56,
9
] | python | en | ['en', 'en', 'en'] | True |
ActivityStream.async_stop | (self) | Cleanup any debounces. | Cleanup any debounces. | def async_stop(self):
"""Cleanup any debounces."""
for debouncer in self._update_debounce.values():
debouncer.async_cancel()
for house_id, updater in self._schedule_updates.items():
if updater is not None:
updater()
self._schedule_updates[h... | [
"def",
"async_stop",
"(",
"self",
")",
":",
"for",
"debouncer",
"in",
"self",
".",
"_update_debounce",
".",
"values",
"(",
")",
":",
"debouncer",
".",
"async_cancel",
"(",
")",
"for",
"house_id",
",",
"updater",
"in",
"self",
".",
"_schedule_updates",
".",... | [
59,
4
] | [
66,
55
] | python | en | ['en', 'en', 'en'] | True |
ActivityStream.get_latest_device_activity | (self, device_id, activity_types) | Return latest activity that is one of the acitivty_types. | Return latest activity that is one of the acitivty_types. | def get_latest_device_activity(self, device_id, activity_types):
"""Return latest activity that is one of the acitivty_types."""
if device_id not in self._latest_activities:
return None
latest_device_activities = self._latest_activities[device_id]
latest_activity = None
... | [
"def",
"get_latest_device_activity",
"(",
"self",
",",
"device_id",
",",
"activity_types",
")",
":",
"if",
"device_id",
"not",
"in",
"self",
".",
"_latest_activities",
":",
"return",
"None",
"latest_device_activities",
"=",
"self",
".",
"_latest_activities",
"[",
... | [
68,
4
] | [
86,
30
] | python | en | ['en', 'en', 'en'] | True |
ActivityStream._async_refresh | (self, time) | Update the activity stream from August. | Update the activity stream from August. | async def _async_refresh(self, time):
"""Update the activity stream from August."""
# This is the only place we refresh the api token
await self._august_gateway.async_refresh_access_token_if_needed()
if self.pubnub.connected:
_LOGGER.debug("Skipping update because pubnub is c... | [
"async",
"def",
"_async_refresh",
"(",
"self",
",",
"time",
")",
":",
"# This is the only place we refresh the api token",
"await",
"self",
".",
"_august_gateway",
".",
"async_refresh_access_token_if_needed",
"(",
")",
"if",
"self",
".",
"pubnub",
".",
"connected",
":... | [
88,
4
] | [
95,
56
] | python | en | ['en', 'en', 'en'] | True |
ActivityStream.async_schedule_house_id_refresh | (self, house_id) | Update for a house activities now and once in the future. | Update for a house activities now and once in the future. | def async_schedule_house_id_refresh(self, house_id):
"""Update for a house activities now and once in the future."""
if self._schedule_updates.get(house_id):
self._schedule_updates[house_id]()
self._schedule_updates[house_id] = None
async def _update_house_activities(_):... | [
"def",
"async_schedule_house_id_refresh",
"(",
"self",
",",
"house_id",
")",
":",
"if",
"self",
".",
"_schedule_updates",
".",
"get",
"(",
"house_id",
")",
":",
"self",
".",
"_schedule_updates",
"[",
"house_id",
"]",
"(",
")",
"self",
".",
"_schedule_updates",... | [
108,
4
] | [
125,
9
] | python | en | ['en', 'en', 'en'] | True |
ActivityStream._async_update_house_id | (self, house_id) | Update device activities for a house. | Update device activities for a house. | async def _async_update_house_id(self, house_id):
"""Update device activities for a house."""
if self._last_update_time:
limit = ACTIVITY_STREAM_FETCH_LIMIT
else:
limit = ACTIVITY_CATCH_UP_FETCH_LIMIT
_LOGGER.debug("Updating device activity for house id %s", hous... | [
"async",
"def",
"_async_update_house_id",
"(",
"self",
",",
"house_id",
")",
":",
"if",
"self",
".",
"_last_update_time",
":",
"limit",
"=",
"ACTIVITY_STREAM_FETCH_LIMIT",
"else",
":",
"limit",
"=",
"ACTIVITY_CATCH_UP_FETCH_LIMIT",
"_LOGGER",
".",
"debug",
"(",
"\... | [
127,
4
] | [
162,
57
] | python | en | ['en', 'en', 'en'] | True |
ActivityStream.async_process_newer_device_activities | (self, activities) | Process activities if they are newer than the last one. | Process activities if they are newer than the last one. | def async_process_newer_device_activities(self, activities):
"""Process activities if they are newer than the last one."""
updated_device_ids = set()
for activity in activities:
device_id = activity.device_id
activity_type = activity.activity_type
device_activ... | [
"def",
"async_process_newer_device_activities",
"(",
"self",
",",
"activities",
")",
":",
"updated_device_ids",
"=",
"set",
"(",
")",
"for",
"activity",
"in",
"activities",
":",
"device_id",
"=",
"activity",
".",
"device_id",
"activity_type",
"=",
"activity",
".",... | [
164,
4
] | [
184,
33
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (hass, config_entry, async_add_entities) | Set up mobile app sensor from a config entry. | Set up mobile app sensor from a config entry. | async def async_setup_entry(hass, config_entry, async_add_entities):
"""Set up mobile app sensor from a config entry."""
entities = []
webhook_id = config_entry.data[CONF_WEBHOOK_ID]
entity_registry = await er.async_get_registry(hass)
entries = er.async_entries_for_config_entry(entity_registry, co... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
",",
"config_entry",
",",
"async_add_entities",
")",
":",
"entities",
"=",
"[",
"]",
"webhook_id",
"=",
"config_entry",
".",
"data",
"[",
"CONF_WEBHOOK_ID",
"]",
"entity_registry",
"=",
"await",
"er",
".",
"asy... | [
24,
0
] | [
69,
5
] | python | en | ['en', 'en', 'en'] | True |
MobileAppSensor.native_value | (self) | Return the state of the sensor. | Return the state of the sensor. | def native_value(self):
"""Return the state of the sensor."""
return self._config[ATTR_SENSOR_STATE] | [
"def",
"native_value",
"(",
"self",
")",
":",
"return",
"self",
".",
"_config",
"[",
"ATTR_SENSOR_STATE",
"]"
] | [
76,
4
] | [
78,
46
] | python | en | ['en', 'en', 'en'] | True |
MobileAppSensor.native_unit_of_measurement | (self) | Return the unit of measurement this sensor expresses itself in. | Return the unit of measurement this sensor expresses itself in. | def native_unit_of_measurement(self):
"""Return the unit of measurement this sensor expresses itself in."""
return self._config.get(ATTR_SENSOR_UOM) | [
"def",
"native_unit_of_measurement",
"(",
"self",
")",
":",
"return",
"self",
".",
"_config",
".",
"get",
"(",
"ATTR_SENSOR_UOM",
")"
] | [
81,
4
] | [
83,
48
] | python | en | ['en', 'en', 'en'] | True |
setup_platform | (hass, config_entry, config) | Set up the switch platform for testing. | Set up the switch platform for testing. | async def setup_platform(hass, config_entry, config):
"""Set up the switch platform for testing."""
config_entry.add_to_hass(hass)
assert await async_setup_component(hass, DOMAIN, config)
await hass.async_block_till_done() | [
"async",
"def",
"setup_platform",
"(",
"hass",
",",
"config_entry",
",",
"config",
")",
":",
"config_entry",
".",
"add_to_hass",
"(",
"hass",
")",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"DOMAIN",
",",
"config",
")",
"await",
"hass",
".... | [
17,
0
] | [
21,
38
] | python | en | ['en', 'en', 'en'] | True |
test_entity_registry | (hass, config_entry, config) | Test sonos device with alarm registered in the device registry. | Test sonos device with alarm registered in the device registry. | async def test_entity_registry(hass, config_entry, config):
"""Test sonos device with alarm registered in the device registry."""
await setup_platform(hass, config_entry, config)
entity_registry = await hass.helpers.entity_registry.async_get_registry()
assert "media_player.zone_a" in entity_registry.e... | [
"async",
"def",
"test_entity_registry",
"(",
"hass",
",",
"config_entry",
",",
"config",
")",
":",
"await",
"setup_platform",
"(",
"hass",
",",
"config_entry",
",",
"config",
")",
"entity_registry",
"=",
"await",
"hass",
".",
"helpers",
".",
"entity_registry",
... | [
24,
0
] | [
31,
62
] | python | en | ['en', 'en', 'en'] | True |
test_alarm_attributes | (hass, config_entry, config) | Test for correct sonos alarm state. | Test for correct sonos alarm state. | async def test_alarm_attributes(hass, config_entry, config):
"""Test for correct sonos alarm state."""
await setup_platform(hass, config_entry, config)
entity_registry = await hass.helpers.entity_registry.async_get_registry()
alarm = entity_registry.entities["switch.sonos_alarm_14"]
alarm_state = ... | [
"async",
"def",
"test_alarm_attributes",
"(",
"hass",
",",
"config_entry",
",",
"config",
")",
":",
"await",
"setup_platform",
"(",
"hass",
",",
"config_entry",
",",
"config",
")",
"entity_registry",
"=",
"await",
"hass",
".",
"helpers",
".",
"entity_registry",
... | [
34,
0
] | [
49,
68
] | python | en | ['es', 'en', 'it'] | False |
test_alarm_create_delete | (
hass, config_entry, config, soco, alarm_clock, alarm_clock_extended, alarm_event
) | Test for correct creation and deletion of alarms during runtime. | Test for correct creation and deletion of alarms during runtime. | async def test_alarm_create_delete(
hass, config_entry, config, soco, alarm_clock, alarm_clock_extended, alarm_event
):
"""Test for correct creation and deletion of alarms during runtime."""
entity_registry = async_get_entity_registry(hass)
one_alarm = copy(alarm_clock.ListAlarms.return_value)
two_... | [
"async",
"def",
"test_alarm_create_delete",
"(",
"hass",
",",
"config_entry",
",",
"config",
",",
"soco",
",",
"alarm_clock",
",",
"alarm_clock_extended",
",",
"alarm_event",
")",
":",
"entity_registry",
"=",
"async_get_entity_registry",
"(",
"hass",
")",
"one_alarm... | [
52,
0
] | [
85,
66
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (hass: HomeAssistant, entry: ConfigEntry) | Set up Bosch SHC from a config entry. | Set up Bosch SHC from a config entry. | async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Set up Bosch SHC from a config entry."""
data = entry.data
zeroconf = await async_get_instance(hass)
try:
session = await hass.async_add_executor_job(
SHCSession,
data[CONF_HOST],
... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
":",
"HomeAssistant",
",",
"entry",
":",
"ConfigEntry",
")",
"->",
"bool",
":",
"data",
"=",
"entry",
".",
"data",
"zeroconf",
"=",
"await",
"async_get_instance",
"(",
"hass",
")",
"try",
":",
"session",
"=... | [
26,
0
] | [
76,
15
] | python | en | ['en', 'en', 'en'] | True |
async_unload_entry | (hass: HomeAssistant, entry: ConfigEntry) | Unload a config entry. | Unload a config entry. | async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Unload a config entry."""
session: SHCSession = hass.data[DOMAIN][entry.entry_id][DATA_SESSION]
hass.data[DOMAIN][entry.entry_id][DATA_POLLING_HANDLER]()
hass.data[DOMAIN][entry.entry_id].pop(DATA_POLLING_HANDLER)
awa... | [
"async",
"def",
"async_unload_entry",
"(",
"hass",
":",
"HomeAssistant",
",",
"entry",
":",
"ConfigEntry",
")",
"->",
"bool",
":",
"session",
":",
"SHCSession",
"=",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"[",
"entry",
".",
"entry_id",
"]",
"[",
"DATA_... | [
79,
0
] | [
91,
20
] | python | en | ['en', 'es', 'en'] | True |
camera_client_fixture | (hass, hass_client) | Fixture to fetch camera streams. | Fixture to fetch camera streams. | def camera_client_fixture(hass, hass_client):
"""Fixture to fetch camera streams."""
assert hass.loop.run_until_complete(
async_setup_component(
hass,
"camera",
{
"camera": {
"name": "config_test",
"platform": "m... | [
"def",
"camera_client_fixture",
"(",
"hass",
",",
"hass_client",
")",
":",
"assert",
"hass",
".",
"loop",
".",
"run_until_complete",
"(",
"async_setup_component",
"(",
"hass",
",",
"\"camera\"",
",",
"{",
"\"camera\"",
":",
"{",
"\"name\"",
":",
"\"config_test\"... | [
13,
0
] | [
30,
53
] | python | en | ['en', 'es', 'en'] | True |
test_get_clientsession_with_ssl | (hass) | Test init clientsession with ssl. | Test init clientsession with ssl. | async def test_get_clientsession_with_ssl(hass):
"""Test init clientsession with ssl."""
client.async_get_clientsession(hass)
assert isinstance(hass.data[client.DATA_CLIENTSESSION], aiohttp.ClientSession)
assert isinstance(hass.data[client.DATA_CONNECTOR], aiohttp.TCPConnector) | [
"async",
"def",
"test_get_clientsession_with_ssl",
"(",
"hass",
")",
":",
"client",
".",
"async_get_clientsession",
"(",
"hass",
")",
"assert",
"isinstance",
"(",
"hass",
".",
"data",
"[",
"client",
".",
"DATA_CLIENTSESSION",
"]",
",",
"aiohttp",
".",
"ClientSes... | [
33,
0
] | [
38,
77
] | python | en | ['en', 'en', 'en'] | True |
test_get_clientsession_without_ssl | (hass) | Test init clientsession without ssl. | Test init clientsession without ssl. | async def test_get_clientsession_without_ssl(hass):
"""Test init clientsession without ssl."""
client.async_get_clientsession(hass, verify_ssl=False)
assert isinstance(
hass.data[client.DATA_CLIENTSESSION_NOTVERIFY], aiohttp.ClientSession
)
assert isinstance(hass.data[client.DATA_CONNECTOR_... | [
"async",
"def",
"test_get_clientsession_without_ssl",
"(",
"hass",
")",
":",
"client",
".",
"async_get_clientsession",
"(",
"hass",
",",
"verify_ssl",
"=",
"False",
")",
"assert",
"isinstance",
"(",
"hass",
".",
"data",
"[",
"client",
".",
"DATA_CLIENTSESSION_NOTV... | [
41,
0
] | [
48,
87
] | python | en | ['en', 'en', 'en'] | True |
test_create_clientsession_with_ssl_and_cookies | (hass) | Test create clientsession with ssl. | Test create clientsession with ssl. | async def test_create_clientsession_with_ssl_and_cookies(hass):
"""Test create clientsession with ssl."""
session = client.async_create_clientsession(hass, cookies={"bla": True})
assert isinstance(session, aiohttp.ClientSession)
assert isinstance(hass.data[client.DATA_CONNECTOR], aiohttp.TCPConnector) | [
"async",
"def",
"test_create_clientsession_with_ssl_and_cookies",
"(",
"hass",
")",
":",
"session",
"=",
"client",
".",
"async_create_clientsession",
"(",
"hass",
",",
"cookies",
"=",
"{",
"\"bla\"",
":",
"True",
"}",
")",
"assert",
"isinstance",
"(",
"session",
... | [
51,
0
] | [
55,
77
] | python | en | ['en', 'en', 'en'] | True |
test_create_clientsession_without_ssl_and_cookies | (hass) | Test create clientsession without ssl. | Test create clientsession without ssl. | async def test_create_clientsession_without_ssl_and_cookies(hass):
"""Test create clientsession without ssl."""
session = client.async_create_clientsession(hass, False, cookies={"bla": True})
assert isinstance(session, aiohttp.ClientSession)
assert isinstance(hass.data[client.DATA_CONNECTOR_NOTVERIFY], ... | [
"async",
"def",
"test_create_clientsession_without_ssl_and_cookies",
"(",
"hass",
")",
":",
"session",
"=",
"client",
".",
"async_create_clientsession",
"(",
"hass",
",",
"False",
",",
"cookies",
"=",
"{",
"\"bla\"",
":",
"True",
"}",
")",
"assert",
"isinstance",
... | [
58,
0
] | [
62,
87
] | python | en | ['en', 'en', 'en'] | True |
test_get_clientsession_cleanup | (hass) | Test init clientsession with ssl. | Test init clientsession with ssl. | async def test_get_clientsession_cleanup(hass):
"""Test init clientsession with ssl."""
client.async_get_clientsession(hass)
assert isinstance(hass.data[client.DATA_CLIENTSESSION], aiohttp.ClientSession)
assert isinstance(hass.data[client.DATA_CONNECTOR], aiohttp.TCPConnector)
hass.bus.async_fire(... | [
"async",
"def",
"test_get_clientsession_cleanup",
"(",
"hass",
")",
":",
"client",
".",
"async_get_clientsession",
"(",
"hass",
")",
"assert",
"isinstance",
"(",
"hass",
".",
"data",
"[",
"client",
".",
"DATA_CLIENTSESSION",
"]",
",",
"aiohttp",
".",
"ClientSess... | [
65,
0
] | [
76,
50
] | python | en | ['en', 'en', 'en'] | True |
test_get_clientsession_cleanup_without_ssl | (hass) | Test init clientsession with ssl. | Test init clientsession with ssl. | async def test_get_clientsession_cleanup_without_ssl(hass):
"""Test init clientsession with ssl."""
client.async_get_clientsession(hass, verify_ssl=False)
assert isinstance(
hass.data[client.DATA_CLIENTSESSION_NOTVERIFY], aiohttp.ClientSession
)
assert isinstance(hass.data[client.DATA_CONNE... | [
"async",
"def",
"test_get_clientsession_cleanup_without_ssl",
"(",
"hass",
")",
":",
"client",
".",
"async_get_clientsession",
"(",
"hass",
",",
"verify_ssl",
"=",
"False",
")",
"assert",
"isinstance",
"(",
"hass",
".",
"data",
"[",
"client",
".",
"DATA_CLIENTSESS... | [
79,
0
] | [
92,
60
] | python | en | ['en', 'en', 'en'] | True |
test_get_clientsession_patched_close | (hass) | Test closing clientsession does not work. | Test closing clientsession does not work. | async def test_get_clientsession_patched_close(hass):
"""Test closing clientsession does not work."""
with patch("aiohttp.ClientSession.close") as mock_close:
session = client.async_get_clientsession(hass)
assert isinstance(hass.data[client.DATA_CLIENTSESSION], aiohttp.ClientSession)
as... | [
"async",
"def",
"test_get_clientsession_patched_close",
"(",
"hass",
")",
":",
"with",
"patch",
"(",
"\"aiohttp.ClientSession.close\"",
")",
"as",
"mock_close",
":",
"session",
"=",
"client",
".",
"async_get_clientsession",
"(",
"hass",
")",
"assert",
"isinstance",
... | [
95,
0
] | [
106,
41
] | python | en | ['en', 'en', 'en'] | True |
test_warning_close_session_integration | (hass, caplog) | Test log warning message when closing the session from integration context. | Test log warning message when closing the session from integration context. | async def test_warning_close_session_integration(hass, caplog):
"""Test log warning message when closing the session from integration context."""
with patch(
"homeassistant.helpers.frame.extract_stack",
return_value=[
Mock(
filename="/home/paulus/homeassistant/core.py... | [
"async",
"def",
"test_warning_close_session_integration",
"(",
"hass",
",",
"caplog",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.helpers.frame.extract_stack\"",
",",
"return_value",
"=",
"[",
"Mock",
"(",
"filename",
"=",
"\"/home/paulus/homeassistant/core.py\"",
",... | [
109,
0
] | [
137,
20
] | python | en | ['en', 'en', 'en'] | True |
test_warning_close_session_custom | (hass, caplog) | Test log warning message when closing the session from custom context. | Test log warning message when closing the session from custom context. | async def test_warning_close_session_custom(hass, caplog):
"""Test log warning message when closing the session from custom context."""
with patch(
"homeassistant.helpers.frame.extract_stack",
return_value=[
Mock(
filename="/home/paulus/homeassistant/core.py",
... | [
"async",
"def",
"test_warning_close_session_custom",
"(",
"hass",
",",
"caplog",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.helpers.frame.extract_stack\"",
",",
"return_value",
"=",
"[",
"Mock",
"(",
"filename",
"=",
"\"/home/paulus/homeassistant/core.py\"",
",",
... | [
140,
0
] | [
168,
5
] | python | en | ['en', 'en', 'en'] | True |
test_async_aiohttp_proxy_stream | (aioclient_mock, camera_client) | Test that it fetches the given url. | Test that it fetches the given url. | async def test_async_aiohttp_proxy_stream(aioclient_mock, camera_client):
"""Test that it fetches the given url."""
aioclient_mock.get("http://example.com/mjpeg_stream", content=b"Frame1Frame2Frame3")
resp = await camera_client.get("/api/camera_proxy_stream/camera.config_test")
assert resp.status == 2... | [
"async",
"def",
"test_async_aiohttp_proxy_stream",
"(",
"aioclient_mock",
",",
"camera_client",
")",
":",
"aioclient_mock",
".",
"get",
"(",
"\"http://example.com/mjpeg_stream\"",
",",
"content",
"=",
"b\"Frame1Frame2Frame3\"",
")",
"resp",
"=",
"await",
"camera_client",
... | [
171,
0
] | [
180,
39
] | python | en | ['en', 'en', 'en'] | True |
test_async_aiohttp_proxy_stream_timeout | (aioclient_mock, camera_client) | Test that it fetches the given url. | Test that it fetches the given url. | async def test_async_aiohttp_proxy_stream_timeout(aioclient_mock, camera_client):
"""Test that it fetches the given url."""
aioclient_mock.get("http://example.com/mjpeg_stream", exc=asyncio.TimeoutError())
resp = await camera_client.get("/api/camera_proxy_stream/camera.config_test")
assert resp.status ... | [
"async",
"def",
"test_async_aiohttp_proxy_stream_timeout",
"(",
"aioclient_mock",
",",
"camera_client",
")",
":",
"aioclient_mock",
".",
"get",
"(",
"\"http://example.com/mjpeg_stream\"",
",",
"exc",
"=",
"asyncio",
".",
"TimeoutError",
"(",
")",
")",
"resp",
"=",
"... | [
183,
0
] | [
188,
29
] | 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.