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
_get_filenames_and_classes
(dataset_dir)
Returns a list of filenames and inferred class names. Args: dataset_dir: A directory containing a set of subdirectories representing class names. Each subdirectory should contain PNG or JPG encoded images. Returns: A list of image file paths, relative to `dataset_dir` and the list of subdirector...
Returns a list of filenames and inferred class names.
def _get_filenames_and_classes(dataset_dir): """Returns a list of filenames and inferred class names. Args: dataset_dir: A directory containing a set of subdirectories representing class names. Each subdirectory should contain PNG or JPG encoded images. Returns: A list of image file paths, relativ...
[ "def", "_get_filenames_and_classes", "(", "dataset_dir", ")", ":", "flower_root", "=", "os", ".", "path", ".", "join", "(", "dataset_dir", ",", "'flower_photos'", ")", "directories", "=", "[", "]", "class_names", "=", "[", "]", "for", "filename", "in", "os",...
[ 71, 0 ]
[ 97, 45 ]
python
en
['en', 'en', 'en']
True
_convert_dataset
(split_name, filenames, class_names_to_ids, dataset_dir)
Converts the given filenames to a TFRecord dataset. Args: split_name: The name of the dataset, either 'train' or 'validation'. filenames: A list of absolute paths to png or jpg images. class_names_to_ids: A dictionary from class names (strings) to ids (integers). dataset_dir: The directory wher...
Converts the given filenames to a TFRecord dataset.
def _convert_dataset(split_name, filenames, class_names_to_ids, dataset_dir): """Converts the given filenames to a TFRecord dataset. Args: split_name: The name of the dataset, either 'train' or 'validation'. filenames: A list of absolute paths to png or jpg images. class_names_to_ids: A dictionary from...
[ "def", "_convert_dataset", "(", "split_name", ",", "filenames", ",", "class_names_to_ids", ",", "dataset_dir", ")", ":", "assert", "split_name", "in", "[", "'train'", ",", "'validation'", "]", "num_per_shard", "=", "int", "(", "math", ".", "ceil", "(", "len", ...
[ 106, 0 ]
[ 149, 20 ]
python
en
['en', 'en', 'en']
True
_clean_up_temporary_files
(dataset_dir)
Removes temporary files used to create the dataset. Args: dataset_dir: The directory where the temporary files are stored.
Removes temporary files used to create the dataset.
def _clean_up_temporary_files(dataset_dir): """Removes temporary files used to create the dataset. Args: dataset_dir: The directory where the temporary files are stored. """ filename = _DATA_URL.split('/')[-1] filepath = os.path.join(dataset_dir, filename) tf.gfile.Remove(filepath) tmp_dir = os.path...
[ "def", "_clean_up_temporary_files", "(", "dataset_dir", ")", ":", "filename", "=", "_DATA_URL", ".", "split", "(", "'/'", ")", "[", "-", "1", "]", "filepath", "=", "os", ".", "path", ".", "join", "(", "dataset_dir", ",", "filename", ")", "tf", ".", "gf...
[ 152, 0 ]
[ 163, 37 ]
python
en
['en', 'en', 'en']
True
run
(dataset_dir)
Runs the download and conversion operation. Args: dataset_dir: The dataset directory where the dataset is stored.
Runs the download and conversion operation.
def run(dataset_dir): """Runs the download and conversion operation. Args: dataset_dir: The dataset directory where the dataset is stored. """ if not tf.gfile.Exists(dataset_dir): tf.gfile.MakeDirs(dataset_dir) if _dataset_exists(dataset_dir): print('Dataset files already exist. Exiting without ...
[ "def", "run", "(", "dataset_dir", ")", ":", "if", "not", "tf", ".", "gfile", ".", "Exists", "(", "dataset_dir", ")", ":", "tf", ".", "gfile", ".", "MakeDirs", "(", "dataset_dir", ")", "if", "_dataset_exists", "(", "dataset_dir", ")", ":", "print", "(",...
[ 176, 0 ]
[ 210, 53 ]
python
en
['en', 'en', 'en']
True
setup
(hass, config)
Set up the LaMetricManager.
Set up the LaMetricManager.
def setup(hass, config): """Set up the LaMetricManager.""" _LOGGER.debug("Setting up LaMetric platform") conf = config[DOMAIN] hlmn = HassLaMetricManager( client_id=conf[CONF_CLIENT_ID], client_secret=conf[CONF_CLIENT_SECRET] ) devices = hlmn.manager.get_devices() if not devices: ...
[ "def", "setup", "(", "hass", ",", "config", ")", ":", "_LOGGER", ".", "debug", "(", "\"Setting up LaMetric platform\"", ")", "conf", "=", "config", "[", "DOMAIN", "]", "hlmn", "=", "HassLaMetricManager", "(", "client_id", "=", "conf", "[", "CONF_CLIENT_ID", ...
[ 29, 0 ]
[ 45, 15 ]
python
en
['en', 'en', 'en']
True
HassLaMetricManager.__init__
(self, client_id, client_secret)
Initialize HassLaMetricManager and connect to LaMetric.
Initialize HassLaMetricManager and connect to LaMetric.
def __init__(self, client_id, client_secret): """Initialize HassLaMetricManager and connect to LaMetric.""" _LOGGER.debug("Connecting to LaMetric") self.manager = LaMetricManager(client_id, client_secret) self._client_id = client_id self._client_secret = client_secret
[ "def", "__init__", "(", "self", ",", "client_id", ",", "client_secret", ")", ":", "_LOGGER", ".", "debug", "(", "\"Connecting to LaMetric\"", ")", "self", ".", "manager", "=", "LaMetricManager", "(", "client_id", ",", "client_secret", ")", "self", ".", "_clien...
[ 51, 4 ]
[ 57, 43 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
(hass, config_entry, async_add_entities)
Set up the Smile Thermostats from a config entry.
Set up the Smile Thermostats from a config entry.
async def async_setup_entry(hass, config_entry, async_add_entities): """Set up the Smile Thermostats from a config entry.""" api = hass.data[DOMAIN][config_entry.entry_id]["api"] coordinator = hass.data[DOMAIN][config_entry.entry_id][COORDINATOR] entities = [] thermostat_classes = [ "thermo...
[ "async", "def", "async_setup_entry", "(", "hass", ",", "config_entry", ",", "async_add_entities", ")", ":", "api", "=", "hass", ".", "data", "[", "DOMAIN", "]", "[", "config_entry", ".", "entry_id", "]", "[", "\"api\"", "]", "coordinator", "=", "hass", "."...
[ 38, 0 ]
[ 69, 38 ]
python
en
['en', 'en', 'en']
True
PwThermostat.__init__
( self, api, coordinator, name, dev_id, loc_id, model, min_temp, max_temp )
Set up the Plugwise API.
Set up the Plugwise API.
def __init__( self, api, coordinator, name, dev_id, loc_id, model, min_temp, max_temp ): """Set up the Plugwise API.""" super().__init__(api, coordinator, name, dev_id) self._api = api self._loc_id = loc_id self._model = model self._min_temp = min_temp ...
[ "def", "__init__", "(", "self", ",", "api", ",", "coordinator", ",", "name", ",", "dev_id", ",", "loc_id", ",", "model", ",", "min_temp", ",", "max_temp", ")", ":", "super", "(", ")", ".", "__init__", "(", "api", ",", "coordinator", ",", "name", ",",...
[ 75, 4 ]
[ 105, 45 ]
python
en
['en', 'zu', 'en']
True
PwThermostat.hvac_action
(self)
Return the current action.
Return the current action.
def hvac_action(self): """Return the current action.""" if self._single_thermostat: if self._heating_state: return CURRENT_HVAC_HEAT if self._cooling_state: return CURRENT_HVAC_COOL return CURRENT_HVAC_IDLE if self._setpoint > s...
[ "def", "hvac_action", "(", "self", ")", ":", "if", "self", ".", "_single_thermostat", ":", "if", "self", ".", "_heating_state", ":", "return", "CURRENT_HVAC_HEAT", "if", "self", ".", "_cooling_state", ":", "return", "CURRENT_HVAC_COOL", "return", "CURRENT_HVAC_IDL...
[ 108, 4 ]
[ 118, 32 ]
python
en
['en', 'en', 'en']
True
PwThermostat.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 SUPPORT_FLAGS
[ "def", "supported_features", "(", "self", ")", ":", "return", "SUPPORT_FLAGS" ]
[ 121, 4 ]
[ 123, 28 ]
python
en
['en', 'en', 'en']
True
PwThermostat.device_state_attributes
(self)
Return the device specific state attributes.
Return the device specific state attributes.
def device_state_attributes(self): """Return the device specific state attributes.""" attributes = {} if self._schema_names: attributes["available_schemas"] = self._schema_names if self._selected_schema: attributes["selected_schema"] = self._selected_schema ...
[ "def", "device_state_attributes", "(", "self", ")", ":", "attributes", "=", "{", "}", "if", "self", ".", "_schema_names", ":", "attributes", "[", "\"available_schemas\"", "]", "=", "self", ".", "_schema_names", "if", "self", ".", "_selected_schema", ":", "attr...
[ 126, 4 ]
[ 133, 25 ]
python
en
['en', 'en', 'en']
True
PwThermostat.preset_modes
(self)
Return the available preset modes list.
Return the available preset modes list.
def preset_modes(self): """Return the available preset modes list.""" return self._presets_list
[ "def", "preset_modes", "(", "self", ")", ":", "return", "self", ".", "_presets_list" ]
[ 136, 4 ]
[ 138, 33 ]
python
en
['en', 'en', 'en']
True
PwThermostat.hvac_modes
(self)
Return the available hvac modes list.
Return the available hvac modes list.
def hvac_modes(self): """Return the available hvac modes list.""" if self._compressor_state is not None: return HVAC_MODES_HEAT_COOL return HVAC_MODES_HEAT_ONLY
[ "def", "hvac_modes", "(", "self", ")", ":", "if", "self", ".", "_compressor_state", "is", "not", "None", ":", "return", "HVAC_MODES_HEAT_COOL", "return", "HVAC_MODES_HEAT_ONLY" ]
[ 141, 4 ]
[ 145, 35 ]
python
en
['en', 'ga', 'en']
True
PwThermostat.hvac_mode
(self)
Return current active hvac state.
Return current active hvac state.
def hvac_mode(self): """Return current active hvac state.""" return self._hvac_mode
[ "def", "hvac_mode", "(", "self", ")", ":", "return", "self", ".", "_hvac_mode" ]
[ 148, 4 ]
[ 150, 30 ]
python
en
['en', 'da', 'en']
True
PwThermostat.target_temperature
(self)
Return the target_temperature.
Return the target_temperature.
def target_temperature(self): """Return the target_temperature.""" return self._setpoint
[ "def", "target_temperature", "(", "self", ")", ":", "return", "self", ".", "_setpoint" ]
[ 153, 4 ]
[ 155, 29 ]
python
en
['en', 'la', 'en']
True
PwThermostat.preset_mode
(self)
Return the active preset.
Return the active preset.
def preset_mode(self): """Return the active preset.""" if self._presets: return self._preset_mode return None
[ "def", "preset_mode", "(", "self", ")", ":", "if", "self", ".", "_presets", ":", "return", "self", ".", "_preset_mode", "return", "None" ]
[ 158, 4 ]
[ 162, 19 ]
python
en
['en', 'sr', 'en']
True
PwThermostat.current_temperature
(self)
Return the current room temperature.
Return the current room temperature.
def current_temperature(self): """Return the current room temperature.""" return self._temperature
[ "def", "current_temperature", "(", "self", ")", ":", "return", "self", ".", "_temperature" ]
[ 165, 4 ]
[ 167, 32 ]
python
en
['en', 'la', 'en']
True
PwThermostat.min_temp
(self)
Return the minimal temperature possible to set.
Return the minimal temperature possible to set.
def min_temp(self): """Return the minimal temperature possible to set.""" return self._min_temp
[ "def", "min_temp", "(", "self", ")", ":", "return", "self", ".", "_min_temp" ]
[ 170, 4 ]
[ 172, 29 ]
python
en
['en', 'en', 'en']
True
PwThermostat.max_temp
(self)
Return the maximum temperature possible to set.
Return the maximum temperature possible to set.
def max_temp(self): """Return the maximum temperature possible to set.""" return self._max_temp
[ "def", "max_temp", "(", "self", ")", ":", "return", "self", ".", "_max_temp" ]
[ 175, 4 ]
[ 177, 29 ]
python
en
['en', 'la', 'en']
True
PwThermostat.temperature_unit
(self)
Return the unit of measured temperature.
Return the unit of measured temperature.
def temperature_unit(self): """Return the unit of measured temperature.""" return TEMP_CELSIUS
[ "def", "temperature_unit", "(", "self", ")", ":", "return", "TEMP_CELSIUS" ]
[ 180, 4 ]
[ 182, 27 ]
python
en
['en', 'la', 'en']
True
PwThermostat.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) if (temperature is not None) and ( self._min_temp < temperature < self._max_temp ): try: await self._api.set_temperature(s...
[ "async", "def", "async_set_temperature", "(", "self", ",", "*", "*", "kwargs", ")", ":", "temperature", "=", "kwargs", ".", "get", "(", "ATTR_TEMPERATURE", ")", "if", "(", "temperature", "is", "not", "None", ")", "and", "(", "self", ".", "_min_temp", "<"...
[ 184, 4 ]
[ 197, 58 ]
python
en
['en', 'ca', 'en']
True
PwThermostat.async_set_hvac_mode
(self, hvac_mode)
Set the hvac mode.
Set the hvac mode.
async def async_set_hvac_mode(self, hvac_mode): """Set the hvac mode.""" state = SCHEDULE_OFF if hvac_mode == HVAC_MODE_AUTO: state = SCHEDULE_ON try: await self._api.set_temperature(self._loc_id, self._schedule_temp) self._setpoint = self....
[ "async", "def", "async_set_hvac_mode", "(", "self", ",", "hvac_mode", ")", ":", "state", "=", "SCHEDULE_OFF", "if", "hvac_mode", "==", "HVAC_MODE_AUTO", ":", "state", "=", "SCHEDULE_ON", "try", ":", "await", "self", ".", "_api", ".", "set_temperature", "(", ...
[ 199, 4 ]
[ 216, 64 ]
python
en
['en', 'pt', 'en']
True
PwThermostat.async_set_preset_mode
(self, preset_mode)
Set the preset mode.
Set the preset mode.
async def async_set_preset_mode(self, preset_mode): """Set the preset mode.""" try: await self._api.set_preset(self._loc_id, preset_mode) self._preset_mode = preset_mode self._setpoint = self._presets.get(self._preset_mode, "none")[0] self.async_write_ha_s...
[ "async", "def", "async_set_preset_mode", "(", "self", ",", "preset_mode", ")", ":", "try", ":", "await", "self", ".", "_api", ".", "set_preset", "(", "self", ".", "_loc_id", ",", "preset_mode", ")", "self", ".", "_preset_mode", "=", "preset_mode", "self", ...
[ 218, 4 ]
[ 226, 64 ]
python
en
['en', 'pt', 'en']
True
PwThermostat._async_process_data
(self)
Update the data for this climate device.
Update the data for this climate device.
def _async_process_data(self): """Update the data for this climate device.""" climate_data = self._api.get_device_data(self._dev_id) heater_central_data = self._api.get_device_data(self._api.heater_id) if "setpoint" in climate_data: self._setpoint = climate_data["setpoint"] ...
[ "def", "_async_process_data", "(", "self", ")", ":", "climate_data", "=", "self", ".", "_api", ".", "get_device_data", "(", "self", ".", "_dev_id", ")", "heater_central_data", "=", "self", ".", "_api", ".", "get_device_data", "(", "self", ".", "_api", ".", ...
[ 229, 4 ]
[ 270, 35 ]
python
en
['en', 'en', 'en']
True
fixture_mock_client
()
Mock py17track client.
Mock py17track client.
def fixture_mock_client(): """Mock py17track client.""" with patch( "homeassistant.components.seventeentrack.sensor.SeventeenTrackClient", new=ClientMock, ): yield ProfileMock.reset()
[ "def", "fixture_mock_client", "(", ")", ":", "with", "patch", "(", "\"homeassistant.components.seventeentrack.sensor.SeventeenTrackClient\"", ",", "new", "=", "ClientMock", ",", ")", ":", "yield", "ProfileMock", ".", "reset", "(", ")" ]
[ 113, 0 ]
[ 120, 23 ]
python
en
['en', 'en', 'en']
True
_setup_seventeentrack
(hass, config=None, summary_data=None)
Set up component using config.
Set up component using config.
async def _setup_seventeentrack(hass, config=None, summary_data=None): """Set up component using config.""" if not config: config = VALID_CONFIG_MINIMAL if not summary_data: summary_data = {} ProfileMock.summary_data = summary_data assert await async_setup_component(hass, "sensor", ...
[ "async", "def", "_setup_seventeentrack", "(", "hass", ",", "config", "=", "None", ",", "summary_data", "=", "None", ")", ":", "if", "not", "config", ":", "config", "=", "VALID_CONFIG_MINIMAL", "if", "not", "summary_data", ":", "summary_data", "=", "{", "}", ...
[ 123, 0 ]
[ 132, 38 ]
python
en
['en', 'en', 'en']
True
_goto_future
(hass, future=None)
Move to future.
Move to future.
async def _goto_future(hass, future=None): """Move to future.""" if not future: future = utcnow() + datetime.timedelta(minutes=10) with patch("homeassistant.util.utcnow", return_value=future): async_fire_time_changed(hass, future) await hass.async_block_till_done() async_fire...
[ "async", "def", "_goto_future", "(", "hass", ",", "future", "=", "None", ")", ":", "if", "not", "future", ":", "future", "=", "utcnow", "(", ")", "+", "datetime", ".", "timedelta", "(", "minutes", "=", "10", ")", "with", "patch", "(", "\"homeassistant....
[ 135, 0 ]
[ 143, 42 ]
python
en
['en', 'it', 'en']
True
test_full_valid_config
(hass)
Ensure everything starts correctly.
Ensure everything starts correctly.
async def test_full_valid_config(hass): """Ensure everything starts correctly.""" assert await async_setup_component(hass, "sensor", VALID_CONFIG_FULL) await hass.async_block_till_done() assert len(hass.states.async_entity_ids()) == len(ProfileMock.summary_data.keys())
[ "async", "def", "test_full_valid_config", "(", "hass", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "\"sensor\"", ",", "VALID_CONFIG_FULL", ")", "await", "hass", ".", "async_block_till_done", "(", ")", "assert", "len", "(", "hass", "."...
[ 146, 0 ]
[ 150, 86 ]
python
en
['en', 'zu', 'en']
True
test_valid_config
(hass)
Ensure everything starts correctly.
Ensure everything starts correctly.
async def test_valid_config(hass): """Ensure everything starts correctly.""" assert await async_setup_component(hass, "sensor", VALID_CONFIG_MINIMAL) await hass.async_block_till_done() assert len(hass.states.async_entity_ids()) == len(ProfileMock.summary_data.keys())
[ "async", "def", "test_valid_config", "(", "hass", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "\"sensor\"", ",", "VALID_CONFIG_MINIMAL", ")", "await", "hass", ".", "async_block_till_done", "(", ")", "assert", "len", "(", "hass", ".", ...
[ 153, 0 ]
[ 157, 86 ]
python
en
['en', 'zu', 'en']
True
test_invalid_config
(hass)
Ensure nothing is created when config is wrong.
Ensure nothing is created when config is wrong.
async def test_invalid_config(hass): """Ensure nothing is created when config is wrong.""" assert await async_setup_component(hass, "sensor", INVALID_CONFIG) assert not hass.states.async_entity_ids()
[ "async", "def", "test_invalid_config", "(", "hass", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "\"sensor\"", ",", "INVALID_CONFIG", ")", "assert", "not", "hass", ".", "states", ".", "async_entity_ids", "(", ")" ]
[ 160, 0 ]
[ 164, 45 ]
python
en
['en', 'en', 'en']
True
test_add_package
(hass)
Ensure package is added correctly when user add a new package.
Ensure package is added correctly when user add a new package.
async def test_add_package(hass): """Ensure package is added correctly when user add a new package.""" package = Package( "456", 206, "friendly name 1", "info text 1", "location 1", 206, 2 ) ProfileMock.package_list = [package] await _setup_seventeentrack(hass) assert hass.states.get("s...
[ "async", "def", "test_add_package", "(", "hass", ")", ":", "package", "=", "Package", "(", "\"456\"", ",", "206", ",", "\"friendly name 1\"", ",", "\"info text 1\"", ",", "\"location 1\"", ",", "206", ",", "2", ")", "ProfileMock", ".", "package_list", "=", "...
[ 167, 0 ]
[ 186, 51 ]
python
en
['en', 'en', 'en']
True
test_remove_package
(hass)
Ensure entity is not there anymore if package is not there.
Ensure entity is not there anymore if package is not there.
async def test_remove_package(hass): """Ensure entity is not there anymore if package is not there.""" package1 = Package( "456", 206, "friendly name 1", "info text 1", "location 1", 206, 2 ) package2 = Package( "789", 206, "friendly name 2", "info text 2", "location 2", 206, 2 ) ...
[ "async", "def", "test_remove_package", "(", "hass", ")", ":", "package1", "=", "Package", "(", "\"456\"", ",", "206", ",", "\"friendly name 1\"", ",", "\"info text 1\"", ",", "\"location 1\"", ",", "206", ",", "2", ")", "package2", "=", "Package", "(", "\"78...
[ 189, 0 ]
[ 212, 51 ]
python
en
['en', 'en', 'en']
True
test_friendly_name_changed
(hass)
Test friendly name change.
Test friendly name change.
async def test_friendly_name_changed(hass): """Test friendly name change.""" package = Package( "456", 206, "friendly name 1", "info text 1", "location 1", 206, 2 ) ProfileMock.package_list = [package] await _setup_seventeentrack(hass) assert hass.states.get("sensor.seventeentrack_pack...
[ "async", "def", "test_friendly_name_changed", "(", "hass", ")", ":", "package", "=", "Package", "(", "\"456\"", ",", "206", ",", "\"friendly name 1\"", ",", "\"info text 1\"", ",", "\"location 1\"", ",", "206", ",", "2", ")", "ProfileMock", ".", "package_list", ...
[ 215, 0 ]
[ 239, 51 ]
python
en
['en', 'ht', 'en']
True
test_delivered_not_shown
(hass)
Ensure delivered packages are not shown.
Ensure delivered packages are not shown.
async def test_delivered_not_shown(hass): """Ensure delivered packages are not shown.""" package = Package( "456", 206, "friendly name 1", "info text 1", "location 1", 206, 2, 40 ) ProfileMock.package_list = [package] hass.components.persistent_notification = MagicMock() await _setup_se...
[ "async", "def", "test_delivered_not_shown", "(", "hass", ")", ":", "package", "=", "Package", "(", "\"456\"", ",", "206", ",", "\"friendly name 1\"", ",", "\"info text 1\"", ",", "\"location 1\"", ",", "206", ",", "2", ",", "40", ")", "ProfileMock", ".", "pa...
[ 242, 0 ]
[ 254, 66 ]
python
en
['en', 'en', 'en']
True
test_delivered_shown
(hass)
Ensure delivered packages are show when user choose to show them.
Ensure delivered packages are show when user choose to show them.
async def test_delivered_shown(hass): """Ensure delivered packages are show when user choose to show them.""" package = Package( "456", 206, "friendly name 1", "info text 1", "location 1", 206, 2, 40 ) ProfileMock.package_list = [package] hass.components.persistent_notification = MagicMock(...
[ "async", "def", "test_delivered_shown", "(", "hass", ")", ":", "package", "=", "Package", "(", "\"456\"", ",", "206", ",", "\"friendly name 1\"", ",", "\"info text 1\"", ",", "\"location 1\"", ",", "206", ",", "2", ",", "40", ")", "ProfileMock", ".", "packag...
[ 257, 0 ]
[ 269, 70 ]
python
en
['en', 'en', 'en']
True
test_becomes_delivered_not_shown_notification
(hass)
Ensure notification is triggered when package becomes delivered.
Ensure notification is triggered when package becomes delivered.
async def test_becomes_delivered_not_shown_notification(hass): """Ensure notification is triggered when package becomes delivered.""" package = Package( "456", 206, "friendly name 1", "info text 1", "location 1", 206, 2 ) ProfileMock.package_list = [package] await _setup_seventeentrack(hass...
[ "async", "def", "test_becomes_delivered_not_shown_notification", "(", "hass", ")", ":", "package", "=", "Package", "(", "\"456\"", ",", "206", ",", "\"friendly name 1\"", ",", "\"info text 1\"", ",", "\"location 1\"", ",", "206", ",", "2", ")", "ProfileMock", ".",...
[ 272, 0 ]
[ 293, 45 ]
python
en
['en', 'en', 'en']
True
test_summary_correctly_updated
(hass)
Ensure summary entities are not duplicated.
Ensure summary entities are not duplicated.
async def test_summary_correctly_updated(hass): """Ensure summary entities are not duplicated.""" await _setup_seventeentrack(hass, summary_data=DEFAULT_SUMMARY) assert len(hass.states.async_entity_ids()) == 7 for state in hass.states.async_all(): assert state.state == "0" ProfileMock.summ...
[ "async", "def", "test_summary_correctly_updated", "(", "hass", ")", ":", "await", "_setup_seventeentrack", "(", "hass", ",", "summary_data", "=", "DEFAULT_SUMMARY", ")", "assert", "len", "(", "hass", ".", "states", ".", "async_entity_ids", "(", ")", ")", "==", ...
[ 296, 0 ]
[ 310, 33 ]
python
en
['en', 'en', 'en']
True
ClientMock.__init__
(self, websession)
Mock the profile.
Mock the profile.
def __init__(self, websession) -> None: """Mock the profile.""" self.profile = ProfileMock()
[ "def", "__init__", "(", "self", ",", "websession", ")", "->", "None", ":", "self", ".", "profile", "=", "ProfileMock", "(", ")" ]
[ 72, 4 ]
[ 74, 36 ]
python
en
['en', 'sm', 'en']
True
ProfileMock.reset
(cls)
Reset data to defaults.
Reset data to defaults.
def reset(cls): """Reset data to defaults.""" cls.package_list = [] cls.login_result = True cls.summary_data = DEFAULT_SUMMARY cls.account_id = "123"
[ "def", "reset", "(", "cls", ")", ":", "cls", ".", "package_list", "=", "[", "]", "cls", ".", "login_result", "=", "True", "cls", ".", "summary_data", "=", "DEFAULT_SUMMARY", "cls", ".", "account_id", "=", "\"123\"" ]
[ 86, 4 ]
[ 91, 30 ]
python
en
['it', 'en', 'en']
True
ProfileMock.__init__
(self)
Override Account id.
Override Account id.
def __init__(self) -> None: """Override Account id.""" self.account_id = self.__class__.account_id
[ "def", "__init__", "(", "self", ")", "->", "None", ":", "self", ".", "account_id", "=", "self", ".", "__class__", ".", "account_id" ]
[ 93, 4 ]
[ 95, 51 ]
python
en
['en', 'nl', 'en']
True
ProfileMock.login
(self, email: str, password: str)
Login mock.
Login mock.
async def login(self, email: str, password: str) -> bool: """Login mock.""" return self.__class__.login_result
[ "async", "def", "login", "(", "self", ",", "email", ":", "str", ",", "password", ":", "str", ")", "->", "bool", ":", "return", "self", ".", "__class__", ".", "login_result" ]
[ 97, 4 ]
[ 99, 42 ]
python
en
['en', 'fy', 'en']
False
ProfileMock.packages
( self, package_state: Union[int, str] = "", show_archived: bool = False )
Packages mock.
Packages mock.
async def packages( self, package_state: Union[int, str] = "", show_archived: bool = False ) -> list: """Packages mock.""" return self.__class__.package_list[:]
[ "async", "def", "packages", "(", "self", ",", "package_state", ":", "Union", "[", "int", ",", "str", "]", "=", "\"\"", ",", "show_archived", ":", "bool", "=", "False", ")", "->", "list", ":", "return", "self", ".", "__class__", ".", "package_list", "["...
[ 101, 4 ]
[ 105, 45 ]
python
en
['pl', 'en', 'en']
False
ProfileMock.summary
(self, show_archived: bool = False)
Summary mock.
Summary mock.
async def summary(self, show_archived: bool = False) -> dict: """Summary mock.""" return self.__class__.summary_data
[ "async", "def", "summary", "(", "self", ",", "show_archived", ":", "bool", "=", "False", ")", "->", "dict", ":", "return", "self", ".", "__class__", ".", "summary_data" ]
[ 107, 4 ]
[ 109, 42 ]
python
en
['en', 'so', 'en']
False
setup_platform
(hass, config, add_entities, discovery_info=None)
Set up the PCAL9535A binary sensors.
Set up the PCAL9535A binary sensors.
def setup_platform(hass, config, add_entities, discovery_info=None): """Set up the PCAL9535A binary sensors.""" pull_mode = config[CONF_PULL_MODE] invert_logic = config[CONF_INVERT_LOGIC] i2c_address = config[CONF_I2C_ADDRESS] bus = config[CONF_I2C_BUS] pcal = PCAL9535A(bus, i2c_address) b...
[ "def", "setup_platform", "(", "hass", ",", "config", ",", "add_entities", ",", "discovery_info", "=", "None", ")", ":", "pull_mode", "=", "config", "[", "CONF_PULL_MODE", "]", "invert_logic", "=", "config", "[", "CONF_INVERT_LOGIC", "]", "i2c_address", "=", "c...
[ 38, 0 ]
[ 56, 38 ]
python
en
['en', 'en', 'en']
True
PCAL9535ABinarySensor.__init__
(self, name, pin, pull_mode, invert_logic)
Initialize the PCAL9535A binary sensor.
Initialize the PCAL9535A binary sensor.
def __init__(self, name, pin, pull_mode, invert_logic): """Initialize the PCAL9535A binary sensor.""" self._name = name or DEVICE_DEFAULT_NAME self._pin = pin self._pin.input = True self._pin.inverted = invert_logic if pull_mode == "DISABLED": self._pin.pullup...
[ "def", "__init__", "(", "self", ",", "name", ",", "pin", ",", "pull_mode", ",", "invert_logic", ")", ":", "self", ".", "_name", "=", "name", "or", "DEVICE_DEFAULT_NAME", "self", ".", "_pin", "=", "pin", "self", ".", "_pin", ".", "input", "=", "True", ...
[ 62, 4 ]
[ 74, 26 ]
python
en
['en', 'en', 'en']
True
PCAL9535ABinarySensor.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" ]
[ 77, 4 ]
[ 79, 25 ]
python
en
['en', 'mi', 'en']
True
PCAL9535ABinarySensor.is_on
(self)
Return the cached state of the entity.
Return the cached state of the entity.
def is_on(self): """Return the cached state of the entity.""" return self._state
[ "def", "is_on", "(", "self", ")", ":", "return", "self", ".", "_state" ]
[ 82, 4 ]
[ 84, 26 ]
python
en
['en', 'en', 'en']
True
PCAL9535ABinarySensor.update
(self)
Update the GPIO state.
Update the GPIO state.
def update(self): """Update the GPIO state.""" self._state = self._pin.level
[ "def", "update", "(", "self", ")", ":", "self", ".", "_state", "=", "self", ".", "_pin", ".", "level" ]
[ 86, 4 ]
[ 88, 37 ]
python
en
['en', 'it', 'en']
True
NetworkMorphismTestCase.test_graph_json_transform
(self)
unittest for graph_json_transform function
unittest for graph_json_transform function
def test_graph_json_transform(self): """ unittest for graph_json_transform function """ graph_init = CnnGenerator(10, (32, 32, 3)).generate() graph_init = to_wider_graph(deepcopy(graph_init)) graph_init = to_deeper_graph(deepcopy(graph_init)) graph_init = to_skip_connect...
[ "def", "test_graph_json_transform", "(", "self", ")", ":", "graph_init", "=", "CnnGenerator", "(", "10", ",", "(", "32", ",", "32", ",", "3", ")", ")", ".", "generate", "(", ")", "graph_init", "=", "to_wider_graph", "(", "deepcopy", "(", "graph_init", ")...
[ 23, 4 ]
[ 83, 63 ]
python
en
['en', 'fr', 'en']
True
NetworkMorphismTestCase.test_to_wider_graph
(self)
unittest for to_wider_graph function
unittest for to_wider_graph function
def test_to_wider_graph(self): """ unittest for to_wider_graph function """ graph_init = CnnGenerator(10, (32, 32, 3)).generate() json_out = graph_to_json(graph_init, "temp.json") graph_recover = json_to_graph(json_out) wider_graph = to_wider_graph(deepcopy(graph_recover...
[ "def", "test_to_wider_graph", "(", "self", ")", ":", "graph_init", "=", "CnnGenerator", "(", "10", ",", "(", "32", ",", "32", ",", "3", ")", ")", ".", "generate", "(", ")", "json_out", "=", "graph_to_json", "(", "graph_init", ",", "\"temp.json\"", ")", ...
[ 85, 4 ]
[ 95, 56 ]
python
en
['en', 'en', 'en']
True
NetworkMorphismTestCase.test_to_deeper_graph
(self)
unittest for to_deeper_graph function
unittest for to_deeper_graph function
def test_to_deeper_graph(self): """ unittest for to_deeper_graph function """ graph_init = CnnGenerator(10, (32, 32, 3)).generate() json_out = graph_to_json(graph_init, "temp.json") graph_recover = json_to_graph(json_out) deeper_graph = to_deeper_graph(deepcopy(graph_rec...
[ "def", "test_to_deeper_graph", "(", "self", ")", ":", "graph_init", "=", "CnnGenerator", "(", "10", ",", "(", "32", ",", "32", ",", "3", ")", ")", ".", "generate", "(", ")", "json_out", "=", "graph_to_json", "(", "graph_init", ",", "\"temp.json\"", ")", ...
[ 97, 4 ]
[ 107, 56 ]
python
en
['en', 'en', 'en']
True
NetworkMorphismTestCase.test_to_skip_connection_graph
(self)
unittest for to_skip_connection_graph function
unittest for to_skip_connection_graph function
def test_to_skip_connection_graph(self): """ unittest for to_skip_connection_graph function """ graph_init = CnnGenerator(10, (32, 32, 3)).generate() json_out = graph_to_json(graph_init, "temp.json") graph_recover = json_to_graph(json_out) skip_connection_graph = to_skip...
[ "def", "test_to_skip_connection_graph", "(", "self", ")", ":", "graph_init", "=", "CnnGenerator", "(", "10", ",", "(", "32", ",", "32", ",", "3", ")", ")", ".", "generate", "(", ")", "json_out", "=", "graph_to_json", "(", "graph_init", ",", "\"temp.json\""...
[ 109, 4 ]
[ 119, 56 ]
python
en
['en', 'en', 'en']
True
NetworkMorphismTestCase.test_generate_parameters
(self)
unittest for generate_parameters function
unittest for generate_parameters function
def test_generate_parameters(self): """ unittest for generate_parameters function """ tuner = NetworkMorphismTuner() model_json = tuner.generate_parameters(0) model_json = json.loads(model_json) self.assertEqual(model_json["input_shape"], [32, 32, 3]) self.assert...
[ "def", "test_generate_parameters", "(", "self", ")", ":", "tuner", "=", "NetworkMorphismTuner", "(", ")", "model_json", "=", "tuner", ".", "generate_parameters", "(", "0", ")", "model_json", "=", "json", ".", "loads", "(", "model_json", ")", "self", ".", "as...
[ 121, 4 ]
[ 129, 58 ]
python
en
['en', 'en', 'en']
True
NetworkMorphismTestCase.test_receive_trial_result
(self)
unittest for receive_trial_result function
unittest for receive_trial_result function
def test_receive_trial_result(self): """ unittest for receive_trial_result function """ tuner = NetworkMorphismTuner() model_json = tuner.generate_parameters(0) tuner.receive_trial_result(0, {}, 0.7) (json_out, father_id, model_id) = tuner.total_data[0] self.ass...
[ "def", "test_receive_trial_result", "(", "self", ")", ":", "tuner", "=", "NetworkMorphismTuner", "(", ")", "model_json", "=", "tuner", ".", "generate_parameters", "(", "0", ")", "tuner", ".", "receive_trial_result", "(", "0", ",", "{", "}", ",", "0.7", ")", ...
[ 131, 4 ]
[ 145, 48 ]
python
en
['en', 'en', 'en']
True
NetworkMorphismTestCase.test_update_search_space
(self)
unittest for update_search_space function
unittest for update_search_space function
def test_update_search_space(self): """ unittest for update_search_space function """ tuner = NetworkMorphismTuner() self.assertEqual(tuner.search_space, dict()) tuner.update_search_space("Test") self.assertEqual(tuner.search_space, "Test")
[ "def", "test_update_search_space", "(", "self", ")", ":", "tuner", "=", "NetworkMorphismTuner", "(", ")", "self", ".", "assertEqual", "(", "tuner", ".", "search_space", ",", "dict", "(", ")", ")", "tuner", ".", "update_search_space", "(", "\"Test\"", ")", "s...
[ 147, 4 ]
[ 154, 52 ]
python
en
['en', 'en', 'en']
True
NetworkMorphismTestCase.test_init_search
(self)
unittest for init_search function
unittest for init_search function
def test_init_search(self): """ unittest for init_search function """ tuner = NetworkMorphismTuner() self.assertEqual(tuner.history, []) tuner.init_search() self.assertEqual(tuner.model_count, 1) self.assertEqual(len(tuner.training_queue), 1) self.assertE...
[ "def", "test_init_search", "(", "self", ")", ":", "tuner", "=", "NetworkMorphismTuner", "(", ")", "self", ".", "assertEqual", "(", "tuner", ".", "history", ",", "[", "]", ")", "tuner", ".", "init_search", "(", ")", "self", ".", "assertEqual", "(", "tuner...
[ 156, 4 ]
[ 165, 51 ]
python
en
['en', 'en', 'en']
True
NetworkMorphismTestCase.test_add_model
(self)
unittest for add_model function
unittest for add_model function
def test_add_model(self): """ unittest for add_model function """ tuner = NetworkMorphismTuner() tuner.add_model(0.8, 0) ret = {"model_id": 0, "metric_value": 0.8} self.assertEqual(tuner.history[-1], ret)
[ "def", "test_add_model", "(", "self", ")", ":", "tuner", "=", "NetworkMorphismTuner", "(", ")", "tuner", ".", "add_model", "(", "0.8", ",", "0", ")", "ret", "=", "{", "\"model_id\"", ":", "0", ",", "\"metric_value\"", ":", "0.8", "}", "self", ".", "ass...
[ 167, 4 ]
[ 174, 48 ]
python
no
['no', 'no', 'en']
True
NetworkMorphismTestCase.test_get_best_model_id
(self)
unittest for get_best_model_id function
unittest for get_best_model_id function
def test_get_best_model_id(self): """ unittest for get_best_model_id function """ tuner = NetworkMorphismTuner() tuner.add_model(0.8, 0) tuner.add_model(0.9, 1) self.assertEqual(tuner.get_best_model_id(), 1)
[ "def", "test_get_best_model_id", "(", "self", ")", ":", "tuner", "=", "NetworkMorphismTuner", "(", ")", "tuner", ".", "add_model", "(", "0.8", ",", "0", ")", "tuner", ".", "add_model", "(", "0.9", ",", "1", ")", "self", ".", "assertEqual", "(", "tuner", ...
[ 176, 4 ]
[ 183, 54 ]
python
en
['en', 'en', 'en']
True
setup_platform
(hass, config, add_entities, discovery_info=None)
Set up the DWD-Weather-Warnings sensor.
Set up the DWD-Weather-Warnings sensor.
def setup_platform(hass, config, add_entities, discovery_info=None): """Set up the DWD-Weather-Warnings sensor.""" name = config.get(CONF_NAME) region_name = config.get(CONF_REGION_NAME) api = WrappedDwDWWAPI(DwdWeatherWarningsAPI(region_name)) sensors = [] for sensor_type in config[CONF_MONIT...
[ "def", "setup_platform", "(", "hass", ",", "config", ",", "add_entities", ",", "discovery_info", "=", "None", ")", ":", "name", "=", "config", ".", "get", "(", "CONF_NAME", ")", "region_name", "=", "config", ".", "get", "(", "CONF_REGION_NAME", ")", "api",...
[ 75, 0 ]
[ 86, 31 ]
python
en
['en', 'zu', 'en']
True
DwdWeatherWarningsSensor.__init__
(self, api, name, sensor_type)
Initialize a DWD-Weather-Warnings sensor.
Initialize a DWD-Weather-Warnings sensor.
def __init__(self, api, name, sensor_type): """Initialize a DWD-Weather-Warnings sensor.""" self._api = api self._name = name self._sensor_type = sensor_type
[ "def", "__init__", "(", "self", ",", "api", ",", "name", ",", "sensor_type", ")", ":", "self", ".", "_api", "=", "api", "self", ".", "_name", "=", "name", "self", ".", "_sensor_type", "=", "sensor_type" ]
[ 92, 4 ]
[ 96, 39 ]
python
en
['en', 'fy', 'en']
True
DwdWeatherWarningsSensor.name
(self)
Return the name of the sensor.
Return the name of the sensor.
def name(self): """Return the name of the sensor.""" return f"{self._name} {MONITORED_CONDITIONS[self._sensor_type][0]}"
[ "def", "name", "(", "self", ")", ":", "return", "f\"{self._name} {MONITORED_CONDITIONS[self._sensor_type][0]}\"" ]
[ 99, 4 ]
[ 101, 75 ]
python
en
['en', 'mi', 'en']
True
DwdWeatherWarningsSensor.icon
(self)
Icon to use in the frontend, if any.
Icon to use in the frontend, if any.
def icon(self): """Icon to use in the frontend, if any.""" return MONITORED_CONDITIONS[self._sensor_type][2]
[ "def", "icon", "(", "self", ")", ":", "return", "MONITORED_CONDITIONS", "[", "self", ".", "_sensor_type", "]", "[", "2", "]" ]
[ 104, 4 ]
[ 106, 57 ]
python
en
['en', 'en', 'en']
True
DwdWeatherWarningsSensor.unit_of_measurement
(self)
Return the unit the value is expressed in.
Return the unit the value is expressed in.
def unit_of_measurement(self): """Return the unit the value is expressed in.""" return MONITORED_CONDITIONS[self._sensor_type][1]
[ "def", "unit_of_measurement", "(", "self", ")", ":", "return", "MONITORED_CONDITIONS", "[", "self", ".", "_sensor_type", "]", "[", "1", "]" ]
[ 109, 4 ]
[ 111, 57 ]
python
en
['en', 'en', 'en']
True
DwdWeatherWarningsSensor.state
(self)
Return the state of the device.
Return the state of the device.
def state(self): """Return the state of the device.""" if self._sensor_type == CURRENT_WARNING_SENSOR: return self._api.api.current_warning_level return self._api.api.expected_warning_level
[ "def", "state", "(", "self", ")", ":", "if", "self", ".", "_sensor_type", "==", "CURRENT_WARNING_SENSOR", ":", "return", "self", ".", "_api", ".", "api", ".", "current_warning_level", "return", "self", ".", "_api", ".", "api", ".", "expected_warning_level" ]
[ 114, 4 ]
[ 118, 51 ]
python
en
['en', 'en', 'en']
True
DwdWeatherWarningsSensor.device_state_attributes
(self)
Return the state attributes of the DWD-Weather-Warnings.
Return the state attributes of the DWD-Weather-Warnings.
def device_state_attributes(self): """Return the state attributes of the DWD-Weather-Warnings.""" data = { ATTR_ATTRIBUTION: ATTRIBUTION, ATTR_REGION_NAME: self._api.api.warncell_name, ATTR_REGION_ID: self._api.api.warncell_id, ATTR_LAST_UPDATE: self._api....
[ "def", "device_state_attributes", "(", "self", ")", ":", "data", "=", "{", "ATTR_ATTRIBUTION", ":", "ATTRIBUTION", ",", "ATTR_REGION_NAME", ":", "self", ".", "_api", ".", "api", ".", "warncell_name", ",", "ATTR_REGION_ID", ":", "self", ".", "_api", ".", "api...
[ 121, 4 ]
[ 155, 19 ]
python
en
['en', 'en', 'en']
True
DwdWeatherWarningsSensor.available
(self)
Could the device be accessed during the last update call.
Could the device be accessed during the last update call.
def available(self): """Could the device be accessed during the last update call.""" return self._api.api.data_valid
[ "def", "available", "(", "self", ")", ":", "return", "self", ".", "_api", ".", "api", ".", "data_valid" ]
[ 158, 4 ]
[ 160, 39 ]
python
en
['en', 'en', 'en']
True
DwdWeatherWarningsSensor.update
(self)
Get the latest data from the DWD-Weather-Warnings API.
Get the latest data from the DWD-Weather-Warnings API.
def update(self): """Get the latest data from the DWD-Weather-Warnings API.""" _LOGGER.debug( "Update requested for %s (%s) by %s", self._api.api.warncell_name, self._api.api.warncell_id, self._sensor_type, ) self._api.update()
[ "def", "update", "(", "self", ")", ":", "_LOGGER", ".", "debug", "(", "\"Update requested for %s (%s) by %s\"", ",", "self", ".", "_api", ".", "api", ".", "warncell_name", ",", "self", ".", "_api", ".", "api", ".", "warncell_id", ",", "self", ".", "_sensor...
[ 162, 4 ]
[ 170, 26 ]
python
en
['en', 'en', 'en']
True
WrappedDwDWWAPI.__init__
(self, api)
Initialize a DWD-Weather-Warnings wrapper.
Initialize a DWD-Weather-Warnings wrapper.
def __init__(self, api): """Initialize a DWD-Weather-Warnings wrapper.""" self.api = api
[ "def", "__init__", "(", "self", ",", "api", ")", ":", "self", ".", "api", "=", "api" ]
[ 176, 4 ]
[ 178, 22 ]
python
en
['en', 'en', 'en']
True
WrappedDwDWWAPI.update
(self)
Get the latest data from the DWD-Weather-Warnings API.
Get the latest data from the DWD-Weather-Warnings API.
def update(self): """Get the latest data from the DWD-Weather-Warnings API.""" self.api.update() _LOGGER.debug("Update performed")
[ "def", "update", "(", "self", ")", ":", "self", ".", "api", ".", "update", "(", ")", "_LOGGER", ".", "debug", "(", "\"Update performed\"", ")" ]
[ 181, 4 ]
[ 184, 41 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
( hass: HomeAssistant, config_entry: ConfigEntry, async_add_entities )
Set up rpi_power binary sensor.
Set up rpi_power binary sensor.
async def async_setup_entry( hass: HomeAssistant, config_entry: ConfigEntry, async_add_entities ): """Set up rpi_power binary sensor.""" under_voltage = await hass.async_add_executor_job(new_under_voltage) async_add_entities([RaspberryChargerBinarySensor(under_voltage)], True)
[ "async", "def", "async_setup_entry", "(", "hass", ":", "HomeAssistant", ",", "config_entry", ":", "ConfigEntry", ",", "async_add_entities", ")", ":", "under_voltage", "=", "await", "hass", ".", "async_add_executor_job", "(", "new_under_voltage", ")", "async_add_entiti...
[ 22, 0 ]
[ 27, 75 ]
python
en
['en', 'pt', 'en']
True
RaspberryChargerBinarySensor.__init__
(self, under_voltage)
Initialize the binary sensor.
Initialize the binary sensor.
def __init__(self, under_voltage): """Initialize the binary sensor.""" self._under_voltage = under_voltage self._is_on = None self._last_is_on = False
[ "def", "__init__", "(", "self", ",", "under_voltage", ")", ":", "self", ".", "_under_voltage", "=", "under_voltage", "self", ".", "_is_on", "=", "None", "self", ".", "_last_is_on", "=", "False" ]
[ 33, 4 ]
[ 37, 32 ]
python
en
['en', 'haw', 'en']
True
RaspberryChargerBinarySensor.update
(self)
Update the state.
Update the state.
def update(self): """Update the state.""" self._is_on = self._under_voltage.get() if self._is_on != self._last_is_on: if self._is_on: _LOGGER.warning(DESCRIPTION_UNDER_VOLTAGE) else: _LOGGER.info(DESCRIPTION_NORMALIZED) self._la...
[ "def", "update", "(", "self", ")", ":", "self", ".", "_is_on", "=", "self", ".", "_under_voltage", ".", "get", "(", ")", "if", "self", ".", "_is_on", "!=", "self", ".", "_last_is_on", ":", "if", "self", ".", "_is_on", ":", "_LOGGER", ".", "warning", ...
[ 39, 4 ]
[ 47, 42 ]
python
en
['en', 'en', 'en']
True
RaspberryChargerBinarySensor.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 "rpi_power"
[ "def", "unique_id", "(", "self", ")", ":", "return", "\"rpi_power\"" ]
[ 50, 4 ]
[ 52, 26 ]
python
en
['en', 'la', 'en']
True
RaspberryChargerBinarySensor.name
(self)
Return the name of the sensor.
Return the name of the sensor.
def name(self): """Return the name of the sensor.""" return "RPi Power status"
[ "def", "name", "(", "self", ")", ":", "return", "\"RPi Power status\"" ]
[ 55, 4 ]
[ 57, 33 ]
python
en
['en', 'mi', 'en']
True
RaspberryChargerBinarySensor.is_on
(self)
Return if there is a problem detected.
Return if there is a problem detected.
def is_on(self): """Return if there is a problem detected.""" return self._is_on
[ "def", "is_on", "(", "self", ")", ":", "return", "self", ".", "_is_on" ]
[ 60, 4 ]
[ 62, 26 ]
python
en
['en', 'en', 'en']
True
RaspberryChargerBinarySensor.icon
(self)
Return the icon of the sensor.
Return the icon of the sensor.
def icon(self): """Return the icon of the sensor.""" return "mdi:raspberry-pi"
[ "def", "icon", "(", "self", ")", ":", "return", "\"mdi:raspberry-pi\"" ]
[ 65, 4 ]
[ 67, 33 ]
python
en
['en', 'en', 'en']
True
RaspberryChargerBinarySensor.device_class
(self)
Return the class of this device.
Return the class of this device.
def device_class(self): """Return the class of this device.""" return DEVICE_CLASS_PROBLEM
[ "def", "device_class", "(", "self", ")", ":", "return", "DEVICE_CLASS_PROBLEM" ]
[ 70, 4 ]
[ 72, 35 ]
python
en
['en', 'en', 'en']
True
GaussianProcess_QuasiPeriodicActivity_Derivative._compute_cov_matrix
(self, variable_value, dist_t1, dist_t2, diagonal_env=None)
Notice the differnece in the factor 2 of the Decay time scale between Grunblatt+2015 and Rajpaul+2015
Notice the differnece in the factor 2 of the Decay time scale between Grunblatt+2015 and Rajpaul+2015
def _compute_cov_matrix(self, variable_value, dist_t1, dist_t2, diagonal_env=None): Prot2 = variable_value['Prot']**2 Pdec2 = variable_value['Pdec']**2 Oamp2 = variable_value['Oamp']**2 """ Notice the differnece in the factor 2 of the Decay time scale between Grunblatt+2015 and Rajpaul...
[ "def", "_compute_cov_matrix", "(", "self", ",", "variable_value", ",", "dist_t1", ",", "dist_t2", ",", "diagonal_env", "=", "None", ")", ":", "Prot2", "=", "variable_value", "[", "'Prot'", "]", "**", "2", "Pdec2", "=", "variable_value", "[", "'Pdec'", "]", ...
[ 56, 4 ]
[ 80, 25 ]
python
en
['en', 'en', 'en']
True
GaussianProcess_QuasiPeriodicActivity_Derivative.lnlk_compute
(self, variable_value, dataset)
2 steps: 1) theta parameters must be converted in physical units (e.g. from logarithmic to linear spaces) 2) physical values must be converted to {\tt george} input parameters
2 steps: 1) theta parameters must be converted in physical units (e.g. from logarithmic to linear spaces) 2) physical values must be converted to {\tt george} input parameters
def lnlk_compute(self, variable_value, dataset): """ 2 steps: 1) theta parameters must be converted in physical units (e.g. from logarithmic to linear spaces) 2) physical values must be converted to {\tt george} input parameters """ env = dataset.e ** 2.0 + dataset.jitter ...
[ "def", "lnlk_compute", "(", "self", ",", "variable_value", ",", "dataset", ")", ":", "env", "=", "dataset", ".", "e", "**", "2.0", "+", "dataset", ".", "jitter", "**", "2.0", "cov_matrix", "=", "self", ".", "_compute_cov_matrix", "(", "variable_value", ","...
[ 89, 4 ]
[ 105, 26 ]
python
en
['en', 'sk', 'en']
False
test_form
(hass)
Test we get the form.
Test we get the form.
async def test_form(hass): """Test we get the form.""" await setup.async_setup_component(hass, "persistent_notification", {}) result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) assert result["type"] == RESULT_TYPE_FORM assert resu...
[ "async", "def", "test_form", "(", "hass", ")", ":", "await", "setup", ".", "async_setup_component", "(", "hass", ",", "\"persistent_notification\"", ",", "{", "}", ")", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(...
[ 21, 0 ]
[ 64, 80 ]
python
en
['en', 'en', 'en']
True
test_form_cannot_connect
(hass)
Test we handle unexisting board.
Test we handle unexisting board.
async def test_form_cannot_connect(hass): """Test we handle unexisting board.""" result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) assert result["step_id"] == "user" with patch( "homeassistant.components.progettihwsw.config...
[ "async", "def", "test_form_cannot_connect", "(", "hass", ")", ":", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "DOMAIN", ",", "context", "=", "{", "\"source\"", ":", "config_entries", ".", "SOURCE_USER", "}", "...
[ 67, 0 ]
[ 86, 58 ]
python
en
['de', 'en', 'en']
True
test_form_existing_entry_exception
(hass)
Test we handle existing board.
Test we handle existing board.
async def test_form_existing_entry_exception(hass): """Test we handle existing board.""" result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) assert result["step_id"] == "user" entry = MockConfigEntry( domain=DOMAIN, d...
[ "async", "def", "test_form_existing_entry_exception", "(", "hass", ")", ":", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "DOMAIN", ",", "context", "=", "{", "\"source\"", ":", "config_entries", ".", "SOURCE_USER", ...
[ 89, 0 ]
[ 112, 52 ]
python
en
['en', 'en', 'en']
True
test_form_user_exception
(hass)
Test we handle unknown exception.
Test we handle unknown exception.
async def test_form_user_exception(hass): """Test we handle unknown exception.""" result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) assert result["step_id"] == "user" with patch( "homeassistant.components.progettihwsw.confi...
[ "async", "def", "test_form_user_exception", "(", "hass", ")", ":", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "DOMAIN", ",", "context", "=", "{", "\"source\"", ":", "config_entries", ".", "SOURCE_USER", "}", "...
[ 115, 0 ]
[ 134, 51 ]
python
en
['en', 'en', 'en']
True
sensor_id
(webhook_id, unique_id)
Return a unique sensor ID.
Return a unique sensor ID.
def sensor_id(webhook_id, unique_id): """Return a unique sensor ID.""" return f"{webhook_id}_{unique_id}"
[ "def", "sensor_id", "(", "webhook_id", ",", "unique_id", ")", ":", "return", "f\"{webhook_id}_{unique_id}\"" ]
[ 22, 0 ]
[ 24, 38 ]
python
ca
['ca', 'ca', 'en']
True
MobileAppEntity.__init__
(self, config: dict, device: DeviceEntry, entry: ConfigEntry)
Initialize the sensor.
Initialize the sensor.
def __init__(self, config: dict, device: DeviceEntry, entry: ConfigEntry): """Initialize the sensor.""" self._config = config self._device = device self._entry = entry self._registration = entry.data self._sensor_id = sensor_id( self._registration[CONF_WEBHOOK...
[ "def", "__init__", "(", "self", ",", "config", ":", "dict", ",", "device", ":", "DeviceEntry", ",", "entry", ":", "ConfigEntry", ")", ":", "self", ".", "_config", "=", "config", "self", ".", "_device", "=", "device", "self", ".", "_entry", "=", "entry"...
[ 30, 4 ]
[ 41, 81 ]
python
en
['en', 'en', 'en']
True
MobileAppEntity.async_added_to_hass
(self)
Register callbacks.
Register callbacks.
async def async_added_to_hass(self): """Register callbacks.""" self.unsub_dispatcher = async_dispatcher_connect( self.hass, SIGNAL_SENSOR_UPDATE, self._handle_update )
[ "async", "def", "async_added_to_hass", "(", "self", ")", ":", "self", ".", "unsub_dispatcher", "=", "async_dispatcher_connect", "(", "self", ".", "hass", ",", "SIGNAL_SENSOR_UPDATE", ",", "self", ".", "_handle_update", ")" ]
[ 43, 4 ]
[ 47, 9 ]
python
en
['en', 'no', 'en']
False
MobileAppEntity.async_will_remove_from_hass
(self)
Disconnect dispatcher listener when removed.
Disconnect dispatcher listener when removed.
async def async_will_remove_from_hass(self): """Disconnect dispatcher listener when removed.""" if self.unsub_dispatcher is not None: self.unsub_dispatcher()
[ "async", "def", "async_will_remove_from_hass", "(", "self", ")", ":", "if", "self", ".", "unsub_dispatcher", "is", "not", "None", ":", "self", ".", "unsub_dispatcher", "(", ")" ]
[ 49, 4 ]
[ 52, 35 ]
python
en
['en', 'en', 'en']
True
MobileAppEntity.should_poll
(self)
Declare that this entity pushes its state to HA.
Declare that this entity pushes its state to HA.
def should_poll(self) -> bool: """Declare that this entity pushes its state to HA.""" return False
[ "def", "should_poll", "(", "self", ")", "->", "bool", ":", "return", "False" ]
[ 55, 4 ]
[ 57, 20 ]
python
en
['en', 'en', 'en']
True
MobileAppEntity.name
(self)
Return the name of the mobile app sensor.
Return the name of the mobile app sensor.
def name(self): """Return the name of the mobile app sensor.""" return self._name
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "_name" ]
[ 60, 4 ]
[ 62, 25 ]
python
en
['en', 'no', 'en']
True
MobileAppEntity.device_class
(self)
Return the device class.
Return the device class.
def device_class(self): """Return the device class.""" return self._config.get(ATTR_SENSOR_DEVICE_CLASS)
[ "def", "device_class", "(", "self", ")", ":", "return", "self", ".", "_config", ".", "get", "(", "ATTR_SENSOR_DEVICE_CLASS", ")" ]
[ 65, 4 ]
[ 67, 57 ]
python
en
['en', 'en', 'en']
True
MobileAppEntity.device_state_attributes
(self)
Return the device state attributes.
Return the device state attributes.
def device_state_attributes(self): """Return the device state attributes.""" return self._config[ATTR_SENSOR_ATTRIBUTES]
[ "def", "device_state_attributes", "(", "self", ")", ":", "return", "self", ".", "_config", "[", "ATTR_SENSOR_ATTRIBUTES", "]" ]
[ 70, 4 ]
[ 72, 51 ]
python
en
['en', 'en', 'en']
True
MobileAppEntity.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 self._config[ATTR_SENSOR_ICON]
[ "def", "icon", "(", "self", ")", ":", "return", "self", ".", "_config", "[", "ATTR_SENSOR_ICON", "]" ]
[ 75, 4 ]
[ 77, 45 ]
python
en
['en', 'en', 'en']
True
MobileAppEntity.unique_id
(self)
Return the unique ID of this sensor.
Return the unique ID of this sensor.
def unique_id(self): """Return the unique ID of this sensor.""" return self._sensor_id
[ "def", "unique_id", "(", "self", ")", ":", "return", "self", ".", "_sensor_id" ]
[ 80, 4 ]
[ 82, 30 ]
python
en
['en', 'la', 'en']
True
MobileAppEntity.device_info
(self)
Return device registry information for this entity.
Return device registry information for this entity.
def device_info(self): """Return device registry information for this entity.""" return device_info(self._registration)
[ "def", "device_info", "(", "self", ")", ":", "return", "device_info", "(", "self", ".", "_registration", ")" ]
[ 85, 4 ]
[ 87, 46 ]
python
en
['en', 'en', 'en']
True
MobileAppEntity.async_update
(self)
Get the latest state of the sensor.
Get the latest state of the sensor.
async def async_update(self): """Get the latest state of the sensor.""" data = self.hass.data[DOMAIN] try: self._config = data[self._entity_type][self._sensor_id] except KeyError: return
[ "async", "def", "async_update", "(", "self", ")", ":", "data", "=", "self", ".", "hass", ".", "data", "[", "DOMAIN", "]", "try", ":", "self", ".", "_config", "=", "data", "[", "self", ".", "_entity_type", "]", "[", "self", ".", "_sensor_id", "]", "...
[ 89, 4 ]
[ 95, 18 ]
python
en
['en', 'en', 'en']
True
MobileAppEntity._handle_update
(self, data)
Handle async event updates.
Handle async event updates.
def _handle_update(self, data): """Handle async event updates.""" incoming_id = sensor_id(data[CONF_WEBHOOK_ID], data[ATTR_SENSOR_UNIQUE_ID]) if incoming_id != self._sensor_id: return self._config = data self.async_write_ha_state()
[ "def", "_handle_update", "(", "self", ",", "data", ")", ":", "incoming_id", "=", "sensor_id", "(", "data", "[", "CONF_WEBHOOK_ID", "]", ",", "data", "[", "ATTR_SENSOR_UNIQUE_ID", "]", ")", "if", "incoming_id", "!=", "self", ".", "_sensor_id", ":", "return", ...
[ 98, 4 ]
[ 105, 35 ]
python
en
['fr', 'en', 'en']
True
async_test_binary_sensor_on_off
(hass, cluster, entity_id)
Test getting on and off messages for binary sensors.
Test getting on and off messages for binary sensors.
async def async_test_binary_sensor_on_off(hass, cluster, entity_id): """Test getting on and off messages for binary sensors.""" # binary sensor on await send_attributes_report(hass, cluster, {1: 0, 0: 1, 2: 2}) assert hass.states.get(entity_id).state == STATE_ON # binary sensor off await send_a...
[ "async", "def", "async_test_binary_sensor_on_off", "(", "hass", ",", "cluster", ",", "entity_id", ")", ":", "# binary sensor on", "await", "send_attributes_report", "(", "hass", ",", "cluster", ",", "{", "1", ":", "0", ",", "0", ":", "1", ",", "2", ":", "2...
[ 34, 0 ]
[ 42, 56 ]
python
en
['en', 'en', 'en']
True
async_test_iaszone_on_off
(hass, cluster, entity_id)
Test getting on and off messages for iaszone binary sensors.
Test getting on and off messages for iaszone binary sensors.
async def async_test_iaszone_on_off(hass, cluster, entity_id): """Test getting on and off messages for iaszone binary sensors.""" # binary sensor on cluster.listener_event("cluster_command", 1, 0, [1]) await hass.async_block_till_done() assert hass.states.get(entity_id).state == STATE_ON # bina...
[ "async", "def", "async_test_iaszone_on_off", "(", "hass", ",", "cluster", ",", "entity_id", ")", ":", "# binary sensor on", "cluster", ".", "listener_event", "(", "\"cluster_command\"", ",", "1", ",", "0", ",", "[", "1", "]", ")", "await", "hass", ".", "asyn...
[ 45, 0 ]
[ 55, 56 ]
python
en
['en', 'en', 'en']
True
test_binary_sensor
( hass, zigpy_device_mock, zha_device_joined_restored, device, on_off_test, cluster_name, reporting, )
Test ZHA binary_sensor platform.
Test ZHA binary_sensor platform.
async def test_binary_sensor( hass, zigpy_device_mock, zha_device_joined_restored, device, on_off_test, cluster_name, reporting, ): """Test ZHA binary_sensor platform.""" zigpy_device = zigpy_device_mock(device) zha_device = await zha_device_joined_restored(zigpy_device) enti...
[ "async", "def", "test_binary_sensor", "(", "hass", ",", "zigpy_device_mock", ",", "zha_device_joined_restored", ",", "device", ",", "on_off_test", ",", "cluster_name", ",", "reporting", ",", ")", ":", "zigpy_device", "=", "zigpy_device_mock", "(", "device", ")", "...
[ 65, 0 ]
[ 96, 56 ]
python
en
['en', 'ku', 'pl']
False
async_setup_platform
(hass, _, add_entities, discovery_info=None)
Add binary sensor from the main Qwikswitch component.
Add binary sensor from the main Qwikswitch component.
async def async_setup_platform(hass, _, add_entities, discovery_info=None): """Add binary sensor from the main Qwikswitch component.""" if discovery_info is None: return qsusb = hass.data[QWIKSWITCH] _LOGGER.debug("Setup qwikswitch.binary_sensor %s, %s", qsusb, discovery_info) devs = [QSBin...
[ "async", "def", "async_setup_platform", "(", "hass", ",", "_", ",", "add_entities", ",", "discovery_info", "=", "None", ")", ":", "if", "discovery_info", "is", "None", ":", "return", "qsusb", "=", "hass", ".", "data", "[", "QWIKSWITCH", "]", "_LOGGER", "."...
[ 13, 0 ]
[ 21, 22 ]
python
en
['en', 'en', 'en']
True