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
BMWLock.unlock
(self, **kwargs)
Unlock the car.
Unlock the car.
def unlock(self, **kwargs): """Unlock the car.""" _LOGGER.debug("%s: unlocking doors", self._vehicle.name) # Optimistic state set here because it takes some time before the # update callback response self._state = STATE_UNLOCKED self.schedule_update_ha_state() sel...
[ "def", "unlock", "(", "self", ",", "*", "*", "kwargs", ")", ":", "_LOGGER", ".", "debug", "(", "\"%s: unlocking doors\"", ",", "self", ".", "_vehicle", ".", "name", ")", "# Optimistic state set here because it takes some time before the", "# update callback response", ...
[ 89, 4 ]
[ 96, 66 ]
python
en
['en', 'ms', 'en']
True
BMWLock.update
(self)
Update state of the lock.
Update state of the lock.
def update(self): """Update state of the lock.""" _LOGGER.debug("%s: updating data for %s", self._vehicle.name, self._attribute) vehicle_state = self._vehicle.state # Possible values: LOCKED, SECURED, SELECTIVE_LOCKED, UNLOCKED self._state = ( STATE_LOCKED ...
[ "def", "update", "(", "self", ")", ":", "_LOGGER", ".", "debug", "(", "\"%s: updating data for %s\"", ",", "self", ".", "_vehicle", ".", "name", ",", "self", ".", "_attribute", ")", "vehicle_state", "=", "self", ".", "_vehicle", ".", "state", "# Possible val...
[ 98, 4 ]
[ 108, 9 ]
python
en
['en', 'en', 'en']
True
BMWLock.update_callback
(self)
Schedule a state update.
Schedule a state update.
def update_callback(self): """Schedule a state update.""" self.schedule_update_ha_state(True)
[ "def", "update_callback", "(", "self", ")", ":", "self", ".", "schedule_update_ha_state", "(", "True", ")" ]
[ 110, 4 ]
[ 112, 43 ]
python
en
['en', 'co', 'en']
True
BMWLock.async_added_to_hass
(self)
Add callback after being added to hass. Show latest data after startup.
Add callback after being added to hass.
async def async_added_to_hass(self): """Add callback after being added to hass. Show latest data after startup. """ self._account.add_update_listener(self.update_callback)
[ "async", "def", "async_added_to_hass", "(", "self", ")", ":", "self", ".", "_account", ".", "add_update_listener", "(", "self", ".", "update_callback", ")" ]
[ 114, 4 ]
[ 119, 63 ]
python
en
['en', 'en', 'en']
True
Lightning.fit
(self, model)
Fit the model with provided dataloader, with Lightning trainer. Parameters ---------- model : nn.Module The model to fit.
Fit the model with provided dataloader, with Lightning trainer.
def fit(self, model): """ Fit the model with provided dataloader, with Lightning trainer. Parameters ---------- model : nn.Module The model to fit. """ self.module.set_model(model) return self.trainer.fit(self.module, self.train_dataloader, se...
[ "def", "fit", "(", "self", ",", "model", ")", ":", "self", ".", "module", ".", "set_model", "(", "model", ")", "return", "self", ".", "trainer", ".", "fit", "(", "self", ".", "module", ",", "self", ".", "train_dataloader", ",", "self", ".", "val_data...
[ 87, 4 ]
[ 97, 89 ]
python
en
['en', 'error', 'th']
False
convert_parlai_checkpoint
(checkpoint_path, pytorch_dump_folder_path, config_json_path)
Copy/paste/tweak model's weights to our BERT structure.
Copy/paste/tweak model's weights to our BERT structure.
def convert_parlai_checkpoint(checkpoint_path, pytorch_dump_folder_path, config_json_path): """ Copy/paste/tweak model's weights to our BERT structure. """ model = torch.load(checkpoint_path, map_location="cpu") sd = model["model"] cfg = BartConfig.from_json_file(config_json_path) m = BartFo...
[ "def", "convert_parlai_checkpoint", "(", "checkpoint_path", ",", "pytorch_dump_folder_path", ",", "config_json_path", ")", ":", "model", "=", "torch", ".", "load", "(", "checkpoint_path", ",", "map_location", "=", "\"cpu\"", ")", "sd", "=", "model", "[", "\"model\...
[ 77, 0 ]
[ 101, 47 ]
python
en
['en', 'error', 'th']
False
test_sensors_pro
(hass, canary)
Test the creation and values of the sensors for Canary Pro.
Test the creation and values of the sensors for Canary Pro.
async def test_sensors_pro(hass, canary) -> None: """Test the creation and values of the sensors for Canary Pro.""" await async_setup_component(hass, "persistent_notification", {}) registry = mock_registry(hass) device_registry = mock_device_registry(hass) online_device_at_home = mock_device(20, "...
[ "async", "def", "test_sensors_pro", "(", "hass", ",", "canary", ")", "->", "None", ":", "await", "async_setup_component", "(", "hass", ",", "\"persistent_notification\"", ",", "{", "}", ")", "registry", "=", "mock_registry", "(", "hass", ")", "device_registry", ...
[ 29, 0 ]
[ 94, 39 ]
python
en
['en', 'en', 'en']
True
test_sensors_attributes_pro
(hass, canary)
Test the creation and values of the sensors attributes for Canary Pro.
Test the creation and values of the sensors attributes for Canary Pro.
async def test_sensors_attributes_pro(hass, canary) -> None: """Test the creation and values of the sensors attributes for Canary Pro.""" await async_setup_component(hass, "persistent_notification", {}) online_device_at_home = mock_device(20, "Dining Room", True, "Canary Pro") instance = canary.return...
[ "async", "def", "test_sensors_attributes_pro", "(", "hass", ",", "canary", ")", "->", "None", ":", "await", "async_setup_component", "(", "hass", ",", "\"persistent_notification\"", ",", "{", "}", ")", "online_device_at_home", "=", "mock_device", "(", "20", ",", ...
[ 97, 0 ]
[ 152, 73 ]
python
en
['en', 'en', 'en']
True
test_sensors_flex
(hass, canary)
Test the creation and values of the sensors for Canary Flex.
Test the creation and values of the sensors for Canary Flex.
async def test_sensors_flex(hass, canary) -> None: """Test the creation and values of the sensors for Canary Flex.""" await async_setup_component(hass, "persistent_notification", {}) registry = mock_registry(hass) device_registry = mock_device_registry(hass) online_device_at_home = mock_device(20,...
[ "async", "def", "test_sensors_flex", "(", "hass", ",", "canary", ")", "->", "None", ":", "await", "async_setup_component", "(", "hass", ",", "\"persistent_notification\"", ",", "{", "}", ")", "registry", "=", "mock_registry", "(", "hass", ")", "device_registry",...
[ 155, 0 ]
[ 212, 40 ]
python
en
['en', 'en', 'en']
True
test_yaml_resources
(hass, hass_ws_client)
Test defining resources in configuration.yaml.
Test defining resources in configuration.yaml.
async def test_yaml_resources(hass, hass_ws_client): """Test defining resources in configuration.yaml.""" assert await async_setup_component( hass, "lovelace", {"lovelace": {"mode": "yaml", "resources": RESOURCE_EXAMPLES}} ) client = await hass_ws_client(hass) # Fetch data await client...
[ "async", "def", "test_yaml_resources", "(", "hass", ",", "hass_ws_client", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "\"lovelace\"", ",", "{", "\"lovelace\"", ":", "{", "\"mode\"", ":", "\"yaml\"", ",", "\"resources\"", ":", "RESOUR...
[ 15, 0 ]
[ 27, 50 ]
python
en
['nl', 'en', 'en']
True
test_yaml_resources_backwards
(hass, hass_ws_client)
Test defining resources in YAML ll config (legacy).
Test defining resources in YAML ll config (legacy).
async def test_yaml_resources_backwards(hass, hass_ws_client): """Test defining resources in YAML ll config (legacy).""" with patch( "homeassistant.components.lovelace.dashboard.load_yaml", return_value={"resources": RESOURCE_EXAMPLES}, ): assert await async_setup_component( ...
[ "async", "def", "test_yaml_resources_backwards", "(", "hass", ",", "hass_ws_client", ")", ":", "with", "patch", "(", "\"homeassistant.components.lovelace.dashboard.load_yaml\"", ",", "return_value", "=", "{", "\"resources\"", ":", "RESOURCE_EXAMPLES", "}", ",", ")", ":"...
[ 30, 0 ]
[ 46, 50 ]
python
en
['en', 'en', 'it']
True
test_storage_resources
(hass, hass_ws_client, hass_storage)
Test defining resources in storage config.
Test defining resources in storage config.
async def test_storage_resources(hass, hass_ws_client, hass_storage): """Test defining resources in storage config.""" resource_config = [{**item, "id": uuid.uuid4().hex} for item in RESOURCE_EXAMPLES] hass_storage[resources.RESOURCE_STORAGE_KEY] = { "key": resources.RESOURCE_STORAGE_KEY, "v...
[ "async", "def", "test_storage_resources", "(", "hass", ",", "hass_ws_client", ",", "hass_storage", ")", ":", "resource_config", "=", "[", "{", "*", "*", "item", ",", "\"id\"", ":", "uuid", ".", "uuid4", "(", ")", ".", "hex", "}", "for", "item", "in", "...
[ 49, 0 ]
[ 65, 48 ]
python
de
['nl', 'de', 'en']
False
test_storage_resources_import
(hass, hass_ws_client, hass_storage)
Test importing resources from storage config.
Test importing resources from storage config.
async def test_storage_resources_import(hass, hass_ws_client, hass_storage): """Test importing resources from storage config.""" assert await async_setup_component(hass, "lovelace", {}) hass_storage[dashboard.CONFIG_STORAGE_KEY_DEFAULT] = { "key": "lovelace", "version": 1, "data": {"...
[ "async", "def", "test_storage_resources_import", "(", "hass", ",", "hass_ws_client", ",", "hass_storage", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "\"lovelace\"", ",", "{", "}", ")", "hass_storage", "[", "dashboard", ".", "CONFIG_STO...
[ 68, 0 ]
[ 151, 78 ]
python
en
['en', 'en', 'en']
True
test_storage_resources_import_invalid
(hass, hass_ws_client, hass_storage)
Test importing resources from storage config.
Test importing resources from storage config.
async def test_storage_resources_import_invalid(hass, hass_ws_client, hass_storage): """Test importing resources from storage config.""" assert await async_setup_component(hass, "lovelace", {}) hass_storage[dashboard.CONFIG_STORAGE_KEY_DEFAULT] = { "key": "lovelace", "version": 1, "d...
[ "async", "def", "test_storage_resources_import_invalid", "(", "hass", ",", "hass_ws_client", ",", "hass_storage", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "\"lovelace\"", ",", "{", "}", ")", "hass_storage", "[", "dashboard", ".", "CO...
[ 154, 0 ]
[ 173, 5 ]
python
en
['en', 'en', 'en']
True
parse_model_grpc
(model_metadata, model_config)
Check the configuration of a model to make sure it meets the requirements for an image classification network (as expected by this client)
Check the configuration of a model to make sure it meets the requirements for an image classification network (as expected by this client)
def parse_model_grpc(model_metadata, model_config): """ Check the configuration of a model to make sure it meets the requirements for an image classification network (as expected by this client) """ print(len(model_metadata.outputs)) if len(model_metadata.inputs) != 1: raise Exceptio...
[ "def", "parse_model_grpc", "(", "model_metadata", ",", "model_config", ")", ":", "print", "(", "len", "(", "model_metadata", ".", "outputs", ")", ")", "if", "len", "(", "model_metadata", ".", "inputs", ")", "!=", "1", ":", "raise", "Exception", "(", "\"exp...
[ 23, 0 ]
[ 70, 75 ]
python
en
['en', 'error', 'th']
False
async_setup_entry
( hass: HomeAssistantType, entry: ConfigEntry, async_add_entities )
Get all cover devices and setup them via config entry.
Get all cover devices and setup them via config entry.
async def async_setup_entry( hass: HomeAssistantType, entry: ConfigEntry, async_add_entities ) -> None: """Get all cover devices and setup them via config entry.""" entities = [] for gateway in hass.data[DOMAIN][entry.entry_id]["gateways"]: for device in gateway.multi_level_switch_devices: ...
[ "async", "def", "async_setup_entry", "(", "hass", ":", "HomeAssistantType", ",", "entry", ":", "ConfigEntry", ",", "async_add_entities", ")", "->", "None", ":", "entities", "=", "[", "]", "for", "gateway", "in", "hass", ".", "data", "[", "DOMAIN", "]", "["...
[ 18, 0 ]
[ 40, 39 ]
python
en
['en', 'pt', 'en']
True
DevoloClimateDeviceEntity.current_temperature
(self)
Return the current temperature.
Return the current temperature.
def current_temperature(self) -> Optional[float]: """Return the current temperature.""" if hasattr(self._device_instance, "multi_level_sensor_property"): return next( ( multi_level_sensor.value for multi_level_sensor in self._device_ins...
[ "def", "current_temperature", "(", "self", ")", "->", "Optional", "[", "float", "]", ":", "if", "hasattr", "(", "self", ".", "_device_instance", ",", "\"multi_level_sensor_property\"", ")", ":", "return", "next", "(", "(", "multi_level_sensor", ".", "value", "...
[ 47, 4 ]
[ 59, 19 ]
python
en
['en', 'la', 'en']
True
DevoloClimateDeviceEntity.target_temperature
(self)
Return the target temperature.
Return the target temperature.
def target_temperature(self) -> Optional[float]: """Return the target temperature.""" return self._value
[ "def", "target_temperature", "(", "self", ")", "->", "Optional", "[", "float", "]", ":", "return", "self", ".", "_value" ]
[ 62, 4 ]
[ 64, 26 ]
python
en
['en', 'la', 'en']
True
DevoloClimateDeviceEntity.target_temperature_step
(self)
Return the precision of the target temperature.
Return the precision of the target temperature.
def target_temperature_step(self) -> float: """Return the precision of the target temperature.""" return PRECISION_HALVES
[ "def", "target_temperature_step", "(", "self", ")", "->", "float", ":", "return", "PRECISION_HALVES" ]
[ 67, 4 ]
[ 69, 31 ]
python
en
['en', 'en', 'en']
True
DevoloClimateDeviceEntity.hvac_mode
(self)
Return the supported HVAC mode.
Return the supported HVAC mode.
def hvac_mode(self) -> str: """Return the supported HVAC mode.""" return HVAC_MODE_HEAT
[ "def", "hvac_mode", "(", "self", ")", "->", "str", ":", "return", "HVAC_MODE_HEAT" ]
[ 72, 4 ]
[ 74, 29 ]
python
en
['en', 'en', 'en']
True
DevoloClimateDeviceEntity.hvac_modes
(self)
Return the list of available hvac operation modes.
Return the list of available hvac operation modes.
def hvac_modes(self) -> List[str]: """Return the list of available hvac operation modes.""" return [HVAC_MODE_HEAT]
[ "def", "hvac_modes", "(", "self", ")", "->", "List", "[", "str", "]", ":", "return", "[", "HVAC_MODE_HEAT", "]" ]
[ 77, 4 ]
[ 79, 31 ]
python
en
['en', 'en', 'en']
True
DevoloClimateDeviceEntity.min_temp
(self)
Return the minimum set temperature value.
Return the minimum set temperature value.
def min_temp(self) -> float: """Return the minimum set temperature value.""" return self._multi_level_switch_property.min
[ "def", "min_temp", "(", "self", ")", "->", "float", ":", "return", "self", ".", "_multi_level_switch_property", ".", "min" ]
[ 82, 4 ]
[ 84, 52 ]
python
en
['en', 'la', 'en']
True
DevoloClimateDeviceEntity.max_temp
(self)
Return the maximum set temperature value.
Return the maximum set temperature value.
def max_temp(self) -> float: """Return the maximum set temperature value.""" return self._multi_level_switch_property.max
[ "def", "max_temp", "(", "self", ")", "->", "float", ":", "return", "self", ".", "_multi_level_switch_property", ".", "max" ]
[ 87, 4 ]
[ 89, 52 ]
python
en
['en', 'la', 'en']
True
DevoloClimateDeviceEntity.precision
(self)
Return the precision of the set temperature.
Return the precision of the set temperature.
def precision(self) -> float: """Return the precision of the set temperature.""" return PRECISION_TENTHS
[ "def", "precision", "(", "self", ")", "->", "float", ":", "return", "PRECISION_TENTHS" ]
[ 92, 4 ]
[ 94, 31 ]
python
en
['en', 'la', 'en']
True
DevoloClimateDeviceEntity.supported_features
(self)
Flag supported features.
Flag supported features.
def supported_features(self): """Flag supported features.""" return SUPPORT_TARGET_TEMPERATURE
[ "def", "supported_features", "(", "self", ")", ":", "return", "SUPPORT_TARGET_TEMPERATURE" ]
[ 97, 4 ]
[ 99, 41 ]
python
en
['da', 'en', 'en']
True
DevoloClimateDeviceEntity.temperature_unit
(self)
Return the supported unit of temperature.
Return the supported unit of temperature.
def temperature_unit(self) -> str: """Return the supported unit of temperature.""" return TEMP_CELSIUS
[ "def", "temperature_unit", "(", "self", ")", "->", "str", ":", "return", "TEMP_CELSIUS" ]
[ 102, 4 ]
[ 104, 27 ]
python
en
['en', 'en', 'en']
True
DevoloClimateDeviceEntity.set_hvac_mode
(self, hvac_mode: str)
Do nothing as devolo devices do not support changing the hvac mode.
Do nothing as devolo devices do not support changing the hvac mode.
def set_hvac_mode(self, hvac_mode: str) -> None: """Do nothing as devolo devices do not support changing the hvac mode."""
[ "def", "set_hvac_mode", "(", "self", ",", "hvac_mode", ":", "str", ")", "->", "None", ":" ]
[ 106, 4 ]
[ 107, 81 ]
python
en
['en', 'en', 'en']
True
DevoloClimateDeviceEntity.set_temperature
(self, **kwargs)
Set new target temperature.
Set new target temperature.
def set_temperature(self, **kwargs): """Set new target temperature.""" self._multi_level_switch_property.set(kwargs[ATTR_TEMPERATURE])
[ "def", "set_temperature", "(", "self", ",", "*", "*", "kwargs", ")", ":", "self", ".", "_multi_level_switch_property", ".", "set", "(", "kwargs", "[", "ATTR_TEMPERATURE", "]", ")" ]
[ 109, 4 ]
[ 111, 71 ]
python
en
['en', 'ca', 'en']
True
validate_integration
(config: Config, integration: Integration)
Validate config flow of an integration.
Validate config flow of an integration.
def validate_integration(config: Config, integration: Integration): """Validate config flow of an integration.""" config_flow_file = integration.path / "config_flow.py" if not config_flow_file.is_file(): if integration.manifest.get("config_flow"): integration.add_error( ...
[ "def", "validate_integration", "(", "config", ":", "Config", ",", "integration", ":", "Integration", ")", ":", "config_flow_file", "=", "integration", ".", "path", "/", "\"config_flow.py\"", "if", "not", "config_flow_file", ".", "is_file", "(", ")", ":", "if", ...
[ 20, 0 ]
[ 83, 5 ]
python
en
['en', 'en', 'en']
True
generate_and_validate
(integrations: Dict[str, Integration], config: Config)
Validate and generate config flow data.
Validate and generate config flow data.
def generate_and_validate(integrations: Dict[str, Integration], config: Config): """Validate and generate config flow data.""" domains = [] for domain in sorted(integrations): integration = integrations[domain] if not integration.manifest: continue if not ( ...
[ "def", "generate_and_validate", "(", "integrations", ":", "Dict", "[", "str", ",", "Integration", "]", ",", "config", ":", "Config", ")", ":", "domains", "=", "[", "]", "for", "domain", "in", "sorted", "(", "integrations", ")", ":", "integration", "=", "...
[ 86, 0 ]
[ 109, 53 ]
python
en
['en', 'en', 'en']
True
validate
(integrations: Dict[str, Integration], config: Config)
Validate config flow file.
Validate config flow file.
def validate(integrations: Dict[str, Integration], config: Config): """Validate config flow file.""" config_flow_path = config.root / "homeassistant/generated/config_flows.py" config.cache["config_flow"] = content = generate_and_validate(integrations, config) if config.specific_integrations: re...
[ "def", "validate", "(", "integrations", ":", "Dict", "[", "str", ",", "Integration", "]", ",", "config", ":", "Config", ")", ":", "config_flow_path", "=", "config", ".", "root", "/", "\"homeassistant/generated/config_flows.py\"", "config", ".", "cache", "[", "...
[ 112, 0 ]
[ 128, 14 ]
python
en
['en', 'da', 'en']
True
generate
(integrations: Dict[str, Integration], config: Config)
Generate config flow file.
Generate config flow file.
def generate(integrations: Dict[str, Integration], config: Config): """Generate config flow file.""" config_flow_path = config.root / "homeassistant/generated/config_flows.py" with open(str(config_flow_path), "w") as fp: fp.write(f"{config.cache['config_flow']}\n")
[ "def", "generate", "(", "integrations", ":", "Dict", "[", "str", ",", "Integration", "]", ",", "config", ":", "Config", ")", ":", "config_flow_path", "=", "config", ".", "root", "/", "\"homeassistant/generated/config_flows.py\"", "with", "open", "(", "str", "(...
[ 131, 0 ]
[ 135, 52 ]
python
en
['en', 'en', 'en']
True
setup_platform
(hass, config, add_entities, discovery_info=None)
Set up the Ziggo Mediabox XL platform.
Set up the Ziggo Mediabox XL platform.
def setup_platform(hass, config, add_entities, discovery_info=None): """Set up the Ziggo Mediabox XL platform.""" hass.data[DATA_KNOWN_DEVICES] = known_devices = set() # Is this a manual configuration? if config.get(CONF_HOST) is not None: host = config.get(CONF_HOST) name = config.get...
[ "def", "setup_platform", "(", "hass", ",", "config", ",", "add_entities", ",", "discovery_info", "=", "None", ")", ":", "hass", ".", "data", "[", "DATA_KNOWN_DEVICES", "]", "=", "known_devices", "=", "set", "(", ")", "# Is this a manual configuration?", "if", ...
[ 45, 0 ]
[ 91, 29 ]
python
en
['en', 'lv', 'en']
True
ZiggoMediaboxXLDevice.__init__
(self, mediabox, host, name, available)
Initialize the device.
Initialize the device.
def __init__(self, mediabox, host, name, available): """Initialize the device.""" self._mediabox = mediabox self._host = host self._name = name self._available = available self._state = None
[ "def", "__init__", "(", "self", ",", "mediabox", ",", "host", ",", "name", ",", "available", ")", ":", "self", ".", "_mediabox", "=", "mediabox", "self", ".", "_host", "=", "host", "self", ".", "_name", "=", "name", "self", ".", "_available", "=", "a...
[ 97, 4 ]
[ 103, 26 ]
python
en
['en', 'en', 'en']
True
ZiggoMediaboxXLDevice.update
(self)
Retrieve the state of the device.
Retrieve the state of the device.
def update(self): """Retrieve the state of the device.""" try: if self._mediabox.test_connection(): if self._mediabox.turned_on(): if self._state != STATE_PAUSED: self._state = STATE_PLAYING else: ...
[ "def", "update", "(", "self", ")", ":", "try", ":", "if", "self", ".", "_mediabox", ".", "test_connection", "(", ")", ":", "if", "self", ".", "_mediabox", ".", "turned_on", "(", ")", ":", "if", "self", ".", "_state", "!=", "STATE_PAUSED", ":", "self"...
[ 105, 4 ]
[ 119, 35 ]
python
en
['en', 'en', 'en']
True
ZiggoMediaboxXLDevice.send_keys
(self, keys)
Send keys to the device and handle exceptions.
Send keys to the device and handle exceptions.
def send_keys(self, keys): """Send keys to the device and handle exceptions.""" try: self._mediabox.send_keys(keys) except OSError: _LOGGER.error("Couldn't send keys to %s", self._host)
[ "def", "send_keys", "(", "self", ",", "keys", ")", ":", "try", ":", "self", ".", "_mediabox", ".", "send_keys", "(", "keys", ")", "except", "OSError", ":", "_LOGGER", ".", "error", "(", "\"Couldn't send keys to %s\"", ",", "self", ".", "_host", ")" ]
[ 121, 4 ]
[ 126, 65 ]
python
en
['en', 'en', 'en']
True
ZiggoMediaboxXLDevice.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" ]
[ 129, 4 ]
[ 131, 25 ]
python
en
['en', 'en', 'en']
True
ZiggoMediaboxXLDevice.state
(self)
Return the state of the device.
Return the state of the device.
def state(self): """Return the state of the device.""" return self._state
[ "def", "state", "(", "self", ")", ":", "return", "self", ".", "_state" ]
[ 134, 4 ]
[ 136, 26 ]
python
en
['en', 'en', 'en']
True
ZiggoMediaboxXLDevice.available
(self)
Return True if the device is available.
Return True if the device is available.
def available(self): """Return True if the device is available.""" return self._available
[ "def", "available", "(", "self", ")", ":", "return", "self", ".", "_available" ]
[ 139, 4 ]
[ 141, 30 ]
python
en
['en', 'en', 'en']
True
ZiggoMediaboxXLDevice.source_list
(self)
List of available sources (channels).
List of available sources (channels).
def source_list(self): """List of available sources (channels).""" return [ self._mediabox.channels()[c] for c in sorted(self._mediabox.channels().keys()) ]
[ "def", "source_list", "(", "self", ")", ":", "return", "[", "self", ".", "_mediabox", ".", "channels", "(", ")", "[", "c", "]", "for", "c", "in", "sorted", "(", "self", ".", "_mediabox", ".", "channels", "(", ")", ".", "keys", "(", ")", ")", "]" ...
[ 144, 4 ]
[ 149, 9 ]
python
en
['en', 'en', 'en']
True
ZiggoMediaboxXLDevice.supported_features
(self)
Flag media player features that are supported.
Flag media player features that are supported.
def supported_features(self): """Flag media player features that are supported.""" return SUPPORT_ZIGGO
[ "def", "supported_features", "(", "self", ")", ":", "return", "SUPPORT_ZIGGO" ]
[ 152, 4 ]
[ 154, 28 ]
python
en
['en', 'en', 'en']
True
ZiggoMediaboxXLDevice.turn_on
(self)
Turn the media player on.
Turn the media player on.
def turn_on(self): """Turn the media player on.""" self.send_keys(["POWER"])
[ "def", "turn_on", "(", "self", ")", ":", "self", ".", "send_keys", "(", "[", "\"POWER\"", "]", ")" ]
[ 156, 4 ]
[ 158, 33 ]
python
en
['en', 'en', 'en']
True
ZiggoMediaboxXLDevice.turn_off
(self)
Turn off media player.
Turn off media player.
def turn_off(self): """Turn off media player.""" self.send_keys(["POWER"])
[ "def", "turn_off", "(", "self", ")", ":", "self", ".", "send_keys", "(", "[", "\"POWER\"", "]", ")" ]
[ 160, 4 ]
[ 162, 33 ]
python
en
['en', 'en', 'en']
True
ZiggoMediaboxXLDevice.media_play
(self)
Send play command.
Send play command.
def media_play(self): """Send play command.""" self.send_keys(["PLAY"]) self._state = STATE_PLAYING
[ "def", "media_play", "(", "self", ")", ":", "self", ".", "send_keys", "(", "[", "\"PLAY\"", "]", ")", "self", ".", "_state", "=", "STATE_PLAYING" ]
[ 164, 4 ]
[ 167, 35 ]
python
en
['en', 'en', 'en']
True
ZiggoMediaboxXLDevice.media_pause
(self)
Send pause command.
Send pause command.
def media_pause(self): """Send pause command.""" self.send_keys(["PAUSE"]) self._state = STATE_PAUSED
[ "def", "media_pause", "(", "self", ")", ":", "self", ".", "send_keys", "(", "[", "\"PAUSE\"", "]", ")", "self", ".", "_state", "=", "STATE_PAUSED" ]
[ 169, 4 ]
[ 172, 34 ]
python
en
['en', 'en', 'en']
True
ZiggoMediaboxXLDevice.media_play_pause
(self)
Simulate play pause media player.
Simulate play pause media player.
def media_play_pause(self): """Simulate play pause media player.""" self.send_keys(["PAUSE"]) if self._state == STATE_PAUSED: self._state = STATE_PLAYING else: self._state = STATE_PAUSED
[ "def", "media_play_pause", "(", "self", ")", ":", "self", ".", "send_keys", "(", "[", "\"PAUSE\"", "]", ")", "if", "self", ".", "_state", "==", "STATE_PAUSED", ":", "self", ".", "_state", "=", "STATE_PLAYING", "else", ":", "self", ".", "_state", "=", "...
[ 174, 4 ]
[ 180, 38 ]
python
en
['en', 'en', 'it']
True
ZiggoMediaboxXLDevice.media_next_track
(self)
Channel up.
Channel up.
def media_next_track(self): """Channel up.""" self.send_keys(["CHAN_UP"]) self._state = STATE_PLAYING
[ "def", "media_next_track", "(", "self", ")", ":", "self", ".", "send_keys", "(", "[", "\"CHAN_UP\"", "]", ")", "self", ".", "_state", "=", "STATE_PLAYING" ]
[ 182, 4 ]
[ 185, 35 ]
python
en
['it', 'en', 'en']
False
ZiggoMediaboxXLDevice.media_previous_track
(self)
Channel down.
Channel down.
def media_previous_track(self): """Channel down.""" self.send_keys(["CHAN_DOWN"]) self._state = STATE_PLAYING
[ "def", "media_previous_track", "(", "self", ")", ":", "self", ".", "send_keys", "(", "[", "\"CHAN_DOWN\"", "]", ")", "self", ".", "_state", "=", "STATE_PLAYING" ]
[ 187, 4 ]
[ 190, 35 ]
python
en
['it', 'en', 'en']
False
ZiggoMediaboxXLDevice.select_source
(self, source)
Select the channel.
Select the channel.
def select_source(self, source): """Select the channel.""" if str(source).isdigit(): digits = str(source) else: digits = next( ( key for key, value in self._mediabox.channels().items() if value ==...
[ "def", "select_source", "(", "self", ",", "source", ")", ":", "if", "str", "(", "source", ")", ".", "isdigit", "(", ")", ":", "digits", "=", "str", "(", "source", ")", "else", ":", "digits", "=", "next", "(", "(", "key", "for", "key", ",", "value...
[ 192, 4 ]
[ 209, 35 ]
python
en
['en', 'en', 'en']
True
setup_platform
(hass, config, add_entities, discovery_info=None)
Set up the alarm platform.
Set up the alarm platform.
def setup_platform(hass, config, add_entities, discovery_info=None): """Set up the alarm platform.""" name = config[CONF_NAME] username = config[CONF_USERNAME] password = config[CONF_PASSWORD] area_id = config[CONF_AREA_ID] try: client = YaleSmartAlarmClient(username, password, area_id)...
[ "def", "setup_platform", "(", "hass", ",", "config", ",", "add_entities", ",", "discovery_info", "=", "None", ")", ":", "name", "=", "config", "[", "CONF_NAME", "]", "username", "=", "config", "[", "CONF_USERNAME", "]", "password", "=", "config", "[", "CON...
[ 48, 0 ]
[ 61, 55 ]
python
en
['en', 'ru', 'en']
True
YaleAlarmDevice.__init__
(self, name, client)
Initialize the Yale Alarm Device.
Initialize the Yale Alarm Device.
def __init__(self, name, client): """Initialize the Yale Alarm Device.""" self._name = name self._client = client self._state = None self._state_map = { YALE_STATE_DISARM: STATE_ALARM_DISARMED, YALE_STATE_ARM_PARTIAL: STATE_ALARM_ARMED_HOME, Y...
[ "def", "__init__", "(", "self", ",", "name", ",", "client", ")", ":", "self", ".", "_name", "=", "name", "self", ".", "_client", "=", "client", "self", ".", "_state", "=", "None", "self", ".", "_state_map", "=", "{", "YALE_STATE_DISARM", ":", "STATE_AL...
[ 67, 4 ]
[ 77, 9 ]
python
en
['en', 'en', 'en']
True
YaleAlarmDevice.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" ]
[ 80, 4 ]
[ 82, 25 ]
python
en
['en', 'en', 'en']
True
YaleAlarmDevice.state
(self)
Return the state of the device.
Return the state of the device.
def state(self): """Return the state of the device.""" return self._state
[ "def", "state", "(", "self", ")", ":", "return", "self", ".", "_state" ]
[ 85, 4 ]
[ 87, 26 ]
python
en
['en', 'en', 'en']
True
YaleAlarmDevice.supported_features
(self)
Return the list of supported features.
Return the list of supported features.
def supported_features(self) -> int: """Return the list of supported features.""" return SUPPORT_ALARM_ARM_HOME | SUPPORT_ALARM_ARM_AWAY
[ "def", "supported_features", "(", "self", ")", "->", "int", ":", "return", "SUPPORT_ALARM_ARM_HOME", "|", "SUPPORT_ALARM_ARM_AWAY" ]
[ 90, 4 ]
[ 92, 62 ]
python
en
['en', 'en', 'en']
True
YaleAlarmDevice.update
(self)
Return the state of the device.
Return the state of the device.
def update(self): """Return the state of the device.""" armed_status = self._client.get_armed_status() self._state = self._state_map.get(armed_status)
[ "def", "update", "(", "self", ")", ":", "armed_status", "=", "self", ".", "_client", ".", "get_armed_status", "(", ")", "self", ".", "_state", "=", "self", ".", "_state_map", ".", "get", "(", "armed_status", ")" ]
[ 94, 4 ]
[ 98, 55 ]
python
en
['en', 'en', 'en']
True
YaleAlarmDevice.alarm_disarm
(self, code=None)
Send disarm command.
Send disarm command.
def alarm_disarm(self, code=None): """Send disarm command.""" self._client.disarm()
[ "def", "alarm_disarm", "(", "self", ",", "code", "=", "None", ")", ":", "self", ".", "_client", ".", "disarm", "(", ")" ]
[ 100, 4 ]
[ 102, 29 ]
python
en
['en', 'pt', 'en']
True
YaleAlarmDevice.alarm_arm_home
(self, code=None)
Send arm home command.
Send arm home command.
def alarm_arm_home(self, code=None): """Send arm home command.""" self._client.arm_partial()
[ "def", "alarm_arm_home", "(", "self", ",", "code", "=", "None", ")", ":", "self", ".", "_client", ".", "arm_partial", "(", ")" ]
[ 104, 4 ]
[ 106, 34 ]
python
en
['en', 'pt', 'en']
True
YaleAlarmDevice.alarm_arm_away
(self, code=None)
Send arm away command.
Send arm away command.
def alarm_arm_away(self, code=None): """Send arm away command.""" self._client.arm_full()
[ "def", "alarm_arm_away", "(", "self", ",", "code", "=", "None", ")", ":", "self", ".", "_client", ".", "arm_full", "(", ")" ]
[ 108, 4 ]
[ 110, 31 ]
python
en
['en', 'en', 'en']
True
async_setup
(hass, config)
Set up configured Logi Circle component.
Set up configured Logi Circle component.
async def async_setup(hass, config): """Set up configured Logi Circle component.""" if DOMAIN not in config: return True conf = config[DOMAIN] config_flow.register_flow_implementation( hass, DOMAIN, client_id=conf[CONF_CLIENT_ID], client_secret=conf[CONF_CLIENT_...
[ "async", "def", "async_setup", "(", "hass", ",", "config", ")", ":", "if", "DOMAIN", "not", "in", "config", ":", "return", "True", "conf", "=", "config", "[", "DOMAIN", "]", "config_flow", ".", "register_flow_implementation", "(", "hass", ",", "DOMAIN", ",...
[ 91, 0 ]
[ 114, 15 ]
python
en
['en', 'su', 'en']
True
async_setup_entry
(hass, entry)
Set up Logi Circle from a config entry.
Set up Logi Circle from a config entry.
async def async_setup_entry(hass, entry): """Set up Logi Circle from a config entry.""" logi_circle = LogiCircle( client_id=entry.data[CONF_CLIENT_ID], client_secret=entry.data[CONF_CLIENT_SECRET], api_key=entry.data[CONF_API_KEY], redirect_uri=entry.data[CONF_REDIRECT_URI], ...
[ "async", "def", "async_setup_entry", "(", "hass", ",", "entry", ")", ":", "logi_circle", "=", "LogiCircle", "(", "client_id", "=", "entry", ".", "data", "[", "CONF_CLIENT_ID", "]", ",", "client_secret", "=", "entry", ".", "data", "[", "CONF_CLIENT_SECRET", "...
[ 117, 0 ]
[ 217, 15 ]
python
en
['en', 'en', 'en']
True
async_unload_entry
(hass, entry)
Unload a config entry.
Unload a config entry.
async def async_unload_entry(hass, entry): """Unload a config entry.""" for component in "camera", "sensor": await hass.config_entries.async_forward_entry_unload(entry, component) logi_circle = hass.data.pop(DATA_LOGI) # Tell API wrapper to close all aiohttp sessions, invalidate WS connections...
[ "async", "def", "async_unload_entry", "(", "hass", ",", "entry", ")", ":", "for", "component", "in", "\"camera\"", ",", "\"sensor\"", ":", "await", "hass", ".", "config_entries", ".", "async_forward_entry_unload", "(", "entry", ",", "component", ")", "logi_circl...
[ 220, 0 ]
[ 231, 15 ]
python
en
['en', 'es', 'en']
True
decrypt
(encrypted_string,key_val)
This is the decryption function It takes in input encrypted string and key value Prints nothing and return the decrypted string value
This is the decryption function It takes in input encrypted string and key value Prints nothing and return the decrypted string value
def decrypt(encrypted_string,key_val): '''This is the decryption function It takes in input encrypted string and key value Prints nothing and return the decrypted string value''' final = '"' encrypted_string = encrypted_string.upper() for i in range(len(encrypted_string)): decrypt_char =...
[ "def", "decrypt", "(", "encrypted_string", ",", "key_val", ")", ":", "final", "=", "'\"'", "encrypted_string", "=", "encrypted_string", ".", "upper", "(", ")", "for", "i", "in", "range", "(", "len", "(", "encrypted_string", ")", ")", ":", "decrypt_char", "...
[ 2, 0 ]
[ 14, 16 ]
python
en
['en', 'en', 'en']
True
encrypt
(input_string,key_val)
This is the encryption function It takes in input string and key value. Prints nothing and return the Encrypted string value
This is the encryption function It takes in input string and key value. Prints nothing and return the Encrypted string value
def encrypt(input_string,key_val): '''This is the encryption function It takes in input string and key value. Prints nothing and return the Encrypted string value''' final = "" input_string = input_string.upper() for i in range(len(input_string)): encrypt_char = ord(input_string[i]) + ke...
[ "def", "encrypt", "(", "input_string", ",", "key_val", ")", ":", "final", "=", "\"\"", "input_string", "=", "input_string", ".", "upper", "(", ")", "for", "i", "in", "range", "(", "len", "(", "input_string", ")", ")", ":", "encrypt_char", "=", "ord", "...
[ 17, 0 ]
[ 30, 16 ]
python
en
['en', 'en', 'en']
True
_get_values
(attribute, text)
Match attribute in text and return all matches. :returns: List of matches.
Match attribute in text and return all matches.
def _get_values(attribute, text): """Match attribute in text and return all matches. :returns: List of matches. """ regex = '{}\s+=\s+"(.*)";'.format(attribute) regex = re.compile(regex) values = regex.findall(text) return values
[ "def", "_get_values", "(", "attribute", ",", "text", ")", ":", "regex", "=", "'{}\\s+=\\s+\"(.*)\";'", ".", "format", "(", "attribute", ")", "regex", "=", "re", ".", "compile", "(", "regex", ")", "values", "=", "regex", ".", "findall", "(", "text", ")", ...
[ 59, 0 ]
[ 67, 17 ]
python
en
['en', 'en', 'en']
True
_get_unique_value
(attribute, text)
Match attribute in text and return unique match. :returns: Single match.
Match attribute in text and return unique match.
def _get_unique_value(attribute, text): """Match attribute in text and return unique match. :returns: Single match. """ values = _get_values(attribute, text) n = len(values) if n > 1: raise ValueError("found too many values for {}".format(attribute)) elif n == 1: return valu...
[ "def", "_get_unique_value", "(", "attribute", ",", "text", ")", ":", "values", "=", "_get_values", "(", "attribute", ",", "text", ")", "n", "=", "len", "(", "values", ")", "if", "n", ">", "1", ":", "raise", "ValueError", "(", "\"found too many values for {...
[ 69, 0 ]
[ 81, 67 ]
python
en
['en', 'en', 'en']
True
_get_line_and_value
(attribute, text)
Match attribute in text. Return the line and the value of the attribute.
Match attribute in text. Return the line and the value of the attribute.
def _get_line_and_value(attribute, text): """Match attribute in text. Return the line and the value of the attribute.""" regex = '({}\s+=\s+"(.*)";)'.format(attribute) regex = re.compile(regex) value = regex.findall(text) n = len(value) if n > 1: raise ValueError("found too many values f...
[ "def", "_get_line_and_value", "(", "attribute", ",", "text", ")", ":", "regex", "=", "'({}\\s+=\\s+\"(.*)\";)'", ".", "format", "(", "attribute", ")", "regex", "=", "re", ".", "compile", "(", "regex", ")", "value", "=", "regex", ".", "findall", "(", "text"...
[ 83, 0 ]
[ 94, 67 ]
python
en
['en', 'en', 'en']
True
_replace_value
(attribute, value, text)
Search and replace value of attribute in text.
Search and replace value of attribute in text.
def _replace_value(attribute, value, text): """Search and replace value of attribute in text.""" old_line, old_value = _get_line_and_value(attribute, text) new_line = old_line.replace(old_value, value) new_text = text.replace(old_line, new_line) return new_text
[ "def", "_replace_value", "(", "attribute", ",", "value", ",", "text", ")", ":", "old_line", ",", "old_value", "=", "_get_line_and_value", "(", "attribute", ",", "text", ")", "new_line", "=", "old_line", ".", "replace", "(", "old_value", ",", "value", ")", ...
[ 97, 0 ]
[ 102, 19 ]
python
en
['en', 'en', 'en']
True
_determine_latest_version
(current_version, target, versions)
Determine latest version, given `target`.
Determine latest version, given `target`.
def _determine_latest_version(current_version, target, versions): """Determine latest version, given `target`. """ current_version = Version(current_version) def _parse_versions(versions): for v in versions: try: yield Version(v) except InvalidVersion: ...
[ "def", "_determine_latest_version", "(", "current_version", ",", "target", ",", "versions", ")", ":", "current_version", "=", "Version", "(", "current_version", ")", "def", "_parse_versions", "(", "versions", ")", ":", "for", "v", "in", "versions", ":", "try", ...
[ 133, 0 ]
[ 162, 46 ]
python
en
['en', 'en', 'en']
True
_get_latest_version_pypi
(package, extension, current_version, target)
Get latest version and hash from PyPI.
Get latest version and hash from PyPI.
def _get_latest_version_pypi(package, extension, current_version, target): """Get latest version and hash from PyPI.""" url = "{}/{}/json".format(INDEX, package) json = _fetch_page(url) versions = json['releases'].keys() version = _determine_latest_version(current_version, target, versions) tr...
[ "def", "_get_latest_version_pypi", "(", "package", ",", "extension", ",", "current_version", ",", "target", ")", ":", "url", "=", "\"{}/{}/json\"", ".", "format", "(", "INDEX", ",", "package", ")", "json", "=", "_fetch_page", "(", "url", ")", "versions", "="...
[ 165, 0 ]
[ 184, 32 ]
python
en
['en', 'en', 'en']
True
_determine_extension
(text, fetcher)
Determine what extension is used in the expression. If we use: - fetchPypi, we check if format is specified. - fetchurl, we determine the extension from the url. - fetchFromGitHub we simply use `.tar.gz`.
Determine what extension is used in the expression.
def _determine_extension(text, fetcher): """Determine what extension is used in the expression. If we use: - fetchPypi, we check if format is specified. - fetchurl, we determine the extension from the url. - fetchFromGitHub we simply use `.tar.gz`. """ if fetcher == 'fetchPypi': try...
[ "def", "_determine_extension", "(", "text", ",", "fetcher", ")", ":", "if", "fetcher", "==", "'fetchPypi'", ":", "try", ":", "src_format", "=", "_get_unique_value", "(", "'format'", ",", "text", ")", "except", "ValueError", "as", "e", ":", "src_format", "=",...
[ 261, 0 ]
[ 302, 20 ]
python
en
['en', 'en', 'en']
True
_commit
(path, pname, old_version, new_version, pkgs_prefix="python: ", **kwargs)
Commit result.
Commit result.
def _commit(path, pname, old_version, new_version, pkgs_prefix="python: ", **kwargs): """Commit result. """ msg = f'{pkgs_prefix}{pname}: {old_version} -> {new_version}' try: subprocess.check_call([GIT, 'add', path]) subprocess.check_call([GIT, 'commit', '-m', msg]) except subproce...
[ "def", "_commit", "(", "path", ",", "pname", ",", "old_version", ",", "new_version", ",", "pkgs_prefix", "=", "\"python: \"", ",", "*", "*", "kwargs", ")", ":", "msg", "=", "f'{pkgs_prefix}{pname}: {old_version} -> {new_version}'", "try", ":", "subprocess", ".", ...
[ 379, 0 ]
[ 392, 15 ]
python
en
['de', 'en', 'en']
False
convert_wav2vec2_checkpoint
( checkpoint_path, pytorch_dump_folder_path, config_path=None, dict_path=None, is_finetuned=True )
Copy/paste/tweak model's weights to transformers design.
Copy/paste/tweak model's weights to transformers design.
def convert_wav2vec2_checkpoint( checkpoint_path, pytorch_dump_folder_path, config_path=None, dict_path=None, is_finetuned=True ): """ Copy/paste/tweak model's weights to transformers design. """ if config_path is not None: config = Wav2Vec2Config.from_pretrained(config_path) else: ...
[ "def", "convert_wav2vec2_checkpoint", "(", "checkpoint_path", ",", "pytorch_dump_folder_path", ",", "config_path", "=", "None", ",", "dict_path", "=", "None", ",", "is_finetuned", "=", "True", ")", ":", "if", "config_path", "is", "not", "None", ":", "config", "=...
[ 153, 0 ]
[ 180, 56 ]
python
en
['en', 'error', 'th']
False
setup
(hass, config)
Set up is called when Home Assistant is loading our component.
Set up is called when Home Assistant is loading our component.
def setup(hass, config): """Set up is called when Home Assistant is loading our component.""" dominos = Dominos(hass, config) component = EntityComponent(_LOGGER, DOMAIN, hass) hass.data[DOMAIN] = {} entities = [] conf = config[DOMAIN] hass.services.register(DOMAIN, "order", dominos.handle...
[ "def", "setup", "(", "hass", ",", "config", ")", ":", "dominos", "=", "Dominos", "(", "hass", ",", "config", ")", "component", "=", "EntityComponent", "(", "_LOGGER", ",", "DOMAIN", ",", "hass", ")", "hass", ".", "data", "[", "DOMAIN", "]", "=", "{",...
[ 64, 0 ]
[ 86, 15 ]
python
en
['en', 'en', 'en']
True
Dominos.__init__
(self, hass, config)
Set up main service.
Set up main service.
def __init__(self, hass, config): """Set up main service.""" conf = config[DOMAIN] self.hass = hass self.customer = Customer( conf.get(ATTR_FIRST_NAME), conf.get(ATTR_LAST_NAME), conf.get(ATTR_EMAIL), conf.get(ATTR_PHONE), conf...
[ "def", "__init__", "(", "self", ",", "hass", ",", "config", ")", ":", "conf", "=", "config", "[", "DOMAIN", "]", "self", ".", "hass", "=", "hass", "self", ".", "customer", "=", "Customer", "(", "conf", ".", "get", "(", "ATTR_FIRST_NAME", ")", ",", ...
[ 92, 4 ]
[ 111, 37 ]
python
en
['en', 'su', 'en']
True
Dominos.handle_order
(self, call)
Handle ordering pizza.
Handle ordering pizza.
def handle_order(self, call): """Handle ordering pizza.""" entity_ids = call.data.get(ATTR_ORDER_ENTITY) target_orders = [ order for order in self.hass.data[DOMAIN]["entities"] if order.entity_id in entity_ids ] for order in target_orders: ...
[ "def", "handle_order", "(", "self", ",", "call", ")", ":", "entity_ids", "=", "call", ".", "data", ".", "get", "(", "ATTR_ORDER_ENTITY", ")", "target_orders", "=", "[", "order", "for", "order", "in", "self", ".", "hass", ".", "data", "[", "DOMAIN", "]"...
[ 113, 4 ]
[ 124, 25 ]
python
en
['mt', 'en', 'en']
True
Dominos.update_closest_store
(self)
Update the shared closest store (if open).
Update the shared closest store (if open).
def update_closest_store(self): """Update the shared closest store (if open).""" try: self.closest_store = self.address.closest_store() return True except StoreException: self.closest_store = None return False
[ "def", "update_closest_store", "(", "self", ")", ":", "try", ":", "self", ".", "closest_store", "=", "self", ".", "address", ".", "closest_store", "(", ")", "return", "True", "except", "StoreException", ":", "self", ".", "closest_store", "=", "None", "return...
[ 127, 4 ]
[ 134, 24 ]
python
en
['en', 'en', 'en']
True
Dominos.get_menu
(self)
Return the products from the closest stores menu.
Return the products from the closest stores menu.
def get_menu(self): """Return the products from the closest stores menu.""" self.update_closest_store() if self.closest_store is None: _LOGGER.warning("Cannot get menu. Store may be closed") return [] menu = self.closest_store.get_menu() product_entries = ...
[ "def", "get_menu", "(", "self", ")", ":", "self", ".", "update_closest_store", "(", ")", "if", "self", ".", "closest_store", "is", "None", ":", "_LOGGER", ".", "warning", "(", "\"Cannot get menu. Store may be closed\"", ")", "return", "[", "]", "menu", "=", ...
[ 136, 4 ]
[ 155, 30 ]
python
en
['en', 'en', 'en']
True
DominosProductListView.__init__
(self, dominos)
Initialize suite view.
Initialize suite view.
def __init__(self, dominos): """Initialize suite view.""" self.dominos = dominos
[ "def", "__init__", "(", "self", ",", "dominos", ")", ":", "self", ".", "dominos", "=", "dominos" ]
[ 164, 4 ]
[ 166, 30 ]
python
en
['en', 'en', 'en']
True
DominosProductListView.get
(self, request)
Retrieve if API is running.
Retrieve if API is running.
def get(self, request): """Retrieve if API is running.""" return self.json(self.dominos.get_menu())
[ "def", "get", "(", "self", ",", "request", ")", ":", "return", "self", ".", "json", "(", "self", ".", "dominos", ".", "get_menu", "(", ")", ")" ]
[ 169, 4 ]
[ 171, 49 ]
python
en
['en', 'sn', 'en']
True
DominosOrder.__init__
(self, order_info, dominos)
Set up the entity.
Set up the entity.
def __init__(self, order_info, dominos): """Set up the entity.""" self._name = order_info["name"] self._product_codes = order_info["codes"] self._orderable = False self.dominos = dominos
[ "def", "__init__", "(", "self", ",", "order_info", ",", "dominos", ")", ":", "self", ".", "_name", "=", "order_info", "[", "\"name\"", "]", "self", ".", "_product_codes", "=", "order_info", "[", "\"codes\"", "]", "self", ".", "_orderable", "=", "False", ...
[ 177, 4 ]
[ 182, 30 ]
python
en
['en', 'zu', 'en']
True
DominosOrder.name
(self)
Return the orders name.
Return the orders name.
def name(self): """Return the orders name.""" return self._name
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "_name" ]
[ 185, 4 ]
[ 187, 25 ]
python
en
['en', 'ig', 'en']
True
DominosOrder.product_codes
(self)
Return the orders product codes.
Return the orders product codes.
def product_codes(self): """Return the orders product codes.""" return self._product_codes
[ "def", "product_codes", "(", "self", ")", ":", "return", "self", ".", "_product_codes" ]
[ 190, 4 ]
[ 192, 34 ]
python
en
['en', 'en', 'en']
True
DominosOrder.orderable
(self)
Return the true if orderable.
Return the true if orderable.
def orderable(self): """Return the true if orderable.""" return self._orderable
[ "def", "orderable", "(", "self", ")", ":", "return", "self", ".", "_orderable" ]
[ 195, 4 ]
[ 197, 30 ]
python
en
['en', 'en', 'en']
True
DominosOrder.state
(self)
Return the state either closed, orderable or unorderable.
Return the state either closed, orderable or unorderable.
def state(self): """Return the state either closed, orderable or unorderable.""" if self.dominos.closest_store is None: return "closed" return "orderable" if self._orderable else "unorderable"
[ "def", "state", "(", "self", ")", ":", "if", "self", ".", "dominos", ".", "closest_store", "is", "None", ":", "return", "\"closed\"", "return", "\"orderable\"", "if", "self", ".", "_orderable", "else", "\"unorderable\"" ]
[ 200, 4 ]
[ 204, 64 ]
python
en
['en', 'en', 'en']
True
DominosOrder.update
(self)
Update the order state and refreshes the store.
Update the order state and refreshes the store.
def update(self): """Update the order state and refreshes the store.""" try: self.dominos.update_closest_store() except StoreException: self._orderable = False return try: order = self.order() order.pay_with() self....
[ "def", "update", "(", "self", ")", ":", "try", ":", "self", ".", "dominos", ".", "update_closest_store", "(", ")", "except", "StoreException", ":", "self", ".", "_orderable", "=", "False", "return", "try", ":", "order", "=", "self", ".", "order", "(", ...
[ 207, 4 ]
[ 220, 35 ]
python
en
['en', 'en', 'en']
True
DominosOrder.order
(self)
Create the order object.
Create the order object.
def order(self): """Create the order object.""" if self.dominos.closest_store is None: raise StoreException order = Order( self.dominos.closest_store, self.dominos.customer, self.dominos.address, self.dominos.country, ) ...
[ "def", "order", "(", "self", ")", ":", "if", "self", ".", "dominos", ".", "closest_store", "is", "None", ":", "raise", "StoreException", "order", "=", "Order", "(", "self", ".", "dominos", ".", "closest_store", ",", "self", ".", "dominos", ".", "customer...
[ 222, 4 ]
[ 237, 20 ]
python
en
['en', 'en', 'en']
True
DominosOrder.place
(self)
Place the order.
Place the order.
def place(self): """Place the order.""" try: order = self.order() order.place() except StoreException: self._orderable = False _LOGGER.warning( "Attempted to order Dominos - Order invalid or store closed" )
[ "def", "place", "(", "self", ")", ":", "try", ":", "order", "=", "self", ".", "order", "(", ")", "order", ".", "place", "(", ")", "except", "StoreException", ":", "self", ".", "_orderable", "=", "False", "_LOGGER", ".", "warning", "(", "\"Attempted to ...
[ 239, 4 ]
[ 248, 13 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
(hass, config_entry, async_add_entities)
Set up automations for a Nexia device.
Set up automations for a Nexia device.
async def async_setup_entry(hass, config_entry, async_add_entities): """Set up automations for a Nexia device.""" nexia_data = hass.data[DOMAIN][config_entry.entry_id] nexia_home = nexia_data[NEXIA_DEVICE] coordinator = nexia_data[UPDATE_COORDINATOR] entities = [] # Automation switches for...
[ "async", "def", "async_setup_entry", "(", "hass", ",", "config_entry", ",", "async_add_entities", ")", ":", "nexia_data", "=", "hass", ".", "data", "[", "DOMAIN", "]", "[", "config_entry", ".", "entry_id", "]", "nexia_home", "=", "nexia_data", "[", "NEXIA_DEVI...
[ 13, 0 ]
[ 27, 38 ]
python
en
['en', 'en', 'en']
True
NexiaAutomationScene.__init__
(self, coordinator, automation)
Initialize the automation scene.
Initialize the automation scene.
def __init__(self, coordinator, automation): """Initialize the automation scene.""" super().__init__( coordinator, name=automation.name, unique_id=automation.automation_id, ) self._automation = automation
[ "def", "__init__", "(", "self", ",", "coordinator", ",", "automation", ")", ":", "super", "(", ")", ".", "__init__", "(", "coordinator", ",", "name", "=", "automation", ".", "name", ",", "unique_id", "=", "automation", ".", "automation_id", ",", ")", "se...
[ 33, 4 ]
[ 40, 37 ]
python
en
['en', 'en', 'en']
True
NexiaAutomationScene.device_state_attributes
(self)
Return the scene specific state attributes.
Return the scene specific state attributes.
def device_state_attributes(self): """Return the scene specific state attributes.""" data = super().device_state_attributes data[ATTR_DESCRIPTION] = self._automation.description return data
[ "def", "device_state_attributes", "(", "self", ")", ":", "data", "=", "super", "(", ")", ".", "device_state_attributes", "data", "[", "ATTR_DESCRIPTION", "]", "=", "self", ".", "_automation", ".", "description", "return", "data" ]
[ 43, 4 ]
[ 47, 19 ]
python
en
['en', 'it', 'en']
True
NexiaAutomationScene.icon
(self)
Return the icon of the automation scene.
Return the icon of the automation scene.
def icon(self): """Return the icon of the automation scene.""" return "mdi:script-text-outline"
[ "def", "icon", "(", "self", ")", ":", "return", "\"mdi:script-text-outline\"" ]
[ 50, 4 ]
[ 52, 40 ]
python
en
['en', 'en', 'en']
True
NexiaAutomationScene.async_activate
(self, **kwargs: Any)
Activate an automation scene.
Activate an automation scene.
async def async_activate(self, **kwargs: Any) -> None: """Activate an automation scene.""" await self.hass.async_add_executor_job(self._automation.activate) async def refresh_callback(_): await self.coordinator.async_refresh() async_call_later(self.hass, SCENE_ACTIVATION_TI...
[ "async", "def", "async_activate", "(", "self", ",", "*", "*", "kwargs", ":", "Any", ")", "->", "None", ":", "await", "self", ".", "hass", ".", "async_add_executor_job", "(", "self", ".", "_automation", ".", "activate", ")", "async", "def", "refresh_callbac...
[ 54, 4 ]
[ 61, 76 ]
python
en
['en', 'en', 'en']
True
async_get_conditions
( hass: HomeAssistant, device_id: str )
List device conditions for Fan devices.
List device conditions for Fan devices.
async def async_get_conditions( hass: HomeAssistant, device_id: str ) -> List[Dict[str, str]]: """List device conditions for Fan devices.""" registry = await entity_registry.async_get_registry(hass) conditions = [] # Get all the integrations entities for this device for entry in entity_registry...
[ "async", "def", "async_get_conditions", "(", "hass", ":", "HomeAssistant", ",", "device_id", ":", "str", ")", "->", "List", "[", "Dict", "[", "str", ",", "str", "]", "]", ":", "registry", "=", "await", "entity_registry", ".", "async_get_registry", "(", "ha...
[ 32, 0 ]
[ 63, 21 ]
python
en
['fr', 'en', 'en']
True
async_condition_from_config
( config: ConfigType, config_validation: bool )
Create a function to test a device condition.
Create a function to test a device condition.
def async_condition_from_config( config: ConfigType, config_validation: bool ) -> condition.ConditionCheckerType: """Create a function to test a device condition.""" if config_validation: config = CONDITION_SCHEMA(config) if config[CONF_TYPE] == "is_on": state = STATE_ON else: ...
[ "def", "async_condition_from_config", "(", "config", ":", "ConfigType", ",", "config_validation", ":", "bool", ")", "->", "condition", ".", "ConditionCheckerType", ":", "if", "config_validation", ":", "config", "=", "CONDITION_SCHEMA", "(", "config", ")", "if", "c...
[ 67, 0 ]
[ 83, 24 ]
python
en
['en', 'en', 'en']
True
create_optimizer
( init_lr: float, num_train_steps: int, num_warmup_steps: int, min_lr_ratio: float = 0.0, adam_beta1: float = 0.9, adam_beta2: float = 0.999, adam_epsilon: float = 1e-8, weight_decay_rate: float = 0.0, power: float = 1.0, include_in_weight_decay: Optional[List[str]] = None, )
Creates an optimizer with a learning rate schedule using a warmup phase followed by a linear decay. Args: init_lr (:obj:`float`): The desired learning rate at the end of the warmup phase. num_train_steps (:obj:`int`): The total number of training steps. num_warm...
Creates an optimizer with a learning rate schedule using a warmup phase followed by a linear decay.
def create_optimizer( init_lr: float, num_train_steps: int, num_warmup_steps: int, min_lr_ratio: float = 0.0, adam_beta1: float = 0.9, adam_beta2: float = 0.999, adam_epsilon: float = 1e-8, weight_decay_rate: float = 0.0, power: float = 1.0, include_in_weight_decay: Optional[List...
[ "def", "create_optimizer", "(", "init_lr", ":", "float", ",", "num_train_steps", ":", "int", ",", "num_warmup_steps", ":", "int", ",", "min_lr_ratio", ":", "float", "=", "0.0", ",", "adam_beta1", ":", "float", "=", "0.9", ",", "adam_beta2", ":", "float", "...
[ 81, 0 ]
[ 148, 33 ]
python
en
['en', 'error', 'th']
False
AdamWeightDecay.from_config
(cls, config)
Creates an optimizer from its config with WarmUp custom object.
Creates an optimizer from its config with WarmUp custom object.
def from_config(cls, config): """Creates an optimizer from its config with WarmUp custom object.""" custom_objects = {"WarmUp": WarmUp} return super(AdamWeightDecay, cls).from_config(config, custom_objects=custom_objects)
[ "def", "from_config", "(", "cls", ",", "config", ")", ":", "custom_objects", "=", "{", "\"WarmUp\"", ":", "WarmUp", "}", "return", "super", "(", "AdamWeightDecay", ",", "cls", ")", ".", "from_config", "(", "config", ",", "custom_objects", "=", "custom_object...
[ 209, 4 ]
[ 212, 93 ]
python
en
['en', 'en', 'en']
True
AdamWeightDecay._get_lr
(self, var_device, var_dtype, apply_state)
Retrieves the learning rate with the given state.
Retrieves the learning rate with the given state.
def _get_lr(self, var_device, var_dtype, apply_state): """Retrieves the learning rate with the given state.""" if apply_state is None: return self._decayed_lr_t[var_dtype], {} apply_state = apply_state or {} coefficients = apply_state.get((var_device, var_dtype)) if ...
[ "def", "_get_lr", "(", "self", ",", "var_device", ",", "var_dtype", ",", "apply_state", ")", ":", "if", "apply_state", "is", "None", ":", "return", "self", ".", "_decayed_lr_t", "[", "var_dtype", "]", ",", "{", "}", "apply_state", "=", "apply_state", "or",...
[ 233, 4 ]
[ 244, 66 ]
python
en
['en', 'en', 'en']
True
AdamWeightDecay._do_use_weight_decay
(self, param_name)
Whether to use L2 weight decay for `param_name`.
Whether to use L2 weight decay for `param_name`.
def _do_use_weight_decay(self, param_name): """Whether to use L2 weight decay for `param_name`.""" if self.weight_decay_rate == 0: return False if self._include_in_weight_decay: for r in self._include_in_weight_decay: if re.search(r, param_name) is not No...
[ "def", "_do_use_weight_decay", "(", "self", ",", "param_name", ")", ":", "if", "self", ".", "weight_decay_rate", "==", "0", ":", "return", "False", "if", "self", ".", "_include_in_weight_decay", ":", "for", "r", "in", "self", ".", "_include_in_weight_decay", "...
[ 263, 4 ]
[ 277, 19 ]
python
en
['en', 'en', 'en']
True
GradientAccumulator.__init__
(self)
Initializes the accumulator.
Initializes the accumulator.
def __init__(self): """Initializes the accumulator.""" self._gradients = [] self._accum_steps = None
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "_gradients", "=", "[", "]", "self", ".", "_accum_steps", "=", "None" ]
[ 292, 4 ]
[ 295, 32 ]
python
en
['en', 'la', 'en']
True
GradientAccumulator.step
(self)
Number of accumulated steps.
Number of accumulated steps.
def step(self): """Number of accumulated steps.""" if self._accum_steps is None: self._accum_steps = tf.Variable( tf.constant(0, dtype=tf.int64), trainable=False, synchronization=tf.VariableSynchronization.ON_READ, aggregation=t...
[ "def", "step", "(", "self", ")", ":", "if", "self", ".", "_accum_steps", "is", "None", ":", "self", ".", "_accum_steps", "=", "tf", ".", "Variable", "(", "tf", ".", "constant", "(", "0", ",", "dtype", "=", "tf", ".", "int64", ")", ",", "trainable",...
[ 298, 4 ]
[ 308, 40 ]
python
en
['en', 'en', 'en']
True