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
Section.section_name
(self)
Returns the value of the section.
Returns the value of the section.
def section_name(self): """ Returns the value of the section. """ return self.value
[ "def", "section_name", "(", "self", ")", ":", "return", "self", ".", "value" ]
[ 428, 4 ]
[ 432, 25 ]
python
en
['en', 'error', 'th']
False
Result.get_keys
(self)
Returns the unique names of all the grandchildren as a list.
Returns the unique names of all the grandchildren as a list.
def get_keys(self): """ Returns the unique names of all the grandchildren as a list. """ return sorted(set(c.name for c in self.grandchildren))
[ "def", "get_keys", "(", "self", ")", ":", "return", "sorted", "(", "set", "(", "c", ".", "name", "for", "c", "in", "self", ".", "grandchildren", ")", ")" ]
[ 459, 4 ]
[ 463, 62 ]
python
en
['en', 'error', 'th']
False
Result.get_crumbs
(self, down=False)
Get the unique names from the current locations to the roots.
Get the unique names from the current locations to the roots.
def get_crumbs(self, down=False): """ Get the unique names from the current locations to the roots. """ res = chain.from_iterable(c.get_crumbs(down=down) for c in self.children) return sorted(set(res))
[ "def", "get_crumbs", "(", "self", ",", "down", "=", "False", ")", ":", "res", "=", "chain", ".", "from_iterable", "(", "c", ".", "get_crumbs", "(", "down", "=", "down", ")", "for", "c", "in", "self", ".", "children", ")", "return", "sorted", "(", "...
[ 467, 4 ]
[ 472, 31 ]
python
en
['en', 'error', 'th']
False
Result.line
(self)
Returns the line of the child if only one child exists. This helps queries behave more like dictionaries when you know only one result should exist.
Returns the line of the child if only one child exists. This helps queries behave more like dictionaries when you know only one result should exist.
def line(self): """ Returns the line of the child if only one child exists. This helps queries behave more like dictionaries when you know only one result should exist. """ if len(self.children) == 0: return None if len(self.children) == 1: ...
[ "def", "line", "(", "self", ")", ":", "if", "len", "(", "self", ".", "children", ")", "==", "0", ":", "return", "None", "if", "len", "(", "self", ".", "children", ")", "==", "1", ":", "return", "self", ".", "children", "[", "0", "]", ".", "line...
[ 486, 4 ]
[ 498, 57 ]
python
en
['en', 'error', 'th']
False
Result.string_value
(self)
Returns the string value of the child if only one child exists. This helps queries behave more like dictionaries when you know only one result should exist.
Returns the string value of the child if only one child exists. This helps queries behave more like dictionaries when you know only one result should exist.
def string_value(self): """ Returns the string value of the child if only one child exists. This helps queries behave more like dictionaries when you know only one result should exist. """ if len(self.children) == 0: return None if len(self.children) ...
[ "def", "string_value", "(", "self", ")", ":", "if", "len", "(", "self", ".", "children", ")", "==", "0", ":", "return", "None", "if", "len", "(", "self", ".", "children", ")", "==", "1", ":", "return", "self", ".", "children", "[", "0", "]", ".",...
[ 501, 4 ]
[ 513, 57 ]
python
en
['en', 'error', 'th']
False
Result.value
(self)
Returns the value of the child if only one child exists. This helps queries behave more like dictionaries when you know only one result should exist.
Returns the value of the child if only one child exists. This helps queries behave more like dictionaries when you know only one result should exist.
def value(self): """ Returns the value of the child if only one child exists. This helps queries behave more like dictionaries when you know only one result should exist. """ if len(self.children) == 0: return None if len(self.children) == 1: ...
[ "def", "value", "(", "self", ")", ":", "if", "len", "(", "self", ".", "children", ")", "==", "0", ":", "return", "None", "if", "len", "(", "self", ".", "children", ")", "==", "1", ":", "return", "self", ".", "children", "[", "0", "]", ".", "val...
[ 516, 4 ]
[ 528, 57 ]
python
en
['en', 'error', 'th']
False
Result.parents
(self)
Returns all of the deduplicated parents as a list. If a child has no parent, the child itself is treated as the parent.
Returns all of the deduplicated parents as a list. If a child has no parent, the child itself is treated as the parent.
def parents(self): """ Returns all of the deduplicated parents as a list. If a child has no parent, the child itself is treated as the parent. """ parents = [] seen = set() for c in self.children: p = c.parent if p is not None: ...
[ "def", "parents", "(", "self", ")", ":", "parents", "=", "[", "]", "seen", "=", "set", "(", ")", "for", "c", "in", "self", ".", "children", ":", "p", "=", "c", ".", "parent", "if", "p", "is", "not", "None", ":", "if", "p", "not", "in", "seen"...
[ 531, 4 ]
[ 547, 39 ]
python
en
['en', 'error', 'th']
False
Result.roots
(self)
Returns the furthest ancestor ``Entry`` instances of all children. If a child has no furthest ancestor, the child itself is treated as a root.
Returns the furthest ancestor ``Entry`` instances of all children. If a child has no furthest ancestor, the child itself is treated as a root.
def roots(self): """ Returns the furthest ancestor ``Entry`` instances of all children. If a child has no furthest ancestor, the child itself is treated as a root. """ roots = [] seen = set() for c in self.children: r = c.root if r is not N...
[ "def", "roots", "(", "self", ")", ":", "roots", "=", "[", "]", "seen", "=", "set", "(", ")", "for", "c", "in", "self", ".", "children", ":", "r", "=", "c", ".", "root", "if", "r", "is", "not", "None", ":", "if", "r", "not", "in", "seen", ":...
[ 550, 4 ]
[ 566, 37 ]
python
en
['en', 'error', 'th']
False
Result.values
(self)
Returns the values of all the children as a list.
Returns the values of all the children as a list.
def values(self): """ Returns the values of all the children as a list. """ return [c.value for c in self.children if c.value is not None]
[ "def", "values", "(", "self", ")", ":", "return", "[", "c", ".", "value", "for", "c", "in", "self", ".", "children", "if", "c", ".", "value", "is", "not", "None", "]" ]
[ 569, 4 ]
[ 573, 70 ]
python
en
['en', 'error', 'th']
False
Result.unique_values
(self)
Returns the unique values of all the children as a list.
Returns the unique values of all the children as a list.
def unique_values(self): """ Returns the unique values of all the children as a list. """ return sorted(set(c.value for c in self.children if c.value is not None))
[ "def", "unique_values", "(", "self", ")", ":", "return", "sorted", "(", "set", "(", "c", ".", "value", "for", "c", "in", "self", ".", "children", "if", "c", ".", "value", "is", "not", "None", ")", ")" ]
[ 576, 4 ]
[ 580, 81 ]
python
en
['en', 'error', 'th']
False
Result.upto
(self, query)
Go up from the current results to the first nodes that match query.
Go up from the current results to the first nodes that match query.
def upto(self, query): """ Go up from the current results to the first nodes that match query. """ roots = [] seen = set() for c in self.children: root = c.upto(query) if root is not None and root not in seen: roots.append(root) ...
[ "def", "upto", "(", "self", ",", "query", ")", ":", "roots", "=", "[", "]", "seen", "=", "set", "(", ")", "for", "c", "in", "self", ".", "children", ":", "root", "=", "c", ".", "upto", "(", "query", ")", "if", "root", "is", "not", "None", "an...
[ 582, 4 ]
[ 593, 37 ]
python
en
['en', 'error', 'th']
False
Result.nth
(self, n)
If the results are from a list beneath a node, get the nth element of the results for each unique parent. Example: ``conf.status.conditions.nth(0)`` will get the 0th condition of each status.
If the results are from a list beneath a node, get the nth element of the results for each unique parent.
def nth(self, n): """ If the results are from a list beneath a node, get the nth element of the results for each unique parent. Example: ``conf.status.conditions.nth(0)`` will get the 0th condition of each status. """ tmp = defaultdict(list) for c...
[ "def", "nth", "(", "self", ",", "n", ")", ":", "tmp", "=", "defaultdict", "(", "list", ")", "for", "c", "in", "self", ".", "children", ":", "tmp", "[", "c", ".", "parent", "]", ".", "append", "(", "c", ")", "results", "=", "[", "]", "for", "_...
[ 595, 4 ]
[ 618, 39 ]
python
en
['en', 'error', 'th']
False
Result.where
(self, name, value=None)
Selects current nodes based on name and value queries of child nodes. If any immediate children match the queries, the parent is included in the results. The :py:func:``make_child_query`` function can be used to construct queries that act on the children as a whole instead of one ...
Selects current nodes based on name and value queries of child nodes. If any immediate children match the queries, the parent is included in the results. The :py:func:``make_child_query`` function can be used to construct queries that act on the children as a whole instead of one ...
def where(self, name, value=None): """ Selects current nodes based on name and value queries of child nodes. If any immediate children match the queries, the parent is included in the results. The :py:func:``make_child_query`` function can be used to construct queries that act on...
[ "def", "where", "(", "self", ",", "name", ",", "value", "=", "None", ")", ":", "if", "isinstance", "(", "name", ",", "_EntryQuery", ")", ":", "query", "=", "name", ".", "to_pyfunc", "(", ")", "elif", "isinstance", "(", "name", ",", "Boolean", ")", ...
[ 624, 4 ]
[ 661, 39 ]
python
en
['en', 'error', 'th']
False
Result.most_common
(self, top=None)
Returns the distribution of values returned by queries that return a single value for each node.
Returns the distribution of values returned by queries that return a single value for each node.
def most_common(self, top=None): """ Returns the distribution of values returned by queries that return a single value for each node. """ res = [c.attrs[0] for c in self.children if len(c.attrs) == 1] return Counter(res).most_common(top)
[ "def", "most_common", "(", "self", ",", "top", "=", "None", ")", ":", "res", "=", "[", "c", ".", "attrs", "[", "0", "]", "for", "c", "in", "self", ".", "children", "if", "len", "(", "c", ".", "attrs", ")", "==", "1", "]", "return", "Counter", ...
[ 675, 4 ]
[ 681, 44 ]
python
en
['en', 'error', 'th']
False
test_plex_tv_clients
( hass, entry, setup_plex_server, requests_mock, player_plexweb_resources )
Test getting Plex clients from plex.tv.
Test getting Plex clients from plex.tv.
async def test_plex_tv_clients( hass, entry, setup_plex_server, requests_mock, player_plexweb_resources ): """Test getting Plex clients from plex.tv.""" requests_mock.get("/resources", text=player_plexweb_resources) with patch("plexapi.myplex.MyPlexResource.connect", side_effect=NotFound): awai...
[ "async", "def", "test_plex_tv_clients", "(", "hass", ",", "entry", ",", "setup_plex_server", ",", "requests_mock", ",", "player_plexweb_resources", ")", ":", "requests_mock", ".", "get", "(", "\"/resources\"", ",", "text", "=", "player_plexweb_resources", ")", "with...
[ 6, 0 ]
[ 30, 65 ]
python
en
['en', 'mt', 'en']
True
was_installed_by_pip
(pkg)
Checks whether pkg was installed by pip This is used not to display the upgrade message when pip is in fact installed by system package manager, such as dnf on Fedora.
Checks whether pkg was installed by pip
def was_installed_by_pip(pkg): # type: (str) -> bool """Checks whether pkg was installed by pip This is used not to display the upgrade message when pip is in fact installed by system package manager, such as dnf on Fedora. """ dist = get_distribution(pkg) if not dist: return False ...
[ "def", "was_installed_by_pip", "(", "pkg", ")", ":", "# type: (str) -> bool", "dist", "=", "get_distribution", "(", "pkg", ")", "if", "not", "dist", ":", "return", "False", "return", "\"pip\"", "==", "get_installer", "(", "dist", ")" ]
[ 108, 0 ]
[ 118, 39 ]
python
en
['en', 'en', 'en']
True
pip_self_version_check
(session, options)
Check for an update for pip. Limit the frequency of checks to once per week. State is stored either in the active virtualenv or in the user's USER_CACHE_DIR keyed off the prefix of the pip script path.
Check for an update for pip.
def pip_self_version_check(session, options): # type: (PipSession, optparse.Values) -> None """Check for an update for pip. Limit the frequency of checks to once per week. State is stored either in the active virtualenv or in the user's USER_CACHE_DIR keyed off the prefix of the pip script path. ...
[ "def", "pip_self_version_check", "(", "session", ",", "options", ")", ":", "# type: (PipSession, optparse.Values) -> None", "installed_version", "=", "get_installed_version", "(", "\"pip\"", ")", "if", "not", "installed_version", ":", "return", "pip_version", "=", "packag...
[ 121, 0 ]
[ 204, 9 ]
python
en
['en', 'en', 'en']
True
bind
(func)
Binds an exttarget with the given name.
Binds an exttarget with the given name.
def bind(func): """ Binds an exttarget with the given name. """ world.exttarget_handlers[func.__name__] = func return func
[ "def", "bind", "(", "func", ")", ":", "world", ".", "exttarget_handlers", "[", "func", ".", "__name__", "]", "=", "func", "return", "func" ]
[ 10, 0 ]
[ 15, 15 ]
python
en
['en', 'error', 'th']
False
account
(irc, host, uid)
$account exttarget handler. The following forms are supported, with groups separated by a literal colon. Account matching is case insensitive, while network name matching IS case sensitive. $account -> Returns True (a match) if the target is registered. $account:accountname -> Returns True if the ...
$account exttarget handler. The following forms are supported, with groups separated by a literal colon. Account matching is case insensitive, while network name matching IS case sensitive.
def account(irc, host, uid): """ $account exttarget handler. The following forms are supported, with groups separated by a literal colon. Account matching is case insensitive, while network name matching IS case sensitive. $account -> Returns True (a match) if the target is registered. $account...
[ "def", "account", "(", "irc", ",", "host", ",", "uid", ")", ":", "userobj", "=", "irc", ".", "users", "[", "uid", "]", "homenet", "=", "irc", ".", "name", "if", "hasattr", "(", "userobj", ",", "'remote'", ")", ":", "# User is a PyLink Relay pseudoclient....
[ 18, 0 ]
[ 62, 95 ]
python
en
['en', 'error', 'th']
False
ircop
(irc, host, uid)
$ircop exttarget handler. The following forms are supported, with groups separated by a literal colon. Oper types are matched case insensitively. $ircop -> Returns True (a match) if the target is opered. $ircop:*admin* -> Returns True if the target's is opered and their opertype matches the glob g...
$ircop exttarget handler. The following forms are supported, with groups separated by a literal colon. Oper types are matched case insensitively.
def ircop(irc, host, uid): """ $ircop exttarget handler. The following forms are supported, with groups separated by a literal colon. Oper types are matched case insensitively. $ircop -> Returns True (a match) if the target is opered. $ircop:*admin* -> Returns True if the target's is opered and the...
[ "def", "ircop", "(", "irc", ",", "host", ",", "uid", ")", ":", "groups", "=", "host", ".", "split", "(", "':'", ")", "log", ".", "debug", "(", "'(%s) exttargets.ircop: groups to match: %s'", ",", "irc", ".", "name", ",", "groups", ")", "if", "len", "("...
[ 65, 0 ]
[ 82, 65 ]
python
en
['en', 'error', 'th']
False
server
(irc, host, uid)
$server exttarget handler. The following forms are supported, with groups separated by a literal colon. Server names are matched case insensitively, but SIDs ARE case sensitive. $server:server.name -> Returns True (a match) if the target is connected on the given server. $server:server.glob -> Returns...
$server exttarget handler. The following forms are supported, with groups separated by a literal colon. Server names are matched case insensitively, but SIDs ARE case sensitive.
def server(irc, host, uid): """ $server exttarget handler. The following forms are supported, with groups separated by a literal colon. Server names are matched case insensitively, but SIDs ARE case sensitive. $server:server.name -> Returns True (a match) if the target is connected on the given server....
[ "def", "server", "(", "irc", ",", "host", ",", "uid", ")", ":", "groups", "=", "host", ".", "split", "(", "':'", ")", "log", ".", "debug", "(", "'(%s) exttargets.server: groups to match: %s'", ",", "irc", ".", "name", ",", "groups", ")", "if", "len", "...
[ 85, 0 ]
[ 103, 16 ]
python
en
['en', 'error', 'th']
False
channel
(irc, host, uid)
$channel exttarget handler. The following forms are supported, with groups separated by a literal colon. Channel names are matched case insensitively. $channel:#channel -> Returns True if the target is in the given channel. $channel:#channel:op -> Returns True if the target is in the given channel, an...
$channel exttarget handler. The following forms are supported, with groups separated by a literal colon. Channel names are matched case insensitively.
def channel(irc, host, uid): """ $channel exttarget handler. The following forms are supported, with groups separated by a literal colon. Channel names are matched case insensitively. $channel:#channel -> Returns True if the target is in the given channel. $channel:#channel:op -> Returns True if th...
[ "def", "channel", "(", "irc", ",", "host", ",", "uid", ")", ":", "groups", "=", "host", ".", "split", "(", "':'", ")", "log", ".", "debug", "(", "'(%s) exttargets.channel: groups to match: %s'", ",", "irc", ".", "name", ",", "groups", ")", "try", ":", ...
[ 106, 0 ]
[ 132, 122 ]
python
en
['en', 'error', 'th']
False
pylinkacc
(irc, host, uid)
$pylinkacc (PyLink account) exttarget handler. The following forms are supported, with groups separated by a literal colon. Account matching is case insensitive. $pylinkacc -> Returns True if the target is logged in to PyLink. $pylinkacc:accountname -> Returns True if the target's PyLink login matches...
$pylinkacc (PyLink account) exttarget handler. The following forms are supported, with groups separated by a literal colon. Account matching is case insensitive.
def pylinkacc(irc, host, uid): """ $pylinkacc (PyLink account) exttarget handler. The following forms are supported, with groups separated by a literal colon. Account matching is case insensitive. $pylinkacc -> Returns True if the target is logged in to PyLink. $pylinkacc:accountname -> Returns Tru...
[ "def", "pylinkacc", "(", "irc", ",", "host", ",", "uid", ")", ":", "login", "=", "irc", ".", "to_lower", "(", "irc", ".", "users", "[", "uid", "]", ".", "account", ")", "groups", "=", "list", "(", "map", "(", "irc", ".", "to_lower", ",", "host", ...
[ 135, 0 ]
[ 152, 33 ]
python
en
['en', 'error', 'th']
False
network
(irc, host, uid)
$network exttarget handler. This exttarget takes one argument: a network name, and returns a match for all users on that network. Note: network names are case sensitive.
$network exttarget handler. This exttarget takes one argument: a network name, and returns a match for all users on that network.
def network(irc, host, uid): """ $network exttarget handler. This exttarget takes one argument: a network name, and returns a match for all users on that network. Note: network names are case sensitive. """ try: targetnet = host.split(':')[1] except IndexError: # No network arg giv...
[ "def", "network", "(", "irc", ",", "host", ",", "uid", ")", ":", "try", ":", "targetnet", "=", "host", ".", "split", "(", "':'", ")", "[", "1", "]", "except", "IndexError", ":", "# No network arg given, bail.", "return", "False", "userobj", "=", "irc", ...
[ 155, 0 ]
[ 174, 31 ]
python
en
['en', 'error', 'th']
False
exttarget_and
(irc, host, uid)
$and exttarget handler. This exttarget takes a series of exttargets (or hostmasks) joined with a "+", and returns True if all sub exttargets match. Examples: $and:($ircop:*admin*+$network:ovd) -> Matches all opers on the network ovd. $and:($account+$pylinkirc) -> Matches all users logged in to bot...
$and exttarget handler. This exttarget takes a series of exttargets (or hostmasks) joined with a "+", and returns True if all sub exttargets match.
def exttarget_and(irc, host, uid): """ $and exttarget handler. This exttarget takes a series of exttargets (or hostmasks) joined with a "+", and returns True if all sub exttargets match. Examples: $and:($ircop:*admin*+$network:ovd) -> Matches all opers on the network ovd. $and:($account+$pylink...
[ "def", "exttarget_and", "(", "irc", ",", "host", ",", "uid", ")", ":", "targets", "=", "host", ".", "split", "(", "':'", ",", "1", ")", "[", "-", "1", "]", "# For readability, this requires that the exttarget list be wrapped in brackets.", "if", "not", "(", "t...
[ 177, 0 ]
[ 197, 86 ]
python
en
['en', 'error', 'th']
False
realname
(irc, host, uid)
$realname exttarget handler. This takes one argument: a glob, which is compared case-insensitively to the user's real name. Examples: $realname:*James* -> matches anyone with "James" in their real name.
$realname exttarget handler. This takes one argument: a glob, which is compared case-insensitively to the user's real name.
def realname(irc, host, uid): """ $realname exttarget handler. This takes one argument: a glob, which is compared case-insensitively to the user's real name. Examples: $realname:*James* -> matches anyone with "James" in their real name. """ groups = host.split(':') if len(groups) >= 2: ...
[ "def", "realname", "(", "irc", ",", "host", ",", "uid", ")", ":", "groups", "=", "host", ".", "split", "(", "':'", ")", "if", "len", "(", "groups", ")", ">=", "2", ":", "return", "irc", ".", "match_text", "(", "groups", "[", "1", "]", ",", "irc...
[ 201, 0 ]
[ 210, 65 ]
python
en
['en', 'error', 'th']
False
service
(irc, host, uid)
$service exttarget handler. This takes one optional argument: a glob, which is compared case-insensitively to the target user's service name (if present). Examples: $service -> Matches any PyLink service bot. $service:automode -> Matches the Automode service bot.
$service exttarget handler. This takes one optional argument: a glob, which is compared case-insensitively to the target user's service name (if present).
def service(irc, host, uid): """ $service exttarget handler. This takes one optional argument: a glob, which is compared case-insensitively to the target user's service name (if present). Examples: $service -> Matches any PyLink service bot. $service:automode -> Matches the Automode service bot. ...
[ "def", "service", "(", "irc", ",", "host", ",", "uid", ")", ":", "if", "not", "irc", ".", "users", "[", "uid", "]", ".", "service", ":", "return", "False", "groups", "=", "host", ".", "split", "(", "':'", ")", "if", "len", "(", "groups", ")", "...
[ 213, 0 ]
[ 228, 15 ]
python
en
['en', 'error', 'th']
False
test_duplicate_error
(hass)
Test that an error is shown when duplicates are added.
Test that an error is shown when duplicates are added.
async def test_duplicate_error(hass): """Test that an error is shown when duplicates are added.""" conf = {CONF_LATITUDE: "51.528308", CONF_LONGITUDE: "-0.3817765"} MockConfigEntry( domain=DOMAIN, unique_id="51.528308, -0.3817765", data=conf ).add_to_hass(hass) result = await hass.config_e...
[ "async", "def", "test_duplicate_error", "(", "hass", ")", ":", "conf", "=", "{", "CONF_LATITUDE", ":", "\"51.528308\"", ",", "CONF_LONGITUDE", ":", "\"-0.3817765\"", "}", "MockConfigEntry", "(", "domain", "=", "DOMAIN", ",", "unique_id", "=", "\"51.528308, -0.3817...
[ 13, 0 ]
[ 26, 51 ]
python
en
['en', 'en', 'en']
True
test_general_error
(hass)
Test that an error is shown on a library error.
Test that an error is shown on a library error.
async def test_general_error(hass): """Test that an error is shown on a library error.""" conf = {CONF_LATITUDE: "51.528308", CONF_LONGITUDE: "-0.3817765"} with patch( "pyflunearyou.cdc.CdcReport.status_by_coordinates", side_effect=FluNearYouError, ): result = await hass.config_...
[ "async", "def", "test_general_error", "(", "hass", ")", ":", "conf", "=", "{", "CONF_LATITUDE", ":", "\"51.528308\"", ",", "CONF_LONGITUDE", ":", "\"-0.3817765\"", "}", "with", "patch", "(", "\"pyflunearyou.cdc.CdcReport.status_by_coordinates\"", ",", "side_effect", "...
[ 29, 0 ]
[ 40, 54 ]
python
en
['en', 'en', 'en']
True
test_show_form
(hass)
Test that the form is served with no input.
Test that the form is served with no input.
async def test_show_form(hass): """Test that the form is served with no input.""" result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER} ) assert result["type"] == data_entry_flow.RESULT_TYPE_FORM assert result["step_id"] == "user"
[ "async", "def", "test_show_form", "(", "hass", ")", ":", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "DOMAIN", ",", "context", "=", "{", "\"source\"", ":", "SOURCE_USER", "}", ")", "assert", "result", "[", ...
[ 43, 0 ]
[ 50, 38 ]
python
en
['en', 'en', 'en']
True
test_step_user
(hass)
Test that the user step works.
Test that the user step works.
async def test_step_user(hass): """Test that the user step works.""" conf = {CONF_LATITUDE: "51.528308", CONF_LONGITUDE: "-0.3817765"} with patch( "homeassistant.components.flunearyou.async_setup_entry", return_value=True ), patch("pyflunearyou.cdc.CdcReport.status_by_coordinates"): res...
[ "async", "def", "test_step_user", "(", "hass", ")", ":", "conf", "=", "{", "CONF_LATITUDE", ":", "\"51.528308\"", ",", "CONF_LONGITUDE", ":", "\"-0.3817765\"", "}", "with", "patch", "(", "\"homeassistant.components.flunearyou.async_setup_entry\"", ",", "return_value", ...
[ 53, 0 ]
[ 69, 9 ]
python
en
['en', 'en', 'en']
True
test_no_clients
(hass, aioclient_mock)
Test the update_clients function when no clients are found.
Test the update_clients function when no clients are found.
async def test_no_clients(hass, aioclient_mock): """Test the update_clients function when no clients are found.""" await setup_unifi_integration( hass, aioclient_mock, options={ CONF_ALLOW_BANDWIDTH_SENSORS: True, CONF_ALLOW_UPTIME_SENSORS: True, }, ) ...
[ "async", "def", "test_no_clients", "(", "hass", ",", "aioclient_mock", ")", ":", "await", "setup_unifi_integration", "(", "hass", ",", "aioclient_mock", ",", "options", "=", "{", "CONF_ALLOW_BANDWIDTH_SENSORS", ":", "True", ",", "CONF_ALLOW_UPTIME_SENSORS", ":", "Tr...
[ 23, 0 ]
[ 34, 64 ]
python
en
['en', 'en', 'en']
True
test_bandwidth_sensors
(hass, aioclient_mock, mock_unifi_websocket)
Verify that bandwidth sensors are working as expected.
Verify that bandwidth sensors are working as expected.
async def test_bandwidth_sensors(hass, aioclient_mock, mock_unifi_websocket): """Verify that bandwidth sensors are working as expected.""" wired_client = { "hostname": "Wired client", "is_wired": True, "mac": "00:00:00:00:00:01", "oui": "Producer", "wired-rx_bytes": 12340...
[ "async", "def", "test_bandwidth_sensors", "(", "hass", ",", "aioclient_mock", ",", "mock_unifi_websocket", ")", ":", "wired_client", "=", "{", "\"hostname\"", ":", "\"Wired client\"", ",", "\"is_wired\"", ":", "True", ",", "\"mac\"", ":", "\"00:00:00:00:00:01\"", ",...
[ 37, 0 ]
[ 134, 64 ]
python
en
['en', 'en', 'en']
True
test_uptime_sensors
( hass, aioclient_mock, mock_unifi_websocket, initial_uptime, event_uptime, new_uptime, )
Verify that uptime sensors are working as expected.
Verify that uptime sensors are working as expected.
async def test_uptime_sensors( hass, aioclient_mock, mock_unifi_websocket, initial_uptime, event_uptime, new_uptime, ): """Verify that uptime sensors are working as expected.""" uptime_client = { "mac": "00:00:00:00:00:01", "name": "client1", "oui": "Producer", ...
[ "async", "def", "test_uptime_sensors", "(", "hass", ",", "aioclient_mock", ",", "mock_unifi_websocket", ",", "initial_uptime", ",", "event_uptime", ",", "new_uptime", ",", ")", ":", "uptime_client", "=", "{", "\"mac\"", ":", "\"00:00:00:00:00:01\"", ",", "\"name\"",...
[ 146, 0 ]
[ 250, 64 ]
python
en
['en', 'en', 'en']
True
test_remove_sensors
(hass, aioclient_mock, mock_unifi_websocket)
Verify removing of clients work as expected.
Verify removing of clients work as expected.
async def test_remove_sensors(hass, aioclient_mock, mock_unifi_websocket): """Verify removing of clients work as expected.""" wired_client = { "hostname": "Wired client", "is_wired": True, "mac": "00:00:00:00:00:01", "oui": "Producer", "wired-rx_bytes": 1234000000, ...
[ "async", "def", "test_remove_sensors", "(", "hass", ",", "aioclient_mock", ",", "mock_unifi_websocket", ")", ":", "wired_client", "=", "{", "\"hostname\"", ":", "\"Wired client\"", ",", "\"is_wired\"", ":", "True", ",", "\"mac\"", ":", "\"00:00:00:00:00:01\"", ",", ...
[ 253, 0 ]
[ 312, 59 ]
python
en
['en', 'en', 'en']
True
calls
(hass)
Track calls to a mock service.
Track calls to a mock service.
def calls(hass): """Track calls to a mock service.""" return async_mock_service(hass, "test", "automation")
[ "def", "calls", "(", "hass", ")", ":", "return", "async_mock_service", "(", "hass", ",", "\"test\"", ",", "\"automation\"", ")" ]
[ 48, 0 ]
[ 50, 57 ]
python
en
['en', 'en', 'en']
True
mock_devices
(hass, zigpy_device_mock, zha_device_joined_restored)
IAS device fixture.
IAS device fixture.
async def mock_devices(hass, zigpy_device_mock, zha_device_joined_restored): """IAS device fixture.""" zigpy_device = zigpy_device_mock( { 1: { SIG_EP_INPUT: [general.Basic.cluster_id], SIG_EP_OUTPUT: [general.OnOff.cluster_id], SIG_EP_TYPE: z...
[ "async", "def", "mock_devices", "(", "hass", ",", "zigpy_device_mock", ",", "zha_device_joined_restored", ")", ":", "zigpy_device", "=", "zigpy_device_mock", "(", "{", "1", ":", "{", "SIG_EP_INPUT", ":", "[", "general", ".", "Basic", ".", "cluster_id", "]", ",...
[ 54, 0 ]
[ 71, 35 ]
python
en
['es', 'sr', 'en']
False
test_triggers
(hass, mock_devices)
Test zha device triggers.
Test zha device triggers.
async def test_triggers(hass, mock_devices): """Test zha device triggers.""" zigpy_device, zha_device = mock_devices zigpy_device.device_automation_triggers = { (SHAKEN, SHAKEN): {COMMAND: COMMAND_SHAKE}, (DOUBLE_PRESS, DOUBLE_PRESS): {COMMAND: COMMAND_DOUBLE}, (SHORT_PRESS, SHORT_...
[ "async", "def", "test_triggers", "(", "hass", ",", "mock_devices", ")", ":", "zigpy_device", ",", "zha_device", "=", "mock_devices", "zigpy_device", ".", "device_automation_triggers", "=", "{", "(", "SHAKEN", ",", "SHAKEN", ")", ":", "{", "COMMAND", ":", "COMM...
[ 74, 0 ]
[ 138, 51 ]
python
br
['br', 'en', 'pl']
False
test_no_triggers
(hass, mock_devices)
Test zha device with no triggers.
Test zha device with no triggers.
async def test_no_triggers(hass, mock_devices): """Test zha device with no triggers.""" _, zha_device = mock_devices ieee_address = str(zha_device.ieee) ha_device_registry = dr.async_get(hass) reg_device = ha_device_registry.async_get_device({("zha", ieee_address)}) triggers = await async_get...
[ "async", "def", "test_no_triggers", "(", "hass", ",", "mock_devices", ")", ":", "_", ",", "zha_device", "=", "mock_devices", "ieee_address", "=", "str", "(", "zha_device", ".", "ieee", ")", "ha_device_registry", "=", "dr", ".", "async_get", "(", "hass", ")",...
[ 141, 0 ]
[ 159, 5 ]
python
en
['en', 'en', 'en']
True
test_if_fires_on_event
(hass, mock_devices, calls)
Test for remote triggers firing.
Test for remote triggers firing.
async def test_if_fires_on_event(hass, mock_devices, calls): """Test for remote triggers firing.""" zigpy_device, zha_device = mock_devices zigpy_device.device_automation_triggers = { (SHAKEN, SHAKEN): {COMMAND: COMMAND_SHAKE}, (DOUBLE_PRESS, DOUBLE_PRESS): {COMMAND: COMMAND_DOUBLE}, ...
[ "async", "def", "test_if_fires_on_event", "(", "hass", ",", "mock_devices", ",", "calls", ")", ":", "zigpy_device", ",", "zha_device", "=", "mock_devices", "zigpy_device", ".", "device_automation_triggers", "=", "{", "(", "SHAKEN", ",", "SHAKEN", ")", ":", "{", ...
[ 162, 0 ]
[ 208, 55 ]
python
en
['en', 'en', 'en']
True
test_device_offline_fires
( hass, zigpy_device_mock, zha_device_restored, calls )
Test for device offline triggers firing.
Test for device offline triggers firing.
async def test_device_offline_fires( hass, zigpy_device_mock, zha_device_restored, calls ): """Test for device offline triggers firing.""" zigpy_device = zigpy_device_mock( { 1: { "in_clusters": [general.Basic.cluster_id], "out_clusters": [general.OnOff.c...
[ "async", "def", "test_device_offline_fires", "(", "hass", ",", "zigpy_device_mock", ",", "zha_device_restored", ",", "calls", ")", ":", "zigpy_device", "=", "zigpy_device_mock", "(", "{", "1", ":", "{", "\"in_clusters\"", ":", "[", "general", ".", "Basic", ".", ...
[ 211, 0 ]
[ 274, 55 ]
python
en
['en', 'en', 'en']
True
test_exception_no_triggers
(hass, mock_devices, calls, caplog)
Test for exception on event triggers firing.
Test for exception on event triggers firing.
async def test_exception_no_triggers(hass, mock_devices, calls, caplog): """Test for exception on event triggers firing.""" _, zha_device = mock_devices ieee_address = str(zha_device.ieee) ha_device_registry = dr.async_get(hass) reg_device = ha_device_registry.async_get_device({("zha", ieee_addres...
[ "async", "def", "test_exception_no_triggers", "(", "hass", ",", "mock_devices", ",", "calls", ",", "caplog", ")", ":", "_", ",", "zha_device", "=", "mock_devices", "ieee_address", "=", "str", "(", "zha_device", ".", "ieee", ")", "ha_device_registry", "=", "dr"...
[ 277, 0 ]
[ 308, 59 ]
python
en
['en', 'en', 'en']
True
test_exception_bad_trigger
(hass, mock_devices, calls, caplog)
Test for exception on event triggers firing.
Test for exception on event triggers firing.
async def test_exception_bad_trigger(hass, mock_devices, calls, caplog): """Test for exception on event triggers firing.""" zigpy_device, zha_device = mock_devices zigpy_device.device_automation_triggers = { (SHAKEN, SHAKEN): {COMMAND: COMMAND_SHAKE}, (DOUBLE_PRESS, DOUBLE_PRESS): {COMMAND...
[ "async", "def", "test_exception_bad_trigger", "(", "hass", ",", "mock_devices", ",", "calls", ",", "caplog", ")", ":", "zigpy_device", ",", "zha_device", "=", "mock_devices", "zigpy_device", ".", "device_automation_triggers", "=", "{", "(", "SHAKEN", ",", "SHAKEN"...
[ 311, 0 ]
[ 350, 59 ]
python
en
['en', 'en', 'en']
True
async_setup_platform
(hass, config, async_add_entities, discovery_info=None)
Set up the ComEd Hourly Pricing sensor.
Set up the ComEd Hourly Pricing sensor.
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None): """Set up the ComEd Hourly Pricing sensor.""" websession = async_get_clientsession(hass) entities = [ ComedHourlyPricingSensor( websession, variable[CONF_OFFSET], variable.get(...
[ "async", "def", "async_setup_platform", "(", "hass", ",", "config", ",", "async_add_entities", ",", "discovery_info", "=", "None", ")", ":", "websession", "=", "async_get_clientsession", "(", "hass", ")", "entities", "=", "[", "ComedHourlyPricingSensor", "(", "web...
[ 63, 0 ]
[ 79, 38 ]
python
en
['en', 'en', 'en']
True
ComedHourlyPricingSensor.__init__
(self, websession, offset, name, description: SensorEntityDescription)
Initialize the sensor.
Initialize the sensor.
def __init__(self, websession, offset, name, description: SensorEntityDescription): """Initialize the sensor.""" self.entity_description = description self.websession = websession if name: self._attr_name = name self.offset = offset
[ "def", "__init__", "(", "self", ",", "websession", ",", "offset", ",", "name", ",", "description", ":", "SensorEntityDescription", ")", ":", "self", ".", "entity_description", "=", "description", "self", ".", "websession", "=", "websession", "if", "name", ":",...
[ 87, 4 ]
[ 93, 28 ]
python
en
['en', 'en', 'en']
True
ComedHourlyPricingSensor.async_update
(self)
Get the ComEd Hourly Pricing data from the web service.
Get the ComEd Hourly Pricing data from the web service.
async def async_update(self): """Get the ComEd Hourly Pricing data from the web service.""" try: sensor_type = self.entity_description.key if sensor_type in (CONF_FIVE_MINUTE, CONF_CURRENT_HOUR_AVERAGE): url_string = _RESOURCE if sensor_type == CON...
[ "async", "def", "async_update", "(", "self", ")", ":", "try", ":", "sensor_type", "=", "self", ".", "entity_description", ".", "key", "if", "sensor_type", "in", "(", "CONF_FIVE_MINUTE", ",", "CONF_CURRENT_HOUR_AVERAGE", ")", ":", "url_string", "=", "_RESOURCE", ...
[ 95, 4 ]
[ 121, 72 ]
python
en
['en', 'en', 'en']
True
setup
(hass, config)
Listen for browse_url events.
Listen for browse_url events.
def setup(hass, config): """Listen for browse_url events.""" hass.services.register( DOMAIN, SERVICE_BROWSE_URL, lambda service: webbrowser.open(service.data[ATTR_URL]), schema=SERVICE_BROWSE_URL_SCHEMA, ) return True
[ "def", "setup", "(", "hass", ",", "config", ")", ":", "hass", ".", "services", ".", "register", "(", "DOMAIN", ",", "SERVICE_BROWSE_URL", ",", "lambda", "service", ":", "webbrowser", ".", "open", "(", "service", ".", "data", "[", "ATTR_URL", "]", ")", ...
[ 20, 0 ]
[ 30, 15 ]
python
en
['en', 'en', 'en']
True
round_temp
(temperature)
Round a temperature to the resolution of the thermostat. RadioThermostats can handle 0.5 degree temps so the input temperature is rounded to that value and returned.
Round a temperature to the resolution of the thermostat.
def round_temp(temperature): """Round a temperature to the resolution of the thermostat. RadioThermostats can handle 0.5 degree temps so the input temperature is rounded to that value and returned. """ return round(temperature * 2.0) / 2.0
[ "def", "round_temp", "(", "temperature", ")", ":", "return", "round", "(", "temperature", "*", "2.0", ")", "/", "2.0" ]
[ 85, 0 ]
[ 91, 41 ]
python
en
['en', 'en', 'en']
True
setup_platform
(hass, config, add_entities, discovery_info=None)
Set up the Radio Thermostat.
Set up the Radio Thermostat.
def setup_platform(hass, config, add_entities, discovery_info=None): """Set up the Radio Thermostat.""" hosts = [] if CONF_HOST in config: hosts = config[CONF_HOST] else: hosts.append(radiotherm.discover.discover_address()) if hosts is None: _LOGGER.error("No Radiotherm Ther...
[ "def", "setup_platform", "(", "hass", ",", "config", ",", "add_entities", ",", "discovery_info", "=", "None", ")", ":", "hosts", "=", "[", "]", "if", "CONF_HOST", "in", "config", ":", "hosts", "=", "config", "[", "CONF_HOST", "]", "else", ":", "hosts", ...
[ 105, 0 ]
[ 127, 30 ]
python
en
['en', 'ja', 'en']
True
RadioThermostat.__init__
(self, device, hold_temp)
Initialize the thermostat.
Initialize the thermostat.
def __init__(self, device, hold_temp): """Initialize the thermostat.""" self.device = device self._target_temperature = None self._current_temperature = None self._current_humidity = None self._current_operation = HVAC_MODE_OFF self._name = None self._fmod...
[ "def", "__init__", "(", "self", ",", "device", ",", "hold_temp", ")", ":", "self", ".", "device", "=", "device", "self", ".", "_target_temperature", "=", "None", "self", ".", "_current_temperature", "=", "None", "self", ".", "_current_humidity", "=", "None",...
[ 133, 4 ]
[ 153, 81 ]
python
en
['en', 'en', 'en']
True
RadioThermostat.supported_features
(self)
Return the list of supported features.
Return the list of supported features.
def supported_features(self): """Return the list of supported features.""" return SUPPORT_FLAGS
[ "def", "supported_features", "(", "self", ")", ":", "return", "SUPPORT_FLAGS" ]
[ 156, 4 ]
[ 158, 28 ]
python
en
['en', 'en', 'en']
True
RadioThermostat.async_added_to_hass
(self)
Register callbacks.
Register callbacks.
async def async_added_to_hass(self): """Register callbacks.""" # Set the time on the device. This shouldn't be in the # constructor because it's a network call. We can't put it in # update() because calling it will clear any temporary mode or # temperature in the thermostat. S...
[ "async", "def", "async_added_to_hass", "(", "self", ")", ":", "# Set the time on the device. This shouldn't be in the", "# constructor because it's a network call. We can't put it in", "# update() because calling it will clear any temporary mode or", "# temperature in the thermostat. So add i...
[ 160, 4 ]
[ 167, 46 ]
python
en
['en', 'no', 'en']
False
RadioThermostat.name
(self)
Return the name of the Radio Thermostat.
Return the name of the Radio Thermostat.
def name(self): """Return the name of the Radio Thermostat.""" return self._name
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "_name" ]
[ 170, 4 ]
[ 172, 25 ]
python
en
['en', 'en', 'en']
True
RadioThermostat.temperature_unit
(self)
Return the unit of measurement.
Return the unit of measurement.
def temperature_unit(self): """Return the unit of measurement.""" return TEMP_FAHRENHEIT
[ "def", "temperature_unit", "(", "self", ")", ":", "return", "TEMP_FAHRENHEIT" ]
[ 175, 4 ]
[ 177, 30 ]
python
en
['en', 'la', 'en']
True
RadioThermostat.precision
(self)
Return the precision of the system.
Return the precision of the system.
def precision(self): """Return the precision of the system.""" return PRECISION_HALVES
[ "def", "precision", "(", "self", ")", ":", "return", "PRECISION_HALVES" ]
[ 180, 4 ]
[ 182, 31 ]
python
en
['en', 'en', 'en']
True
RadioThermostat.extra_state_attributes
(self)
Return the device specific state attributes.
Return the device specific state attributes.
def extra_state_attributes(self): """Return the device specific state attributes.""" return {ATTR_FAN_ACTION: self._fstate}
[ "def", "extra_state_attributes", "(", "self", ")", ":", "return", "{", "ATTR_FAN_ACTION", ":", "self", ".", "_fstate", "}" ]
[ 185, 4 ]
[ 187, 46 ]
python
en
['en', 'en', 'en']
True
RadioThermostat.fan_modes
(self)
List of available fan modes.
List of available fan modes.
def fan_modes(self): """List of available fan modes.""" if self._is_model_ct80: return CT80_FAN_OPERATION_LIST return CT30_FAN_OPERATION_LIST
[ "def", "fan_modes", "(", "self", ")", ":", "if", "self", ".", "_is_model_ct80", ":", "return", "CT80_FAN_OPERATION_LIST", "return", "CT30_FAN_OPERATION_LIST" ]
[ 190, 4 ]
[ 194, 38 ]
python
en
['en', 'en', 'en']
True
RadioThermostat.fan_mode
(self)
Return whether the fan is on.
Return whether the fan is on.
def fan_mode(self): """Return whether the fan is on.""" return self._fmode
[ "def", "fan_mode", "(", "self", ")", ":", "return", "self", ".", "_fmode" ]
[ 197, 4 ]
[ 199, 26 ]
python
en
['en', 'en', 'en']
True
RadioThermostat.set_fan_mode
(self, fan_mode)
Turn fan on/off.
Turn fan on/off.
def set_fan_mode(self, fan_mode): """Turn fan on/off.""" code = FAN_MODE_TO_CODE.get(fan_mode) if code is not None: self.device.fmode = code
[ "def", "set_fan_mode", "(", "self", ",", "fan_mode", ")", ":", "code", "=", "FAN_MODE_TO_CODE", ".", "get", "(", "fan_mode", ")", "if", "code", "is", "not", "None", ":", "self", ".", "device", ".", "fmode", "=", "code" ]
[ 201, 4 ]
[ 205, 36 ]
python
en
['en', 'fy', 'en']
True
RadioThermostat.current_temperature
(self)
Return the current temperature.
Return the current temperature.
def current_temperature(self): """Return the current temperature.""" return self._current_temperature
[ "def", "current_temperature", "(", "self", ")", ":", "return", "self", ".", "_current_temperature" ]
[ 208, 4 ]
[ 210, 40 ]
python
en
['en', 'la', 'en']
True
RadioThermostat.current_humidity
(self)
Return the current temperature.
Return the current temperature.
def current_humidity(self): """Return the current temperature.""" return self._current_humidity
[ "def", "current_humidity", "(", "self", ")", ":", "return", "self", ".", "_current_humidity" ]
[ 213, 4 ]
[ 215, 37 ]
python
en
['en', 'la', 'en']
True
RadioThermostat.hvac_mode
(self)
Return the current operation. head, cool idle.
Return the current operation. head, cool idle.
def hvac_mode(self): """Return the current operation. head, cool idle.""" return self._current_operation
[ "def", "hvac_mode", "(", "self", ")", ":", "return", "self", ".", "_current_operation" ]
[ 218, 4 ]
[ 220, 38 ]
python
en
['en', 'en', 'en']
True
RadioThermostat.hvac_modes
(self)
Return the operation modes list.
Return the operation modes list.
def hvac_modes(self): """Return the operation modes list.""" return OPERATION_LIST
[ "def", "hvac_modes", "(", "self", ")", ":", "return", "OPERATION_LIST" ]
[ 223, 4 ]
[ 225, 29 ]
python
en
['en', 'en', 'en']
True
RadioThermostat.hvac_action
(self)
Return the current running hvac operation if supported.
Return the current running hvac operation if supported.
def hvac_action(self): """Return the current running hvac operation if supported.""" if self.hvac_mode == HVAC_MODE_OFF: return None return self._tstate
[ "def", "hvac_action", "(", "self", ")", ":", "if", "self", ".", "hvac_mode", "==", "HVAC_MODE_OFF", ":", "return", "None", "return", "self", ".", "_tstate" ]
[ 228, 4 ]
[ 232, 27 ]
python
en
['en', 'en', 'en']
True
RadioThermostat.target_temperature
(self)
Return the temperature we try to reach.
Return the temperature we try to reach.
def target_temperature(self): """Return the temperature we try to reach.""" return self._target_temperature
[ "def", "target_temperature", "(", "self", ")", ":", "return", "self", ".", "_target_temperature" ]
[ 235, 4 ]
[ 237, 39 ]
python
en
['en', 'en', 'en']
True
RadioThermostat.preset_mode
(self)
Return the current preset mode, e.g., home, away, temp.
Return the current preset mode, e.g., home, away, temp.
def preset_mode(self): """Return the current preset mode, e.g., home, away, temp.""" if self._program_mode == 0: return PRESET_HOME if self._program_mode == 1: return PRESET_ALTERNATE if self._program_mode == 2: return PRESET_AWAY if self._prog...
[ "def", "preset_mode", "(", "self", ")", ":", "if", "self", ".", "_program_mode", "==", "0", ":", "return", "PRESET_HOME", "if", "self", ".", "_program_mode", "==", "1", ":", "return", "PRESET_ALTERNATE", "if", "self", ".", "_program_mode", "==", "2", ":", ...
[ 240, 4 ]
[ 249, 33 ]
python
en
['en', 'pt', 'en']
True
RadioThermostat.preset_modes
(self)
Return a list of available preset modes.
Return a list of available preset modes.
def preset_modes(self): """Return a list of available preset modes.""" return PRESET_MODES
[ "def", "preset_modes", "(", "self", ")", ":", "return", "PRESET_MODES" ]
[ 252, 4 ]
[ 254, 27 ]
python
en
['en', 'en', 'en']
True
RadioThermostat.update
(self)
Update and validate the data from the thermostat.
Update and validate the data from the thermostat.
def update(self): """Update and validate the data from the thermostat.""" # Radio thermostats are very slow, and sometimes don't respond # very quickly. So we need to keep the number of calls to them # to a bare minimum or we'll hit the Home Assistant 10 sec warning. We # have ...
[ "def", "update", "(", "self", ")", ":", "# Radio thermostats are very slow, and sometimes don't respond", "# very quickly. So we need to keep the number of calls to them", "# to a bare minimum or we'll hit the Home Assistant 10 sec warning. We", "# have to make one call to /tstat to get temps bu...
[ 256, 4 ]
[ 320, 55 ]
python
en
['en', 'en', 'en']
True
RadioThermostat.set_temperature
(self, **kwargs)
Set new target temperature.
Set new target temperature.
def set_temperature(self, **kwargs): """Set new target temperature.""" temperature = kwargs.get(ATTR_TEMPERATURE) if temperature is None: return temperature = round_temp(temperature) if self._current_operation == HVAC_MODE_COOL: self.device.t_cool = temp...
[ "def", "set_temperature", "(", "self", ",", "*", "*", "kwargs", ")", ":", "temperature", "=", "kwargs", ".", "get", "(", "ATTR_TEMPERATURE", ")", "if", "temperature", "is", "None", ":", "return", "temperature", "=", "round_temp", "(", "temperature", ")", "...
[ 322, 4 ]
[ 347, 36 ]
python
en
['en', 'ca', 'en']
True
RadioThermostat.set_time
(self)
Set device time.
Set device time.
def set_time(self): """Set device time.""" # Calling this clears any local temperature override and # reverts to the scheduled temperature. now = dt_util.now() self.device.time = { "day": now.weekday(), "hour": now.hour, "minute": now.minute, ...
[ "def", "set_time", "(", "self", ")", ":", "# Calling this clears any local temperature override and", "# reverts to the scheduled temperature.", "now", "=", "dt_util", ".", "now", "(", ")", "self", ".", "device", ".", "time", "=", "{", "\"day\"", ":", "now", ".", ...
[ 349, 4 ]
[ 358, 9 ]
python
en
['fr', 'en', 'en']
True
RadioThermostat.set_hvac_mode
(self, hvac_mode)
Set operation mode (auto, cool, heat, off).
Set operation mode (auto, cool, heat, off).
def set_hvac_mode(self, hvac_mode): """Set operation mode (auto, cool, heat, off).""" if hvac_mode in (HVAC_MODE_OFF, HVAC_MODE_AUTO): self.device.tmode = TEMP_MODE_TO_CODE[hvac_mode] # Setting t_cool or t_heat automatically changes tmode. elif hvac_mode == HVAC_MODE_COOL: ...
[ "def", "set_hvac_mode", "(", "self", ",", "hvac_mode", ")", ":", "if", "hvac_mode", "in", "(", "HVAC_MODE_OFF", ",", "HVAC_MODE_AUTO", ")", ":", "self", ".", "device", ".", "tmode", "=", "TEMP_MODE_TO_CODE", "[", "hvac_mode", "]", "# Setting t_cool or t_heat aut...
[ 360, 4 ]
[ 369, 57 ]
python
en
['nl', 'ny', 'en']
False
RadioThermostat.set_preset_mode
(self, preset_mode)
Set Preset mode (Home, Alternate, Away, Holiday).
Set Preset mode (Home, Alternate, Away, Holiday).
def set_preset_mode(self, preset_mode): """Set Preset mode (Home, Alternate, Away, Holiday).""" if preset_mode in (PRESET_MODES): self.device.program_mode = PRESET_MODE_TO_CODE[preset_mode] else: _LOGGER.error( "Preset_mode %s not in PRESET_MODES", ...
[ "def", "set_preset_mode", "(", "self", ",", "preset_mode", ")", ":", "if", "preset_mode", "in", "(", "PRESET_MODES", ")", ":", "self", ".", "device", ".", "program_mode", "=", "PRESET_MODE_TO_CODE", "[", "preset_mode", "]", "else", ":", "_LOGGER", ".", "erro...
[ 371, 4 ]
[ 379, 13 ]
python
de
['de', 'pt', 'en']
False
TestHistogramOptimBinNums.test_simple
(self)
Straightforward testing with a mixture of linspace data (for consistency). All test values have been precomputed and the values shouldn't change
Straightforward testing with a mixture of linspace data (for consistency). All test values have been precomputed and the values shouldn't change
def test_simple(self): """ Straightforward testing with a mixture of linspace data (for consistency). All test values have been precomputed and the values shouldn't change """ # Some basic sanity checking, with some fixed data. # Checking for the correct number of...
[ "def", "test_simple", "(", "self", ")", ":", "# Some basic sanity checking, with some fixed data.", "# Checking for the correct number of bins", "basic_test", "=", "{", "50", ":", "{", "'fd'", ":", "4", ",", "'scott'", ":", "4", ",", "'rice'", ":", "8", ",", "'stu...
[ 439, 4 ]
[ 463, 79 ]
python
en
['en', 'error', 'th']
False
TestHistogramOptimBinNums.test_small
(self)
Smaller datasets have the potential to cause issues with the data adaptive methods, especially the FD method. All bin numbers have been precalculated.
Smaller datasets have the potential to cause issues with the data adaptive methods, especially the FD method. All bin numbers have been precalculated.
def test_small(self): """ Smaller datasets have the potential to cause issues with the data adaptive methods, especially the FD method. All bin numbers have been precalculated. """ small_dat = {1: {'fd': 1, 'scott': 1, 'rice': 1, 'sturges': 1, 'do...
[ "def", "test_small", "(", "self", ")", ":", "small_dat", "=", "{", "1", ":", "{", "'fd'", ":", "1", ",", "'scott'", ":", "1", ",", "'rice'", ":", "1", ",", "'sturges'", ":", "1", ",", "'doane'", ":", "1", ",", "'sqrt'", ":", "1", ",", "'stone'"...
[ 465, 4 ]
[ 483, 79 ]
python
en
['en', 'error', 'th']
False
TestHistogramOptimBinNums.test_incorrect_methods
(self)
Check a Value Error is thrown when an unknown string is passed in
Check a Value Error is thrown when an unknown string is passed in
def test_incorrect_methods(self): """ Check a Value Error is thrown when an unknown string is passed in """ check_list = ['mad', 'freeman', 'histograms', 'IQR'] for estimator in check_list: assert_raises(ValueError, histogram, [1, 2, 3], estimator)
[ "def", "test_incorrect_methods", "(", "self", ")", ":", "check_list", "=", "[", "'mad'", ",", "'freeman'", ",", "'histograms'", ",", "'IQR'", "]", "for", "estimator", "in", "check_list", ":", "assert_raises", "(", "ValueError", ",", "histogram", ",", "[", "1...
[ 485, 4 ]
[ 491, 70 ]
python
en
['en', 'error', 'th']
False
TestHistogramOptimBinNums.test_novariance
(self)
Check that methods handle no variance in data Primarily for Scott and FD as the SD and IQR are both 0 in this case
Check that methods handle no variance in data Primarily for Scott and FD as the SD and IQR are both 0 in this case
def test_novariance(self): """ Check that methods handle no variance in data Primarily for Scott and FD as the SD and IQR are both 0 in this case """ novar_dataset = np.ones(100) novar_resultdict = {'fd': 1, 'scott': 1, 'rice': 1, 'sturges': 1, ...
[ "def", "test_novariance", "(", "self", ")", ":", "novar_dataset", "=", "np", ".", "ones", "(", "100", ")", "novar_resultdict", "=", "{", "'fd'", ":", "1", ",", "'scott'", ":", "1", ",", "'rice'", ":", "1", ",", "'sturges'", ":", "1", ",", "'doane'", ...
[ 493, 4 ]
[ 505, 62 ]
python
en
['en', 'error', 'th']
False
TestHistogramOptimBinNums.test_limited_variance
(self)
Check when IQR is 0, but variance exists, we return the sturges value and not the fd value.
Check when IQR is 0, but variance exists, we return the sturges value and not the fd value.
def test_limited_variance(self): """ Check when IQR is 0, but variance exists, we return the sturges value and not the fd value. """ lim_var_data = np.ones(1000) lim_var_data[:3] = 0 lim_var_data[-4:] = 100 edges_auto = histogram_bin_edges(lim_var_data, '...
[ "def", "test_limited_variance", "(", "self", ")", ":", "lim_var_data", "=", "np", ".", "ones", "(", "1000", ")", "lim_var_data", "[", ":", "3", "]", "=", "0", "lim_var_data", "[", "-", "4", ":", "]", "=", "100", "edges_auto", "=", "histogram_bin_edges", ...
[ 507, 4 ]
[ 523, 60 ]
python
en
['en', 'error', 'th']
False
TestHistogramOptimBinNums.test_outlier
(self)
Check the FD, Scott and Doane with outliers. The FD estimates a smaller binwidth since it's less affected by outliers. Since the range is so (artificially) large, this means more bins, most of which will be empty, but the data of interest usually is unaffected. The Scott estima...
Check the FD, Scott and Doane with outliers.
def test_outlier(self): """ Check the FD, Scott and Doane with outliers. The FD estimates a smaller binwidth since it's less affected by outliers. Since the range is so (artificially) large, this means more bins, most of which will be empty, but the data of interest usually is ...
[ "def", "test_outlier", "(", "self", ")", ":", "xcenter", "=", "np", ".", "linspace", "(", "-", "10", ",", "10", ",", "50", ")", "outlier_dataset", "=", "np", ".", "hstack", "(", "(", "np", ".", "linspace", "(", "-", "110", ",", "-", "100", ",", ...
[ 525, 4 ]
[ 543, 41 ]
python
en
['en', 'error', 'th']
False
TestHistogramOptimBinNums.test_scott_vs_stone
(self)
Verify that Scott's rule and Stone's rule converges for normally distributed data
Verify that Scott's rule and Stone's rule converges for normally distributed data
def test_scott_vs_stone(self): """Verify that Scott's rule and Stone's rule converges for normally distributed data""" def nbins_ratio(seed, size): rng = np.random.RandomState(seed) x = rng.normal(loc=0, scale=2, size=size) a, b = len(np.histogram(x, 'stone')[0]), le...
[ "def", "test_scott_vs_stone", "(", "self", ")", ":", "def", "nbins_ratio", "(", "seed", ",", "size", ")", ":", "rng", "=", "np", ".", "random", ".", "RandomState", "(", "seed", ")", "x", "=", "rng", ".", "normal", "(", "loc", "=", "0", ",", "scale"...
[ 545, 4 ]
[ 559, 69 ]
python
en
['en', 'en', 'en']
True
TestHistogramOptimBinNums.test_simple_range
(self)
Straightforward testing with a mixture of linspace data (for consistency). Adding in a 3rd mixture that will then be completely ignored. All test values have been precomputed and the shouldn't change.
Straightforward testing with a mixture of linspace data (for consistency). Adding in a 3rd mixture that will then be completely ignored. All test values have been precomputed and the shouldn't change.
def test_simple_range(self): """ Straightforward testing with a mixture of linspace data (for consistency). Adding in a 3rd mixture that will then be completely ignored. All test values have been precomputed and the shouldn't change. """ # some basic sanity checki...
[ "def", "test_simple_range", "(", "self", ")", ":", "# some basic sanity checking, with some fixed data.", "# Checking for the correct number of bins", "basic_test", "=", "{", "50", ":", "{", "'fd'", ":", "8", ",", "'scott'", ":", "8", ",", "'rice'", ":", "15", ",", ...
[ 561, 4 ]
[ 590, 58 ]
python
en
['en', 'error', 'th']
False
TestHistogramOptimBinNums.test_simple_weighted
(self)
Check that weighted data raises a TypeError
Check that weighted data raises a TypeError
def test_simple_weighted(self): """ Check that weighted data raises a TypeError """ estimator_list = ['fd', 'scott', 'rice', 'sturges', 'auto'] for estimator in estimator_list: assert_raises(TypeError, histogram, [1, 2, 3], estimator, weights...
[ "def", "test_simple_weighted", "(", "self", ")", ":", "estimator_list", "=", "[", "'fd'", ",", "'scott'", ",", "'rice'", ",", "'sturges'", ",", "'auto'", "]", "for", "estimator", "in", "estimator_list", ":", "assert_raises", "(", "TypeError", ",", "histogram",...
[ 602, 4 ]
[ 609, 55 ]
python
en
['en', 'error', 'th']
False
TestHistogramdd.test_equal_edges
(self)
Test that adjacent entries in an edge array can be equal
Test that adjacent entries in an edge array can be equal
def test_equal_edges(self): """ Test that adjacent entries in an edge array can be equal """ x = np.array([0, 1, 2]) y = np.array([0, 1, 2]) x_edges = np.array([0, 2, 2]) y_edges = 1 hist, edges = histogramdd((x, y), bins=(x_edges, y_edges)) hist_expected = np.ar...
[ "def", "test_equal_edges", "(", "self", ")", ":", "x", "=", "np", ".", "array", "(", "[", "0", ",", "1", ",", "2", "]", ")", "y", "=", "np", ".", "array", "(", "[", "0", ",", "1", ",", "2", "]", ")", "x_edges", "=", "np", ".", "array", "(...
[ 749, 4 ]
[ 761, 41 ]
python
en
['en', 'en', 'en']
True
TestHistogramdd.test_edge_dtype
(self)
Test that if an edge array is input, its type is preserved
Test that if an edge array is input, its type is preserved
def test_edge_dtype(self): """ Test that if an edge array is input, its type is preserved """ x = np.array([0, 10, 20]) y = x / 10 x_edges = np.array([0, 5, 15, 20]) y_edges = x_edges / 10 hist, edges = histogramdd((x, y), bins=(x_edges, y_edges)) assert_equal(ed...
[ "def", "test_edge_dtype", "(", "self", ")", ":", "x", "=", "np", ".", "array", "(", "[", "0", ",", "10", ",", "20", "]", ")", "y", "=", "x", "/", "10", "x_edges", "=", "np", ".", "array", "(", "[", "0", ",", "5", ",", "15", ",", "20", "]"...
[ 763, 4 ]
[ 772, 51 ]
python
en
['en', 'en', 'en']
True
TestFakeApi.test_fake_outer_boolean_serialize
(self)
Test case for fake_outer_boolean_serialize
Test case for fake_outer_boolean_serialize
def test_fake_outer_boolean_serialize(self): """Test case for fake_outer_boolean_serialize """ pass
[ "def", "test_fake_outer_boolean_serialize", "(", "self", ")", ":", "pass" ]
[ 30, 4 ]
[ 34, 12 ]
python
en
['en', 'en', 'nl']
True
TestFakeApi.test_fake_outer_composite_serialize
(self)
Test case for fake_outer_composite_serialize
Test case for fake_outer_composite_serialize
def test_fake_outer_composite_serialize(self): """Test case for fake_outer_composite_serialize """ pass
[ "def", "test_fake_outer_composite_serialize", "(", "self", ")", ":", "pass" ]
[ 36, 4 ]
[ 40, 12 ]
python
en
['en', 'en', 'en']
True
TestFakeApi.test_fake_outer_number_serialize
(self)
Test case for fake_outer_number_serialize
Test case for fake_outer_number_serialize
def test_fake_outer_number_serialize(self): """Test case for fake_outer_number_serialize """ pass
[ "def", "test_fake_outer_number_serialize", "(", "self", ")", ":", "pass" ]
[ 42, 4 ]
[ 46, 12 ]
python
en
['en', 'en', 'pt']
True
TestFakeApi.test_fake_outer_string_serialize
(self)
Test case for fake_outer_string_serialize
Test case for fake_outer_string_serialize
def test_fake_outer_string_serialize(self): """Test case for fake_outer_string_serialize """ pass
[ "def", "test_fake_outer_string_serialize", "(", "self", ")", ":", "pass" ]
[ 48, 4 ]
[ 52, 12 ]
python
en
['en', 'en', 'en']
True
TestFakeApi.test_test_body_with_query_params
(self)
Test case for test_body_with_query_params
Test case for test_body_with_query_params
def test_test_body_with_query_params(self): """Test case for test_body_with_query_params """ pass
[ "def", "test_test_body_with_query_params", "(", "self", ")", ":", "pass" ]
[ 54, 4 ]
[ 58, 12 ]
python
en
['en', 'en', 'en']
True
TestFakeApi.test_test_client_model
(self)
Test case for test_client_model To test \"client\" model # noqa: E501
Test case for test_client_model
def test_test_client_model(self): """Test case for test_client_model To test \"client\" model # noqa: E501 """ pass
[ "def", "test_test_client_model", "(", "self", ")", ":", "pass" ]
[ 60, 4 ]
[ 65, 12 ]
python
en
['en', 'da', 'en']
True
TestFakeApi.test_test_endpoint_parameters
(self)
Test case for test_endpoint_parameters Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 # noqa: E501
Test case for test_endpoint_parameters
def test_test_endpoint_parameters(self): """Test case for test_endpoint_parameters Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 # noqa: E501 """ pass
[ "def", "test_test_endpoint_parameters", "(", "self", ")", ":", "pass" ]
[ 67, 4 ]
[ 72, 12 ]
python
en
['en', 'en', 'en']
True
TestFakeApi.test_test_enum_parameters
(self)
Test case for test_enum_parameters To test enum parameters # noqa: E501
Test case for test_enum_parameters
def test_test_enum_parameters(self): """Test case for test_enum_parameters To test enum parameters # noqa: E501 """ pass
[ "def", "test_test_enum_parameters", "(", "self", ")", ":", "pass" ]
[ 74, 4 ]
[ 79, 12 ]
python
en
['en', 'fr', 'pt']
False
TestFakeApi.test_test_inline_additional_properties
(self)
Test case for test_inline_additional_properties test inline additionalProperties # noqa: E501
Test case for test_inline_additional_properties
def test_test_inline_additional_properties(self): """Test case for test_inline_additional_properties test inline additionalProperties # noqa: E501 """ pass
[ "def", "test_test_inline_additional_properties", "(", "self", ")", ":", "pass" ]
[ 81, 4 ]
[ 86, 12 ]
python
en
['en', 'en', 'en']
True
TestFakeApi.test_test_json_form_data
(self)
Test case for test_json_form_data test json serialization of form data # noqa: E501
Test case for test_json_form_data
def test_test_json_form_data(self): """Test case for test_json_form_data test json serialization of form data # noqa: E501 """ pass
[ "def", "test_test_json_form_data", "(", "self", ")", ":", "pass" ]
[ 88, 4 ]
[ 93, 12 ]
python
en
['en', 'da', 'en']
True
TestAdditionalPropertiesWithArrayOfEnums.testAdditionalPropertiesWithArrayOfEnums
(self)
Test AdditionalPropertiesWithArrayOfEnums
Test AdditionalPropertiesWithArrayOfEnums
def testAdditionalPropertiesWithArrayOfEnums(self): """Test AdditionalPropertiesWithArrayOfEnums""" # FIXME: construct object with mandatory attributes with example values # model = AdditionalPropertiesWithArrayOfEnums() # noqa: E501 pass
[ "def", "testAdditionalPropertiesWithArrayOfEnums", "(", "self", ")", ":", "# FIXME: construct object with mandatory attributes with example values", "# model = AdditionalPropertiesWithArrayOfEnums() # noqa: E501", "pass" ]
[ 30, 4 ]
[ 34, 12 ]
python
en
['en', 'ky', 'en']
False
EnumClass.openapi_types
()
This must be a method because a model may have properties that are of type self, this must run after the class is loaded Returns openapi_types (dict): The key is attribute name and the value is attribute type.
This must be a method because a model may have properties that are of type self, this must run after the class is loaded
def openapi_types(): """ This must be a method because a model may have properties that are of type self, this must run after the class is loaded Returns openapi_types (dict): The key is attribute name and the value is attribute type. """ retu...
[ "def", "openapi_types", "(", ")", ":", "return", "{", "'value'", ":", "(", "str", ",", ")", ",", "}" ]
[ 65, 4 ]
[ 76, 9 ]
python
en
['en', 'error', 'th']
False
EnumClass.__init__
(self, *args, **kwargs)
EnumClass - a model defined in OpenAPI Note that value can be passed either in args or in kwargs, but not in both. Args: args[0] (str): if omitted defaults to "-efg", must be one of ["_abc", "-efg", "(xyz)", ] # noqa: E501 Keyword Args: value (str): if omitted default...
EnumClass - a model defined in OpenAPI
def __init__(self, *args, **kwargs): """EnumClass - a model defined in OpenAPI Note that value can be passed either in args or in kwargs, but not in both. Args: args[0] (str): if omitted defaults to "-efg", must be one of ["_abc", "-efg", "(xyz)", ] # noqa: E501 Keyword A...
[ "def", "__init__", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "'value'", "in", "kwargs", ":", "value", "=", "kwargs", ".", "pop", "(", "'value'", ")", "elif", "args", ":", "args", "=", "list", "(", "args", ")", "value...
[ 97, 4 ]
[ 178, 13 ]
python
en
['en', 'fy', 'en']
True
director_update_data
( hass: HomeAssistant, entry: ConfigEntry, var: str )
Retrieve data from the Control4 director for update_coordinator.
Retrieve data from the Control4 director for update_coordinator.
async def director_update_data( hass: HomeAssistant, entry: ConfigEntry, var: str ) -> dict: """Retrieve data from the Control4 director for update_coordinator.""" # possibly implement usage of director_token_expiration to start # token refresh without waiting for error to occur try: directo...
[ "async", "def", "director_update_data", "(", "hass", ":", "HomeAssistant", ",", "entry", ":", "ConfigEntry", ",", "var", ":", "str", ")", "->", "dict", ":", "# possibly implement usage of director_token_expiration to start", "# token refresh without waiting for error to occur...
[ 23, 0 ]
[ 37, 43 ]
python
en
['en', 'en', 'en']
True
refresh_tokens
(hass: HomeAssistant, entry: ConfigEntry)
Store updated authentication and director tokens in hass.data.
Store updated authentication and director tokens in hass.data.
async def refresh_tokens(hass: HomeAssistant, entry: ConfigEntry): """Store updated authentication and director tokens in hass.data.""" config = entry.data account_session = aiohttp_client.async_get_clientsession(hass) account = C4Account(config[CONF_USERNAME], config[CONF_PASSWORD], account_session) ...
[ "async", "def", "refresh_tokens", "(", "hass", ":", "HomeAssistant", ",", "entry", ":", "ConfigEntry", ")", ":", "config", "=", "entry", ".", "data", "account_session", "=", "aiohttp_client", ".", "async_get_clientsession", "(", "hass", ")", "account", "=", "C...
[ 40, 0 ]
[ 61, 70 ]
python
en
['en', 'en', 'en']
True
setup_platform
(hass, config, add_entities, discovery_info=None)
Set up the Radarr platform.
Set up the Radarr platform.
def setup_platform(hass, config, add_entities, discovery_info=None): """Set up the Radarr platform.""" conditions = config[CONF_MONITORED_CONDITIONS] entities = [ RadarrSensor(hass, config, description) for description in SENSOR_TYPES if description.key in conditions ] add_en...
[ "def", "setup_platform", "(", "hass", ",", "config", ",", "add_entities", ",", "discovery_info", "=", "None", ")", ":", "conditions", "=", "config", "[", "CONF_MONITORED_CONDITIONS", "]", "entities", "=", "[", "RadarrSensor", "(", "hass", ",", "config", ",", ...
[ 129, 0 ]
[ 137, 32 ]
python
en
['en', 'pt', 'en']
True
get_date
(zone, offset=0)
Get date based on timezone and offset of days.
Get date based on timezone and offset of days.
def get_date(zone, offset=0): """Get date based on timezone and offset of days.""" day = 60 * 60 * 24 return datetime.date(datetime.fromtimestamp(time.time() + day * offset, tz=zone))
[ "def", "get_date", "(", "zone", ",", "offset", "=", "0", ")", ":", "day", "=", "60", "*", "60", "*", "24", "return", "datetime", ".", "date", "(", "datetime", ".", "fromtimestamp", "(", "time", ".", "time", "(", ")", "+", "day", "*", "offset", ",...
[ 242, 0 ]
[ 245, 85 ]
python
en
['en', 'en', 'en']
True