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
WUHourlyForecastSensorConfig.__init__
(self, period: int, field: int)
Initialize hourly forecast sensor configuration. :param period: forecast period number :param field: field name to use as value
Initialize hourly forecast sensor configuration.
def __init__(self, period: int, field: int): """Initialize hourly forecast sensor configuration. :param period: forecast period number :param field: field name to use as value """ super().__init__( friendly_name=lambda wu: ( f"{wu.data['hourly_forecas...
[ "def", "__init__", "(", "self", ",", "period", ":", "int", ",", "field", ":", "int", ")", ":", "super", "(", ")", ".", "__init__", "(", "friendly_name", "=", "lambda", "wu", ":", "(", "f\"{wu.data['hourly_forecast'][period]['FCTTIME']['weekday_name_abbrev']} \"", ...
[ 215, 4 ]
[ 267, 9 ]
python
en
['en', 'pt', 'en']
True
WUAlmanacSensorConfig.__init__
( self, friendly_name: Union[str, Callable], field: str, value_type: str, wu_unit: str, unit_of_measurement: str, icon: str, device_class=None, )
Initialize almanac sensor configuration. :param friendly_name: Friendly name :param field: value name returned in 'almanac' dict as returned by the WU API :param value_type: "record" or "normal" :param wu_unit: unit name in WU API :param unit_of_measurement: unit of measurement ...
Initialize almanac sensor configuration.
def __init__( self, friendly_name: Union[str, Callable], field: str, value_type: str, wu_unit: str, unit_of_measurement: str, icon: str, device_class=None, ): """Initialize almanac sensor configuration. :param friendly_name: Friendly n...
[ "def", "__init__", "(", "self", ",", "friendly_name", ":", "Union", "[", "str", ",", "Callable", "]", ",", "field", ":", "str", ",", "value_type", ":", "str", ",", "wu_unit", ":", "str", ",", "unit_of_measurement", ":", "str", ",", "icon", ":", "str", ...
[ 273, 4 ]
[ 299, 9 ]
python
en
['tr', 'ro', 'en']
False
WUAlertsSensorConfig.__init__
(self, friendly_name: Union[str, Callable])
Initialiize alerts sensor configuration. :param friendly_name: Friendly name
Initialiize alerts sensor configuration.
def __init__(self, friendly_name: Union[str, Callable]): """Initialiize alerts sensor configuration. :param friendly_name: Friendly name """ super().__init__( friendly_name=friendly_name, feature="alerts", value=lambda wu: len(wu.data["alerts"]), ...
[ "def", "__init__", "(", "self", ",", "friendly_name", ":", "Union", "[", "str", ",", "Callable", "]", ")", ":", "super", "(", ")", ".", "__init__", "(", "friendly_name", "=", "friendly_name", ",", "feature", "=", "\"alerts\"", ",", "value", "=", "lambda"...
[ 305, 4 ]
[ 318, 9 ]
python
en
['en', 'eu', 'en']
True
WUndergroundSensor.__init__
(self, hass: HomeAssistantType, rest, condition, unique_id_base: str)
Initialize the sensor.
Initialize the sensor.
def __init__(self, hass: HomeAssistantType, rest, condition, unique_id_base: str): """Initialize the sensor.""" self.rest = rest self._condition = condition self._state = None self._attributes = {ATTR_ATTRIBUTION: ATTRIBUTION} self._icon = None self._entity_pictur...
[ "def", "__init__", "(", "self", ",", "hass", ":", "HomeAssistantType", ",", "rest", ",", "condition", ",", "unique_id_base", ":", "str", ")", ":", "self", ".", "rest", "=", "rest", "self", ".", "_condition", "=", "condition", "self", ".", "_state", "=", ...
[ 1122, 4 ]
[ 1136, 61 ]
python
en
['en', 'en', 'en']
True
WUndergroundSensor._cfg_expand
(self, what, default=None)
Parse and return sensor data.
Parse and return sensor data.
def _cfg_expand(self, what, default=None): """Parse and return sensor data.""" cfg = SENSOR_TYPES[self._condition] val = getattr(cfg, what) if not callable(val): return val try: val = val(self.rest) except (KeyError, IndexError, TypeError, ValueErr...
[ "def", "_cfg_expand", "(", "self", ",", "what", ",", "default", "=", "None", ")", ":", "cfg", "=", "SENSOR_TYPES", "[", "self", ".", "_condition", "]", "val", "=", "getattr", "(", "cfg", ",", "what", ")", "if", "not", "callable", "(", "val", ")", "...
[ 1138, 4 ]
[ 1155, 18 ]
python
en
['en', 'id', 'en']
True
WUndergroundSensor._update_attrs
(self)
Parse and update device state attributes.
Parse and update device state attributes.
def _update_attrs(self): """Parse and update device state attributes.""" attrs = self._cfg_expand("device_state_attributes", {}) for (attr, callback) in attrs.items(): if callable(callback): try: self._attributes[attr] = callback(self.rest) ...
[ "def", "_update_attrs", "(", "self", ")", ":", "attrs", "=", "self", ".", "_cfg_expand", "(", "\"device_state_attributes\"", ",", "{", "}", ")", "for", "(", "attr", ",", "callback", ")", "in", "attrs", ".", "items", "(", ")", ":", "if", "callable", "("...
[ 1157, 4 ]
[ 1174, 49 ]
python
en
['en', 'en', 'en']
True
WUndergroundSensor.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._cfg_expand("friendly_name")
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "_cfg_expand", "(", "\"friendly_name\"", ")" ]
[ 1177, 4 ]
[ 1179, 48 ]
python
en
['en', 'mi', 'en']
True
WUndergroundSensor.state
(self)
Return the state of the sensor.
Return the state of the sensor.
def state(self): """Return the state of the sensor.""" return self._state
[ "def", "state", "(", "self", ")", ":", "return", "self", ".", "_state" ]
[ 1182, 4 ]
[ 1184, 26 ]
python
en
['en', 'en', 'en']
True
WUndergroundSensor.device_state_attributes
(self)
Return the state attributes.
Return the state attributes.
def device_state_attributes(self): """Return the state attributes.""" return self._attributes
[ "def", "device_state_attributes", "(", "self", ")", ":", "return", "self", ".", "_attributes" ]
[ 1187, 4 ]
[ 1189, 31 ]
python
en
['en', 'en', 'en']
True
WUndergroundSensor.icon
(self)
Return icon.
Return icon.
def icon(self): """Return icon.""" return self._icon
[ "def", "icon", "(", "self", ")", ":", "return", "self", ".", "_icon" ]
[ 1192, 4 ]
[ 1194, 25 ]
python
en
['en', 'la', 'en']
False
WUndergroundSensor.entity_picture
(self)
Return the entity picture.
Return the entity picture.
def entity_picture(self): """Return the entity picture.""" return self._entity_picture
[ "def", "entity_picture", "(", "self", ")", ":", "return", "self", ".", "_entity_picture" ]
[ 1197, 4 ]
[ 1199, 35 ]
python
en
['en', 'en', 'en']
True
WUndergroundSensor.unit_of_measurement
(self)
Return the units of measurement.
Return the units of measurement.
def unit_of_measurement(self): """Return the units of measurement.""" return self._unit_of_measurement
[ "def", "unit_of_measurement", "(", "self", ")", ":", "return", "self", ".", "_unit_of_measurement" ]
[ 1202, 4 ]
[ 1204, 40 ]
python
en
['en', 'bg', 'en']
True
WUndergroundSensor.device_class
(self)
Return the units of measurement.
Return the units of measurement.
def device_class(self): """Return the units of measurement.""" return self._device_class
[ "def", "device_class", "(", "self", ")", ":", "return", "self", ".", "_device_class" ]
[ 1207, 4 ]
[ 1209, 33 ]
python
en
['en', 'bg', 'en']
True
WUndergroundSensor.async_update
(self)
Update current conditions.
Update current conditions.
async def async_update(self): """Update current conditions.""" await self.rest.async_update() if not self.rest.data: # no data, return return self._state = self._cfg_expand("value") self._update_attrs() self._icon = self._cfg_expand("icon", super...
[ "async", "def", "async_update", "(", "self", ")", ":", "await", "self", ".", "rest", ".", "async_update", "(", ")", "if", "not", "self", ".", "rest", ".", "data", ":", "# no data, return", "return", "self", ".", "_state", "=", "self", ".", "_cfg_expand",...
[ 1211, 4 ]
[ 1226, 13 ]
python
en
['en', 'en', 'en']
True
WUndergroundSensor.unique_id
(self)
Return a unique ID.
Return a unique ID.
def unique_id(self) -> str: """Return a unique ID.""" return self._unique_id
[ "def", "unique_id", "(", "self", ")", "->", "str", ":", "return", "self", ".", "_unique_id" ]
[ 1229, 4 ]
[ 1231, 30 ]
python
ca
['fr', 'ca', 'en']
False
WUndergroundData.__init__
(self, hass, api_key, pws_id, lang, latitude, longitude)
Initialize the data object.
Initialize the data object.
def __init__(self, hass, api_key, pws_id, lang, latitude, longitude): """Initialize the data object.""" self._hass = hass self._api_key = api_key self._pws_id = pws_id self._lang = f"lang:{lang}" self._latitude = latitude self._longitude = longitude self._...
[ "def", "__init__", "(", "self", ",", "hass", ",", "api_key", ",", "pws_id", ",", "lang", ",", "latitude", ",", "longitude", ")", ":", "self", ".", "_hass", "=", "hass", "self", ".", "_api_key", "=", "api_key", "self", ".", "_pws_id", "=", "pws_id", "...
[ 1237, 4 ]
[ 1247, 59 ]
python
en
['en', 'en', 'en']
True
WUndergroundData.request_feature
(self, feature)
Register feature to be fetched from WU API.
Register feature to be fetched from WU API.
def request_feature(self, feature): """Register feature to be fetched from WU API.""" self._features.add(feature)
[ "def", "request_feature", "(", "self", ",", "feature", ")", ":", "self", ".", "_features", ".", "add", "(", "feature", ")" ]
[ 1249, 4 ]
[ 1251, 35 ]
python
en
['en', 'en', 'en']
True
WUndergroundData.async_update
(self)
Get the latest data from WUnderground.
Get the latest data from WUnderground.
async def async_update(self): """Get the latest data from WUnderground.""" try: with async_timeout.timeout(10): response = await self._session.get(self._build_url()) result = await response.json() if "error" in result["response"]: raise...
[ "async", "def", "async_update", "(", "self", ")", ":", "try", ":", "with", "async_timeout", ".", "timeout", "(", "10", ")", ":", "response", "=", "await", "self", ".", "_session", ".", "get", "(", "self", ".", "_build_url", "(", ")", ")", "result", "...
[ 1265, 4 ]
[ 1277, 76 ]
python
en
['en', 'en', 'en']
True
setup_integration
( hass: HomeAssistantType, )
Mock ConfigEntry in Home Assistant.
Mock ConfigEntry in Home Assistant.
async def setup_integration( hass: HomeAssistantType, ) -> MockConfigEntry: """Mock ConfigEntry in Home Assistant.""" entry = MockConfigEntry( domain=DOMAIN, unique_id=WILIGHT_ID, data={ CONF_HOST: HOST, CONF_SERIAL_NUMBER: UPNP_SERIAL, CONF_MODEL...
[ "async", "def", "setup_integration", "(", "hass", ":", "HomeAssistantType", ",", ")", "->", "MockConfigEntry", ":", "entry", "=", "MockConfigEntry", "(", "domain", "=", "DOMAIN", ",", "unique_id", "=", "WILIGHT_ID", ",", "data", "=", "{", "CONF_HOST", ":", "...
[ 64, 0 ]
[ 84, 16 ]
python
en
['en', 'en', 'en']
True
test_convert_same_unit
()
Test conversion from any unit to same unit.
Test conversion from any unit to same unit.
def test_convert_same_unit(): """Test conversion from any unit to same unit.""" assert distance_util.convert(5, LENGTH_KILOMETERS, LENGTH_KILOMETERS) == 5 assert distance_util.convert(2, LENGTH_METERS, LENGTH_METERS) == 2 assert distance_util.convert(6, LENGTH_CENTIMETERS, LENGTH_CENTIMETERS) == 6 a...
[ "def", "test_convert_same_unit", "(", ")", ":", "assert", "distance_util", ".", "convert", "(", "5", ",", "LENGTH_KILOMETERS", ",", "LENGTH_KILOMETERS", ")", "==", "5", "assert", "distance_util", ".", "convert", "(", "2", ",", "LENGTH_METERS", ",", "LENGTH_METER...
[ 20, 0 ]
[ 29, 70 ]
python
en
['en', 'en', 'en']
True
test_convert_invalid_unit
()
Test exception is thrown for invalid units.
Test exception is thrown for invalid units.
def test_convert_invalid_unit(): """Test exception is thrown for invalid units.""" with pytest.raises(ValueError): distance_util.convert(5, INVALID_SYMBOL, VALID_SYMBOL) with pytest.raises(ValueError): distance_util.convert(5, VALID_SYMBOL, INVALID_SYMBOL)
[ "def", "test_convert_invalid_unit", "(", ")", ":", "with", "pytest", ".", "raises", "(", "ValueError", ")", ":", "distance_util", ".", "convert", "(", "5", ",", "INVALID_SYMBOL", ",", "VALID_SYMBOL", ")", "with", "pytest", ".", "raises", "(", "ValueError", "...
[ 32, 0 ]
[ 38, 62 ]
python
en
['en', 'en', 'en']
True
test_convert_nonnumeric_value
()
Test exception is thrown for nonnumeric type.
Test exception is thrown for nonnumeric type.
def test_convert_nonnumeric_value(): """Test exception is thrown for nonnumeric type.""" with pytest.raises(TypeError): distance_util.convert("a", LENGTH_KILOMETERS, LENGTH_METERS)
[ "def", "test_convert_nonnumeric_value", "(", ")", ":", "with", "pytest", ".", "raises", "(", "TypeError", ")", ":", "distance_util", ".", "convert", "(", "\"a\"", ",", "LENGTH_KILOMETERS", ",", "LENGTH_METERS", ")" ]
[ 41, 0 ]
[ 44, 68 ]
python
en
['en', 'en', 'en']
True
test_convert_from_miles
()
Test conversion from miles to other units.
Test conversion from miles to other units.
def test_convert_from_miles(): """Test conversion from miles to other units.""" miles = 5 assert distance_util.convert(miles, LENGTH_MILES, LENGTH_KILOMETERS) == 8.04672 assert distance_util.convert(miles, LENGTH_MILES, LENGTH_METERS) == 8046.72 assert distance_util.convert(miles, LENGTH_MILES, LENG...
[ "def", "test_convert_from_miles", "(", ")", ":", "miles", "=", "5", "assert", "distance_util", ".", "convert", "(", "miles", ",", "LENGTH_MILES", ",", "LENGTH_KILOMETERS", ")", "==", "8.04672", "assert", "distance_util", ".", "convert", "(", "miles", ",", "LEN...
[ 47, 0 ]
[ 56, 85 ]
python
en
['en', 'en', 'en']
True
test_convert_from_yards
()
Test conversion from yards to other units.
Test conversion from yards to other units.
def test_convert_from_yards(): """Test conversion from yards to other units.""" yards = 5 assert ( distance_util.convert(yards, LENGTH_YARD, LENGTH_KILOMETERS) == 0.0045720000000000005 ) assert distance_util.convert(yards, LENGTH_YARD, LENGTH_METERS) == 4.572 assert distance_util...
[ "def", "test_convert_from_yards", "(", ")", ":", "yards", "=", "5", "assert", "(", "distance_util", ".", "convert", "(", "yards", ",", "LENGTH_YARD", ",", "LENGTH_KILOMETERS", ")", "==", "0.0045720000000000005", ")", "assert", "distance_util", ".", "convert", "(...
[ 59, 0 ]
[ 71, 82 ]
python
en
['en', 'en', 'en']
True
test_convert_from_feet
()
Test conversion from feet to other units.
Test conversion from feet to other units.
def test_convert_from_feet(): """Test conversion from feet to other units.""" feet = 5000 assert distance_util.convert(feet, LENGTH_FEET, LENGTH_KILOMETERS) == 1.524 assert distance_util.convert(feet, LENGTH_FEET, LENGTH_METERS) == 1524 assert distance_util.convert(feet, LENGTH_FEET, LENGTH_CENTIMET...
[ "def", "test_convert_from_feet", "(", ")", ":", "feet", "=", "5000", "assert", "distance_util", ".", "convert", "(", "feet", ",", "LENGTH_FEET", ",", "LENGTH_KILOMETERS", ")", "==", "1.524", "assert", "distance_util", ".", "convert", "(", "feet", ",", "LENGTH_...
[ 74, 0 ]
[ 83, 88 ]
python
en
['en', 'en', 'en']
True
test_convert_from_inches
()
Test conversion from inches to other units.
Test conversion from inches to other units.
def test_convert_from_inches(): """Test conversion from inches to other units.""" inches = 5000 assert distance_util.convert(inches, LENGTH_INCHES, LENGTH_KILOMETERS) == 0.127 assert distance_util.convert(inches, LENGTH_INCHES, LENGTH_METERS) == 127.0 assert distance_util.convert(inches, LENGTH_INCH...
[ "def", "test_convert_from_inches", "(", ")", ":", "inches", "=", "5000", "assert", "distance_util", ".", "convert", "(", "inches", ",", "LENGTH_INCHES", ",", "LENGTH_KILOMETERS", ")", "==", "0.127", "assert", "distance_util", ".", "convert", "(", "inches", ",", ...
[ 86, 0 ]
[ 97, 81 ]
python
en
['en', 'en', 'en']
True
test_convert_from_kilometers
()
Test conversion from kilometers to other units.
Test conversion from kilometers to other units.
def test_convert_from_kilometers(): """Test conversion from kilometers to other units.""" km = 5 assert distance_util.convert(km, LENGTH_KILOMETERS, LENGTH_METERS) == 5000 assert distance_util.convert(km, LENGTH_KILOMETERS, LENGTH_CENTIMETERS) == 500000 assert distance_util.convert(km, LENGTH_KILOME...
[ "def", "test_convert_from_kilometers", "(", ")", ":", "km", "=", "5", "assert", "distance_util", ".", "convert", "(", "km", ",", "LENGTH_KILOMETERS", ",", "LENGTH_METERS", ")", "==", "5000", "assert", "distance_util", ".", "convert", "(", "km", ",", "LENGTH_KI...
[ 100, 0 ]
[ 109, 82 ]
python
en
['en', 'en', 'en']
True
test_convert_from_meters
()
Test conversion from meters to other units.
Test conversion from meters to other units.
def test_convert_from_meters(): """Test conversion from meters to other units.""" m = 5000 assert distance_util.convert(m, LENGTH_METERS, LENGTH_KILOMETERS) == 5 assert distance_util.convert(m, LENGTH_METERS, LENGTH_CENTIMETERS) == 500000 assert distance_util.convert(m, LENGTH_METERS, LENGTH_MILLIME...
[ "def", "test_convert_from_meters", "(", ")", ":", "m", "=", "5000", "assert", "distance_util", ".", "convert", "(", "m", ",", "LENGTH_METERS", ",", "LENGTH_KILOMETERS", ")", "==", "5", "assert", "distance_util", ".", "convert", "(", "m", ",", "LENGTH_METERS", ...
[ 112, 0 ]
[ 121, 77 ]
python
en
['en', 'en', 'en']
True
test_convert_from_centimeters
()
Test conversion from centimeters to other units.
Test conversion from centimeters to other units.
def test_convert_from_centimeters(): """Test conversion from centimeters to other units.""" cm = 500000 assert distance_util.convert(cm, LENGTH_CENTIMETERS, LENGTH_KILOMETERS) == 5 assert distance_util.convert(cm, LENGTH_CENTIMETERS, LENGTH_METERS) == 5000 assert distance_util.convert(cm, LENGTH_CEN...
[ "def", "test_convert_from_centimeters", "(", ")", ":", "cm", "=", "500000", "assert", "distance_util", ".", "convert", "(", "cm", ",", "LENGTH_CENTIMETERS", ",", "LENGTH_KILOMETERS", ")", "==", "5", "assert", "distance_util", ".", "convert", "(", "cm", ",", "L...
[ 124, 0 ]
[ 133, 83 ]
python
en
['en', 'en', 'en']
True
test_convert_from_millimeters
()
Test conversion from millimeters to other units.
Test conversion from millimeters to other units.
def test_convert_from_millimeters(): """Test conversion from millimeters to other units.""" mm = 5000000 assert distance_util.convert(mm, LENGTH_MILLIMETERS, LENGTH_KILOMETERS) == 5 assert distance_util.convert(mm, LENGTH_MILLIMETERS, LENGTH_METERS) == 5000 assert distance_util.convert(mm, LENGTH_MI...
[ "def", "test_convert_from_millimeters", "(", ")", ":", "mm", "=", "5000000", "assert", "distance_util", ".", "convert", "(", "mm", ",", "LENGTH_MILLIMETERS", ",", "LENGTH_KILOMETERS", ")", "==", "5", "assert", "distance_util", ".", "convert", "(", "mm", ",", "...
[ 136, 0 ]
[ 145, 83 ]
python
en
['en', 'en', 'en']
True
AzureDevOpsFlowHandler.__init__
(self)
Initialize config flow.
Initialize config flow.
def __init__(self): """Initialize config flow.""" self._organization = None self._project = None self._pat = None
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "_organization", "=", "None", "self", ".", "_project", "=", "None", "self", ".", "_pat", "=", "None" ]
[ 21, 4 ]
[ 25, 24 ]
python
en
['de', 'en', 'en']
True
AzureDevOpsFlowHandler._show_setup_form
(self, errors=None)
Show the setup form to the user.
Show the setup form to the user.
async def _show_setup_form(self, errors=None): """Show the setup form to the user.""" return self.async_show_form( step_id="user", data_schema=vol.Schema( { vol.Required(CONF_ORG, default=self._organization): str, vol.Requir...
[ "async", "def", "_show_setup_form", "(", "self", ",", "errors", "=", "None", ")", ":", "return", "self", ".", "async_show_form", "(", "step_id", "=", "\"user\"", ",", "data_schema", "=", "vol", ".", "Schema", "(", "{", "vol", ".", "Required", "(", "CONF_...
[ 27, 4 ]
[ 39, 9 ]
python
en
['en', 'en', 'en']
True
AzureDevOpsFlowHandler._show_reauth_form
(self, errors=None)
Show the reauth form to the user.
Show the reauth form to the user.
async def _show_reauth_form(self, errors=None): """Show the reauth form to the user.""" return self.async_show_form( step_id="reauth", description_placeholders={ "project_url": f"{self._organization}/{self._project}" }, data_schema=vol.Sche...
[ "async", "def", "_show_reauth_form", "(", "self", ",", "errors", "=", "None", ")", ":", "return", "self", ".", "async_show_form", "(", "step_id", "=", "\"reauth\"", ",", "description_placeholders", "=", "{", "\"project_url\"", ":", "f\"{self._organization}/{self._pr...
[ 41, 4 ]
[ 50, 9 ]
python
en
['en', 'en', 'en']
True
AzureDevOpsFlowHandler._check_setup
(self)
Check the setup of the flow.
Check the setup of the flow.
async def _check_setup(self): """Check the setup of the flow.""" errors = {} client = DevOpsClient() try: if self._pat is not None: await client.authorize(self._pat, self._organization) if not client.authorized: errors["ba...
[ "async", "def", "_check_setup", "(", "self", ")", ":", "errors", "=", "{", "}", "client", "=", "DevOpsClient", "(", ")", "try", ":", "if", "self", ".", "_pat", "is", "not", "None", ":", "await", "client", ".", "authorize", "(", "self", ".", "_pat", ...
[ 52, 4 ]
[ 71, 19 ]
python
en
['en', 'en', 'en']
True
AzureDevOpsFlowHandler.async_step_user
(self, user_input=None)
Handle a flow initiated by the user.
Handle a flow initiated by the user.
async def async_step_user(self, user_input=None): """Handle a flow initiated by the user.""" if user_input is None: return await self._show_setup_form(user_input) self._organization = user_input[CONF_ORG] self._project = user_input[CONF_PROJECT] self._pat = user_inpu...
[ "async", "def", "async_step_user", "(", "self", ",", "user_input", "=", "None", ")", ":", "if", "user_input", "is", "None", ":", "return", "await", "self", ".", "_show_setup_form", "(", "user_input", ")", "self", ".", "_organization", "=", "user_input", "[",...
[ 73, 4 ]
[ 88, 41 ]
python
en
['en', 'en', 'en']
True
AzureDevOpsFlowHandler.async_step_reauth
(self, user_input)
Handle configuration by re-auth.
Handle configuration by re-auth.
async def async_step_reauth(self, user_input): """Handle configuration by re-auth.""" if user_input.get(CONF_ORG) and user_input.get(CONF_PROJECT): self._organization = user_input[CONF_ORG] self._project = user_input[CONF_PROJECT] self._pat = user_input[CONF_PAT] ...
[ "async", "def", "async_step_reauth", "(", "self", ",", "user_input", ")", ":", "if", "user_input", ".", "get", "(", "CONF_ORG", ")", "and", "user_input", ".", "get", "(", "CONF_PROJECT", ")", ":", "self", ".", "_organization", "=", "user_input", "[", "CONF...
[ 90, 4 ]
[ 118, 67 ]
python
en
['en', 'en', 'en']
True
AzureDevOpsFlowHandler._async_create_entry
(self)
Handle create entry.
Handle create entry.
def _async_create_entry(self): """Handle create entry.""" return self.async_create_entry( title=f"{self._organization}/{self._project}", data={ CONF_ORG: self._organization, CONF_PROJECT: self._project, CONF_PAT: self._pat, ...
[ "def", "_async_create_entry", "(", "self", ")", ":", "return", "self", ".", "async_create_entry", "(", "title", "=", "f\"{self._organization}/{self._project}\"", ",", "data", "=", "{", "CONF_ORG", ":", "self", ".", "_organization", ",", "CONF_PROJECT", ":", "self"...
[ 120, 4 ]
[ 129, 9 ]
python
en
['es', 'en', 'en']
True
ConfigEntryAuth.__init__
( self, hass: core.HomeAssistant, config_entry: config_entries.ConfigEntry, implementation: config_entry_oauth2_flow.AbstractOAuth2Implementation, )
Initialize Home Connect Auth.
Initialize Home Connect Auth.
def __init__( self, hass: core.HomeAssistant, config_entry: config_entries.ConfigEntry, implementation: config_entry_oauth2_flow.AbstractOAuth2Implementation, ): """Initialize Home Connect Auth.""" self.hass = hass self.config_entry = config_entry self...
[ "def", "__init__", "(", "self", ",", "hass", ":", "core", ".", "HomeAssistant", ",", "config_entry", ":", "config_entries", ".", "ConfigEntry", ",", "implementation", ":", "config_entry_oauth2_flow", ".", "AbstractOAuth2Implementation", ",", ")", ":", "self", ".",...
[ 26, 4 ]
[ 39, 25 ]
python
en
['en', 'en', 'en']
True
ConfigEntryAuth.refresh_tokens
(self)
Refresh and return new Home Connect tokens using Home Assistant OAuth2 session.
Refresh and return new Home Connect tokens using Home Assistant OAuth2 session.
def refresh_tokens(self) -> dict: """Refresh and return new Home Connect tokens using Home Assistant OAuth2 session.""" run_coroutine_threadsafe( self.session.async_ensure_token_valid(), self.hass.loop ).result() return self.session.token
[ "def", "refresh_tokens", "(", "self", ")", "->", "dict", ":", "run_coroutine_threadsafe", "(", "self", ".", "session", ".", "async_ensure_token_valid", "(", ")", ",", "self", ".", "hass", ".", "loop", ")", ".", "result", "(", ")", "return", "self", ".", ...
[ 41, 4 ]
[ 47, 33 ]
python
en
['en', 'en', 'en']
True
ConfigEntryAuth.get_devices
(self)
Get a dictionary of devices.
Get a dictionary of devices.
def get_devices(self): """Get a dictionary of devices.""" appl = self.get_appliances() devices = [] for app in appl: if app.type == "Dryer": device = Dryer(self.hass, app) elif app.type == "Washer": device = Washer(self.hass, app) ...
[ "def", "get_devices", "(", "self", ")", ":", "appl", "=", "self", ".", "get_appliances", "(", ")", "devices", "=", "[", "]", "for", "app", "in", "appl", ":", "if", "app", ".", "type", "==", "\"Dryer\"", ":", "device", "=", "Dryer", "(", "self", "."...
[ 49, 4 ]
[ 75, 22 ]
python
en
['en', 'en', 'en']
True
HomeConnectDevice.__init__
(self, hass, appliance)
Initialize the device class.
Initialize the device class.
def __init__(self, hass, appliance): """Initialize the device class.""" self.hass = hass self.appliance = appliance
[ "def", "__init__", "(", "self", ",", "hass", ",", "appliance", ")", ":", "self", ".", "hass", "=", "hass", "self", ".", "appliance", "=", "appliance" ]
[ 85, 4 ]
[ 88, 34 ]
python
en
['en', 'en', 'en']
True
HomeConnectDevice.initialize
(self)
Fetch the info needed to initialize the device.
Fetch the info needed to initialize the device.
def initialize(self): """Fetch the info needed to initialize the device.""" try: self.appliance.get_status() except (HomeConnectError, ValueError): _LOGGER.debug("Unable to fetch appliance status. Probably offline") try: self.appliance.get_settings() ...
[ "def", "initialize", "(", "self", ")", ":", "try", ":", "self", ".", "appliance", ".", "get_status", "(", ")", "except", "(", "HomeConnectError", ",", "ValueError", ")", ":", "_LOGGER", ".", "debug", "(", "\"Unable to fetch appliance status. Probably offline\"", ...
[ 90, 4 ]
[ 107, 66 ]
python
en
['en', 'en', 'en']
True
HomeConnectDevice.event_callback
(self, appliance)
Handle event.
Handle event.
def event_callback(self, appliance): """Handle event.""" _LOGGER.debug("Update triggered on %s", appliance.name) _LOGGER.debug(self.appliance.status) dispatcher_send(self.hass, SIGNAL_UPDATE_ENTITIES, appliance.haId)
[ "def", "event_callback", "(", "self", ",", "appliance", ")", ":", "_LOGGER", ".", "debug", "(", "\"Update triggered on %s\"", ",", "appliance", ".", "name", ")", "_LOGGER", ".", "debug", "(", "self", ".", "appliance", ".", "status", ")", "dispatcher_send", "...
[ 109, 4 ]
[ 113, 74 ]
python
en
['es', 'en', 'en']
False
DeviceWithPrograms.get_programs_available
(self)
Get the available programs.
Get the available programs.
def get_programs_available(self): """Get the available programs.""" return self.PROGRAMS
[ "def", "get_programs_available", "(", "self", ")", ":", "return", "self", ".", "PROGRAMS" ]
[ 121, 4 ]
[ 123, 28 ]
python
en
['en', 'en', 'en']
True
DeviceWithPrograms.get_program_switches
(self)
Get a dictionary with info about program switches. There will be one switch for each program.
Get a dictionary with info about program switches.
def get_program_switches(self): """Get a dictionary with info about program switches. There will be one switch for each program. """ programs = self.get_programs_available() return [{"device": self, "program_name": p["name"]} for p in programs]
[ "def", "get_program_switches", "(", "self", ")", ":", "programs", "=", "self", ".", "get_programs_available", "(", ")", "return", "[", "{", "\"device\"", ":", "self", ",", "\"program_name\"", ":", "p", "[", "\"name\"", "]", "}", "for", "p", "in", "programs...
[ 125, 4 ]
[ 131, 78 ]
python
en
['en', 'en', 'en']
True
DeviceWithPrograms.get_program_sensors
(self)
Get a dictionary with info about program sensors. There will be one of the four types of sensors for each device.
Get a dictionary with info about program sensors.
def get_program_sensors(self): """Get a dictionary with info about program sensors. There will be one of the four types of sensors for each device. """ sensors = { "Remaining Program Time": (None, None, DEVICE_CLASS_TIMESTAMP, 1), "Duration": (TIME_SECOND...
[ "def", "get_program_sensors", "(", "self", ")", ":", "sensors", "=", "{", "\"Remaining Program Time\"", ":", "(", "None", ",", "None", ",", "DEVICE_CLASS_TIMESTAMP", ",", "1", ")", ",", "\"Duration\"", ":", "(", "TIME_SECONDS", ",", "\"mdi:update\"", ",", "Non...
[ 133, 4 ]
[ 155, 9 ]
python
en
['en', 'en', 'en']
True
DeviceWithDoor.get_door_entity
(self)
Get a dictionary with info about the door binary sensor.
Get a dictionary with info about the door binary sensor.
def get_door_entity(self): """Get a dictionary with info about the door binary sensor.""" return { "device": self, "desc": "Door", "device_class": "door", }
[ "def", "get_door_entity", "(", "self", ")", ":", "return", "{", "\"device\"", ":", "self", ",", "\"desc\"", ":", "\"Door\"", ",", "\"device_class\"", ":", "\"door\"", ",", "}" ]
[ 161, 4 ]
[ 167, 9 ]
python
en
['en', 'en', 'en']
True
Dryer.get_entity_info
(self)
Get a dictionary with infos about the associated entities.
Get a dictionary with infos about the associated entities.
def get_entity_info(self): """Get a dictionary with infos about the associated entities.""" door_entity = self.get_door_entity() program_sensors = self.get_program_sensors() program_switches = self.get_program_switches() return { "binary_sensor": [door_entity], ...
[ "def", "get_entity_info", "(", "self", ")", ":", "door_entity", "=", "self", ".", "get_door_entity", "(", ")", "program_sensors", "=", "self", ".", "get_program_sensors", "(", ")", "program_switches", "=", "self", ".", "get_program_switches", "(", ")", "return",...
[ 192, 4 ]
[ 201, 9 ]
python
en
['en', 'en', 'en']
True
Dishwasher.get_entity_info
(self)
Get a dictionary with infos about the associated entities.
Get a dictionary with infos about the associated entities.
def get_entity_info(self): """Get a dictionary with infos about the associated entities.""" door_entity = self.get_door_entity() program_sensors = self.get_program_sensors() program_switches = self.get_program_switches() return { "binary_sensor": [door_entity], ...
[ "def", "get_entity_info", "(", "self", ")", ":", "door_entity", "=", "self", ".", "get_door_entity", "(", ")", "program_sensors", "=", "self", ".", "get_program_sensors", "(", ")", "program_switches", "=", "self", ".", "get_program_switches", "(", ")", "return",...
[ 232, 4 ]
[ 241, 9 ]
python
en
['en', 'en', 'en']
True
Oven.get_entity_info
(self)
Get a dictionary with infos about the associated entities.
Get a dictionary with infos about the associated entities.
def get_entity_info(self): """Get a dictionary with infos about the associated entities.""" door_entity = self.get_door_entity() program_sensors = self.get_program_sensors() program_switches = self.get_program_switches() return { "binary_sensor": [door_entity], ...
[ "def", "get_entity_info", "(", "self", ")", ":", "door_entity", "=", "self", ".", "get_door_entity", "(", ")", "program_sensors", "=", "self", ".", "get_program_sensors", "(", ")", "program_switches", "=", "self", ".", "get_program_switches", "(", ")", "return",...
[ 257, 4 ]
[ 266, 9 ]
python
en
['en', 'en', 'en']
True
Washer.get_entity_info
(self)
Get a dictionary with infos about the associated entities.
Get a dictionary with infos about the associated entities.
def get_entity_info(self): """Get a dictionary with infos about the associated entities.""" door_entity = self.get_door_entity() program_sensors = self.get_program_sensors() program_switches = self.get_program_switches() return { "binary_sensor": [door_entity], ...
[ "def", "get_entity_info", "(", "self", ")", ":", "door_entity", "=", "self", ".", "get_door_entity", "(", ")", "program_sensors", "=", "self", ".", "get_program_sensors", "(", ")", "program_switches", "=", "self", ".", "get_program_switches", "(", ")", "return",...
[ 296, 4 ]
[ 305, 9 ]
python
en
['en', 'en', 'en']
True
CoffeeMaker.get_entity_info
(self)
Get a dictionary with infos about the associated entities.
Get a dictionary with infos about the associated entities.
def get_entity_info(self): """Get a dictionary with infos about the associated entities.""" program_sensors = self.get_program_sensors() program_switches = self.get_program_switches() return {"switch": program_switches, "sensor": program_sensors}
[ "def", "get_entity_info", "(", "self", ")", ":", "program_sensors", "=", "self", ".", "get_program_sensors", "(", ")", "program_switches", "=", "self", ".", "get_program_switches", "(", ")", "return", "{", "\"switch\"", ":", "program_switches", ",", "\"sensor\"", ...
[ 330, 4 ]
[ 334, 70 ]
python
en
['en', 'en', 'en']
True
Hood.get_entity_info
(self)
Get a dictionary with infos about the associated entities.
Get a dictionary with infos about the associated entities.
def get_entity_info(self): """Get a dictionary with infos about the associated entities.""" program_sensors = self.get_program_sensors() program_switches = self.get_program_switches() return {"switch": program_switches, "sensor": program_sensors}
[ "def", "get_entity_info", "(", "self", ")", ":", "program_sensors", "=", "self", ".", "get_program_sensors", "(", ")", "program_switches", "=", "self", ".", "get_program_switches", "(", ")", "return", "{", "\"switch\"", ":", "program_switches", ",", "\"sensor\"", ...
[ 346, 4 ]
[ 350, 70 ]
python
en
['en', 'en', 'en']
True
FridgeFreezer.get_entity_info
(self)
Get a dictionary with infos about the associated entities.
Get a dictionary with infos about the associated entities.
def get_entity_info(self): """Get a dictionary with infos about the associated entities.""" door_entity = self.get_door_entity() return {"binary_sensor": [door_entity]}
[ "def", "get_entity_info", "(", "self", ")", ":", "door_entity", "=", "self", ".", "get_door_entity", "(", ")", "return", "{", "\"binary_sensor\"", ":", "[", "door_entity", "]", "}" ]
[ 356, 4 ]
[ 359, 47 ]
python
en
['en', 'en', 'en']
True
Hob.get_entity_info
(self)
Get a dictionary with infos about the associated entities.
Get a dictionary with infos about the associated entities.
def get_entity_info(self): """Get a dictionary with infos about the associated entities.""" program_sensors = self.get_program_sensors() program_switches = self.get_program_switches() return {"switch": program_switches, "sensor": program_sensors}
[ "def", "get_entity_info", "(", "self", ")", ":", "program_sensors", "=", "self", ".", "get_program_sensors", "(", ")", "program_switches", "=", "self", ".", "get_program_switches", "(", ")", "return", "{", "\"switch\"", ":", "program_switches", ",", "\"sensor\"", ...
[ 367, 4 ]
[ 371, 70 ]
python
en
['en', 'en', 'en']
True
setup_platform
(hass, config, add_entities, discovery_info=None)
Set up the ISS sensor.
Set up the ISS sensor.
def setup_platform(hass, config, add_entities, discovery_info=None): """Set up the ISS sensor.""" if None in (hass.config.latitude, hass.config.longitude): _LOGGER.error("Latitude or longitude not set in Home Assistant config") return False try: iss_data = IssData(hass.config.latitu...
[ "def", "setup_platform", "(", "hass", ",", "config", ",", "add_entities", ",", "discovery_info", "=", "None", ")", ":", "if", "None", "in", "(", "hass", ".", "config", ".", "latitude", ",", "hass", ".", "config", ".", "longitude", ")", ":", "_LOGGER", ...
[ 36, 0 ]
[ 52, 70 ]
python
en
['en', 'bg', 'en']
True
IssBinarySensor.__init__
(self, iss_data, name, show)
Initialize the sensor.
Initialize the sensor.
def __init__(self, iss_data, name, show): """Initialize the sensor.""" self.iss_data = iss_data self._state = None self._name = name self._show_on_map = show
[ "def", "__init__", "(", "self", ",", "iss_data", ",", "name", ",", "show", ")", ":", "self", ".", "iss_data", "=", "iss_data", "self", ".", "_state", "=", "None", "self", ".", "_name", "=", "name", "self", ".", "_show_on_map", "=", "show" ]
[ 58, 4 ]
[ 63, 32 ]
python
en
['en', 'en', 'en']
True
IssBinarySensor.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" ]
[ 66, 4 ]
[ 68, 25 ]
python
en
['en', 'mi', 'en']
True
IssBinarySensor.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.iss_data.is_above if self.iss_data else False
[ "def", "is_on", "(", "self", ")", ":", "return", "self", ".", "iss_data", ".", "is_above", "if", "self", ".", "iss_data", "else", "False" ]
[ 71, 4 ]
[ 73, 65 ]
python
en
['en', 'fy', 'en']
True
IssBinarySensor.device_class
(self)
Return the class of this sensor.
Return the class of this sensor.
def device_class(self): """Return the class of this sensor.""" return DEFAULT_DEVICE_CLASS
[ "def", "device_class", "(", "self", ")", ":", "return", "DEFAULT_DEVICE_CLASS" ]
[ 76, 4 ]
[ 78, 35 ]
python
en
['en', 'en', 'en']
True
IssBinarySensor.device_state_attributes
(self)
Return the state attributes.
Return the state attributes.
def device_state_attributes(self): """Return the state attributes.""" if self.iss_data: attrs = { ATTR_ISS_NUMBER_PEOPLE_SPACE: self.iss_data.number_of_people_in_space, ATTR_ISS_NEXT_RISE: self.iss_data.next_rise, } if self._show_on_map...
[ "def", "device_state_attributes", "(", "self", ")", ":", "if", "self", ".", "iss_data", ":", "attrs", "=", "{", "ATTR_ISS_NUMBER_PEOPLE_SPACE", ":", "self", ".", "iss_data", ".", "number_of_people_in_space", ",", "ATTR_ISS_NEXT_RISE", ":", "self", ".", "iss_data",...
[ 81, 4 ]
[ 94, 24 ]
python
en
['en', 'en', 'en']
True
IssBinarySensor.update
(self)
Get the latest data from ISS API and updates the states.
Get the latest data from ISS API and updates the states.
def update(self): """Get the latest data from ISS API and updates the states.""" self.iss_data.update()
[ "def", "update", "(", "self", ")", ":", "self", ".", "iss_data", ".", "update", "(", ")" ]
[ 96, 4 ]
[ 98, 30 ]
python
en
['en', 'en', 'en']
True
IssData.__init__
(self, latitude, longitude)
Initialize the data object.
Initialize the data object.
def __init__(self, latitude, longitude): """Initialize the data object.""" self.is_above = None self.next_rise = None self.number_of_people_in_space = None self.position = None self.latitude = latitude self.longitude = longitude
[ "def", "__init__", "(", "self", ",", "latitude", ",", "longitude", ")", ":", "self", ".", "is_above", "=", "None", "self", ".", "next_rise", "=", "None", "self", ".", "number_of_people_in_space", "=", "None", "self", ".", "position", "=", "None", "self", ...
[ 104, 4 ]
[ 111, 34 ]
python
en
['en', 'en', 'en']
True
IssData.update
(self)
Get the latest data from the ISS API.
Get the latest data from the ISS API.
def update(self): """Get the latest data from the ISS API.""" try: iss = pyiss.ISS() self.is_above = iss.is_ISS_above(self.latitude, self.longitude) self.next_rise = iss.next_rise(self.latitude, self.longitude) self.number_of_people_in_space = iss.number_o...
[ "def", "update", "(", "self", ")", ":", "try", ":", "iss", "=", "pyiss", ".", "ISS", "(", ")", "self", ".", "is_above", "=", "iss", ".", "is_ISS_above", "(", "self", ".", "latitude", ",", "self", ".", "longitude", ")", "self", ".", "next_rise", "="...
[ 114, 4 ]
[ 124, 24 ]
python
en
['en', 'en', 'en']
True
ZWaveServices.__init__
(self, hass, manager)
Initialize with both hass and ozwmanager objects.
Initialize with both hass and ozwmanager objects.
def __init__(self, hass, manager): """Initialize with both hass and ozwmanager objects.""" self._hass = hass self._manager = manager
[ "def", "__init__", "(", "self", ",", "hass", ",", "manager", ")", ":", "self", ".", "_hass", "=", "hass", "self", ".", "_manager", "=", "manager" ]
[ 18, 4 ]
[ 21, 31 ]
python
en
['en', 'en', 'en']
True
ZWaveServices.async_register
(self)
Register all our services.
Register all our services.
def async_register(self): """Register all our services.""" self._hass.services.async_register( const.DOMAIN, const.SERVICE_ADD_NODE, self.async_add_node, schema=vol.Schema( { vol.Optional(const.ATTR_INSTANCE_ID, default=...
[ "def", "async_register", "(", "self", ")", ":", "self", ".", "_hass", ".", "services", ".", "async_register", "(", "const", ".", "DOMAIN", ",", "const", ".", "SERVICE_ADD_NODE", ",", "self", ".", "async_add_node", ",", "schema", "=", "vol", ".", "Schema", ...
[ 24, 4 ]
[ 85, 9 ]
python
en
['en', 'en', 'en']
True
ZWaveServices.async_set_config_parameter
(self, service)
Set a config parameter to a node.
Set a config parameter to a node.
def async_set_config_parameter(self, service): """Set a config parameter to a node.""" instance_id = service.data[const.ATTR_INSTANCE_ID] node_id = service.data[const.ATTR_NODE_ID] param = service.data[const.ATTR_CONFIG_PARAMETER] selection = service.data[const.ATTR_CONFIG_VALUE]...
[ "def", "async_set_config_parameter", "(", "self", ",", "service", ")", ":", "instance_id", "=", "service", ".", "data", "[", "const", ".", "ATTR_INSTANCE_ID", "]", "node_id", "=", "service", ".", "data", "[", "const", ".", "ATTR_NODE_ID", "]", "param", "=", ...
[ 88, 4 ]
[ 105, 9 ]
python
en
['en', 'pt', 'en']
True
ZWaveServices.async_add_node
(self, service)
Enter inclusion mode on the controller.
Enter inclusion mode on the controller.
def async_add_node(self, service): """Enter inclusion mode on the controller.""" instance_id = service.data[const.ATTR_INSTANCE_ID] secure = service.data[const.ATTR_SECURE] instance = self._manager.get_instance(instance_id) if instance is None: raise ValueError(f"No O...
[ "def", "async_add_node", "(", "self", ",", "service", ")", ":", "instance_id", "=", "service", ".", "data", "[", "const", ".", "ATTR_INSTANCE_ID", "]", "secure", "=", "service", ".", "data", "[", "const", ".", "ATTR_SECURE", "]", "instance", "=", "self", ...
[ 108, 4 ]
[ 115, 33 ]
python
en
['en', 'en', 'en']
True
ZWaveServices.async_remove_node
(self, service)
Enter exclusion mode on the controller.
Enter exclusion mode on the controller.
def async_remove_node(self, service): """Enter exclusion mode on the controller.""" instance_id = service.data[const.ATTR_INSTANCE_ID] instance = self._manager.get_instance(instance_id) if instance is None: raise ValueError(f"No OpenZWave Instance with ID {instance_id}") ...
[ "def", "async_remove_node", "(", "self", ",", "service", ")", ":", "instance_id", "=", "service", ".", "data", "[", "const", ".", "ATTR_INSTANCE_ID", "]", "instance", "=", "self", ".", "_manager", ".", "get_instance", "(", "instance_id", ")", "if", "instance...
[ 118, 4 ]
[ 124, 30 ]
python
en
['en', 'en', 'en']
True
ZWaveServices.async_cancel_command
(self, service)
Tell the controller to cancel an add or remove command.
Tell the controller to cancel an add or remove command.
def async_cancel_command(self, service): """Tell the controller to cancel an add or remove command.""" instance_id = service.data[const.ATTR_INSTANCE_ID] instance = self._manager.get_instance(instance_id) if instance is None: raise ValueError(f"No OpenZWave Instance with ID {...
[ "def", "async_cancel_command", "(", "self", ",", "service", ")", ":", "instance_id", "=", "service", ".", "data", "[", "const", ".", "ATTR_INSTANCE_ID", "]", "instance", "=", "self", ".", "_manager", ".", "get_instance", "(", "instance_id", ")", "if", "insta...
[ 127, 4 ]
[ 133, 44 ]
python
en
['en', 'en', 'en']
True
TuyaConfigFlow.__init__
(self)
Initialize flow.
Initialize flow.
def __init__(self): """Initialize flow.""" self._country_code = None self._password = None self._platform = None self._username = None self._is_import = False
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "_country_code", "=", "None", "self", ".", "_password", "=", "None", "self", ".", "_platform", "=", "None", "self", ".", "_username", "=", "None", "self", ".", "_is_import", "=", "False" ]
[ 79, 4 ]
[ 85, 31 ]
python
en
['en', 'pl', 'en']
False
TuyaConfigFlow._try_connect
(self)
Try to connect and check auth.
Try to connect and check auth.
def _try_connect(self): """Try to connect and check auth.""" tuya = TuyaApi() try: tuya.init( self._username, self._password, self._country_code, self._platform ) except (TuyaNetException, TuyaServerException): return RESULT_CONN_ERROR ...
[ "def", "_try_connect", "(", "self", ")", ":", "tuya", "=", "TuyaApi", "(", ")", "try", ":", "tuya", ".", "init", "(", "self", ".", "_username", ",", "self", ".", "_password", ",", "self", ".", "_country_code", ",", "self", ".", "_platform", ")", "exc...
[ 98, 4 ]
[ 110, 29 ]
python
en
['en', 'en', 'en']
True
TuyaConfigFlow.async_step_import
(self, user_input=None)
Handle configuration by yaml file.
Handle configuration by yaml file.
async def async_step_import(self, user_input=None): """Handle configuration by yaml file.""" self._is_import = True return await self.async_step_user(user_input)
[ "async", "def", "async_step_import", "(", "self", ",", "user_input", "=", "None", ")", ":", "self", ".", "_is_import", "=", "True", "return", "await", "self", ".", "async_step_user", "(", "user_input", ")" ]
[ 112, 4 ]
[ 115, 53 ]
python
en
['en', 'en', 'en']
True
TuyaConfigFlow.async_step_user
(self, user_input=None)
Handle a flow initialized by the user.
Handle a flow initialized by the user.
async def async_step_user(self, user_input=None): """Handle a flow initialized by the user.""" if self._async_current_entries(): return self.async_abort(reason="single_instance_allowed") errors = {} if user_input is not None: self._country_code = str(user_input...
[ "async", "def", "async_step_user", "(", "self", ",", "user_input", "=", "None", ")", ":", "if", "self", ".", "_async_current_entries", "(", ")", ":", "return", "self", ".", "async_abort", "(", "reason", "=", "\"single_instance_allowed\"", ")", "errors", "=", ...
[ 117, 4 ]
[ 146, 9 ]
python
en
['en', 'en', 'en']
True
TuyaConfigFlow.async_get_options_flow
(config_entry)
Get the options flow for this handler.
Get the options flow for this handler.
def async_get_options_flow(config_entry): """Get the options flow for this handler.""" return OptionsFlowHandler(config_entry)
[ "def", "async_get_options_flow", "(", "config_entry", ")", ":", "return", "OptionsFlowHandler", "(", "config_entry", ")" ]
[ 150, 4 ]
[ 152, 47 ]
python
en
['en', 'en', 'en']
True
OptionsFlowHandler.__init__
(self, config_entry: config_entries.ConfigEntry)
Initialize options flow.
Initialize options flow.
def __init__(self, config_entry: config_entries.ConfigEntry): """Initialize options flow.""" self.config_entry = config_entry self._conf_devs_id = None self._conf_devs_option = {} self._form_error = None
[ "def", "__init__", "(", "self", ",", "config_entry", ":", "config_entries", ".", "ConfigEntry", ")", ":", "self", ".", "config_entry", "=", "config_entry", "self", ".", "_conf_devs_id", "=", "None", "self", ".", "_conf_devs_option", "=", "{", "}", "self", "....
[ 158, 4 ]
[ 163, 31 ]
python
en
['en', 'en', 'en']
True
OptionsFlowHandler._get_form_error
(self)
Set the error to be shown in the options form.
Set the error to be shown in the options form.
def _get_form_error(self): """Set the error to be shown in the options form.""" errors = {} if self._form_error: errors["base"] = self._form_error self._form_error = None return errors
[ "def", "_get_form_error", "(", "self", ")", ":", "errors", "=", "{", "}", "if", "self", ".", "_form_error", ":", "errors", "[", "\"base\"", "]", "=", "self", ".", "_form_error", "self", ".", "_form_error", "=", "None", "return", "errors" ]
[ 165, 4 ]
[ 171, 21 ]
python
en
['en', 'en', 'en']
True
OptionsFlowHandler._get_tuya_devices_filtered
(self, types, exclude_mode=False, type_prefix=True)
Get the list of Tuya device to filtered by types.
Get the list of Tuya device to filtered by types.
def _get_tuya_devices_filtered(self, types, exclude_mode=False, type_prefix=True): """Get the list of Tuya device to filtered by types.""" config_list = {} types_filter = set(types) tuya = self.hass.data[DOMAIN][TUYA_DATA] devices_list = tuya.get_all_devices() for device ...
[ "def", "_get_tuya_devices_filtered", "(", "self", ",", "types", ",", "exclude_mode", "=", "False", ",", "type_prefix", "=", "True", ")", ":", "config_list", "=", "{", "}", "types_filter", "=", "set", "(", "types", ")", "tuya", "=", "self", ".", "hass", "...
[ 173, 4 ]
[ 193, 26 ]
python
en
['en', 'en', 'en']
True
OptionsFlowHandler._get_device
(self, dev_id)
Get specific device from tuya library.
Get specific device from tuya library.
def _get_device(self, dev_id): """Get specific device from tuya library.""" tuya = self.hass.data[DOMAIN][TUYA_DATA] return tuya.get_device_by_id(dev_id)
[ "def", "_get_device", "(", "self", ",", "dev_id", ")", ":", "tuya", "=", "self", ".", "hass", ".", "data", "[", "DOMAIN", "]", "[", "TUYA_DATA", "]", "return", "tuya", ".", "get_device_by_id", "(", "dev_id", ")" ]
[ 195, 4 ]
[ 198, 44 ]
python
en
['en', 'en', 'en']
True
OptionsFlowHandler._save_config
(self, data)
Save the updated options.
Save the updated options.
def _save_config(self, data): """Save the updated options.""" curr_conf = self.config_entry.options.copy() curr_conf.update(data) curr_conf.update(self._conf_devs_option) return self.async_create_entry(title="", data=curr_conf)
[ "def", "_save_config", "(", "self", ",", "data", ")", ":", "curr_conf", "=", "self", ".", "config_entry", ".", "options", ".", "copy", "(", ")", "curr_conf", ".", "update", "(", "data", ")", "curr_conf", ".", "update", "(", "self", ".", "_conf_devs_optio...
[ 200, 4 ]
[ 206, 64 ]
python
en
['en', 'en', 'en']
True
OptionsFlowHandler._async_device_form
(self, devs_id)
Return configuration form for devices.
Return configuration form for devices.
async def _async_device_form(self, devs_id): """Return configuration form for devices.""" conf_devs_id = [] for count, dev_id in enumerate(devs_id): device_info = dev_id.split("-") if count == 0: device_type = device_info[0] device_id = dev...
[ "async", "def", "_async_device_form", "(", "self", ",", "devs_id", ")", ":", "conf_devs_id", "=", "[", "]", "for", "count", ",", "dev_id", "in", "enumerate", "(", "devs_id", ")", ":", "device_info", "=", "dev_id", ".", "split", "(", "\"-\"", ")", "if", ...
[ 208, 4 ]
[ 247, 9 ]
python
en
['da', 'en', 'en']
True
OptionsFlowHandler.async_step_init
(self, user_input=None)
Handle options flow.
Handle options flow.
async def async_step_init(self, user_input=None): """Handle options flow.""" if user_input is not None: dev_ids = user_input.get(CONF_LIST_DEVICES) if dev_ids: return await self.async_step_device(None, dev_ids) user_input.pop(CONF_LIST_DEVICES, []) ...
[ "async", "def", "async_step_init", "(", "self", ",", "user_input", "=", "None", ")", ":", "if", "user_input", "is", "not", "None", ":", "dev_ids", "=", "user_input", ".", "get", "(", "CONF_LIST_DEVICES", ")", "if", "dev_ids", ":", "return", "await", "self"...
[ 249, 4 ]
[ 301, 9 ]
python
en
['en', 'nl', 'en']
True
OptionsFlowHandler.async_step_device
(self, user_input=None, dev_ids=None)
Handle options flow for device.
Handle options flow for device.
async def async_step_device(self, user_input=None, dev_ids=None): """Handle options flow for device.""" if dev_ids is not None: return await self._async_device_form(dev_ids) if user_input is not None: for device_id in self._conf_devs_id: self._conf_devs_op...
[ "async", "def", "async_step_device", "(", "self", ",", "user_input", "=", "None", ",", "dev_ids", "=", "None", ")", ":", "if", "dev_ids", "is", "not", "None", ":", "return", "await", "self", ".", "_async_device_form", "(", "dev_ids", ")", "if", "user_input...
[ 303, 4 ]
[ 311, 43 ]
python
en
['en', 'en', 'en']
True
OptionsFlowHandler._get_device_schema
(self, device_type, curr_conf, device)
Return option schema for device.
Return option schema for device.
def _get_device_schema(self, device_type, curr_conf, device): """Return option schema for device.""" if device_type == "light": return self._get_light_schema(curr_conf, device) if device_type == "climate": return self._get_climate_schema(curr_conf, device) return ...
[ "def", "_get_device_schema", "(", "self", ",", "device_type", ",", "curr_conf", ",", "device", ")", ":", "if", "device_type", "==", "\"light\"", ":", "return", "self", ".", "_get_light_schema", "(", "curr_conf", ",", "device", ")", "if", "device_type", "==", ...
[ 313, 4 ]
[ 319, 19 ]
python
de
['nl', 'de', 'en']
False
OptionsFlowHandler._get_light_schema
(curr_conf, device)
Create option schema for light device.
Create option schema for light device.
def _get_light_schema(curr_conf, device): """Create option schema for light device.""" min_kelvin = device.max_color_temp() max_kelvin = device.min_color_temp() config_schema = vol.Schema( { vol.Optional( CONF_SUPPORT_COLOR, ...
[ "def", "_get_light_schema", "(", "curr_conf", ",", "device", ")", ":", "min_kelvin", "=", "device", ".", "max_color_temp", "(", ")", "max_kelvin", "=", "device", ".", "min_color_temp", "(", ")", "config_schema", "=", "vol", ".", "Schema", "(", "{", "vol", ...
[ 322, 4 ]
[ 359, 28 ]
python
en
['nl', 'en', 'en']
True
OptionsFlowHandler._get_climate_schema
(curr_conf, device)
Create option schema for climate device.
Create option schema for climate device.
def _get_climate_schema(curr_conf, device): """Create option schema for climate device.""" unit = device.temperature_unit() def_unit = TEMP_FAHRENHEIT if unit == "FAHRENHEIT" else TEMP_CELSIUS config_schema = vol.Schema( { vol.Optional( CO...
[ "def", "_get_climate_schema", "(", "curr_conf", ",", "device", ")", ":", "unit", "=", "device", ".", "temperature_unit", "(", ")", "def_unit", "=", "TEMP_FAHRENHEIT", "if", "unit", "==", "\"FAHRENHEIT\"", "else", "TEMP_CELSIUS", "config_schema", "=", "vol", ".",...
[ 362, 4 ]
[ 392, 28 ]
python
en
['de', 'en', 'en']
True
test_default_setup
(hass, monkeypatch)
Test all basic functionality of the rflink sensor component.
Test all basic functionality of the rflink sensor component.
async def test_default_setup(hass, monkeypatch): """Test all basic functionality of the rflink sensor component.""" # setup mocking rflink module event_callback, create, _, _ = await mock_rflink(hass, CONFIG, DOMAIN, monkeypatch) # make sure arguments are passed assert create.call_args_list[0][1]["...
[ "async", "def", "test_default_setup", "(", "hass", ",", "monkeypatch", ")", ":", "# setup mocking rflink module", "event_callback", ",", "create", ",", "_", ",", "_", "=", "await", "mock_rflink", "(", "hass", ",", "CONFIG", ",", "DOMAIN", ",", "monkeypatch", "...
[ 44, 0 ]
[ 80, 67 ]
python
en
['en', 'en', 'en']
True
test_entity_availability
(hass, monkeypatch)
If Rflink device is disconnected, entities should become unavailable.
If Rflink device is disconnected, entities should become unavailable.
async def test_entity_availability(hass, monkeypatch): """If Rflink device is disconnected, entities should become unavailable.""" # Make sure Rflink mock does not 'recover' to quickly from the # disconnect or else the unavailability cannot be measured config = CONFIG failures = [True, True] con...
[ "async", "def", "test_entity_availability", "(", "hass", ",", "monkeypatch", ")", ":", "# Make sure Rflink mock does not 'recover' to quickly from the", "# disconnect or else the unavailability cannot be measured", "config", "=", "CONFIG", "failures", "=", "[", "True", ",", "Tr...
[ 83, 0 ]
[ 115, 67 ]
python
en
['en', 'en', 'en']
True
test_off_delay
(hass, legacy_patchable_time, monkeypatch)
Test off_delay option.
Test off_delay option.
async def test_off_delay(hass, legacy_patchable_time, monkeypatch): """Test off_delay option.""" # setup mocking rflink module event_callback, create, _, _ = await mock_rflink(hass, CONFIG, DOMAIN, monkeypatch) # make sure arguments are passed assert create.call_args_list[0][1]["ignore"] event...
[ "async", "def", "test_off_delay", "(", "hass", ",", "legacy_patchable_time", ",", "monkeypatch", ")", ":", "# setup mocking rflink module", "event_callback", ",", "create", ",", "_", ",", "_", "=", "await", "mock_rflink", "(", "hass", ",", "CONFIG", ",", "DOMAIN...
[ 118, 0 ]
[ 178, 27 ]
python
en
['en', 'en', 'en']
True
TFLxmertEmbeddings.call
(self, input_ids=None, token_type_ids=None, inputs_embeds=None, training=False)
Applies embedding based on inputs tensor. Returns: final_embeddings (:obj:`tf.Tensor`): output embedding tensor.
Applies embedding based on inputs tensor.
def call(self, input_ids=None, token_type_ids=None, inputs_embeds=None, training=False): """ Applies embedding based on inputs tensor. Returns: final_embeddings (:obj:`tf.Tensor`): output embedding tensor. """ assert not (input_ids is None and inputs_embeds is None) ...
[ "def", "call", "(", "self", ",", "input_ids", "=", "None", ",", "token_type_ids", "=", "None", ",", "inputs_embeds", "=", "None", ",", "training", "=", "False", ")", ":", "assert", "not", "(", "input_ids", "is", "None", "and", "inputs_embeds", "is", "Non...
[ 218, 4 ]
[ 243, 31 ]
python
en
['en', 'error', 'th']
False
generate_summaries_or_translations
( examples: List[str], out_file: str, model_name: str, batch_size: int = 8, device: str = DEFAULT_DEVICE, fp16=False, task="summarization", prefix=None, **generate_kwargs, )
Save model.generate results to <out_file>, and return how long it took.
Save model.generate results to <out_file>, and return how long it took.
def generate_summaries_or_translations( examples: List[str], out_file: str, model_name: str, batch_size: int = 8, device: str = DEFAULT_DEVICE, fp16=False, task="summarization", prefix=None, **generate_kwargs, ) -> Dict: """Save model.generate results to <out_file>, and return ho...
[ "def", "generate_summaries_or_translations", "(", "examples", ":", "List", "[", "str", "]", ",", "out_file", ":", "str", ",", "model_name", ":", "str", ",", "batch_size", ":", "int", "=", "8", ",", "device", ":", "str", "=", "DEFAULT_DEVICE", ",", "fp16", ...
[ 37, 0 ]
[ 78, 91 ]
python
en
['en', 'en', 'en']
True
run_generate
(verbose=True)
Takes input text, generates output, and then using reference calculates the BLEU scores. The results are saved to a file and returned to the caller, and printed out unless ``verbose=False`` is passed. Args: verbose (:obj:`bool`, `optional`, defaults to :obj:`True`): print results to stdout ...
def run_generate(verbose=True): """ Takes input text, generates output, and then using reference calculates the BLEU scores. The results are saved to a file and returned to the caller, and printed out unless ``verbose=False`` is passed. Args: verbose (:obj:`bool`, `optional`, defaults to :obj...
[ "def", "run_generate", "(", "verbose", "=", "True", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", ")", "parser", ".", "add_argument", "(", "\"model_name\"", ",", "type", "=", "str", ",", "help", "=", "\"like facebook/bart-large-cnn,t5-base, et...
[ 85, 0 ]
[ 175, 17 ]
python
en
['en', 'error', 'th']
False
setup_platform
(hass, config, add_entities, discovery_info=None)
Iterate through all MAX! Devices and add thermostats.
Iterate through all MAX! Devices and add thermostats.
def setup_platform(hass, config, add_entities, discovery_info=None): """Iterate through all MAX! Devices and add thermostats.""" devices = [] for handler in hass.data[DATA_KEY].values(): cube = handler.cube for device in cube.devices: name = f"{cube.room_by_id(device.room_id).nam...
[ "def", "setup_platform", "(", "hass", ",", "config", ",", "add_entities", ",", "discovery_info", "=", "None", ")", ":", "devices", "=", "[", "]", "for", "handler", "in", "hass", ".", "data", "[", "DATA_KEY", "]", ".", "values", "(", ")", ":", "cube", ...
[ 64, 0 ]
[ 76, 29 ]
python
en
['en', 'en', 'en']
True
MaxCubeClimate.__init__
(self, handler, name, rf_address)
Initialize MAX! Cube ClimateEntity.
Initialize MAX! Cube ClimateEntity.
def __init__(self, handler, name, rf_address): """Initialize MAX! Cube ClimateEntity.""" self._name = name self._rf_address = rf_address self._cubehandle = handler
[ "def", "__init__", "(", "self", ",", "handler", ",", "name", ",", "rf_address", ")", ":", "self", ".", "_name", "=", "name", "self", ".", "_rf_address", "=", "rf_address", "self", ".", "_cubehandle", "=", "handler" ]
[ 82, 4 ]
[ 86, 34 ]
python
en
['en', 'en', 'it']
True
MaxCubeClimate.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" ]
[ 89, 4 ]
[ 91, 28 ]
python
en
['en', 'en', 'en']
True
MaxCubeClimate.should_poll
(self)
Return the polling state.
Return the polling state.
def should_poll(self): """Return the polling state.""" return True
[ "def", "should_poll", "(", "self", ")", ":", "return", "True" ]
[ 94, 4 ]
[ 96, 19 ]
python
en
['en', 'en', 'en']
True
MaxCubeClimate.name
(self)
Return the name of the climate device.
Return the name of the climate device.
def name(self): """Return the name of the climate device.""" return self._name
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "_name" ]
[ 99, 4 ]
[ 101, 25 ]
python
en
['en', 'en', 'en']
True
MaxCubeClimate.min_temp
(self)
Return the minimum temperature.
Return the minimum temperature.
def min_temp(self): """Return the minimum temperature.""" device = self._cubehandle.cube.device_by_rf(self._rf_address) if device.min_temperature is None: return MIN_TEMPERATURE return device.min_temperature
[ "def", "min_temp", "(", "self", ")", ":", "device", "=", "self", ".", "_cubehandle", ".", "cube", ".", "device_by_rf", "(", "self", ".", "_rf_address", ")", "if", "device", ".", "min_temperature", "is", "None", ":", "return", "MIN_TEMPERATURE", "return", "...
[ 104, 4 ]
[ 109, 37 ]
python
en
['en', 'la', 'en']
True
MaxCubeClimate.max_temp
(self)
Return the maximum temperature.
Return the maximum temperature.
def max_temp(self): """Return the maximum temperature.""" device = self._cubehandle.cube.device_by_rf(self._rf_address) if device.max_temperature is None: return MAX_TEMPERATURE return device.max_temperature
[ "def", "max_temp", "(", "self", ")", ":", "device", "=", "self", ".", "_cubehandle", ".", "cube", ".", "device_by_rf", "(", "self", ".", "_rf_address", ")", "if", "device", ".", "max_temperature", "is", "None", ":", "return", "MAX_TEMPERATURE", "return", "...
[ 112, 4 ]
[ 117, 37 ]
python
en
['en', 'la', 'en']
True
MaxCubeClimate.temperature_unit
(self)
Return the unit of measurement.
Return the unit of measurement.
def temperature_unit(self): """Return the unit of measurement.""" return TEMP_CELSIUS
[ "def", "temperature_unit", "(", "self", ")", ":", "return", "TEMP_CELSIUS" ]
[ 120, 4 ]
[ 122, 27 ]
python
en
['en', 'la', 'en']
True