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_restoring_client
(hass, aioclient_mock)
Verify clients are restored from clients_all if they ever was registered to entity registry.
Verify clients are restored from clients_all if they ever was registered to entity registry.
async def test_restoring_client(hass, aioclient_mock): """Verify clients are restored from clients_all if they ever was registered to entity registry.""" client = { "hostname": "client", "is_wired": True, "last_seen": 1562600145, "mac": "00:00:00:00:00:01", } restored = {...
[ "async", "def", "test_restoring_client", "(", "hass", ",", "aioclient_mock", ")", ":", "client", "=", "{", "\"hostname\"", ":", "\"client\"", ",", "\"is_wired\"", ":", "True", ",", "\"last_seen\"", ":", "1562600145", ",", "\"mac\"", ":", "\"00:00:00:00:00:01\"", ...
[ 918, 0 ]
[ 969, 61 ]
python
en
['en', 'en', 'en']
True
test_dont_track_clients
(hass, aioclient_mock)
Test don't track clients config works.
Test don't track clients config works.
async def test_dont_track_clients(hass, aioclient_mock): """Test don't track clients config works.""" wireless_client = { "essid": "ssid", "hostname": "Wireless client", "ip": "10.0.0.1", "is_wired": False, "last_seen": 1562600145, "mac": "00:00:00:00:00:01", ...
[ "async", "def", "test_dont_track_clients", "(", "hass", ",", "aioclient_mock", ")", ":", "wireless_client", "=", "{", "\"essid\"", ":", "\"ssid\"", ",", "\"hostname\"", ":", "\"Wireless client\"", ",", "\"ip\"", ":", "\"10.0.0.1\"", ",", "\"is_wired\"", ":", "Fals...
[ 972, 0 ]
[ 1029, 51 ]
python
en
['nl', 'en', 'en']
True
test_dont_track_devices
(hass, aioclient_mock)
Test don't track devices config works.
Test don't track devices config works.
async def test_dont_track_devices(hass, aioclient_mock): """Test don't track devices config works.""" client = { "hostname": "client", "is_wired": True, "last_seen": 1562600145, "mac": "00:00:00:00:00:01", } device = { "board_rev": 3, "device_id": "mock-id...
[ "async", "def", "test_dont_track_devices", "(", "hass", ",", "aioclient_mock", ")", ":", "client", "=", "{", "\"hostname\"", ":", "\"client\"", ",", "\"is_wired\"", ":", "True", ",", "\"last_seen\"", ":", "1562600145", ",", "\"mac\"", ":", "\"00:00:00:00:00:01\"",...
[ 1032, 0 ]
[ 1078, 51 ]
python
en
['nl', 'en', 'en']
True
test_dont_track_wired_clients
(hass, aioclient_mock)
Test don't track wired clients config works.
Test don't track wired clients config works.
async def test_dont_track_wired_clients(hass, aioclient_mock): """Test don't track wired clients config works.""" wireless_client = { "essid": "ssid", "hostname": "Wireless Client", "is_wired": False, "last_seen": 1562600145, "mac": "00:00:00:00:00:01", } wired_cl...
[ "async", "def", "test_dont_track_wired_clients", "(", "hass", ",", "aioclient_mock", ")", ":", "wireless_client", "=", "{", "\"essid\"", ":", "\"ssid\"", ",", "\"hostname\"", ":", "\"Wireless Client\"", ",", "\"is_wired\"", ":", "False", ",", "\"last_seen\"", ":", ...
[ 1081, 0 ]
[ 1116, 57 ]
python
en
['en', 'en', 'en']
True
setup_platform
(hass, config, add_entities, discovery_info=None)
Set up the sensors. Login to the bank and get a list of existing accounts. Create a sensor for each account.
Set up the sensors.
def setup_platform(hass, config, add_entities, discovery_info=None): """Set up the sensors. Login to the bank and get a list of existing accounts. Create a sensor for each account. """ credentials = BankCredentials( config[CONF_BIN], config[CONF_USERNAME], config[CONF_PIN], config[CONF_URL]...
[ "def", "setup_platform", "(", "hass", ",", "config", ",", "add_entities", ",", "discovery_info", "=", "None", ")", ":", "credentials", "=", "BankCredentials", "(", "config", "[", "CONF_BIN", "]", ",", "config", "[", "CONF_USERNAME", "]", ",", "config", "[", ...
[ 53, 0 ]
[ 102, 32 ]
python
en
['en', 'bg', 'en']
True
FinTsClient.__init__
(self, credentials: BankCredentials, name: str)
Initialize a FinTsClient.
Initialize a FinTsClient.
def __init__(self, credentials: BankCredentials, name: str) -> None: """Initialize a FinTsClient.""" self._credentials = credentials self.name = name
[ "def", "__init__", "(", "self", ",", "credentials", ":", "BankCredentials", ",", "name", ":", "str", ")", "->", "None", ":", "self", ".", "_credentials", "=", "credentials", "self", ".", "name", "=", "name" ]
[ 111, 4 ]
[ 114, 24 ]
python
en
['en', 'fr', 'it']
False
FinTsClient.client
(self)
Get the client object. As the fints library is stateless, there is not benefit in caching the client objects. If that ever changes, consider caching the client object and also think about potential concurrency problems.
Get the client object.
def client(self): """Get the client object. As the fints library is stateless, there is not benefit in caching the client objects. If that ever changes, consider caching the client object and also think about potential concurrency problems. """ return FinTS3PinTanClient...
[ "def", "client", "(", "self", ")", ":", "return", "FinTS3PinTanClient", "(", "self", ".", "_credentials", ".", "blz", ",", "self", ".", "_credentials", ".", "login", ",", "self", ".", "_credentials", ".", "pin", ",", "self", ".", "_credentials", ".", "ur...
[ 117, 4 ]
[ 130, 9 ]
python
en
['en', 'en', 'en']
True
FinTsClient.detect_accounts
(self)
Identify the accounts of the bank.
Identify the accounts of the bank.
def detect_accounts(self): """Identify the accounts of the bank.""" balance_accounts = [] holdings_accounts = [] for account in self.client.get_sepa_accounts(): try: self.client.get_balance(account) balance_accounts.append(account) ...
[ "def", "detect_accounts", "(", "self", ")", ":", "balance_accounts", "=", "[", "]", "holdings_accounts", "=", "[", "]", "for", "account", "in", "self", ".", "client", ".", "get_sepa_accounts", "(", ")", ":", "try", ":", "self", ".", "client", ".", "get_b...
[ 132, 4 ]
[ 154, 50 ]
python
en
['en', 'en', 'en']
True
FinTsAccount.__init__
(self, client: FinTsClient, account, name: str)
Initialize a FinTs balance account.
Initialize a FinTs balance account.
def __init__(self, client: FinTsClient, account, name: str) -> None: """Initialize a FinTs balance account.""" self._client = client self._account = account self._attr_name = name self._attr_icon = ICON self._attr_extra_state_attributes = { ATTR_ACCOUNT: self....
[ "def", "__init__", "(", "self", ",", "client", ":", "FinTsClient", ",", "account", ",", "name", ":", "str", ")", "->", "None", ":", "self", ".", "_client", "=", "client", "self", ".", "_account", "=", "account", "self", ".", "_attr_name", "=", "name", ...
[ 164, 4 ]
[ 175, 76 ]
python
en
['en', 'en', 'en']
True
FinTsAccount.update
(self)
Get the current balance and currency for the account.
Get the current balance and currency for the account.
def update(self) -> None: """Get the current balance and currency for the account.""" bank = self._client.client balance = bank.get_balance(self._account) self._attr_native_value = balance.amount.amount self._attr_native_unit_of_measurement = balance.amount.currency _LOGG...
[ "def", "update", "(", "self", ")", "->", "None", ":", "bank", "=", "self", ".", "_client", ".", "client", "balance", "=", "bank", ".", "get_balance", "(", "self", ".", "_account", ")", "self", ".", "_attr_native_value", "=", "balance", ".", "amount", "...
[ 177, 4 ]
[ 183, 65 ]
python
en
['en', 'en', 'en']
True
FinTsHoldingsAccount.__init__
(self, client: FinTsClient, account, name: str)
Initialize a FinTs holdings account.
Initialize a FinTs holdings account.
def __init__(self, client: FinTsClient, account, name: str) -> None: """Initialize a FinTs holdings account.""" self._client = client self._attr_name = name self._account = account self._holdings: list[Any] = [] self._attr_icon = ICON self._attr_native_unit_of_mea...
[ "def", "__init__", "(", "self", ",", "client", ":", "FinTsClient", ",", "account", ",", "name", ":", "str", ")", "->", "None", ":", "self", ".", "_client", "=", "client", "self", ".", "_attr_name", "=", "name", "self", ".", "_account", "=", "account", ...
[ 193, 4 ]
[ 200, 53 ]
python
en
['en', 'en', 'en']
True
FinTsHoldingsAccount.update
(self)
Get the current holdings for the account.
Get the current holdings for the account.
def update(self) -> None: """Get the current holdings for the account.""" bank = self._client.client self._holdings = bank.get_holdings(self._account) self._attr_native_value = sum(h.total_value for h in self._holdings)
[ "def", "update", "(", "self", ")", "->", "None", ":", "bank", "=", "self", ".", "_client", ".", "client", "self", ".", "_holdings", "=", "bank", ".", "get_holdings", "(", "self", ".", "_account", ")", "self", ".", "_attr_native_value", "=", "sum", "(",...
[ 202, 4 ]
[ 206, 76 ]
python
en
['en', 'en', 'en']
True
FinTsHoldingsAccount.extra_state_attributes
(self)
Additional attributes of the sensor. Lists each holding of the account with the current value.
Additional attributes of the sensor.
def extra_state_attributes(self) -> dict: """Additional attributes of the sensor. Lists each holding of the account with the current value. """ attributes = { ATTR_ACCOUNT: self._account.accountnumber, ATTR_ACCOUNT_TYPE: "holdings", } if self._cli...
[ "def", "extra_state_attributes", "(", "self", ")", "->", "dict", ":", "attributes", "=", "{", "ATTR_ACCOUNT", ":", "self", ".", "_account", ".", "accountnumber", ",", "ATTR_ACCOUNT_TYPE", ":", "\"holdings\"", ",", "}", "if", "self", ".", "_client", ".", "nam...
[ 209, 4 ]
[ 228, 25 ]
python
en
['en', 'en', 'en']
True
read_keys
(base, key)
Return list of registry keys.
Return list of registry keys.
def read_keys(base, key): """Return list of registry keys.""" try: handle = RegOpenKeyEx(base, key) except RegError: return None L = [] i = 0 while True: try: k = RegEnumKey(handle, i) except RegError: break L.append(k) i +=...
[ "def", "read_keys", "(", "base", ",", "key", ")", ":", "try", ":", "handle", "=", "RegOpenKeyEx", "(", "base", ",", "key", ")", "except", "RegError", ":", "return", "None", "L", "=", "[", "]", "i", "=", "0", "while", "True", ":", "try", ":", "k",...
[ 54, 0 ]
[ 69, 12 ]
python
en
['en', 'no', 'en']
True
read_values
(base, key)
Return dict of registry keys and values. All names are converted to lowercase.
Return dict of registry keys and values.
def read_values(base, key): """Return dict of registry keys and values. All names are converted to lowercase. """ try: handle = RegOpenKeyEx(base, key) except RegError: return None d = {} i = 0 while True: try: name, value, type = RegEnumValue(handle,...
[ "def", "read_values", "(", "base", ",", "key", ")", ":", "try", ":", "handle", "=", "RegOpenKeyEx", "(", "base", ",", "key", ")", "except", "RegError", ":", "return", "None", "d", "=", "{", "}", "i", "=", "0", "while", "True", ":", "try", ":", "n...
[ 71, 0 ]
[ 90, 12 ]
python
en
['en', 'en', 'en']
True
get_build_version
()
Return the version of MSVC that was used to build Python. For Python 2.3 and up, the version number is included in sys.version. For earlier versions, assume the compiler is MSVC 6.
Return the version of MSVC that was used to build Python.
def get_build_version(): """Return the version of MSVC that was used to build Python. For Python 2.3 and up, the version number is included in sys.version. For earlier versions, assume the compiler is MSVC 6. """ prefix = "MSC v." i = sys.version.find(prefix) if i == -1: return 6 ...
[ "def", "get_build_version", "(", ")", ":", "prefix", "=", "\"MSC v.\"", "i", "=", "sys", ".", "version", ".", "find", "(", "prefix", ")", "if", "i", "==", "-", "1", ":", "return", "6", "i", "=", "i", "+", "len", "(", "prefix", ")", "s", ",", "r...
[ 146, 0 ]
[ 169, 15 ]
python
en
['en', 'en', 'en']
True
get_build_architecture
()
Return the processor architecture. Possible results are "Intel" or "AMD64".
Return the processor architecture.
def get_build_architecture(): """Return the processor architecture. Possible results are "Intel" or "AMD64". """ prefix = " bit (" i = sys.version.find(prefix) if i == -1: return "Intel" j = sys.version.find(")", i) return sys.version[i+len(prefix):j]
[ "def", "get_build_architecture", "(", ")", ":", "prefix", "=", "\" bit (\"", "i", "=", "sys", ".", "version", ".", "find", "(", "prefix", ")", "if", "i", "==", "-", "1", ":", "return", "\"Intel\"", "j", "=", "sys", ".", "version", ".", "find", "(", ...
[ 171, 0 ]
[ 182, 39 ]
python
en
['en', 'it', 'en']
True
normalize_and_reduce_paths
(paths)
Return a list of normalized paths with duplicates removed. The current order of paths is maintained.
Return a list of normalized paths with duplicates removed.
def normalize_and_reduce_paths(paths): """Return a list of normalized paths with duplicates removed. The current order of paths is maintained. """ # Paths are normalized so things like: /a and /a/ aren't both preserved. reduced_paths = [] for p in paths: np = os.path.normpath(p) ...
[ "def", "normalize_and_reduce_paths", "(", "paths", ")", ":", "# Paths are normalized so things like: /a and /a/ aren't both preserved.", "reduced_paths", "=", "[", "]", "for", "p", "in", "paths", ":", "np", "=", "os", ".", "path", ".", "normpath", "(", "p", ")", ...
[ 184, 0 ]
[ 196, 24 ]
python
en
['en', 'en', 'en']
True
MSVCCompiler.find_exe
(self, exe)
Return path to an MSVC executable program. Tries to find the program in several places: first, one of the MSVC program search paths from the registry; next, the directories in the PATH environment variable. If any of those work, return an absolute path that is known to exist. If none ...
Return path to an MSVC executable program.
def find_exe(self, exe): """Return path to an MSVC executable program. Tries to find the program in several places: first, one of the MSVC program search paths from the registry; next, the directories in the PATH environment variable. If any of those work, return an absolute pa...
[ "def", "find_exe", "(", "self", ",", "exe", ")", ":", "for", "p", "in", "self", ".", "__paths", ":", "fn", "=", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "abspath", "(", "p", ")", ",", "exe", ")", "if", "os", ".", "path", ...
[ 564, 4 ]
[ 584, 18 ]
python
en
['en', 'en', 'en']
True
MSVCCompiler.get_msvc_paths
(self, path, platform='x86')
Get a list of devstudio directories (include, lib or path). Return a list of strings. The list will be empty if unable to access the registry or appropriate registry keys not found.
Get a list of devstudio directories (include, lib or path).
def get_msvc_paths(self, path, platform='x86'): """Get a list of devstudio directories (include, lib or path). Return a list of strings. The list will be empty if unable to access the registry or appropriate registry keys not found. """ if not _can_read_reg: return ...
[ "def", "get_msvc_paths", "(", "self", ",", "path", ",", "platform", "=", "'x86'", ")", ":", "if", "not", "_can_read_reg", ":", "return", "[", "]", "path", "=", "path", "+", "\" dirs\"", "if", "self", ".", "__version", ">=", "7", ":", "key", "=", "(",...
[ 586, 4 ]
[ 620, 17 ]
python
en
['en', 'en', 'en']
True
MSVCCompiler.set_path_env_var
(self, name)
Set environment variable 'name' to an MSVC path type value. This is equivalent to a SET command prior to execution of spawned commands.
Set environment variable 'name' to an MSVC path type value.
def set_path_env_var(self, name): """Set environment variable 'name' to an MSVC path type value. This is equivalent to a SET command prior to execution of spawned commands. """ if name == "lib": p = self.get_msvc_paths("library") else: p = self.g...
[ "def", "set_path_env_var", "(", "self", ",", "name", ")", ":", "if", "name", "==", "\"lib\"", ":", "p", "=", "self", ".", "get_msvc_paths", "(", "\"library\"", ")", "else", ":", "p", "=", "self", ".", "get_msvc_paths", "(", "name", ")", "if", "p", ":...
[ 622, 4 ]
[ 634, 42 ]
python
en
['en', 'en', 'en']
True
async_setup_platform
(hass, config, async_add_entities, discovery_info=None)
Create the IntesisHome climate devices.
Create the IntesisHome climate devices.
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None): """Create the IntesisHome climate devices.""" ih_user = config[CONF_USERNAME] ih_pass = config[CONF_PASSWORD] device_type = config[CONF_DEVICE] controller = IntesisHome( ih_user, ih_pass, ...
[ "async", "def", "async_setup_platform", "(", "hass", ",", "config", ",", "async_add_entities", ",", "discovery_info", "=", "None", ")", ":", "ih_user", "=", "config", "[", "CONF_USERNAME", "]", "ih_pass", "=", "config", "[", "CONF_PASSWORD", "]", "device_type", ...
[ 91, 0 ]
[ 128, 31 ]
python
en
['en', 'en', 'en']
True
IntesisAC.__init__
(self, ih_device_id, ih_device, controller)
Initialize the thermostat.
Initialize the thermostat.
def __init__(self, ih_device_id, ih_device, controller): """Initialize the thermostat.""" self._controller = controller self._device_id = ih_device_id self._ih_device = ih_device self._device_name = ih_device.get("name") self._device_type = controller.device_type ...
[ "def", "__init__", "(", "self", ",", "ih_device_id", ",", "ih_device", ",", "controller", ")", ":", "self", ".", "_controller", "=", "controller", "self", ".", "_device_id", "=", "ih_device_id", "self", ".", "_ih_device", "=", "ih_device", "self", ".", "_dev...
[ 134, 4 ]
[ 191, 50 ]
python
en
['en', 'en', 'en']
True
IntesisAC.async_added_to_hass
(self)
Subscribe to event updates.
Subscribe to event updates.
async def async_added_to_hass(self): """Subscribe to event updates.""" _LOGGER.debug("Added climate device with state: %s", repr(self._ih_device)) await self._controller.add_update_callback(self.async_update_callback) try: await self._controller.connect() except IHCon...
[ "async", "def", "async_added_to_hass", "(", "self", ")", ":", "_LOGGER", ".", "debug", "(", "\"Added climate device with state: %s\"", ",", "repr", "(", "self", ".", "_ih_device", ")", ")", "await", "self", ".", "_controller", ".", "add_update_callback", "(", "s...
[ 193, 4 ]
[ 201, 42 ]
python
en
['en', 'en', 'en']
True
IntesisAC.name
(self)
Return the name of the AC device.
Return the name of the AC device.
def name(self): """Return the name of the AC device.""" return self._device_name
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "_device_name" ]
[ 204, 4 ]
[ 206, 32 ]
python
en
['en', 'en', 'en']
True
IntesisAC.temperature_unit
(self)
Intesishome API uses celsius on the backend.
Intesishome API uses celsius on the backend.
def temperature_unit(self): """Intesishome API uses celsius on the backend.""" return TEMP_CELSIUS
[ "def", "temperature_unit", "(", "self", ")", ":", "return", "TEMP_CELSIUS" ]
[ 209, 4 ]
[ 211, 27 ]
python
en
['en', 'haw', 'en']
True
IntesisAC.extra_state_attributes
(self)
Return the device specific state attributes.
Return the device specific state attributes.
def extra_state_attributes(self): """Return the device specific state attributes.""" attrs = {} if self._outdoor_temp: attrs["outdoor_temp"] = self._outdoor_temp if self._power_consumption_heat: attrs["power_consumption_heat_kw"] = round( self._pow...
[ "def", "extra_state_attributes", "(", "self", ")", ":", "attrs", "=", "{", "}", "if", "self", ".", "_outdoor_temp", ":", "attrs", "[", "\"outdoor_temp\"", "]", "=", "self", ".", "_outdoor_temp", "if", "self", ".", "_power_consumption_heat", ":", "attrs", "["...
[ 214, 4 ]
[ 228, 20 ]
python
en
['en', 'en', 'en']
True
IntesisAC.unique_id
(self)
Return unique ID for this device.
Return unique ID for this device.
def unique_id(self): """Return unique ID for this device.""" return self._device_id
[ "def", "unique_id", "(", "self", ")", ":", "return", "self", ".", "_device_id" ]
[ 231, 4 ]
[ 233, 30 ]
python
en
['en', 'en', 'en']
True
IntesisAC.target_temperature_step
(self)
Return whether setpoint should be whole or half degree precision.
Return whether setpoint should be whole or half degree precision.
def target_temperature_step(self) -> float: """Return whether setpoint should be whole or half degree precision.""" return self._setpoint_step
[ "def", "target_temperature_step", "(", "self", ")", "->", "float", ":", "return", "self", ".", "_setpoint_step" ]
[ 236, 4 ]
[ 238, 34 ]
python
en
['en', 'en', 'en']
True
IntesisAC.preset_modes
(self)
Return a list of HVAC preset modes.
Return a list of HVAC preset modes.
def preset_modes(self): """Return a list of HVAC preset modes.""" return self._preset_list
[ "def", "preset_modes", "(", "self", ")", ":", "return", "self", ".", "_preset_list" ]
[ 241, 4 ]
[ 243, 32 ]
python
en
['en', 'is', 'en']
True
IntesisAC.preset_mode
(self)
Return the current preset mode.
Return the current preset mode.
def preset_mode(self): """Return the current preset mode.""" return self._preset
[ "def", "preset_mode", "(", "self", ")", ":", "return", "self", ".", "_preset" ]
[ 246, 4 ]
[ 248, 27 ]
python
en
['en', 'en', 'en']
True
IntesisAC.async_set_temperature
(self, **kwargs)
Set new target temperature.
Set new target temperature.
async def async_set_temperature(self, **kwargs): """Set new target temperature.""" temperature = kwargs.get(ATTR_TEMPERATURE) hvac_mode = kwargs.get(ATTR_HVAC_MODE) if hvac_mode: await self.async_set_hvac_mode(hvac_mode) if temperature: _LOGGER.debug("Se...
[ "async", "def", "async_set_temperature", "(", "self", ",", "*", "*", "kwargs", ")", ":", "temperature", "=", "kwargs", ".", "get", "(", "ATTR_TEMPERATURE", ")", "hvac_mode", "=", "kwargs", ".", "get", "(", "ATTR_HVAC_MODE", ")", "if", "hvac_mode", ":", "aw...
[ 250, 4 ]
[ 264, 35 ]
python
en
['en', 'ca', 'en']
True
IntesisAC.async_set_hvac_mode
(self, hvac_mode)
Set operation mode.
Set operation mode.
async def async_set_hvac_mode(self, hvac_mode): """Set operation mode.""" _LOGGER.debug("Setting %s to %s mode", self._device_type, hvac_mode) if hvac_mode == HVAC_MODE_OFF: self._power = False await self._controller.set_power_off(self._device_id) # Write chan...
[ "async", "def", "async_set_hvac_mode", "(", "self", ",", "hvac_mode", ")", ":", "_LOGGER", ".", "debug", "(", "\"Setting %s to %s mode\"", ",", "self", ".", "_device_type", ",", "hvac_mode", ")", "if", "hvac_mode", "==", "HVAC_MODE_OFF", ":", "self", ".", "_po...
[ 266, 4 ]
[ 290, 35 ]
python
en
['nl', 'ny', 'en']
False
IntesisAC.async_set_fan_mode
(self, fan_mode)
Set fan mode (from quiet, low, medium, high, auto).
Set fan mode (from quiet, low, medium, high, auto).
async def async_set_fan_mode(self, fan_mode): """Set fan mode (from quiet, low, medium, high, auto).""" await self._controller.set_fan_speed(self._device_id, fan_mode) # Updates can take longer than 2 seconds, so update locally self._fan_speed = fan_mode self.async_write_ha_stat...
[ "async", "def", "async_set_fan_mode", "(", "self", ",", "fan_mode", ")", ":", "await", "self", ".", "_controller", ".", "set_fan_speed", "(", "self", ".", "_device_id", ",", "fan_mode", ")", "# Updates can take longer than 2 seconds, so update locally", "self", ".", ...
[ 292, 4 ]
[ 298, 35 ]
python
en
['en', 'en', 'en']
True
IntesisAC.async_set_preset_mode
(self, preset_mode)
Set preset mode.
Set preset mode.
async def async_set_preset_mode(self, preset_mode): """Set preset mode.""" ih_preset_mode = MAP_PRESET_MODE_TO_IH.get(preset_mode) await self._controller.set_preset_mode(self._device_id, ih_preset_mode)
[ "async", "def", "async_set_preset_mode", "(", "self", ",", "preset_mode", ")", ":", "ih_preset_mode", "=", "MAP_PRESET_MODE_TO_IH", ".", "get", "(", "preset_mode", ")", "await", "self", ".", "_controller", ".", "set_preset_mode", "(", "self", ".", "_device_id", ...
[ 300, 4 ]
[ 303, 79 ]
python
de
['de', 'pt', 'it']
False
IntesisAC.async_set_swing_mode
(self, swing_mode)
Set the vertical vane.
Set the vertical vane.
async def async_set_swing_mode(self, swing_mode): """Set the vertical vane.""" swing_settings = MAP_SWING_TO_IH.get(swing_mode) if swing_settings: await self._controller.set_vertical_vane( self._device_id, swing_settings.get("vvane") ) await se...
[ "async", "def", "async_set_swing_mode", "(", "self", ",", "swing_mode", ")", ":", "swing_settings", "=", "MAP_SWING_TO_IH", ".", "get", "(", "swing_mode", ")", "if", "swing_settings", ":", "await", "self", ".", "_controller", ".", "set_vertical_vane", "(", "self...
[ 305, 4 ]
[ 314, 13 ]
python
nl
['en', 'nl', 'nl']
True
IntesisAC.async_update
(self)
Copy values from controller dictionary to climate device.
Copy values from controller dictionary to climate device.
async def async_update(self): """Copy values from controller dictionary to climate device.""" # Update values from controller's device dictionary self._connected = self._controller.is_connected self._current_temp = self._controller.get_temperature(self._device_id) self._fan_speed...
[ "async", "def", "async_update", "(", "self", ")", ":", "# Update values from controller's device dictionary", "self", ".", "_connected", "=", "self", ".", "_controller", ".", "is_connected", "self", ".", "_current_temp", "=", "self", ".", "_controller", ".", "get_te...
[ 316, 4 ]
[ 349, 9 ]
python
en
['en', 'en', 'en']
True
IntesisAC.async_will_remove_from_hass
(self)
Shutdown the controller when the device is being removed.
Shutdown the controller when the device is being removed.
async def async_will_remove_from_hass(self): """Shutdown the controller when the device is being removed.""" await self._controller.stop()
[ "async", "def", "async_will_remove_from_hass", "(", "self", ")", ":", "await", "self", ".", "_controller", ".", "stop", "(", ")" ]
[ 351, 4 ]
[ 353, 37 ]
python
en
['en', 'en', 'en']
True
IntesisAC.icon
(self)
Return the icon for the current state.
Return the icon for the current state.
def icon(self): """Return the icon for the current state.""" icon = None if self._power: icon = MAP_STATE_ICONS.get(self._hvac_mode) return icon
[ "def", "icon", "(", "self", ")", ":", "icon", "=", "None", "if", "self", ".", "_power", ":", "icon", "=", "MAP_STATE_ICONS", ".", "get", "(", "self", ".", "_hvac_mode", ")", "return", "icon" ]
[ 356, 4 ]
[ 361, 19 ]
python
en
['en', 'en', 'en']
True
IntesisAC.async_update_callback
(self, device_id=None)
Let HA know there has been an update from the controller.
Let HA know there has been an update from the controller.
async def async_update_callback(self, device_id=None): """Let HA know there has been an update from the controller.""" # Track changes in connection state if not self._controller.is_connected and self._connected: # Connection has dropped self._connected = False ...
[ "async", "def", "async_update_callback", "(", "self", ",", "device_id", "=", "None", ")", ":", "# Track changes in connection state", "if", "not", "self", ".", "_controller", ".", "is_connected", "and", "self", ".", "_connected", ":", "# Connection has dropped", "se...
[ 363, 4 ]
[ 394, 53 ]
python
en
['en', 'en', 'en']
True
IntesisAC.min_temp
(self)
Return the minimum temperature for the current mode of operation.
Return the minimum temperature for the current mode of operation.
def min_temp(self): """Return the minimum temperature for the current mode of operation.""" return self._min_temp
[ "def", "min_temp", "(", "self", ")", ":", "return", "self", ".", "_min_temp" ]
[ 397, 4 ]
[ 399, 29 ]
python
en
['en', 'en', 'en']
True
IntesisAC.max_temp
(self)
Return the maximum temperature for the current mode of operation.
Return the maximum temperature for the current mode of operation.
def max_temp(self): """Return the maximum temperature for the current mode of operation.""" return self._max_temp
[ "def", "max_temp", "(", "self", ")", ":", "return", "self", ".", "_max_temp" ]
[ 402, 4 ]
[ 404, 29 ]
python
en
['en', 'en', 'en']
True
IntesisAC.should_poll
(self)
Poll for updates if pyIntesisHome doesn't have a socket open.
Poll for updates if pyIntesisHome doesn't have a socket open.
def should_poll(self): """Poll for updates if pyIntesisHome doesn't have a socket open.""" return False
[ "def", "should_poll", "(", "self", ")", ":", "return", "False" ]
[ 407, 4 ]
[ 409, 20 ]
python
en
['en', 'en', 'en']
True
IntesisAC.hvac_modes
(self)
List of available operation modes.
List of available operation modes.
def hvac_modes(self): """List of available operation modes.""" return self._hvac_mode_list
[ "def", "hvac_modes", "(", "self", ")", ":", "return", "self", ".", "_hvac_mode_list" ]
[ 412, 4 ]
[ 414, 35 ]
python
en
['en', 'en', 'en']
True
IntesisAC.fan_mode
(self)
Return whether the fan is on.
Return whether the fan is on.
def fan_mode(self): """Return whether the fan is on.""" return self._fan_speed
[ "def", "fan_mode", "(", "self", ")", ":", "return", "self", ".", "_fan_speed" ]
[ 417, 4 ]
[ 419, 30 ]
python
en
['en', 'en', 'en']
True
IntesisAC.swing_mode
(self)
Return current swing mode.
Return current swing mode.
def swing_mode(self): """Return current swing mode.""" if self._vvane == IH_SWING_SWING and self._hvane == IH_SWING_SWING: swing = SWING_BOTH elif self._vvane == IH_SWING_SWING: swing = SWING_VERTICAL elif self._hvane == IH_SWING_SWING: swing = SWING_H...
[ "def", "swing_mode", "(", "self", ")", ":", "if", "self", ".", "_vvane", "==", "IH_SWING_SWING", "and", "self", ".", "_hvane", "==", "IH_SWING_SWING", ":", "swing", "=", "SWING_BOTH", "elif", "self", ".", "_vvane", "==", "IH_SWING_SWING", ":", "swing", "="...
[ 422, 4 ]
[ 432, 20 ]
python
en
['en', 'bg', 'en']
True
IntesisAC.fan_modes
(self)
List of available fan modes.
List of available fan modes.
def fan_modes(self): """List of available fan modes.""" return self._fan_modes
[ "def", "fan_modes", "(", "self", ")", ":", "return", "self", ".", "_fan_modes" ]
[ 435, 4 ]
[ 437, 30 ]
python
en
['en', 'en', 'en']
True
IntesisAC.swing_modes
(self)
List of available swing positions.
List of available swing positions.
def swing_modes(self): """List of available swing positions.""" return self._swing_list
[ "def", "swing_modes", "(", "self", ")", ":", "return", "self", ".", "_swing_list" ]
[ 440, 4 ]
[ 442, 31 ]
python
en
['en', 'en', 'en']
True
IntesisAC.available
(self)
If the device hasn't been able to connect, mark as unavailable.
If the device hasn't been able to connect, mark as unavailable.
def available(self) -> bool: """If the device hasn't been able to connect, mark as unavailable.""" return self._connected or self._connected is None
[ "def", "available", "(", "self", ")", "->", "bool", ":", "return", "self", ".", "_connected", "or", "self", ".", "_connected", "is", "None" ]
[ 445, 4 ]
[ 447, 57 ]
python
en
['en', 'en', 'en']
True
IntesisAC.current_temperature
(self)
Return the current temperature.
Return the current temperature.
def current_temperature(self): """Return the current temperature.""" return self._current_temp
[ "def", "current_temperature", "(", "self", ")", ":", "return", "self", ".", "_current_temp" ]
[ 450, 4 ]
[ 452, 33 ]
python
en
['en', 'la', 'en']
True
IntesisAC.hvac_mode
(self)
Return the current mode of operation if unit is on.
Return the current mode of operation if unit is on.
def hvac_mode(self): """Return the current mode of operation if unit is on.""" if self._power: return self._hvac_mode return HVAC_MODE_OFF
[ "def", "hvac_mode", "(", "self", ")", ":", "if", "self", ".", "_power", ":", "return", "self", ".", "_hvac_mode", "return", "HVAC_MODE_OFF" ]
[ 455, 4 ]
[ 459, 28 ]
python
en
['en', 'en', 'en']
True
IntesisAC.target_temperature
(self)
Return the current setpoint temperature if unit is on.
Return the current setpoint temperature if unit is on.
def target_temperature(self): """Return the current setpoint temperature if unit is on.""" return self._target_temp
[ "def", "target_temperature", "(", "self", ")", ":", "return", "self", ".", "_target_temp" ]
[ 462, 4 ]
[ 464, 32 ]
python
en
['en', 'en', 'en']
True
IntesisAC.supported_features
(self)
Return the list of supported features.
Return the list of supported features.
def supported_features(self): """Return the list of supported features.""" return self._support
[ "def", "supported_features", "(", "self", ")", ":", "return", "self", ".", "_support" ]
[ 467, 4 ]
[ 469, 28 ]
python
en
['en', 'en', 'en']
True
setup
(hass, config)
Set up the ADS component.
Set up the ADS component.
def setup(hass, config): """Set up the ADS component.""" conf = config[DOMAIN] net_id = conf[CONF_DEVICE] ip_address = conf.get(CONF_IP_ADDRESS) port = conf[CONF_PORT] client = pyads.Connection(net_id, port, ip_address) AdsHub.ADS_TYPEMAP = { ADSTYPE_BOOL: pyads.PLCTYPE_BOOL, ...
[ "def", "setup", "(", "hass", ",", "config", ")", ":", "conf", "=", "config", "[", "DOMAIN", "]", "net_id", "=", "conf", "[", "CONF_DEVICE", "]", "ip_address", "=", "conf", ".", "get", "(", "CONF_IP_ADDRESS", ")", "port", "=", "conf", "[", "CONF_PORT", ...
[ 79, 0 ]
[ 139, 15 ]
python
en
['en', 'en', 'en']
True
AdsHub.__init__
(self, ads_client)
Initialize the ADS hub.
Initialize the ADS hub.
def __init__(self, ads_client): """Initialize the ADS hub.""" self._client = ads_client self._client.open() # All ADS devices are registered here self._devices = [] self._notification_items = {} self._lock = threading.Lock()
[ "def", "__init__", "(", "self", ",", "ads_client", ")", ":", "self", ".", "_client", "=", "ads_client", "self", ".", "_client", ".", "open", "(", ")", "# All ADS devices are registered here", "self", ".", "_devices", "=", "[", "]", "self", ".", "_notificatio...
[ 151, 4 ]
[ 159, 37 ]
python
en
['en', 'en', 'en']
True
AdsHub.shutdown
(self, *args, **kwargs)
Shutdown ADS connection.
Shutdown ADS connection.
def shutdown(self, *args, **kwargs): """Shutdown ADS connection.""" _LOGGER.debug("Shutting down ADS") for notification_item in self._notification_items.values(): _LOGGER.debug( "Deleting device notification %d, %d", notification_item.hnotify, ...
[ "def", "shutdown", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "_LOGGER", ".", "debug", "(", "\"Shutting down ADS\"", ")", "for", "notification_item", "in", "self", ".", "_notification_items", ".", "values", "(", ")", ":", "_LOGGER", ...
[ 161, 4 ]
[ 180, 30 ]
python
en
['en', 'de', 'en']
True
AdsHub.register_device
(self, device)
Register a new device.
Register a new device.
def register_device(self, device): """Register a new device.""" self._devices.append(device)
[ "def", "register_device", "(", "self", ",", "device", ")", ":", "self", ".", "_devices", ".", "append", "(", "device", ")" ]
[ 182, 4 ]
[ 184, 36 ]
python
en
['en', 'en', 'en']
True
AdsHub.write_by_name
(self, name, value, plc_datatype)
Write a value to the device.
Write a value to the device.
def write_by_name(self, name, value, plc_datatype): """Write a value to the device.""" with self._lock: try: return self._client.write_by_name(name, value, plc_datatype) except pyads.ADSError as err: _LOGGER.error("Error writing %s: %s", name, err...
[ "def", "write_by_name", "(", "self", ",", "name", ",", "value", ",", "plc_datatype", ")", ":", "with", "self", ".", "_lock", ":", "try", ":", "return", "self", ".", "_client", ".", "write_by_name", "(", "name", ",", "value", ",", "plc_datatype", ")", "...
[ 186, 4 ]
[ 193, 64 ]
python
en
['en', 'en', 'en']
True
AdsHub.read_by_name
(self, name, plc_datatype)
Read a value from the device.
Read a value from the device.
def read_by_name(self, name, plc_datatype): """Read a value from the device.""" with self._lock: try: return self._client.read_by_name(name, plc_datatype) except pyads.ADSError as err: _LOGGER.error("Error reading %s: %s", name, err)
[ "def", "read_by_name", "(", "self", ",", "name", ",", "plc_datatype", ")", ":", "with", "self", ".", "_lock", ":", "try", ":", "return", "self", ".", "_client", ".", "read_by_name", "(", "name", ",", "plc_datatype", ")", "except", "pyads", ".", "ADSError...
[ 195, 4 ]
[ 202, 64 ]
python
en
['en', 'en', 'en']
True
AdsHub.add_device_notification
(self, name, plc_datatype, callback)
Add a notification to the ADS devices.
Add a notification to the ADS devices.
def add_device_notification(self, name, plc_datatype, callback): """Add a notification to the ADS devices.""" attr = pyads.NotificationAttrib(ctypes.sizeof(plc_datatype)) with self._lock: try: hnotify, huser = self._client.add_device_notification( ...
[ "def", "add_device_notification", "(", "self", ",", "name", ",", "plc_datatype", ",", "callback", ")", ":", "attr", "=", "pyads", ".", "NotificationAttrib", "(", "ctypes", ".", "sizeof", "(", "plc_datatype", ")", ")", "with", "self", ".", "_lock", ":", "tr...
[ 204, 4 ]
[ 224, 17 ]
python
en
['en', 'en', 'en']
True
AdsHub._device_notification_callback
(self, notification, name)
Handle device notifications.
Handle device notifications.
def _device_notification_callback(self, notification, name): """Handle device notifications.""" contents = notification.contents hnotify = int(contents.hNotification) _LOGGER.debug("Received notification %d", hnotify) # get dynamically sized data array data_size = conte...
[ "def", "_device_notification_callback", "(", "self", ",", "notification", ",", "name", ")", ":", "contents", "=", "notification", ".", "contents", "hnotify", "=", "int", "(", "contents", ".", "hNotification", ")", "_LOGGER", ".", "debug", "(", "\"Received notifi...
[ 226, 4 ]
[ 264, 65 ]
python
en
['fr', 'en', 'en']
True
AdsEntity.__init__
(self, ads_hub, name, ads_var)
Initialize ADS binary sensor.
Initialize ADS binary sensor.
def __init__(self, ads_hub, name, ads_var): """Initialize ADS binary sensor.""" self._state_dict = {} self._state_dict[STATE_KEY_STATE] = None self._ads_hub = ads_hub self._ads_var = ads_var self._event = None self._attr_unique_id = ads_var self._attr_name...
[ "def", "__init__", "(", "self", ",", "ads_hub", ",", "name", ",", "ads_var", ")", ":", "self", ".", "_state_dict", "=", "{", "}", "self", ".", "_state_dict", "[", "STATE_KEY_STATE", "]", "=", "None", "self", ".", "_ads_hub", "=", "ads_hub", "self", "."...
[ 272, 4 ]
[ 280, 30 ]
python
en
['en', 'pl', 'en']
True
AdsEntity.async_initialize_device
( self, ads_var, plctype, state_key=STATE_KEY_STATE, factor=None )
Register device notification.
Register device notification.
async def async_initialize_device( self, ads_var, plctype, state_key=STATE_KEY_STATE, factor=None ): """Register device notification.""" def update(name, value): """Handle device notifications.""" _LOGGER.debug("Variable %s changed its value to %d", name, value) ...
[ "async", "def", "async_initialize_device", "(", "self", ",", "ads_var", ",", "plctype", ",", "state_key", "=", "STATE_KEY_STATE", ",", "factor", "=", "None", ")", ":", "def", "update", "(", "name", ",", "value", ")", ":", "\"\"\"Handle device notifications.\"\"\...
[ 282, 4 ]
[ 312, 78 ]
python
en
['da', 'en', 'en']
True
AdsEntity.available
(self)
Return False if state has not been updated yet.
Return False if state has not been updated yet.
def available(self) -> bool: """Return False if state has not been updated yet.""" return self._state_dict[STATE_KEY_STATE] is not None
[ "def", "available", "(", "self", ")", "->", "bool", ":", "return", "self", ".", "_state_dict", "[", "STATE_KEY_STATE", "]", "is", "not", "None" ]
[ 315, 4 ]
[ 317, 60 ]
python
en
['en', 'en', 'en']
True
setup_platform
(hass, config, add_entities, discovery_info=None)
Set up the aREST binary sensor.
Set up the aREST binary sensor.
def setup_platform(hass, config, add_entities, discovery_info=None): """Set up the aREST binary sensor.""" resource = config[CONF_RESOURCE] pin = config[CONF_PIN] device_class = config.get(CONF_DEVICE_CLASS) try: response = requests.get(resource, timeout=10).json() except requests.excep...
[ "def", "setup_platform", "(", "hass", ",", "config", ",", "add_entities", ",", "discovery_info", "=", "None", ")", ":", "resource", "=", "config", "[", "CONF_RESOURCE", "]", "pin", "=", "config", "[", "CONF_PIN", "]", "device_class", "=", "config", ".", "g...
[ 36, 0 ]
[ 66, 5 ]
python
en
['en', 'cs', 'en']
True
ArestBinarySensor.__init__
(self, arest, resource, name, device_class, pin)
Initialize the aREST device.
Initialize the aREST device.
def __init__(self, arest, resource, name, device_class, pin): """Initialize the aREST device.""" self.arest = arest self._attr_name = name self._attr_device_class = device_class if pin is not None: request = requests.get(f"{resource}/mode/{pin}/i", timeout=10) ...
[ "def", "__init__", "(", "self", ",", "arest", ",", "resource", ",", "name", ",", "device_class", ",", "pin", ")", ":", "self", ".", "arest", "=", "arest", "self", ".", "_attr_name", "=", "name", "self", ".", "_attr_device_class", "=", "device_class", "if...
[ 72, 4 ]
[ 81, 63 ]
python
en
['en', 'en', 'en']
True
ArestBinarySensor.update
(self)
Get the latest data from aREST API.
Get the latest data from aREST API.
def update(self): """Get the latest data from aREST API.""" self.arest.update() self._attr_is_on = bool(self.arest.data.get("state"))
[ "def", "update", "(", "self", ")", ":", "self", ".", "arest", ".", "update", "(", ")", "self", ".", "_attr_is_on", "=", "bool", "(", "self", ".", "arest", ".", "data", ".", "get", "(", "\"state\"", ")", ")" ]
[ 83, 4 ]
[ 86, 61 ]
python
en
['en', 'en', 'en']
True
ArestData.__init__
(self, resource, pin)
Initialize the aREST data object.
Initialize the aREST data object.
def __init__(self, resource, pin): """Initialize the aREST data object.""" self._resource = resource self._pin = pin self.data = {}
[ "def", "__init__", "(", "self", ",", "resource", ",", "pin", ")", ":", "self", ".", "_resource", "=", "resource", "self", ".", "_pin", "=", "pin", "self", ".", "data", "=", "{", "}" ]
[ 92, 4 ]
[ 96, 22 ]
python
en
['en', 'en', 'en']
True
ArestData.update
(self)
Get the latest data from aREST device.
Get the latest data from aREST device.
def update(self): """Get the latest data from aREST device.""" try: response = requests.get(f"{self._resource}/digital/{self._pin}", timeout=10) self.data = {"state": response.json()["return_value"]} except requests.exceptions.ConnectionError: _LOGGER.error("N...
[ "def", "update", "(", "self", ")", ":", "try", ":", "response", "=", "requests", ".", "get", "(", "f\"{self._resource}/digital/{self._pin}\"", ",", "timeout", "=", "10", ")", "self", ".", "data", "=", "{", "\"state\"", ":", "response", ".", "json", "(", ...
[ 99, 4 ]
[ 105, 68 ]
python
en
['en', 'en', 'en']
True
device_reg
(hass)
Return an empty, loaded, registry.
Return an empty, loaded, registry.
def device_reg(hass): """Return an empty, loaded, registry.""" return mock_device_registry(hass)
[ "def", "device_reg", "(", "hass", ")", ":", "return", "mock_device_registry", "(", "hass", ")" ]
[ 18, 0 ]
[ 20, 37 ]
python
en
['en', 'fy', 'en']
True
entity_reg
(hass)
Return an empty, loaded, registry.
Return an empty, loaded, registry.
def entity_reg(hass): """Return an empty, loaded, registry.""" return mock_registry(hass)
[ "def", "entity_reg", "(", "hass", ")", ":", "return", "mock_registry", "(", "hass", ")" ]
[ 24, 0 ]
[ 26, 30 ]
python
en
['en', 'fy', 'en']
True
calls
(hass)
Track calls to a mock service.
Track calls to a mock service.
def calls(hass): """Track calls to a mock service.""" return async_mock_service(hass, "test", "automation")
[ "def", "calls", "(", "hass", ")", ":", "return", "async_mock_service", "(", "hass", ",", "\"test\"", ",", "\"automation\"", ")" ]
[ 30, 0 ]
[ 32, 57 ]
python
en
['en', 'en', 'en']
True
test_get_triggers
(hass, device_reg, entity_reg)
Test we get the expected triggers from a arcam_fmj.
Test we get the expected triggers from a arcam_fmj.
async def test_get_triggers(hass, device_reg, entity_reg): """Test we get the expected triggers from a arcam_fmj.""" config_entry = MockConfigEntry(domain=DOMAIN, data={}) config_entry.add_to_hass(hass) device_entry = device_reg.async_get_or_create( config_entry_id=config_entry.entry_id, ...
[ "async", "def", "test_get_triggers", "(", "hass", ",", "device_reg", ",", "entity_reg", ")", ":", "config_entry", "=", "MockConfigEntry", "(", "domain", "=", "DOMAIN", ",", "data", "=", "{", "}", ")", "config_entry", ".", "add_to_hass", "(", "hass", ")", "...
[ 35, 0 ]
[ 62, 82 ]
python
en
['en', 'en', 'en']
True
test_if_fires_on_turn_on_request
(hass, calls, player_setup, state)
Test for turn_on and turn_off triggers firing.
Test for turn_on and turn_off triggers firing.
async def test_if_fires_on_turn_on_request(hass, calls, player_setup, state): """Test for turn_on and turn_off triggers firing.""" state.get_power.return_value = None assert await async_setup_component( hass, automation.DOMAIN, { automation.DOMAIN: [ { ...
[ "async", "def", "test_if_fires_on_turn_on_request", "(", "hass", ",", "calls", ",", "player_setup", ",", "state", ")", ":", "state", ".", "get_power", ".", "return_value", "=", "None", "assert", "await", "async_setup_component", "(", "hass", ",", "automation", "...
[ 65, 0 ]
[ 104, 35 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
(hass, config_entry, async_add_entities)
Set up Coinbase sensor platform.
Set up Coinbase sensor platform.
async def async_setup_entry(hass, config_entry, async_add_entities): """Set up Coinbase sensor platform.""" instance = hass.data[DOMAIN][config_entry.entry_id] entities = [] provided_currencies = [ account[API_ACCOUNT_CURRENCY] for account in instance.accounts if account[API_RE...
[ "async", "def", "async_setup_entry", "(", "hass", ",", "config_entry", ",", "async_add_entities", ")", ":", "instance", "=", "hass", ".", "data", "[", "DOMAIN", "]", "[", "config_entry", ".", "entry_id", "]", "entities", "=", "[", "]", "provided_currencies", ...
[ 38, 0 ]
[ 77, 32 ]
python
en
['en', 'pt', 'en']
True
AccountSensor.__init__
(self, coinbase_data, currency)
Initialize the sensor.
Initialize the sensor.
def __init__(self, coinbase_data, currency): """Initialize the sensor.""" self._coinbase_data = coinbase_data self._currency = currency for account in coinbase_data.accounts: if ( account[API_ACCOUNT_CURRENCY] == currency and account[API_RESOUR...
[ "def", "__init__", "(", "self", ",", "coinbase_data", ",", "currency", ")", ":", "self", ".", "_coinbase_data", "=", "coinbase_data", "self", ".", "_currency", "=", "currency", "for", "account", "in", "coinbase_data", ".", "accounts", ":", "if", "(", "accoun...
[ 83, 4 ]
[ 105, 21 ]
python
en
['en', 'en', 'en']
True
AccountSensor.name
(self)
Return the name of the sensor.
Return the name of the sensor.
def name(self): """Return the name of the sensor.""" return self._name
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "_name" ]
[ 108, 4 ]
[ 110, 25 ]
python
en
['en', 'mi', 'en']
True
AccountSensor.unique_id
(self)
Return the Unique ID of the sensor.
Return the Unique ID of the sensor.
def unique_id(self): """Return the Unique ID of the sensor.""" return self._id
[ "def", "unique_id", "(", "self", ")", ":", "return", "self", ".", "_id" ]
[ 113, 4 ]
[ 115, 23 ]
python
en
['en', 'la', 'en']
True
AccountSensor.native_value
(self)
Return the state of the sensor.
Return the state of the sensor.
def native_value(self): """Return the state of the sensor.""" return self._state
[ "def", "native_value", "(", "self", ")", ":", "return", "self", ".", "_state" ]
[ 118, 4 ]
[ 120, 26 ]
python
en
['en', 'en', 'en']
True
AccountSensor.native_unit_of_measurement
(self)
Return the unit of measurement this sensor expresses itself in.
Return the unit of measurement this sensor expresses itself in.
def native_unit_of_measurement(self): """Return the unit of measurement this sensor expresses itself in.""" return self._unit_of_measurement
[ "def", "native_unit_of_measurement", "(", "self", ")", ":", "return", "self", ".", "_unit_of_measurement" ]
[ 123, 4 ]
[ 125, 40 ]
python
en
['en', 'en', 'en']
True
AccountSensor.icon
(self)
Return the icon to use in the frontend, if any.
Return the icon to use in the frontend, if any.
def icon(self): """Return the icon to use in the frontend, if any.""" return CURRENCY_ICONS.get(self._unit_of_measurement, DEFAULT_COIN_ICON)
[ "def", "icon", "(", "self", ")", ":", "return", "CURRENCY_ICONS", ".", "get", "(", "self", ".", "_unit_of_measurement", ",", "DEFAULT_COIN_ICON", ")" ]
[ 128, 4 ]
[ 130, 79 ]
python
en
['en', 'en', 'en']
True
AccountSensor.extra_state_attributes
(self)
Return the state attributes of the sensor.
Return the state attributes of the sensor.
def extra_state_attributes(self): """Return the state attributes of the sensor.""" return { ATTR_ATTRIBUTION: ATTRIBUTION, ATTR_NATIVE_BALANCE: f"{self._native_balance} {self._native_currency}", }
[ "def", "extra_state_attributes", "(", "self", ")", ":", "return", "{", "ATTR_ATTRIBUTION", ":", "ATTRIBUTION", ",", "ATTR_NATIVE_BALANCE", ":", "f\"{self._native_balance} {self._native_currency}\"", ",", "}" ]
[ 133, 4 ]
[ 138, 9 ]
python
en
['en', 'en', 'en']
True
AccountSensor.update
(self)
Get the latest state of the sensor.
Get the latest state of the sensor.
def update(self): """Get the latest state of the sensor.""" self._coinbase_data.update() for account in self._coinbase_data.accounts: if ( account[API_ACCOUNT_CURRENCY] == self._currency and account[API_RESOURCE_TYPE] != API_TYPE_VAULT ): ...
[ "def", "update", "(", "self", ")", ":", "self", ".", "_coinbase_data", ".", "update", "(", ")", "for", "account", "in", "self", ".", "_coinbase_data", ".", "accounts", ":", "if", "(", "account", "[", "API_ACCOUNT_CURRENCY", "]", "==", "self", ".", "_curr...
[ 140, 4 ]
[ 155, 21 ]
python
en
['en', 'en', 'en']
True
ExchangeRateSensor.__init__
(self, coinbase_data, exchange_currency, exchange_base)
Initialize the sensor.
Initialize the sensor.
def __init__(self, coinbase_data, exchange_currency, exchange_base): """Initialize the sensor.""" self._coinbase_data = coinbase_data self.currency = exchange_currency self._name = f"{exchange_currency} Exchange Rate" self._id = f"coinbase-{coinbase_data.user_id}-xe-{exchange_cur...
[ "def", "__init__", "(", "self", ",", "coinbase_data", ",", "exchange_currency", ",", "exchange_base", ")", ":", "self", ".", "_coinbase_data", "=", "coinbase_data", "self", ".", "currency", "=", "exchange_currency", "self", ".", "_name", "=", "f\"{exchange_currenc...
[ 161, 4 ]
[ 170, 49 ]
python
en
['en', 'en', 'en']
True
ExchangeRateSensor.name
(self)
Return the name of the sensor.
Return the name of the sensor.
def name(self): """Return the name of the sensor.""" return self._name
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "_name" ]
[ 173, 4 ]
[ 175, 25 ]
python
en
['en', 'mi', 'en']
True
ExchangeRateSensor.unique_id
(self)
Return the unique ID of the sensor.
Return the unique ID of the sensor.
def unique_id(self): """Return the unique ID of the sensor.""" return self._id
[ "def", "unique_id", "(", "self", ")", ":", "return", "self", ".", "_id" ]
[ 178, 4 ]
[ 180, 23 ]
python
en
['en', 'la', 'en']
True
ExchangeRateSensor.native_value
(self)
Return the state of the sensor.
Return the state of the sensor.
def native_value(self): """Return the state of the sensor.""" return self._state
[ "def", "native_value", "(", "self", ")", ":", "return", "self", ".", "_state" ]
[ 183, 4 ]
[ 185, 26 ]
python
en
['en', 'en', 'en']
True
ExchangeRateSensor.native_unit_of_measurement
(self)
Return the unit of measurement this sensor expresses itself in.
Return the unit of measurement this sensor expresses itself in.
def native_unit_of_measurement(self): """Return the unit of measurement this sensor expresses itself in.""" return self._unit_of_measurement
[ "def", "native_unit_of_measurement", "(", "self", ")", ":", "return", "self", ".", "_unit_of_measurement" ]
[ 188, 4 ]
[ 190, 40 ]
python
en
['en', 'en', 'en']
True
ExchangeRateSensor.icon
(self)
Return the icon to use in the frontend, if any.
Return the icon to use in the frontend, if any.
def icon(self): """Return the icon to use in the frontend, if any.""" return CURRENCY_ICONS.get(self.currency, DEFAULT_COIN_ICON)
[ "def", "icon", "(", "self", ")", ":", "return", "CURRENCY_ICONS", ".", "get", "(", "self", ".", "currency", ",", "DEFAULT_COIN_ICON", ")" ]
[ 193, 4 ]
[ 195, 67 ]
python
en
['en', 'en', 'en']
True
ExchangeRateSensor.extra_state_attributes
(self)
Return the state attributes of the sensor.
Return the state attributes of the sensor.
def extra_state_attributes(self): """Return the state attributes of the sensor.""" return {ATTR_ATTRIBUTION: ATTRIBUTION}
[ "def", "extra_state_attributes", "(", "self", ")", ":", "return", "{", "ATTR_ATTRIBUTION", ":", "ATTRIBUTION", "}" ]
[ 198, 4 ]
[ 200, 46 ]
python
en
['en', 'en', 'en']
True
ExchangeRateSensor.update
(self)
Get the latest state of the sensor.
Get the latest state of the sensor.
def update(self): """Get the latest state of the sensor.""" self._coinbase_data.update() self._state = round( 1 / float(self._coinbase_data.exchange_rates.rates[self.currency]), 2 )
[ "def", "update", "(", "self", ")", ":", "self", ".", "_coinbase_data", ".", "update", "(", ")", "self", ".", "_state", "=", "round", "(", "1", "/", "float", "(", "self", ".", "_coinbase_data", ".", "exchange_rates", ".", "rates", "[", "self", ".", "c...
[ 202, 4 ]
[ 207, 9 ]
python
en
['en', 'en', 'en']
True
make_distribution_for_install_requirement
(install_req)
Returns a Distribution for the given InstallRequirement
Returns a Distribution for the given InstallRequirement
def make_distribution_for_install_requirement(install_req): # type: (InstallRequirement) -> AbstractDistribution """Returns a Distribution for the given InstallRequirement """ # Editable requirements will always be source distributions. They use the # legacy logic until we create a modern standard f...
[ "def", "make_distribution_for_install_requirement", "(", "install_req", ")", ":", "# type: (InstallRequirement) -> AbstractDistribution", "# Editable requirements will always be source distributions. They use the", "# legacy logic until we create a modern standard for them.", "if", "install_req"...
[ 9, 0 ]
[ 23, 42 ]
python
en
['en', 'en', 'en']
True
TransmissionFlowHandler.async_get_options_flow
(config_entry)
Get the options flow for this handler.
Get the options flow for this handler.
def async_get_options_flow(config_entry): """Get the options flow for this handler.""" return TransmissionOptionsFlowHandler(config_entry)
[ "def", "async_get_options_flow", "(", "config_entry", ")", ":", "return", "TransmissionOptionsFlowHandler", "(", "config_entry", ")" ]
[ 46, 4 ]
[ 48, 59 ]
python
en
['en', 'en', 'en']
True
TransmissionFlowHandler.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.""" errors = {} if user_input is not None: for entry in self._async_current_entries(): if ( entry.data[CONF_HOST] == user_input[CONF_HOST] ...
[ "async", "def", "async_step_user", "(", "self", ",", "user_input", "=", "None", ")", ":", "errors", "=", "{", "}", "if", "user_input", "is", "not", "None", ":", "for", "entry", "in", "self", ".", "_async_current_entries", "(", ")", ":", "if", "(", "ent...
[ 50, 4 ]
[ 83, 9 ]
python
en
['en', 'en', 'en']
True
TransmissionFlowHandler.async_step_import
(self, import_config)
Import from Transmission client config.
Import from Transmission client config.
async def async_step_import(self, import_config): """Import from Transmission client config.""" import_config[CONF_SCAN_INTERVAL] = import_config[ CONF_SCAN_INTERVAL ].total_seconds() return await self.async_step_user(user_input=import_config)
[ "async", "def", "async_step_import", "(", "self", ",", "import_config", ")", ":", "import_config", "[", "CONF_SCAN_INTERVAL", "]", "=", "import_config", "[", "CONF_SCAN_INTERVAL", "]", ".", "total_seconds", "(", ")", "return", "await", "self", ".", "async_step_use...
[ 85, 4 ]
[ 90, 67 ]
python
en
['en', 'en', 'en']
True
TransmissionOptionsFlowHandler.__init__
(self, config_entry)
Initialize Transmission options flow.
Initialize Transmission options flow.
def __init__(self, config_entry): """Initialize Transmission options flow.""" self.config_entry = config_entry
[ "def", "__init__", "(", "self", ",", "config_entry", ")", ":", "self", ".", "config_entry", "=", "config_entry" ]
[ 96, 4 ]
[ 98, 40 ]
python
en
['en', 'en', 'en']
True
TransmissionOptionsFlowHandler.async_step_init
(self, user_input=None)
Manage the Transmission options.
Manage the Transmission options.
async def async_step_init(self, user_input=None): """Manage the Transmission options.""" if user_input is not None: return self.async_create_entry(title="", data=user_input) options = { vol.Optional( CONF_SCAN_INTERVAL, default=self.config...
[ "async", "def", "async_step_init", "(", "self", ",", "user_input", "=", "None", ")", ":", "if", "user_input", "is", "not", "None", ":", "return", "self", ".", "async_create_entry", "(", "title", "=", "\"\"", ",", "data", "=", "user_input", ")", "options", ...
[ 100, 4 ]
[ 122, 84 ]
python
en
['en', 'en', 'en']
True
wled_exception_handler
(func)
Decorate WLED calls to handle WLED exceptions. A decorator that wraps the passed in function, catches WLED errors, and handles the availability of the device in the data coordinator.
Decorate WLED calls to handle WLED exceptions.
def wled_exception_handler(func): """Decorate WLED calls to handle WLED exceptions. A decorator that wraps the passed in function, catches WLED errors, and handles the availability of the device in the data coordinator. """ async def handler(self, *args, **kwargs): try: await f...
[ "def", "wled_exception_handler", "(", "func", ")", ":", "async", "def", "handler", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "try", ":", "await", "func", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", "self", ...
[ 7, 0 ]
[ 27, 18 ]
python
en
['en', 'en', 'en']
True
create_device_name
(node: OZWNode)
Generate sensible (short) default device name from a OZWNode.
Generate sensible (short) default device name from a OZWNode.
def create_device_name(node: OZWNode): """Generate sensible (short) default device name from a OZWNode.""" # Prefer custom name set by OZWAdmin if present if node.node_name: return node.node_name # Prefer short devicename from metadata if present if node.meta_data and node.meta_data.get("Nam...
[ "def", "create_device_name", "(", "node", ":", "OZWNode", ")", ":", "# Prefer custom name set by OZWAdmin if present", "if", "node", ".", "node_name", ":", "return", "node", ".", "node_name", "# Prefer short devicename from metadata if present", "if", "node", ".", "meta_d...
[ 273, 0 ]
[ 289, 28 ]
python
en
['en', 'en', 'en']
True
create_device_id
(node: OZWNode, node_instance: int = 1)
Generate unique device_id from a OZWNode.
Generate unique device_id from a OZWNode.
def create_device_id(node: OZWNode, node_instance: int = 1): """Generate unique device_id from a OZWNode.""" ozw_instance = node.parent.id dev_id = f"{ozw_instance}.{node.node_id}.{node_instance}" return dev_id
[ "def", "create_device_id", "(", "node", ":", "OZWNode", ",", "node_instance", ":", "int", "=", "1", ")", ":", "ozw_instance", "=", "node", ".", "parent", ".", "id", "dev_id", "=", "f\"{ozw_instance}.{node.node_id}.{node_instance}\"", "return", "dev_id" ]
[ 292, 0 ]
[ 296, 17 ]
python
en
['en', 'en', 'en']
True