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
MockPreset.__init__
(self, id_)
Init the class.
Init the class.
def __init__(self, id_): """Init the class.""" self._id = id_ self._name = "preset"
[ "def", "__init__", "(", "self", ",", "id_", ")", ":", "self", ".", "_id", "=", "id_", "self", ".", "_name", "=", "\"preset\"" ]
[ 165, 4 ]
[ 168, 29 ]
python
en
['en', 'en', 'en']
True
MockVolume.__init__
(self)
Init class.
Init class.
def __init__(self): """Init class.""" self._actual = 12 self._muted = False
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "_actual", "=", "12", "self", ".", "_muted", "=", "False" ]
[ 174, 4 ]
[ 177, 27 ]
python
en
['en', 'mt', 'en']
False
MockVolumeMuted.__init__
(self)
Init the class.
Init the class.
def __init__(self): """Init the class.""" self._actual = 12 self._muted = True
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "_actual", "=", "12", "self", ".", "_muted", "=", "True" ]
[ 183, 4 ]
[ 186, 26 ]
python
en
['en', 'en', 'en']
True
MockStatusStandby.__init__
(self)
Init the class.
Init the class.
def __init__(self): """Init the class.""" self._source = "STANDBY"
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "_source", "=", "\"STANDBY\"" ]
[ 192, 4 ]
[ 194, 32 ]
python
en
['en', 'en', 'en']
True
MockStatusPlaying.__init__
(self)
Init the class.
Init the class.
def __init__(self): """Init the class.""" self._source = "" self._play_status = "PLAY_STATE" self._image = "image.url" self._artist = "artist" self._track = "track" self._album = "album" self._duration = 1 self._station_name = None
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "_source", "=", "\"\"", "self", ".", "_play_status", "=", "\"PLAY_STATE\"", "self", ".", "_image", "=", "\"image.url\"", "self", ".", "_artist", "=", "\"artist\"", "self", ".", "_track", "=", "\"track\...
[ 200, 4 ]
[ 209, 33 ]
python
en
['en', 'en', 'en']
True
MockStatusPlayingRadio.__init__
(self)
Init the class.
Init the class.
def __init__(self): """Init the class.""" self._source = "" self._play_status = "PLAY_STATE" self._image = "image.url" self._artist = None self._track = None self._album = None self._duration = None self._station_name = "station"
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "_source", "=", "\"\"", "self", ".", "_play_status", "=", "\"PLAY_STATE\"", "self", ".", "_image", "=", "\"image.url\"", "self", ".", "_artist", "=", "None", "self", ".", "_track", "=", "None", "self...
[ 215, 4 ]
[ 224, 38 ]
python
en
['en', 'en', 'en']
True
MockStatusUnknown.__init__
(self)
Init the class.
Init the class.
def __init__(self): """Init the class.""" self._source = "" self._play_status = "PLAY_STATE" self._image = "image.url" self._artist = None self._track = None self._album = None self._duration = None self._station_name = None
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "_source", "=", "\"\"", "self", ".", "_play_status", "=", "\"PLAY_STATE\"", "self", ".", "_image", "=", "\"image.url\"", "self", ".", "_artist", "=", "None", "self", ".", "_track", "=", "None", "self...
[ 230, 4 ]
[ 239, 33 ]
python
en
['en', 'en', 'en']
True
MockStatusPause.__init__
(self)
Init the class.
Init the class.
def __init__(self): """Init the class.""" self._source = "" self._play_status = "PAUSE_STATE" self._image = "image.url" self._artist = None self._track = None self._album = None self._duration = None self._station_name = None
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "_source", "=", "\"\"", "self", ".", "_play_status", "=", "\"PAUSE_STATE\"", "self", ".", "_image", "=", "\"image.url\"", "self", ".", "_artist", "=", "None", "self", ".", "_track", "=", "None", "sel...
[ 245, 4 ]
[ 254, 33 ]
python
en
['en', 'en', 'en']
True
MockStatusPlayingAux.__init__
(self)
Init the class.
Init the class.
def __init__(self): """Init the class.""" self._source = "AUX" self._play_status = "PLAY_STATE" self._image = "image.url" self._artist = None self._track = None self._album = None self._duration = None self._station_name = None
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "_source", "=", "\"AUX\"", "self", ".", "_play_status", "=", "\"PLAY_STATE\"", "self", ".", "_image", "=", "\"image.url\"", "self", ".", "_artist", "=", "None", "self", ".", "_track", "=", "None", "s...
[ 260, 4 ]
[ 269, 33 ]
python
en
['en', 'en', 'en']
True
MockStatusPlayingBluetooth.__init__
(self)
Init the class.
Init the class.
def __init__(self): """Init the class.""" self._source = "BLUETOOTH" self._play_status = "PLAY_STATE" self._image = "image.url" self._artist = "artist" self._track = "track" self._album = "album" self._duration = None self._station_name = None
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "_source", "=", "\"BLUETOOTH\"", "self", ".", "_play_status", "=", "\"PLAY_STATE\"", "self", ".", "_image", "=", "\"image.url\"", "self", ".", "_artist", "=", "\"artist\"", "self", ".", "_track", "=", ...
[ 275, 4 ]
[ 284, 33 ]
python
en
['en', 'en', 'en']
True
test_timeout
(hass, caplog)
Test we do not block forever.
Test we do not block forever.
async def test_timeout(hass, caplog): """Test we do not block forever.""" assert await async_setup_component( hass, notify.DOMAIN, { "notify": { "name": "test", "platform": "command_line", "command": "sleep 10000", ...
[ "async", "def", "test_timeout", "(", "hass", ",", "caplog", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "notify", ".", "DOMAIN", ",", "{", "\"notify\"", ":", "{", "\"name\"", ":", "\"test\"", ",", "\"platform\"", ":", "\"command_l...
[ 97, 0 ]
[ 116, 35 ]
python
en
['pt', 'no', 'en']
False
TestCommandLine.setUp
(self)
Set up things to be run when tests are started.
Set up things to be run when tests are started.
def setUp(self): # pylint: disable=invalid-name """Set up things to be run when tests are started.""" self.hass = get_test_home_assistant() self.addCleanup(self.tear_down_cleanup)
[ "def", "setUp", "(", "self", ")", ":", "# pylint: disable=invalid-name", "self", ".", "hass", "=", "get_test_home_assistant", "(", ")", "self", ".", "addCleanup", "(", "self", ".", "tear_down_cleanup", ")" ]
[ 15, 4 ]
[ 18, 47 ]
python
en
['en', 'en', 'en']
True
TestCommandLine.tear_down_cleanup
(self)
Stop down everything that was started.
Stop down everything that was started.
def tear_down_cleanup(self): """Stop down everything that was started.""" self.hass.stop()
[ "def", "tear_down_cleanup", "(", "self", ")", ":", "self", ".", "hass", ".", "stop", "(", ")" ]
[ 20, 4 ]
[ 22, 24 ]
python
en
['en', 'en', 'en']
True
TestCommandLine.test_setup
(self)
Test setup.
Test setup.
def test_setup(self): """Test setup.""" with assert_setup_component(1) as handle_config: assert setup_component( self.hass, "notify", { "notify": { "name": "test", "platform": ...
[ "def", "test_setup", "(", "self", ")", ":", "with", "assert_setup_component", "(", "1", ")", "as", "handle_config", ":", "assert", "setup_component", "(", "self", ".", "hass", ",", "\"notify\"", ",", "{", "\"notify\"", ":", "{", "\"name\"", ":", "\"test\"", ...
[ 24, 4 ]
[ 38, 43 ]
python
en
['en', 'haw', 'en']
False
TestCommandLine.test_bad_config
(self)
Test set up the platform with bad/missing configuration.
Test set up the platform with bad/missing configuration.
def test_bad_config(self): """Test set up the platform with bad/missing configuration.""" config = {notify.DOMAIN: {"name": "test", "platform": "command_line"}} with assert_setup_component(0) as handle_config: assert setup_component(self.hass, notify.DOMAIN, config) assert no...
[ "def", "test_bad_config", "(", "self", ")", ":", "config", "=", "{", "notify", ".", "DOMAIN", ":", "{", "\"name\"", ":", "\"test\"", ",", "\"platform\"", ":", "\"command_line\"", "}", "}", "with", "assert_setup_component", "(", "0", ")", "as", "handle_config...
[ 40, 4 ]
[ 45, 47 ]
python
en
['en', 'da', 'en']
True
TestCommandLine.test_command_line_output
(self)
Test the command line output.
Test the command line output.
def test_command_line_output(self): """Test the command line output.""" with tempfile.TemporaryDirectory() as tempdirname: filename = os.path.join(tempdirname, "message.txt") message = "one, two, testing, testing" with assert_setup_component(1) as handle_config: ...
[ "def", "test_command_line_output", "(", "self", ")", ":", "with", "tempfile", ".", "TemporaryDirectory", "(", ")", "as", "tempdirname", ":", "filename", "=", "os", ".", "path", ".", "join", "(", "tempdirname", ",", "\"message.txt\"", ")", "message", "=", "\"...
[ 47, 4 ]
[ 72, 51 ]
python
en
['en', 'en', 'en']
True
TestCommandLine.test_error_for_none_zero_exit_code
(self, mock_error)
Test if an error is logged for non zero exit codes.
Test if an error is logged for non zero exit codes.
def test_error_for_none_zero_exit_code(self, mock_error): """Test if an error is logged for non zero exit codes.""" with assert_setup_component(1) as handle_config: assert setup_component( self.hass, notify.DOMAIN, { "notify...
[ "def", "test_error_for_none_zero_exit_code", "(", "self", ",", "mock_error", ")", ":", "with", "assert_setup_component", "(", "1", ")", "as", "handle_config", ":", "assert", "setup_component", "(", "self", ".", "hass", ",", "notify", ".", "DOMAIN", ",", "{", "...
[ 75, 4 ]
[ 94, 41 ]
python
en
['en', 'en', 'en']
True
_assert_tensors_equal
(a, b, atol=1e-12, prefix="")
If tensors not close, or a and b arent both tensors, raise a nice Assertion error.
If tensors not close, or a and b arent both tensors, raise a nice Assertion error.
def _assert_tensors_equal(a, b, atol=1e-12, prefix=""): """If tensors not close, or a and b arent both tensors, raise a nice Assertion error.""" if a is None and b is None: return True try: if tf.debugging.assert_near(a, b, atol=atol): return True raise except Excepti...
[ "def", "_assert_tensors_equal", "(", "a", ",", "b", ",", "atol", "=", "1e-12", ",", "prefix", "=", "\"\"", ")", ":", "if", "a", "is", "None", "and", "b", "is", "None", ":", "return", "True", "try", ":", "if", "tf", ".", "debugging", ".", "assert_ne...
[ 282, 0 ]
[ 294, 33 ]
python
en
['en', 'en', 'en']
True
TelldusLiveEntity.__init__
(self, client, device_id)
Initialize the entity.
Initialize the entity.
def __init__(self, client, device_id): """Initialize the entity.""" self._id = device_id self._client = client self._name = self.device.name self._async_unsub_dispatcher_connect = None
[ "def", "__init__", "(", "self", ",", "client", ",", "device_id", ")", ":", "self", ".", "_id", "=", "device_id", "self", ".", "_client", "=", "client", "self", ".", "_name", "=", "self", ".", "device", ".", "name", "self", ".", "_async_unsub_dispatcher_c...
[ 21, 4 ]
[ 26, 51 ]
python
en
['en', 'en', 'en']
True
TelldusLiveEntity.async_added_to_hass
(self)
Call when entity is added to hass.
Call when entity is added to hass.
async def async_added_to_hass(self): """Call when entity is added to hass.""" _LOGGER.debug("Created device %s", self) self._async_unsub_dispatcher_connect = async_dispatcher_connect( self.hass, SIGNAL_UPDATE_ENTITY, self._update_callback )
[ "async", "def", "async_added_to_hass", "(", "self", ")", ":", "_LOGGER", ".", "debug", "(", "\"Created device %s\"", ",", "self", ")", "self", ".", "_async_unsub_dispatcher_connect", "=", "async_dispatcher_connect", "(", "self", ".", "hass", ",", "SIGNAL_UPDATE_ENTI...
[ 28, 4 ]
[ 33, 9 ]
python
en
['en', 'en', 'en']
True
TelldusLiveEntity.async_will_remove_from_hass
(self)
Disconnect dispatcher listener when removed.
Disconnect dispatcher listener when removed.
async def async_will_remove_from_hass(self): """Disconnect dispatcher listener when removed.""" if self._async_unsub_dispatcher_connect: self._async_unsub_dispatcher_connect()
[ "async", "def", "async_will_remove_from_hass", "(", "self", ")", ":", "if", "self", ".", "_async_unsub_dispatcher_connect", ":", "self", ".", "_async_unsub_dispatcher_connect", "(", ")" ]
[ 35, 4 ]
[ 38, 50 ]
python
en
['en', 'en', 'en']
True
TelldusLiveEntity._update_callback
(self)
Return the property of the device might have changed.
Return the property of the device might have changed.
def _update_callback(self): """Return the property of the device might have changed.""" if self.device.name: self._name = self.device.name self.async_write_ha_state()
[ "def", "_update_callback", "(", "self", ")", ":", "if", "self", ".", "device", ".", "name", ":", "self", ".", "_name", "=", "self", ".", "device", ".", "name", "self", ".", "async_write_ha_state", "(", ")" ]
[ 41, 4 ]
[ 45, 35 ]
python
en
['en', 'en', 'en']
True
TelldusLiveEntity.device_id
(self)
Return the id of the device.
Return the id of the device.
def device_id(self): """Return the id of the device.""" return self._id
[ "def", "device_id", "(", "self", ")", ":", "return", "self", ".", "_id" ]
[ 48, 4 ]
[ 50, 23 ]
python
en
['en', 'en', 'en']
True
TelldusLiveEntity.device
(self)
Return the representation of the device.
Return the representation of the device.
def device(self): """Return the representation of the device.""" return self._client.device(self.device_id)
[ "def", "device", "(", "self", ")", ":", "return", "self", ".", "_client", ".", "device", "(", "self", ".", "device_id", ")" ]
[ 53, 4 ]
[ 55, 50 ]
python
en
['en', 'en', 'en']
True
TelldusLiveEntity._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.device.state
[ "def", "_state", "(", "self", ")", ":", "return", "self", ".", "device", ".", "state" ]
[ 58, 4 ]
[ 60, 32 ]
python
en
['en', 'en', 'en']
True
TelldusLiveEntity.should_poll
(self)
Return the polling state.
Return the polling state.
def should_poll(self): """Return the polling state.""" return False
[ "def", "should_poll", "(", "self", ")", ":", "return", "False" ]
[ 63, 4 ]
[ 65, 20 ]
python
en
['en', 'en', 'en']
True
TelldusLiveEntity.assumed_state
(self)
Return true if unable to access real state of entity.
Return true if unable to access real state of entity.
def assumed_state(self): """Return true if unable to access real state of entity.""" return True
[ "def", "assumed_state", "(", "self", ")", ":", "return", "True" ]
[ 68, 4 ]
[ 70, 19 ]
python
en
['en', 'en', 'en']
True
TelldusLiveEntity.name
(self)
Return name of device.
Return name of device.
def name(self): """Return name of device.""" return self._name or DEVICE_DEFAULT_NAME
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "_name", "or", "DEVICE_DEFAULT_NAME" ]
[ 73, 4 ]
[ 75, 48 ]
python
en
['en', 'en', 'en']
True
TelldusLiveEntity.available
(self)
Return true if device is not offline.
Return true if device is not offline.
def available(self): """Return true if device is not offline.""" return self._client.is_available(self.device_id)
[ "def", "available", "(", "self", ")", ":", "return", "self", ".", "_client", ".", "is_available", "(", "self", ".", "device_id", ")" ]
[ 78, 4 ]
[ 80, 56 ]
python
en
['en', 'fy', 'en']
True
TelldusLiveEntity.device_state_attributes
(self)
Return the state attributes.
Return the state attributes.
def device_state_attributes(self): """Return the state attributes.""" attrs = {} if self._battery_level: attrs[ATTR_BATTERY_LEVEL] = self._battery_level if self._last_updated: attrs[ATTR_LAST_UPDATED] = self._last_updated return attrs
[ "def", "device_state_attributes", "(", "self", ")", ":", "attrs", "=", "{", "}", "if", "self", ".", "_battery_level", ":", "attrs", "[", "ATTR_BATTERY_LEVEL", "]", "=", "self", ".", "_battery_level", "if", "self", ".", "_last_updated", ":", "attrs", "[", "...
[ 83, 4 ]
[ 90, 20 ]
python
en
['en', 'en', 'en']
True
TelldusLiveEntity._battery_level
(self)
Return the battery level of a device.
Return the battery level of a device.
def _battery_level(self): """Return the battery level of a device.""" if self.device.battery == BATTERY_LOW: return 1 if self.device.battery == BATTERY_UNKNOWN: return None if self.device.battery == BATTERY_OK: return 100 return self.device.ba...
[ "def", "_battery_level", "(", "self", ")", ":", "if", "self", ".", "device", ".", "battery", "==", "BATTERY_LOW", ":", "return", "1", "if", "self", ".", "device", ".", "battery", "==", "BATTERY_UNKNOWN", ":", "return", "None", "if", "self", ".", "device"...
[ 93, 4 ]
[ 102, 34 ]
python
en
['en', 'en', 'en']
True
TelldusLiveEntity._last_updated
(self)
Return the last update of a device.
Return the last update of a device.
def _last_updated(self): """Return the last update of a device.""" return ( str(datetime.fromtimestamp(self.device.lastUpdated)) if self.device.lastUpdated else None )
[ "def", "_last_updated", "(", "self", ")", ":", "return", "(", "str", "(", "datetime", ".", "fromtimestamp", "(", "self", ".", "device", ".", "lastUpdated", ")", ")", "if", "self", ".", "device", ".", "lastUpdated", "else", "None", ")" ]
[ 105, 4 ]
[ 111, 9 ]
python
en
['en', 'en', 'en']
True
TelldusLiveEntity.unique_id
(self)
Return a unique ID.
Return a unique ID.
def unique_id(self) -> str: """Return a unique ID.""" return self._id
[ "def", "unique_id", "(", "self", ")", "->", "str", ":", "return", "self", ".", "_id" ]
[ 114, 4 ]
[ 116, 23 ]
python
ca
['fr', 'ca', 'en']
False
TelldusLiveEntity.device_info
(self)
Return device info.
Return device info.
def device_info(self): """Return device info.""" device = self._client.device_info(self.device.device_id) device_info = { "identifiers": {("tellduslive", self.device.device_id)}, "name": self.device.name, } model = device.get("model") if model is n...
[ "def", "device_info", "(", "self", ")", ":", "device", "=", "self", ".", "_client", ".", "device_info", "(", "self", ".", "device", ".", "device_id", ")", "device_info", "=", "{", "\"identifiers\"", ":", "{", "(", "\"tellduslive\"", ",", "self", ".", "de...
[ 119, 4 ]
[ 135, 26 ]
python
en
['es', 'hr', 'en']
False
scan
(hass, entity_id=ENTITY_MATCH_ALL)
Force process of all cameras or given entity.
Force process of all cameras or given entity.
def scan(hass, entity_id=ENTITY_MATCH_ALL): """Force process of all cameras or given entity.""" hass.add_job(async_scan, hass, entity_id)
[ "def", "scan", "(", "hass", ",", "entity_id", "=", "ENTITY_MATCH_ALL", ")", ":", "hass", ".", "add_job", "(", "async_scan", ",", "hass", ",", "entity_id", ")" ]
[ 12, 0 ]
[ 14, 45 ]
python
en
['en', 'en', 'en']
True
async_scan
(hass, entity_id=ENTITY_MATCH_ALL)
Force process of all cameras or given entity.
Force process of all cameras or given entity.
def async_scan(hass, entity_id=ENTITY_MATCH_ALL): """Force process of all cameras or given entity.""" data = {ATTR_ENTITY_ID: entity_id} if entity_id else None hass.async_add_job(hass.services.async_call(DOMAIN, SERVICE_SCAN, data))
[ "def", "async_scan", "(", "hass", ",", "entity_id", "=", "ENTITY_MATCH_ALL", ")", ":", "data", "=", "{", "ATTR_ENTITY_ID", ":", "entity_id", "}", "if", "entity_id", "else", "None", "hass", ".", "async_add_job", "(", "hass", ".", "services", ".", "async_call"...
[ 19, 0 ]
[ 22, 76 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
(hass, config_entry, async_add_entities)
Set up the Fritzbox smarthome sensor from config_entry.
Set up the Fritzbox smarthome sensor from config_entry.
async def async_setup_entry(hass, config_entry, async_add_entities): """Set up the Fritzbox smarthome sensor from config_entry.""" entities = [] devices = hass.data[FRITZBOX_DOMAIN][CONF_DEVICES] fritz = hass.data[FRITZBOX_DOMAIN][CONF_CONNECTIONS][config_entry.entry_id] for device in await hass.as...
[ "async", "def", "async_setup_entry", "(", "hass", ",", "config_entry", ",", "async_add_entities", ")", ":", "entities", "=", "[", "]", "devices", "=", "hass", ".", "data", "[", "FRITZBOX_DOMAIN", "]", "[", "CONF_DEVICES", "]", "fritz", "=", "hass", ".", "d...
[ 15, 0 ]
[ 31, 32 ]
python
en
['en', 'en', 'en']
True
FritzBoxTempSensor.__init__
(self, device, fritz)
Initialize the switch.
Initialize the switch.
def __init__(self, device, fritz): """Initialize the switch.""" self._device = device self._fritz = fritz
[ "def", "__init__", "(", "self", ",", "device", ",", "fritz", ")", ":", "self", ".", "_device", "=", "device", "self", ".", "_fritz", "=", "fritz" ]
[ 37, 4 ]
[ 40, 27 ]
python
en
['en', 'en', 'en']
True
FritzBoxTempSensor.device_info
(self)
Return device specific attributes.
Return device specific attributes.
def device_info(self): """Return device specific attributes.""" return { "name": self.name, "identifiers": {(FRITZBOX_DOMAIN, self._device.ain)}, "manufacturer": self._device.manufacturer, "model": self._device.productname, "sw_version": self._...
[ "def", "device_info", "(", "self", ")", ":", "return", "{", "\"name\"", ":", "self", ".", "name", ",", "\"identifiers\"", ":", "{", "(", "FRITZBOX_DOMAIN", ",", "self", ".", "_device", ".", "ain", ")", "}", ",", "\"manufacturer\"", ":", "self", ".", "_...
[ 43, 4 ]
[ 51, 9 ]
python
en
['fr', 'it', 'en']
False
FritzBoxTempSensor.unique_id
(self)
Return the unique ID of the device.
Return the unique ID of the device.
def unique_id(self): """Return the unique ID of the device.""" return self._device.ain
[ "def", "unique_id", "(", "self", ")", ":", "return", "self", ".", "_device", ".", "ain" ]
[ 54, 4 ]
[ 56, 31 ]
python
en
['en', 'en', 'en']
True
FritzBoxTempSensor.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._device.name
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "_device", ".", "name" ]
[ 59, 4 ]
[ 61, 32 ]
python
en
['en', 'en', 'en']
True
FritzBoxTempSensor.state
(self)
Return the state of the sensor.
Return the state of the sensor.
def state(self): """Return the state of the sensor.""" return self._device.temperature
[ "def", "state", "(", "self", ")", ":", "return", "self", ".", "_device", ".", "temperature" ]
[ 64, 4 ]
[ 66, 39 ]
python
en
['en', 'en', 'en']
True
FritzBoxTempSensor.unit_of_measurement
(self)
Return the unit of measurement.
Return the unit of measurement.
def unit_of_measurement(self): """Return the unit of measurement.""" return TEMP_CELSIUS
[ "def", "unit_of_measurement", "(", "self", ")", ":", "return", "TEMP_CELSIUS" ]
[ 69, 4 ]
[ 71, 27 ]
python
en
['en', 'la', 'en']
True
FritzBoxTempSensor.update
(self)
Get latest data and states from the device.
Get latest data and states from the device.
def update(self): """Get latest data and states from the device.""" try: self._device.update() except requests.exceptions.HTTPError as ex: LOGGER.warning("Fritzhome connection error: %s", ex) self._fritz.login()
[ "def", "update", "(", "self", ")", ":", "try", ":", "self", ".", "_device", ".", "update", "(", ")", "except", "requests", ".", "exceptions", ".", "HTTPError", "as", "ex", ":", "LOGGER", ".", "warning", "(", "\"Fritzhome connection error: %s\"", ",", "ex",...
[ 73, 4 ]
[ 79, 31 ]
python
en
['en', 'en', 'en']
True
FritzBoxTempSensor.device_state_attributes
(self)
Return the state attributes of the device.
Return the state attributes of the device.
def device_state_attributes(self): """Return the state attributes of the device.""" attrs = { ATTR_STATE_DEVICE_LOCKED: self._device.device_lock, ATTR_STATE_LOCKED: self._device.lock, } return attrs
[ "def", "device_state_attributes", "(", "self", ")", ":", "attrs", "=", "{", "ATTR_STATE_DEVICE_LOCKED", ":", "self", ".", "_device", ".", "device_lock", ",", "ATTR_STATE_LOCKED", ":", "self", ".", "_device", ".", "lock", ",", "}", "return", "attrs" ]
[ 82, 4 ]
[ 88, 20 ]
python
en
['en', 'en', 'en']
True
mcpi_samples
(n)
Compute the number of points in the unit circle out of n points.
Compute the number of points in the unit circle out of n points.
def mcpi_samples(n): """ Compute the number of points in the unit circle out of n points. """ count = 0 for i in range(n): x, y = random.random(), random.random() if x*x + y*y <= 1: count += 1 return count
[ "def", "mcpi_samples", "(", "n", ")", ":", "count", "=", "0", "for", "i", "in", "range", "(", "n", ")", ":", "x", ",", "y", "=", "random", ".", "random", "(", ")", ",", "random", ".", "random", "(", ")", "if", "x", "*", "x", "+", "y", "*", ...
[ 17, 0 ]
[ 26, 16 ]
python
en
['en', 'error', 'th']
False
setup_platform
(hass, config, add_entities, discovery_info=None)
Set up the Loop Energy sensors.
Set up the Loop Energy sensors.
def setup_platform(hass, config, add_entities, discovery_info=None): """Set up the Loop Energy sensors.""" elec_config = config.get(CONF_ELEC) gas_config = config.get(CONF_GAS, {}) controller = pyloopenergy.LoopEnergy( elec_config.get(CONF_ELEC_SERIAL), elec_config.get(CONF_ELEC_SECRET)...
[ "def", "setup_platform", "(", "hass", ",", "config", ",", "add_entities", ",", "discovery_info", "=", "None", ")", ":", "elec_config", "=", "config", ".", "get", "(", "CONF_ELEC", ")", "gas_config", "=", "config", ".", "get", "(", "CONF_GAS", ",", "{", "...
[ 55, 0 ]
[ 81, 25 ]
python
en
['en', 'af', 'en']
True
LoopEnergyDevice.__init__
(self, controller)
Initialize the sensor.
Initialize the sensor.
def __init__(self, controller): """Initialize the sensor.""" self._state = None self._unit_of_measurement = DEFAULT_UNIT self._controller = controller self._name = None
[ "def", "__init__", "(", "self", ",", "controller", ")", ":", "self", ".", "_state", "=", "None", "self", ".", "_unit_of_measurement", "=", "DEFAULT_UNIT", "self", ".", "_controller", "=", "controller", "self", ".", "_name", "=", "None" ]
[ 87, 4 ]
[ 92, 25 ]
python
en
['en', 'en', 'en']
True
LoopEnergyDevice.name
(self)
Return the name of the sensor.
Return the name of the sensor.
def name(self): """Return the name of the sensor.""" return self._name
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "_name" ]
[ 95, 4 ]
[ 97, 25 ]
python
en
['en', 'mi', 'en']
True
LoopEnergyDevice.state
(self)
Return the state of the sensor.
Return the state of the sensor.
def state(self): """Return the state of the sensor.""" return self._state
[ "def", "state", "(", "self", ")", ":", "return", "self", ".", "_state" ]
[ 100, 4 ]
[ 102, 26 ]
python
en
['en', 'en', 'en']
True
LoopEnergyDevice.should_poll
(self)
No polling needed.
No polling needed.
def should_poll(self): """No polling needed.""" return False
[ "def", "should_poll", "(", "self", ")", ":", "return", "False" ]
[ 105, 4 ]
[ 107, 20 ]
python
en
['en', 'en', 'en']
True
LoopEnergyDevice.unit_of_measurement
(self)
Return the unit of measurement of this entity, if any.
Return the unit of measurement of this entity, if any.
def unit_of_measurement(self): """Return the unit of measurement of this entity, if any.""" return self._unit_of_measurement
[ "def", "unit_of_measurement", "(", "self", ")", ":", "return", "self", ".", "_unit_of_measurement" ]
[ 110, 4 ]
[ 112, 40 ]
python
en
['en', 'en', 'en']
True
LoopEnergyElec.__init__
(self, controller)
Initialize the sensor.
Initialize the sensor.
def __init__(self, controller): """Initialize the sensor.""" super().__init__(controller) self._name = "Power Usage"
[ "def", "__init__", "(", "self", ",", "controller", ")", ":", "super", "(", ")", ".", "__init__", "(", "controller", ")", "self", ".", "_name", "=", "\"Power Usage\"" ]
[ 121, 4 ]
[ 124, 34 ]
python
en
['en', 'en', 'en']
True
LoopEnergyElec.async_added_to_hass
(self)
Subscribe to updates.
Subscribe to updates.
async def async_added_to_hass(self): """Subscribe to updates.""" self._controller.subscribe_elecricity(self._callback)
[ "async", "def", "async_added_to_hass", "(", "self", ")", ":", "self", ".", "_controller", ".", "subscribe_elecricity", "(", "self", ".", "_callback", ")" ]
[ 126, 4 ]
[ 128, 61 ]
python
en
['en', 'en', 'en']
True
LoopEnergyElec.update
(self)
Get the cached Loop energy reading.
Get the cached Loop energy reading.
def update(self): """Get the cached Loop energy reading.""" self._state = round(self._controller.electricity_useage, 2)
[ "def", "update", "(", "self", ")", ":", "self", ".", "_state", "=", "round", "(", "self", ".", "_controller", ".", "electricity_useage", ",", "2", ")" ]
[ 130, 4 ]
[ 132, 67 ]
python
en
['en', 'en', 'en']
True
LoopEnergyGas.__init__
(self, controller)
Initialize the sensor.
Initialize the sensor.
def __init__(self, controller): """Initialize the sensor.""" super().__init__(controller) self._name = "Gas Usage"
[ "def", "__init__", "(", "self", ",", "controller", ")", ":", "super", "(", ")", ".", "__init__", "(", "controller", ")", "self", ".", "_name", "=", "\"Gas Usage\"" ]
[ 138, 4 ]
[ 141, 32 ]
python
en
['en', 'en', 'en']
True
LoopEnergyGas.async_added_to_hass
(self)
Subscribe to updates.
Subscribe to updates.
async def async_added_to_hass(self): """Subscribe to updates.""" self._controller.subscribe_gas(self._callback)
[ "async", "def", "async_added_to_hass", "(", "self", ")", ":", "self", ".", "_controller", ".", "subscribe_gas", "(", "self", ".", "_callback", ")" ]
[ 143, 4 ]
[ 145, 54 ]
python
en
['en', 'en', 'en']
True
LoopEnergyGas.update
(self)
Get the cached Loop gas reading.
Get the cached Loop gas reading.
def update(self): """Get the cached Loop gas reading.""" self._state = round(self._controller.gas_useage, 2)
[ "def", "update", "(", "self", ")", ":", "self", ".", "_state", "=", "round", "(", "self", ".", "_controller", ".", "gas_useage", ",", "2", ")" ]
[ 147, 4 ]
[ 149, 59 ]
python
en
['en', 'en', 'en']
True
register_flow_implementation
(hass, client_id, client_secret)
Register a ambiclimate implementation. client_id: Client id. client_secret: Client secret.
Register a ambiclimate implementation.
def register_flow_implementation(hass, client_id, client_secret): """Register a ambiclimate implementation. client_id: Client id. client_secret: Client secret. """ hass.data.setdefault(DATA_AMBICLIMATE_IMPL, {}) hass.data[DATA_AMBICLIMATE_IMPL] = { CONF_CLIENT_ID: client_id, CO...
[ "def", "register_flow_implementation", "(", "hass", ",", "client_id", ",", "client_secret", ")", ":", "hass", ".", "data", ".", "setdefault", "(", "DATA_AMBICLIMATE_IMPL", ",", "{", "}", ")", "hass", ".", "data", "[", "DATA_AMBICLIMATE_IMPL", "]", "=", "{", ...
[ 26, 0 ]
[ 37, 5 ]
python
en
['pt', 'en', 'es']
False
AmbiclimateAuthCallbackView.get
(self, request)
Receive authorization token.
Receive authorization token.
async def get(self, request): """Receive authorization token.""" code = request.query.get("code") if code is None: return "No code" hass = request.app["hass"] hass.async_create_task( hass.config_entries.flow.async_init( DOMAIN, context={"so...
[ "async", "def", "get", "(", "self", ",", "request", ")", ":", "code", "=", "request", ".", "query", ".", "get", "(", "\"code\"", ")", "if", "code", "is", "None", ":", "return", "\"No code\"", "hass", "=", "request", ".", "app", "[", "\"hass\"", "]", ...
[ 146, 4 ]
[ 157, 20 ]
python
de
['de', 'el-Latn', 'en']
False
RoutesParser.parse
(self, conf: dict)
Parse specified route configuration. Args: conf (dict): Configuration to parse. Returns: (Dict[str, int], List[List[RoutePoint]]): Route mapping (name to index), and list of route point list (index is route index).
Parse specified route configuration.
def parse(self, conf: dict) -> (Dict[str, int], List[List[RoutePoint]]): """Parse specified route configuration. Args: conf (dict): Configuration to parse. Returns: (Dict[str, int], List[List[RoutePoint]]): Route mapping (name to index), and list of rou...
[ "def", "parse", "(", "self", ",", "conf", ":", "dict", ")", "->", "(", "Dict", "[", "str", ",", "int", "]", ",", "List", "[", "List", "[", "RoutePoint", "]", "]", ")", ":", "routes", ":", "List", "[", "List", "[", "RoutePoint", "]", "]", "=", ...
[ 13, 4 ]
[ 35, 36 ]
python
en
['ro', 'en', 'en']
True
TestMicrosoftFaceIdentifySetup.setup_method
(self)
Set up things to be run when tests are started.
Set up things to be run when tests are started.
def setup_method(self): """Set up things to be run when tests are started.""" self.hass = get_test_home_assistant()
[ "def", "setup_method", "(", "self", ")", ":", "self", ".", "hass", "=", "get_test_home_assistant", "(", ")" ]
[ 21, 4 ]
[ 23, 45 ]
python
en
['en', 'en', 'en']
True
TestMicrosoftFaceIdentifySetup.teardown_method
(self)
Stop everything that was started.
Stop everything that was started.
def teardown_method(self): """Stop everything that was started.""" self.hass.stop()
[ "def", "teardown_method", "(", "self", ")", ":", "self", ".", "hass", ".", "stop", "(", ")" ]
[ 25, 4 ]
[ 27, 24 ]
python
en
['en', 'en', 'en']
True
TestMicrosoftFaceIdentifySetup.test_setup_platform
(self, store_mock)
Set up platform with one entity.
Set up platform with one entity.
def test_setup_platform(self, store_mock): """Set up platform with one entity.""" config = { ip.DOMAIN: { "platform": "microsoft_face_identify", "source": {"entity_id": "camera.demo_camera"}, "group": "Test Group1", }, "...
[ "def", "test_setup_platform", "(", "self", ",", "store_mock", ")", ":", "config", "=", "{", "ip", ".", "DOMAIN", ":", "{", "\"platform\"", ":", "\"microsoft_face_identify\"", ",", "\"source\"", ":", "{", "\"entity_id\"", ":", "\"camera.demo_camera\"", "}", ",", ...
[ 33, 4 ]
[ 49, 81 ]
python
en
['en', 'en', 'en']
True
TestMicrosoftFaceIdentifySetup.test_setup_platform_name
(self, store_mock)
Set up platform with one entity and set name.
Set up platform with one entity and set name.
def test_setup_platform_name(self, store_mock): """Set up platform with one entity and set name.""" config = { ip.DOMAIN: { "platform": "microsoft_face_identify", "source": {"entity_id": "camera.demo_camera", "name": "test local"}, "group": "Te...
[ "def", "test_setup_platform_name", "(", "self", ",", "store_mock", ")", ":", "config", "=", "{", "ip", ".", "DOMAIN", ":", "{", "\"platform\"", ":", "\"microsoft_face_identify\"", ",", "\"source\"", ":", "{", "\"entity_id\"", ":", "\"camera.demo_camera\"", ",", ...
[ 55, 4 ]
[ 71, 66 ]
python
en
['en', 'en', 'en']
True
TestMicrosoftFaceIdentify.setup_method
(self)
Set up things to be run when tests are started.
Set up things to be run when tests are started.
def setup_method(self): """Set up things to be run when tests are started.""" self.hass = get_test_home_assistant() self.config = { ip.DOMAIN: { "platform": "microsoft_face_identify", "source": {"entity_id": "camera.demo_camera", "name": "test local"}...
[ "def", "setup_method", "(", "self", ")", ":", "self", ".", "hass", "=", "get_test_home_assistant", "(", ")", "self", ".", "config", "=", "{", "ip", ".", "DOMAIN", ":", "{", "\"platform\"", ":", "\"microsoft_face_identify\"", ",", "\"source\"", ":", "{", "\...
[ 77, 4 ]
[ 91, 63 ]
python
en
['en', 'en', 'en']
True
TestMicrosoftFaceIdentify.teardown_method
(self)
Stop everything that was started.
Stop everything that was started.
def teardown_method(self): """Stop everything that was started.""" self.hass.stop()
[ "def", "teardown_method", "(", "self", ")", ":", "self", ".", "hass", ".", "stop", "(", ")" ]
[ 93, 4 ]
[ 95, 24 ]
python
en
['en', 'en', 'en']
True
TestMicrosoftFaceIdentify.test_ms_identify_process_image
(self, poll_mock, aioclient_mock)
Set up and scan a picture and test plates from event.
Set up and scan a picture and test plates from event.
def test_ms_identify_process_image(self, poll_mock, aioclient_mock): """Set up and scan a picture and test plates from event.""" aioclient_mock.get( self.endpoint_url.format("persongroups"), text=load_fixture("microsoft_face_persongroups.json"), ) aioclient_mock.g...
[ "def", "test_ms_identify_process_image", "(", "self", ",", "poll_mock", ",", "aioclient_mock", ")", ":", "aioclient_mock", ".", "get", "(", "self", ".", "endpoint_url", ".", "format", "(", "\"persongroups\"", ")", ",", "text", "=", "load_fixture", "(", "\"micros...
[ 102, 4 ]
[ 170, 43 ]
python
en
['en', 'en', 'en']
True
async_check_sabnzbd
(sab_api)
Check if we can reach SABnzbd.
Check if we can reach SABnzbd.
async def async_check_sabnzbd(sab_api): """Check if we can reach SABnzbd.""" try: await sab_api.check_available() return True except SabnzbdApiException: _LOGGER.error("Connection to SABnzbd API failed") return False
[ "async", "def", "async_check_sabnzbd", "(", "sab_api", ")", ":", "try", ":", "await", "sab_api", ".", "check_available", "(", ")", "return", "True", "except", "SabnzbdApiException", ":", "_LOGGER", ".", "error", "(", "\"Connection to SABnzbd API failed\"", ")", "r...
[ 90, 0 ]
[ 98, 20 ]
python
en
['en', 'en', 'en']
True
async_configure_sabnzbd
( hass, config, use_ssl, name=DEFAULT_NAME, api_key=None )
Try to configure Sabnzbd and request api key if configuration fails.
Try to configure Sabnzbd and request api key if configuration fails.
async def async_configure_sabnzbd( hass, config, use_ssl, name=DEFAULT_NAME, api_key=None ): """Try to configure Sabnzbd and request api key if configuration fails.""" host = config[CONF_HOST] port = config[CONF_PORT] web_root = config.get(CONF_PATH) uri_scheme = "https" if use_ssl else "http" ...
[ "async", "def", "async_configure_sabnzbd", "(", "hass", ",", "config", ",", "use_ssl", ",", "name", "=", "DEFAULT_NAME", ",", "api_key", "=", "None", ")", ":", "host", "=", "config", "[", "CONF_HOST", "]", "port", "=", "config", "[", "CONF_PORT", "]", "w...
[ 101, 0 ]
[ 123, 69 ]
python
en
['en', 'en', 'en']
True
async_setup
(hass, config)
Set up the SABnzbd component.
Set up the SABnzbd component.
async def async_setup(hass, config): """Set up the SABnzbd component.""" async def sabnzbd_discovered(service, info): """Handle service discovery.""" ssl = info.get("properties", {}).get("https", "0") == "1" await async_configure_sabnzbd(hass, info, ssl) discovery.async_listen(hass...
[ "async", "def", "async_setup", "(", "hass", ",", "config", ")", ":", "async", "def", "sabnzbd_discovered", "(", "service", ",", "info", ")", ":", "\"\"\"Handle service discovery.\"\"\"", "ssl", "=", "info", ".", "get", "(", "\"properties\"", ",", "{", "}", "...
[ 126, 0 ]
[ 142, 15 ]
python
en
['en', 'en', 'en']
True
async_setup_sabnzbd
(hass, sab_api, config, name)
Set up SABnzbd sensors and services.
Set up SABnzbd sensors and services.
def async_setup_sabnzbd(hass, sab_api, config, name): """Set up SABnzbd sensors and services.""" sab_api_data = SabnzbdApiData(sab_api, name, config.get(CONF_SENSORS, {})) if config.get(CONF_SENSORS): hass.data[DATA_SABNZBD] = sab_api_data hass.async_create_task( discovery.async...
[ "def", "async_setup_sabnzbd", "(", "hass", ",", "sab_api", ",", "config", ",", "name", ")", ":", "sab_api_data", "=", "SabnzbdApiData", "(", "sab_api", ",", "name", ",", "config", ".", "get", "(", "CONF_SENSORS", ",", "{", "}", ")", ")", "if", "config", ...
[ 146, 0 ]
[ 187, 74 ]
python
en
['en', 'en', 'en']
True
async_request_configuration
(hass, config, host, web_root)
Request configuration steps from the user.
Request configuration steps from the user.
def async_request_configuration(hass, config, host, web_root): """Request configuration steps from the user.""" configurator = hass.components.configurator # We got an error if this method is called while we are configuring if host in _CONFIGURING: configurator.async_notify_errors( ...
[ "def", "async_request_configuration", "(", "hass", ",", "config", ",", "host", ",", "web_root", ")", ":", "configurator", "=", "hass", ".", "components", ".", "configurator", "# We got an error if this method is called while we are configuring", "if", "host", "in", "_CO...
[ 191, 0 ]
[ 229, 5 ]
python
en
['en', 'en', 'en']
True
SabnzbdApiData.__init__
(self, sab_api, name, sensors)
Initialize component.
Initialize component.
def __init__(self, sab_api, name, sensors): """Initialize component.""" self.sab_api = sab_api self.name = name self.sensors = sensors
[ "def", "__init__", "(", "self", ",", "sab_api", ",", "name", ",", "sensors", ")", ":", "self", ".", "sab_api", "=", "sab_api", "self", ".", "name", "=", "name", "self", ".", "sensors", "=", "sensors" ]
[ 235, 4 ]
[ 239, 30 ]
python
en
['de', 'en', 'en']
False
SabnzbdApiData.async_pause_queue
(self)
Pause Sabnzbd queue.
Pause Sabnzbd queue.
async def async_pause_queue(self): """Pause Sabnzbd queue.""" try: return await self.sab_api.pause_queue() except SabnzbdApiException as err: _LOGGER.error(err) return False
[ "async", "def", "async_pause_queue", "(", "self", ")", ":", "try", ":", "return", "await", "self", ".", "sab_api", ".", "pause_queue", "(", ")", "except", "SabnzbdApiException", "as", "err", ":", "_LOGGER", ".", "error", "(", "err", ")", "return", "False" ...
[ 241, 4 ]
[ 248, 24 ]
python
es
['fr', 'es', 'pt']
False
SabnzbdApiData.async_resume_queue
(self)
Resume Sabnzbd queue.
Resume Sabnzbd queue.
async def async_resume_queue(self): """Resume Sabnzbd queue.""" try: return await self.sab_api.resume_queue() except SabnzbdApiException as err: _LOGGER.error(err) return False
[ "async", "def", "async_resume_queue", "(", "self", ")", ":", "try", ":", "return", "await", "self", ".", "sab_api", ".", "resume_queue", "(", ")", "except", "SabnzbdApiException", "as", "err", ":", "_LOGGER", ".", "error", "(", "err", ")", "return", "False...
[ 250, 4 ]
[ 257, 24 ]
python
es
['fr', 'es', 'pt']
False
SabnzbdApiData.async_set_queue_speed
(self, limit)
Set speed limit for the Sabnzbd queue.
Set speed limit for the Sabnzbd queue.
async def async_set_queue_speed(self, limit): """Set speed limit for the Sabnzbd queue.""" try: return await self.sab_api.set_speed_limit(limit) except SabnzbdApiException as err: _LOGGER.error(err) return False
[ "async", "def", "async_set_queue_speed", "(", "self", ",", "limit", ")", ":", "try", ":", "return", "await", "self", ".", "sab_api", ".", "set_speed_limit", "(", "limit", ")", "except", "SabnzbdApiException", "as", "err", ":", "_LOGGER", ".", "error", "(", ...
[ 259, 4 ]
[ 266, 24 ]
python
en
['en', 'en', 'en']
True
SabnzbdApiData.get_queue_field
(self, field)
Return the value for the given field from the Sabnzbd queue.
Return the value for the given field from the Sabnzbd queue.
def get_queue_field(self, field): """Return the value for the given field from the Sabnzbd queue.""" return self.sab_api.queue.get(field)
[ "def", "get_queue_field", "(", "self", ",", "field", ")", ":", "return", "self", ".", "sab_api", ".", "queue", ".", "get", "(", "field", ")" ]
[ 268, 4 ]
[ 270, 44 ]
python
en
['en', 'en', 'en']
True
setup_platform
(hass, platform: str, *, devices=None, scenes=None)
Set up the SmartThings platform and prerequisites.
Set up the SmartThings platform and prerequisites.
async def setup_platform(hass, platform: str, *, devices=None, scenes=None): """Set up the SmartThings platform and prerequisites.""" hass.config.components.add(DOMAIN) config_entry = ConfigEntry( 2, DOMAIN, "Test", {CONF_INSTALLED_APP_ID: str(uuid4())}, SOURCE_USER, ...
[ "async", "def", "setup_platform", "(", "hass", ",", "platform", ":", "str", ",", "*", ",", "devices", "=", "None", ",", "scenes", "=", "None", ")", ":", "hass", ".", "config", ".", "components", ".", "add", "(", "DOMAIN", ")", "config_entry", "=", "C...
[ 54, 0 ]
[ 73, 23 ]
python
en
['en', 'en', 'en']
True
setup_component
(hass, config_file, hass_storage)
Load the SmartThing component.
Load the SmartThing component.
async def setup_component(hass, config_file, hass_storage): """Load the SmartThing component.""" hass_storage[STORAGE_KEY] = {"data": config_file, "version": STORAGE_VERSION} await async_process_ha_core_config( hass, {"external_url": "https://test.local"}, ) await async_setup_compone...
[ "async", "def", "setup_component", "(", "hass", ",", "config_file", ",", "hass_storage", ")", ":", "hass_storage", "[", "STORAGE_KEY", "]", "=", "{", "\"data\"", ":", "config_file", ",", "\"version\"", ":", "STORAGE_VERSION", "}", "await", "async_process_ha_core_c...
[ 77, 0 ]
[ 84, 56 ]
python
en
['en', 'en', 'en']
True
location_fixture
()
Fixture for a single location.
Fixture for a single location.
def location_fixture(): """Fixture for a single location.""" return _create_location()
[ "def", "location_fixture", "(", ")", ":", "return", "_create_location", "(", ")" ]
[ 95, 0 ]
[ 97, 29 ]
python
en
['en', 'en', 'en']
True
locations_fixture
(location)
Fixture for 2 locations.
Fixture for 2 locations.
def locations_fixture(location): """Fixture for 2 locations.""" return [location, _create_location()]
[ "def", "locations_fixture", "(", "location", ")", ":", "return", "[", "location", ",", "_create_location", "(", ")", "]" ]
[ 101, 0 ]
[ 103, 41 ]
python
en
['en', 'en', 'en']
True
app_fixture
(hass, config_file)
Fixture for a single app.
Fixture for a single app.
async def app_fixture(hass, config_file): """Fixture for a single app.""" app = Mock(AppEntity) app.app_name = APP_NAME_PREFIX + str(uuid4()) app.app_id = str(uuid4()) app.app_type = "WEBHOOK_SMART_APP" app.classifications = [CLASSIFICATION_AUTOMATION] app.display_name = "Home Assistant" ...
[ "async", "def", "app_fixture", "(", "hass", ",", "config_file", ")", ":", "app", "=", "Mock", "(", "AppEntity", ")", "app", ".", "app_name", "=", "APP_NAME_PREFIX", "+", "str", "(", "uuid4", "(", ")", ")", "app", ".", "app_id", "=", "str", "(", "uuid...
[ 107, 0 ]
[ 125, 14 ]
python
en
['en', 'en', 'en']
True
app_oauth_client_fixture
()
Fixture for a single app's oauth.
Fixture for a single app's oauth.
def app_oauth_client_fixture(): """Fixture for a single app's oauth.""" client = Mock(AppOAuthClient) client.client_id = str(uuid4()) client.client_secret = str(uuid4()) return client
[ "def", "app_oauth_client_fixture", "(", ")", ":", "client", "=", "Mock", "(", "AppOAuthClient", ")", "client", ".", "client_id", "=", "str", "(", "uuid4", "(", ")", ")", "client", ".", "client_secret", "=", "str", "(", "uuid4", "(", ")", ")", "return", ...
[ 129, 0 ]
[ 134, 17 ]
python
en
['en', 'en', 'en']
True
app_settings_fixture
(app, config_file)
Fixture for an app settings.
Fixture for an app settings.
def app_settings_fixture(app, config_file): """Fixture for an app settings.""" settings = Mock(AppSettings) settings.app_id = app.app_id settings.settings = {SETTINGS_INSTANCE_ID: config_file[CONF_INSTANCE_ID]} return settings
[ "def", "app_settings_fixture", "(", "app", ",", "config_file", ")", ":", "settings", "=", "Mock", "(", "AppSettings", ")", "settings", ".", "app_id", "=", "app", ".", "app_id", "settings", ".", "settings", "=", "{", "SETTINGS_INSTANCE_ID", ":", "config_file", ...
[ 138, 0 ]
[ 143, 19 ]
python
en
['en', 'en', 'en']
True
installed_app_fixture
(location, app)
Fixture for a single installed app.
Fixture for a single installed app.
def installed_app_fixture(location, app): """Fixture for a single installed app.""" return _create_installed_app(location.location_id, app.app_id)
[ "def", "installed_app_fixture", "(", "location", ",", "app", ")", ":", "return", "_create_installed_app", "(", "location", ".", "location_id", ",", "app", ".", "app_id", ")" ]
[ 157, 0 ]
[ 159, 66 ]
python
en
['en', 'en', 'en']
True
installed_apps_fixture
(installed_app, locations, app)
Fixture for 2 installed apps.
Fixture for 2 installed apps.
def installed_apps_fixture(installed_app, locations, app): """Fixture for 2 installed apps.""" return [installed_app, _create_installed_app(locations[1].location_id, app.app_id)]
[ "def", "installed_apps_fixture", "(", "installed_app", ",", "locations", ",", "app", ")", ":", "return", "[", "installed_app", ",", "_create_installed_app", "(", "locations", "[", "1", "]", ".", "location_id", ",", "app", ".", "app_id", ")", "]" ]
[ 163, 0 ]
[ 165, 87 ]
python
en
['en', 'en', 'en']
True
config_file_fixture
()
Fixture representing the local config file contents.
Fixture representing the local config file contents.
def config_file_fixture(): """Fixture representing the local config file contents.""" return {CONF_INSTANCE_ID: str(uuid4()), CONF_WEBHOOK_ID: secrets.token_hex()}
[ "def", "config_file_fixture", "(", ")", ":", "return", "{", "CONF_INSTANCE_ID", ":", "str", "(", "uuid4", "(", ")", ")", ",", "CONF_WEBHOOK_ID", ":", "secrets", ".", "token_hex", "(", ")", "}" ]
[ 169, 0 ]
[ 171, 81 ]
python
en
['en', 'en', 'en']
True
smartthings_mock_fixture
(locations)
Fixture to mock smartthings API calls.
Fixture to mock smartthings API calls.
def smartthings_mock_fixture(locations): """Fixture to mock smartthings API calls.""" async def _location(location_id): return next( location for location in locations if location.location_id == location_id ) smartthings_mock = Mock(SmartThings) smartthings_mock.location.si...
[ "def", "smartthings_mock_fixture", "(", "locations", ")", ":", "async", "def", "_location", "(", "location_id", ")", ":", "return", "next", "(", "location", "for", "location", "in", "locations", "if", "location", ".", "location_id", "==", "location_id", ")", "...
[ 175, 0 ]
[ 189, 30 ]
python
en
['en', 'mi', 'en']
True
device_fixture
(location)
Fixture representing devices loaded.
Fixture representing devices loaded.
def device_fixture(location): """Fixture representing devices loaded.""" item = Mock(DeviceEntity) item.device_id = "743de49f-036f-4e9c-839a-2f89d57607db" item.name = "GE In-Wall Smart Dimmer" item.label = "Front Porch Lights" item.location_id = location.location_id item.capabilities = [ ...
[ "def", "device_fixture", "(", "location", ")", ":", "item", "=", "Mock", "(", "DeviceEntity", ")", "item", ".", "device_id", "=", "\"743de49f-036f-4e9c-839a-2f89d57607db\"", "item", ".", "name", "=", "\"GE In-Wall Smart Dimmer\"", "item", ".", "label", "=", "\"Fro...
[ 193, 0 ]
[ 212, 15 ]
python
en
['tl', 'en', 'en']
True
config_entry_fixture
(hass, installed_app, location)
Fixture representing a config entry.
Fixture representing a config entry.
def config_entry_fixture(hass, installed_app, location): """Fixture representing a config entry.""" data = { CONF_ACCESS_TOKEN: str(uuid4()), CONF_INSTALLED_APP_ID: installed_app.installed_app_id, CONF_APP_ID: installed_app.app_id, CONF_LOCATION_ID: location.location_id, ...
[ "def", "config_entry_fixture", "(", "hass", ",", "installed_app", ",", "location", ")", ":", "data", "=", "{", "CONF_ACCESS_TOKEN", ":", "str", "(", "uuid4", "(", ")", ")", ",", "CONF_INSTALLED_APP_ID", ":", "installed_app", ".", "installed_app_id", ",", "CONF...
[ 216, 0 ]
[ 234, 5 ]
python
en
['en', 'en', 'en']
True
subscription_factory_fixture
()
Fixture for creating mock subscriptions.
Fixture for creating mock subscriptions.
def subscription_factory_fixture(): """Fixture for creating mock subscriptions.""" def _factory(capability): sub = Subscription() sub.capability = capability return sub return _factory
[ "def", "subscription_factory_fixture", "(", ")", ":", "def", "_factory", "(", "capability", ")", ":", "sub", "=", "Subscription", "(", ")", "sub", ".", "capability", "=", "capability", "return", "sub", "return", "_factory" ]
[ 238, 0 ]
[ 246, 19 ]
python
en
['en', 'en', 'en']
True
device_factory_fixture
()
Fixture for creating mock devices.
Fixture for creating mock devices.
def device_factory_fixture(): """Fixture for creating mock devices.""" api = Mock(Api) api.post_device_command.return_value = {"results": [{"status": "ACCEPTED"}]} def _factory(label, capabilities, status: dict = None): device_data = { "deviceId": str(uuid4()), "name": "...
[ "def", "device_factory_fixture", "(", ")", ":", "api", "=", "Mock", "(", "Api", ")", "api", ".", "post_device_command", ".", "return_value", "=", "{", "\"results\"", ":", "[", "{", "\"status\"", ":", "\"ACCEPTED\"", "}", "]", "}", "def", "_factory", "(", ...
[ 250, 0 ]
[ 283, 19 ]
python
en
['en', 'en', 'en']
True
scene_factory_fixture
(location)
Fixture for creating mock devices.
Fixture for creating mock devices.
def scene_factory_fixture(location): """Fixture for creating mock devices.""" def _factory(name): scene = Mock(SceneEntity) scene.scene_id = str(uuid4()) scene.name = name scene.location_id = location.location_id return scene return _factory
[ "def", "scene_factory_fixture", "(", "location", ")", ":", "def", "_factory", "(", "name", ")", ":", "scene", "=", "Mock", "(", "SceneEntity", ")", "scene", ".", "scene_id", "=", "str", "(", "uuid4", "(", ")", ")", "scene", ".", "name", "=", "name", ...
[ 287, 0 ]
[ 297, 19 ]
python
en
['en', 'en', 'en']
True
scene_fixture
(scene_factory)
Fixture for an individual scene.
Fixture for an individual scene.
def scene_fixture(scene_factory): """Fixture for an individual scene.""" return scene_factory("Test Scene")
[ "def", "scene_fixture", "(", "scene_factory", ")", ":", "return", "scene_factory", "(", "\"Test Scene\"", ")" ]
[ 301, 0 ]
[ 303, 38 ]
python
en
['en', 'en', 'en']
True
event_factory_fixture
()
Fixture for creating mock devices.
Fixture for creating mock devices.
def event_factory_fixture(): """Fixture for creating mock devices.""" def _factory( device_id, event_type="DEVICE_EVENT", capability="", attribute="Updated", value="Value", data=None, ): event = Mock() event.event_type = event_type eve...
[ "def", "event_factory_fixture", "(", ")", ":", "def", "_factory", "(", "device_id", ",", "event_type", "=", "\"DEVICE_EVENT\"", ",", "capability", "=", "\"\"", ",", "attribute", "=", "\"Updated\"", ",", "value", "=", "\"Value\"", ",", "data", "=", "None", ",...
[ 307, 0 ]
[ 329, 19 ]
python
en
['en', 'en', 'en']
True
event_request_factory_fixture
(event_factory)
Fixture for creating mock smartapp event requests.
Fixture for creating mock smartapp event requests.
def event_request_factory_fixture(event_factory): """Fixture for creating mock smartapp event requests.""" def _factory(device_ids=None, events=None): request = Mock() request.installed_app_id = uuid4() if events is None: events = [] if device_ids: events...
[ "def", "event_request_factory_fixture", "(", "event_factory", ")", ":", "def", "_factory", "(", "device_ids", "=", "None", ",", "events", "=", "None", ")", ":", "request", "=", "Mock", "(", ")", "request", ".", "installed_app_id", "=", "uuid4", "(", ")", "...
[ 333, 0 ]
[ 348, 19 ]
python
en
['no', 'en', 'en']
True
async_setup_entry
( hass: HomeAssistantType, entry: ConfigEntry, async_add_entities )
Set up device tracker for iCloud component.
Set up device tracker for iCloud component.
async def async_setup_entry( hass: HomeAssistantType, entry: ConfigEntry, async_add_entities ) -> None: """Set up device tracker for iCloud component.""" account = hass.data[DOMAIN][entry.unique_id] tracked = set() @callback def update_account(): """Update the values of the account.""" ...
[ "async", "def", "async_setup_entry", "(", "hass", ":", "HomeAssistantType", ",", "entry", ":", "ConfigEntry", ",", "async_add_entities", ")", "->", "None", ":", "account", "=", "hass", ".", "data", "[", "DOMAIN", "]", "[", "entry", ".", "unique_id", "]", "...
[ 15, 0 ]
[ 31, 20 ]
python
en
['en', 'en', 'en']
True
add_entities
(account, async_add_entities, tracked)
Add new tracker entities from the account.
Add new tracker entities from the account.
def add_entities(account, async_add_entities, tracked): """Add new tracker entities from the account.""" new_tracked = [] for dev_id, device in account.devices.items(): if dev_id in tracked or device.battery_level is None: continue new_tracked.append(IcloudDeviceBatterySensor(a...
[ "def", "add_entities", "(", "account", ",", "async_add_entities", ",", "tracked", ")", ":", "new_tracked", "=", "[", "]", "for", "dev_id", ",", "device", "in", "account", ".", "devices", ".", "items", "(", ")", ":", "if", "dev_id", "in", "tracked", "or",...
[ 35, 0 ]
[ 47, 45 ]
python
en
['en', 'en', 'en']
True
IcloudDeviceBatterySensor.__init__
(self, account: IcloudAccount, device: IcloudDevice)
Initialize the battery sensor.
Initialize the battery sensor.
def __init__(self, account: IcloudAccount, device: IcloudDevice): """Initialize the battery sensor.""" self._account = account self._device = device self._unsub_dispatcher = None
[ "def", "__init__", "(", "self", ",", "account", ":", "IcloudAccount", ",", "device", ":", "IcloudDevice", ")", ":", "self", ".", "_account", "=", "account", "self", ".", "_device", "=", "device", "self", ".", "_unsub_dispatcher", "=", "None" ]
[ 53, 4 ]
[ 57, 37 ]
python
en
['en', 'en', 'en']
True