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
RachioIro.list_flex_schedules
(self)
Return a list of flex schedules.
Return a list of flex schedules.
def list_flex_schedules(self) -> list: """Return a list of flex schedules.""" return self._flex_schedules
[ "def", "list_flex_schedules", "(", "self", ")", "->", "list", ":", "return", "self", ".", "_flex_schedules" ]
[ 190, 4 ]
[ 192, 35 ]
python
en
['en', 'lb', 'en']
True
RachioIro.stop_watering
(self)
Stop watering all zones connected to this controller.
Stop watering all zones connected to this controller.
def stop_watering(self) -> None: """Stop watering all zones connected to this controller.""" self.rachio.device.stop_water(self.controller_id) _LOGGER.info("Stopped watering of all zones on %s", str(self))
[ "def", "stop_watering", "(", "self", ")", "->", "None", ":", "self", ".", "rachio", ".", "device", ".", "stop_water", "(", "self", ".", "controller_id", ")", "_LOGGER", ".", "info", "(", "\"Stopped watering of all zones on %s\"", ",", "str", "(", "self", ")"...
[ 194, 4 ]
[ 197, 70 ]
python
en
['en', 'en', 'en']
True
OAuth2FlowHandler.logger
(self)
Return logger.
Return logger.
def logger(self) -> logging.Logger: """Return logger.""" return logging.getLogger(__name__)
[ "def", "logger", "(", "self", ")", "->", "logging", ".", "Logger", ":", "return", "logging", ".", "getLogger", "(", "__name__", ")" ]
[ 18, 4 ]
[ 20, 42 ]
python
en
['es', 'no', 'en']
False
send_trial
(parameters: dict)
Send a new trial. Executed on tuner end. Return a ID that is the unique identifier for this trial.
Send a new trial. Executed on tuner end. Return a ID that is the unique identifier for this trial.
def send_trial(parameters: dict) -> int: """ Send a new trial. Executed on tuner end. Return a ID that is the unique identifier for this trial. """ return get_advisor().send_trial(parameters)
[ "def", "send_trial", "(", "parameters", ":", "dict", ")", "->", "int", ":", "return", "get_advisor", "(", ")", ".", "send_trial", "(", "parameters", ")" ]
[ 29, 0 ]
[ 34, 47 ]
python
en
['en', 'error', 'th']
False
receive_trial_parameters
()
Received a new trial. Executed on trial end. Reload with our json loads because NNI didn't use Retiarii serializer to load the data.
Received a new trial. Executed on trial end. Reload with our json loads because NNI didn't use Retiarii serializer to load the data.
def receive_trial_parameters() -> dict: """ Received a new trial. Executed on trial end. Reload with our json loads because NNI didn't use Retiarii serializer to load the data. """ params = nni.get_next_parameter() params = json_loads(json.dumps(params)) return params
[ "def", "receive_trial_parameters", "(", ")", "->", "dict", ":", "params", "=", "nni", ".", "get_next_parameter", "(", ")", "params", "=", "json_loads", "(", "json", ".", "dumps", "(", "params", ")", ")", "return", "params" ]
[ 37, 0 ]
[ 44, 17 ]
python
en
['en', 'error', 'th']
False
test_entity_registry
(hass)
Tests that the devices are registered in the entity registry.
Tests that the devices are registered in the entity registry.
async def test_entity_registry(hass): """Tests that the devices are registered in the entity registry.""" await setup_platform(hass, CAMERA_DOMAIN) entity_registry = await hass.helpers.entity_registry.async_get_registry() entry = entity_registry.async_get("camera.test_cam") assert entry.unique_id =...
[ "async", "def", "test_entity_registry", "(", "hass", ")", ":", "await", "setup_platform", "(", "hass", ",", "CAMERA_DOMAIN", ")", "entity_registry", "=", "await", "hass", ".", "helpers", ".", "entity_registry", ".", "async_get_registry", "(", ")", "entry", "=", ...
[ 10, 0 ]
[ 16, 64 ]
python
en
['en', 'en', 'en']
True
test_attributes
(hass)
Test the camera attributes are correct.
Test the camera attributes are correct.
async def test_attributes(hass): """Test the camera attributes are correct.""" await setup_platform(hass, CAMERA_DOMAIN) state = hass.states.get("camera.test_cam") assert state.state == STATE_IDLE
[ "async", "def", "test_attributes", "(", "hass", ")", ":", "await", "setup_platform", "(", "hass", ",", "CAMERA_DOMAIN", ")", "state", "=", "hass", ".", "states", ".", "get", "(", "\"camera.test_cam\"", ")", "assert", "state", ".", "state", "==", "STATE_IDLE"...
[ 19, 0 ]
[ 24, 36 ]
python
en
['en', 'en', 'en']
True
test_capture_image
(hass)
Test the camera capture image service.
Test the camera capture image service.
async def test_capture_image(hass): """Test the camera capture image service.""" await setup_platform(hass, CAMERA_DOMAIN) with patch("abodepy.AbodeCamera.capture") as mock_capture: await hass.services.async_call( ABODE_DOMAIN, "capture_image", {ATTR_ENTITY_ID: "...
[ "async", "def", "test_capture_image", "(", "hass", ")", ":", "await", "setup_platform", "(", "hass", ",", "CAMERA_DOMAIN", ")", "with", "patch", "(", "\"abodepy.AbodeCamera.capture\"", ")", "as", "mock_capture", ":", "await", "hass", ".", "services", ".", "async...
[ 27, 0 ]
[ 39, 41 ]
python
en
['en', 'ro', 'en']
True
test_camera_on
(hass)
Test the camera turn on service.
Test the camera turn on service.
async def test_camera_on(hass): """Test the camera turn on service.""" await setup_platform(hass, CAMERA_DOMAIN) with patch("abodepy.AbodeCamera.privacy_mode") as mock_capture: await hass.services.async_call( CAMERA_DOMAIN, "turn_on", {ATTR_ENTITY_ID: "camera.tes...
[ "async", "def", "test_camera_on", "(", "hass", ")", ":", "await", "setup_platform", "(", "hass", ",", "CAMERA_DOMAIN", ")", "with", "patch", "(", "\"abodepy.AbodeCamera.privacy_mode\"", ")", "as", "mock_capture", ":", "await", "hass", ".", "services", ".", "asyn...
[ 42, 0 ]
[ 54, 51 ]
python
en
['en', 'en', 'en']
True
test_camera_off
(hass)
Test the camera turn off service.
Test the camera turn off service.
async def test_camera_off(hass): """Test the camera turn off service.""" await setup_platform(hass, CAMERA_DOMAIN) with patch("abodepy.AbodeCamera.privacy_mode") as mock_capture: await hass.services.async_call( CAMERA_DOMAIN, "turn_off", {ATTR_ENTITY_ID: "camera....
[ "async", "def", "test_camera_off", "(", "hass", ")", ":", "await", "setup_platform", "(", "hass", ",", "CAMERA_DOMAIN", ")", "with", "patch", "(", "\"abodepy.AbodeCamera.privacy_mode\"", ")", "as", "mock_capture", ":", "await", "hass", ".", "services", ".", "asy...
[ 57, 0 ]
[ 69, 50 ]
python
en
['en', 'en', 'en']
True
async_setup_platform
(hass, config, async_add_entities, discovery_info=None)
Set up the FFmpeg binary motion sensor.
Set up the FFmpeg binary motion sensor.
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None): """Set up the FFmpeg binary motion sensor.""" manager = hass.data[DATA_FFMPEG] entity = FFmpegMotion(hass, manager, config) async_add_entities([entity])
[ "async", "def", "async_setup_platform", "(", "hass", ",", "config", ",", "async_add_entities", ",", "discovery_info", "=", "None", ")", ":", "manager", "=", "hass", ".", "data", "[", "DATA_FFMPEG", "]", "entity", "=", "FFmpegMotion", "(", "hass", ",", "manag...
[ 50, 0 ]
[ 54, 32 ]
python
en
['en', 'haw', 'en']
True
FFmpegBinarySensor.__init__
(self, config)
Init for the binary sensor noise detection.
Init for the binary sensor noise detection.
def __init__(self, config): """Init for the binary sensor noise detection.""" super().__init__(config.get(CONF_INITIAL_STATE)) self._state = False self._config = config self._name = config.get(CONF_NAME)
[ "def", "__init__", "(", "self", ",", "config", ")", ":", "super", "(", ")", ".", "__init__", "(", "config", ".", "get", "(", "CONF_INITIAL_STATE", ")", ")", "self", ".", "_state", "=", "False", "self", ".", "_config", "=", "config", "self", ".", "_na...
[ 60, 4 ]
[ 66, 42 ]
python
en
['en', 'en', 'en']
True
FFmpegBinarySensor._async_callback
(self, state)
HA-FFmpeg callback for noise detection.
HA-FFmpeg callback for noise detection.
def _async_callback(self, state): """HA-FFmpeg callback for noise detection.""" self._state = state self.async_write_ha_state()
[ "def", "_async_callback", "(", "self", ",", "state", ")", ":", "self", ".", "_state", "=", "state", "self", ".", "async_write_ha_state", "(", ")" ]
[ 69, 4 ]
[ 72, 35 ]
python
en
['nb', 'no', 'en']
False
FFmpegBinarySensor.is_on
(self)
Return true if the binary sensor is on.
Return true if the binary sensor is on.
def is_on(self): """Return true if the binary sensor is on.""" return self._state
[ "def", "is_on", "(", "self", ")", ":", "return", "self", ".", "_state" ]
[ 75, 4 ]
[ 77, 26 ]
python
en
['en', 'fy', 'en']
True
FFmpegBinarySensor.name
(self)
Return the name of the entity.
Return the name of the entity.
def name(self): """Return the name of the entity.""" return self._name
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "_name" ]
[ 80, 4 ]
[ 82, 25 ]
python
en
['en', 'en', 'en']
True
FFmpegMotion.__init__
(self, hass, manager, config)
Initialize FFmpeg motion binary sensor.
Initialize FFmpeg motion binary sensor.
def __init__(self, hass, manager, config): """Initialize FFmpeg motion binary sensor.""" super().__init__(config) self.ffmpeg = ffmpeg_sensor.SensorMotion( manager.binary, hass.loop, self._async_callback )
[ "def", "__init__", "(", "self", ",", "hass", ",", "manager", ",", "config", ")", ":", "super", "(", ")", ".", "__init__", "(", "config", ")", "self", ".", "ffmpeg", "=", "ffmpeg_sensor", ".", "SensorMotion", "(", "manager", ".", "binary", ",", "hass", ...
[ 88, 4 ]
[ 94, 9 ]
python
en
['en', 'ny', 'en']
True
FFmpegMotion._async_start_ffmpeg
(self, entity_ids)
Start a FFmpeg instance. This method is a coroutine.
Start a FFmpeg instance.
async def _async_start_ffmpeg(self, entity_ids): """Start a FFmpeg instance. This method is a coroutine. """ if entity_ids is not None and self.entity_id not in entity_ids: return # init config self.ffmpeg.set_options( time_reset=self._config.get...
[ "async", "def", "_async_start_ffmpeg", "(", "self", ",", "entity_ids", ")", ":", "if", "entity_ids", "is", "not", "None", "and", "self", ".", "entity_id", "not", "in", "entity_ids", ":", "return", "# init config", "self", ".", "ffmpeg", ".", "set_options", "...
[ 96, 4 ]
[ 116, 9 ]
python
en
['hu', 'lb', 'en']
False
FFmpegMotion.device_class
(self)
Return the class of this sensor, from DEVICE_CLASSES.
Return the class of this sensor, from DEVICE_CLASSES.
def device_class(self): """Return the class of this sensor, from DEVICE_CLASSES.""" return DEVICE_CLASS_MOTION
[ "def", "device_class", "(", "self", ")", ":", "return", "DEVICE_CLASS_MOTION" ]
[ 119, 4 ]
[ 121, 34 ]
python
en
['en', 'en', 'en']
True
validate_lang
(value)
Validate chosen gender or language.
Validate chosen gender or language.
def validate_lang(value): """Validate chosen gender or language.""" lang = value[CONF_LANG] gender = value.get(CONF_GENDER) if gender is None: gender = value[CONF_GENDER] = next( (chk_gender for chk_lang, chk_gender in MAP_VOICE if chk_lang == lang), None ) if (lang, ge...
[ "def", "validate_lang", "(", "value", ")", ":", "lang", "=", "value", "[", "CONF_LANG", "]", "gender", "=", "value", ".", "get", "(", "CONF_GENDER", ")", "if", "gender", "is", "None", ":", "gender", "=", "value", "[", "CONF_GENDER", "]", "=", "next", ...
[ 18, 0 ]
[ 31, 16 ]
python
en
['nl', 'jv', 'en']
False
async_get_engine
(hass, config, discovery_info=None)
Set up Cloud speech component.
Set up Cloud speech component.
async def async_get_engine(hass, config, discovery_info=None): """Set up Cloud speech component.""" cloud: Cloud = hass.data[DOMAIN] if discovery_info is not None: language = DEFAULT_LANG gender = DEFAULT_GENDER else: language = config[CONF_LANG] gender = config[CONF_GEN...
[ "async", "def", "async_get_engine", "(", "hass", ",", "config", ",", "discovery_info", "=", "None", ")", ":", "cloud", ":", "Cloud", "=", "hass", ".", "data", "[", "DOMAIN", "]", "if", "discovery_info", "is", "not", "None", ":", "language", "=", "DEFAULT...
[ 45, 0 ]
[ 56, 49 ]
python
en
['en', 'lb', 'en']
True
CloudProvider.__init__
(self, cloud: Cloud, language: str, gender: str)
Initialize cloud provider.
Initialize cloud provider.
def __init__(self, cloud: Cloud, language: str, gender: str): """Initialize cloud provider.""" self.cloud = cloud self.name = "Cloud" self._language = language self._gender = gender
[ "def", "__init__", "(", "self", ",", "cloud", ":", "Cloud", ",", "language", ":", "str", ",", "gender", ":", "str", ")", ":", "self", ".", "cloud", "=", "cloud", "self", ".", "name", "=", "\"Cloud\"", "self", ".", "_language", "=", "language", "self"...
[ 62, 4 ]
[ 67, 29 ]
python
en
['nl', 'en', 'en']
True
CloudProvider.default_language
(self)
Return the default language.
Return the default language.
def default_language(self): """Return the default language.""" return self._language
[ "def", "default_language", "(", "self", ")", ":", "return", "self", ".", "_language" ]
[ 70, 4 ]
[ 72, 29 ]
python
en
['en', 'et', 'en']
True
CloudProvider.supported_languages
(self)
Return list of supported languages.
Return list of supported languages.
def supported_languages(self): """Return list of supported languages.""" return SUPPORT_LANGUAGES
[ "def", "supported_languages", "(", "self", ")", ":", "return", "SUPPORT_LANGUAGES" ]
[ 75, 4 ]
[ 77, 32 ]
python
en
['en', 'en', 'en']
True
CloudProvider.supported_options
(self)
Return list of supported options like voice, emotion.
Return list of supported options like voice, emotion.
def supported_options(self): """Return list of supported options like voice, emotion.""" return [CONF_GENDER]
[ "def", "supported_options", "(", "self", ")", ":", "return", "[", "CONF_GENDER", "]" ]
[ 80, 4 ]
[ 82, 28 ]
python
en
['en', 'en', 'en']
True
CloudProvider.default_options
(self)
Return a dict include default options.
Return a dict include default options.
def default_options(self): """Return a dict include default options.""" return {CONF_GENDER: self._gender}
[ "def", "default_options", "(", "self", ")", ":", "return", "{", "CONF_GENDER", ":", "self", ".", "_gender", "}" ]
[ 85, 4 ]
[ 87, 42 ]
python
en
['it', 'en', 'en']
True
CloudProvider.async_get_tts_audio
(self, message, language, options=None)
Load TTS from NabuCasa Cloud.
Load TTS from NabuCasa Cloud.
async def async_get_tts_audio(self, message, language, options=None): """Load TTS from NabuCasa Cloud.""" # Process TTS try: data = await self.cloud.voice.process_tts( message, language, gender=options[CONF_GENDER] ) except VoiceError: ...
[ "async", "def", "async_get_tts_audio", "(", "self", ",", "message", ",", "language", ",", "options", "=", "None", ")", ":", "# Process TTS", "try", ":", "data", "=", "await", "self", ".", "cloud", ".", "voice", ".", "process_tts", "(", "message", ",", "l...
[ 89, 4 ]
[ 99, 28 ]
python
en
['en', 'bg', 'en']
True
CompositeEvalMetric.add
(self, metric)
Adds a child metric. Args: metric (EvalMetric): A metric instance.
Adds a child metric. Args: metric (EvalMetric): A metric instance.
def add(self, metric): """Adds a child metric. Args: metric (EvalMetric): A metric instance. """ self.metrics.append(metric)
[ "def", "add", "(", "self", ",", "metric", ")", ":", "self", ".", "metrics", ".", "append", "(", "metric", ")" ]
[ 17, 4 ]
[ 22, 35 ]
python
en
['en', 'en', 'en']
True
CompositeEvalMetric.get_metric
(self, index)
Returns a child metric. Args: index (int): Index of child metric in the list of metrics.
Returns a child metric. Args: index (int): Index of child metric in the list of metrics.
def get_metric(self, index): """Returns a child metric. Args: index (int): Index of child metric in the list of metrics. """ try: return self.metrics[index] except IndexError: return ValueError("Metric index {} is out of range 0 and {}".format(...
[ "def", "get_metric", "(", "self", ",", "index", ")", ":", "try", ":", "return", "self", ".", "metrics", "[", "index", "]", "except", "IndexError", ":", "return", "ValueError", "(", "\"Metric index {} is out of range 0 and {}\"", ".", "format", "(", "index", ",...
[ 24, 4 ]
[ 33, 42 ]
python
en
['en', 'vi', 'en']
True
CompositeEvalMetric.update
(self, outputs)
Updates the internal evaluation result. Args: labels (dict of `NDArray`): The labels of the data. preds (dict of `NDArray`): Predicted values.
Updates the internal evaluation result. Args: labels (dict of `NDArray`): The labels of the data. preds (dict of `NDArray`): Predicted values.
def update(self, outputs): """Updates the internal evaluation result. Args: labels (dict of `NDArray`): The labels of the data. preds (dict of `NDArray`): Predicted values. """ for metric in self.metrics: metric.update(outputs)
[ "def", "update", "(", "self", ",", "outputs", ")", ":", "for", "metric", "in", "self", ".", "metrics", ":", "metric", ".", "update", "(", "outputs", ")" ]
[ 35, 4 ]
[ 42, 34 ]
python
en
['en', 'en', 'en']
True
CompositeEvalMetric.reset
(self)
Resets the internal evaluation result to initial state.
Resets the internal evaluation result to initial state.
def reset(self): """Resets the internal evaluation result to initial state.""" try: for metric in self.metrics: metric.reset() except AttributeError: pass
[ "def", "reset", "(", "self", ")", ":", "try", ":", "for", "metric", "in", "self", ".", "metrics", ":", "metric", ".", "reset", "(", ")", "except", "AttributeError", ":", "pass" ]
[ 44, 4 ]
[ 50, 16 ]
python
en
['en', 'en', 'en']
True
CompositeEvalMetric.get
(self)
Returns the current evaluation result. Returns: names (list of str): Name of the metrics. values (list of float): Value of the evaluations.
Returns the current evaluation result. Returns: names (list of str): Name of the metrics. values (list of float): Value of the evaluations.
def get(self): """Returns the current evaluation result. Returns: names (list of str): Name of the metrics. values (list of float): Value of the evaluations. """ names = [] values = [] for metric in self.metrics: name, value = metric.ge...
[ "def", "get", "(", "self", ")", ":", "names", "=", "[", "]", "values", "=", "[", "]", "for", "metric", "in", "self", ".", "metrics", ":", "name", ",", "value", "=", "metric", ".", "get", "(", ")", "if", "isinstance", "(", "name", ",", "str", ")...
[ 52, 4 ]
[ 68, 28 ]
python
en
['en', 'da', 'en']
True
async_setup_entry
(hass, config_entry, async_add_entities)
Set up tellduslive sensors dynamically.
Set up tellduslive sensors dynamically.
async def async_setup_entry(hass, config_entry, async_add_entities): """Set up tellduslive sensors dynamically.""" async def async_discover_switch(device_id): """Discover and add a discovered sensor.""" client = hass.data[tellduslive.DOMAIN] async_add_entities([TelldusLiveSwitch(client,...
[ "async", "def", "async_setup_entry", "(", "hass", ",", "config_entry", ",", "async_add_entities", ")", ":", "async", "def", "async_discover_switch", "(", "device_id", ")", ":", "\"\"\"Discover and add a discovered sensor.\"\"\"", "client", "=", "hass", ".", "data", "[...
[ 8, 0 ]
[ 20, 5 ]
python
en
['en', 'hu', 'en']
True
TelldusLiveSwitch.is_on
(self)
Return true if switch is on.
Return true if switch is on.
def is_on(self): """Return true if switch is on.""" return self.device.is_on
[ "def", "is_on", "(", "self", ")", ":", "return", "self", ".", "device", ".", "is_on" ]
[ 27, 4 ]
[ 29, 32 ]
python
en
['en', 'fy', 'en']
True
TelldusLiveSwitch.turn_on
(self, **kwargs)
Turn the switch on.
Turn the switch on.
def turn_on(self, **kwargs): """Turn the switch on.""" self.device.turn_on() self._update_callback()
[ "def", "turn_on", "(", "self", ",", "*", "*", "kwargs", ")", ":", "self", ".", "device", ".", "turn_on", "(", ")", "self", ".", "_update_callback", "(", ")" ]
[ 31, 4 ]
[ 34, 31 ]
python
en
['en', 'en', 'en']
True
TelldusLiveSwitch.turn_off
(self, **kwargs)
Turn the switch off.
Turn the switch off.
def turn_off(self, **kwargs): """Turn the switch off.""" self.device.turn_off() self._update_callback()
[ "def", "turn_off", "(", "self", ",", "*", "*", "kwargs", ")", ":", "self", ".", "device", ".", "turn_off", "(", ")", "self", ".", "_update_callback", "(", ")" ]
[ 36, 4 ]
[ 39, 31 ]
python
en
['en', 'en', 'en']
True
setup_platform
(hass, config, add_entities, discovery_info=None)
Set up the QVR Pro camera platform.
Set up the QVR Pro camera platform.
def setup_platform(hass, config, add_entities, discovery_info=None): """Set up the QVR Pro camera platform.""" if discovery_info is None: return client = hass.data[DOMAIN]["client"] entities = [] for channel in hass.data[DOMAIN]["channels"]: stream_source = get_stream_source(chan...
[ "def", "setup_platform", "(", "hass", ",", "config", ",", "add_entities", ",", "discovery_info", "=", "None", ")", ":", "if", "discovery_info", "is", "None", ":", "return", "client", "=", "hass", ".", "data", "[", "DOMAIN", "]", "[", "\"client\"", "]", "...
[ 13, 0 ]
[ 29, 26 ]
python
en
['en', 'da', 'en']
True
get_stream_source
(guid, client)
Get channel stream source.
Get channel stream source.
def get_stream_source(guid, client): """Get channel stream source.""" try: resp = client.get_channel_live_stream(guid, protocol="rtsp") full_url = resp["resourceUris"] protocol = full_url[:7] auth = f"{client.get_auth_string()}@" url = full_url[7:] return f"{pr...
[ "def", "get_stream_source", "(", "guid", ",", "client", ")", ":", "try", ":", "resp", "=", "client", ".", "get_channel_live_stream", "(", "guid", ",", "protocol", "=", "\"rtsp\"", ")", "full_url", "=", "resp", "[", "\"resourceUris\"", "]", "protocol", "=", ...
[ 32, 0 ]
[ 47, 19 ]
python
en
['en', 'de', 'en']
True
QVRProCamera.__init__
(self, name, model, brand, channel_index, guid, stream_source, client)
Init QVR Pro camera.
Init QVR Pro camera.
def __init__(self, name, model, brand, channel_index, guid, stream_source, client): """Init QVR Pro camera.""" self._name = f"{SHORT_NAME} {name}" self._model = model self._brand = brand self.index = channel_index self.guid = guid self._client = client se...
[ "def", "__init__", "(", "self", ",", "name", ",", "model", ",", "brand", ",", "channel_index", ",", "guid", ",", "stream_source", ",", "client", ")", ":", "self", ".", "_name", "=", "f\"{SHORT_NAME} {name}\"", "self", ".", "_model", "=", "model", "self", ...
[ 53, 4 ]
[ 66, 26 ]
python
ca
['es', 'ca', 'it']
False
QVRProCamera.name
(self)
Return the name of the entity.
Return the name of the entity.
def name(self): """Return the name of the entity.""" return self._name
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "_name" ]
[ 69, 4 ]
[ 71, 25 ]
python
en
['en', 'en', 'en']
True
QVRProCamera.model
(self)
Return the model of the entity.
Return the model of the entity.
def model(self): """Return the model of the entity.""" return self._model
[ "def", "model", "(", "self", ")", ":", "return", "self", ".", "_model" ]
[ 74, 4 ]
[ 76, 26 ]
python
en
['en', 'en', 'en']
True
QVRProCamera.brand
(self)
Return the brand of the entity.
Return the brand of the entity.
def brand(self): """Return the brand of the entity.""" return self._brand
[ "def", "brand", "(", "self", ")", ":", "return", "self", ".", "_brand" ]
[ 79, 4 ]
[ 81, 26 ]
python
en
['en', 'en', 'en']
True
QVRProCamera.device_state_attributes
(self)
Get the state attributes.
Get the state attributes.
def device_state_attributes(self): """Get the state attributes.""" attrs = {"qvr_guid": self.guid} return attrs
[ "def", "device_state_attributes", "(", "self", ")", ":", "attrs", "=", "{", "\"qvr_guid\"", ":", "self", ".", "guid", "}", "return", "attrs" ]
[ 84, 4 ]
[ 88, 20 ]
python
en
['en', 'en', 'en']
True
QVRProCamera.camera_image
(self)
Get image bytes from camera.
Get image bytes from camera.
def camera_image(self): """Get image bytes from camera.""" try: return self._client.get_snapshot(self.guid) except QVRResponseError as ex: _LOGGER.error("Error getting image: %s", ex) self._client.connect() return self._client.get_snapshot(self.guid)
[ "def", "camera_image", "(", "self", ")", ":", "try", ":", "return", "self", ".", "_client", ".", "get_snapshot", "(", "self", ".", "guid", ")", "except", "QVRResponseError", "as", "ex", ":", "_LOGGER", ".", "error", "(", "\"Error getting image: %s\"", ",", ...
[ 90, 4 ]
[ 99, 51 ]
python
en
['en', 'en', 'en']
True
QVRProCamera.stream_source
(self)
Get stream source.
Get stream source.
async def stream_source(self): """Get stream source.""" return self._stream_source
[ "async", "def", "stream_source", "(", "self", ")", ":", "return", "self", ".", "_stream_source" ]
[ 101, 4 ]
[ 103, 34 ]
python
de
['fr', 'de', 'en']
False
QVRProCamera.supported_features
(self)
Get supported features.
Get supported features.
def supported_features(self): """Get supported features.""" return self._supported_features
[ "def", "supported_features", "(", "self", ")", ":", "return", "self", ".", "_supported_features" ]
[ 106, 4 ]
[ 108, 39 ]
python
en
['en', 'en', 'en']
True
async_request_config
( hass, name, callback=None, description=None, description_image=None, submit_caption=None, fields=None, link_name=None, link_url=None, entity_picture=None, )
Create a new request for configuration. Will return an ID to be used for sequent calls.
Create a new request for configuration.
def async_request_config( hass, name, callback=None, description=None, description_image=None, submit_caption=None, fields=None, link_name=None, link_url=None, entity_picture=None, ): """Create a new request for configuration. Will return an ID to be used for sequent cal...
[ "def", "async_request_config", "(", "hass", ",", "name", ",", "callback", "=", "None", ",", "description", "=", "None", ",", "description_image", "=", "None", ",", "submit_caption", "=", "None", ",", "fields", "=", "None", ",", "link_name", "=", "None", ",...
[ 44, 0 ]
[ 80, 21 ]
python
en
['en', 'en', 'en']
True
request_config
(hass, *args, **kwargs)
Create a new request for configuration. Will return an ID to be used for sequent calls.
Create a new request for configuration.
def request_config(hass, *args, **kwargs): """Create a new request for configuration. Will return an ID to be used for sequent calls. """ return run_callback_threadsafe( hass.loop, ft.partial(async_request_config, hass, *args, **kwargs) ).result()
[ "def", "request_config", "(", "hass", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "run_callback_threadsafe", "(", "hass", ".", "loop", ",", "ft", ".", "partial", "(", "async_request_config", ",", "hass", ",", "*", "args", ",", "*", "...
[ 84, 0 ]
[ 91, 14 ]
python
en
['en', 'en', 'en']
True
async_notify_errors
(hass, request_id, error)
Add errors to a config request.
Add errors to a config request.
def async_notify_errors(hass, request_id, error): """Add errors to a config request.""" try: hass.data[DATA_REQUESTS][request_id].async_notify_errors(request_id, error) except KeyError: # If request_id does not exist pass
[ "def", "async_notify_errors", "(", "hass", ",", "request_id", ",", "error", ")", ":", "try", ":", "hass", ".", "data", "[", "DATA_REQUESTS", "]", "[", "request_id", "]", ".", "async_notify_errors", "(", "request_id", ",", "error", ")", "except", "KeyError", ...
[ 96, 0 ]
[ 102, 12 ]
python
en
['en', 'en', 'en']
True
notify_errors
(hass, request_id, error)
Add errors to a config request.
Add errors to a config request.
def notify_errors(hass, request_id, error): """Add errors to a config request.""" return run_callback_threadsafe( hass.loop, async_notify_errors, hass, request_id, error ).result()
[ "def", "notify_errors", "(", "hass", ",", "request_id", ",", "error", ")", ":", "return", "run_callback_threadsafe", "(", "hass", ".", "loop", ",", "async_notify_errors", ",", "hass", ",", "request_id", ",", "error", ")", ".", "result", "(", ")" ]
[ 106, 0 ]
[ 110, 14 ]
python
en
['en', 'en', 'en']
True
async_request_done
(hass, request_id)
Mark a configuration request as done.
Mark a configuration request as done.
def async_request_done(hass, request_id): """Mark a configuration request as done.""" try: hass.data[DATA_REQUESTS].pop(request_id).async_request_done(request_id) except KeyError: # If request_id does not exist pass
[ "def", "async_request_done", "(", "hass", ",", "request_id", ")", ":", "try", ":", "hass", ".", "data", "[", "DATA_REQUESTS", "]", ".", "pop", "(", "request_id", ")", ".", "async_request_done", "(", "request_id", ")", "except", "KeyError", ":", "# If request...
[ 115, 0 ]
[ 121, 12 ]
python
en
['pt', 'en', 'en']
True
request_done
(hass, request_id)
Mark a configuration request as done.
Mark a configuration request as done.
def request_done(hass, request_id): """Mark a configuration request as done.""" return run_callback_threadsafe( hass.loop, async_request_done, hass, request_id ).result()
[ "def", "request_done", "(", "hass", ",", "request_id", ")", ":", "return", "run_callback_threadsafe", "(", "hass", ".", "loop", ",", "async_request_done", ",", "hass", ",", "request_id", ")", ".", "result", "(", ")" ]
[ 125, 0 ]
[ 129, 14 ]
python
en
['pt', 'en', 'en']
True
async_setup
(hass, config)
Set up the configurator component.
Set up the configurator component.
async def async_setup(hass, config): """Set up the configurator component.""" return True
[ "async", "def", "async_setup", "(", "hass", ",", "config", ")", ":", "return", "True" ]
[ 132, 0 ]
[ 134, 15 ]
python
en
['en', 'en', 'en']
True
Configurator.__init__
(self, hass)
Initialize the configurator.
Initialize the configurator.
def __init__(self, hass): """Initialize the configurator.""" self.hass = hass self._cur_id = 0 self._requests = {} hass.services.async_register( DOMAIN, SERVICE_CONFIGURE, self.async_handle_service_call )
[ "def", "__init__", "(", "self", ",", "hass", ")", ":", "self", ".", "hass", "=", "hass", "self", ".", "_cur_id", "=", "0", "self", ".", "_requests", "=", "{", "}", "hass", ".", "services", ".", "async_register", "(", "DOMAIN", ",", "SERVICE_CONFIGURE",...
[ 140, 4 ]
[ 147, 9 ]
python
en
['en', 'en', 'en']
True
Configurator.async_request_config
( self, name, callback, description, submit_caption, fields, entity_picture )
Set up a request for configuration.
Set up a request for configuration.
def async_request_config( self, name, callback, description, submit_caption, fields, entity_picture ): """Set up a request for configuration.""" entity_id = async_generate_entity_id(ENTITY_ID_FORMAT, name, hass=self.hass) if fields is None: fields = [] request_i...
[ "def", "async_request_config", "(", "self", ",", "name", ",", "callback", ",", "description", ",", "submit_caption", ",", "fields", ",", "entity_picture", ")", ":", "entity_id", "=", "async_generate_entity_id", "(", "ENTITY_ID_FORMAT", ",", "name", ",", "hass", ...
[ 150, 4 ]
[ 183, 25 ]
python
en
['en', 'en', 'en']
True
Configurator.async_notify_errors
(self, request_id, error)
Update the state with errors.
Update the state with errors.
def async_notify_errors(self, request_id, error): """Update the state with errors.""" if not self._validate_request_id(request_id): return entity_id = self._requests[request_id][0] state = self.hass.states.get(entity_id) new_data = dict(state.attributes) ne...
[ "def", "async_notify_errors", "(", "self", ",", "request_id", ",", "error", ")", ":", "if", "not", "self", ".", "_validate_request_id", "(", "request_id", ")", ":", "return", "entity_id", "=", "self", ".", "_requests", "[", "request_id", "]", "[", "0", "]"...
[ 186, 4 ]
[ 198, 72 ]
python
en
['en', 'en', 'en']
True
Configurator.async_request_done
(self, request_id)
Remove the configuration request.
Remove the configuration request.
def async_request_done(self, request_id): """Remove the configuration request.""" if not self._validate_request_id(request_id): return entity_id = self._requests.pop(request_id)[0] # If we remove the state right away, it will not be included with # the result of the...
[ "def", "async_request_done", "(", "self", ",", "request_id", ")", ":", "if", "not", "self", ".", "_validate_request_id", "(", "request_id", ")", ":", "return", "entity_id", "=", "self", ".", "_requests", ".", "pop", "(", "request_id", ")", "[", "0", "]", ...
[ 201, 4 ]
[ 218, 76 ]
python
en
['en', 'it', 'en']
True
Configurator.async_handle_service_call
(self, call)
Handle a configure service call.
Handle a configure service call.
async def async_handle_service_call(self, call): """Handle a configure service call.""" request_id = call.data.get(ATTR_CONFIGURE_ID) if not self._validate_request_id(request_id): return # pylint: disable=unused-variable entity_id, fields, callback = self._requests[...
[ "async", "def", "async_handle_service_call", "(", "self", ",", "call", ")", ":", "request_id", "=", "call", ".", "data", ".", "get", "(", "ATTR_CONFIGURE_ID", ")", "if", "not", "self", ".", "_validate_request_id", "(", "request_id", ")", ":", "return", "# py...
[ 220, 4 ]
[ 232, 83 ]
python
en
['es', 'gl', 'en']
False
Configurator._generate_unique_id
(self)
Generate a unique configurator ID.
Generate a unique configurator ID.
def _generate_unique_id(self): """Generate a unique configurator ID.""" self._cur_id += 1 return f"{id(self)}-{self._cur_id}"
[ "def", "_generate_unique_id", "(", "self", ")", ":", "self", ".", "_cur_id", "+=", "1", "return", "f\"{id(self)}-{self._cur_id}\"" ]
[ 234, 4 ]
[ 237, 43 ]
python
it
['fr', 'it', 'it']
True
Configurator._validate_request_id
(self, request_id)
Validate that the request belongs to this instance.
Validate that the request belongs to this instance.
def _validate_request_id(self, request_id): """Validate that the request belongs to this instance.""" return request_id in self._requests
[ "def", "_validate_request_id", "(", "self", ",", "request_id", ")", ":", "return", "request_id", "in", "self", ".", "_requests" ]
[ 239, 4 ]
[ 241, 43 ]
python
en
['en', 'en', 'en']
True
setup
(hass, config)
Set up the Remember the milk component.
Set up the Remember the milk component.
def setup(hass, config): """Set up the Remember the milk component.""" component = EntityComponent(_LOGGER, DOMAIN, hass) stored_rtm_config = RememberTheMilkConfiguration(hass) for rtm_config in config[DOMAIN]: account_name = rtm_config[CONF_NAME] _LOGGER.info("Adding Remember the milk ...
[ "def", "setup", "(", "hass", ",", "config", ")", ":", "component", "=", "EntityComponent", "(", "_LOGGER", ",", "DOMAIN", ",", "hass", ")", "stored_rtm_config", "=", "RememberTheMilkConfiguration", "(", "hass", ")", "for", "rtm_config", "in", "config", "[", ...
[ 49, 0 ]
[ 77, 15 ]
python
en
['en', 'en', 'en']
True
RememberTheMilkConfiguration.__init__
(self, hass)
Create new instance of configuration.
Create new instance of configuration.
def __init__(self, hass): """Create new instance of configuration.""" self._config_file_path = hass.config.path(CONFIG_FILE_NAME) if not os.path.isfile(self._config_file_path): self._config = {} return try: _LOGGER.debug("Loading configuration from fil...
[ "def", "__init__", "(", "self", ",", "hass", ")", ":", "self", ".", "_config_file_path", "=", "hass", ".", "config", ".", "path", "(", "CONFIG_FILE_NAME", ")", "if", "not", "os", ".", "path", ".", "isfile", "(", "self", ".", "_config_file_path", ")", "...
[ 157, 4 ]
[ 172, 29 ]
python
en
['en', 'en', 'en']
True
RememberTheMilkConfiguration.save_config
(self)
Write the configuration to a file.
Write the configuration to a file.
def save_config(self): """Write the configuration to a file.""" with open(self._config_file_path, "w") as config_file: json.dump(self._config, config_file)
[ "def", "save_config", "(", "self", ")", ":", "with", "open", "(", "self", ".", "_config_file_path", ",", "\"w\"", ")", "as", "config_file", ":", "json", ".", "dump", "(", "self", ".", "_config", ",", "config_file", ")" ]
[ 174, 4 ]
[ 177, 48 ]
python
en
['en', 'en', 'en']
True
RememberTheMilkConfiguration.get_token
(self, profile_name)
Get the server token for a profile.
Get the server token for a profile.
def get_token(self, profile_name): """Get the server token for a profile.""" if profile_name in self._config: return self._config[profile_name][CONF_TOKEN] return None
[ "def", "get_token", "(", "self", ",", "profile_name", ")", ":", "if", "profile_name", "in", "self", ".", "_config", ":", "return", "self", ".", "_config", "[", "profile_name", "]", "[", "CONF_TOKEN", "]", "return", "None" ]
[ 179, 4 ]
[ 183, 19 ]
python
en
['en', 'en', 'en']
True
RememberTheMilkConfiguration.set_token
(self, profile_name, token)
Store a new server token for a profile.
Store a new server token for a profile.
def set_token(self, profile_name, token): """Store a new server token for a profile.""" self._initialize_profile(profile_name) self._config[profile_name][CONF_TOKEN] = token self.save_config()
[ "def", "set_token", "(", "self", ",", "profile_name", ",", "token", ")", ":", "self", ".", "_initialize_profile", "(", "profile_name", ")", "self", ".", "_config", "[", "profile_name", "]", "[", "CONF_TOKEN", "]", "=", "token", "self", ".", "save_config", ...
[ 185, 4 ]
[ 189, 26 ]
python
en
['en', 'en', 'en']
True
RememberTheMilkConfiguration.delete_token
(self, profile_name)
Delete a token for a profile. Usually called when the token has expired.
Delete a token for a profile.
def delete_token(self, profile_name): """Delete a token for a profile. Usually called when the token has expired. """ self._config.pop(profile_name, None) self.save_config()
[ "def", "delete_token", "(", "self", ",", "profile_name", ")", ":", "self", ".", "_config", ".", "pop", "(", "profile_name", ",", "None", ")", "self", ".", "save_config", "(", ")" ]
[ 191, 4 ]
[ 197, 26 ]
python
en
['en', 'it', 'en']
True
RememberTheMilkConfiguration._initialize_profile
(self, profile_name)
Initialize the data structures for a profile.
Initialize the data structures for a profile.
def _initialize_profile(self, profile_name): """Initialize the data structures for a profile.""" if profile_name not in self._config: self._config[profile_name] = {} if CONF_ID_MAP not in self._config[profile_name]: self._config[profile_name][CONF_ID_MAP] = {}
[ "def", "_initialize_profile", "(", "self", ",", "profile_name", ")", ":", "if", "profile_name", "not", "in", "self", ".", "_config", ":", "self", ".", "_config", "[", "profile_name", "]", "=", "{", "}", "if", "CONF_ID_MAP", "not", "in", "self", ".", "_co...
[ 199, 4 ]
[ 204, 56 ]
python
en
['en', 'en', 'en']
True
RememberTheMilkConfiguration.get_rtm_id
(self, profile_name, hass_id)
Get the RTM ids for a Home Assistant task ID. The id of a RTM tasks consists of the tuple: list id, timeseries id and the task id.
Get the RTM ids for a Home Assistant task ID.
def get_rtm_id(self, profile_name, hass_id): """Get the RTM ids for a Home Assistant task ID. The id of a RTM tasks consists of the tuple: list id, timeseries id and the task id. """ self._initialize_profile(profile_name) ids = self._config[profile_name][CONF_ID_MAP].get...
[ "def", "get_rtm_id", "(", "self", ",", "profile_name", ",", "hass_id", ")", ":", "self", ".", "_initialize_profile", "(", "profile_name", ")", "ids", "=", "self", ".", "_config", "[", "profile_name", "]", "[", "CONF_ID_MAP", "]", ".", "get", "(", "hass_id"...
[ 206, 4 ]
[ 216, 76 ]
python
en
['en', 'en', 'en']
True
RememberTheMilkConfiguration.set_rtm_id
(self, profile_name, hass_id, list_id, time_series_id, rtm_task_id)
Add/Update the RTM task ID for a Home Assistant task IS.
Add/Update the RTM task ID for a Home Assistant task IS.
def set_rtm_id(self, profile_name, hass_id, list_id, time_series_id, rtm_task_id): """Add/Update the RTM task ID for a Home Assistant task IS.""" self._initialize_profile(profile_name) id_tuple = { CONF_LIST_ID: list_id, CONF_TIMESERIES_ID: time_series_id, CON...
[ "def", "set_rtm_id", "(", "self", ",", "profile_name", ",", "hass_id", ",", "list_id", ",", "time_series_id", ",", "rtm_task_id", ")", ":", "self", ".", "_initialize_profile", "(", "profile_name", ")", "id_tuple", "=", "{", "CONF_LIST_ID", ":", "list_id", ",",...
[ 218, 4 ]
[ 227, 26 ]
python
en
['en', 'en', 'en']
True
RememberTheMilkConfiguration.delete_rtm_id
(self, profile_name, hass_id)
Delete a key mapping.
Delete a key mapping.
def delete_rtm_id(self, profile_name, hass_id): """Delete a key mapping.""" self._initialize_profile(profile_name) if hass_id in self._config[profile_name][CONF_ID_MAP]: del self._config[profile_name][CONF_ID_MAP][hass_id] self.save_config()
[ "def", "delete_rtm_id", "(", "self", ",", "profile_name", ",", "hass_id", ")", ":", "self", ".", "_initialize_profile", "(", "profile_name", ")", "if", "hass_id", "in", "self", ".", "_config", "[", "profile_name", "]", "[", "CONF_ID_MAP", "]", ":", "del", ...
[ 229, 4 ]
[ 234, 30 ]
python
en
['hu', 'en', 'en']
True
RememberTheMilk.__init__
(self, name, api_key, shared_secret, token, rtm_config)
Create new instance of Remember The Milk component.
Create new instance of Remember The Milk component.
def __init__(self, name, api_key, shared_secret, token, rtm_config): """Create new instance of Remember The Milk component.""" self._name = name self._api_key = api_key self._shared_secret = shared_secret self._token = token self._rtm_config = rtm_config self._rtm...
[ "def", "__init__", "(", "self", ",", "name", ",", "api_key", ",", "shared_secret", ",", "token", ",", "rtm_config", ")", ":", "self", ".", "_name", "=", "name", "self", ".", "_api_key", "=", "api_key", "self", ".", "_shared_secret", "=", "shared_secret", ...
[ 240, 4 ]
[ 250, 68 ]
python
en
['en', 'en', 'en']
True
RememberTheMilk._check_token
(self)
Check if the API token is still valid. If it is not valid any more, delete it from the configuration. This will trigger a new authentication process.
Check if the API token is still valid.
def _check_token(self): """Check if the API token is still valid. If it is not valid any more, delete it from the configuration. This will trigger a new authentication process. """ valid = self._rtm_api.token_valid() if not valid: _LOGGER.error( ...
[ "def", "_check_token", "(", "self", ")", ":", "valid", "=", "self", ".", "_rtm_api", ".", "token_valid", "(", ")", "if", "not", "valid", ":", "_LOGGER", ".", "error", "(", "\"Token for account %s is invalid. You need to register again!\"", ",", "self", ".", "nam...
[ 252, 4 ]
[ 268, 32 ]
python
en
['en', 'en', 'en']
True
RememberTheMilk.create_task
(self, call)
Create a new task on Remember The Milk. You can use the smart syntax to define the attributes of a new task, e.g. "my task #some_tag ^today" will add tag "some_tag" and set the due date to today.
Create a new task on Remember The Milk.
def create_task(self, call): """Create a new task on Remember The Milk. You can use the smart syntax to define the attributes of a new task, e.g. "my task #some_tag ^today" will add tag "some_tag" and set the due date to today. """ try: task_name = call.data....
[ "def", "create_task", "(", "self", ",", "call", ")", ":", "try", ":", "task_name", "=", "call", ".", "data", ".", "get", "(", "CONF_NAME", ")", "hass_id", "=", "call", ".", "data", ".", "get", "(", "CONF_ID", ")", "rtm_id", "=", "None", "if", "hass...
[ 270, 4 ]
[ 321, 19 ]
python
en
['en', 'en', 'en']
True
RememberTheMilk.complete_task
(self, call)
Complete a task that was previously created by this component.
Complete a task that was previously created by this component.
def complete_task(self, call): """Complete a task that was previously created by this component.""" hass_id = call.data.get(CONF_ID) rtm_id = self._rtm_config.get_rtm_id(self._name, hass_id) if rtm_id is None: _LOGGER.error( "Could not find task with ID %s in ...
[ "def", "complete_task", "(", "self", ",", "call", ")", ":", "hass_id", "=", "call", ".", "data", ".", "get", "(", "CONF_ID", ")", "rtm_id", "=", "self", ".", "_rtm_config", ".", "get_rtm_id", "(", "self", ".", "_name", ",", "hass_id", ")", "if", "rtm...
[ 323, 4 ]
[ 354, 19 ]
python
en
['en', 'en', 'en']
True
RememberTheMilk.name
(self)
Return the name of the device.
Return the name of the device.
def name(self): """Return the name of the device.""" return self._name
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "_name" ]
[ 357, 4 ]
[ 359, 25 ]
python
en
['en', 'en', 'en']
True
RememberTheMilk.state
(self)
Return the state of the device.
Return the state of the device.
def state(self): """Return the state of the device.""" if not self._token_valid: return "API token invalid" return STATE_OK
[ "def", "state", "(", "self", ")", ":", "if", "not", "self", ".", "_token_valid", ":", "return", "\"API token invalid\"", "return", "STATE_OK" ]
[ 362, 4 ]
[ 366, 23 ]
python
en
['en', 'en', 'en']
True
setup_platform
(hass, config, add_entities, discovery_info=None)
Set up the Google Wifi sensor.
Set up the Google Wifi sensor.
def setup_platform(hass, config, add_entities, discovery_info=None): """Set up the Google Wifi sensor.""" name = config.get(CONF_NAME) host = config.get(CONF_HOST) conditions = config.get(CONF_MONITORED_CONDITIONS) api = GoogleWifiAPI(host, conditions) dev = [] for condition in conditions: ...
[ "def", "setup_platform", "(", "hass", ",", "config", ",", "add_entities", ",", "discovery_info", "=", "None", ")", ":", "name", "=", "config", ".", "get", "(", "CONF_NAME", ")", "host", "=", "config", ".", "get", "(", "CONF_HOST", ")", "conditions", "=",...
[ 59, 0 ]
[ 70, 27 ]
python
en
['en', 'haw', 'en']
True
GoogleWifiSensor.__init__
(self, api, name, variable)
Initialize a Google Wifi sensor.
Initialize a Google Wifi sensor.
def __init__(self, api, name, variable): """Initialize a Google Wifi sensor.""" self._api = api self._name = name self._state = None variable_info = MONITORED_CONDITIONS[variable] self._var_name = variable self._var_units = variable_info[1] self._var_icon...
[ "def", "__init__", "(", "self", ",", "api", ",", "name", ",", "variable", ")", ":", "self", ".", "_api", "=", "api", "self", ".", "_name", "=", "name", "self", ".", "_state", "=", "None", "variable_info", "=", "MONITORED_CONDITIONS", "[", "variable", "...
[ 76, 4 ]
[ 85, 41 ]
python
ro
['ro', 'ro', 'it']
True
GoogleWifiSensor.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}_{self._var_name}"
[ "def", "name", "(", "self", ")", ":", "return", "f\"{self._name}_{self._var_name}\"" ]
[ 88, 4 ]
[ 90, 47 ]
python
en
['en', 'mi', 'en']
True
GoogleWifiSensor.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 self._var_icon
[ "def", "icon", "(", "self", ")", ":", "return", "self", ".", "_var_icon" ]
[ 93, 4 ]
[ 95, 29 ]
python
en
['en', 'en', 'en']
True
GoogleWifiSensor.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 self._var_units
[ "def", "unit_of_measurement", "(", "self", ")", ":", "return", "self", ".", "_var_units" ]
[ 98, 4 ]
[ 100, 30 ]
python
en
['en', 'en', 'en']
True
GoogleWifiSensor.available
(self)
Return availability of Google Wifi API.
Return availability of Google Wifi API.
def available(self): """Return availability of Google Wifi API.""" return self._api.available
[ "def", "available", "(", "self", ")", ":", "return", "self", ".", "_api", ".", "available" ]
[ 103, 4 ]
[ 105, 34 ]
python
en
['en', 'sm', 'en']
True
GoogleWifiSensor.state
(self)
Return the state of the device.
Return the state of the device.
def state(self): """Return the state of the device.""" return self._state
[ "def", "state", "(", "self", ")", ":", "return", "self", ".", "_state" ]
[ 108, 4 ]
[ 110, 26 ]
python
en
['en', 'en', 'en']
True
GoogleWifiSensor.update
(self)
Get the latest data from the Google Wifi API.
Get the latest data from the Google Wifi API.
def update(self): """Get the latest data from the Google Wifi API.""" self._api.update() if self.available: self._state = self._api.data[self._var_name] else: self._state = None
[ "def", "update", "(", "self", ")", ":", "self", ".", "_api", ".", "update", "(", ")", "if", "self", ".", "available", ":", "self", ".", "_state", "=", "self", ".", "_api", ".", "data", "[", "self", ".", "_var_name", "]", "else", ":", "self", ".",...
[ 112, 4 ]
[ 118, 30 ]
python
en
['en', 'en', 'en']
True
GoogleWifiAPI.__init__
(self, host, conditions)
Initialize the data object.
Initialize the data object.
def __init__(self, host, conditions): """Initialize the data object.""" uri = "http://" resource = f"{uri}{host}{ENDPOINT}" self._request = requests.Request("GET", resource).prepare() self.raw_data = None self.conditions = conditions self.data = { ATTR...
[ "def", "__init__", "(", "self", ",", "host", ",", "conditions", ")", ":", "uri", "=", "\"http://\"", "resource", "=", "f\"{uri}{host}{ENDPOINT}\"", "self", ".", "_request", "=", "requests", ".", "Request", "(", "\"GET\"", ",", "resource", ")", ".", "prepare"...
[ 124, 4 ]
[ 140, 21 ]
python
en
['en', 'en', 'en']
True
GoogleWifiAPI.update
(self)
Get the latest data from the router.
Get the latest data from the router.
def update(self): """Get the latest data from the router.""" try: with requests.Session() as sess: response = sess.send(self._request, timeout=10) self.raw_data = response.json() self.data_format() self.available = True except (Valu...
[ "def", "update", "(", "self", ")", ":", "try", ":", "with", "requests", ".", "Session", "(", ")", "as", "sess", ":", "response", "=", "sess", ".", "send", "(", "self", ".", "_request", ",", "timeout", "=", "10", ")", "self", ".", "raw_data", "=", ...
[ 143, 4 ]
[ 154, 32 ]
python
en
['en', 'en', 'en']
True
GoogleWifiAPI.data_format
(self)
Format raw data into easily accessible dict.
Format raw data into easily accessible dict.
def data_format(self): """Format raw data into easily accessible dict.""" for attr_key in self.conditions: value = MONITORED_CONDITIONS[attr_key] try: primary_key = value[0][0] sensor_key = value[0][1] if primary_key in self.raw_dat...
[ "def", "data_format", "(", "self", ")", ":", "for", "attr_key", "in", "self", ".", "conditions", ":", "value", "=", "MONITORED_CONDITIONS", "[", "attr_key", "]", "try", ":", "primary_key", "=", "value", "[", "0", "]", "[", "0", "]", "sensor_key", "=", ...
[ 156, 4 ]
[ 190, 51 ]
python
en
['en', 'en', 'en']
True
OpenUvFlowHandler._show_form
(self, errors=None)
Show the form to the user.
Show the form to the user.
async def _show_form(self, errors=None): """Show the form to the user.""" return self.async_show_form( step_id="user", data_schema=CONFIG_SCHEMA, errors=errors if errors else {}, )
[ "async", "def", "_show_form", "(", "self", ",", "errors", "=", "None", ")", ":", "return", "self", ".", "async_show_form", "(", "step_id", "=", "\"user\"", ",", "data_schema", "=", "CONFIG_SCHEMA", ",", "errors", "=", "errors", "if", "errors", "else", "{",...
[ 32, 4 ]
[ 38, 9 ]
python
en
['en', 'en', 'en']
True
OpenUvFlowHandler.async_step_import
(self, import_config)
Import a config entry from configuration.yaml.
Import a config entry from configuration.yaml.
async def async_step_import(self, import_config): """Import a config entry from configuration.yaml.""" return await self.async_step_user(import_config)
[ "async", "def", "async_step_import", "(", "self", ",", "import_config", ")", ":", "return", "await", "self", ".", "async_step_user", "(", "import_config", ")" ]
[ 40, 4 ]
[ 42, 56 ]
python
en
['en', 'en', 'en']
True
OpenUvFlowHandler.async_step_user
(self, user_input=None)
Handle the start of the config flow.
Handle the start of the config flow.
async def async_step_user(self, user_input=None): """Handle the start of the config flow.""" if not user_input: return await self._show_form() if user_input.get(CONF_LATITUDE): identifier = f"{user_input[CONF_LATITUDE]}, {user_input[CONF_LONGITUDE]}" else: ...
[ "async", "def", "async_step_user", "(", "self", ",", "user_input", "=", "None", ")", ":", "if", "not", "user_input", ":", "return", "await", "self", ".", "_show_form", "(", ")", "if", "user_input", ".", "get", "(", "CONF_LATITUDE", ")", ":", "identifier", ...
[ 44, 4 ]
[ 65, 73 ]
python
en
['en', 'en', 'en']
True
CnnGenerator.generate
(self, model_len=None, model_width=None)
Generates a CNN. Args: model_len: An integer. Number of convolutional layers. model_width: An integer. Number of filters for the convolutional layers. Returns: An instance of the class Graph. Represents the neural architecture graph of the generated model.
Generates a CNN. Args: model_len: An integer. Number of convolutional layers. model_width: An integer. Number of filters for the convolutional layers. Returns: An instance of the class Graph. Represents the neural architecture graph of the generated model.
def generate(self, model_len=None, model_width=None): """Generates a CNN. Args: model_len: An integer. Number of convolutional layers. model_width: An integer. Number of filters for the convolutional layers. Returns: An instance of the class Graph. Represents ...
[ "def", "generate", "(", "self", ",", "model_len", "=", "None", ",", "model_width", "=", "None", ")", ":", "if", "model_len", "is", "None", ":", "model_len", "=", "Constant", ".", "MODEL_LEN", "if", "model_width", "is", "None", ":", "model_width", "=", "C...
[ 56, 4 ]
[ 109, 20 ]
python
ca
['en', 'ca', 'it']
False
MlpGenerator.__init__
(self, n_output_node, input_shape)
Initialize the instance. Args: n_output_node: An integer. Number of output nodes in the network. input_shape: A tuple. Input shape of the network. If it is 1D, ensure the value is appended by a comma in the tuple.
Initialize the instance. Args: n_output_node: An integer. Number of output nodes in the network. input_shape: A tuple. Input shape of the network. If it is 1D, ensure the value is appended by a comma in the tuple.
def __init__(self, n_output_node, input_shape): """Initialize the instance. Args: n_output_node: An integer. Number of output nodes in the network. input_shape: A tuple. Input shape of the network. If it is 1D, ensure the value is appended by a comma in the tuple....
[ "def", "__init__", "(", "self", ",", "n_output_node", ",", "input_shape", ")", ":", "super", "(", "MlpGenerator", ",", "self", ")", ".", "__init__", "(", "n_output_node", ",", "input_shape", ")", "if", "len", "(", "self", ".", "input_shape", ")", ">", "1...
[ 116, 4 ]
[ 125, 64 ]
python
en
['en', 'en', 'en']
True
MlpGenerator.generate
(self, model_len=None, model_width=None)
Generates a Multi-Layer Perceptron. Args: model_len: An integer. Number of hidden layers. model_width: An integer or a list of integers of length `model_len`. If it is a list, it represents the number of nodes in each hidden layer. If it is an integer, all hidden layers h...
Generates a Multi-Layer Perceptron. Args: model_len: An integer. Number of hidden layers. model_width: An integer or a list of integers of length `model_len`. If it is a list, it represents the number of nodes in each hidden layer. If it is an integer, all hidden layers h...
def generate(self, model_len=None, model_width=None): """Generates a Multi-Layer Perceptron. Args: model_len: An integer. Number of hidden layers. model_width: An integer or a list of integers of length `model_len`. If it is a list, it represents the number of nod...
[ "def", "generate", "(", "self", ",", "model_len", "=", "None", ",", "model_width", "=", "None", ")", ":", "if", "model_len", "is", "None", ":", "model_len", "=", "Constant", ".", "MODEL_LEN", "if", "model_width", "is", "None", ":", "model_width", "=", "C...
[ 127, 4 ]
[ 165, 20 ]
python
it
['en', 'it', 'it']
True
test_fail_setup_if_no_command_topic
(hass, mqtt_mock)
Test if command fails with command topic.
Test if command fails with command topic.
async def test_fail_setup_if_no_command_topic(hass, mqtt_mock): """Test if command fails with command topic.""" assert await async_setup_component( hass, light.DOMAIN, {light.DOMAIN: {"platform": "mqtt", "name": "test"}} ) await hass.async_block_till_done() assert hass.states.get("light.test...
[ "async", "def", "test_fail_setup_if_no_command_topic", "(", "hass", ",", "mqtt_mock", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "light", ".", "DOMAIN", ",", "{", "light", ".", "DOMAIN", ":", "{", "\"platform\"", ":", "\"mqtt\"", "...
[ 199, 0 ]
[ 205, 48 ]
python
en
['en', 'en', 'en']
True
test_no_color_brightness_color_temp_hs_white_xy_if_no_topics
(hass, mqtt_mock)
Test if there is no color and brightness if no topic.
Test if there is no color and brightness if no topic.
async def test_no_color_brightness_color_temp_hs_white_xy_if_no_topics(hass, mqtt_mock): """Test if there is no color and brightness if no topic.""" assert await async_setup_component( hass, light.DOMAIN, { light.DOMAIN: { "platform": "mqtt", "...
[ "async", "def", "test_no_color_brightness_color_temp_hs_white_xy_if_no_topics", "(", "hass", ",", "mqtt_mock", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "light", ".", "DOMAIN", ",", "{", "light", ".", "DOMAIN", ":", "{", "\"platform\"",...
[ 208, 0 ]
[ 242, 51 ]
python
en
['en', 'en', 'en']
True
test_controlling_state_via_topic
(hass, mqtt_mock)
Test the controlling of the state via topic.
Test the controlling of the state via topic.
async def test_controlling_state_via_topic(hass, mqtt_mock): """Test the controlling of the state via topic.""" config = { light.DOMAIN: { "platform": "mqtt", "name": "test", "state_topic": "test_light_rgb/status", "command_topic": "test_light_rgb/set", ...
[ "async", "def", "test_controlling_state_via_topic", "(", "hass", ",", "mqtt_mock", ")", ":", "config", "=", "{", "light", ".", "DOMAIN", ":", "{", "\"platform\"", ":", "\"mqtt\"", ",", "\"name\"", ":", "\"test\"", ",", "\"state_topic\"", ":", "\"test_light_rgb/s...
[ 245, 0 ]
[ 344, 67 ]
python
en
['en', 'en', 'en']
True
test_invalid_state_via_topic
(hass, mqtt_mock, caplog)
Test handling of empty data via topic.
Test handling of empty data via topic.
async def test_invalid_state_via_topic(hass, mqtt_mock, caplog): """Test handling of empty data via topic.""" config = { light.DOMAIN: { "platform": "mqtt", "name": "test", "state_topic": "test_light_rgb/status", "command_topic": "test_light_rgb/set", ...
[ "async", "def", "test_invalid_state_via_topic", "(", "hass", ",", "mqtt_mock", ",", "caplog", ")", ":", "config", "=", "{", "light", ".", "DOMAIN", ":", "{", "\"platform\"", ":", "\"mqtt\"", ",", "\"name\"", ":", "\"test\"", ",", "\"state_topic\"", ":", "\"t...
[ 347, 0 ]
[ 460, 55 ]
python
en
['en', 'en', 'en']
True
test_brightness_controlling_scale
(hass, mqtt_mock)
Test the brightness controlling scale.
Test the brightness controlling scale.
async def test_brightness_controlling_scale(hass, mqtt_mock): """Test the brightness controlling scale.""" with assert_setup_component(1, light.DOMAIN): assert await async_setup_component( hass, light.DOMAIN, { light.DOMAIN: { "plat...
[ "async", "def", "test_brightness_controlling_scale", "(", "hass", ",", "mqtt_mock", ")", ":", "with", "assert_setup_component", "(", "1", ",", "light", ".", "DOMAIN", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "light", ".", "DOMAIN",...
[ 463, 0 ]
[ 507, 54 ]
python
en
['en', 'en', 'en']
True
test_brightness_from_rgb_controlling_scale
(hass, mqtt_mock)
Test the brightness controlling scale.
Test the brightness controlling scale.
async def test_brightness_from_rgb_controlling_scale(hass, mqtt_mock): """Test the brightness controlling scale.""" with assert_setup_component(1, light.DOMAIN): assert await async_setup_component( hass, light.DOMAIN, { light.DOMAIN: { ...
[ "async", "def", "test_brightness_from_rgb_controlling_scale", "(", "hass", ",", "mqtt_mock", ")", ":", "with", "assert_setup_component", "(", "1", ",", "light", ".", "DOMAIN", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "light", ".", ...
[ 510, 0 ]
[ 546, 52 ]
python
en
['en', 'en', 'en']
True
test_white_value_controlling_scale
(hass, mqtt_mock)
Test the white_value controlling scale.
Test the white_value controlling scale.
async def test_white_value_controlling_scale(hass, mqtt_mock): """Test the white_value controlling scale.""" with assert_setup_component(1, light.DOMAIN): assert await async_setup_component( hass, light.DOMAIN, { light.DOMAIN: { "pl...
[ "async", "def", "test_white_value_controlling_scale", "(", "hass", ",", "mqtt_mock", ")", ":", "with", "assert_setup_component", "(", "1", ",", "light", ".", "DOMAIN", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "light", ".", "DOMAIN"...
[ 549, 0 ]
[ 593, 55 ]
python
en
['en', 'en', 'en']
True
test_controlling_state_via_topic_with_templates
(hass, mqtt_mock)
Test the setting of the state with a template.
Test the setting of the state with a template.
async def test_controlling_state_via_topic_with_templates(hass, mqtt_mock): """Test the setting of the state with a template.""" config = { light.DOMAIN: { "platform": "mqtt", "name": "test", "state_topic": "test_light_rgb/status", "command_topic": "test_l...
[ "async", "def", "test_controlling_state_via_topic_with_templates", "(", "hass", ",", "mqtt_mock", ")", ":", "config", "=", "{", "light", ".", "DOMAIN", ":", "{", "\"platform\"", ":", "\"mqtt\"", ",", "\"name\"", ":", "\"test\"", ",", "\"state_topic\"", ":", "\"t...
[ 596, 0 ]
[ 678, 60 ]
python
en
['en', 'en', 'en']
True