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
test_config_options
(hass)
Test configuration options.
Test configuration options.
async def test_config_options(hass): """Test configuration options.""" count_start = len(hass.states.async_entity_ids()) _LOGGER.debug("ENTITIES @ start: %s", hass.states.async_entity_ids()) config = { DOMAIN: { "test_1": {}, "test_2": { CONF_NAME: "Hell...
[ "async", "def", "test_config_options", "(", "hass", ")", ":", "count_start", "=", "len", "(", "hass", ".", "states", ".", "async_entity_ids", "(", ")", ")", "_LOGGER", ".", "debug", "(", "\"ENTITIES @ start: %s\"", ",", "hass", ".", "states", ".", "async_ent...
[ 80, 0 ]
[ 125, 60 ]
python
en
['en', 'fr', 'en']
True
test_methods
(hass)
Test increment, decrement, and reset methods.
Test increment, decrement, and reset methods.
async def test_methods(hass): """Test increment, decrement, and reset methods.""" config = {DOMAIN: {"test_1": {}}} assert await async_setup_component(hass, "counter", config) entity_id = "counter.test_1" state = hass.states.get(entity_id) assert 0 == int(state.state) async_increment(has...
[ "async", "def", "test_methods", "(", "hass", ")", ":", "config", "=", "{", "DOMAIN", ":", "{", "\"test_1\"", ":", "{", "}", "}", "}", "assert", "await", "async_setup_component", "(", "hass", ",", "\"counter\"", ",", "config", ")", "entity_id", "=", "\"co...
[ 128, 0 ]
[ 161, 32 ]
python
en
['en', 'nl', 'en']
True
test_methods_with_config
(hass)
Test increment, decrement, and reset methods with configuration.
Test increment, decrement, and reset methods with configuration.
async def test_methods_with_config(hass): """Test increment, decrement, and reset methods with configuration.""" config = { DOMAIN: {"test": {CONF_NAME: "Hello World", CONF_INITIAL: 10, CONF_STEP: 5}} } assert await async_setup_component(hass, "counter", config) entity_id = "counter.test" ...
[ "async", "def", "test_methods_with_config", "(", "hass", ")", ":", "config", "=", "{", "DOMAIN", ":", "{", "\"test\"", ":", "{", "CONF_NAME", ":", "\"Hello World\"", ",", "CONF_INITIAL", ":", "10", ",", "CONF_STEP", ":", "5", "}", "}", "}", "assert", "aw...
[ 164, 0 ]
[ 193, 33 ]
python
en
['en', 'en', 'en']
True
test_initial_state_overrules_restore_state
(hass)
Ensure states are restored on startup.
Ensure states are restored on startup.
async def test_initial_state_overrules_restore_state(hass): """Ensure states are restored on startup.""" mock_restore_cache( hass, (State("counter.test1", "11"), State("counter.test2", "-22")) ) hass.state = CoreState.starting await async_setup_component( hass, DOMAIN, ...
[ "async", "def", "test_initial_state_overrules_restore_state", "(", "hass", ")", ":", "mock_restore_cache", "(", "hass", ",", "(", "State", "(", "\"counter.test1\"", ",", "\"11\"", ")", ",", "State", "(", "\"counter.test2\"", ",", "\"-22\"", ")", ")", ")", "hass"...
[ 196, 0 ]
[ 221, 33 ]
python
en
['en', 'en', 'en']
True
test_restore_state_overrules_initial_state
(hass)
Ensure states are restored on startup.
Ensure states are restored on startup.
async def test_restore_state_overrules_initial_state(hass): """Ensure states are restored on startup.""" attr = {"initial": 6, "minimum": 1, "maximum": 8, "step": 2} mock_restore_cache( hass, ( State("counter.test1", "11"), State("counter.test2", "-22"), ...
[ "async", "def", "test_restore_state_overrules_initial_state", "(", "hass", ")", ":", "attr", "=", "{", "\"initial\"", ":", "6", ",", "\"minimum\"", ":", "1", ",", "\"maximum\"", ":", "8", ",", "\"step\"", ":", "2", "}", "mock_restore_cache", "(", "hass", ","...
[ 224, 0 ]
[ 258, 44 ]
python
en
['en', 'en', 'en']
True
test_no_initial_state_and_no_restore_state
(hass)
Ensure that entity is create without initial and restore feature.
Ensure that entity is create without initial and restore feature.
async def test_no_initial_state_and_no_restore_state(hass): """Ensure that entity is create without initial and restore feature.""" hass.state = CoreState.starting await async_setup_component(hass, DOMAIN, {DOMAIN: {"test1": {CONF_STEP: 5}}}) state = hass.states.get("counter.test1") assert state ...
[ "async", "def", "test_no_initial_state_and_no_restore_state", "(", "hass", ")", ":", "hass", ".", "state", "=", "CoreState", ".", "starting", "await", "async_setup_component", "(", "hass", ",", "DOMAIN", ",", "{", "DOMAIN", ":", "{", "\"test1\"", ":", "{", "CO...
[ 261, 0 ]
[ 269, 32 ]
python
en
['en', 'en', 'en']
True
test_counter_context
(hass, hass_admin_user)
Test that counter context works.
Test that counter context works.
async def test_counter_context(hass, hass_admin_user): """Test that counter context works.""" assert await async_setup_component(hass, "counter", {"counter": {"test": {}}}) state = hass.states.get("counter.test") assert state is not None await hass.services.async_call( "counter", "...
[ "async", "def", "test_counter_context", "(", "hass", ",", "hass_admin_user", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "\"counter\"", ",", "{", "\"counter\"", ":", "{", "\"test\"", ":", "{", "}", "}", "}", ")", "state", "=", "...
[ 272, 0 ]
[ 290, 55 ]
python
en
['en', 'en', 'en']
True
test_counter_min
(hass, hass_admin_user)
Test that min works.
Test that min works.
async def test_counter_min(hass, hass_admin_user): """Test that min works.""" assert await async_setup_component( hass, "counter", {"counter": {"test": {"minimum": "0", "initial": "0"}}} ) state = hass.states.get("counter.test") assert state is not None assert state.state == "0" aw...
[ "async", "def", "test_counter_min", "(", "hass", ",", "hass_admin_user", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "\"counter\"", ",", "{", "\"counter\"", ":", "{", "\"test\"", ":", "{", "\"minimum\"", ":", "\"0\"", ",", "\"initia...
[ 293, 0 ]
[ 325, 30 ]
python
en
['en', 'en', 'en']
True
test_counter_max
(hass, hass_admin_user)
Test that max works.
Test that max works.
async def test_counter_max(hass, hass_admin_user): """Test that max works.""" assert await async_setup_component( hass, "counter", {"counter": {"test": {"maximum": "0", "initial": "0"}}} ) state = hass.states.get("counter.test") assert state is not None assert state.state == "0" aw...
[ "async", "def", "test_counter_max", "(", "hass", ",", "hass_admin_user", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "\"counter\"", ",", "{", "\"counter\"", ":", "{", "\"test\"", ":", "{", "\"maximum\"", ":", "\"0\"", ",", "\"initia...
[ 328, 0 ]
[ 360, 31 ]
python
en
['en', 'en', 'en']
True
test_configure
(hass, hass_admin_user)
Test that setting values through configure works.
Test that setting values through configure works.
async def test_configure(hass, hass_admin_user): """Test that setting values through configure works.""" assert await async_setup_component( hass, "counter", {"counter": {"test": {"maximum": "10", "initial": "10"}}} ) state = hass.states.get("counter.test") assert state is not None asse...
[ "async", "def", "test_configure", "(", "hass", ",", "hass_admin_user", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "\"counter\"", ",", "{", "\"counter\"", ":", "{", "\"test\"", ":", "{", "\"maximum\"", ":", "\"10\"", ",", "\"initial...
[ 363, 0 ]
[ 495, 47 ]
python
en
['en', 'en', 'en']
True
test_load_from_storage
(hass, storage_setup)
Test set up from storage.
Test set up from storage.
async def test_load_from_storage(hass, storage_setup): """Test set up from storage.""" assert await storage_setup() state = hass.states.get(f"{DOMAIN}.from_storage") assert int(state.state) == 10 assert state.attributes.get(ATTR_FRIENDLY_NAME) == "from storage" assert state.attributes.get(ATTR_E...
[ "async", "def", "test_load_from_storage", "(", "hass", ",", "storage_setup", ")", ":", "assert", "await", "storage_setup", "(", ")", "state", "=", "hass", ".", "states", ".", "get", "(", "f\"{DOMAIN}.from_storage\"", ")", "assert", "int", "(", "state", ".", ...
[ 498, 0 ]
[ 504, 46 ]
python
en
['en', 'en', 'en']
True
test_editable_state_attribute
(hass, storage_setup)
Test editable attribute.
Test editable attribute.
async def test_editable_state_attribute(hass, storage_setup): """Test editable attribute.""" assert await storage_setup( config={ DOMAIN: { "from_yaml": { "minimum": 1, "maximum": 10, "initial": 5, ...
[ "async", "def", "test_editable_state_attribute", "(", "hass", ",", "storage_setup", ")", ":", "assert", "await", "storage_setup", "(", "config", "=", "{", "DOMAIN", ":", "{", "\"from_yaml\"", ":", "{", "\"minimum\"", ":", "1", ",", "\"maximum\"", ":", "10", ...
[ 507, 0 ]
[ 530, 51 ]
python
de
['de', 'et', 'en']
False
test_ws_list
(hass, hass_ws_client, storage_setup)
Test listing via WS.
Test listing via WS.
async def test_ws_list(hass, hass_ws_client, storage_setup): """Test listing via WS.""" assert await storage_setup( config={ DOMAIN: { "from_yaml": { "minimum": 1, "maximum": 10, "initial": 5, "st...
[ "async", "def", "test_ws_list", "(", "hass", ",", "hass_ws_client", ",", "storage_setup", ")", ":", "assert", "await", "storage_setup", "(", "config", "=", "{", "DOMAIN", ":", "{", "\"from_yaml\"", ":", "{", "\"minimum\"", ":", "1", ",", "\"maximum\"", ":", ...
[ 533, 0 ]
[ 562, 59 ]
python
hmn
['nl', 'hmn', 'it']
False
test_ws_delete
(hass, hass_ws_client, storage_setup)
Test WS delete cleans up entity registry.
Test WS delete cleans up entity registry.
async def test_ws_delete(hass, hass_ws_client, storage_setup): """Test WS delete cleans up entity registry.""" assert await storage_setup() input_id = "from_storage" input_entity_id = f"{DOMAIN}.{input_id}" ent_reg = await entity_registry.async_get_registry(hass) state = hass.states.get(input_...
[ "async", "def", "test_ws_delete", "(", "hass", ",", "hass_ws_client", ",", "storage_setup", ")", ":", "assert", "await", "storage_setup", "(", ")", "input_id", "=", "\"from_storage\"", "input_entity_id", "=", "f\"{DOMAIN}.{input_id}\"", "ent_reg", "=", "await", "ent...
[ 565, 0 ]
[ 587, 72 ]
python
en
['en', 'en', 'en']
True
test_update_min_max
(hass, hass_ws_client, storage_setup)
Test updating min/max updates the state.
Test updating min/max updates the state.
async def test_update_min_max(hass, hass_ws_client, storage_setup): """Test updating min/max updates the state.""" items = [ { "id": "from_storage", "initial": 15, "name": "from storage", "maximum": 100, "minimum": 10, "step": 3, ...
[ "async", "def", "test_update_min_max", "(", "hass", ",", "hass_ws_client", ",", "storage_setup", ")", ":", "items", "=", "[", "{", "\"id\"", ":", "\"from_storage\"", ",", "\"initial\"", ":", "15", ",", "\"name\"", ":", "\"from storage\"", ",", "\"maximum\"", "...
[ 590, 0 ]
[ 673, 43 ]
python
en
['en', 'en', 'en']
True
test_create
(hass, hass_ws_client, storage_setup)
Test creating counter using WS.
Test creating counter using WS.
async def test_create(hass, hass_ws_client, storage_setup): """Test creating counter using WS.""" items = [] assert await storage_setup(items) counter_id = "new_counter" input_entity_id = f"{DOMAIN}.{counter_id}" ent_reg = await entity_registry.async_get_registry(hass) state = hass.state...
[ "async", "def", "test_create", "(", "hass", ",", "hass_ws_client", ",", "storage_setup", ")", ":", "items", "=", "[", "]", "assert", "await", "storage_setup", "(", "items", ")", "counter_id", "=", "\"new_counter\"", "input_entity_id", "=", "f\"{DOMAIN}.{counter_id...
[ 676, 0 ]
[ 701, 43 ]
python
en
['fr', 'en', 'en']
True
async_setup_entry
(hass, config_entry, async_add_entities)
Initialize sensor platform from config entry.
Initialize sensor platform from config entry.
async def async_setup_entry(hass, config_entry, async_add_entities): """Initialize sensor platform from config entry.""" coordinator = hass.data[DOMAIN][config_entry.entry_id] entities = [] for sensor in SENSORS: entities.append(AtagSensor(coordinator, sensor)) async_add_entities(entities)
[ "async", "def", "async_setup_entry", "(", "hass", ",", "config_entry", ",", "async_add_entities", ")", ":", "coordinator", "=", "hass", ".", "data", "[", "DOMAIN", "]", "[", "config_entry", ".", "entry_id", "]", "entities", "=", "[", "]", "for", "sensor", ...
[ 25, 0 ]
[ 31, 32 ]
python
en
['en', 'pt', 'en']
True
AtagSensor.__init__
(self, coordinator, sensor)
Initialize Atag sensor.
Initialize Atag sensor.
def __init__(self, coordinator, sensor): """Initialize Atag sensor.""" super().__init__(coordinator, SENSORS[sensor]) self._name = sensor
[ "def", "__init__", "(", "self", ",", "coordinator", ",", "sensor", ")", ":", "super", "(", ")", ".", "__init__", "(", "coordinator", ",", "SENSORS", "[", "sensor", "]", ")", "self", ".", "_name", "=", "sensor" ]
[ 37, 4 ]
[ 40, 27 ]
python
de
['de', 'pt', 'it']
False
AtagSensor.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.coordinator.data[self._id].state
[ "def", "state", "(", "self", ")", ":", "return", "self", ".", "coordinator", ".", "data", "[", "self", ".", "_id", "]", ".", "state" ]
[ 43, 4 ]
[ 45, 52 ]
python
en
['en', 'en', 'en']
True
AtagSensor.icon
(self)
Return icon.
Return icon.
def icon(self): """Return icon.""" return self.coordinator.data[self._id].icon
[ "def", "icon", "(", "self", ")", ":", "return", "self", ".", "coordinator", ".", "data", "[", "self", ".", "_id", "]", ".", "icon" ]
[ 48, 4 ]
[ 50, 51 ]
python
en
['en', 'la', 'en']
False
AtagSensor.device_class
(self)
Return deviceclass.
Return deviceclass.
def device_class(self): """Return deviceclass.""" if self.coordinator.data[self._id].sensorclass in [ DEVICE_CLASS_PRESSURE, DEVICE_CLASS_TEMPERATURE, ]: return self.coordinator.data[self._id].sensorclass return None
[ "def", "device_class", "(", "self", ")", ":", "if", "self", ".", "coordinator", ".", "data", "[", "self", ".", "_id", "]", ".", "sensorclass", "in", "[", "DEVICE_CLASS_PRESSURE", ",", "DEVICE_CLASS_TEMPERATURE", ",", "]", ":", "return", "self", ".", "coord...
[ 53, 4 ]
[ 60, 19 ]
python
en
['es', 'fy', 'en']
False
AtagSensor.unit_of_measurement
(self)
Return measure.
Return measure.
def unit_of_measurement(self): """Return measure.""" if self.coordinator.data[self._id].measure in [ PRESSURE_BAR, TEMP_CELSIUS, TEMP_FAHRENHEIT, PERCENTAGE, TIME_HOURS, ]: return self.coordinator.data[self._id].measure ...
[ "def", "unit_of_measurement", "(", "self", ")", ":", "if", "self", ".", "coordinator", ".", "data", "[", "self", ".", "_id", "]", ".", "measure", "in", "[", "PRESSURE_BAR", ",", "TEMP_CELSIUS", ",", "TEMP_FAHRENHEIT", ",", "PERCENTAGE", ",", "TIME_HOURS", ...
[ 63, 4 ]
[ 73, 19 ]
python
en
['en', 'id', 'en']
False
_extract_images
(filename, num_images)
Extract the images into a numpy array. Args: filename: The path to an MNIST images file. num_images: The number of images in the file. Returns: A numpy array of shape [number_of_images, height, width, channels].
Extract the images into a numpy array.
def _extract_images(filename, num_images): """Extract the images into a numpy array. Args: filename: The path to an MNIST images file. num_images: The number of images in the file. Returns: A numpy array of shape [number_of_images, height, width, channels]. """ print('Extracting images from: ', ...
[ "def", "_extract_images", "(", "filename", ",", "num_images", ")", ":", "print", "(", "'Extracting images from: '", ",", "filename", ")", "with", "gzip", ".", "open", "(", "filename", ")", "as", "bytestream", ":", "bytestream", ".", "read", "(", "16", ")", ...
[ 63, 0 ]
[ 80, 13 ]
python
en
['en', 'en', 'en']
True
_extract_labels
(filename, num_labels)
Extract the labels into a vector of int64 label IDs. Args: filename: The path to an MNIST labels file. num_labels: The number of labels in the file. Returns: A numpy array of shape [number_of_labels]
Extract the labels into a vector of int64 label IDs.
def _extract_labels(filename, num_labels): """Extract the labels into a vector of int64 label IDs. Args: filename: The path to an MNIST labels file. num_labels: The number of labels in the file. Returns: A numpy array of shape [number_of_labels] """ print('Extracting labels from: ', filename) ...
[ "def", "_extract_labels", "(", "filename", ",", "num_labels", ")", ":", "print", "(", "'Extracting labels from: '", ",", "filename", ")", "with", "gzip", ".", "open", "(", "filename", ")", "as", "bytestream", ":", "bytestream", ".", "read", "(", "8", ")", ...
[ 83, 0 ]
[ 98, 15 ]
python
en
['en', 'en', 'en']
True
_add_to_tfrecord
(data_filename, labels_filename, num_images, tfrecord_writer)
Loads data from the binary MNIST files and writes files to a TFRecord. Args: data_filename: The filename of the MNIST images. labels_filename: The filename of the MNIST labels. num_images: The number of images in the dataset. tfrecord_writer: The TFRecord writer to use for writing.
Loads data from the binary MNIST files and writes files to a TFRecord.
def _add_to_tfrecord(data_filename, labels_filename, num_images, tfrecord_writer): """Loads data from the binary MNIST files and writes files to a TFRecord. Args: data_filename: The filename of the MNIST images. labels_filename: The filename of the MNIST labels. num_images: The num...
[ "def", "_add_to_tfrecord", "(", "data_filename", ",", "labels_filename", ",", "num_images", ",", "tfrecord_writer", ")", ":", "images", "=", "_extract_images", "(", "data_filename", ",", "num_images", ")", "labels", "=", "_extract_labels", "(", "labels_filename", ",...
[ 101, 0 ]
[ 128, 58 ]
python
en
['en', 'en', 'en']
True
_get_output_filename
(dataset_dir, split_name)
Creates the output filename. Args: dataset_dir: The directory where the temporary files are stored. split_name: The name of the train/test split. Returns: An absolute file path.
Creates the output filename.
def _get_output_filename(dataset_dir, split_name): """Creates the output filename. Args: dataset_dir: The directory where the temporary files are stored. split_name: The name of the train/test split. Returns: An absolute file path. """ return '%s/mnist_%s.tfrecord' % (dataset_dir, split_name)
[ "def", "_get_output_filename", "(", "dataset_dir", ",", "split_name", ")", ":", "return", "'%s/mnist_%s.tfrecord'", "%", "(", "dataset_dir", ",", "split_name", ")" ]
[ 131, 0 ]
[ 141, 59 ]
python
en
['en', 'sm', 'en']
True
_download_dataset
(dataset_dir)
Downloads MNIST locally. Args: dataset_dir: The directory where the temporary files are stored.
Downloads MNIST locally.
def _download_dataset(dataset_dir): """Downloads MNIST locally. Args: dataset_dir: The directory where the temporary files are stored. """ for filename in [_TRAIN_DATA_FILENAME, _TRAIN_LABELS_FILENAME, _TEST_DATA_FILENAME, _TEST_LABELS_FILENAME]: ...
[ "def", "_download_dataset", "(", "dataset_dir", ")", ":", "for", "filename", "in", "[", "_TRAIN_DATA_FILENAME", ",", "_TRAIN_LABELS_FILENAME", ",", "_TEST_DATA_FILENAME", ",", "_TEST_LABELS_FILENAME", "]", ":", "filepath", "=", "os", ".", "path", ".", "join", "(",...
[ 144, 0 ]
[ 168, 64 ]
python
en
['en', 'de', 'en']
True
_clean_up_temporary_files
(dataset_dir)
Removes temporary files used to create the dataset. Args: dataset_dir: The directory where the temporary files are stored.
Removes temporary files used to create the dataset.
def _clean_up_temporary_files(dataset_dir): """Removes temporary files used to create the dataset. Args: dataset_dir: The directory where the temporary files are stored. """ for filename in [_TRAIN_DATA_FILENAME, _TRAIN_LABELS_FILENAME, _TEST_DATA_FILENAME, ...
[ "def", "_clean_up_temporary_files", "(", "dataset_dir", ")", ":", "for", "filename", "in", "[", "_TRAIN_DATA_FILENAME", ",", "_TRAIN_LABELS_FILENAME", ",", "_TEST_DATA_FILENAME", ",", "_TEST_LABELS_FILENAME", "]", ":", "filepath", "=", "os", ".", "path", ".", "join"...
[ 171, 0 ]
[ 182, 29 ]
python
en
['en', 'en', 'en']
True
run
(dataset_dir)
Runs the download and conversion operation. Args: dataset_dir: The dataset directory where the dataset is stored.
Runs the download and conversion operation.
def run(dataset_dir): """Runs the download and conversion operation. Args: dataset_dir: The dataset directory where the dataset is stored. """ if not tf.gfile.Exists(dataset_dir): tf.gfile.MakeDirs(dataset_dir) training_filename = _get_output_filename(dataset_dir, 'train') testing_filename = _get_...
[ "def", "run", "(", "dataset_dir", ")", ":", "if", "not", "tf", ".", "gfile", ".", "Exists", "(", "dataset_dir", ")", ":", "tf", ".", "gfile", ".", "MakeDirs", "(", "dataset_dir", ")", "training_filename", "=", "_get_output_filename", "(", "dataset_dir", ",...
[ 185, 0 ]
[ 220, 51 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
(hass, config_entry, async_add_entities)
Add locks for a config entry.
Add locks for a config entry.
async def async_setup_entry(hass, config_entry, async_add_entities): """Add locks for a config entry.""" broker = hass.data[DOMAIN][DATA_BROKERS][config_entry.entry_id] async_add_entities( [ SmartThingsLock(device) for device in broker.devices.values() if broker.a...
[ "async", "def", "async_setup_entry", "(", "hass", ",", "config_entry", ",", "async_add_entities", ")", ":", "broker", "=", "hass", ".", "data", "[", "DOMAIN", "]", "[", "DATA_BROKERS", "]", "[", "config_entry", ".", "entry_id", "]", "async_add_entities", "(", ...
[ 21, 0 ]
[ 30, 5 ]
python
en
['en', 'cy', 'en']
True
get_capabilities
(capabilities: Sequence[str])
Return all capabilities supported if minimum required are present.
Return all capabilities supported if minimum required are present.
def get_capabilities(capabilities: Sequence[str]) -> Optional[Sequence[str]]: """Return all capabilities supported if minimum required are present.""" if Capability.lock in capabilities: return [Capability.lock] return None
[ "def", "get_capabilities", "(", "capabilities", ":", "Sequence", "[", "str", "]", ")", "->", "Optional", "[", "Sequence", "[", "str", "]", "]", ":", "if", "Capability", ".", "lock", "in", "capabilities", ":", "return", "[", "Capability", ".", "lock", "]"...
[ 33, 0 ]
[ 37, 15 ]
python
en
['en', 'en', 'en']
True
SmartThingsLock.async_lock
(self, **kwargs)
Lock the device.
Lock the device.
async def async_lock(self, **kwargs): """Lock the device.""" await self._device.lock(set_status=True) self.async_write_ha_state()
[ "async", "def", "async_lock", "(", "self", ",", "*", "*", "kwargs", ")", ":", "await", "self", ".", "_device", ".", "lock", "(", "set_status", "=", "True", ")", "self", ".", "async_write_ha_state", "(", ")" ]
[ 43, 4 ]
[ 46, 35 ]
python
en
['en', 'en', 'en']
True
SmartThingsLock.async_unlock
(self, **kwargs)
Unlock the device.
Unlock the device.
async def async_unlock(self, **kwargs): """Unlock the device.""" await self._device.unlock(set_status=True) self.async_write_ha_state()
[ "async", "def", "async_unlock", "(", "self", ",", "*", "*", "kwargs", ")", ":", "await", "self", ".", "_device", ".", "unlock", "(", "set_status", "=", "True", ")", "self", ".", "async_write_ha_state", "(", ")" ]
[ 48, 4 ]
[ 51, 35 ]
python
en
['en', 'zh', 'en']
True
SmartThingsLock.is_locked
(self)
Return true if lock is locked.
Return true if lock is locked.
def is_locked(self): """Return true if lock is locked.""" return self._device.status.lock == ST_STATE_LOCKED
[ "def", "is_locked", "(", "self", ")", ":", "return", "self", ".", "_device", ".", "status", ".", "lock", "==", "ST_STATE_LOCKED" ]
[ 54, 4 ]
[ 56, 58 ]
python
en
['en', 'mt', 'en']
True
SmartThingsLock.device_state_attributes
(self)
Return device specific state attributes.
Return device specific state attributes.
def device_state_attributes(self): """Return device specific state attributes.""" state_attrs = {} status = self._device.status.attributes[Attribute.lock] if status.value: state_attrs["lock_state"] = status.value if isinstance(status.data, dict): for st_at...
[ "def", "device_state_attributes", "(", "self", ")", ":", "state_attrs", "=", "{", "}", "status", "=", "self", ".", "_device", ".", "status", ".", "attributes", "[", "Attribute", ".", "lock", "]", "if", "status", ".", "value", ":", "state_attrs", "[", "\"...
[ 59, 4 ]
[ 70, 26 ]
python
en
['fr', 'en', 'en']
True
test_switch_set_state
(hass, hk_driver, events)
Test if accessory and HA are updated accordingly.
Test if accessory and HA are updated accordingly.
async def test_switch_set_state(hass, hk_driver, events): """Test if accessory and HA are updated accordingly.""" code = "1234" config = {ATTR_CODE: code} entity_id = "alarm_control_panel.test" hass.states.async_set(entity_id, None) await hass.async_block_till_done() acc = SecuritySystem(ha...
[ "async", "def", "test_switch_set_state", "(", "hass", ",", "hk_driver", ",", "events", ")", ":", "code", "=", "\"1234\"", "config", "=", "{", "ATTR_CODE", ":", "code", "}", "entity_id", "=", "\"alarm_control_panel.test\"", "hass", ".", "states", ".", "async_se...
[ 27, 0 ]
[ 115, 46 ]
python
en
['en', 'en', 'en']
True
test_no_alarm_code
(hass, hk_driver, config, events)
Test accessory if security_system doesn't require an alarm_code.
Test accessory if security_system doesn't require an alarm_code.
async def test_no_alarm_code(hass, hk_driver, config, events): """Test accessory if security_system doesn't require an alarm_code.""" entity_id = "alarm_control_panel.test" hass.states.async_set(entity_id, None) await hass.async_block_till_done() acc = SecuritySystem(hass, hk_driver, "SecuritySyste...
[ "async", "def", "test_no_alarm_code", "(", "hass", ",", "hk_driver", ",", "config", ",", "events", ")", ":", "entity_id", "=", "\"alarm_control_panel.test\"", "hass", ".", "states", ".", "async_set", "(", "entity_id", ",", "None", ")", "await", "hass", ".", ...
[ 119, 0 ]
[ 137, 46 ]
python
en
['en', 'en', 'en']
True
test_supported_states
(hass, hk_driver, events)
Test different supported states.
Test different supported states.
async def test_supported_states(hass, hk_driver, events): """Test different supported states.""" code = "1234" config = {ATTR_CODE: code} entity_id = "alarm_control_panel.test" loader = get_loader() default_current_states = loader.get_char( "SecuritySystemCurrentState" ).properties....
[ "async", "def", "test_supported_states", "(", "hass", ",", "hk_driver", ",", "events", ")", ":", "code", "=", "\"1234\"", "config", "=", "{", "ATTR_CODE", ":", "code", "}", "entity_id", "=", "\"alarm_control_panel.test\"", "loader", "=", "get_loader", "(", ")"...
[ 140, 0 ]
[ 250, 58 ]
python
en
['de', 'en', 'en']
True
async_setup
(hass: HomeAssistant, config: ConfigType)
Set up the Elgato Key Light components.
Set up the Elgato Key Light components.
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up the Elgato Key Light components.""" return True
[ "async", "def", "async_setup", "(", "hass", ":", "HomeAssistant", ",", "config", ":", "ConfigType", ")", "->", "bool", ":", "return", "True" ]
[ 14, 0 ]
[ 16, 15 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
(hass: HomeAssistant, entry: ConfigEntry)
Set up Elgato Key Light from a config entry.
Set up Elgato Key Light from a config entry.
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: """Set up Elgato Key Light from a config entry.""" session = async_get_clientsession(hass) elgato = Elgato( entry.data[CONF_HOST], port=entry.data[CONF_PORT], session=session, ) # Ensure we can con...
[ "async", "def", "async_setup_entry", "(", "hass", ":", "HomeAssistant", ",", "entry", ":", "ConfigEntry", ")", "->", "bool", ":", "session", "=", "async_get_clientsession", "(", "hass", ")", "elgato", "=", "Elgato", "(", "entry", ".", "data", "[", "CONF_HOST...
[ 19, 0 ]
[ 41, 15 ]
python
en
['en', 'en', 'en']
True
async_unload_entry
(hass: HomeAssistant, entry: ConfigEntry)
Unload Elgato Key Light config entry.
Unload Elgato Key Light config entry.
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: """Unload Elgato Key Light config entry.""" # Unload entities for this entry/device. await hass.config_entries.async_forward_entry_unload(entry, LIGHT_DOMAIN) # Cleanup del hass.data[DOMAIN][entry.entry_id] if not ha...
[ "async", "def", "async_unload_entry", "(", "hass", ":", "HomeAssistant", ",", "entry", ":", "ConfigEntry", ")", "->", "bool", ":", "# Unload entities for this entry/device.", "await", "hass", ".", "config_entries", ".", "async_forward_entry_unload", "(", "entry", ",",...
[ 44, 0 ]
[ 54, 15 ]
python
en
['en', 'sv', 'it']
False
async_setup
(hass: HomeAssistantType, config: OrderedDict)
Set up songpal environment.
Set up songpal environment.
async def async_setup(hass: HomeAssistantType, config: OrderedDict) -> bool: """Set up songpal environment.""" conf = config.get(DOMAIN) if conf is None: return True for config_entry in conf: hass.async_create_task( hass.config_entries.flow.async_init( DOMAIN,...
[ "async", "def", "async_setup", "(", "hass", ":", "HomeAssistantType", ",", "config", ":", "OrderedDict", ")", "->", "bool", ":", "conf", "=", "config", ".", "get", "(", "DOMAIN", ")", "if", "conf", "is", "None", ":", "return", "True", "for", "config_entr...
[ 22, 0 ]
[ 35, 15 ]
python
en
['en', 'fil', 'en']
True
async_setup_entry
(hass: HomeAssistantType, entry: ConfigEntry)
Set up songpal media player.
Set up songpal media player.
async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry) -> bool: """Set up songpal media player.""" hass.async_create_task( hass.config_entries.async_forward_entry_setup(entry, "media_player") ) return True
[ "async", "def", "async_setup_entry", "(", "hass", ":", "HomeAssistantType", ",", "entry", ":", "ConfigEntry", ")", "->", "bool", ":", "hass", ".", "async_create_task", "(", "hass", ".", "config_entries", ".", "async_forward_entry_setup", "(", "entry", ",", "\"me...
[ 38, 0 ]
[ 43, 15 ]
python
en
['en', 'fil', 'en']
True
async_unload_entry
(hass: HomeAssistantType, entry: ConfigEntry)
Unload songpal media player.
Unload songpal media player.
async def async_unload_entry(hass: HomeAssistantType, entry: ConfigEntry) -> bool: """Unload songpal media player.""" return await hass.config_entries.async_forward_entry_unload(entry, "media_player")
[ "async", "def", "async_unload_entry", "(", "hass", ":", "HomeAssistantType", ",", "entry", ":", "ConfigEntry", ")", "->", "bool", ":", "return", "await", "hass", ".", "config_entries", ".", "async_forward_entry_unload", "(", "entry", ",", "\"media_player\"", ")" ]
[ 46, 0 ]
[ 48, 86 ]
python
ca
['fr', 'ca', 'en']
False
StarlineFlowHandler.__init__
(self)
Initialize flow.
Initialize flow.
def __init__(self): """Initialize flow.""" self._app_id: Optional[str] = None self._app_secret: Optional[str] = None self._username: Optional[str] = None self._password: Optional[str] = None self._mfa_code: Optional[str] = None self._app_code = None self....
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "_app_id", ":", "Optional", "[", "str", "]", "=", "None", "self", ".", "_app_secret", ":", "Optional", "[", "str", "]", "=", "None", "self", ".", "_username", ":", "Optional", "[", "str", "]", ...
[ 32, 4 ]
[ 51, 35 ]
python
en
['en', 'pl', 'en']
False
StarlineFlowHandler.async_step_user
(self, user_input=None)
Handle a flow initialized by the user.
Handle a flow initialized by the user.
async def async_step_user(self, user_input=None): """Handle a flow initialized by the user.""" return await self.async_step_auth_app(user_input)
[ "async", "def", "async_step_user", "(", "self", ",", "user_input", "=", "None", ")", ":", "return", "await", "self", ".", "async_step_auth_app", "(", "user_input", ")" ]
[ 53, 4 ]
[ 55, 57 ]
python
en
['en', 'en', 'en']
True
StarlineFlowHandler.async_step_auth_app
(self, user_input=None, error=None)
Authenticate application step.
Authenticate application step.
async def async_step_auth_app(self, user_input=None, error=None): """Authenticate application step.""" if user_input is not None: self._app_id = user_input[CONF_APP_ID] self._app_secret = user_input[CONF_APP_SECRET] return await self._async_authenticate_app(error) ...
[ "async", "def", "async_step_auth_app", "(", "self", ",", "user_input", "=", "None", ",", "error", "=", "None", ")", ":", "if", "user_input", "is", "not", "None", ":", "self", ".", "_app_id", "=", "user_input", "[", "CONF_APP_ID", "]", "self", ".", "_app_...
[ 57, 4 ]
[ 63, 47 ]
python
en
['de', 'en', 'en']
True
StarlineFlowHandler.async_step_auth_user
(self, user_input=None, error=None)
Authenticate user step.
Authenticate user step.
async def async_step_auth_user(self, user_input=None, error=None): """Authenticate user step.""" if user_input is not None: self._username = user_input[CONF_USERNAME] self._password = user_input[CONF_PASSWORD] return await self._async_authenticate_user(error) ...
[ "async", "def", "async_step_auth_user", "(", "self", ",", "user_input", "=", "None", ",", "error", "=", "None", ")", ":", "if", "user_input", "is", "not", "None", ":", "self", ".", "_username", "=", "user_input", "[", "CONF_USERNAME", "]", "self", ".", "...
[ 65, 4 ]
[ 71, 48 ]
python
en
['da', 'en', 'en']
True
StarlineFlowHandler.async_step_auth_mfa
(self, user_input=None, error=None)
Authenticate mfa step.
Authenticate mfa step.
async def async_step_auth_mfa(self, user_input=None, error=None): """Authenticate mfa step.""" if user_input is not None: self._mfa_code = user_input[CONF_MFA_CODE] return await self._async_authenticate_user(error) return self._async_form_auth_mfa(error)
[ "async", "def", "async_step_auth_mfa", "(", "self", ",", "user_input", "=", "None", ",", "error", "=", "None", ")", ":", "if", "user_input", "is", "not", "None", ":", "self", ".", "_mfa_code", "=", "user_input", "[", "CONF_MFA_CODE", "]", "return", "await"...
[ 73, 4 ]
[ 78, 47 ]
python
en
['en', 'co', 'en']
True
StarlineFlowHandler.async_step_auth_captcha
(self, user_input=None, error=None)
Captcha verification step.
Captcha verification step.
async def async_step_auth_captcha(self, user_input=None, error=None): """Captcha verification step.""" if user_input is not None: self._captcha_code = user_input[CONF_CAPTCHA_CODE] return await self._async_authenticate_user(error) return self._async_form_auth_captcha(erro...
[ "async", "def", "async_step_auth_captcha", "(", "self", ",", "user_input", "=", "None", ",", "error", "=", "None", ")", ":", "if", "user_input", "is", "not", "None", ":", "self", ".", "_captcha_code", "=", "user_input", "[", "CONF_CAPTCHA_CODE", "]", "return...
[ 80, 4 ]
[ 85, 51 ]
python
en
['sw', 'haw', 'en']
False
StarlineFlowHandler._async_form_auth_app
(self, error=None)
Authenticate application form.
Authenticate application form.
def _async_form_auth_app(self, error=None): """Authenticate application form.""" errors = {} if error is not None: errors["base"] = error return self.async_show_form( step_id="auth_app", data_schema=vol.Schema( { vo...
[ "def", "_async_form_auth_app", "(", "self", ",", "error", "=", "None", ")", ":", "errors", "=", "{", "}", "if", "error", "is", "not", "None", ":", "errors", "[", "\"base\"", "]", "=", "error", "return", "self", ".", "async_show_form", "(", "step_id", "...
[ 88, 4 ]
[ 107, 9 ]
python
en
['de', 'en', 'en']
True
StarlineFlowHandler._async_form_auth_user
(self, error=None)
Authenticate user form.
Authenticate user form.
def _async_form_auth_user(self, error=None): """Authenticate user form.""" errors = {} if error is not None: errors["base"] = error return self.async_show_form( step_id="auth_user", data_schema=vol.Schema( { vol.Req...
[ "def", "_async_form_auth_user", "(", "self", ",", "error", "=", "None", ")", ":", "errors", "=", "{", "}", "if", "error", "is", "not", "None", ":", "errors", "[", "\"base\"", "]", "=", "error", "return", "self", ".", "async_show_form", "(", "step_id", ...
[ 110, 4 ]
[ 129, 9 ]
python
en
['da', 'en', 'en']
True
StarlineFlowHandler._async_form_auth_mfa
(self, error=None)
Authenticate mfa form.
Authenticate mfa form.
def _async_form_auth_mfa(self, error=None): """Authenticate mfa form.""" errors = {} if error is not None: errors["base"] = error return self.async_show_form( step_id="auth_mfa", data_schema=vol.Schema( { vol.Requir...
[ "def", "_async_form_auth_mfa", "(", "self", ",", "error", "=", "None", ")", ":", "errors", "=", "{", "}", "if", "error", "is", "not", "None", ":", "errors", "[", "\"base\"", "]", "=", "error", "return", "self", ".", "async_show_form", "(", "step_id", "...
[ 132, 4 ]
[ 149, 9 ]
python
en
['en', 'en', 'it']
True
StarlineFlowHandler._async_form_auth_captcha
(self, error=None)
Captcha verification form.
Captcha verification form.
def _async_form_auth_captcha(self, error=None): """Captcha verification form.""" errors = {} if error is not None: errors["base"] = error return self.async_show_form( step_id="auth_captcha", data_schema=vol.Schema( { ...
[ "def", "_async_form_auth_captcha", "(", "self", ",", "error", "=", "None", ")", ":", "errors", "=", "{", "}", "if", "error", "is", "not", "None", ":", "errors", "[", "\"base\"", "]", "=", "error", "return", "self", ".", "async_show_form", "(", "step_id",...
[ 152, 4 ]
[ 171, 9 ]
python
en
['es', 'fr', 'en']
False
StarlineFlowHandler._async_authenticate_app
(self, error=None)
Authenticate application.
Authenticate application.
async def _async_authenticate_app(self, error=None): """Authenticate application.""" try: self._app_code = await self.hass.async_add_executor_job( self._auth.get_app_code, self._app_id, self._app_secret ) self._app_token = await self.hass.async_add_exe...
[ "async", "def", "_async_authenticate_app", "(", "self", ",", "error", "=", "None", ")", ":", "try", ":", "self", ".", "_app_code", "=", "await", "self", ".", "hass", ".", "async_add_executor_job", "(", "self", ".", "_auth", ".", "get_app_code", ",", "self"...
[ 173, 4 ]
[ 185, 60 ]
python
en
['de', 'en', 'en']
False
StarlineFlowHandler._async_authenticate_user
(self, error=None)
Authenticate user.
Authenticate user.
async def _async_authenticate_user(self, error=None): """Authenticate user.""" try: state, data = await self.hass.async_add_executor_job( self._auth.get_slid_user_token, self._app_token, self._username, self._password, ...
[ "async", "def", "_async_authenticate_user", "(", "self", ",", "error", "=", "None", ")", ":", "try", ":", "state", ",", "data", "=", "await", "self", ".", "hass", ".", "async_add_executor_job", "(", "self", ".", "_auth", ".", "get_slid_user_token", ",", "s...
[ 187, 4 ]
[ 218, 62 ]
python
de
['de', 'la', 'en']
False
StarlineFlowHandler._async_get_entry
(self)
Create entry.
Create entry.
async def _async_get_entry(self): """Create entry.""" ( self._slnet_token, self._slnet_token_expires, self._user_id, ) = await self.hass.async_add_executor_job( self._auth.get_user_id, self._user_slid ) return self.async_create_ent...
[ "async", "def", "_async_get_entry", "(", "self", ")", ":", "(", "self", ".", "_slnet_token", ",", "self", ".", "_slnet_token_expires", ",", "self", ".", "_user_id", ",", ")", "=", "await", "self", ".", "hass", ".", "async_add_executor_job", "(", "self", "....
[ 220, 4 ]
[ 238, 9 ]
python
be
['es', 'be', 'en']
False
async_setup_platform
(hass, config, async_add_entities, discovery_info=None)
Discover and setup Xeoma Cameras.
Discover and setup Xeoma Cameras.
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None): """Discover and setup Xeoma Cameras.""" host = config[CONF_HOST] login = config.get(CONF_USERNAME) password = config.get(CONF_PASSWORD) xeoma = Xeoma(host, login, password) try: await xeoma.async_te...
[ "async", "def", "async_setup_platform", "(", "hass", ",", "config", ",", "async_add_entities", ",", "discovery_info", "=", "None", ")", ":", "host", "=", "config", "[", "CONF_HOST", "]", "login", "=", "config", ".", "get", "(", "CONF_USERNAME", ")", "passwor...
[ 41, 0 ]
[ 95, 14 ]
python
en
['en', 'pt', 'en']
True
XeomaCamera.__init__
(self, xeoma, image, name, username, password)
Initialize a Xeoma camera.
Initialize a Xeoma camera.
def __init__(self, xeoma, image, name, username, password): """Initialize a Xeoma camera.""" super().__init__() self._xeoma = xeoma self._name = name self._image = image self._username = username self._password = password self._last_image = None
[ "def", "__init__", "(", "self", ",", "xeoma", ",", "image", ",", "name", ",", "username", ",", "password", ")", ":", "super", "(", ")", ".", "__init__", "(", ")", "self", ".", "_xeoma", "=", "xeoma", "self", ".", "_name", "=", "name", "self", ".", ...
[ 101, 4 ]
[ 109, 31 ]
python
co
['es', 'co', 'it']
False
XeomaCamera.async_camera_image
(self)
Return a still image response from the camera.
Return a still image response from the camera.
async def async_camera_image(self): """Return a still image response from the camera.""" try: image = await self._xeoma.async_get_camera_image( self._image, self._username, self._password ) self._last_image = image except XeomaError as err: ...
[ "async", "def", "async_camera_image", "(", "self", ")", ":", "try", ":", "image", "=", "await", "self", ".", "_xeoma", ".", "async_get_camera_image", "(", "self", ".", "_image", ",", "self", ".", "_username", ",", "self", ".", "_password", ")", "self", "...
[ 111, 4 ]
[ 122, 31 ]
python
en
['en', 'en', 'en']
True
XeomaCamera.name
(self)
Return the name of this device.
Return the name of this device.
def name(self): """Return the name of this device.""" return self._name
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "_name" ]
[ 125, 4 ]
[ 127, 25 ]
python
en
['en', 'en', 'en']
True
async_setup
(hass, config)
Set up the IQVIA component.
Set up the IQVIA component.
async def async_setup(hass, config): """Set up the IQVIA component.""" hass.data[DOMAIN] = {DATA_COORDINATOR: {}} return True
[ "async", "def", "async_setup", "(", "hass", ",", "config", ")", ":", "hass", ".", "data", "[", "DOMAIN", "]", "=", "{", "DATA_COORDINATOR", ":", "{", "}", "}", "return", "True" ]
[ 37, 0 ]
[ 40, 15 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
(hass, entry)
Set up IQVIA as config entry.
Set up IQVIA as config entry.
async def async_setup_entry(hass, entry): """Set up IQVIA as config entry.""" hass.data[DOMAIN][DATA_COORDINATOR][entry.entry_id] = {} if not entry.unique_id: # If the config entry doesn't already have a unique ID, set one: hass.config_entries.async_update_entry( entry, **{"uniq...
[ "async", "def", "async_setup_entry", "(", "hass", ",", "entry", ")", ":", "hass", ".", "data", "[", "DOMAIN", "]", "[", "DATA_COORDINATOR", "]", "[", "entry", ".", "entry_id", "]", "=", "{", "}", "if", "not", "entry", ".", "unique_id", ":", "# If the c...
[ 43, 0 ]
[ 91, 15 ]
python
en
['en', 'pt', 'en']
True
async_unload_entry
(hass, entry)
Unload an OpenUV config entry.
Unload an OpenUV config entry.
async def async_unload_entry(hass, entry): """Unload an OpenUV config entry.""" unload_ok = all( await asyncio.gather( *[ hass.config_entries.async_forward_entry_unload(entry, component) for component in PLATFORMS ] ) ) if unload_o...
[ "async", "def", "async_unload_entry", "(", "hass", ",", "entry", ")", ":", "unload_ok", "=", "all", "(", "await", "asyncio", ".", "gather", "(", "*", "[", "hass", ".", "config_entries", ".", "async_forward_entry_unload", "(", "entry", ",", "component", ")", ...
[ 94, 0 ]
[ 108, 20 ]
python
en
['en', 'en', 'en']
True
IQVIAEntity.__init__
(self, coordinator, entry, sensor_type, name, icon)
Initialize.
Initialize.
def __init__(self, coordinator, entry, sensor_type, name, icon): """Initialize.""" super().__init__(coordinator) self._attrs = {ATTR_ATTRIBUTION: DEFAULT_ATTRIBUTION} self._entry = entry self._icon = icon self._name = name self._state = None self._type = s...
[ "def", "__init__", "(", "self", ",", "coordinator", ",", "entry", ",", "sensor_type", ",", "name", ",", "icon", ")", ":", "super", "(", ")", ".", "__init__", "(", "coordinator", ")", "self", ".", "_attrs", "=", "{", "ATTR_ATTRIBUTION", ":", "DEFAULT_ATTR...
[ 114, 4 ]
[ 122, 32 ]
python
en
['en', 'en', 'it']
False
IQVIAEntity.device_state_attributes
(self)
Return the device state attributes.
Return the device state attributes.
def device_state_attributes(self): """Return the device state attributes.""" return self._attrs
[ "def", "device_state_attributes", "(", "self", ")", ":", "return", "self", ".", "_attrs" ]
[ 125, 4 ]
[ 127, 26 ]
python
en
['en', 'en', 'en']
True
IQVIAEntity.icon
(self)
Return the icon.
Return the icon.
def icon(self): """Return the icon.""" return self._icon
[ "def", "icon", "(", "self", ")", ":", "return", "self", ".", "_icon" ]
[ 130, 4 ]
[ 132, 25 ]
python
en
['en', 'sr', 'en']
True
IQVIAEntity.name
(self)
Return the name.
Return the name.
def name(self): """Return the name.""" return self._name
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "_name" ]
[ 135, 4 ]
[ 137, 25 ]
python
en
['en', 'ig', 'en']
True
IQVIAEntity.state
(self)
Return the state.
Return the state.
def state(self): """Return the state.""" return self._state
[ "def", "state", "(", "self", ")", ":", "return", "self", ".", "_state" ]
[ 140, 4 ]
[ 142, 26 ]
python
en
['en', 'en', 'en']
True
IQVIAEntity.unique_id
(self)
Return a unique, Home Assistant friendly identifier for this entity.
Return a unique, Home Assistant friendly identifier for this entity.
def unique_id(self): """Return a unique, Home Assistant friendly identifier for this entity.""" return f"{self._entry.data[CONF_ZIP_CODE]}_{self._type}"
[ "def", "unique_id", "(", "self", ")", ":", "return", "f\"{self._entry.data[CONF_ZIP_CODE]}_{self._type}\"" ]
[ 145, 4 ]
[ 147, 64 ]
python
en
['en', 'en', 'en']
True
IQVIAEntity.unit_of_measurement
(self)
Return the unit the value is expressed in.
Return the unit the value is expressed in.
def unit_of_measurement(self): """Return the unit the value is expressed in.""" return "index"
[ "def", "unit_of_measurement", "(", "self", ")", ":", "return", "\"index\"" ]
[ 150, 4 ]
[ 152, 22 ]
python
en
['en', 'en', 'en']
True
IQVIAEntity._handle_coordinator_update
(self)
Handle updated data from the coordinator.
Handle updated data from the coordinator.
def _handle_coordinator_update(self) -> None: """Handle updated data from the coordinator.""" self.update_from_latest_data() self.async_write_ha_state()
[ "def", "_handle_coordinator_update", "(", "self", ")", "->", "None", ":", "self", ".", "update_from_latest_data", "(", ")", "self", ".", "async_write_ha_state", "(", ")" ]
[ 155, 4 ]
[ 158, 35 ]
python
en
['en', 'en', 'en']
True
IQVIAEntity.async_added_to_hass
(self)
Register callbacks.
Register callbacks.
async def async_added_to_hass(self): """Register callbacks.""" await super().async_added_to_hass() if self._type == TYPE_ALLERGY_FORECAST: self.async_on_remove( self.hass.data[DOMAIN][DATA_COORDINATOR][self._entry.entry_id][ TYPE_ALLERGY_OUTLOOK ...
[ "async", "def", "async_added_to_hass", "(", "self", ")", ":", "await", "super", "(", ")", ".", "async_added_to_hass", "(", ")", "if", "self", ".", "_type", "==", "TYPE_ALLERGY_FORECAST", ":", "self", ".", "async_on_remove", "(", "self", ".", "hass", ".", "...
[ 160, 4 ]
[ 171, 38 ]
python
en
['en', 'no', 'en']
False
IQVIAEntity.update_from_latest_data
(self)
Update the entity from the latest data.
Update the entity from the latest data.
def update_from_latest_data(self): """Update the entity from the latest data.""" raise NotImplementedError
[ "def", "update_from_latest_data", "(", "self", ")", ":", "raise", "NotImplementedError" ]
[ 174, 4 ]
[ 176, 33 ]
python
en
['en', 'en', 'en']
True
setup_platform
(hass, config, add_entities, discovery_info=None)
Set up the Lutron lights.
Set up the Lutron lights.
def setup_platform(hass, config, add_entities, discovery_info=None): """Set up the Lutron lights.""" devs = [] for (area_name, device) in hass.data[LUTRON_DEVICES]["light"]: dev = LutronLight(area_name, device, hass.data[LUTRON_CONTROLLER]) devs.append(dev) add_entities(devs, True)
[ "def", "setup_platform", "(", "hass", ",", "config", ",", "add_entities", ",", "discovery_info", "=", "None", ")", ":", "devs", "=", "[", "]", "for", "(", "area_name", ",", "device", ")", "in", "hass", ".", "data", "[", "LUTRON_DEVICES", "]", "[", "\"l...
[ 10, 0 ]
[ 17, 28 ]
python
en
['en', 'ceb', 'en']
True
to_lutron_level
(level)
Convert the given Home Assistant light level (0-255) to Lutron (0.0-100.0).
Convert the given Home Assistant light level (0-255) to Lutron (0.0-100.0).
def to_lutron_level(level): """Convert the given Home Assistant light level (0-255) to Lutron (0.0-100.0).""" return float((level * 100) / 255)
[ "def", "to_lutron_level", "(", "level", ")", ":", "return", "float", "(", "(", "level", "*", "100", ")", "/", "255", ")" ]
[ 20, 0 ]
[ 22, 37 ]
python
en
['en', 'en', 'en']
True
to_hass_level
(level)
Convert the given Lutron (0.0-100.0) light level to Home Assistant (0-255).
Convert the given Lutron (0.0-100.0) light level to Home Assistant (0-255).
def to_hass_level(level): """Convert the given Lutron (0.0-100.0) light level to Home Assistant (0-255).""" return int((level * 255) / 100)
[ "def", "to_hass_level", "(", "level", ")", ":", "return", "int", "(", "(", "level", "*", "255", ")", "/", "100", ")" ]
[ 25, 0 ]
[ 27, 35 ]
python
en
['en', 'en', 'en']
True
LutronLight.__init__
(self, area_name, lutron_device, controller)
Initialize the light.
Initialize the light.
def __init__(self, area_name, lutron_device, controller): """Initialize the light.""" self._prev_brightness = None super().__init__(area_name, lutron_device, controller)
[ "def", "__init__", "(", "self", ",", "area_name", ",", "lutron_device", ",", "controller", ")", ":", "self", ".", "_prev_brightness", "=", "None", "super", "(", ")", ".", "__init__", "(", "area_name", ",", "lutron_device", ",", "controller", ")" ]
[ 33, 4 ]
[ 36, 62 ]
python
en
['en', 'en', 'en']
True
LutronLight.supported_features
(self)
Flag supported features.
Flag supported features.
def supported_features(self): """Flag supported features.""" return SUPPORT_BRIGHTNESS
[ "def", "supported_features", "(", "self", ")", ":", "return", "SUPPORT_BRIGHTNESS" ]
[ 39, 4 ]
[ 41, 33 ]
python
en
['da', 'en', 'en']
True
LutronLight.brightness
(self)
Return the brightness of the light.
Return the brightness of the light.
def brightness(self): """Return the brightness of the light.""" new_brightness = to_hass_level(self._lutron_device.last_level()) if new_brightness != 0: self._prev_brightness = new_brightness return new_brightness
[ "def", "brightness", "(", "self", ")", ":", "new_brightness", "=", "to_hass_level", "(", "self", ".", "_lutron_device", ".", "last_level", "(", ")", ")", "if", "new_brightness", "!=", "0", ":", "self", ".", "_prev_brightness", "=", "new_brightness", "return", ...
[ 44, 4 ]
[ 49, 29 ]
python
en
['en', 'no', 'en']
True
LutronLight.turn_on
(self, **kwargs)
Turn the light on.
Turn the light on.
def turn_on(self, **kwargs): """Turn the light on.""" if ATTR_BRIGHTNESS in kwargs and self._lutron_device.is_dimmable: brightness = kwargs[ATTR_BRIGHTNESS] elif self._prev_brightness == 0: brightness = 255 / 2 else: brightness = self._prev_brightness ...
[ "def", "turn_on", "(", "self", ",", "*", "*", "kwargs", ")", ":", "if", "ATTR_BRIGHTNESS", "in", "kwargs", "and", "self", ".", "_lutron_device", ".", "is_dimmable", ":", "brightness", "=", "kwargs", "[", "ATTR_BRIGHTNESS", "]", "elif", "self", ".", "_prev_...
[ 51, 4 ]
[ 60, 63 ]
python
en
['en', 'et', 'en']
True
LutronLight.turn_off
(self, **kwargs)
Turn the light off.
Turn the light off.
def turn_off(self, **kwargs): """Turn the light off.""" self._lutron_device.level = 0
[ "def", "turn_off", "(", "self", ",", "*", "*", "kwargs", ")", ":", "self", ".", "_lutron_device", ".", "level", "=", "0" ]
[ 62, 4 ]
[ 64, 37 ]
python
en
['en', 'zh', 'en']
True
LutronLight.device_state_attributes
(self)
Return the state attributes.
Return the state attributes.
def device_state_attributes(self): """Return the state attributes.""" return {"lutron_integration_id": self._lutron_device.id}
[ "def", "device_state_attributes", "(", "self", ")", ":", "return", "{", "\"lutron_integration_id\"", ":", "self", ".", "_lutron_device", ".", "id", "}" ]
[ 67, 4 ]
[ 69, 64 ]
python
en
['en', 'en', 'en']
True
LutronLight.is_on
(self)
Return true if device is on.
Return true if device is on.
def is_on(self): """Return true if device is on.""" return self._lutron_device.last_level() > 0
[ "def", "is_on", "(", "self", ")", ":", "return", "self", ".", "_lutron_device", ".", "last_level", "(", ")", ">", "0" ]
[ 72, 4 ]
[ 74, 51 ]
python
en
['en', 'fy', 'en']
True
LutronLight.update
(self)
Call when forcing a refresh of the device.
Call when forcing a refresh of the device.
def update(self): """Call when forcing a refresh of the device.""" if self._prev_brightness is None: self._prev_brightness = to_hass_level(self._lutron_device.level)
[ "def", "update", "(", "self", ")", ":", "if", "self", ".", "_prev_brightness", "is", "None", ":", "self", ".", "_prev_brightness", "=", "to_hass_level", "(", "self", ".", "_lutron_device", ".", "level", ")" ]
[ 76, 4 ]
[ 79, 76 ]
python
en
['en', 'en', 'en']
True
setup
(hass, config)
Activate Tahoma component.
Activate Tahoma component.
def setup(hass, config): """Activate Tahoma component.""" conf = config[DOMAIN] username = conf.get(CONF_USERNAME) password = conf.get(CONF_PASSWORD) exclude = conf.get(CONF_EXCLUDE) try: api = TahomaApi(username, password) except RequestException: _LOGGER.exception("Error w...
[ "def", "setup", "(", "hass", ",", "config", ")", ":", "conf", "=", "config", "[", "DOMAIN", "]", "username", "=", "conf", ".", "get", "(", "CONF_USERNAME", ")", "password", "=", "conf", ".", "get", "(", "CONF_PASSWORD", ")", "exclude", "=", "conf", "...
[ 74, 0 ]
[ 116, 15 ]
python
en
['es', 'en', 'en']
True
map_tahoma_device
(tahoma_device)
Map Tahoma device types to Home Assistant components.
Map Tahoma device types to Home Assistant components.
def map_tahoma_device(tahoma_device): """Map Tahoma device types to Home Assistant components.""" return TAHOMA_TYPES.get(tahoma_device.type)
[ "def", "map_tahoma_device", "(", "tahoma_device", ")", ":", "return", "TAHOMA_TYPES", ".", "get", "(", "tahoma_device", ".", "type", ")" ]
[ 119, 0 ]
[ 121, 47 ]
python
en
['en', 'en', 'en']
True
TahomaDevice.__init__
(self, tahoma_device, controller)
Initialize the device.
Initialize the device.
def __init__(self, tahoma_device, controller): """Initialize the device.""" self.tahoma_device = tahoma_device self.controller = controller self._name = self.tahoma_device.label
[ "def", "__init__", "(", "self", ",", "tahoma_device", ",", "controller", ")", ":", "self", ".", "tahoma_device", "=", "tahoma_device", "self", ".", "controller", "=", "controller", "self", ".", "_name", "=", "self", ".", "tahoma_device", ".", "label" ]
[ 127, 4 ]
[ 131, 45 ]
python
en
['en', 'en', 'en']
True
TahomaDevice.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" ]
[ 134, 4 ]
[ 136, 25 ]
python
en
['en', 'en', 'en']
True
TahomaDevice.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.""" return {"tahoma_device_id": self.tahoma_device.url}
[ "def", "device_state_attributes", "(", "self", ")", ":", "return", "{", "\"tahoma_device_id\"", ":", "self", ".", "tahoma_device", ".", "url", "}" ]
[ 139, 4 ]
[ 141, 59 ]
python
en
['en', 'en', 'en']
True
TahomaDevice.apply_action
(self, cmd_name, *args)
Apply Action to Device.
Apply Action to Device.
def apply_action(self, cmd_name, *args): """Apply Action to Device.""" action = Action(self.tahoma_device.url) action.add_command(cmd_name, *args) self.controller.apply_actions("HomeAssistant", [action])
[ "def", "apply_action", "(", "self", ",", "cmd_name", ",", "*", "args", ")", ":", "action", "=", "Action", "(", "self", ".", "tahoma_device", ".", "url", ")", "action", ".", "add_command", "(", "cmd_name", ",", "*", "args", ")", "self", ".", "controller...
[ 143, 4 ]
[ 148, 64 ]
python
en
['en', 'en', 'en']
True
FreeboxFlowHandler.__init__
(self)
Initialize Freebox config flow.
Initialize Freebox config flow.
def __init__(self): """Initialize Freebox config flow.""" self._host = None self._port = None
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "_host", "=", "None", "self", ".", "_port", "=", "None" ]
[ 21, 4 ]
[ 24, 25 ]
python
en
['de', 'en', 'en']
True
FreeboxFlowHandler._show_setup_form
(self, user_input=None, errors=None)
Show the setup form to the user.
Show the setup form to the user.
def _show_setup_form(self, user_input=None, errors=None): """Show the setup form to the user.""" if user_input is None: user_input = {} return self.async_show_form( step_id="user", data_schema=vol.Schema( { vol.Required(CO...
[ "def", "_show_setup_form", "(", "self", ",", "user_input", "=", "None", ",", "errors", "=", "None", ")", ":", "if", "user_input", "is", "None", ":", "user_input", "=", "{", "}", "return", "self", ".", "async_show_form", "(", "step_id", "=", "\"user\"", "...
[ 26, 4 ]
[ 41, 9 ]
python
en
['en', 'en', 'en']
True
FreeboxFlowHandler.async_step_user
(self, user_input=None)
Handle a flow initiated by the user.
Handle a flow initiated by the user.
async def async_step_user(self, user_input=None): """Handle a flow initiated by the user.""" errors = {} if user_input is None: return self._show_setup_form(user_input, errors) self._host = user_input[CONF_HOST] self._port = user_input[CONF_PORT] # Check if...
[ "async", "def", "async_step_user", "(", "self", ",", "user_input", "=", "None", ")", ":", "errors", "=", "{", "}", "if", "user_input", "is", "None", ":", "return", "self", ".", "_show_setup_form", "(", "user_input", ",", "errors", ")", "self", ".", "_hos...
[ 43, 4 ]
[ 57, 43 ]
python
en
['en', 'en', 'en']
True
FreeboxFlowHandler.async_step_link
(self, user_input=None)
Attempt to link with the Freebox router. Given a configured host, will ask the user to press the button to connect to the router.
Attempt to link with the Freebox router.
async def async_step_link(self, user_input=None): """Attempt to link with the Freebox router. Given a configured host, will ask the user to press the button to connect to the router. """ if user_input is None: return self.async_show_form(step_id="link") erro...
[ "async", "def", "async_step_link", "(", "self", ",", "user_input", "=", "None", ")", ":", "if", "user_input", "is", "None", ":", "return", "self", ".", "async_show_form", "(", "step_id", "=", "\"link\"", ")", "errors", "=", "{", "}", "fbx", "=", "await",...
[ 59, 4 ]
[ 102, 66 ]
python
en
['en', 'en', 'en']
True
FreeboxFlowHandler.async_step_import
(self, user_input=None)
Import a config entry.
Import a config entry.
async def async_step_import(self, user_input=None): """Import a config entry.""" return await self.async_step_user(user_input)
[ "async", "def", "async_step_import", "(", "self", ",", "user_input", "=", "None", ")", ":", "return", "await", "self", ".", "async_step_user", "(", "user_input", ")" ]
[ 104, 4 ]
[ 106, 53 ]
python
en
['en', 'en', 'en']
True
FreeboxFlowHandler.async_step_discovery
(self, discovery_info)
Initialize step from discovery.
Initialize step from discovery.
async def async_step_discovery(self, discovery_info): """Initialize step from discovery.""" return await self.async_step_user(discovery_info)
[ "async", "def", "async_step_discovery", "(", "self", ",", "discovery_info", ")", ":", "return", "await", "self", ".", "async_step_user", "(", "discovery_info", ")" ]
[ 108, 4 ]
[ 110, 57 ]
python
en
['en', 'en', 'en']
True
RagTokenizer.as_target_tokenizer
(self)
Temporarily sets the tokenizer for encoding the targets. Useful for tokenizer associated to sequence-to-sequence models that need a slightly different processing for the labels.
Temporarily sets the tokenizer for encoding the targets. Useful for tokenizer associated to sequence-to-sequence models that need a slightly different processing for the labels.
def as_target_tokenizer(self): """ Temporarily sets the tokenizer for encoding the targets. Useful for tokenizer associated to sequence-to-sequence models that need a slightly different processing for the labels. """ self.current_tokenizer = self.generator yield s...
[ "def", "as_target_tokenizer", "(", "self", ")", ":", "self", ".", "current_tokenizer", "=", "self", ".", "generator", "yield", "self", ".", "current_tokenizer", "=", "self", ".", "question_encoder" ]
[ 71, 4 ]
[ 78, 54 ]
python
en
['en', 'error', 'th']
False
FSMTConfig.to_dict
(self)
Serializes this instance to a Python dictionary. Override the default `to_dict()` from `PretrainedConfig`. Returns: :obj:`Dict[str, any]`: Dictionary of all the attributes that make up this configuration instance,
Serializes this instance to a Python dictionary. Override the default `to_dict()` from `PretrainedConfig`.
def to_dict(self): """ Serializes this instance to a Python dictionary. Override the default `to_dict()` from `PretrainedConfig`. Returns: :obj:`Dict[str, any]`: Dictionary of all the attributes that make up this configuration instance, """ output = copy.deepcopy(sel...
[ "def", "to_dict", "(", "self", ")", ":", "output", "=", "copy", ".", "deepcopy", "(", "self", ".", "__dict__", ")", "output", "[", "\"decoder\"", "]", "=", "self", ".", "decoder", ".", "to_dict", "(", ")", "output", "[", "\"model_type\"", "]", "=", "...
[ 216, 4 ]
[ 226, 21 ]
python
en
['en', 'error', 'th']
False
async_setup_entry
(hass, entry, async_add_entities)
Set up TotalConnect alarm panels based on a config entry.
Set up TotalConnect alarm panels based on a config entry.
async def async_setup_entry(hass, entry, async_add_entities) -> None: """Set up TotalConnect alarm panels based on a config entry.""" alarms = [] client = hass.data[DOMAIN][entry.entry_id] for location_id, location in client.locations.items(): location_name = location.location_name ala...
[ "async", "def", "async_setup_entry", "(", "hass", ",", "entry", ",", "async_add_entities", ")", "->", "None", ":", "alarms", "=", "[", "]", "client", "=", "hass", ".", "data", "[", "DOMAIN", "]", "[", "entry", ".", "entry_id", "]", "for", "location_id", ...
[ 26, 0 ]
[ 36, 36 ]
python
en
['en', 'en', 'en']
True