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
BuildNameTest.test_manual
(self)
Respect user-selected build.
Respect user-selected build.
def test_manual(self): """Respect user-selected build.""" with Stub(os, 'environ', fake_environment()) as fake: truth = 'erick is awesome' fake[bootstrap.BUILD_ENV] = truth self.assertEqual(truth, fake[bootstrap.BUILD_ENV])
[ "def", "test_manual", "(", "self", ")", ":", "with", "Stub", "(", "os", ",", "'environ'", ",", "fake_environment", "(", ")", ")", "as", "fake", ":", "truth", "=", "'erick is awesome'", "fake", "[", "bootstrap", ".", "BUILD_ENV", "]", "=", "truth", "self"...
[ 847, 4 ]
[ 852, 62 ]
python
en
['en', 'en', 'en']
True
BuildNameTest.test_unique
(self)
New build every minute.
New build every minute.
def test_unique(self): """New build every minute.""" with Stub(os, 'environ', fake_environment()) as fake: bootstrap.build_name(SECONDS) first = fake[bootstrap.BUILD_ENV] del fake[bootstrap.BUILD_ENV] bootstrap.build_name(SECONDS + 60) self.ass...
[ "def", "test_unique", "(", "self", ")", ":", "with", "Stub", "(", "os", ",", "'environ'", ",", "fake_environment", "(", ")", ")", "as", "fake", ":", "bootstrap", ".", "build_name", "(", "SECONDS", ")", "first", "=", "fake", "[", "bootstrap", ".", "BUIL...
[ 854, 4 ]
[ 861, 65 ]
python
en
['en', 'en', 'en']
True
SetupCredentialsTest.test_norobot_noupload_noenv
(self)
Can avoid setting up credentials.
Can avoid setting up credentials.
def test_norobot_noupload_noenv(self): """Can avoid setting up credentials.""" del self.env[bootstrap.SERVICE_ACCOUNT_ENV] with Stub(os, 'environ', self.env): bootstrap.setup_credentials(Bomb, None, None)
[ "def", "test_norobot_noupload_noenv", "(", "self", ")", ":", "del", "self", ".", "env", "[", "bootstrap", ".", "SERVICE_ACCOUNT_ENV", "]", "with", "Stub", "(", "os", ",", "'environ'", ",", "self", ".", "env", ")", ":", "bootstrap", ".", "setup_credentials", ...
[ 874, 4 ]
[ 878, 57 ]
python
en
['en', 'en', 'en']
True
SetupCredentialsTest.test_application_credentials
(self)
Raise if GOOGLE_APPLICATION_CREDENTIALS does not exist.
Raise if GOOGLE_APPLICATION_CREDENTIALS does not exist.
def test_application_credentials(self): """Raise if GOOGLE_APPLICATION_CREDENTIALS does not exist.""" del self.env[bootstrap.SERVICE_ACCOUNT_ENV] with Stub(os, 'environ', self.env) as fake: gac = 'FAKE_CREDS.json' fake['HOME'] = 'kansas' with Stub(os.path, 'is...
[ "def", "test_application_credentials", "(", "self", ")", ":", "del", "self", ".", "env", "[", "bootstrap", ".", "SERVICE_ACCOUNT_ENV", "]", "with", "Stub", "(", "os", ",", "'environ'", ",", "self", ".", "env", ")", "as", "fake", ":", "gac", "=", "'FAKE_C...
[ 887, 4 ]
[ 906, 67 ]
python
en
['en', 'en', 'en']
True
SetupMagicEnvironmentTest.test_home_workspace_on_jenkins
(self)
WORKSPACE/HOME are set correctly for the Jenkins environment.
WORKSPACE/HOME are set correctly for the Jenkins environment.
def test_home_workspace_on_jenkins(self): """WORKSPACE/HOME are set correctly for the Jenkins environment.""" env = fake_environment(set_jenkins_home=True, set_workspace=True) cwd = '/fake/random-location' old_home = env[bootstrap.HOME_ENV] old_workspace = env[bootstrap.WORKSPACE...
[ "def", "test_home_workspace_on_jenkins", "(", "self", ")", ":", "env", "=", "fake_environment", "(", "set_jenkins_home", "=", "True", ",", "set_workspace", "=", "True", ")", "cwd", "=", "'/fake/random-location'", "old_home", "=", "env", "[", "bootstrap", ".", "H...
[ 910, 4 ]
[ 926, 62 ]
python
en
['en', 'en', 'en']
True
SetupMagicEnvironmentTest.test_home_workspace_in_k8s
(self)
WORKSPACE/HOME are set correctly for the kubernetes environment.
WORKSPACE/HOME are set correctly for the kubernetes environment.
def test_home_workspace_in_k8s(self): """WORKSPACE/HOME are set correctly for the kubernetes environment.""" env = fake_environment(set_jenkins_home=False, set_workspace=True) cwd = '/fake/random-location' old_home = env[bootstrap.HOME_ENV] old_workspace = env[bootstrap.WORKSPACE...
[ "def", "test_home_workspace_in_k8s", "(", "self", ")", ":", "env", "=", "fake_environment", "(", "set_jenkins_home", "=", "False", ",", "set_workspace", "=", "True", ")", "cwd", "=", "'/fake/random-location'", "old_home", "=", "env", "[", "bootstrap", ".", "HOME...
[ 928, 4 ]
[ 944, 62 ]
python
en
['en', 'en', 'en']
True
SetupMagicEnvironmentTest.test_workspace_always_set
(self)
WORKSPACE is set to cwd when unset in initial environment.
WORKSPACE is set to cwd when unset in initial environment.
def test_workspace_always_set(self): """WORKSPACE is set to cwd when unset in initial environment.""" env = fake_environment(set_workspace=False) cwd = '/fake/random-location' with Stub(os, 'environ', env): with Stub(os, 'getcwd', lambda: cwd): bootstrap.setup...
[ "def", "test_workspace_always_set", "(", "self", ")", ":", "env", "=", "fake_environment", "(", "set_workspace", "=", "False", ")", "cwd", "=", "'/fake/random-location'", "with", "Stub", "(", "os", ",", "'environ'", ",", "env", ")", ":", "with", "Stub", "(",...
[ 946, 4 ]
[ 956, 59 ]
python
en
['en', 'en', 'en']
True
PRPathsTest.test_kubernetes_kubernetes
(self)
Test the kubernetes/kubernetes prefix.
Test the kubernetes/kubernetes prefix.
def test_kubernetes_kubernetes(self): """Test the kubernetes/kubernetes prefix.""" path = bootstrap.pr_paths(UPLOAD, repo({'kubernetes/kubernetes': ('', PULL)}), JOB, BUILD) self.assertTrue(any( str(PULL) == p for p in path.build_log.split('/')))
[ "def", "test_kubernetes_kubernetes", "(", "self", ")", ":", "path", "=", "bootstrap", ".", "pr_paths", "(", "UPLOAD", ",", "repo", "(", "{", "'kubernetes/kubernetes'", ":", "(", "''", ",", "PULL", ")", "}", ")", ",", "JOB", ",", "BUILD", ")", "self", "...
[ 1050, 4 ]
[ 1054, 63 ]
python
en
['en', 'zu', 'it']
False
PRPathsTest.test_kubernetes
(self)
Test the kubernetes/something prefix.
Test the kubernetes/something prefix.
def test_kubernetes(self): """Test the kubernetes/something prefix.""" path = bootstrap.pr_paths(UPLOAD, repo({'kubernetes/prefix': ('', PULL)}), JOB, BUILD) self.assertTrue(any( 'prefix' in p for p in path.build_log.split('/')), path.build_log) self.assertTrue(any( ...
[ "def", "test_kubernetes", "(", "self", ")", ":", "path", "=", "bootstrap", ".", "pr_paths", "(", "UPLOAD", ",", "repo", "(", "{", "'kubernetes/prefix'", ":", "(", "''", ",", "PULL", ")", "}", ")", ",", "JOB", ",", "BUILD", ")", "self", ".", "assertTr...
[ 1056, 4 ]
[ 1062, 79 ]
python
en
['en', 'zu', 'en']
True
PRPathsTest.test_other
(self)
Test the none kubernetes prefixes.
Test the none kubernetes prefixes.
def test_other(self): """Test the none kubernetes prefixes.""" path = bootstrap.pr_paths(UPLOAD, repo({'github.com/random/repo': ('', PULL)}), JOB, BUILD) self.assertTrue(any( 'random_repo' in p for p in path.build_log.split('/')), path.build_log) self.assertTrue(any( ...
[ "def", "test_other", "(", "self", ")", ":", "path", "=", "bootstrap", ".", "pr_paths", "(", "UPLOAD", ",", "repo", "(", "{", "'github.com/random/repo'", ":", "(", "''", ",", "PULL", ")", "}", ")", ",", "JOB", ",", "BUILD", ")", "self", ".", "assertTr...
[ 1064, 4 ]
[ 1070, 79 ]
python
en
['en', 'en', 'it']
True
BootstrapTest.test_setcreds_setroot_fails
(self)
We should still call setup_credentials even if setup_root blows up.
We should still call setup_credentials even if setup_root blows up.
def test_setcreds_setroot_fails(self): """We should still call setup_credentials even if setup_root blows up.""" called = set() with Stub(bootstrap, 'setup_root', Bomb): with Stub(bootstrap, 'setup_credentials', lambda *a, **kw: called.add('setup_credentials')):...
[ "def", "test_setcreds_setroot_fails", "(", "self", ")", ":", "called", "=", "set", "(", ")", "with", "Stub", "(", "bootstrap", ",", "'setup_root'", ",", "Bomb", ")", ":", "with", "Stub", "(", "bootstrap", ",", "'setup_credentials'", ",", "lambda", "*", "a"...
[ 1137, 4 ]
[ 1148, 41 ]
python
en
['en', 'en', 'en']
True
BootstrapTest.test_pr_paths
(self)
Use a pr_paths when pull is set.
Use a pr_paths when pull is set.
def test_pr_paths(self): """Use a pr_paths when pull is set.""" with Stub(bootstrap, 'ci_paths', Bomb): with Stub(bootstrap, 'pr_paths', FakePath()) as path: test_bootstrap(branch=None, pull=PULL, root='.') self.assertEqual(PULL, path.arg[1][REPO][1], (PULL, path...
[ "def", "test_pr_paths", "(", "self", ")", ":", "with", "Stub", "(", "bootstrap", ",", "'ci_paths'", ",", "Bomb", ")", ":", "with", "Stub", "(", "bootstrap", ",", "'pr_paths'", ",", "FakePath", "(", ")", ")", "as", "path", ":", "test_bootstrap", "(", "b...
[ 1172, 4 ]
[ 1178, 74 ]
python
en
['en', 'en', 'en']
True
BootstrapTest.test_ci_paths
(self)
Use a ci_paths when branch is set.
Use a ci_paths when branch is set.
def test_ci_paths(self): """Use a ci_paths when branch is set.""" with Stub(bootstrap, 'pr_paths', Bomb): with Stub(bootstrap, 'ci_paths', FakePath()) as path: test_bootstrap(pull=None, branch=BRANCH) self.assertFalse(any( PULL in o for o in (path...
[ "def", "test_ci_paths", "(", "self", ")", ":", "with", "Stub", "(", "bootstrap", ",", "'pr_paths'", ",", "Bomb", ")", ":", "with", "Stub", "(", "bootstrap", ",", "'ci_paths'", ",", "FakePath", "(", ")", ")", "as", "path", ":", "test_bootstrap", "(", "p...
[ 1180, 4 ]
[ 1187, 56 ]
python
en
['en', 'en', 'en']
True
BootstrapTest.test_finish_when_start_fails
(self)
Finish is called even if start fails.
Finish is called even if start fails.
def test_finish_when_start_fails(self): """Finish is called even if start fails.""" with Stub(bootstrap, 'finish', FakeFinish()) as fake: with Stub(bootstrap, 'start', Bomb): with self.assertRaises(AssertionError): test_bootstrap(pull=None) self.as...
[ "def", "test_finish_when_start_fails", "(", "self", ")", ":", "with", "Stub", "(", "bootstrap", ",", "'finish'", ",", "FakeFinish", "(", ")", ")", "as", "fake", ":", "with", "Stub", "(", "bootstrap", ",", "'start'", ",", "Bomb", ")", ":", "with", "self",...
[ 1189, 4 ]
[ 1196, 45 ]
python
en
['en', 'en', 'en']
True
BootstrapTest.test_finish_when_build_fails
(self)
Finish is called even if the build fails.
Finish is called even if the build fails.
def test_finish_when_build_fails(self): """Finish is called even if the build fails.""" def call_error(*_a, **_kw): raise subprocess.CalledProcessError(1, [], '') with Stub(bootstrap, 'finish', FakeFinish()) as fake: with Stub(bootstrap, '_call', call_error): ...
[ "def", "test_finish_when_build_fails", "(", "self", ")", ":", "def", "call_error", "(", "*", "_a", ",", "*", "*", "_kw", ")", ":", "raise", "subprocess", ".", "CalledProcessError", "(", "1", ",", "[", "]", ",", "''", ")", "with", "Stub", "(", "bootstra...
[ 1198, 4 ]
[ 1207, 45 ]
python
en
['en', 'en', 'en']
True
BootstrapTest.test_job_env
(self)
bootstrap sets JOB_NAME.
bootstrap sets JOB_NAME.
def test_job_env(self): """bootstrap sets JOB_NAME.""" with Stub(os, 'environ', fake_environment()) as env: test_bootstrap(pull=None) self.assertIn(bootstrap.JOB_ENV, env)
[ "def", "test_job_env", "(", "self", ")", ":", "with", "Stub", "(", "os", ",", "'environ'", ",", "fake_environment", "(", ")", ")", "as", "env", ":", "test_bootstrap", "(", "pull", "=", "None", ")", "self", ".", "assertIn", "(", "bootstrap", ".", "JOB_E...
[ 1215, 4 ]
[ 1219, 45 ]
python
en
['en', 'st', 'en']
True
IntegrationTest.test_branch_ref
(self)
Make sure we check out a specific commit.
Make sure we check out a specific commit.
def test_branch_ref(self): """Make sure we check out a specific commit.""" subprocess.check_call(['git', 'checkout', '-b', self.BRANCH]) subprocess.check_call(['git', 'rm', self.MASTER]) subprocess.check_call(['touch', self.BRANCH_FILE]) subprocess.check_call(['git', 'add', self....
[ "def", "test_branch_ref", "(", "self", ")", ":", "subprocess", ".", "check_call", "(", "[", "'git'", ",", "'checkout'", ",", "'-b'", ",", "self", ".", "BRANCH", "]", ")", "subprocess", ".", "check_call", "(", "[", "'git'", ",", "'rm'", ",", "self", "."...
[ 1361, 4 ]
[ 1402, 41 ]
python
en
['en', 'en', 'en']
True
_process_conns
()
Main loop which processes connected sockets.
Main loop which processes connected sockets.
def _process_conns(): """Main loop which processes connected sockets.""" while not world.shutting_down.is_set(): for socketkey, mask in selector.select(timeout=SELECT_TIMEOUT): irc = socketkey.data try: if mask & selectors.EVENT_READ and not irc._aborted.is_set()...
[ "def", "_process_conns", "(", ")", ":", "while", "not", "world", ".", "shutting_down", ".", "is_set", "(", ")", ":", "for", "socketkey", ",", "mask", "in", "selector", ".", "select", "(", "timeout", "=", "SELECT_TIMEOUT", ")", ":", "irc", "=", "socketkey...
[ 18, 0 ]
[ 29, 24 ]
python
en
['en', 'en', 'en']
True
register
(irc)
Registers a network to the global selectors instance.
Registers a network to the global selectors instance.
def register(irc): """ Registers a network to the global selectors instance. """ log.debug('selectdriver: registering %s for network %s', irc._socket, irc.name) selector.register(irc._socket, selectors.EVENT_READ, data=irc)
[ "def", "register", "(", "irc", ")", ":", "log", ".", "debug", "(", "'selectdriver: registering %s for network %s'", ",", "irc", ".", "_socket", ",", "irc", ".", "name", ")", "selector", ".", "register", "(", "irc", ".", "_socket", ",", "selectors", ".", "E...
[ 31, 0 ]
[ 36, 66 ]
python
en
['en', 'error', 'th']
False
unregister
(irc)
Removes a network from the global selectors instance.
Removes a network from the global selectors instance.
def unregister(irc): """ Removes a network from the global selectors instance. """ if irc._socket.fileno() != -1: log.debug('selectdriver: de-registering %s for network %s', irc._socket, irc.name) selector.unregister(irc._socket) else: log.debug('selectdriver: skipping de-reg...
[ "def", "unregister", "(", "irc", ")", ":", "if", "irc", ".", "_socket", ".", "fileno", "(", ")", "!=", "-", "1", ":", "log", ".", "debug", "(", "'selectdriver: de-registering %s for network %s'", ",", "irc", ".", "_socket", ",", "irc", ".", "name", ")", ...
[ 38, 0 ]
[ 46, 99 ]
python
en
['en', 'error', 'th']
False
start
()
Starts a thread to process connections.
Starts a thread to process connections.
def start(): """ Starts a thread to process connections. """ t = threading.Thread(target=_process_conns, name="Selector driver loop") t.start()
[ "def", "start", "(", ")", ":", "t", "=", "threading", ".", "Thread", "(", "target", "=", "_process_conns", ",", "name", "=", "\"Selector driver loop\"", ")", "t", ".", "start", "(", ")" ]
[ 48, 0 ]
[ 53, 13 ]
python
en
['en', 'error', 'th']
False
test_default_setup
(hass, monkeypatch)
Test all basic functionality of the rflink switch component.
Test all basic functionality of the rflink switch component.
async def test_default_setup(hass, monkeypatch): """Test all basic functionality of the rflink switch component.""" # setup mocking rflink module event_callback, create, protocol, _ = await mock_rflink( hass, CONFIG, DOMAIN, monkeypatch ) # make sure arguments are passed assert create.c...
[ "async", "def", "test_default_setup", "(", "hass", ",", "monkeypatch", ")", ":", "# setup mocking rflink module", "event_callback", ",", "create", ",", "protocol", ",", "_", "=", "await", "mock_rflink", "(", "hass", ",", "CONFIG", ",", "DOMAIN", ",", "monkeypatc...
[ 34, 0 ]
[ 91, 68 ]
python
en
['en', 'en', 'en']
True
test_group_alias
(hass, monkeypatch)
Group aliases should only respond to group commands (allon/alloff).
Group aliases should only respond to group commands (allon/alloff).
async def test_group_alias(hass, monkeypatch): """Group aliases should only respond to group commands (allon/alloff).""" config = { "rflink": {"port": "/dev/ttyABC0"}, DOMAIN: { "platform": "rflink", "devices": { "protocol_0_0": {"name": "test", "group_ali...
[ "async", "def", "test_group_alias", "(", "hass", ",", "monkeypatch", ")", ":", "config", "=", "{", "\"rflink\"", ":", "{", "\"port\"", ":", "\"/dev/ttyABC0\"", "}", ",", "DOMAIN", ":", "{", "\"platform\"", ":", "\"rflink\"", ",", "\"devices\"", ":", "{", "...
[ 94, 0 ]
[ 121, 58 ]
python
en
['en', 'en', 'en']
True
test_nogroup_alias
(hass, monkeypatch)
Non group aliases should not respond to group commands.
Non group aliases should not respond to group commands.
async def test_nogroup_alias(hass, monkeypatch): """Non group aliases should not respond to group commands.""" config = { "rflink": {"port": "/dev/ttyABC0"}, DOMAIN: { "platform": "rflink", "devices": { "protocol_0_0": { "name": "test",...
[ "async", "def", "test_nogroup_alias", "(", "hass", ",", "monkeypatch", ")", ":", "config", "=", "{", "\"rflink\"", ":", "{", "\"port\"", ":", "\"/dev/ttyABC0\"", "}", ",", "DOMAIN", ":", "{", "\"platform\"", ":", "\"rflink\"", ",", "\"devices\"", ":", "{", ...
[ 124, 0 ]
[ 154, 58 ]
python
en
['en', 'en', 'en']
True
test_nogroup_device_id
(hass, monkeypatch)
Device id that do not respond to group commands (allon/alloff).
Device id that do not respond to group commands (allon/alloff).
async def test_nogroup_device_id(hass, monkeypatch): """Device id that do not respond to group commands (allon/alloff).""" config = { "rflink": {"port": "/dev/ttyABC0"}, DOMAIN: { "platform": "rflink", "devices": {"test_nogroup_0_0": {"name": "test", "group": False}}, ...
[ "async", "def", "test_nogroup_device_id", "(", "hass", ",", "monkeypatch", ")", ":", "config", "=", "{", "\"rflink\"", ":", "{", "\"port\"", ":", "\"/dev/ttyABC0\"", "}", ",", "DOMAIN", ":", "{", "\"platform\"", ":", "\"rflink\"", ",", "\"devices\"", ":", "{...
[ 157, 0 ]
[ 182, 58 ]
python
en
['en', 'en', 'en']
True
test_device_defaults
(hass, monkeypatch)
Event should fire if device_defaults config says so.
Event should fire if device_defaults config says so.
async def test_device_defaults(hass, monkeypatch): """Event should fire if device_defaults config says so.""" config = { "rflink": {"port": "/dev/ttyABC0"}, DOMAIN: { "platform": "rflink", "device_defaults": {"fire_event": True}, "devices": { "...
[ "async", "def", "test_device_defaults", "(", "hass", ",", "monkeypatch", ")", ":", "config", "=", "{", "\"rflink\"", ":", "{", "\"port\"", ":", "\"/dev/ttyABC0\"", "}", ",", "DOMAIN", ":", "{", "\"platform\"", ":", "\"rflink\"", ",", "\"device_defaults\"", ":"...
[ 185, 0 ]
[ 214, 75 ]
python
en
['en', 'en', 'en']
True
test_not_firing_default
(hass, monkeypatch)
By default no bus events should be fired.
By default no bus events should be fired.
async def test_not_firing_default(hass, monkeypatch): """By default no bus events should be fired.""" config = { "rflink": {"port": "/dev/ttyABC0"}, DOMAIN: { "platform": "rflink", "devices": { "protocol_0_0": {"name": "test", "aliases": ["test_alias_0_0"]...
[ "async", "def", "test_not_firing_default", "(", "hass", ",", "monkeypatch", ")", ":", "config", "=", "{", "\"rflink\"", ":", "{", "\"port\"", ":", "\"/dev/ttyABC0\"", "}", ",", "DOMAIN", ":", "{", "\"platform\"", ":", "\"rflink\"", ",", "\"devices\"", ":", "...
[ 217, 0 ]
[ 244, 47 ]
python
en
['en', 'en', 'en']
True
test_restore_state
(hass, monkeypatch)
Ensure states are restored on startup.
Ensure states are restored on startup.
async def test_restore_state(hass, monkeypatch): """Ensure states are restored on startup.""" config = { "rflink": {"port": "/dev/ttyABC0"}, DOMAIN: { "platform": "rflink", "devices": { "test": {"name": "s1", "aliases": ["test_alias_0_0"]}, ...
[ "async", "def", "test_restore_state", "(", "hass", ",", "monkeypatch", ")", ":", "config", "=", "{", "\"rflink\"", ":", "{", "\"port\"", ":", "\"/dev/ttyABC0\"", "}", ",", "DOMAIN", ":", "{", "\"platform\"", ":", "\"rflink\"", ",", "\"devices\"", ":", "{", ...
[ 247, 0 ]
[ 282, 44 ]
python
en
['en', 'en', 'en']
True
TestMixedPropertiesAndAdditionalPropertiesClass.make_instance
(self, include_optional)
Test MixedPropertiesAndAdditionalPropertiesClass include_option is a boolean, when False only required params are included, when True both required and optional params are included
Test MixedPropertiesAndAdditionalPropertiesClass include_option is a boolean, when False only required params are included, when True both required and optional params are included
def make_instance(self, include_optional): """Test MixedPropertiesAndAdditionalPropertiesClass include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # model = petstore_api.models.mixed_p...
[ "def", "make_instance", "(", "self", ",", "include_optional", ")", ":", "# model = petstore_api.models.mixed_properties_and_additional_properties_class.MixedPropertiesAndAdditionalPropertiesClass() # noqa: E501", "if", "include_optional", ":", "return", "MixedPropertiesAndAdditionalProper...
[ 30, 4 ]
[ 48, 9 ]
python
en
['en', 'lb', 'en']
False
TestMixedPropertiesAndAdditionalPropertiesClass.testMixedPropertiesAndAdditionalPropertiesClass
(self)
Test MixedPropertiesAndAdditionalPropertiesClass
Test MixedPropertiesAndAdditionalPropertiesClass
def testMixedPropertiesAndAdditionalPropertiesClass(self): """Test MixedPropertiesAndAdditionalPropertiesClass""" inst_req_only = self.make_instance(include_optional=False) inst_req_and_optional = self.make_instance(include_optional=True)
[ "def", "testMixedPropertiesAndAdditionalPropertiesClass", "(", "self", ")", ":", "inst_req_only", "=", "self", ".", "make_instance", "(", "include_optional", "=", "False", ")", "inst_req_and_optional", "=", "self", ".", "make_instance", "(", "include_optional", "=", "...
[ 50, 4 ]
[ 53, 73 ]
python
en
['en', 'lb', 'en']
False
async_setup_entry
( hass: HomeAssistant, entry: ConfigEntry, async_add_entities )
Set up FireServiceRota binary sensor based on a config entry.
Set up FireServiceRota binary sensor based on a config entry.
async def async_setup_entry( hass: HomeAssistant, entry: ConfigEntry, async_add_entities ) -> None: """Set up FireServiceRota binary sensor based on a config entry.""" client = hass.data[FIRESERVICEROTA_DOMAIN][entry.entry_id][DATA_CLIENT] coordinator: DataUpdateCoordinator = hass.data[FIRESERVICEROTA...
[ "async", "def", "async_setup_entry", "(", "hass", ":", "HomeAssistant", ",", "entry", ":", "ConfigEntry", ",", "async_add_entities", ")", "->", "None", ":", "client", "=", "hass", ".", "data", "[", "FIRESERVICEROTA_DOMAIN", "]", "[", "entry", ".", "entry_id", ...
[ 12, 0 ]
[ 23, 74 ]
python
en
['en', 'da', 'en']
True
ResponseBinarySensor.__init__
(self, coordinator: DataUpdateCoordinator, client, entry)
Initialize.
Initialize.
def __init__(self, coordinator: DataUpdateCoordinator, client, entry): """Initialize.""" super().__init__(coordinator) self._client = client self._unique_id = f"{entry.unique_id}_Duty" self._state = None
[ "def", "__init__", "(", "self", ",", "coordinator", ":", "DataUpdateCoordinator", ",", "client", ",", "entry", ")", ":", "super", "(", ")", ".", "__init__", "(", "coordinator", ")", "self", ".", "_client", "=", "client", "self", ".", "_unique_id", "=", "...
[ 29, 4 ]
[ 35, 26 ]
python
en
['en', 'en', 'it']
False
ResponseBinarySensor.name
(self)
Return the name of the sensor.
Return the name of the sensor.
def name(self) -> str: """Return the name of the sensor.""" return "Duty"
[ "def", "name", "(", "self", ")", "->", "str", ":", "return", "\"Duty\"" ]
[ 38, 4 ]
[ 40, 21 ]
python
en
['en', 'mi', 'en']
True
ResponseBinarySensor.icon
(self)
Return the icon to use in the frontend.
Return the icon to use in the frontend.
def icon(self) -> str: """Return the icon to use in the frontend.""" if self._state: return "mdi:calendar-check" return "mdi:calendar-remove"
[ "def", "icon", "(", "self", ")", "->", "str", ":", "if", "self", ".", "_state", ":", "return", "\"mdi:calendar-check\"", "return", "\"mdi:calendar-remove\"" ]
[ 43, 4 ]
[ 48, 36 ]
python
en
['en', 'en', 'en']
True
ResponseBinarySensor.unique_id
(self)
Return the unique ID for this binary sensor.
Return the unique ID for this binary sensor.
def unique_id(self) -> str: """Return the unique ID for this binary sensor.""" return self._unique_id
[ "def", "unique_id", "(", "self", ")", "->", "str", ":", "return", "self", ".", "_unique_id" ]
[ 51, 4 ]
[ 53, 30 ]
python
en
['en', 'en', 'en']
True
ResponseBinarySensor.is_on
(self)
Return the state of the binary sensor.
Return the state of the binary sensor.
def is_on(self) -> bool: """Return the state of the binary sensor.""" self._state = self._client.on_duty return self._state
[ "def", "is_on", "(", "self", ")", "->", "bool", ":", "self", ".", "_state", "=", "self", ".", "_client", ".", "on_duty", "return", "self", ".", "_state" ]
[ 56, 4 ]
[ 61, 26 ]
python
en
['en', 'ig', 'en']
True
ResponseBinarySensor.extra_state_attributes
(self)
Return available attributes for binary sensor.
Return available attributes for binary sensor.
def extra_state_attributes(self): """Return available attributes for binary sensor.""" attr = {} if not self.coordinator.data: return attr data = self.coordinator.data attr = { key: data[key] for key in ( "start_time", ...
[ "def", "extra_state_attributes", "(", "self", ")", ":", "attr", "=", "{", "}", "if", "not", "self", ".", "coordinator", ".", "data", ":", "return", "attr", "data", "=", "self", ".", "coordinator", ".", "data", "attr", "=", "{", "key", ":", "data", "[...
[ 64, 4 ]
[ 86, 19 ]
python
en
['en', 'en', 'en']
True
test_webhook_event_handling_thermostats
(hass, config_entry, netatmo_auth)
Test service and webhook event handling with thermostats.
Test service and webhook event handling with thermostats.
async def test_webhook_event_handling_thermostats(hass, config_entry, netatmo_auth): """Test service and webhook event handling with thermostats.""" with selected_platforms(["climate"]): await hass.config_entries.async_setup(config_entry.entry_id) await hass.async_block_till_done() webhook...
[ "async", "def", "test_webhook_event_handling_thermostats", "(", "hass", ",", "config_entry", ",", "netatmo_auth", ")", ":", "with", "selected_platforms", "(", "[", "\"climate\"", "]", ")", ":", "await", "hass", ".", "config_entries", ".", "async_setup", "(", "conf...
[ 31, 0 ]
[ 203, 5 ]
python
en
['en', 'en', 'en']
True
test_service_preset_mode_frost_guard_thermostat
( hass, config_entry, netatmo_auth )
Test service with frost guard preset for thermostats.
Test service with frost guard preset for thermostats.
async def test_service_preset_mode_frost_guard_thermostat( hass, config_entry, netatmo_auth ): """Test service with frost guard preset for thermostats.""" with selected_platforms(["climate"]): await hass.config_entries.async_setup(config_entry.entry_id) await hass.async_block_till_done() ...
[ "async", "def", "test_service_preset_mode_frost_guard_thermostat", "(", "hass", ",", "config_entry", ",", "netatmo_auth", ")", ":", "with", "selected_platforms", "(", "[", "\"climate\"", "]", ")", ":", "await", "hass", ".", "config_entries", ".", "async_setup", "(",...
[ 206, 0 ]
[ 278, 5 ]
python
en
['en', 'en', 'en']
True
test_service_preset_modes_thermostat
(hass, config_entry, netatmo_auth)
Test service with preset modes for thermostats.
Test service with preset modes for thermostats.
async def test_service_preset_modes_thermostat(hass, config_entry, netatmo_auth): """Test service with preset modes for thermostats.""" with selected_platforms(["climate"]): await hass.config_entries.async_setup(config_entry.entry_id) await hass.async_block_till_done() webhook_id = config_...
[ "async", "def", "test_service_preset_modes_thermostat", "(", "hass", ",", "config_entry", ",", "netatmo_auth", ")", ":", "with", "selected_platforms", "(", "[", "\"climate\"", "]", ")", ":", "await", "hass", ".", "config_entries", ".", "async_setup", "(", "config_...
[ 281, 0 ]
[ 357, 85 ]
python
en
['en', 'en', 'en']
True
test_webhook_event_handling_no_data
(hass, config_entry, netatmo_auth)
Test service and webhook event handling with erroneous data.
Test service and webhook event handling with erroneous data.
async def test_webhook_event_handling_no_data(hass, config_entry, netatmo_auth): """Test service and webhook event handling with erroneous data.""" with selected_platforms(["climate"]): await hass.config_entries.async_setup(config_entry.entry_id) await hass.async_block_till_done() # Test w...
[ "async", "def", "test_webhook_event_handling_no_data", "(", "hass", ",", "config_entry", ",", "netatmo_auth", ")", ":", "with", "selected_platforms", "(", "[", "\"climate\"", "]", ")", ":", "await", "hass", ".", "config_entries", ".", "async_setup", "(", "config_e...
[ 360, 0 ]
[ 406, 54 ]
python
en
['en', 'en', 'en']
True
test_service_schedule_thermostats
(hass, config_entry, caplog, netatmo_auth)
Test service for selecting Netatmo schedule with thermostats.
Test service for selecting Netatmo schedule with thermostats.
async def test_service_schedule_thermostats(hass, config_entry, caplog, netatmo_auth): """Test service for selecting Netatmo schedule with thermostats.""" with selected_platforms(["climate"]): await hass.config_entries.async_setup(config_entry.entry_id) await hass.async_block_till_done() w...
[ "async", "def", "test_service_schedule_thermostats", "(", "hass", ",", "config_entry", ",", "caplog", ",", "netatmo_auth", ")", ":", "with", "selected_platforms", "(", "[", "\"climate\"", "]", ")", ":", "await", "hass", ".", "config_entries", ".", "async_setup", ...
[ 409, 0 ]
[ 461, 58 ]
python
en
['en', 'en', 'en']
True
test_service_preset_mode_already_boost_valves
( hass, config_entry, netatmo_auth )
Test service with boost preset for valves when already in boost mode.
Test service with boost preset for valves when already in boost mode.
async def test_service_preset_mode_already_boost_valves( hass, config_entry, netatmo_auth ): """Test service with boost preset for valves when already in boost mode.""" with selected_platforms(["climate"]): await hass.config_entries.async_setup(config_entry.entry_id) await hass.async_block_...
[ "async", "def", "test_service_preset_mode_already_boost_valves", "(", "hass", ",", "config_entry", ",", "netatmo_auth", ")", ":", "with", "selected_platforms", "(", "[", "\"climate\"", "]", ")", ":", "await", "hass", ".", "config_entries", ".", "async_setup", "(", ...
[ 464, 0 ]
[ 541, 82 ]
python
en
['en', 'en', 'en']
True
test_service_preset_mode_boost_valves
(hass, config_entry, netatmo_auth)
Test service with boost preset for valves.
Test service with boost preset for valves.
async def test_service_preset_mode_boost_valves(hass, config_entry, netatmo_auth): """Test service with boost preset for valves.""" with selected_platforms(["climate"]): await hass.config_entries.async_setup(config_entry.entry_id) await hass.async_block_till_done() webhook_id = config_entr...
[ "async", "def", "test_service_preset_mode_boost_valves", "(", "hass", ",", "config_entry", ",", "netatmo_auth", ")", ":", "with", "selected_platforms", "(", "[", "\"climate\"", "]", ")", ":", "await", "hass", ".", "config_entries", ".", "async_setup", "(", "config...
[ 544, 0 ]
[ 591, 82 ]
python
en
['en', 'en', 'en']
True
test_service_preset_mode_invalid
(hass, config_entry, caplog, netatmo_auth)
Test service with invalid preset.
Test service with invalid preset.
async def test_service_preset_mode_invalid(hass, config_entry, caplog, netatmo_auth): """Test service with invalid preset.""" with selected_platforms(["climate"]): await hass.config_entries.async_setup(config_entry.entry_id) await hass.async_block_till_done() await hass.services.async_call...
[ "async", "def", "test_service_preset_mode_invalid", "(", "hass", ",", "config_entry", ",", "caplog", ",", "netatmo_auth", ")", ":", "with", "selected_platforms", "(", "[", "\"climate\"", "]", ")", ":", "await", "hass", ".", "config_entries", ".", "async_setup", ...
[ 594, 0 ]
[ 609, 63 ]
python
en
['en', 'en', 'en']
True
test_valves_service_turn_off
(hass, config_entry, netatmo_auth)
Test service turn off for valves.
Test service turn off for valves.
async def test_valves_service_turn_off(hass, config_entry, netatmo_auth): """Test service turn off for valves.""" with selected_platforms(["climate"]): await hass.config_entries.async_setup(config_entry.entry_id) await hass.async_block_till_done() webhook_id = config_entry.data[CONF_WEBHOO...
[ "async", "def", "test_valves_service_turn_off", "(", "hass", ",", "config_entry", ",", "netatmo_auth", ")", ":", "with", "selected_platforms", "(", "[", "\"climate\"", "]", ")", ":", "await", "hass", ".", "config_entries", ".", "async_setup", "(", "config_entry", ...
[ 612, 0 ]
[ 654, 65 ]
python
en
['en', 'da', 'en']
True
test_valves_service_turn_on
(hass, config_entry, netatmo_auth)
Test service turn on for valves.
Test service turn on for valves.
async def test_valves_service_turn_on(hass, config_entry, netatmo_auth): """Test service turn on for valves.""" with selected_platforms(["climate"]): await hass.config_entries.async_setup(config_entry.entry_id) await hass.async_block_till_done() webhook_id = config_entry.data[CONF_WEBHOOK_...
[ "async", "def", "test_valves_service_turn_on", "(", "hass", ",", "config_entry", ",", "netatmo_auth", ")", ":", "with", "selected_platforms", "(", "[", "\"climate\"", "]", ")", ":", "await", "hass", ".", "config_entries", ".", "async_setup", "(", "config_entry", ...
[ 657, 0 ]
[ 699, 66 ]
python
en
['en', 'no', 'en']
True
test_get_all_home_ids
()
Test extracting all home ids returned by NetAtmo API.
Test extracting all home ids returned by NetAtmo API.
async def test_get_all_home_ids(): """Test extracting all home ids returned by NetAtmo API.""" # Test with backend returning no data assert climate.get_all_home_ids(None) == [] # Test with fake data home_data = Mock() home_data.homes = { "123": {"id": "123", "name": "Home 1", "modules":...
[ "async", "def", "test_get_all_home_ids", "(", ")", ":", "# Test with backend returning no data", "assert", "climate", ".", "get_all_home_ids", "(", "None", ")", "==", "[", "]", "# Test with fake data", "home_data", "=", "Mock", "(", ")", "home_data", ".", "homes", ...
[ 702, 0 ]
[ 714, 58 ]
python
en
['en', 'en', 'en']
True
test_webhook_home_id_mismatch
(hass, config_entry, netatmo_auth)
Test service turn on for valves.
Test service turn on for valves.
async def test_webhook_home_id_mismatch(hass, config_entry, netatmo_auth): """Test service turn on for valves.""" with selected_platforms(["climate"]): await hass.config_entries.async_setup(config_entry.entry_id) await hass.async_block_till_done() webhook_id = config_entry.data[CONF_WEBHOO...
[ "async", "def", "test_webhook_home_id_mismatch", "(", "hass", ",", "config_entry", ",", "netatmo_auth", ")", ":", "with", "selected_platforms", "(", "[", "\"climate\"", "]", ")", ":", "await", "hass", ".", "config_entries", ".", "async_setup", "(", "config_entry",...
[ 717, 0 ]
[ 752, 66 ]
python
en
['en', 'no', 'en']
True
test_webhook_set_point
(hass, config_entry, netatmo_auth)
Test service turn on for valves.
Test service turn on for valves.
async def test_webhook_set_point(hass, config_entry, netatmo_auth): """Test service turn on for valves.""" with selected_platforms(["climate"]): await hass.config_entries.async_setup(config_entry.entry_id) await hass.async_block_till_done() webhook_id = config_entry.data[CONF_WEBHOOK_ID] ...
[ "async", "def", "test_webhook_set_point", "(", "hass", ",", "config_entry", ",", "netatmo_auth", ")", ":", "with", "selected_platforms", "(", "[", "\"climate\"", "]", ")", ":", "await", "hass", ".", "config_entries", ".", "async_setup", "(", "config_entry", ".",...
[ 755, 0 ]
[ 790, 66 ]
python
en
['en', 'no', '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" ]
[ 18, 0 ]
[ 20, 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" ]
[ 24, 0 ]
[ 27, 36 ]
python
en
['en', 'en', 'en']
True
restore_timezone
(hass)
Make sure we change timezone.
Make sure we change timezone.
def restore_timezone(hass): """Make sure we change timezone.""" yield dt_util.set_default_time_zone(ORIG_TIMEZONE)
[ "def", "restore_timezone", "(", "hass", ")", ":", "yield", "dt_util", ".", "set_default_time_zone", "(", "ORIG_TIMEZONE", ")" ]
[ 31, 0 ]
[ 34, 48 ]
python
en
['en', 'sw', '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...
[ 37, 0 ]
[ 58, 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\"", ":", ...
[ 61, 0 ]
[ 66, 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=dt_util.UTC) config = { "binary_sensor": [ { "platform": "tod", "name": "Evening", "after": "18:00", "be...
[ "async", "def", "test_in_period_on_start", "(", "hass", ")", ":", "test_time", "=", "datetime", "(", "2019", ",", "1", ",", "10", ",", "18", ",", "43", ",", "0", ",", "tzinfo", "=", "dt_util", ".", "UTC", ")", "config", "=", "{", "\"binary_sensor\"", ...
[ 69, 0 ]
[ 90, 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=dt_util.UTC) config = { "binary_sensor": [ {"platform": "tod", "name": "Night", "after": "22:00",...
[ "async", "def", "test_midnight_turnover_before_midnight_inside_period", "(", "hass", ")", ":", "test_time", "=", "datetime", "(", "2019", ",", "1", ",", "10", ",", "22", ",", "30", ",", "0", ",", "tzinfo", "=", "dt_util", ".", "UTC", ")", "config", "=", ...
[ 93, 0 ]
[ 109, 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 = datetime(2019, 1, 10, 21, 0, 0, tzinfo=dt_util.UTC) config = { "binary_sensor": [ {"platform": "tod", "name": "Night", "after": "22:00", "...
[ "async", "def", "test_midnight_turnover_after_midnight_inside_period", "(", "hass", ")", ":", "test_time", "=", "datetime", "(", "2019", ",", "1", ",", "10", ",", "21", ",", "0", ",", "0", ",", "tzinfo", "=", "dt_util", ".", "UTC", ")", "config", "=", "{...
[ 112, 0 ]
[ 143, 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 = datetime(2019, 1, 10, 20, 30, 0, tzinfo=dt_util.UTC) config = { "binary_sensor": [ {"platform": "tod", "name": "Night", "after": "22:00"...
[ "async", "def", "test_midnight_turnover_before_midnight_outside_period", "(", "hass", ")", ":", "test_time", "=", "datetime", "(", "2019", ",", "1", ",", "10", ",", "20", ",", "30", ",", "0", ",", "tzinfo", "=", "dt_util", ".", "UTC", ")", "config", "=", ...
[ 146, 0 ]
[ 162, 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 = datetime(2019, 1, 10, 20, 0, 0, tzinfo=dt_util.UTC) config = { "binary_sensor": [ {"platform": "tod", "name": "Night", "after": "22:00",...
[ "async", "def", "test_midnight_turnover_after_midnight_outside_period", "(", "hass", ")", ":", "test_time", "=", "datetime", "(", "2019", ",", "1", ",", "10", ",", "20", ",", "0", ",", "0", ",", "tzinfo", "=", "dt_util", ".", "UTC", ")", "config", "=", "...
[ 165, 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 = datetime(2019, 1, 12, tzinfo=dt_util.UTC) sunrise = dt_util.as_local( get_astral_event_date(hass, "sunrise", dt_util.as_utc(test_time)) ) sunset = dt_util.as_local( get_astral_event_dat...
[ "async", "def", "test_from_sunrise_to_sunset", "(", "hass", ")", ":", "test_time", "=", "datetime", "(", "2019", ",", "1", ",", "12", ",", "tzinfo", "=", "dt_util", ".", "UTC", ")", "sunrise", "=", "dt_util", ".", "as_local", "(", "get_astral_event_date", ...
[ 210, 0 ]
[ 306, 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 = datetime(2019, 1, 12, tzinfo=dt_util.UTC) sunset = dt_util.as_local(get_astral_event_date(hass, "sunset", test_time)) sunrise = dt_util.as_local(get_astral_event_next(hass, "sunrise", sunset)) # assert...
[ "async", "def", "test_from_sunset_to_sunrise", "(", "hass", ")", ":", "test_time", "=", "datetime", "(", "2019", ",", "1", ",", "12", ",", "tzinfo", "=", "dt_util", ".", "UTC", ")", "sunset", "=", "dt_util", ".", "as_local", "(", "get_astral_event_date", "...
[ 309, 0 ]
[ 398, 39 ]
python
en
['en', 'en', 'en']
True
test_offset
(hass)
Test offset.
Test offset.
async def test_offset(hass): """Test offset.""" after = datetime(2019, 1, 10, 18, 0, 0, tzinfo=dt_util.UTC) + timedelta( hours=1, minutes=34 ) before = datetime(2019, 1, 10, 22, 0, 0, tzinfo=dt_util.UTC) + timedelta( hours=1, minutes=45 ) entity_id = "binary_sensor.evening" ...
[ "async", "def", "test_offset", "(", "hass", ")", ":", "after", "=", "datetime", "(", "2019", ",", "1", ",", "10", ",", "18", ",", "0", ",", "0", ",", "tzinfo", "=", "dt_util", ".", "UTC", ")", "+", "timedelta", "(", "hours", "=", "1", ",", "min...
[ 401, 0 ]
[ 477, 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 = datetime(2019, 1, 10, 18, 0, 0, tzinfo=dt_util.UTC) + timedelta( hours=1, minutes=34 ) entity_id = "binary_sensor.evening" config = { "binary_sensor": [ { "platform": "tod", ...
[ "async", "def", "test_offset_overnight", "(", "hass", ")", ":", "after", "=", "datetime", "(", "2019", ",", "1", ",", "10", ",", "18", ",", "0", ",", "0", ",", "tzinfo", "=", "dt_util", ".", "UTC", ")", "+", "timedelta", "(", "hours", "=", "1", "...
[ 480, 0 ]
[ 518, 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 = datetime(2010, 1, 1, tzinfo=dt_util.UTC) sunrise = dt_util.as_local( get_astral_event_next(hass, "sunrise", dt_...
[ "async", "def", "test_norwegian_case_winter", "(", "hass", ")", ":", "hass", ".", "config", ".", "latitude", "=", "69.6", "hass", ".", "config", ".", "longitude", "=", "18.8", "test_time", "=", "datetime", "(", "2010", ",", "1", ",", "1", ",", "tzinfo", ...
[ 521, 0 ]
[ 632, 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 hass.config.elevation = 10.0 test_time = datetime(2010, 6, 1, tzinfo=dt_util.UTC) sunrise = dt_util.as_local( get_astr...
[ "async", "def", "test_norwegian_case_summer", "(", "hass", ")", ":", "hass", ".", "config", ".", "latitude", "=", "69.6", "hass", ".", "config", ".", "longitude", "=", "18.8", "hass", ".", "config", ".", "elevation", "=", "10.0", "test_time", "=", "datetim...
[ 635, 0 ]
[ 748, 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 = datetime(2019, 1, 12, tzinfo=dt_util.UTC) sunrise = dt_util.as_local( get_astral_event_date(hass, "sunrise", dt_util.as_utc(test_time)) + timedelta(hours=-1, minutes=-30) ) sunset = dt_util.as_local( ...
[ "async", "def", "test_sun_offset", "(", "hass", ")", ":", "test_time", "=", "datetime", "(", "2019", ",", "1", ",", "12", ",", "tzinfo", "=", "dt_util", ".", "UTC", ")", "sunrise", "=", "dt_util", ".", "as_local", "(", "get_astral_event_date", "(", "hass...
[ 751, 0 ]
[ 868, 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 = "CET" dt_util.set_default_time_zone(dt_util.get_time_zone("CET")) test_time = datetime(2019, 3, 30, 3, 0, 0, tzinfo=dt_util.UTC) config = { "binary_sensor": [ {"platform": "tod", "name": "Day", "a...
[ "async", "def", "test_dst", "(", "hass", ")", ":", "hass", ".", "config", ".", "time_zone", "=", "\"CET\"", "dt_util", ".", "set_default_time_zone", "(", "dt_util", ".", "get_time_zone", "(", "\"CET\"", ")", ")", "test_time", "=", "datetime", "(", "2019", ...
[ 871, 0 ]
[ 897, 39 ]
python
en
['en', 'en', 'en']
True
test_simple_before_after_does_not_loop_utc_not_in_range
(hass)
Test simple before after.
Test simple before after.
async def test_simple_before_after_does_not_loop_utc_not_in_range(hass): """Test simple before after.""" hass.config.time_zone = "UTC" dt_util.set_default_time_zone(dt_util.UTC) test_time = datetime(2019, 1, 10, 18, 43, 0, tzinfo=dt_util.UTC) config = { "binary_sensor": [ { ...
[ "async", "def", "test_simple_before_after_does_not_loop_utc_not_in_range", "(", "hass", ")", ":", "hass", ".", "config", ".", "time_zone", "=", "\"UTC\"", "dt_util", ".", "set_default_time_zone", "(", "dt_util", ".", "UTC", ")", "test_time", "=", "datetime", "(", ...
[ 900, 0 ]
[ 926, 73 ]
python
en
['da', 'en', 'en']
True
test_simple_before_after_does_not_loop_utc_in_range
(hass)
Test simple before after.
Test simple before after.
async def test_simple_before_after_does_not_loop_utc_in_range(hass): """Test simple before after.""" hass.config.time_zone = "UTC" dt_util.set_default_time_zone(dt_util.UTC) test_time = datetime(2019, 1, 10, 22, 43, 0, tzinfo=dt_util.UTC) config = { "binary_sensor": [ { ...
[ "async", "def", "test_simple_before_after_does_not_loop_utc_in_range", "(", "hass", ")", ":", "hass", ".", "config", ".", "time_zone", "=", "\"UTC\"", "dt_util", ".", "set_default_time_zone", "(", "dt_util", ".", "UTC", ")", "test_time", "=", "datetime", "(", "201...
[ 929, 0 ]
[ 955, 73 ]
python
en
['da', 'en', 'en']
True
test_simple_before_after_does_not_loop_utc_fire_at_before
(hass)
Test simple before after.
Test simple before after.
async def test_simple_before_after_does_not_loop_utc_fire_at_before(hass): """Test simple before after.""" hass.config.time_zone = "UTC" dt_util.set_default_time_zone(dt_util.UTC) test_time = datetime(2019, 1, 11, 6, 0, 0, tzinfo=dt_util.UTC) config = { "binary_sensor": [ { ...
[ "async", "def", "test_simple_before_after_does_not_loop_utc_fire_at_before", "(", "hass", ")", ":", "hass", ".", "config", ".", "time_zone", "=", "\"UTC\"", "dt_util", ".", "set_default_time_zone", "(", "dt_util", ".", "UTC", ")", "test_time", "=", "datetime", "(", ...
[ 958, 0 ]
[ 984, 73 ]
python
en
['da', 'en', 'en']
True
test_simple_before_after_does_not_loop_utc_fire_at_after
(hass)
Test simple before after.
Test simple before after.
async def test_simple_before_after_does_not_loop_utc_fire_at_after(hass): """Test simple before after.""" hass.config.time_zone = "UTC" dt_util.set_default_time_zone(dt_util.UTC) test_time = datetime(2019, 1, 10, 22, 0, 0, tzinfo=dt_util.UTC) config = { "binary_sensor": [ { ...
[ "async", "def", "test_simple_before_after_does_not_loop_utc_fire_at_after", "(", "hass", ")", ":", "hass", ".", "config", ".", "time_zone", "=", "\"UTC\"", "dt_util", ".", "set_default_time_zone", "(", "dt_util", ".", "UTC", ")", "test_time", "=", "datetime", "(", ...
[ 987, 0 ]
[ 1013, 73 ]
python
en
['da', 'en', 'en']
True
test_simple_before_after_does_not_loop_utc_both_before_now
(hass)
Test simple before after.
Test simple before after.
async def test_simple_before_after_does_not_loop_utc_both_before_now(hass): """Test simple before after.""" hass.config.time_zone = "UTC" dt_util.set_default_time_zone(dt_util.UTC) test_time = datetime(2019, 1, 10, 22, 0, 0, tzinfo=dt_util.UTC) config = { "binary_sensor": [ { ...
[ "async", "def", "test_simple_before_after_does_not_loop_utc_both_before_now", "(", "hass", ")", ":", "hass", ".", "config", ".", "time_zone", "=", "\"UTC\"", "dt_util", ".", "set_default_time_zone", "(", "dt_util", ".", "UTC", ")", "test_time", "=", "datetime", "(",...
[ 1016, 0 ]
[ 1042, 73 ]
python
en
['da', 'en', 'en']
True
test_simple_before_after_does_not_loop_berlin_not_in_range
(hass)
Test simple before after.
Test simple before after.
async def test_simple_before_after_does_not_loop_berlin_not_in_range(hass): """Test simple before after.""" hass.config.time_zone = "Europe/Berlin" dt_util.set_default_time_zone(dt_util.get_time_zone("Europe/Berlin")) test_time = datetime(2019, 1, 10, 18, 43, 0, tzinfo=dt_util.UTC) config = { ...
[ "async", "def", "test_simple_before_after_does_not_loop_berlin_not_in_range", "(", "hass", ")", ":", "hass", ".", "config", ".", "time_zone", "=", "\"Europe/Berlin\"", "dt_util", ".", "set_default_time_zone", "(", "dt_util", ".", "get_time_zone", "(", "\"Europe/Berlin\"",...
[ 1045, 0 ]
[ 1071, 73 ]
python
en
['da', 'en', 'en']
True
test_simple_before_after_does_not_loop_berlin_in_range
(hass)
Test simple before after.
Test simple before after.
async def test_simple_before_after_does_not_loop_berlin_in_range(hass): """Test simple before after.""" hass.config.time_zone = "Europe/Berlin" dt_util.set_default_time_zone(dt_util.get_time_zone("Europe/Berlin")) test_time = datetime(2019, 1, 10, 23, 43, 0, tzinfo=dt_util.UTC) config = { "b...
[ "async", "def", "test_simple_before_after_does_not_loop_berlin_in_range", "(", "hass", ")", ":", "hass", ".", "config", ".", "time_zone", "=", "\"Europe/Berlin\"", "dt_util", ".", "set_default_time_zone", "(", "dt_util", ".", "get_time_zone", "(", "\"Europe/Berlin\"", "...
[ 1074, 0 ]
[ 1100, 73 ]
python
en
['da', 'en', 'en']
True
setup_platform
(hass, config, add_entities, discovery_info=None)
Set up the NAD platform.
Set up the NAD platform.
def setup_platform(hass, config, add_entities, discovery_info=None): """Set up the NAD platform.""" if config.get(CONF_TYPE) in ("RS232", "Telnet"): add_entities( [NAD(config)], True, ) else: add_entities( [NADtcp(config)], True, ...
[ "def", "setup_platform", "(", "hass", ",", "config", ",", "add_entities", ",", "discovery_info", "=", "None", ")", ":", "if", "config", ".", "get", "(", "CONF_TYPE", ")", "in", "(", "\"RS232\"", ",", "\"Telnet\"", ")", ":", "add_entities", "(", "[", "NAD...
[ 65, 0 ]
[ 76, 9 ]
python
en
['en', 'da', 'en']
True
NAD.__init__
(self, config)
Initialize the NAD Receiver device.
Initialize the NAD Receiver device.
def __init__(self, config): """Initialize the NAD Receiver device.""" self.config = config self._instantiate_nad_receiver() self._min_volume = config[CONF_MIN_VOLUME] self._max_volume = config[CONF_MAX_VOLUME] self._source_dict = config[CONF_SOURCE_DICT] self._rev...
[ "def", "__init__", "(", "self", ",", "config", ")", ":", "self", ".", "config", "=", "config", "self", ".", "_instantiate_nad_receiver", "(", ")", "self", ".", "_min_volume", "=", "config", "[", "CONF_MIN_VOLUME", "]", "self", ".", "_max_volume", "=", "con...
[ 82, 4 ]
[ 91, 69 ]
python
en
['en', 'en', 'en']
True
NAD.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.config[CONF_NAME]
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "config", "[", "CONF_NAME", "]" ]
[ 102, 4 ]
[ 104, 37 ]
python
en
['en', 'en', 'en']
True
NAD.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._state
[ "def", "state", "(", "self", ")", ":", "return", "self", ".", "_state" ]
[ 107, 4 ]
[ 109, 26 ]
python
en
['en', 'en', 'en']
True
NAD.icon
(self)
Return the icon for the device.
Return the icon for the device.
def icon(self): """Return the icon for the device.""" return "mdi:speaker-multiple"
[ "def", "icon", "(", "self", ")", ":", "return", "\"mdi:speaker-multiple\"" ]
[ 112, 4 ]
[ 114, 37 ]
python
en
['en', 'en', 'en']
True
NAD.volume_level
(self)
Volume level of the media player (0..1).
Volume level of the media player (0..1).
def volume_level(self): """Volume level of the media player (0..1).""" return self._volume
[ "def", "volume_level", "(", "self", ")", ":", "return", "self", ".", "_volume" ]
[ 117, 4 ]
[ 119, 27 ]
python
en
['en', 'en', 'en']
True
NAD.is_volume_muted
(self)
Boolean if volume is currently muted.
Boolean if volume is currently muted.
def is_volume_muted(self): """Boolean if volume is currently muted.""" return self._mute
[ "def", "is_volume_muted", "(", "self", ")", ":", "return", "self", ".", "_mute" ]
[ 122, 4 ]
[ 124, 25 ]
python
en
['en', 'en', 'en']
True
NAD.supported_features
(self)
Flag media player features that are supported.
Flag media player features that are supported.
def supported_features(self): """Flag media player features that are supported.""" return SUPPORT_NAD
[ "def", "supported_features", "(", "self", ")", ":", "return", "SUPPORT_NAD" ]
[ 127, 4 ]
[ 129, 26 ]
python
en
['en', 'en', 'en']
True
NAD.turn_off
(self)
Turn the media player off.
Turn the media player off.
def turn_off(self): """Turn the media player off.""" self._nad_receiver.main_power("=", "Off")
[ "def", "turn_off", "(", "self", ")", ":", "self", ".", "_nad_receiver", ".", "main_power", "(", "\"=\"", ",", "\"Off\"", ")" ]
[ 131, 4 ]
[ 133, 49 ]
python
en
['en', 'en', 'en']
True
NAD.turn_on
(self)
Turn the media player on.
Turn the media player on.
def turn_on(self): """Turn the media player on.""" self._nad_receiver.main_power("=", "On")
[ "def", "turn_on", "(", "self", ")", ":", "self", ".", "_nad_receiver", ".", "main_power", "(", "\"=\"", ",", "\"On\"", ")" ]
[ 135, 4 ]
[ 137, 48 ]
python
en
['en', 'en', 'en']
True
NAD.volume_up
(self)
Volume up the media player.
Volume up the media player.
def volume_up(self): """Volume up the media player.""" self._nad_receiver.main_volume("+")
[ "def", "volume_up", "(", "self", ")", ":", "self", ".", "_nad_receiver", ".", "main_volume", "(", "\"+\"", ")" ]
[ 139, 4 ]
[ 141, 43 ]
python
en
['en', 'en', 'en']
True
NAD.volume_down
(self)
Volume down the media player.
Volume down the media player.
def volume_down(self): """Volume down the media player.""" self._nad_receiver.main_volume("-")
[ "def", "volume_down", "(", "self", ")", ":", "self", ".", "_nad_receiver", ".", "main_volume", "(", "\"-\"", ")" ]
[ 143, 4 ]
[ 145, 43 ]
python
en
['en', 'en', 'en']
True
NAD.set_volume_level
(self, volume)
Set volume level, range 0..1.
Set volume level, range 0..1.
def set_volume_level(self, volume): """Set volume level, range 0..1.""" self._nad_receiver.main_volume("=", self.calc_db(volume))
[ "def", "set_volume_level", "(", "self", ",", "volume", ")", ":", "self", ".", "_nad_receiver", ".", "main_volume", "(", "\"=\"", ",", "self", ".", "calc_db", "(", "volume", ")", ")" ]
[ 147, 4 ]
[ 149, 65 ]
python
en
['fr', 'zu', 'en']
False
NAD.mute_volume
(self, mute)
Mute (true) or unmute (false) media player.
Mute (true) or unmute (false) media player.
def mute_volume(self, mute): """Mute (true) or unmute (false) media player.""" if mute: self._nad_receiver.main_mute("=", "On") else: self._nad_receiver.main_mute("=", "Off")
[ "def", "mute_volume", "(", "self", ",", "mute", ")", ":", "if", "mute", ":", "self", ".", "_nad_receiver", ".", "main_mute", "(", "\"=\"", ",", "\"On\"", ")", "else", ":", "self", ".", "_nad_receiver", ".", "main_mute", "(", "\"=\"", ",", "\"Off\"", ")...
[ 151, 4 ]
[ 156, 52 ]
python
en
['en', 'la', 'it']
False
NAD.select_source
(self, source)
Select input source.
Select input source.
def select_source(self, source): """Select input source.""" self._nad_receiver.main_source("=", self._reverse_mapping.get(source))
[ "def", "select_source", "(", "self", ",", "source", ")", ":", "self", ".", "_nad_receiver", ".", "main_source", "(", "\"=\"", ",", "self", ".", "_reverse_mapping", ".", "get", "(", "source", ")", ")" ]
[ 158, 4 ]
[ 160, 78 ]
python
en
['fr', 'su', 'en']
False
NAD.source
(self)
Name of the current input source.
Name of the current input source.
def source(self): """Name of the current input source.""" return self._source
[ "def", "source", "(", "self", ")", ":", "return", "self", ".", "_source" ]
[ 163, 4 ]
[ 165, 27 ]
python
en
['en', 'en', 'en']
True
NAD.source_list
(self)
List of available input sources.
List of available input sources.
def source_list(self): """List of available input sources.""" return sorted(self._reverse_mapping)
[ "def", "source_list", "(", "self", ")", ":", "return", "sorted", "(", "self", ".", "_reverse_mapping", ")" ]
[ 168, 4 ]
[ 170, 44 ]
python
en
['en', 'en', 'en']
True
NAD.available
(self)
Return if device is available.
Return if device is available.
def available(self): """Return if device is available.""" return self._state is not None
[ "def", "available", "(", "self", ")", ":", "return", "self", ".", "_state", "is", "not", "None" ]
[ 173, 4 ]
[ 175, 38 ]
python
en
['en', 'en', 'en']
True
NAD.update
(self)
Retrieve latest state.
Retrieve latest state.
def update(self) -> None: """Retrieve latest state.""" power_state = self._nad_receiver.main_power("?") if not power_state: self._state = None return self._state = ( STATE_ON if self._nad_receiver.main_power("?") == "On" else STATE_OFF ) ...
[ "def", "update", "(", "self", ")", "->", "None", ":", "power_state", "=", "self", ".", "_nad_receiver", ".", "main_power", "(", "\"?\"", ")", "if", "not", "power_state", ":", "self", ".", "_state", "=", "None", "return", "self", ".", "_state", "=", "("...
[ 177, 4 ]
[ 193, 85 ]
python
en
['es', 'sk', 'en']
False
NAD.calc_volume
(self, decibel)
Calculate the volume given the decibel. Return the volume (0..1).
Calculate the volume given the decibel.
def calc_volume(self, decibel): """ Calculate the volume given the decibel. Return the volume (0..1). """ return abs(self._min_volume - decibel) / abs( self._min_volume - self._max_volume )
[ "def", "calc_volume", "(", "self", ",", "decibel", ")", ":", "return", "abs", "(", "self", ".", "_min_volume", "-", "decibel", ")", "/", "abs", "(", "self", ".", "_min_volume", "-", "self", ".", "_max_volume", ")" ]
[ 195, 4 ]
[ 203, 9 ]
python
en
['en', 'error', 'th']
False
NAD.calc_db
(self, volume)
Calculate the decibel given the volume. Return the dB.
Calculate the decibel given the volume.
def calc_db(self, volume): """ Calculate the decibel given the volume. Return the dB. """ return self._min_volume + round( abs(self._min_volume - self._max_volume) * volume )
[ "def", "calc_db", "(", "self", ",", "volume", ")", ":", "return", "self", ".", "_min_volume", "+", "round", "(", "abs", "(", "self", ".", "_min_volume", "-", "self", ".", "_max_volume", ")", "*", "volume", ")" ]
[ 205, 4 ]
[ 213, 9 ]
python
en
['en', 'error', 'th']
False
NADtcp.__init__
(self, config)
Initialize the amplifier.
Initialize the amplifier.
def __init__(self, config): """Initialize the amplifier.""" self._name = config[CONF_NAME] self._nad_receiver = NADReceiverTCP(config.get(CONF_HOST)) self._min_vol = (config[CONF_MIN_VOLUME] + 90) * 2 # from dB to nad vol (0-200) self._max_vol = (config[CONF_MAX_VOLUME] + 90) * ...
[ "def", "__init__", "(", "self", ",", "config", ")", ":", "self", ".", "_name", "=", "config", "[", "CONF_NAME", "]", "self", ".", "_nad_receiver", "=", "NADReceiverTCP", "(", "config", ".", "get", "(", "CONF_HOST", ")", ")", "self", ".", "_min_vol", "=...
[ 219, 4 ]
[ 231, 66 ]
python
en
['en', 'en', 'en']
True
NADtcp.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" ]
[ 234, 4 ]
[ 236, 25 ]
python
en
['en', 'en', 'en']
True
NADtcp.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._state
[ "def", "state", "(", "self", ")", ":", "return", "self", ".", "_state" ]
[ 239, 4 ]
[ 241, 26 ]
python
en
['en', 'en', 'en']
True
NADtcp.volume_level
(self)
Volume level of the media player (0..1).
Volume level of the media player (0..1).
def volume_level(self): """Volume level of the media player (0..1).""" return self._volume
[ "def", "volume_level", "(", "self", ")", ":", "return", "self", ".", "_volume" ]
[ 244, 4 ]
[ 246, 27 ]
python
en
['en', 'en', 'en']
True