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
AirVisualOptionsFlowHandler.__init__
(self, config_entry)
Initialize.
Initialize.
def __init__(self, config_entry): """Initialize.""" self.config_entry = config_entry
[ "def", "__init__", "(", "self", ",", "config_entry", ")", ":", "self", ".", "config_entry", "=", "config_entry" ]
[ 217, 4 ]
[ 219, 40 ]
python
en
['en', 'en', 'it']
False
AirVisualOptionsFlowHandler.async_step_init
(self, user_input=None)
Manage the options.
Manage the options.
async def async_step_init(self, user_input=None): """Manage the options.""" if user_input is not None: return self.async_create_entry(title="", data=user_input) return self.async_show_form( step_id="init", data_schema=vol.Schema( { ...
[ "async", "def", "async_step_init", "(", "self", ",", "user_input", "=", "None", ")", ":", "if", "user_input", "is", "not", "None", ":", "return", "self", ".", "async_create_entry", "(", "title", "=", "\"\"", ",", "data", "=", "user_input", ")", "return", ...
[ 221, 4 ]
[ 236, 9 ]
python
en
['en', 'en', 'en']
True
find_unique_id_for_remote
(harmony: HarmonyAPI)
Find the unique id for both websocket and xmpp clients.
Find the unique id for both websocket and xmpp clients.
def find_unique_id_for_remote(harmony: HarmonyAPI): """Find the unique id for both websocket and xmpp clients.""" if harmony.hub_id is not None: return str(harmony.hub_id) # fallback timeStampHash if Hub ID is not available return harmony.config["global"]["timeStampHash"].split(";")[-1]
[ "def", "find_unique_id_for_remote", "(", "harmony", ":", "HarmonyAPI", ")", ":", "if", "harmony", ".", "hub_id", "is", "not", "None", ":", "return", "str", "(", "harmony", ".", "hub_id", ")", "# fallback timeStampHash if Hub ID is not available", "return", "harmony"...
[ 9, 0 ]
[ 15, 67 ]
python
en
['en', 'en', 'en']
True
find_best_name_for_remote
(data: dict, harmony: HarmonyAPI)
Find the best name from config or fallback to the remote.
Find the best name from config or fallback to the remote.
def find_best_name_for_remote(data: dict, harmony: HarmonyAPI): """Find the best name from config or fallback to the remote.""" # As a last resort we get the name from the harmony client # in the event a name was not provided. harmony.name is # usually the ip address but it can be an empty string. ...
[ "def", "find_best_name_for_remote", "(", "data", ":", "dict", ",", "harmony", ":", "HarmonyAPI", ")", ":", "# As a last resort we get the name from the harmony client", "# in the event a name was not provided. harmony.name is", "# usually the ip address but it can be an empty string.", ...
[ 18, 0 ]
[ 26, 26 ]
python
en
['en', 'en', 'en']
True
get_harmony_client_if_available
(ip_address: str)
Connect to a harmony hub and fetch info.
Connect to a harmony hub and fetch info.
async def get_harmony_client_if_available(ip_address: str): """Connect to a harmony hub and fetch info.""" harmony = HarmonyAPI(ip_address=ip_address) try: if not await harmony.connect(): await harmony.close() return None except harmony_exceptions.TimeOut: return...
[ "async", "def", "get_harmony_client_if_available", "(", "ip_address", ":", "str", ")", ":", "harmony", "=", "HarmonyAPI", "(", "ip_address", "=", "ip_address", ")", "try", ":", "if", "not", "await", "harmony", ".", "connect", "(", ")", ":", "await", "harmony...
[ 29, 0 ]
[ 42, 18 ]
python
en
['en', 'en', 'en']
True
find_matching_config_entries_for_host
(hass, host)
Search existing config entries for one matching the host.
Search existing config entries for one matching the host.
def find_matching_config_entries_for_host(hass, host): """Search existing config entries for one matching the host.""" for entry in hass.config_entries.async_entries(DOMAIN): if entry.data[CONF_HOST] == host: return entry return None
[ "def", "find_matching_config_entries_for_host", "(", "hass", ",", "host", ")", ":", "for", "entry", "in", "hass", ".", "config_entries", ".", "async_entries", "(", "DOMAIN", ")", ":", "if", "entry", ".", "data", "[", "CONF_HOST", "]", "==", "host", ":", "r...
[ 45, 0 ]
[ 50, 15 ]
python
en
['en', 'en', 'en']
True
list_names_from_hublist
(hub_list)
Extract the name key value from a hub list of names.
Extract the name key value from a hub list of names.
def list_names_from_hublist(hub_list): """Extract the name key value from a hub list of names.""" if not hub_list: return [] return [ element["name"] for element in hub_list if element.get("name") and element.get("id") != -1 ]
[ "def", "list_names_from_hublist", "(", "hub_list", ")", ":", "if", "not", "hub_list", ":", "return", "[", "]", "return", "[", "element", "[", "\"name\"", "]", "for", "element", "in", "hub_list", "if", "element", ".", "get", "(", "\"name\"", ")", "and", "...
[ 53, 0 ]
[ 61, 5 ]
python
en
['en', 'en', 'en']
True
test_proximities
(hass)
Test a list of proximities.
Test a list of proximities.
async def test_proximities(hass): """Test a list of proximities.""" config = { "proximity": { "home": { "ignored_zones": ["work"], "devices": ["device_tracker.test1", "device_tracker.test2"], "tolerance": "1", }, "work":...
[ "async", "def", "test_proximities", "(", "hass", ")", ":", "config", "=", "{", "\"proximity\"", ":", "{", "\"home\"", ":", "{", "\"ignored_zones\"", ":", "[", "\"work\"", "]", ",", "\"devices\"", ":", "[", "\"device_tracker.test1\"", ",", "\"device_tracker.test2...
[ 6, 0 ]
[ 32, 33 ]
python
en
['en', 'en', 'en']
True
test_proximities_setup
(hass)
Test a list of proximities with missing devices.
Test a list of proximities with missing devices.
async def test_proximities_setup(hass): """Test a list of proximities with missing devices.""" config = { "proximity": { "home": { "ignored_zones": ["work"], "devices": ["device_tracker.test1", "device_tracker.test2"], "tolerance": "1", ...
[ "async", "def", "test_proximities_setup", "(", "hass", ")", ":", "config", "=", "{", "\"proximity\"", ":", "{", "\"home\"", ":", "{", "\"ignored_zones\"", ":", "[", "\"work\"", "]", ",", "\"devices\"", ":", "[", "\"device_tracker.test1\"", ",", "\"device_tracker...
[ 35, 0 ]
[ 48, 60 ]
python
en
['en', 'en', 'en']
True
test_proximity
(hass)
Test the proximity.
Test the proximity.
async def test_proximity(hass): """Test the proximity.""" config = { "proximity": { "home": { "ignored_zones": ["work"], "devices": ["device_tracker.test1", "device_tracker.test2"], "tolerance": "1", } } } assert aw...
[ "async", "def", "test_proximity", "(", "hass", ")", ":", "config", "=", "{", "\"proximity\"", ":", "{", "\"home\"", ":", "{", "\"ignored_zones\"", ":", "[", "\"work\"", "]", ",", "\"devices\"", ":", "[", "\"device_tracker.test1\"", ",", "\"device_tracker.test2\"...
[ 51, 0 ]
[ 73, 29 ]
python
en
['en', 'en', 'en']
True
test_device_tracker_test1_in_zone
(hass)
Test for tracker in zone.
Test for tracker in zone.
async def test_device_tracker_test1_in_zone(hass): """Test for tracker in zone.""" config = { "proximity": { "home": { "ignored_zones": ["work"], "devices": ["device_tracker.test1"], "tolerance": "1", } } } assert a...
[ "async", "def", "test_device_tracker_test1_in_zone", "(", "hass", ")", ":", "config", "=", "{", "\"proximity\"", ":", "{", "\"home\"", ":", "{", "\"ignored_zones\"", ":", "[", "\"work\"", "]", ",", "\"devices\"", ":", "[", "\"device_tracker.test1\"", "]", ",", ...
[ 76, 0 ]
[ 99, 61 ]
python
en
['nl', 'en', 'en']
True
test_device_trackers_in_zone
(hass)
Test for trackers in zone.
Test for trackers in zone.
async def test_device_trackers_in_zone(hass): """Test for trackers in zone.""" config = { "proximity": { "home": { "ignored_zones": ["work"], "devices": ["device_tracker.test1", "device_tracker.test2"], "tolerance": "1", } }...
[ "async", "def", "test_device_trackers_in_zone", "(", "hass", ")", ":", "config", "=", "{", "\"proximity\"", ":", "{", "\"home\"", ":", "{", "\"ignored_zones\"", ":", "[", "\"work\"", "]", ",", "\"devices\"", ":", "[", "\"device_tracker.test1\"", ",", "\"device_t...
[ 102, 0 ]
[ 133, 61 ]
python
en
['nl', 'en', 'en']
True
test_device_tracker_test1_away
(hass)
Test for tracker state away.
Test for tracker state away.
async def test_device_tracker_test1_away(hass): """Test for tracker state away.""" config = { "proximity": { "home": { "ignored_zones": ["work"], "devices": ["device_tracker.test1"], "tolerance": "1", } } } assert a...
[ "async", "def", "test_device_tracker_test1_away", "(", "hass", ")", ":", "config", "=", "{", "\"proximity\"", ":", "{", "\"home\"", ":", "{", "\"ignored_zones\"", ":", "[", "\"work\"", "]", ",", "\"devices\"", ":", "[", "\"device_tracker.test1\"", "]", ",", "\...
[ 136, 0 ]
[ 159, 61 ]
python
en
['en', 'en', 'en']
True
test_device_tracker_test1_awayfurther
(hass)
Test for tracker state away further.
Test for tracker state away further.
async def test_device_tracker_test1_awayfurther(hass): """Test for tracker state away further.""" config_zones(hass) await hass.async_block_till_done() config = { "proximity": { "home": { "ignored_zones": ["work"], "devices": ["device_tracker.test1"]...
[ "async", "def", "test_device_tracker_test1_awayfurther", "(", "hass", ")", ":", "config_zones", "(", "hass", ")", "await", "hass", ".", "async_block_till_done", "(", ")", "config", "=", "{", "\"proximity\"", ":", "{", "\"home\"", ":", "{", "\"ignored_zones\"", "...
[ 162, 0 ]
[ 198, 63 ]
python
en
['en', 'en', 'en']
True
test_device_tracker_test1_awaycloser
(hass)
Test for tracker state away closer.
Test for tracker state away closer.
async def test_device_tracker_test1_awaycloser(hass): """Test for tracker state away closer.""" config_zones(hass) await hass.async_block_till_done() config = { "proximity": { "home": { "ignored_zones": ["work"], "devices": ["device_tracker.test1"], ...
[ "async", "def", "test_device_tracker_test1_awaycloser", "(", "hass", ")", ":", "config_zones", "(", "hass", ")", "await", "hass", ".", "async_block_till_done", "(", ")", "config", "=", "{", "\"proximity\"", ":", "{", "\"home\"", ":", "{", "\"ignored_zones\"", ":...
[ 201, 0 ]
[ 236, 61 ]
python
en
['en', 'en', 'en']
True
test_all_device_trackers_in_ignored_zone
(hass)
Test for tracker in ignored zone.
Test for tracker in ignored zone.
async def test_all_device_trackers_in_ignored_zone(hass): """Test for tracker in ignored zone.""" config = { "proximity": { "home": { "ignored_zones": ["work"], "devices": ["device_tracker.test1"], "tolerance": "1", } } ...
[ "async", "def", "test_all_device_trackers_in_ignored_zone", "(", "hass", ")", ":", "config", "=", "{", "\"proximity\"", ":", "{", "\"home\"", ":", "{", "\"ignored_zones\"", ":", "[", "\"work\"", "]", ",", "\"devices\"", ":", "[", "\"device_tracker.test1\"", "]", ...
[ 239, 0 ]
[ 258, 61 ]
python
en
['en', 'en', 'en']
True
test_device_tracker_test1_no_coordinates
(hass)
Test for tracker with no coordinates.
Test for tracker with no coordinates.
async def test_device_tracker_test1_no_coordinates(hass): """Test for tracker with no coordinates.""" config = { "proximity": { "home": { "ignored_zones": ["work"], "devices": ["device_tracker.test1"], "tolerance": "1", } } ...
[ "async", "def", "test_device_tracker_test1_no_coordinates", "(", "hass", ")", ":", "config", "=", "{", "\"proximity\"", ":", "{", "\"home\"", ":", "{", "\"ignored_zones\"", ":", "[", "\"work\"", "]", ",", "\"devices\"", ":", "[", "\"device_tracker.test1\"", "]", ...
[ 261, 0 ]
[ 281, 61 ]
python
en
['en', 'en', 'en']
True
test_device_tracker_test1_awayfurther_than_test2_first_test1
(hass)
Test for tracker ordering.
Test for tracker ordering.
async def test_device_tracker_test1_awayfurther_than_test2_first_test1(hass): """Test for tracker ordering.""" config_zones(hass) await hass.async_block_till_done() hass.states.async_set( "device_tracker.test1", "not_home", {"friendly_name": "test1"} ) await hass.async_block_till_done()...
[ "async", "def", "test_device_tracker_test1_awayfurther_than_test2_first_test1", "(", "hass", ")", ":", "config_zones", "(", "hass", ")", "await", "hass", ".", "async_block_till_done", "(", ")", "hass", ".", "states", ".", "async_set", "(", "\"device_tracker.test1\"", ...
[ 284, 0 ]
[ 331, 61 ]
python
en
['en', 'no', 'en']
True
test_device_tracker_test1_awayfurther_than_test2_first_test2
(hass)
Test for tracker ordering.
Test for tracker ordering.
async def test_device_tracker_test1_awayfurther_than_test2_first_test2(hass): """Test for tracker ordering.""" config_zones(hass) await hass.async_block_till_done() hass.states.async_set( "device_tracker.test1", "not_home", {"friendly_name": "test1"} ) await hass.async_block_till_done()...
[ "async", "def", "test_device_tracker_test1_awayfurther_than_test2_first_test2", "(", "hass", ")", ":", "config_zones", "(", "hass", ")", "await", "hass", ".", "async_block_till_done", "(", ")", "hass", ".", "states", ".", "async_set", "(", "\"device_tracker.test1\"", ...
[ 334, 0 ]
[ 379, 61 ]
python
en
['en', 'no', 'en']
True
test_device_tracker_test1_awayfurther_test2_in_ignored_zone
(hass)
Test for tracker states.
Test for tracker states.
async def test_device_tracker_test1_awayfurther_test2_in_ignored_zone(hass): """Test for tracker states.""" hass.states.async_set( "device_tracker.test1", "not_home", {"friendly_name": "test1"} ) await hass.async_block_till_done() hass.states.async_set("device_tracker.test2", "work", {"frien...
[ "async", "def", "test_device_tracker_test1_awayfurther_test2_in_ignored_zone", "(", "hass", ")", ":", "hass", ".", "states", ".", "async_set", "(", "\"device_tracker.test1\"", ",", "\"not_home\"", ",", "{", "\"friendly_name\"", ":", "\"test1\"", "}", ")", "await", "ha...
[ 382, 0 ]
[ 412, 61 ]
python
en
['en', 'en', 'en']
True
test_device_tracker_test1_awayfurther_test2_first
(hass)
Test for tracker state.
Test for tracker state.
async def test_device_tracker_test1_awayfurther_test2_first(hass): """Test for tracker state.""" config_zones(hass) await hass.async_block_till_done() hass.states.async_set( "device_tracker.test1", "not_home", {"friendly_name": "test1"} ) await hass.async_block_till_done() hass.stat...
[ "async", "def", "test_device_tracker_test1_awayfurther_test2_first", "(", "hass", ")", ":", "config_zones", "(", "hass", ")", "await", "hass", ".", "async_block_till_done", "(", ")", "hass", ".", "states", ".", "async_set", "(", "\"device_tracker.test1\"", ",", "\"n...
[ 415, 0 ]
[ 476, 61 ]
python
en
['en', 'en', 'en']
True
test_device_tracker_test1_awayfurther_a_bit
(hass)
Test for tracker states.
Test for tracker states.
async def test_device_tracker_test1_awayfurther_a_bit(hass): """Test for tracker states.""" assert await async_setup_component( hass, DOMAIN, { "proximity": { "home": { "ignored_zones": ["work"], "devices": ["device_trac...
[ "async", "def", "test_device_tracker_test1_awayfurther_a_bit", "(", "hass", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "DOMAIN", ",", "{", "\"proximity\"", ":", "{", "\"home\"", ":", "{", "\"ignored_zones\"", ":", "[", "\"work\"", "]",...
[ 479, 0 ]
[ 514, 64 ]
python
en
['en', 'en', 'en']
True
test_device_tracker_test1_nearest_after_test2_in_ignored_zone
(hass)
Test for tracker states.
Test for tracker states.
async def test_device_tracker_test1_nearest_after_test2_in_ignored_zone(hass): """Test for tracker states.""" config_zones(hass) await hass.async_block_till_done() hass.states.async_set( "device_tracker.test1", "not_home", {"friendly_name": "test1"} ) await hass.async_block_till_done() ...
[ "async", "def", "test_device_tracker_test1_nearest_after_test2_in_ignored_zone", "(", "hass", ")", ":", "config_zones", "(", "hass", ")", "await", "hass", ".", "async_block_till_done", "(", ")", "hass", ".", "states", ".", "async_set", "(", "\"device_tracker.test1\"", ...
[ 517, 0 ]
[ 573, 61 ]
python
en
['en', 'en', 'en']
True
config_zones
(hass)
Set up zones for test.
Set up zones for test.
def config_zones(hass): """Set up zones for test.""" hass.config.components.add("zone") hass.states.async_set( "zone.home", "zoning", {"name": "home", "latitude": 2.1, "longitude": 1.1, "radius": 10}, ) hass.states.async_set( "zone.work", "zoning", {"n...
[ "def", "config_zones", "(", "hass", ")", ":", "hass", ".", "config", ".", "components", ".", "add", "(", "\"zone\"", ")", "hass", ".", "states", ".", "async_set", "(", "\"zone.home\"", ",", "\"zoning\"", ",", "{", "\"name\"", ":", "\"home\"", ",", "\"lat...
[ 576, 0 ]
[ 588, 5 ]
python
en
['en', 'en', 'en']
True
run
(argv=None)
The main function which creates the pipeline and runs it.
The main function which creates the pipeline and runs it.
def run(argv=None): """The main function which creates the pipeline and runs it.""" parser = argparse.ArgumentParser() # Here we add some specific command line arguments we expect. Specifically # we have the input file to load and the output table to write to. parser.add_argument( '--input...
[ "def", "run", "(", "argv", "=", "None", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", ")", "# Here we add some specific command line arguments we expect. Specifically", "# we have the input file to load and the output table to write to.", "parser", ".", "ad...
[ 109, 0 ]
[ 198, 31 ]
python
en
['en', 'en', 'en']
True
DataIngestion.parse_method
(self, string_input)
This method translates a single line of comma separated values to a dictionary which can be loaded into BigQuery. Args: string_input: A comma separated list of values in the form of state_abbreviation,gender,year,name,count_of_babies,dataset_created_date example stri...
This method translates a single line of comma separated values to a dictionary which can be loaded into BigQuery.
def parse_method(self, string_input): """This method translates a single line of comma separated values to a dictionary which can be loaded into BigQuery. Args: string_input: A comma separated list of values in the form of state_abbreviation,gender,year,name,count_of_babies,...
[ "def", "parse_method", "(", "self", ",", "string_input", ")", ":", "# Strip out return characters and quote characters.", "schema", "=", "bigquery", ".", "parse_table_schema_from_json", "(", "self", ".", "schema_str", ")", "field_map", "=", "[", "f", "for", "f", "in...
[ 49, 4 ]
[ 106, 22 ]
python
en
['en', 'en', 'en']
True
mock_legacy_time
(legacy_patchable_time)
Make time patchable for all the tests.
Make time patchable for all the tests.
def mock_legacy_time(legacy_patchable_time): """Make time patchable for all the tests.""" yield
[ "def", "mock_legacy_time", "(", "legacy_patchable_time", ")", ":", "yield" ]
[ 17, 0 ]
[ 19, 9 ]
python
en
['en', 'en', 'en']
True
setup_fixture
(hass)
Set up things to be run when tests are started.
Set up things to be run when tests are started.
def setup_fixture(hass): """Set up things to be run when tests are started.""" hass.config.latitude = 50.27583 hass.config.longitude = 18.98583
[ "def", "setup_fixture", "(", "hass", ")", ":", "hass", ".", "config", ".", "latitude", "=", "50.27583", "hass", ".", "config", ".", "longitude", "=", "18.98583" ]
[ 23, 0 ]
[ 26, 36 ]
python
en
['en', 'en', 'en']
True
test_setup
(hass)
Test the setup.
Test the setup.
async def test_setup(hass): """Test the setup.""" config = { "binary_sensor": [ { "platform": "tod", "name": "Early Morning", "after": "sunrise", "after_offset": "-02:00", "before": "7:00", "befor...
[ "async", "def", "test_setup", "(", "hass", ")", ":", "config", "=", "{", "\"binary_sensor\"", ":", "[", "{", "\"platform\"", ":", "\"tod\"", ",", "\"name\"", ":", "\"Early Morning\"", ",", "\"after\"", ":", "\"sunrise\"", ",", "\"after_offset\"", ":", "\"-02:0...
[ 29, 0 ]
[ 50, 73 ]
python
en
['en', 'haw', 'en']
True
test_setup_no_sensors
(hass)
Test setup with no sensors.
Test setup with no sensors.
async def test_setup_no_sensors(hass): """Test setup with no sensors.""" with assert_setup_component(0): assert await async_setup_component( hass, "binary_sensor", {"binary_sensor": {"platform": "tod"}} )
[ "async", "def", "test_setup_no_sensors", "(", "hass", ")", ":", "with", "assert_setup_component", "(", "0", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "\"binary_sensor\"", ",", "{", "\"binary_sensor\"", ":", "{", "\"platform\"", ":", ...
[ 53, 0 ]
[ 58, 9 ]
python
en
['en', 'haw', 'en']
True
test_in_period_on_start
(hass)
Test simple setting.
Test simple setting.
async def test_in_period_on_start(hass): """Test simple setting.""" test_time = datetime(2019, 1, 10, 18, 43, 0, tzinfo=hass.config.time_zone) config = { "binary_sensor": [ { "platform": "tod", "name": "Evening", "after": "18:00", ...
[ "async", "def", "test_in_period_on_start", "(", "hass", ")", ":", "test_time", "=", "datetime", "(", "2019", ",", "1", ",", "10", ",", "18", ",", "43", ",", "0", ",", "tzinfo", "=", "hass", ".", "config", ".", "time_zone", ")", "config", "=", "{", ...
[ 61, 0 ]
[ 82, 34 ]
python
en
['en', 'en', 'en']
True
test_midnight_turnover_before_midnight_inside_period
(hass)
Test midnight turnover setting before midnight inside period .
Test midnight turnover setting before midnight inside period .
async def test_midnight_turnover_before_midnight_inside_period(hass): """Test midnight turnover setting before midnight inside period .""" test_time = datetime(2019, 1, 10, 22, 30, 0, tzinfo=hass.config.time_zone) config = { "binary_sensor": [ {"platform": "tod", "name": "Night", "after"...
[ "async", "def", "test_midnight_turnover_before_midnight_inside_period", "(", "hass", ")", ":", "test_time", "=", "datetime", "(", "2019", ",", "1", ",", "10", ",", "22", ",", "30", ",", "0", ",", "tzinfo", "=", "hass", ".", "config", ".", "time_zone", ")",...
[ 85, 0 ]
[ 101, 34 ]
python
en
['en', 'en', 'en']
True
test_midnight_turnover_after_midnight_inside_period
(hass)
Test midnight turnover setting before midnight inside period .
Test midnight turnover setting before midnight inside period .
async def test_midnight_turnover_after_midnight_inside_period(hass): """Test midnight turnover setting before midnight inside period .""" test_time = hass.config.time_zone.localize( datetime(2019, 1, 10, 21, 0, 0) ).astimezone(pytz.UTC) config = { "binary_sensor": [ {"platfor...
[ "async", "def", "test_midnight_turnover_after_midnight_inside_period", "(", "hass", ")", ":", "test_time", "=", "hass", ".", "config", ".", "time_zone", ".", "localize", "(", "datetime", "(", "2019", ",", "1", ",", "10", ",", "21", ",", "0", ",", "0", ")",...
[ 104, 0 ]
[ 137, 38 ]
python
en
['en', 'en', 'en']
True
test_midnight_turnover_before_midnight_outside_period
(hass)
Test midnight turnover setting before midnight outside period.
Test midnight turnover setting before midnight outside period.
async def test_midnight_turnover_before_midnight_outside_period(hass): """Test midnight turnover setting before midnight outside period.""" test_time = hass.config.time_zone.localize( datetime(2019, 1, 10, 20, 30, 0) ).astimezone(pytz.UTC) config = { "binary_sensor": [ {"plat...
[ "async", "def", "test_midnight_turnover_before_midnight_outside_period", "(", "hass", ")", ":", "test_time", "=", "hass", ".", "config", ".", "time_zone", ".", "localize", "(", "datetime", "(", "2019", ",", "1", ",", "10", ",", "20", ",", "30", ",", "0", "...
[ 140, 0 ]
[ 158, 35 ]
python
en
['en', 'en', 'en']
True
test_midnight_turnover_after_midnight_outside_period
(hass)
Test midnight turnover setting before midnight inside period .
Test midnight turnover setting before midnight inside period .
async def test_midnight_turnover_after_midnight_outside_period(hass): """Test midnight turnover setting before midnight inside period .""" test_time = hass.config.time_zone.localize( datetime(2019, 1, 10, 20, 0, 0) ).astimezone(pytz.UTC) config = { "binary_sensor": [ {"platf...
[ "async", "def", "test_midnight_turnover_after_midnight_outside_period", "(", "hass", ")", ":", "test_time", "=", "hass", ".", "config", ".", "time_zone", ".", "localize", "(", "datetime", "(", "2019", ",", "1", ",", "10", ",", "20", ",", "0", ",", "0", ")"...
[ 161, 0 ]
[ 207, 39 ]
python
en
['en', 'en', 'en']
True
test_from_sunrise_to_sunset
(hass)
Test period from sunrise to sunset.
Test period from sunrise to sunset.
async def test_from_sunrise_to_sunset(hass): """Test period from sunrise to sunset.""" test_time = hass.config.time_zone.localize(datetime(2019, 1, 12)).astimezone( pytz.UTC ) sunrise = dt_util.as_local( get_astral_event_date(hass, "sunrise", dt_util.as_utc(test_time)) ) sunset =...
[ "async", "def", "test_from_sunrise_to_sunset", "(", "hass", ")", ":", "test_time", "=", "hass", ".", "config", ".", "time_zone", ".", "localize", "(", "datetime", "(", "2019", ",", "1", ",", "12", ")", ")", ".", "astimezone", "(", "pytz", ".", "UTC", "...
[ 210, 0 ]
[ 308, 39 ]
python
en
['en', 'en', 'en']
True
test_from_sunset_to_sunrise
(hass)
Test period from sunset to sunrise.
Test period from sunset to sunrise.
async def test_from_sunset_to_sunrise(hass): """Test period from sunset to sunrise.""" test_time = hass.config.time_zone.localize(datetime(2019, 1, 12)).astimezone( pytz.UTC ) sunset = dt_util.as_local(get_astral_event_date(hass, "sunset", test_time)) sunrise = dt_util.as_local(get_astral_ev...
[ "async", "def", "test_from_sunset_to_sunrise", "(", "hass", ")", ":", "test_time", "=", "hass", ".", "config", ".", "time_zone", ".", "localize", "(", "datetime", "(", "2019", ",", "1", ",", "12", ")", ")", ".", "astimezone", "(", "pytz", ".", "UTC", "...
[ 311, 0 ]
[ 402, 39 ]
python
en
['en', 'en', 'en']
True
test_offset
(hass)
Test offset.
Test offset.
async def test_offset(hass): """Test offset.""" after = hass.config.time_zone.localize(datetime(2019, 1, 10, 18, 0, 0)).astimezone( pytz.UTC ) + timedelta(hours=1, minutes=34) before = hass.config.time_zone.localize(datetime(2019, 1, 10, 22, 0, 0)).astimezone( pytz.UTC ) + timedelta...
[ "async", "def", "test_offset", "(", "hass", ")", ":", "after", "=", "hass", ".", "config", ".", "time_zone", ".", "localize", "(", "datetime", "(", "2019", ",", "1", ",", "10", ",", "18", ",", "0", ",", "0", ")", ")", ".", "astimezone", "(", "pyt...
[ 405, 0 ]
[ 481, 39 ]
python
en
['en', 'lb', 'en']
False
test_offset_overnight
(hass)
Test offset overnight.
Test offset overnight.
async def test_offset_overnight(hass): """Test offset overnight.""" after = hass.config.time_zone.localize(datetime(2019, 1, 10, 18, 0, 0)).astimezone( pytz.UTC ) + timedelta(hours=1, minutes=34) entity_id = "binary_sensor.evening" config = { "binary_sensor": [ { ...
[ "async", "def", "test_offset_overnight", "(", "hass", ")", ":", "after", "=", "hass", ".", "config", ".", "time_zone", ".", "localize", "(", "datetime", "(", "2019", ",", "1", ",", "10", ",", "18", ",", "0", ",", "0", ")", ")", ".", "astimezone", "...
[ 484, 0 ]
[ 522, 38 ]
python
en
['en', 'ky', 'en']
True
test_norwegian_case_winter
(hass)
Test location in Norway where the sun doesn't set in summer.
Test location in Norway where the sun doesn't set in summer.
async def test_norwegian_case_winter(hass): """Test location in Norway where the sun doesn't set in summer.""" hass.config.latitude = 69.6 hass.config.longitude = 18.8 test_time = hass.config.time_zone.localize(datetime(2010, 1, 1)).astimezone( pytz.UTC ) sunrise = dt_util.as_local( ...
[ "async", "def", "test_norwegian_case_winter", "(", "hass", ")", ":", "hass", ".", "config", ".", "latitude", "=", "69.6", "hass", ".", "config", ".", "longitude", "=", "18.8", "test_time", "=", "hass", ".", "config", ".", "time_zone", ".", "localize", "(",...
[ 525, 0 ]
[ 638, 39 ]
python
en
['en', 'en', 'en']
True
test_norwegian_case_summer
(hass)
Test location in Norway where the sun doesn't set in summer.
Test location in Norway where the sun doesn't set in summer.
async def test_norwegian_case_summer(hass): """Test location in Norway where the sun doesn't set in summer.""" hass.config.latitude = 69.6 hass.config.longitude = 18.8 test_time = hass.config.time_zone.localize(datetime(2010, 6, 1)).astimezone( pytz.UTC ) sunrise = dt_util.as_local( ...
[ "async", "def", "test_norwegian_case_summer", "(", "hass", ")", ":", "hass", ".", "config", ".", "latitude", "=", "69.6", "hass", ".", "config", ".", "longitude", "=", "18.8", "test_time", "=", "hass", ".", "config", ".", "time_zone", ".", "localize", "(",...
[ 641, 0 ]
[ 755, 39 ]
python
en
['en', 'en', 'en']
True
test_sun_offset
(hass)
Test sun event with offset.
Test sun event with offset.
async def test_sun_offset(hass): """Test sun event with offset.""" test_time = hass.config.time_zone.localize(datetime(2019, 1, 12)).astimezone( pytz.UTC ) sunrise = dt_util.as_local( get_astral_event_date(hass, "sunrise", dt_util.as_utc(test_time)) + timedelta(hours=-1, minutes=...
[ "async", "def", "test_sun_offset", "(", "hass", ")", ":", "test_time", "=", "hass", ".", "config", ".", "time_zone", ".", "localize", "(", "datetime", "(", "2019", ",", "1", ",", "12", ")", ")", ".", "astimezone", "(", "pytz", ".", "UTC", ")", "sunri...
[ 758, 0 ]
[ 877, 38 ]
python
en
['en', 'en', 'en']
True
test_dst
(hass)
Test sun event with offset.
Test sun event with offset.
async def test_dst(hass): """Test sun event with offset.""" hass.config.time_zone = pytz.timezone("CET") test_time = hass.config.time_zone.localize( datetime(2019, 3, 30, 3, 0, 0) ).astimezone(pytz.UTC) config = { "binary_sensor": [ {"platform": "tod", "name": "Day", "aft...
[ "async", "def", "test_dst", "(", "hass", ")", ":", "hass", ".", "config", ".", "time_zone", "=", "pytz", ".", "timezone", "(", "\"CET\"", ")", "test_time", "=", "hass", ".", "config", ".", "time_zone", ".", "localize", "(", "datetime", "(", "2019", ","...
[ 880, 0 ]
[ 908, 39 ]
python
en
['en', 'en', 'en']
True
async_setup
(hass, config)
Set up a config entry.
Set up a config entry.
async def async_setup(hass, config): """Set up a config entry.""" hass.data[DOMAIN] = {} if DOMAIN not in config: return True conf = config[DOMAIN] if not hass.config_entries.async_entries(DOMAIN): hass.async_create_task( hass.config_entries.flow.async_init( ...
[ "async", "def", "async_setup", "(", "hass", ",", "config", ")", ":", "hass", ".", "data", "[", "DOMAIN", "]", "=", "{", "}", "if", "DOMAIN", "not", "in", "config", ":", "return", "True", "conf", "=", "config", "[", "DOMAIN", "]", "if", "not", "hass...
[ 32, 0 ]
[ 47, 15 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
(hass, entry)
Set up Spider via config entry.
Set up Spider via config entry.
async def async_setup_entry(hass, entry): """Set up Spider via config entry.""" try: api = await hass.async_add_executor_job( SpiderApi, entry.data[CONF_USERNAME], entry.data[CONF_PASSWORD], entry.data[CONF_SCAN_INTERVAL], ) except Unauthorized...
[ "async", "def", "async_setup_entry", "(", "hass", ",", "entry", ")", ":", "try", ":", "api", "=", "await", "hass", ".", "async_add_executor_job", "(", "SpiderApi", ",", "entry", ".", "data", "[", "CONF_USERNAME", "]", ",", "entry", ".", "data", "[", "CON...
[ 50, 0 ]
[ 73, 15 ]
python
en
['en', 'pt', 'en']
True
async_unload_entry
(hass, entry)
Unload Spider entry.
Unload Spider entry.
async def async_unload_entry(hass, entry): """Unload Spider entry.""" unload_ok = all( await asyncio.gather( *[ hass.config_entries.async_forward_entry_unload(entry, component) for component in PLATFORMS ] ) ) if not unload_ok: ...
[ "async", "def", "async_unload_entry", "(", "hass", ",", "entry", ")", ":", "unload_ok", "=", "all", "(", "await", "asyncio", ".", "gather", "(", "*", "[", "hass", ".", "config_entries", ".", "async_forward_entry_unload", "(", "entry", ",", "component", ")", ...
[ 76, 0 ]
[ 92, 15 ]
python
da
['da', 'da', 'en']
True
kepler_E
(M_in, ecc)
#if ecc < 1e-10: # return mx # equation 9a aux = 4.0 * ecc + 0.50 alpha = (1.0 - ecc) / aux beta = mx / (2.0 * aux) # equation 9b ## the actual equation 9b is much much slower, but gives the same ## answer (probably because more refinement necessary) aux = np.sqrt(beta * be...
#if ecc < 1e-10: # return mx
def kepler_E(M_in, ecc): mx = np.atleast_1d(M_in) % (2. * np.pi) eccanom = np.zeros(np.size(mx), dtype=np.double) """ #if ecc < 1e-10: # return mx # equation 9a aux = 4.0 * ecc + 0.50 alpha = (1.0 - ecc) / aux beta = mx / (2.0 * aux) # equation 9b ## the actual equatio...
[ "def", "kepler_E", "(", "M_in", ",", "ecc", ")", ":", "mx", "=", "np", ".", "atleast_1d", "(", "M_in", ")", "%", "(", "2.", "*", "np", ".", "pi", ")", "eccanom", "=", "np", ".", "zeros", "(", "np", ".", "size", "(", "mx", ")", ",", "dtype", ...
[ 29, 0 ]
[ 110, 19 ]
python
en
['en', 'error', 'th']
False
kepler_K1
(m_star1, m_star2, period, i, e0)
Computes the radial velocity semi-amplitude of the primary star :param m_star1: mass of the primary, in Solar mass units :param m_star2: mass of the secondary/planet, in Solar mass units :param period: orbital period of star2, in [d] :param i: orbital inclination of star2 wrt the observer (0=face on),...
Computes the radial velocity semi-amplitude of the primary star
def kepler_K1(m_star1, m_star2, period, i, e0): """ Computes the radial velocity semi-amplitude of the primary star :param m_star1: mass of the primary, in Solar mass units :param m_star2: mass of the secondary/planet, in Solar mass units :param period: orbital period of star2, in [d] :param i: orb...
[ "def", "kepler_K1", "(", "m_star1", ",", "m_star2", ",", "period", ",", "i", ",", "e0", ")", ":", "# period must be given in days, conversion factor to seconds are included in the routine", "# constants.Gsi: Gravitational constant in SI system [m^3 kg^-1 s^-2]", "# constants.Msun: Su...
[ 113, 0 ]
[ 130, 58 ]
python
en
['en', 'en', 'en']
True
f_get_mass
(m_star2, m_star1, period, e0, k1)
Computes the difference between the input radial velocity semi-amplitude of the primary star and the value corresponding to the provided orbital parameters. Supporting function to get_planet_mass subroutine :param m_star2: mass of the secondary/planet, in Solar mass units :param m_star1: mass of the p...
Computes the difference between the input radial velocity semi-amplitude of the primary star and the value corresponding to the provided orbital parameters. Supporting function to get_planet_mass subroutine
def f_get_mass(m_star2, m_star1, period, e0, k1): """ Computes the difference between the input radial velocity semi-amplitude of the primary star and the value corresponding to the provided orbital parameters. Supporting function to get_planet_mass subroutine :param m_star2: mass of the secondary/plan...
[ "def", "f_get_mass", "(", "m_star2", ",", "m_star1", ",", "period", ",", "e0", ",", "k1", ")", ":", "# period must be given in days, conversion factor to seconds are included in the routine", "# constants.Gsi: Gravitational constant in SI system [m^3 kg^-1 s^-2]", "# constants.Msun: ...
[ 204, 0 ]
[ 231, 62 ]
python
en
['en', 'en', 'en']
True
get_approximate_mass
(period, k1, e0, m_star1)
Return the approximate mass of the planet in Solar mass units, in the assumption that M_planet << M_star :param period: orbital period of star2, in [d] :param k1: observed RV semi-amplitude of the primary :param e0: orbital eccentricity of star2 :param m_star1: mass of the primary, in Solar mass units...
Return the approximate mass of the planet in Solar mass units, in the assumption that M_planet << M_star
def get_approximate_mass(period, k1, e0, m_star1): """ Return the approximate mass of the planet in Solar mass units, in the assumption that M_planet << M_star :param period: orbital period of star2, in [d] :param k1: observed RV semi-amplitude of the primary :param e0: orbital eccentricity of star2 ...
[ "def", "get_approximate_mass", "(", "period", ",", "k1", ",", "e0", ",", "m_star1", ")", ":", "return", "k1", "/", "(", "(", "2.", "*", "np", ".", "pi", "*", "constants", ".", "Gsi", "*", "constants", ".", "Msun", "/", "86400.0", ")", "**", "(", ...
[ 233, 0 ]
[ 245, 35 ]
python
en
['en', 'en', 'en']
True
setup
(hass, hass_config)
Set up global ECoalController instance same for sensors and switches.
Set up global ECoalController instance same for sensors and switches.
def setup(hass, hass_config): """Set up global ECoalController instance same for sensors and switches.""" conf = hass_config[DOMAIN] host = conf[CONF_HOST] username = conf[CONF_USERNAME] passwd = conf[CONF_PASSWORD] # Creating ECoalController instance makes HTTP request to controller. ecoal...
[ "def", "setup", "(", "hass", ",", "hass_config", ")", ":", "conf", "=", "hass_config", "[", "DOMAIN", "]", "host", "=", "conf", "[", "CONF_HOST", "]", "username", "=", "conf", "[", "CONF_USERNAME", "]", "passwd", "=", "conf", "[", "CONF_PASSWORD", "]", ...
[ 81, 0 ]
[ 106, 15 ]
python
en
['en', 'en', 'en']
True
test_setup_with_config
(hass)
Test the platform setup with configuration.
Test the platform setup with configuration.
async def test_setup_with_config(hass): """Test the platform setup with configuration.""" assert await async_setup_component( hass, "sensor", {"dte_energy_bridge": DTE_ENERGY_BRIDGE_CONFIG} ) await hass.async_block_till_done()
[ "async", "def", "test_setup_with_config", "(", "hass", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "\"sensor\"", ",", "{", "\"dte_energy_bridge\"", ":", "DTE_ENERGY_BRIDGE_CONFIG", "}", ")", "await", "hass", ".", "async_block_till_done", ...
[ 8, 0 ]
[ 13, 38 ]
python
en
['en', 'en', 'en']
True
test_setup_correct_reading
(hass)
Test DTE Energy bridge returns a correct value.
Test DTE Energy bridge returns a correct value.
async def test_setup_correct_reading(hass): """Test DTE Energy bridge returns a correct value.""" with requests_mock.Mocker() as mock_req: mock_req.get( "http://{}/instantaneousdemand".format(DTE_ENERGY_BRIDGE_CONFIG["ip"]), text=".411 kW", ) assert await async_se...
[ "async", "def", "test_setup_correct_reading", "(", "hass", ")", ":", "with", "requests_mock", ".", "Mocker", "(", ")", "as", "mock_req", ":", "mock_req", ".", "get", "(", "\"http://{}/instantaneousdemand\"", ".", "format", "(", "DTE_ENERGY_BRIDGE_CONFIG", "[", "\"...
[ 16, 0 ]
[ 27, 74 ]
python
en
['en', 'fr', 'en']
True
test_setup_incorrect_units_reading
(hass)
Test DTE Energy bridge handles a value with incorrect units.
Test DTE Energy bridge handles a value with incorrect units.
async def test_setup_incorrect_units_reading(hass): """Test DTE Energy bridge handles a value with incorrect units.""" with requests_mock.Mocker() as mock_req: mock_req.get( "http://{}/instantaneousdemand".format(DTE_ENERGY_BRIDGE_CONFIG["ip"]), text="411 kW", ) a...
[ "async", "def", "test_setup_incorrect_units_reading", "(", "hass", ")", ":", "with", "requests_mock", ".", "Mocker", "(", ")", "as", "mock_req", ":", "mock_req", ".", "get", "(", "\"http://{}/instantaneousdemand\"", ".", "format", "(", "DTE_ENERGY_BRIDGE_CONFIG", "[...
[ 30, 0 ]
[ 41, 74 ]
python
en
['en', 'en', 'en']
True
test_setup_bad_format_reading
(hass)
Test DTE Energy bridge handles an invalid value.
Test DTE Energy bridge handles an invalid value.
async def test_setup_bad_format_reading(hass): """Test DTE Energy bridge handles an invalid value.""" with requests_mock.Mocker() as mock_req: mock_req.get( "http://{}/instantaneousdemand".format(DTE_ENERGY_BRIDGE_CONFIG["ip"]), text="411", ) assert await async_se...
[ "async", "def", "test_setup_bad_format_reading", "(", "hass", ")", ":", "with", "requests_mock", ".", "Mocker", "(", ")", "as", "mock_req", ":", "mock_req", ".", "get", "(", "\"http://{}/instantaneousdemand\"", ".", "format", "(", "DTE_ENERGY_BRIDGE_CONFIG", "[", ...
[ 44, 0 ]
[ 55, 76 ]
python
en
['en', 'fr', 'en']
True
zha_device
()
Return a mock of ZHA device.
Return a mock of ZHA device.
def zha_device(): """Return a mock of ZHA device.""" dev = mock.MagicMock() dev.manufacturer = MANUFACTURER dev.model = MODEL return dev
[ "def", "zha_device", "(", ")", ":", "dev", "=", "mock", ".", "MagicMock", "(", ")", "dev", ".", "manufacturer", "=", "MANUFACTURER", "dev", ".", "model", "=", "MODEL", "return", "dev" ]
[ 12, 0 ]
[ 17, 14 ]
python
en
['en', 'fy', 'en']
True
channels
(channel)
Return a mock of channels.
Return a mock of channels.
def channels(channel): """Return a mock of channels.""" return [channel("level", 8), channel("on_off", 6)]
[ "def", "channels", "(", "channel", ")", ":", "return", "[", "channel", "(", "\"level\"", ",", "8", ")", ",", "channel", "(", "\"on_off\"", ",", "6", ")", "]" ]
[ 21, 0 ]
[ 24, 54 ]
python
en
['en', 'fy', 'en']
True
test_registry_matching
(rule, matched, channels)
Test strict rule matching.
Test strict rule matching.
def test_registry_matching(rule, matched, channels): """Test strict rule matching.""" assert rule.strict_matched(MANUFACTURER, MODEL, channels) is matched
[ "def", "test_registry_matching", "(", "rule", ",", "matched", ",", "channels", ")", ":", "assert", "rule", ".", "strict_matched", "(", "MANUFACTURER", ",", "MODEL", ",", "channels", ")", "is", "matched" ]
[ 127, 0 ]
[ 129, 72 ]
python
en
['en', 'en', 'en']
True
test_registry_loose_matching
(rule, matched, channels)
Test loose rule matching.
Test loose rule matching.
def test_registry_loose_matching(rule, matched, channels): """Test loose rule matching.""" assert rule.loose_matched(MANUFACTURER, MODEL, channels) is matched
[ "def", "test_registry_loose_matching", "(", "rule", ",", "matched", ",", "channels", ")", ":", "assert", "rule", ".", "loose_matched", "(", "MANUFACTURER", ",", "MODEL", ",", "channels", ")", "is", "matched" ]
[ 210, 0 ]
[ 212, 71 ]
python
en
['en', 'en', 'en']
True
test_match_rule_claim_channels_color
(channel)
Test channel claiming.
Test channel claiming.
def test_match_rule_claim_channels_color(channel): """Test channel claiming.""" ch_color = channel("color", 0x300) ch_level = channel("level", 8) ch_onoff = channel("on_off", 6) rule = registries.MatchRule(channel_names="on_off", aux_channels={"color", "level"}) claimed = rule.claim_channels([c...
[ "def", "test_match_rule_claim_channels_color", "(", "channel", ")", ":", "ch_color", "=", "channel", "(", "\"color\"", ",", "0x300", ")", "ch_level", "=", "channel", "(", "\"level\"", ",", "8", ")", "ch_onoff", "=", "channel", "(", "\"on_off\"", ",", "6", ")...
[ 215, 0 ]
[ 223, 70 ]
python
en
['it', 'en', 'en']
True
test_match_rule_claim_channels
(rule, match, channel, channels)
Test channel claiming.
Test channel claiming.
def test_match_rule_claim_channels(rule, match, channel, channels): """Test channel claiming.""" ch_basic = channel("basic", 0) channels.append(ch_basic) ch_power = channel("power", 1) channels.append(ch_power) claimed = rule.claim_channels(channels) assert match == {ch.name for ch in claim...
[ "def", "test_match_rule_claim_channels", "(", "rule", ",", "match", ",", "channel", ",", "channels", ")", ":", "ch_basic", "=", "channel", "(", "\"basic\"", ",", "0", ")", "channels", ".", "append", "(", "ch_basic", ")", "ch_power", "=", "channel", "(", "\...
[ 247, 0 ]
[ 255, 47 ]
python
en
['it', 'en', 'en']
True
entity_registry
()
Registry fixture.
Registry fixture.
def entity_registry(): """Registry fixture.""" return registries.ZHAEntityRegistry()
[ "def", "entity_registry", "(", ")", ":", "return", "registries", ".", "ZHAEntityRegistry", "(", ")" ]
[ 259, 0 ]
[ 261, 41 ]
python
en
['en', 'nl', 'en']
False
test_weighted_match
(channel, entity_registry, manufacturer, model, match_name)
Test weightedd match.
Test weightedd match.
def test_weighted_match(channel, entity_registry, manufacturer, model, match_name): """Test weightedd match.""" s = mock.sentinel @entity_registry.strict_match( s.component, channel_names="on_off", models={MODEL, "another model", "some model"}, ) class OnOffMultimodel: ...
[ "def", "test_weighted_match", "(", "channel", ",", "entity_registry", ",", "manufacturer", ",", "model", ",", "match_name", ")", ":", "s", "=", "mock", ".", "sentinel", "@", "entity_registry", ".", "strict_match", "(", "s", ".", "component", ",", "channel_name...
[ 274, 0 ]
[ 315, 33 ]
python
en
['en', 'de', 'en']
True
async_attach_trigger
(hass, config, action, automation_info)
Listen for state changes based on configuration.
Listen for state changes based on configuration.
async def async_attach_trigger(hass, config, action, automation_info): """Listen for state changes based on configuration.""" entities = {} removes = [] job = HassJob(action) @callback def time_automation_listener(description, now, *, entity_id=None): """Listen for time changes and call...
[ "async", "def", "async_attach_trigger", "(", "hass", ",", "config", ",", "action", ",", "automation_info", ")", ":", "entities", "=", "{", "}", "removes", "=", "[", "]", "job", "=", "HassJob", "(", "action", ")", "@", "callback", "def", "time_automation_li...
[ 39, 0 ]
[ 177, 36 ]
python
en
['en', 'en', 'en']
True
discovery_fixture
()
Patch the discovery service.
Patch the discovery service.
def discovery_fixture(): """Patch the discovery service.""" with patch( "homeassistant.components.gree.bridge.Discovery.search_devices", new_callable=AsyncMock, return_value=[build_device_info_mock()], ) as mock: yield mock
[ "def", "discovery_fixture", "(", ")", ":", "with", "patch", "(", "\"homeassistant.components.gree.bridge.Discovery.search_devices\"", ",", "new_callable", "=", "AsyncMock", ",", "return_value", "=", "[", "build_device_info_mock", "(", ")", "]", ",", ")", "as", "mock",...
[ 9, 0 ]
[ 16, 18 ]
python
en
['en', 'en', 'en']
True
device_fixture
()
Path the device search and bind.
Path the device search and bind.
def device_fixture(): """Path the device search and bind.""" with patch( "homeassistant.components.gree.bridge.Device", return_value=build_device_mock(), ) as mock: yield mock
[ "def", "device_fixture", "(", ")", ":", "with", "patch", "(", "\"homeassistant.components.gree.bridge.Device\"", ",", "return_value", "=", "build_device_mock", "(", ")", ",", ")", "as", "mock", ":", "yield", "mock" ]
[ 20, 0 ]
[ 26, 18 ]
python
en
['en', 'en', 'en']
True
setup_fixture
()
Patch the climate setup.
Patch the climate setup.
def setup_fixture(): """Patch the climate setup.""" with patch( "homeassistant.components.gree.climate.async_setup_entry", return_value=True ) as setup: yield setup
[ "def", "setup_fixture", "(", ")", ":", "with", "patch", "(", "\"homeassistant.components.gree.climate.async_setup_entry\"", ",", "return_value", "=", "True", ")", "as", "setup", ":", "yield", "setup" ]
[ 30, 0 ]
[ 35, 19 ]
python
en
['en', 'en', 'en']
True
generate_perf_report
(result_file_name)
Generate a performance report. The input result_file_name should be the path of the "results.csv" generated by automlbenchmark. This function outputs 1) a formatted report named "performances.txt" in the "reports/" directory located in the same parent directory as "results.csv" and 2) a report named ...
Generate a performance report. The input result_file_name should be the path of the "results.csv" generated by automlbenchmark. This function outputs 1) a formatted report named "performances.txt" in the "reports/" directory located in the same parent directory as "results.csv" and 2) a report named ...
def generate_perf_report(result_file_name): """ Generate a performance report. The input result_file_name should be the path of the "results.csv" generated by automlbenchmark. This function outputs 1) a formatted report named "performances.txt" in the "reports/" directory located in the same paren...
[ "def", "generate_perf_report", "(", "result_file_name", ")", ":", "result", "=", "pd", ".", "read_csv", "(", "result_file_name", ")", "task_ids", "=", "result", "[", "'id'", "]", ".", "unique", "(", ")", "tuners", "=", "result", "[", "'framework'", "]", "....
[ 9, 0 ]
[ 97, 25 ]
python
en
['en', 'error', 'th']
False
generate_graphs
(result_file_name)
Generate graphs describing performance statistics. The input result_file_name should be the path of the "results.csv" generated by automlbenchmark. For each task, this function outputs two graphs in the "reports/" directory located in the same parent directory as "results.csv". The graph named tas...
Generate graphs describing performance statistics. The input result_file_name should be the path of the "results.csv" generated by automlbenchmark. For each task, this function outputs two graphs in the "reports/" directory located in the same parent directory as "results.csv". The graph named tas...
def generate_graphs(result_file_name): """ Generate graphs describing performance statistics. The input result_file_name should be the path of the "results.csv" generated by automlbenchmark. For each task, this function outputs two graphs in the "reports/" directory located in the same parent direc...
[ "def", "generate_graphs", "(", "result_file_name", ")", ":", "markers", "=", "list", "(", "Line2D", ".", "markers", ".", "keys", "(", ")", ")", "result", "=", "pd", ".", "read_csv", "(", "result_file_name", ")", "scorelog_dir", "=", "result_file_name", ".", ...
[ 100, 0 ]
[ 153, 23 ]
python
en
['en', 'error', 'th']
False
test_setup_adds_proper_devices
(hass)
Test if setup adds devices.
Test if setup adds devices.
async def test_setup_adds_proper_devices(hass): """Test if setup adds devices.""" with mock.patch( "homeassistant.components.mfi.switch.MFiClient" ) as mock_client, mock.patch( "homeassistant.components.mfi.switch.MfiSwitch", side_effect=mfi.MfiSwitch ) as mock_switch: ports = { ...
[ "async", "def", "test_setup_adds_proper_devices", "(", "hass", ")", ":", "with", "mock", ".", "patch", "(", "\"homeassistant.components.mfi.switch.MFiClient\"", ")", "as", "mock_client", ",", "mock", ".", "patch", "(", "\"homeassistant.components.mfi.switch.MfiSwitch\"", ...
[ 25, 0 ]
[ 48, 74 ]
python
en
['es', 'en', 'en']
True
port_fixture
()
Port fixture.
Port fixture.
def port_fixture(): """Port fixture.""" return mock.MagicMock()
[ "def", "port_fixture", "(", ")", ":", "return", "mock", ".", "MagicMock", "(", ")" ]
[ 52, 0 ]
[ 54, 27 ]
python
en
['en', 'nl', 'en']
False
switch_fixture
(port)
Switch fixture.
Switch fixture.
def switch_fixture(port): """Switch fixture.""" return mfi.MfiSwitch(port)
[ "def", "switch_fixture", "(", "port", ")", ":", "return", "mfi", ".", "MfiSwitch", "(", "port", ")" ]
[ 58, 0 ]
[ 60, 30 ]
python
en
['en', 'sr', 'en']
False
test_name
(port, switch)
Test the name.
Test the name.
async def test_name(port, switch): """Test the name.""" assert port.label == switch.name
[ "async", "def", "test_name", "(", "port", ",", "switch", ")", ":", "assert", "port", ".", "label", "==", "switch", ".", "name" ]
[ 63, 0 ]
[ 65, 36 ]
python
en
['en', 'en', 'en']
True
test_update
(port, switch)
Test update.
Test update.
async def test_update(port, switch): """Test update.""" switch.update() assert port.refresh.call_count == 1 assert port.refresh.call_args == mock.call()
[ "async", "def", "test_update", "(", "port", ",", "switch", ")", ":", "switch", ".", "update", "(", ")", "assert", "port", ".", "refresh", ".", "call_count", "==", "1", "assert", "port", ".", "refresh", ".", "call_args", "==", "mock", ".", "call", "(", ...
[ 68, 0 ]
[ 72, 48 ]
python
en
['en', 'de', 'en']
False
test_update_with_target_state
(port, switch)
Test update with target state.
Test update with target state.
async def test_update_with_target_state(port, switch): """Test update with target state.""" # pylint: disable=protected-access switch._target_state = True port.data = {} port.data["output"] = "stale" switch.update() assert port.data["output"] == 1.0 # pylint: disable=protected-access ...
[ "async", "def", "test_update_with_target_state", "(", "port", ",", "switch", ")", ":", "# pylint: disable=protected-access", "switch", ".", "_target_state", "=", "True", "port", ".", "data", "=", "{", "}", "port", ".", "data", "[", "\"output\"", "]", "=", "\"s...
[ 75, 0 ]
[ 87, 45 ]
python
en
['en', 'en', 'en']
True
test_turn_on
(port, switch)
Test turn_on.
Test turn_on.
async def test_turn_on(port, switch): """Test turn_on.""" switch.turn_on() assert port.control.call_count == 1 assert port.control.call_args == mock.call(True) # pylint: disable=protected-access assert switch._target_state
[ "async", "def", "test_turn_on", "(", "port", ",", "switch", ")", ":", "switch", ".", "turn_on", "(", ")", "assert", "port", ".", "control", ".", "call_count", "==", "1", "assert", "port", ".", "control", ".", "call_args", "==", "mock", ".", "call", "("...
[ 90, 0 ]
[ 96, 31 ]
python
en
['en', 'et', 'en']
False
test_turn_off
(port, switch)
Test turn_off.
Test turn_off.
async def test_turn_off(port, switch): """Test turn_off.""" switch.turn_off() assert port.control.call_count == 1 assert port.control.call_args == mock.call(False) # pylint: disable=protected-access assert not switch._target_state
[ "async", "def", "test_turn_off", "(", "port", ",", "switch", ")", ":", "switch", ".", "turn_off", "(", ")", "assert", "port", ".", "control", ".", "call_count", "==", "1", "assert", "port", ".", "control", ".", "call_args", "==", "mock", ".", "call", "...
[ 99, 0 ]
[ 105, 35 ]
python
en
['en', 'cy', 'en']
False
test_current_power_w
(port, switch)
Test current power.
Test current power.
async def test_current_power_w(port, switch): """Test current power.""" port.data = {"active_pwr": 10} assert switch.current_power_w == 10
[ "async", "def", "test_current_power_w", "(", "port", ",", "switch", ")", ":", "port", ".", "data", "=", "{", "\"active_pwr\"", ":", "10", "}", "assert", "switch", ".", "current_power_w", "==", "10" ]
[ 108, 0 ]
[ 111, 39 ]
python
en
['en', 'en', 'en']
True
test_current_power_w_no_data
(port, switch)
Test current power if there is no data.
Test current power if there is no data.
async def test_current_power_w_no_data(port, switch): """Test current power if there is no data.""" port.data = {"notpower": 123} assert switch.current_power_w == 0
[ "async", "def", "test_current_power_w_no_data", "(", "port", ",", "switch", ")", ":", "port", ".", "data", "=", "{", "\"notpower\"", ":", "123", "}", "assert", "switch", ".", "current_power_w", "==", "0" ]
[ 114, 0 ]
[ 117, 38 ]
python
en
['en', 'en', 'en']
True
test_device_state_attributes
(port, switch)
Test the state attributes.
Test the state attributes.
async def test_device_state_attributes(port, switch): """Test the state attributes.""" port.data = {"v_rms": 1.25, "i_rms": 2.75} assert switch.device_state_attributes == {"volts": 1.2, "amps": 2.8}
[ "async", "def", "test_device_state_attributes", "(", "port", ",", "switch", ")", ":", "port", ".", "data", "=", "{", "\"v_rms\"", ":", "1.25", ",", "\"i_rms\"", ":", "2.75", "}", "assert", "switch", ".", "device_state_attributes", "==", "{", "\"volts\"", ":"...
[ 120, 0 ]
[ 123, 72 ]
python
en
['en', 'en', 'en']
True
test_setup
(hass, legacy_patchable_time)
Test the general setup of the integration.
Test the general setup of the integration.
async def test_setup(hass, legacy_patchable_time): """Test the general setup of the integration.""" # Set up some mock feed entries for this test. mock_entry_1 = _generate_mock_feed_entry( "1234", "Title 1", 15.5, (38.0, -3.0), attribution="Attribution 1", ) m...
[ "async", "def", "test_setup", "(", "hass", ",", "legacy_patchable_time", ")", ":", "# Set up some mock feed entries for this test.", "mock_entry_1", "=", "_generate_mock_feed_entry", "(", "\"1234\"", ",", "\"Title 1\"", ",", "15.5", ",", "(", "38.0", ",", "-", "3.0", ...
[ 27, 0 ]
[ 112, 44 ]
python
en
['en', 'en', 'en']
True
zigpy_device
(zigpy_device_mock)
Device tracker zigpy device.
Device tracker zigpy device.
def zigpy_device(zigpy_device_mock): """Device tracker zigpy device.""" endpoints = { 1: { "in_clusters": [hvac.Fan.cluster_id], "out_clusters": [], "device_type": zha.DeviceType.ON_OFF_SWITCH, } } return zigpy_device_mock(endpoints)
[ "def", "zigpy_device", "(", "zigpy_device_mock", ")", ":", "endpoints", "=", "{", "1", ":", "{", "\"in_clusters\"", ":", "[", "hvac", ".", "Fan", ".", "cluster_id", "]", ",", "\"out_clusters\"", ":", "[", "]", ",", "\"device_type\"", ":", "zha", ".", "De...
[ 42, 0 ]
[ 51, 39 ]
python
cs
['nl', 'cs', 'en']
False
coordinator
(hass, zigpy_device_mock, zha_device_joined)
Test zha fan platform.
Test zha fan platform.
async def coordinator(hass, zigpy_device_mock, zha_device_joined): """Test zha fan platform.""" zigpy_device = zigpy_device_mock( { 1: { "in_clusters": [], "out_clusters": [], "device_type": zha.DeviceType.COLOR_DIMMABLE_LIGHT, } ...
[ "async", "def", "coordinator", "(", "hass", ",", "zigpy_device_mock", ",", "zha_device_joined", ")", ":", "zigpy_device", "=", "zigpy_device_mock", "(", "{", "1", ":", "{", "\"in_clusters\"", ":", "[", "]", ",", "\"out_clusters\"", ":", "[", "]", ",", "\"dev...
[ 55, 0 ]
[ 72, 21 ]
python
cs
['cs', 'fy', 'nl']
False
device_fan_1
(hass, zigpy_device_mock, zha_device_joined)
Test zha fan platform.
Test zha fan platform.
async def device_fan_1(hass, zigpy_device_mock, zha_device_joined): """Test zha fan platform.""" zigpy_device = zigpy_device_mock( { 1: { "in_clusters": [general.OnOff.cluster_id, hvac.Fan.cluster_id], "out_clusters": [], } }, ieee...
[ "async", "def", "device_fan_1", "(", "hass", ",", "zigpy_device_mock", ",", "zha_device_joined", ")", ":", "zigpy_device", "=", "zigpy_device_mock", "(", "{", "1", ":", "{", "\"in_clusters\"", ":", "[", "general", ".", "OnOff", ".", "cluster_id", ",", "hvac", ...
[ 76, 0 ]
[ 90, 21 ]
python
cs
['cs', 'fy', 'nl']
False
device_fan_2
(hass, zigpy_device_mock, zha_device_joined)
Test zha fan platform.
Test zha fan platform.
async def device_fan_2(hass, zigpy_device_mock, zha_device_joined): """Test zha fan platform.""" zigpy_device = zigpy_device_mock( { 1: { "in_clusters": [ general.OnOff.cluster_id, hvac.Fan.cluster_id, general.Level...
[ "async", "def", "device_fan_2", "(", "hass", ",", "zigpy_device_mock", ",", "zha_device_joined", ")", ":", "zigpy_device", "=", "zigpy_device_mock", "(", "{", "1", ":", "{", "\"in_clusters\"", ":", "[", "general", ".", "OnOff", ".", "cluster_id", ",", "hvac", ...
[ 94, 0 ]
[ 112, 21 ]
python
cs
['cs', 'fy', 'nl']
False
test_fan
(hass, zha_device_joined_restored, zigpy_device)
Test zha fan platform.
Test zha fan platform.
async def test_fan(hass, zha_device_joined_restored, zigpy_device): """Test zha fan platform.""" zha_device = await zha_device_joined_restored(zigpy_device) cluster = zigpy_device.endpoints.get(1).fan entity_id = await find_entity_id(DOMAIN, zha_device, hass) assert entity_id is not None asser...
[ "async", "def", "test_fan", "(", "hass", ",", "zha_device_joined_restored", ",", "zigpy_device", ")", ":", "zha_device", "=", "await", "zha_device_joined_restored", "(", "zigpy_device", ")", "cluster", "=", "zigpy_device", ".", "endpoints", ".", "get", "(", "1", ...
[ 115, 0 ]
[ 161, 64 ]
python
cs
['cs', 'fy', 'nl']
False
async_turn_on
(hass, entity_id, speed=None)
Turn fan on.
Turn fan on.
async def async_turn_on(hass, entity_id, speed=None): """Turn fan on.""" data = { key: value for key, value in [(ATTR_ENTITY_ID, entity_id), (ATTR_SPEED, speed)] if value is not None } await hass.services.async_call(DOMAIN, SERVICE_TURN_ON, data, blocking=True)
[ "async", "def", "async_turn_on", "(", "hass", ",", "entity_id", ",", "speed", "=", "None", ")", ":", "data", "=", "{", "key", ":", "value", "for", "key", ",", "value", "in", "[", "(", "ATTR_ENTITY_ID", ",", "entity_id", ")", ",", "(", "ATTR_SPEED", "...
[ 164, 0 ]
[ 172, 80 ]
python
en
['en', 'fy', 'en']
True
async_turn_off
(hass, entity_id)
Turn fan off.
Turn fan off.
async def async_turn_off(hass, entity_id): """Turn fan off.""" data = {ATTR_ENTITY_ID: entity_id} if entity_id else {} await hass.services.async_call(DOMAIN, SERVICE_TURN_OFF, data, blocking=True)
[ "async", "def", "async_turn_off", "(", "hass", ",", "entity_id", ")", ":", "data", "=", "{", "ATTR_ENTITY_ID", ":", "entity_id", "}", "if", "entity_id", "else", "{", "}", "await", "hass", ".", "services", ".", "async_call", "(", "DOMAIN", ",", "SERVICE_TUR...
[ 175, 0 ]
[ 179, 81 ]
python
en
['en', 'fy', 'en']
True
async_set_speed
(hass, entity_id, speed=None)
Set speed for specified fan.
Set speed for specified fan.
async def async_set_speed(hass, entity_id, speed=None): """Set speed for specified fan.""" data = { key: value for key, value in [(ATTR_ENTITY_ID, entity_id), (ATTR_SPEED, speed)] if value is not None } await hass.services.async_call(DOMAIN, SERVICE_SET_SPEED, data, blocking=Tru...
[ "async", "def", "async_set_speed", "(", "hass", ",", "entity_id", ",", "speed", "=", "None", ")", ":", "data", "=", "{", "key", ":", "value", "for", "key", ",", "value", "in", "[", "(", "ATTR_ENTITY_ID", ",", "entity_id", ")", ",", "(", "ATTR_SPEED", ...
[ 182, 0 ]
[ 190, 82 ]
python
en
['en', 'fy', 'en']
True
async_test_zha_group_fan_entity
( hass, device_fan_1, device_fan_2, coordinator )
Test the fan entity for a ZHA group.
Test the fan entity for a ZHA group.
async def async_test_zha_group_fan_entity( hass, device_fan_1, device_fan_2, coordinator ): """Test the fan entity for a ZHA group.""" zha_gateway = get_zha_gateway(hass) assert zha_gateway is not None zha_gateway.coordinator_zha_device = coordinator coordinator._zha_gateway = zha_gateway de...
[ "async", "def", "async_test_zha_group_fan_entity", "(", "hass", ",", "device_fan_1", ",", "device_fan_2", ",", "coordinator", ")", ":", "zha_gateway", "=", "get_zha_gateway", "(", "hass", ")", "assert", "zha_gateway", "is", "not", "None", "zha_gateway", ".", "coor...
[ 193, 0 ]
[ 274, 56 ]
python
en
['en', 'en', 'en']
True
EncoderDecoderConfig.from_encoder_decoder_configs
( cls, encoder_config: PretrainedConfig, decoder_config: PretrainedConfig, **kwargs )
r""" Instantiate a :class:`~transformers.EncoderDecoderConfig` (or a derived class) from a pre-trained encoder model configuration and decoder model configuration. Returns: :class:`EncoderDecoderConfig`: An instance of a configuration object
r""" Instantiate a :class:`~transformers.EncoderDecoderConfig` (or a derived class) from a pre-trained encoder model configuration and decoder model configuration.
def from_encoder_decoder_configs( cls, encoder_config: PretrainedConfig, decoder_config: PretrainedConfig, **kwargs ) -> PretrainedConfig: r""" Instantiate a :class:`~transformers.EncoderDecoderConfig` (or a derived class) from a pre-trained encoder model configuration and decoder mo...
[ "def", "from_encoder_decoder_configs", "(", "cls", ",", "encoder_config", ":", "PretrainedConfig", ",", "decoder_config", ":", "PretrainedConfig", ",", "*", "*", "kwargs", ")", "->", "PretrainedConfig", ":", "logger", ".", "info", "(", "\"Set `config.is_decoder=True` ...
[ 90, 4 ]
[ 104, 96 ]
python
cy
['en', 'cy', 'hi']
False
EncoderDecoderConfig.to_dict
(self)
Serializes this instance to a Python dictionary. Override the default `to_dict()` from `PretrainedConfig`. Returns: :obj:`Dict[str, any]`: Dictionary of all the attributes that make up this configuration instance,
Serializes this instance to a Python dictionary. Override the default `to_dict()` from `PretrainedConfig`.
def to_dict(self): """ Serializes this instance to a Python dictionary. Override the default `to_dict()` from `PretrainedConfig`. Returns: :obj:`Dict[str, any]`: Dictionary of all the attributes that make up this configuration instance, """ output = copy.deepcopy(sel...
[ "def", "to_dict", "(", "self", ")", ":", "output", "=", "copy", ".", "deepcopy", "(", "self", ".", "__dict__", ")", "output", "[", "\"encoder\"", "]", "=", "self", ".", "encoder", ".", "to_dict", "(", ")", "output", "[", "\"decoder\"", "]", "=", "sel...
[ 106, 4 ]
[ 117, 21 ]
python
en
['en', 'error', 'th']
False
setup_platform
(hass, config, add_entities, discovery_info=None)
Set up the Egardia Alarm Control Panael platform.
Set up the Egardia Alarm Control Panael platform.
def setup_platform(hass, config, add_entities, discovery_info=None): """Set up the Egardia Alarm Control Panael platform.""" if discovery_info is None: return device = EgardiaAlarm( discovery_info["name"], hass.data[EGARDIA_DEVICE], discovery_info[CONF_REPORT_SERVER_ENABLED],...
[ "def", "setup_platform", "(", "hass", ",", "config", ",", "add_entities", ",", "discovery_info", "=", "None", ")", ":", "if", "discovery_info", "is", "None", ":", "return", "device", "=", "EgardiaAlarm", "(", "discovery_info", "[", "\"name\"", "]", ",", "has...
[ 40, 0 ]
[ 52, 32 ]
python
en
['en', 'su', 'en']
True
EgardiaAlarm.__init__
( self, name, egardiasystem, rs_enabled=False, rs_codes=None, rs_port=52010 )
Initialize the Egardia alarm.
Initialize the Egardia alarm.
def __init__( self, name, egardiasystem, rs_enabled=False, rs_codes=None, rs_port=52010 ): """Initialize the Egardia alarm.""" self._name = name self._egardiasystem = egardiasystem self._status = None self._rs_enabled = rs_enabled self._rs_codes = rs_codes ...
[ "def", "__init__", "(", "self", ",", "name", ",", "egardiasystem", ",", "rs_enabled", "=", "False", ",", "rs_codes", "=", "None", ",", "rs_port", "=", "52010", ")", ":", "self", ".", "_name", "=", "name", "self", ".", "_egardiasystem", "=", "egardiasyste...
[ 58, 4 ]
[ 67, 31 ]
python
en
['en', 'la', 'en']
True
EgardiaAlarm.async_added_to_hass
(self)
Add Egardiaserver callback if enabled.
Add Egardiaserver callback if enabled.
async def async_added_to_hass(self): """Add Egardiaserver callback if enabled.""" if self._rs_enabled: _LOGGER.debug("Registering callback to Egardiaserver") self.hass.data[EGARDIA_SERVER].register_callback(self.handle_status_event)
[ "async", "def", "async_added_to_hass", "(", "self", ")", ":", "if", "self", ".", "_rs_enabled", ":", "_LOGGER", ".", "debug", "(", "\"Registering callback to Egardiaserver\"", ")", "self", ".", "hass", ".", "data", "[", "EGARDIA_SERVER", "]", ".", "register_call...
[ 69, 4 ]
[ 73, 86 ]
python
en
['en', 'zu', 'en']
True
EgardiaAlarm.name
(self)
Return the name of the device.
Return the name of the device.
def name(self): """Return the name of the device.""" return self._name
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "_name" ]
[ 76, 4 ]
[ 78, 25 ]
python
en
['en', 'en', 'en']
True
EgardiaAlarm.state
(self)
Return the state of the device.
Return the state of the device.
def state(self): """Return the state of the device.""" return self._status
[ "def", "state", "(", "self", ")", ":", "return", "self", ".", "_status" ]
[ 81, 4 ]
[ 83, 27 ]
python
en
['en', 'en', 'en']
True
EgardiaAlarm.supported_features
(self)
Return the list of supported features.
Return the list of supported features.
def supported_features(self) -> int: """Return the list of supported features.""" return SUPPORT_ALARM_ARM_HOME | SUPPORT_ALARM_ARM_AWAY
[ "def", "supported_features", "(", "self", ")", "->", "int", ":", "return", "SUPPORT_ALARM_ARM_HOME", "|", "SUPPORT_ALARM_ARM_AWAY" ]
[ 86, 4 ]
[ 88, 62 ]
python
en
['en', 'en', 'en']
True
EgardiaAlarm.should_poll
(self)
Poll if no report server is enabled.
Poll if no report server is enabled.
def should_poll(self): """Poll if no report server is enabled.""" if not self._rs_enabled: return True return False
[ "def", "should_poll", "(", "self", ")", ":", "if", "not", "self", ".", "_rs_enabled", ":", "return", "True", "return", "False" ]
[ 91, 4 ]
[ 95, 20 ]
python
en
['en', 'en', 'en']
True
EgardiaAlarm.handle_status_event
(self, event)
Handle the Egardia system status event.
Handle the Egardia system status event.
def handle_status_event(self, event): """Handle the Egardia system status event.""" statuscode = event.get("status") if statuscode is not None: status = self.lookupstatusfromcode(statuscode) self.parsestatus(status) self.schedule_update_ha_state()
[ "def", "handle_status_event", "(", "self", ",", "event", ")", ":", "statuscode", "=", "event", ".", "get", "(", "\"status\"", ")", "if", "statuscode", "is", "not", "None", ":", "status", "=", "self", ".", "lookupstatusfromcode", "(", "statuscode", ")", "se...
[ 97, 4 ]
[ 103, 43 ]
python
en
['en', 'la', 'en']
True