Search is not available for this dataset
identifier
stringlengths
1
155
parameters
stringlengths
2
6.09k
docstring
stringlengths
11
63.4k
docstring_summary
stringlengths
0
63.4k
function
stringlengths
29
99.8k
function_tokens
list
start_point
list
end_point
list
language
stringclasses
1 value
docstring_language
stringlengths
2
7
docstring_language_predictions
stringlengths
18
23
is_langid_reliable
stringclasses
2 values
test_methods
(hass)
Test if methods call the services as expected.
Test if methods call the services as expected.
async def test_methods(hass): """Test if methods call the services as expected.""" # Test is_on hass.states.async_set("light.test", STATE_ON) assert light.is_on(hass, "light.test") hass.states.async_set("light.test", STATE_OFF) assert not light.is_on(hass, "light.test") # Test turn_on ...
[ "async", "def", "test_methods", "(", "hass", ")", ":", "# Test is_on", "hass", ".", "states", ".", "async_set", "(", "\"light.test\"", ",", "STATE_ON", ")", "assert", "light", ".", "is_on", "(", "hass", ",", "\"light.test\"", ")", "hass", ".", "states", "....
[ 25, 0 ]
[ 104, 63 ]
python
en
['en', 'en', 'en']
True
test_services
(hass, mock_light_profiles)
Test the provided services.
Test the provided services.
async def test_services(hass, mock_light_profiles): """Test the provided services.""" platform = getattr(hass.components, "test.light") platform.init() assert await async_setup_component( hass, light.DOMAIN, {light.DOMAIN: {CONF_PLATFORM: "test"}} ) await hass.async_block_till_done() ...
[ "async", "def", "test_services", "(", "hass", ",", "mock_light_profiles", ")", ":", "platform", "=", "getattr", "(", "hass", ".", "components", ",", "\"test.light\"", ")", "platform", ".", "init", "(", ")", "assert", "await", "async_setup_component", "(", "has...
[ 107, 0 ]
[ 406, 21 ]
python
en
['en', 'en', 'en']
True
test_light_profiles
(hass, mock_light_profiles)
Test light profiles.
Test light profiles.
async def test_light_profiles(hass, mock_light_profiles): """Test light profiles.""" platform = getattr(hass.components, "test.light") platform.init() mock_light_profiles["test"] = color.color_xy_to_hs(0.4, 0.6) + (100, 0) mock_light_profiles["test_off"] = 0, 0, 0, 0 assert await async_setup_c...
[ "async", "def", "test_light_profiles", "(", "hass", ",", "mock_light_profiles", ")", ":", "platform", "=", "getattr", "(", "hass", ".", "components", ",", "\"test.light\"", ")", "platform", ".", "init", "(", ")", "mock_light_profiles", "[", "\"test\"", "]", "=...
[ 409, 0 ]
[ 451, 45 ]
python
en
['en', 'zh', 'en']
True
test_default_profiles_group
(hass, mock_light_profiles)
Test default turn-on light profile for all lights.
Test default turn-on light profile for all lights.
async def test_default_profiles_group(hass, mock_light_profiles): """Test default turn-on light profile for all lights.""" platform = getattr(hass.components, "test.light") platform.init() assert await async_setup_component( hass, light.DOMAIN, {light.DOMAIN: {CONF_PLATFORM: "test"}} ) ...
[ "async", "def", "test_default_profiles_group", "(", "hass", ",", "mock_light_profiles", ")", ":", "platform", "=", "getattr", "(", "hass", ".", "components", ",", "\"test.light\"", ")", "platform", ".", "init", "(", ")", "assert", "await", "async_setup_component",...
[ 454, 0 ]
[ 479, 5 ]
python
en
['en', 'da', 'en']
True
test_default_profiles_light
(hass, mock_light_profiles)
Test default turn-on light profile for a specific light.
Test default turn-on light profile for a specific light.
async def test_default_profiles_light(hass, mock_light_profiles): """Test default turn-on light profile for a specific light.""" platform = getattr(hass.components, "test.light") platform.init() assert await async_setup_component( hass, light.DOMAIN, {light.DOMAIN: {CONF_PLATFORM: "test"}} ...
[ "async", "def", "test_default_profiles_light", "(", "hass", ",", "mock_light_profiles", ")", ":", "platform", "=", "getattr", "(", "hass", ".", "components", ",", "\"test.light\"", ")", "platform", ".", "init", "(", ")", "assert", "await", "async_setup_component",...
[ 482, 0 ]
[ 516, 5 ]
python
en
['en', 'en', 'en']
True
test_light_context
(hass, hass_admin_user)
Test that light context works.
Test that light context works.
async def test_light_context(hass, hass_admin_user): """Test that light context works.""" platform = getattr(hass.components, "test.light") platform.init() assert await async_setup_component(hass, "light", {"light": {"platform": "test"}}) await hass.async_block_till_done() state = hass.states.g...
[ "async", "def", "test_light_context", "(", "hass", ",", "hass_admin_user", ")", ":", "platform", "=", "getattr", "(", "hass", ".", "components", ",", "\"test.light\"", ")", "platform", ".", "init", "(", ")", "assert", "await", "async_setup_component", "(", "ha...
[ 519, 0 ]
[ 540, 55 ]
python
en
['en', 'en', 'en']
True
test_light_turn_on_auth
(hass, hass_admin_user)
Test that light context works.
Test that light context works.
async def test_light_turn_on_auth(hass, hass_admin_user): """Test that light context works.""" platform = getattr(hass.components, "test.light") platform.init() assert await async_setup_component(hass, "light", {"light": {"platform": "test"}}) await hass.async_block_till_done() state = hass.sta...
[ "async", "def", "test_light_turn_on_auth", "(", "hass", ",", "hass_admin_user", ")", ":", "platform", "=", "getattr", "(", "hass", ".", "components", ",", "\"test.light\"", ")", "platform", ".", "init", "(", ")", "assert", "await", "async_setup_component", "(", ...
[ 543, 0 ]
[ 562, 9 ]
python
en
['en', 'en', 'en']
True
test_light_brightness_step
(hass)
Test that light context works.
Test that light context works.
async def test_light_brightness_step(hass): """Test that light context works.""" platform = getattr(hass.components, "test.light") platform.init() entity = platform.ENTITIES[0] entity.supported_features = light.SUPPORT_BRIGHTNESS entity.brightness = 100 assert await async_setup_component(has...
[ "async", "def", "test_light_brightness_step", "(", "hass", ")", ":", "platform", "=", "getattr", "(", "hass", ".", "components", ",", "\"test.light\"", ")", "platform", ".", "init", "(", ")", "entity", "=", "platform", ".", "ENTITIES", "[", "0", "]", "enti...
[ 565, 0 ]
[ 597, 42 ]
python
en
['en', 'en', 'en']
True
test_light_brightness_pct_conversion
(hass)
Test that light brightness percent conversion.
Test that light brightness percent conversion.
async def test_light_brightness_pct_conversion(hass): """Test that light brightness percent conversion.""" platform = getattr(hass.components, "test.light") platform.init() entity = platform.ENTITIES[0] entity.supported_features = light.SUPPORT_BRIGHTNESS entity.brightness = 100 assert await...
[ "async", "def", "test_light_brightness_pct_conversion", "(", "hass", ")", ":", "platform", "=", "getattr", "(", "hass", ".", "components", ",", "\"test.light\"", ")", "platform", ".", "init", "(", ")", "entity", "=", "platform", ".", "ENTITIES", "[", "0", "]...
[ 600, 0 ]
[ 662, 42 ]
python
en
['en', 'yi', 'en']
True
test_deprecated_base_class
(caplog)
Test deprecated base class.
Test deprecated base class.
def test_deprecated_base_class(caplog): """Test deprecated base class.""" class CustomLight(light.Light): pass CustomLight() assert "Light is deprecated, modify CustomLight" in caplog.text
[ "def", "test_deprecated_base_class", "(", "caplog", ")", ":", "class", "CustomLight", "(", "light", ".", "Light", ")", ":", "pass", "CustomLight", "(", ")", "assert", "\"Light is deprecated, modify CustomLight\"", "in", "caplog", ".", "text" ]
[ 665, 0 ]
[ 672, 67 ]
python
en
['en', 'en', 'en']
True
test_profiles
(hass)
Test profiles loading.
Test profiles loading.
async def test_profiles(hass): """Test profiles loading.""" profiles = orig_Profiles(hass) await profiles.async_initialize() assert profiles.data == { "concentrate": (35.932, 69.412, 219, 0), "energize": (43.333, 21.176, 203, 0), "reading": (38.88, 49.02, 240, 0), "relax"...
[ "async", "def", "test_profiles", "(", "hass", ")", ":", "profiles", "=", "orig_Profiles", "(", "hass", ")", "await", "profiles", ".", "async_initialize", "(", ")", "assert", "profiles", ".", "data", "==", "{", "\"concentrate\"", ":", "(", "35.932", ",", "6...
[ 675, 0 ]
[ 684, 5 ]
python
en
['fr', 'ja', 'en']
False
async_setup_platform
( hass: HomeAssistant, config: Dict[str, Union[str, bool]], async_add_entities: Callable, discovery_info: Optional[DiscoveryInfoType] = None, )
Set up the HERE travel time platform.
Set up the HERE travel time platform.
async def async_setup_platform( hass: HomeAssistant, config: Dict[str, Union[str, bool]], async_add_entities: Callable, discovery_info: Optional[DiscoveryInfoType] = None, ) -> None: """Set up the HERE travel time platform.""" api_key = config[CONF_API_KEY] here_client = herepy.RoutingApi(a...
[ "async", "def", "async_setup_platform", "(", "hass", ":", "HomeAssistant", ",", "config", ":", "Dict", "[", "str", ",", "Union", "[", "str", ",", "bool", "]", "]", ",", "async_add_entities", ":", "Callable", ",", "discovery_info", ":", "Optional", "[", "Di...
[ 143, 0 ]
[ 194, 32 ]
python
en
['en', 'da', 'en']
True
_are_valid_client_credentials
(here_client: herepy.RoutingApi)
Check if the provided credentials are correct using defaults.
Check if the provided credentials are correct using defaults.
def _are_valid_client_credentials(here_client: herepy.RoutingApi) -> bool: """Check if the provided credentials are correct using defaults.""" known_working_origin = [38.9, -77.04833] known_working_destination = [39.0, -77.1] try: here_client.car_route( known_working_origin, ...
[ "def", "_are_valid_client_credentials", "(", "here_client", ":", "herepy", ".", "RoutingApi", ")", "->", "bool", ":", "known_working_origin", "=", "[", "38.9", ",", "-", "77.04833", "]", "known_working_destination", "=", "[", "39.0", ",", "-", "77.1", "]", "tr...
[ 197, 0 ]
[ 213, 15 ]
python
en
['en', 'en', 'en']
True
convert_time_to_isodate
(timestr: str)
Take a string like 08:00:00 and combine it with the current date.
Take a string like 08:00:00 and combine it with the current date.
def convert_time_to_isodate(timestr: str) -> str: """Take a string like 08:00:00 and combine it with the current date.""" combined = datetime.combine(dt.start_of_local_day(), dt.parse_time(timestr)) if combined < datetime.now(): combined = combined + timedelta(days=1) return combined.isoformat()
[ "def", "convert_time_to_isodate", "(", "timestr", ":", "str", ")", "->", "str", ":", "combined", "=", "datetime", ".", "combine", "(", "dt", ".", "start_of_local_day", "(", ")", ",", "dt", ".", "parse_time", "(", "timestr", ")", ")", "if", "combined", "<...
[ 500, 0 ]
[ 505, 31 ]
python
en
['en', 'en', 'en']
True
HERETravelTimeSensor.__init__
( self, name: str, origin: str, destination: str, origin_entity_id: str, destination_entity_id: str, here_data: "HERETravelTimeData", )
Initialize the sensor.
Initialize the sensor.
def __init__( self, name: str, origin: str, destination: str, origin_entity_id: str, destination_entity_id: str, here_data: "HERETravelTimeData", ) -> None: """Initialize the sensor.""" self._name = name self._origin_entity_id = origin_...
[ "def", "__init__", "(", "self", ",", "name", ":", "str", ",", "origin", ":", "str", ",", "destination", ":", "str", ",", "origin_entity_id", ":", "str", ",", "destination_entity_id", ":", "str", ",", "here_data", ":", "\"HERETravelTimeData\"", ",", ")", "-...
[ 219, 4 ]
[ 243, 53 ]
python
en
['en', 'en', 'en']
True
HERETravelTimeSensor.async_added_to_hass
(self)
Delay the sensor update to avoid entity not found warnings.
Delay the sensor update to avoid entity not found warnings.
async def async_added_to_hass(self) -> None: """Delay the sensor update to avoid entity not found warnings.""" @callback def delayed_sensor_update(event): """Update sensor after Home Assistant started.""" self.async_schedule_update_ha_state(True) self.hass.bus.a...
[ "async", "def", "async_added_to_hass", "(", "self", ")", "->", "None", ":", "@", "callback", "def", "delayed_sensor_update", "(", "event", ")", ":", "\"\"\"Update sensor after Home Assistant started.\"\"\"", "self", ".", "async_schedule_update_ha_state", "(", "True", ")...
[ 245, 4 ]
[ 255, 9 ]
python
en
['en', 'en', 'en']
True
HERETravelTimeSensor.state
(self)
Return the state of the sensor.
Return the state of the sensor.
def state(self) -> Optional[str]: """Return the state of the sensor.""" if self._here_data.traffic_mode: if self._here_data.traffic_time is not None: return str(round(self._here_data.traffic_time / 60)) if self._here_data.base_time is not None: return str(...
[ "def", "state", "(", "self", ")", "->", "Optional", "[", "str", "]", ":", "if", "self", ".", "_here_data", ".", "traffic_mode", ":", "if", "self", ".", "_here_data", ".", "traffic_time", "is", "not", "None", ":", "return", "str", "(", "round", "(", "...
[ 258, 4 ]
[ 266, 19 ]
python
en
['en', 'en', 'en']
True
HERETravelTimeSensor.name
(self)
Get the name of the sensor.
Get the name of the sensor.
def name(self) -> str: """Get the name of the sensor.""" return self._name
[ "def", "name", "(", "self", ")", "->", "str", ":", "return", "self", ".", "_name" ]
[ 269, 4 ]
[ 271, 25 ]
python
en
['en', 'en', 'en']
True
HERETravelTimeSensor.device_state_attributes
( self, )
Return the state attributes.
Return the state attributes.
def device_state_attributes( self, ) -> Optional[Dict[str, Union[None, float, str, bool]]]: """Return the state attributes.""" if self._here_data.base_time is None: return None res = self._attrs if self._here_data.attribution is not None: res[ATTR_ATT...
[ "def", "device_state_attributes", "(", "self", ",", ")", "->", "Optional", "[", "Dict", "[", "str", ",", "Union", "[", "None", ",", "float", ",", "str", ",", "bool", "]", "]", "]", ":", "if", "self", ".", "_here_data", ".", "base_time", "is", "None",...
[ 274, 4 ]
[ 292, 18 ]
python
en
['en', 'en', 'en']
True
HERETravelTimeSensor.unit_of_measurement
(self)
Return the unit this state is expressed in.
Return the unit this state is expressed in.
def unit_of_measurement(self) -> str: """Return the unit this state is expressed in.""" return self._unit_of_measurement
[ "def", "unit_of_measurement", "(", "self", ")", "->", "str", ":", "return", "self", ".", "_unit_of_measurement" ]
[ 295, 4 ]
[ 297, 40 ]
python
en
['en', 'en', 'en']
True
HERETravelTimeSensor.icon
(self)
Icon to use in the frontend depending on travel_mode.
Icon to use in the frontend depending on travel_mode.
def icon(self) -> str: """Icon to use in the frontend depending on travel_mode.""" if self._here_data.travel_mode == TRAVEL_MODE_BICYCLE: return ICON_BICYCLE if self._here_data.travel_mode == TRAVEL_MODE_PEDESTRIAN: return ICON_PEDESTRIAN if self._here_data.travel...
[ "def", "icon", "(", "self", ")", "->", "str", ":", "if", "self", ".", "_here_data", ".", "travel_mode", "==", "TRAVEL_MODE_BICYCLE", ":", "return", "ICON_BICYCLE", "if", "self", ".", "_here_data", ".", "travel_mode", "==", "TRAVEL_MODE_PEDESTRIAN", ":", "retur...
[ 300, 4 ]
[ 310, 23 ]
python
en
['en', 'en', 'en']
True
HERETravelTimeSensor.async_update
(self)
Update Sensor Information.
Update Sensor Information.
async def async_update(self) -> None: """Update Sensor Information.""" # Convert device_trackers to HERE friendly location if self._origin_entity_id is not None: self._here_data.origin = await self._get_location_from_entity( self._origin_entity_id ) ...
[ "async", "def", "async_update", "(", "self", ")", "->", "None", ":", "# Convert device_trackers to HERE friendly location", "if", "self", ".", "_origin_entity_id", "is", "not", "None", ":", "self", ".", "_here_data", ".", "origin", "=", "await", "self", ".", "_g...
[ 312, 4 ]
[ 325, 70 ]
python
en
['en', 'nl', 'en']
True
HERETravelTimeSensor._get_location_from_entity
(self, entity_id: str)
Get the location from the entity state or attributes.
Get the location from the entity state or attributes.
async def _get_location_from_entity(self, entity_id: str) -> Optional[str]: """Get the location from the entity state or attributes.""" entity = self.hass.states.get(entity_id) if entity is None: _LOGGER.error("Unable to find entity %s", entity_id) return None #...
[ "async", "def", "_get_location_from_entity", "(", "self", ",", "entity_id", ":", "str", ")", "->", "Optional", "[", "str", "]", ":", "entity", "=", "self", ".", "hass", ".", "states", ".", "get", "(", "entity_id", ")", "if", "entity", "is", "None", ":"...
[ 327, 4 ]
[ 356, 19 ]
python
en
['en', 'en', 'en']
True
HERETravelTimeSensor._entity_state_is_valid_coordinate_set
(state: str)
Check that the given string is a valid set of coordinates.
Check that the given string is a valid set of coordinates.
def _entity_state_is_valid_coordinate_set(state: str) -> bool: """Check that the given string is a valid set of coordinates.""" schema = vol.Schema(cv.gps) try: coordinates = state.split(",") schema(coordinates) return True except (vol.MultipleInvalid)...
[ "def", "_entity_state_is_valid_coordinate_set", "(", "state", ":", "str", ")", "->", "bool", ":", "schema", "=", "vol", ".", "Schema", "(", "cv", ".", "gps", ")", "try", ":", "coordinates", "=", "state", ".", "split", "(", "\",\"", ")", "schema", "(", ...
[ 359, 4 ]
[ 367, 24 ]
python
en
['en', 'en', 'en']
True
HERETravelTimeSensor._get_location_from_attributes
(entity: State)
Get the lat/long string from an entities attributes.
Get the lat/long string from an entities attributes.
def _get_location_from_attributes(entity: State) -> str: """Get the lat/long string from an entities attributes.""" attr = entity.attributes return f"{attr.get(ATTR_LATITUDE)},{attr.get(ATTR_LONGITUDE)}"
[ "def", "_get_location_from_attributes", "(", "entity", ":", "State", ")", "->", "str", ":", "attr", "=", "entity", ".", "attributes", "return", "f\"{attr.get(ATTR_LATITUDE)},{attr.get(ATTR_LONGITUDE)}\"" ]
[ 370, 4 ]
[ 373, 70 ]
python
en
['en', 'en', 'en']
True
HERETravelTimeData.__init__
( self, here_client: herepy.RoutingApi, travel_mode: str, traffic_mode: bool, route_mode: str, units: str, arrival: datetime, departure: datetime, )
Initialize herepy.
Initialize herepy.
def __init__( self, here_client: herepy.RoutingApi, travel_mode: str, traffic_mode: bool, route_mode: str, units: str, arrival: datetime, departure: datetime, ) -> None: """Initialize herepy.""" self.origin = None self.destinati...
[ "def", "__init__", "(", "self", ",", "here_client", ":", "herepy", ".", "RoutingApi", ",", "travel_mode", ":", "str", ",", "traffic_mode", ":", "bool", ",", "route_mode", ":", "str", ",", "units", ":", "str", ",", "arrival", ":", "datetime", ",", "depart...
[ 379, 4 ]
[ 406, 34 ]
python
en
['en', 'zu', 'en']
False
HERETravelTimeData.update
(self)
Get the latest data from HERE.
Get the latest data from HERE.
def update(self) -> None: """Get the latest data from HERE.""" if self.traffic_mode: traffic_mode = TRAFFIC_MODE_ENABLED else: traffic_mode = TRAFFIC_MODE_DISABLED if self.destination is not None and self.origin is not None: # Convert location to HERE...
[ "def", "update", "(", "self", ")", "->", "None", ":", "if", "self", ".", "traffic_mode", ":", "traffic_mode", "=", "TRAFFIC_MODE_ENABLED", "else", ":", "traffic_mode", "=", "TRAFFIC_MODE_DISABLED", "if", "self", ".", "destination", "is", "not", "None", "and", ...
[ 408, 4 ]
[ 483, 65 ]
python
en
['en', 'en', 'en']
True
HERETravelTimeData._build_hass_attribution
(source_attribution: Dict)
Build a hass frontend ready string out of the sourceAttribution.
Build a hass frontend ready string out of the sourceAttribution.
def _build_hass_attribution(source_attribution: Dict) -> Optional[str]: """Build a hass frontend ready string out of the sourceAttribution.""" suppliers = source_attribution.get("supplier") if suppliers is not None: supplier_titles = [] for supplier in suppliers: ...
[ "def", "_build_hass_attribution", "(", "source_attribution", ":", "Dict", ")", "->", "Optional", "[", "str", "]", ":", "suppliers", "=", "source_attribution", ".", "get", "(", "\"supplier\"", ")", "if", "suppliers", "is", "not", "None", ":", "supplier_titles", ...
[ 486, 4 ]
[ 497, 30 ]
python
en
['en', 'en', 'en']
True
setup_platform
(hass, config, add_entities, discovery_info=None)
Set up the Gitter sensor.
Set up the Gitter sensor.
def setup_platform(hass, config, add_entities, discovery_info=None): """Set up the Gitter sensor.""" name = config.get(CONF_NAME) api_key = config.get(CONF_API_KEY) room = config.get(CONF_ROOM) gitter = GitterClient(api_key) try: username = gitter.auth.get_my_id["name"] except Gitt...
[ "def", "setup_platform", "(", "hass", ",", "config", ",", "add_entities", ",", "discovery_info", "=", "None", ")", ":", "name", "=", "config", ".", "get", "(", "CONF_NAME", ")", "api_key", "=", "config", ".", "get", "(", "CONF_API_KEY", ")", "room", "=",...
[ 32, 0 ]
[ 46, 68 ]
python
en
['en', 'no', 'en']
True
GitterSensor.__init__
(self, data, room, name, username)
Initialize the sensor.
Initialize the sensor.
def __init__(self, data, room, name, username): """Initialize the sensor.""" self._name = name self._data = data self._room = room self._username = username self._state = None self._mention = 0 self._unit_of_measurement = "Msg"
[ "def", "__init__", "(", "self", ",", "data", ",", "room", ",", "name", ",", "username", ")", ":", "self", ".", "_name", "=", "name", "self", ".", "_data", "=", "data", "self", ".", "_room", "=", "room", "self", ".", "_username", "=", "username", "s...
[ 52, 4 ]
[ 60, 41 ]
python
en
['en', 'en', 'en']
True
GitterSensor.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" ]
[ 63, 4 ]
[ 65, 25 ]
python
en
['en', 'mi', 'en']
True
GitterSensor.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" ]
[ 68, 4 ]
[ 70, 26 ]
python
en
['en', 'en', 'en']
True
GitterSensor.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._unit_of_measurement
[ "def", "unit_of_measurement", "(", "self", ")", ":", "return", "self", ".", "_unit_of_measurement" ]
[ 73, 4 ]
[ 75, 40 ]
python
en
['en', 'en', 'en']
True
GitterSensor.device_state_attributes
(self)
Return the state attributes.
Return the state attributes.
def device_state_attributes(self): """Return the state attributes.""" return { ATTR_USERNAME: self._username, ATTR_ROOM: self._room, ATTR_MENTION: self._mention, }
[ "def", "device_state_attributes", "(", "self", ")", ":", "return", "{", "ATTR_USERNAME", ":", "self", ".", "_username", ",", "ATTR_ROOM", ":", "self", ".", "_room", ",", "ATTR_MENTION", ":", "self", ".", "_mention", ",", "}" ]
[ 78, 4 ]
[ 84, 9 ]
python
en
['en', 'en', 'en']
True
GitterSensor.icon
(self)
Return the icon to use in the frontend, if any.
Return the icon to use in the frontend, if any.
def icon(self): """Return the icon to use in the frontend, if any.""" return ICON
[ "def", "icon", "(", "self", ")", ":", "return", "ICON" ]
[ 87, 4 ]
[ 89, 19 ]
python
en
['en', 'en', 'en']
True
GitterSensor.update
(self)
Get the latest data and updates the state.
Get the latest data and updates the state.
def update(self): """Get the latest data and updates the state.""" try: data = self._data.user.unread_items(self._room) except GitterRoomError as error: _LOGGER.error(error) return if "error" not in data: self._mention = len(data["mention...
[ "def", "update", "(", "self", ")", ":", "try", ":", "data", "=", "self", ".", "_data", ".", "user", ".", "unread_items", "(", "self", ".", "_room", ")", "except", "GitterRoomError", "as", "error", ":", "_LOGGER", ".", "error", "(", "error", ")", "ret...
[ 91, 4 ]
[ 104, 55 ]
python
en
['en', 'en', 'en']
True
test_mapping_integrity
()
Test ensures the map dicts have proper integrity.
Test ensures the map dicts have proper integrity.
async def test_mapping_integrity(): """Test ensures the map dicts have proper integrity.""" # Ensure every CAPABILITY_TO_ATTRIB key is in CAPABILITIES # Ensure every CAPABILITY_TO_ATTRIB value is in ATTRIB_TO_CLASS keys for capability, attrib in binary_sensor.CAPABILITY_TO_ATTRIB.items(): assert...
[ "async", "def", "test_mapping_integrity", "(", ")", ":", "# Ensure every CAPABILITY_TO_ATTRIB key is in CAPABILITIES", "# Ensure every CAPABILITY_TO_ATTRIB value is in ATTRIB_TO_CLASS keys", "for", "capability", ",", "attrib", "in", "binary_sensor", ".", "CAPABILITY_TO_ATTRIB", ".", ...
[ 20, 0 ]
[ 31, 59 ]
python
en
['en', 'en', 'en']
True
test_entity_state
(hass, device_factory)
Tests the state attributes properly match the light types.
Tests the state attributes properly match the light types.
async def test_entity_state(hass, device_factory): """Tests the state attributes properly match the light types.""" device = device_factory( "Motion Sensor 1", [Capability.motion_sensor], {Attribute.motion: "inactive"} ) await setup_platform(hass, BINARY_SENSOR_DOMAIN, devices=[device]) stat...
[ "async", "def", "test_entity_state", "(", "hass", ",", "device_factory", ")", ":", "device", "=", "device_factory", "(", "\"Motion Sensor 1\"", ",", "[", "Capability", ".", "motion_sensor", "]", ",", "{", "Attribute", ".", "motion", ":", "\"inactive\"", "}", "...
[ 34, 0 ]
[ 42, 87 ]
python
en
['en', 'en', 'en']
True
test_entity_and_device_attributes
(hass, device_factory)
Test the attributes of the entity are correct.
Test the attributes of the entity are correct.
async def test_entity_and_device_attributes(hass, device_factory): """Test the attributes of the entity are correct.""" # Arrange device = device_factory( "Motion Sensor 1", [Capability.motion_sensor], {Attribute.motion: "inactive"} ) entity_registry = await hass.helpers.entity_registry.asyn...
[ "async", "def", "test_entity_and_device_attributes", "(", "hass", ",", "device_factory", ")", ":", "# Arrange", "device", "=", "device_factory", "(", "\"Motion Sensor 1\"", ",", "[", "Capability", ".", "motion_sensor", "]", ",", "{", "Attribute", ".", "motion", ":...
[ 45, 0 ]
[ 63, 46 ]
python
en
['en', 'en', 'en']
True
test_update_from_signal
(hass, device_factory)
Test the binary_sensor updates when receiving a signal.
Test the binary_sensor updates when receiving a signal.
async def test_update_from_signal(hass, device_factory): """Test the binary_sensor updates when receiving a signal.""" # Arrange device = device_factory( "Motion Sensor 1", [Capability.motion_sensor], {Attribute.motion: "inactive"} ) await setup_platform(hass, BINARY_SENSOR_DOMAIN, devices=[...
[ "async", "def", "test_update_from_signal", "(", "hass", ",", "device_factory", ")", ":", "# Arrange", "device", "=", "device_factory", "(", "\"Motion Sensor 1\"", ",", "[", "Capability", ".", "motion_sensor", "]", ",", "{", "Attribute", ".", "motion", ":", "\"in...
[ 66, 0 ]
[ 82, 30 ]
python
en
['en', 'lb', 'en']
True
test_unload_config_entry
(hass, device_factory)
Test the binary_sensor is removed when the config entry is unloaded.
Test the binary_sensor is removed when the config entry is unloaded.
async def test_unload_config_entry(hass, device_factory): """Test the binary_sensor is removed when the config entry is unloaded.""" # Arrange device = device_factory( "Motion Sensor 1", [Capability.motion_sensor], {Attribute.motion: "inactive"} ) config_entry = await setup_platform(hass, BI...
[ "async", "def", "test_unload_config_entry", "(", "hass", ",", "device_factory", ")", ":", "# Arrange", "device", "=", "device_factory", "(", "\"Motion Sensor 1\"", ",", "[", "Capability", ".", "motion_sensor", "]", ",", "{", "Attribute", ".", "motion", ":", "\"i...
[ 85, 0 ]
[ 95, 70 ]
python
en
['en', 'en', 'en']
True
test_setup
( hass: HomeAssistantType, aioclient_mock: AiohttpClientMocker )
Test setup with basic config.
Test setup with basic config.
async def test_setup( hass: HomeAssistantType, aioclient_mock: AiohttpClientMocker ) -> None: """Test setup with basic config.""" await setup_integration(hass, aioclient_mock) assert hass.states.get(MAIN_ENTITY_ID) assert hass.states.get(CLIENT_ENTITY_ID) assert hass.states.get(UNAVAILABLE_ENTIT...
[ "async", "def", "test_setup", "(", "hass", ":", "HomeAssistantType", ",", "aioclient_mock", ":", "AiohttpClientMocker", ")", "->", "None", ":", "await", "setup_integration", "(", "hass", ",", "aioclient_mock", ")", "assert", "hass", ".", "states", ".", "get", ...
[ 21, 0 ]
[ 28, 49 ]
python
en
['en', 'zu', 'en']
True
test_unique_id
( hass: HomeAssistantType, aioclient_mock: AiohttpClientMocker )
Test unique id.
Test unique id.
async def test_unique_id( hass: HomeAssistantType, aioclient_mock: AiohttpClientMocker ) -> None: """Test unique id.""" await setup_integration(hass, aioclient_mock) entity_registry = await hass.helpers.entity_registry.async_get_registry() main = entity_registry.async_get(MAIN_ENTITY_ID) asser...
[ "async", "def", "test_unique_id", "(", "hass", ":", "HomeAssistantType", ",", "aioclient_mock", ":", "AiohttpClientMocker", ")", "->", "None", ":", "await", "setup_integration", "(", "hass", ",", "aioclient_mock", ")", "entity_registry", "=", "await", "hass", ".",...
[ 31, 0 ]
[ 46, 57 ]
python
en
['fr', 'la', 'en']
False
test_main_services
( hass: HomeAssistantType, aioclient_mock: AiohttpClientMocker )
Test the different services.
Test the different services.
async def test_main_services( hass: HomeAssistantType, aioclient_mock: AiohttpClientMocker ) -> None: """Test the different services.""" await setup_integration(hass, aioclient_mock) with patch("directv.DIRECTV.remote") as remote_mock: await hass.services.async_call( REMOTE_DOMAIN, ...
[ "async", "def", "test_main_services", "(", "hass", ":", "HomeAssistantType", ",", "aioclient_mock", ":", "AiohttpClientMocker", ")", "->", "None", ":", "await", "setup_integration", "(", "hass", ",", "aioclient_mock", ")", "with", "patch", "(", "\"directv.DIRECTV.re...
[ 49, 0 ]
[ 80, 56 ]
python
en
['en', 'en', 'en']
True
async_register
( hass: HomeAssistant, register: system_health.SystemHealthRegistration )
Register system health callbacks.
Register system health callbacks.
def async_register( hass: HomeAssistant, register: system_health.SystemHealthRegistration ) -> None: """Register system health callbacks.""" register.async_register_info(system_health_info)
[ "def", "async_register", "(", "hass", ":", "HomeAssistant", ",", "register", ":", "system_health", ".", "SystemHealthRegistration", ")", "->", "None", ":", "register", ".", "async_register_info", "(", "system_health_info", ")" ]
[ 7, 0 ]
[ 11, 52 ]
python
en
['en', 'sv', 'en']
True
system_health_info
(hass)
Get info for the info page.
Get info for the info page.
async def system_health_info(hass): """Get info for the info page.""" info = await system_info.async_get_system_info(hass) return { "version": info.get("version"), "installation_type": info.get("installation_type"), "dev": info.get("dev"), "hassio": info.get("hassio"), ...
[ "async", "def", "system_health_info", "(", "hass", ")", ":", "info", "=", "await", "system_info", ".", "async_get_system_info", "(", "hass", ")", "return", "{", "\"version\"", ":", "info", ".", "get", "(", "\"version\"", ")", ",", "\"installation_type\"", ":",...
[ 14, 0 ]
[ 30, 5 ]
python
en
['en', 'en', 'en']
True
to_wider_graph
(graph)
wider graph
wider graph
def to_wider_graph(graph): ''' wider graph ''' weighted_layer_ids = graph.wide_layer_ids() weighted_layer_ids = list( filter( lambda x: graph.layer_list[x].output.shape[-1], weighted_layer_ids) ) wider_layers = sample(weighted_layer_ids, 1) for layer_id in wider_layers: ...
[ "def", "to_wider_graph", "(", "graph", ")", ":", "weighted_layer_ids", "=", "graph", ".", "wide_layer_ids", "(", ")", "weighted_layer_ids", "=", "list", "(", "filter", "(", "lambda", "x", ":", "graph", ".", "layer_list", "[", "x", "]", ".", "output", ".", ...
[ 20, 0 ]
[ 38, 16 ]
python
de
['de', 'de', 'ur']
False
to_skip_connection_graph
(graph)
skip connection graph
skip connection graph
def to_skip_connection_graph(graph): ''' skip connection graph ''' # The last conv layer cannot be widen since wider operator cannot be done # over the two sides of flatten. weighted_layer_ids = graph.skip_connection_layer_ids() valid_connection = [] for skip_type in sorted( [Net...
[ "def", "to_skip_connection_graph", "(", "graph", ")", ":", "# The last conv layer cannot be widen since wider operator cannot be done", "# over the two sides of flatten.", "weighted_layer_ids", "=", "graph", ".", "skip_connection_layer_ids", "(", ")", "valid_connection", "=", "[", ...
[ 41, 0 ]
[ 63, 16 ]
python
en
['sv', 'fr', 'en']
False
create_new_layer
(layer, n_dim)
create new layer for the graph
create new layer for the graph
def create_new_layer(layer, n_dim): ''' create new layer for the graph ''' input_shape = layer.output.shape dense_deeper_classes = [StubDense, get_dropout_class(n_dim), StubReLU] conv_deeper_classes = [ get_conv_class(n_dim), get_batch_norm_class(n_dim), StubReLU] if is...
[ "def", "create_new_layer", "(", "layer", ",", "n_dim", ")", ":", "input_shape", "=", "layer", ".", "output", ".", "shape", "dense_deeper_classes", "=", "[", "StubDense", ",", "get_dropout_class", "(", "n_dim", ")", ",", "StubReLU", "]", "conv_deeper_classes", ...
[ 66, 0 ]
[ 114, 20 ]
python
en
['en', 'en', 'en']
True
to_deeper_graph
(graph)
deeper graph
deeper graph
def to_deeper_graph(graph): ''' deeper graph ''' weighted_layer_ids = graph.deep_layer_ids() if len(weighted_layer_ids) >= Constant.MAX_LAYERS: return None deeper_layer_ids = sample(weighted_layer_ids, 1) for layer_id in deeper_layer_ids: layer = graph.layer_list[layer_id] ...
[ "def", "to_deeper_graph", "(", "graph", ")", ":", "weighted_layer_ids", "=", "graph", ".", "deep_layer_ids", "(", ")", "if", "len", "(", "weighted_layer_ids", ")", ">=", "Constant", ".", "MAX_LAYERS", ":", "return", "None", "deeper_layer_ids", "=", "sample", "...
[ 117, 0 ]
[ 131, 16 ]
python
en
['it', 'lb', 'en']
False
legal_graph
(graph)
judge if a graph is legal or not.
judge if a graph is legal or not.
def legal_graph(graph): '''judge if a graph is legal or not. ''' descriptor = graph.extract_descriptor() skips = descriptor.skip_connections if len(skips) != len(set(skips)): return False return True
[ "def", "legal_graph", "(", "graph", ")", ":", "descriptor", "=", "graph", ".", "extract_descriptor", "(", ")", "skips", "=", "descriptor", ".", "skip_connections", "if", "len", "(", "skips", ")", "!=", "len", "(", "set", "(", "skips", ")", ")", ":", "r...
[ 134, 0 ]
[ 142, 15 ]
python
en
['en', 'en', 'en']
True
transform
(graph)
core transform function for graph.
core transform function for graph.
def transform(graph): '''core transform function for graph. ''' graphs = [] for _ in range(Constant.N_NEIGHBOURS * 2): random_num = randrange(3) temp_graph = None if random_num == 0: temp_graph = to_deeper_graph(deepcopy(graph)) elif random_num == 1: ...
[ "def", "transform", "(", "graph", ")", ":", "graphs", "=", "[", "]", "for", "_", "in", "range", "(", "Constant", ".", "N_NEIGHBOURS", "*", "2", ")", ":", "random_num", "=", "randrange", "(", "3", ")", "temp_graph", "=", "None", "if", "random_num", "=...
[ 145, 0 ]
[ 166, 17 ]
python
en
['en', 'en', 'en']
True
get_scanner
(hass, config)
Validate the configuration and return a Cisco ME scanner.
Validate the configuration and return a Cisco ME scanner.
def get_scanner(hass, config): """Validate the configuration and return a Cisco ME scanner.""" config = config[DOMAIN] controller = CiscoMobilityExpress( config[CONF_HOST], config[CONF_USERNAME], config[CONF_PASSWORD], config[CONF_SSL], config[CONF_VERIFY_SSL], ...
[ "def", "get_scanner", "(", "hass", ",", "config", ")", ":", "config", "=", "config", "[", "DOMAIN", "]", "controller", "=", "CiscoMobilityExpress", "(", "config", "[", "CONF_HOST", "]", ",", "config", "[", "CONF_USERNAME", "]", ",", "config", "[", "CONF_PA...
[ 36, 0 ]
[ 50, 43 ]
python
en
['en', 'en', 'en']
True
CiscoMEDeviceScanner.__init__
(self, controller)
Initialize the scanner.
Initialize the scanner.
def __init__(self, controller): """Initialize the scanner.""" self.controller = controller self.last_results = {}
[ "def", "__init__", "(", "self", ",", "controller", ")", ":", "self", ".", "controller", "=", "controller", "self", ".", "last_results", "=", "{", "}" ]
[ 56, 4 ]
[ 59, 30 ]
python
en
['en', 'en', 'en']
True
CiscoMEDeviceScanner.scan_devices
(self)
Scan for new devices and return a list with found device IDs.
Scan for new devices and return a list with found device IDs.
def scan_devices(self): """Scan for new devices and return a list with found device IDs.""" self._update_info() return [device.macaddr for device in self.last_results]
[ "def", "scan_devices", "(", "self", ")", ":", "self", ".", "_update_info", "(", ")", "return", "[", "device", ".", "macaddr", "for", "device", "in", "self", ".", "last_results", "]" ]
[ 61, 4 ]
[ 65, 63 ]
python
en
['en', 'en', 'en']
True
CiscoMEDeviceScanner.get_device_name
(self, device)
Return the name of the given device or None if we don't know.
Return the name of the given device or None if we don't know.
def get_device_name(self, device): """Return the name of the given device or None if we don't know.""" name = next( (result.clId for result in self.last_results if result.macaddr == device), None, ) return name
[ "def", "get_device_name", "(", "self", ",", "device", ")", ":", "name", "=", "next", "(", "(", "result", ".", "clId", "for", "result", "in", "self", ".", "last_results", "if", "result", ".", "macaddr", "==", "device", ")", ",", "None", ",", ")", "ret...
[ 67, 4 ]
[ 73, 19 ]
python
en
['en', 'en', 'en']
True
CiscoMEDeviceScanner.get_extra_attributes
(self, device)
Get extra attributes of a device. Some known extra attributes that may be returned in the device tuple include SSID, PT (eg 802.11ac), devtype (eg iPhone 7) among others.
Get extra attributes of a device.
def get_extra_attributes(self, device): """ Get extra attributes of a device. Some known extra attributes that may be returned in the device tuple include SSID, PT (eg 802.11ac), devtype (eg iPhone 7) among others. """ device = next( (result for result in sel...
[ "def", "get_extra_attributes", "(", "self", ",", "device", ")", ":", "device", "=", "next", "(", "(", "result", "for", "result", "in", "self", ".", "last_results", "if", "result", ".", "macaddr", "==", "device", ")", ",", "None", ")", "return", "device",...
[ 75, 4 ]
[ 85, 31 ]
python
en
['en', 'error', 'th']
False
CiscoMEDeviceScanner._update_info
(self)
Check the Cisco ME controller for devices.
Check the Cisco ME controller for devices.
def _update_info(self): """Check the Cisco ME controller for devices.""" self.last_results = self.controller.get_associated_devices() _LOGGER.debug( "Cisco Mobility Express controller returned: %s", self.last_results )
[ "def", "_update_info", "(", "self", ")", ":", "self", ".", "last_results", "=", "self", ".", "controller", ".", "get_associated_devices", "(", ")", "_LOGGER", ".", "debug", "(", "\"Cisco Mobility Express controller returned: %s\"", ",", "self", ".", "last_results", ...
[ 87, 4 ]
[ 92, 9 ]
python
en
['en', 'en', 'en']
True
create_file
(path)
Create a test file.
Create a test file.
def create_file(path): """Create a test file.""" with open(path, "w") as test_file: test_file.write("test")
[ "def", "create_file", "(", "path", ")", ":", "with", "open", "(", "path", ",", "\"w\"", ")", "as", "test_file", ":", "test_file", ".", "write", "(", "\"test\"", ")" ]
[ 13, 0 ]
[ 16, 31 ]
python
en
['en', 'sm', 'en']
True
remove_test_file
()
Remove test file.
Remove test file.
def remove_test_file(): """Remove test file.""" if os.path.isfile(TEST_FILE): os.remove(TEST_FILE) os.rmdir(TEST_DIR)
[ "def", "remove_test_file", "(", ")", ":", "if", "os", ".", "path", ".", "isfile", "(", "TEST_FILE", ")", ":", "os", ".", "remove", "(", "TEST_FILE", ")", "os", ".", "rmdir", "(", "TEST_DIR", ")" ]
[ 19, 0 ]
[ 23, 26 ]
python
en
['en', 'it', 'en']
True
test_invalid_path
(hass)
Test that an invalid path is caught.
Test that an invalid path is caught.
async def test_invalid_path(hass): """Test that an invalid path is caught.""" config = {"sensor": {"platform": "folder", CONF_FOLDER_PATHS: "invalid_path"}} assert await async_setup_component(hass, "sensor", config) assert len(hass.states.async_entity_ids()) == 0
[ "async", "def", "test_invalid_path", "(", "hass", ")", ":", "config", "=", "{", "\"sensor\"", ":", "{", "\"platform\"", ":", "\"folder\"", ",", "CONF_FOLDER_PATHS", ":", "\"invalid_path\"", "}", "}", "assert", "await", "async_setup_component", "(", "hass", ",", ...
[ 26, 0 ]
[ 30, 51 ]
python
en
['en', 'en', 'en']
True
test_valid_path
(hass)
Test for a valid path.
Test for a valid path.
async def test_valid_path(hass): """Test for a valid path.""" if not os.path.isdir(TEST_DIR): os.mkdir(TEST_DIR) create_file(TEST_FILE) hass.config.allowlist_external_dirs = {TEST_DIR} config = {"sensor": {"platform": "folder", CONF_FOLDER_PATHS: TEST_DIR}} assert await async_setup_comp...
[ "async", "def", "test_valid_path", "(", "hass", ")", ":", "if", "not", "os", ".", "path", ".", "isdir", "(", "TEST_DIR", ")", ":", "os", ".", "mkdir", "(", "TEST_DIR", ")", "create_file", "(", "TEST_FILE", ")", "hass", ".", "config", ".", "allowlist_ex...
[ 33, 0 ]
[ 48, 22 ]
python
en
['en', 'en', 'en']
True
TestTCPSensor.setup_method
(self, method)
Set up things to be run when tests are started.
Set up things to be run when tests are started.
def setup_method(self, method): """Set up things to be run when tests are started.""" self.hass = get_test_home_assistant()
[ "def", "setup_method", "(", "self", ",", "method", ")", ":", "self", ".", "hass", "=", "get_test_home_assistant", "(", ")" ]
[ 41, 4 ]
[ 43, 45 ]
python
en
['en', 'en', 'en']
True
TestTCPSensor.teardown_method
(self, method)
Stop everything that was started.
Stop everything that was started.
def teardown_method(self, method): """Stop everything that was started.""" self.hass.stop()
[ "def", "teardown_method", "(", "self", ",", "method", ")", ":", "self", ".", "hass", ".", "stop", "(", ")" ]
[ 45, 4 ]
[ 47, 24 ]
python
en
['en', 'en', 'en']
True
TestTCPSensor.test_setup_platform_valid_config
(self, mock_update)
Check a valid configuration and call add_entities with sensor.
Check a valid configuration and call add_entities with sensor.
def test_setup_platform_valid_config(self, mock_update): """Check a valid configuration and call add_entities with sensor.""" with assert_setup_component(0, "sensor"): assert setup_component(self.hass, "sensor", TEST_CONFIG) add_entities = Mock() tcp.setup_platform(None, TES...
[ "def", "test_setup_platform_valid_config", "(", "self", ",", "mock_update", ")", ":", "with", "assert_setup_component", "(", "0", ",", "\"sensor\"", ")", ":", "assert", "setup_component", "(", "self", ".", "hass", ",", "\"sensor\"", ",", "TEST_CONFIG", ")", "add...
[ 50, 4 ]
[ 58, 73 ]
python
en
['en', 'en', 'en']
True
TestTCPSensor.test_setup_platform_invalid_config
(self)
Check an invalid configuration.
Check an invalid configuration.
def test_setup_platform_invalid_config(self): """Check an invalid configuration.""" with assert_setup_component(0): assert setup_component( self.hass, "sensor", {"sensor": {"platform": "tcp", "porrt": 1234}} )
[ "def", "test_setup_platform_invalid_config", "(", "self", ")", ":", "with", "assert_setup_component", "(", "0", ")", ":", "assert", "setup_component", "(", "self", ".", "hass", ",", "\"sensor\"", ",", "{", "\"sensor\"", ":", "{", "\"platform\"", ":", "\"tcp\"", ...
[ 60, 4 ]
[ 65, 13 ]
python
en
['en', 'en', 'en']
True
TestTCPSensor.test_name
(self, mock_update)
Return the name if set in the configuration.
Return the name if set in the configuration.
def test_name(self, mock_update): """Return the name if set in the configuration.""" sensor = tcp.TcpSensor(self.hass, TEST_CONFIG["sensor"]) assert sensor.name == TEST_CONFIG["sensor"][tcp.CONF_NAME]
[ "def", "test_name", "(", "self", ",", "mock_update", ")", ":", "sensor", "=", "tcp", ".", "TcpSensor", "(", "self", ".", "hass", ",", "TEST_CONFIG", "[", "\"sensor\"", "]", ")", "assert", "sensor", ".", "name", "==", "TEST_CONFIG", "[", "\"sensor\"", "]"...
[ 68, 4 ]
[ 71, 66 ]
python
en
['en', 'en', 'en']
True
TestTCPSensor.test_name_not_set
(self, mock_update)
Return the superclass name property if not set in configuration.
Return the superclass name property if not set in configuration.
def test_name_not_set(self, mock_update): """Return the superclass name property if not set in configuration.""" config = copy(TEST_CONFIG["sensor"]) del config[tcp.CONF_NAME] entity = Entity() sensor = tcp.TcpSensor(self.hass, config) assert sensor.name == entity.name
[ "def", "test_name_not_set", "(", "self", ",", "mock_update", ")", ":", "config", "=", "copy", "(", "TEST_CONFIG", "[", "\"sensor\"", "]", ")", "del", "config", "[", "tcp", ".", "CONF_NAME", "]", "entity", "=", "Entity", "(", ")", "sensor", "=", "tcp", ...
[ 74, 4 ]
[ 80, 41 ]
python
en
['en', 'en', 'en']
True
TestTCPSensor.test_state
(self, mock_update)
Return the contents of _state.
Return the contents of _state.
def test_state(self, mock_update): """Return the contents of _state.""" sensor = tcp.TcpSensor(self.hass, TEST_CONFIG["sensor"]) uuid = str(uuid4()) sensor._state = uuid assert sensor.state == uuid
[ "def", "test_state", "(", "self", ",", "mock_update", ")", ":", "sensor", "=", "tcp", ".", "TcpSensor", "(", "self", ".", "hass", ",", "TEST_CONFIG", "[", "\"sensor\"", "]", ")", "uuid", "=", "str", "(", "uuid4", "(", ")", ")", "sensor", ".", "_state...
[ 83, 4 ]
[ 88, 35 ]
python
en
['en', 'en', 'en']
True
TestTCPSensor.test_unit_of_measurement
(self, mock_update)
Return the configured unit of measurement.
Return the configured unit of measurement.
def test_unit_of_measurement(self, mock_update): """Return the configured unit of measurement.""" sensor = tcp.TcpSensor(self.hass, TEST_CONFIG["sensor"]) assert ( sensor.unit_of_measurement == TEST_CONFIG["sensor"][tcp.CONF_UNIT_OF_MEASUREMENT] )
[ "def", "test_unit_of_measurement", "(", "self", ",", "mock_update", ")", ":", "sensor", "=", "tcp", ".", "TcpSensor", "(", "self", ".", "hass", ",", "TEST_CONFIG", "[", "\"sensor\"", "]", ")", "assert", "(", "sensor", ".", "unit_of_measurement", "==", "TEST_...
[ 91, 4 ]
[ 97, 9 ]
python
en
['en', 'la', 'en']
True
TestTCPSensor.test_config_valid_keys
(self, *args)
Store valid keys in _config.
Store valid keys in _config.
def test_config_valid_keys(self, *args): """Store valid keys in _config.""" sensor = tcp.TcpSensor(self.hass, TEST_CONFIG["sensor"]) del TEST_CONFIG["sensor"]["platform"] for key in TEST_CONFIG["sensor"]: assert key in sensor._config
[ "def", "test_config_valid_keys", "(", "self", ",", "*", "args", ")", ":", "sensor", "=", "tcp", ".", "TcpSensor", "(", "self", ".", "hass", ",", "TEST_CONFIG", "[", "\"sensor\"", "]", ")", "del", "TEST_CONFIG", "[", "\"sensor\"", "]", "[", "\"platform\"", ...
[ 100, 4 ]
[ 106, 40 ]
python
en
['en', 'af', 'en']
True
TestTCPSensor.test_validate_config_valid_keys
(self)
Return True when provided with the correct keys.
Return True when provided with the correct keys.
def test_validate_config_valid_keys(self): """Return True when provided with the correct keys.""" with assert_setup_component(0, "sensor"): assert setup_component(self.hass, "sensor", TEST_CONFIG)
[ "def", "test_validate_config_valid_keys", "(", "self", ")", ":", "with", "assert_setup_component", "(", "0", ",", "\"sensor\"", ")", ":", "assert", "setup_component", "(", "self", ".", "hass", ",", "\"sensor\"", ",", "TEST_CONFIG", ")" ]
[ 108, 4 ]
[ 111, 68 ]
python
en
['en', 'en', 'en']
True
TestTCPSensor.test_config_invalid_keys
(self, mock_update)
Shouldn't store invalid keys in _config.
Shouldn't store invalid keys in _config.
def test_config_invalid_keys(self, mock_update): """Shouldn't store invalid keys in _config.""" config = copy(TEST_CONFIG["sensor"]) config.update({"a": "test_a", "b": "test_b", "c": "test_c"}) sensor = tcp.TcpSensor(self.hass, config) for invalid_key in "abc": assert...
[ "def", "test_config_invalid_keys", "(", "self", ",", "mock_update", ")", ":", "config", "=", "copy", "(", "TEST_CONFIG", "[", "\"sensor\"", "]", ")", "config", ".", "update", "(", "{", "\"a\"", ":", "\"test_a\"", ",", "\"b\"", ":", "\"test_b\"", ",", "\"c\...
[ 114, 4 ]
[ 120, 52 ]
python
en
['en', 'en', 'en']
True
TestTCPSensor.test_validate_config_invalid_keys
(self)
Test with invalid keys plus some extra.
Test with invalid keys plus some extra.
def test_validate_config_invalid_keys(self): """Test with invalid keys plus some extra.""" config = copy(TEST_CONFIG["sensor"]) config.update({"a": "test_a", "b": "test_b", "c": "test_c"}) with assert_setup_component(0, "sensor"): assert setup_component(self.hass, "sensor", {...
[ "def", "test_validate_config_invalid_keys", "(", "self", ")", ":", "config", "=", "copy", "(", "TEST_CONFIG", "[", "\"sensor\"", "]", ")", "config", ".", "update", "(", "{", "\"a\"", ":", "\"test_a\"", ",", "\"b\"", ":", "\"test_b\"", ",", "\"c\"", ":", "\...
[ 122, 4 ]
[ 127, 72 ]
python
en
['en', 'en', 'en']
True
TestTCPSensor.test_config_uses_defaults
(self, mock_update)
Check if defaults were set.
Check if defaults were set.
def test_config_uses_defaults(self, mock_update): """Check if defaults were set.""" config = copy(TEST_CONFIG["sensor"]) for key in KEYS_AND_DEFAULTS: del config[key] with assert_setup_component(1) as result_config: assert setup_component(self.hass, "sensor", {"...
[ "def", "test_config_uses_defaults", "(", "self", ",", "mock_update", ")", ":", "config", "=", "copy", "(", "TEST_CONFIG", "[", "\"sensor\"", "]", ")", "for", "key", "in", "KEYS_AND_DEFAULTS", ":", "del", "config", "[", "key", "]", "with", "assert_setup_compone...
[ 130, 4 ]
[ 143, 49 ]
python
en
['en', 'en', 'en']
True
TestTCPSensor.test_validate_config_missing_defaults
(self)
Return True when defaulted keys are not provided.
Return True when defaulted keys are not provided.
def test_validate_config_missing_defaults(self): """Return True when defaulted keys are not provided.""" config = copy(TEST_CONFIG["sensor"]) for key in KEYS_AND_DEFAULTS: del config[key] with assert_setup_component(0, "sensor"): assert setup_component(self.hass...
[ "def", "test_validate_config_missing_defaults", "(", "self", ")", ":", "config", "=", "copy", "(", "TEST_CONFIG", "[", "\"sensor\"", "]", ")", "for", "key", "in", "KEYS_AND_DEFAULTS", ":", "del", "config", "[", "key", "]", "with", "assert_setup_component", "(", ...
[ 145, 4 ]
[ 153, 72 ]
python
en
['en', 'en', 'en']
True
TestTCPSensor.test_validate_config_missing_required
(self)
Return False when required config items are missing.
Return False when required config items are missing.
def test_validate_config_missing_required(self): """Return False when required config items are missing.""" for key in TEST_CONFIG["sensor"]: if key in KEYS_AND_DEFAULTS: continue config = copy(TEST_CONFIG["sensor"]) del config[key] with as...
[ "def", "test_validate_config_missing_required", "(", "self", ")", ":", "for", "key", "in", "TEST_CONFIG", "[", "\"sensor\"", "]", ":", "if", "key", "in", "KEYS_AND_DEFAULTS", ":", "continue", "config", "=", "copy", "(", "TEST_CONFIG", "[", "\"sensor\"", "]", "...
[ 155, 4 ]
[ 163, 76 ]
python
en
['en', 'en', 'en']
True
TestTCPSensor.test_init_calls_update
(self, mock_update)
Call update() method during __init__().
Call update() method during __init__().
def test_init_calls_update(self, mock_update): """Call update() method during __init__().""" tcp.TcpSensor(self.hass, TEST_CONFIG) assert mock_update.called
[ "def", "test_init_calls_update", "(", "self", ",", "mock_update", ")", ":", "tcp", ".", "TcpSensor", "(", "self", ".", "hass", ",", "TEST_CONFIG", ")", "assert", "mock_update", ".", "called" ]
[ 166, 4 ]
[ 169, 33 ]
python
en
['en', 'en', 'en']
True
TestTCPSensor.test_update_connects_to_host_and_port
(self, mock_select, mock_socket)
Connect to the configured host and port.
Connect to the configured host and port.
def test_update_connects_to_host_and_port(self, mock_select, mock_socket): """Connect to the configured host and port.""" tcp.TcpSensor(self.hass, TEST_CONFIG["sensor"]) mock_socket = mock_socket().__enter__() assert mock_socket.connect.mock_calls[0][1] == ( ( ...
[ "def", "test_update_connects_to_host_and_port", "(", "self", ",", "mock_select", ",", "mock_socket", ")", ":", "tcp", ".", "TcpSensor", "(", "self", ".", "hass", ",", "TEST_CONFIG", "[", "\"sensor\"", "]", ")", "mock_socket", "=", "mock_socket", "(", ")", ".",...
[ 173, 4 ]
[ 182, 9 ]
python
en
['en', 'en', 'en']
True
TestTCPSensor.test_update_returns_if_connecting_fails
(self, *args)
Return if connecting to host fails.
Return if connecting to host fails.
def test_update_returns_if_connecting_fails(self, *args): """Return if connecting to host fails.""" with patch("homeassistant.components.tcp.sensor.TcpSensor.update"): sensor = tcp.TcpSensor(self.hass, TEST_CONFIG["sensor"]) assert sensor.update() is None
[ "def", "test_update_returns_if_connecting_fails", "(", "self", ",", "*", "args", ")", ":", "with", "patch", "(", "\"homeassistant.components.tcp.sensor.TcpSensor.update\"", ")", ":", "sensor", "=", "tcp", ".", "TcpSensor", "(", "self", ".", "hass", ",", "TEST_CONFIG...
[ 185, 4 ]
[ 189, 38 ]
python
en
['en', 'en', 'en']
True
TestTCPSensor.test_update_returns_if_sending_fails
(self, *args)
Return if sending fails.
Return if sending fails.
def test_update_returns_if_sending_fails(self, *args): """Return if sending fails.""" with patch("homeassistant.components.tcp.sensor.TcpSensor.update"): sensor = tcp.TcpSensor(self.hass, TEST_CONFIG["sensor"]) assert sensor.update() is None
[ "def", "test_update_returns_if_sending_fails", "(", "self", ",", "*", "args", ")", ":", "with", "patch", "(", "\"homeassistant.components.tcp.sensor.TcpSensor.update\"", ")", ":", "sensor", "=", "tcp", ".", "TcpSensor", "(", "self", ".", "hass", ",", "TEST_CONFIG", ...
[ 193, 4 ]
[ 197, 38 ]
python
en
['ms', 'no', 'en']
False
TestTCPSensor.test_update_returns_if_select_fails
(self, *args)
Return if select fails to return a socket.
Return if select fails to return a socket.
def test_update_returns_if_select_fails(self, *args): """Return if select fails to return a socket.""" with patch("homeassistant.components.tcp.sensor.TcpSensor.update"): sensor = tcp.TcpSensor(self.hass, TEST_CONFIG["sensor"]) assert sensor.update() is None
[ "def", "test_update_returns_if_select_fails", "(", "self", ",", "*", "args", ")", ":", "with", "patch", "(", "\"homeassistant.components.tcp.sensor.TcpSensor.update\"", ")", ":", "sensor", "=", "tcp", ".", "TcpSensor", "(", "self", ".", "hass", ",", "TEST_CONFIG", ...
[ 202, 4 ]
[ 206, 38 ]
python
en
['en', 'bg', 'en']
True
TestTCPSensor.test_update_sends_payload
(self, mock_select, mock_socket)
Send the configured payload as bytes.
Send the configured payload as bytes.
def test_update_sends_payload(self, mock_select, mock_socket): """Send the configured payload as bytes.""" tcp.TcpSensor(self.hass, TEST_CONFIG["sensor"]) mock_socket = mock_socket().__enter__() mock_socket.send.assert_called_with( TEST_CONFIG["sensor"][tcp.CONF_PAYLOAD].enco...
[ "def", "test_update_sends_payload", "(", "self", ",", "mock_select", ",", "mock_socket", ")", ":", "tcp", ".", "TcpSensor", "(", "self", ".", "hass", ",", "TEST_CONFIG", "[", "\"sensor\"", "]", ")", "mock_socket", "=", "mock_socket", "(", ")", ".", "__enter_...
[ 210, 4 ]
[ 216, 9 ]
python
en
['en', 'en', 'en']
True
TestTCPSensor.test_update_calls_select_with_timeout
(self, mock_select, mock_socket)
Provide the timeout argument to select.
Provide the timeout argument to select.
def test_update_calls_select_with_timeout(self, mock_select, mock_socket): """Provide the timeout argument to select.""" tcp.TcpSensor(self.hass, TEST_CONFIG["sensor"]) mock_socket = mock_socket().__enter__() mock_select.assert_called_with( [mock_socket], [], [], TEST_CONFIG[...
[ "def", "test_update_calls_select_with_timeout", "(", "self", ",", "mock_select", ",", "mock_socket", ")", ":", "tcp", ".", "TcpSensor", "(", "self", ".", "hass", ",", "TEST_CONFIG", "[", "\"sensor\"", "]", ")", "mock_socket", "=", "mock_socket", "(", ")", ".",...
[ 220, 4 ]
[ 226, 9 ]
python
en
['en', 'en', 'en']
True
TestTCPSensor.test_update_receives_packet_and_sets_as_state
(self, mock_select, mock_socket)
Test the response from the socket and set it as the state.
Test the response from the socket and set it as the state.
def test_update_receives_packet_and_sets_as_state(self, mock_select, mock_socket): """Test the response from the socket and set it as the state.""" test_value = "test_value" mock_socket = mock_socket().__enter__() mock_socket.recv.return_value = test_value.encode() config = copy(...
[ "def", "test_update_receives_packet_and_sets_as_state", "(", "self", ",", "mock_select", ",", "mock_socket", ")", ":", "test_value", "=", "\"test_value\"", "mock_socket", "=", "mock_socket", "(", ")", ".", "__enter__", "(", ")", "mock_socket", ".", "recv", ".", "r...
[ 230, 4 ]
[ 238, 42 ]
python
en
['en', 'en', 'en']
True
TestTCPSensor.test_update_renders_value_in_template
(self, mock_select, mock_socket)
Render the value in the provided template.
Render the value in the provided template.
def test_update_renders_value_in_template(self, mock_select, mock_socket): """Render the value in the provided template.""" test_value = "test_value" mock_socket = mock_socket().__enter__() mock_socket.recv.return_value = test_value.encode() config = copy(TEST_CONFIG["sensor"]) ...
[ "def", "test_update_renders_value_in_template", "(", "self", ",", "mock_select", ",", "mock_socket", ")", ":", "test_value", "=", "\"test_value\"", "mock_socket", "=", "mock_socket", "(", ")", ".", "__enter__", "(", ")", "mock_socket", ".", "recv", ".", "return_va...
[ 242, 4 ]
[ 250, 51 ]
python
en
['en', 'en', 'en']
True
TestTCPSensor.test_update_returns_if_template_render_fails
(self, mock_select, mock_socket)
Return None if rendering the template fails.
Return None if rendering the template fails.
def test_update_returns_if_template_render_fails(self, mock_select, mock_socket): """Return None if rendering the template fails.""" test_value = "test_value" mock_socket = mock_socket().__enter__() mock_socket.recv.return_value = test_value.encode() config = copy(TEST_CONFIG["se...
[ "def", "test_update_returns_if_template_render_fails", "(", "self", ",", "mock_select", ",", "mock_socket", ")", ":", "test_value", "=", "\"test_value\"", "mock_socket", "=", "mock_socket", "(", ")", ".", "__enter__", "(", ")", "mock_socket", ".", "recv", ".", "re...
[ 254, 4 ]
[ 262, 38 ]
python
en
['en', 'en', 'en']
True
test_zodiac_day
(hass, now, sign, element, modality)
Test the zodiac sensor.
Test the zodiac sensor.
async def test_zodiac_day(hass, now, sign, element, modality): """Test the zodiac sensor.""" config = {DOMAIN: {}} with patch("homeassistant.components.zodiac.sensor.utcnow", return_value=now): assert await async_setup_component(hass, DOMAIN, config) await hass.async_block_till_done() ...
[ "async", "def", "test_zodiac_day", "(", "hass", ",", "now", ",", "sign", ",", "element", ",", "modality", ")", ":", "config", "=", "{", "DOMAIN", ":", "{", "}", "}", "with", "patch", "(", "\"homeassistant.components.zodiac.sensor.utcnow\"", ",", "return_value"...
[ 36, 0 ]
[ 49, 54 ]
python
en
['en', 'bg-Latn', 'en']
True
AirVisualFlowHandler.__init__
(self)
Initialize the config flow.
Initialize the config flow.
def __init__(self): """Initialize the config flow.""" self._geo_id = None self._latitude = None self._longitude = None self.api_key_data_schema = vol.Schema({vol.Required(CONF_API_KEY): str})
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "_geo_id", "=", "None", "self", ".", "_latitude", "=", "None", "self", ".", "_longitude", "=", "None", "self", ".", "api_key_data_schema", "=", "vol", ".", "Schema", "(", "{", "vol", ".", "Required...
[ 36, 4 ]
[ 42, 80 ]
python
en
['en', 'en', 'en']
True
AirVisualFlowHandler.geography_schema
(self)
Return the data schema for the cloud API.
Return the data schema for the cloud API.
def geography_schema(self): """Return the data schema for the cloud API.""" return self.api_key_data_schema.extend( { vol.Required( CONF_LATITUDE, default=self.hass.config.latitude ): cv.latitude, vol.Required( ...
[ "def", "geography_schema", "(", "self", ")", ":", "return", "self", ".", "api_key_data_schema", ".", "extend", "(", "{", "vol", ".", "Required", "(", "CONF_LATITUDE", ",", "default", "=", "self", ".", "hass", ".", "config", ".", "latitude", ")", ":", "cv...
[ 45, 4 ]
[ 56, 9 ]
python
en
['en', 'en', 'en']
True
AirVisualFlowHandler.pick_integration_type_schema
(self)
Return the data schema for picking the integration type.
Return the data schema for picking the integration type.
def pick_integration_type_schema(self): """Return the data schema for picking the integration type.""" return vol.Schema( { vol.Required("type"): vol.In( [INTEGRATION_TYPE_GEOGRAPHY, INTEGRATION_TYPE_NODE_PRO] ) } )
[ "def", "pick_integration_type_schema", "(", "self", ")", ":", "return", "vol", ".", "Schema", "(", "{", "vol", ".", "Required", "(", "\"type\"", ")", ":", "vol", ".", "In", "(", "[", "INTEGRATION_TYPE_GEOGRAPHY", ",", "INTEGRATION_TYPE_NODE_PRO", "]", ")", "...
[ 59, 4 ]
[ 67, 9 ]
python
en
['en', 'en', 'en']
True
AirVisualFlowHandler.node_pro_schema
(self)
Return the data schema for a Node/Pro.
Return the data schema for a Node/Pro.
def node_pro_schema(self): """Return the data schema for a Node/Pro.""" return vol.Schema( {vol.Required(CONF_IP_ADDRESS): str, vol.Required(CONF_PASSWORD): str} )
[ "def", "node_pro_schema", "(", "self", ")", ":", "return", "vol", ".", "Schema", "(", "{", "vol", ".", "Required", "(", "CONF_IP_ADDRESS", ")", ":", "str", ",", "vol", ".", "Required", "(", "CONF_PASSWORD", ")", ":", "str", "}", ")" ]
[ 70, 4 ]
[ 74, 9 ]
python
en
['en', 'lb', 'en']
True
AirVisualFlowHandler._async_set_unique_id
(self, unique_id)
Set the unique ID of the config flow and abort if it already exists.
Set the unique ID of the config flow and abort if it already exists.
async def _async_set_unique_id(self, unique_id): """Set the unique ID of the config flow and abort if it already exists.""" await self.async_set_unique_id(unique_id) self._abort_if_unique_id_configured()
[ "async", "def", "_async_set_unique_id", "(", "self", ",", "unique_id", ")", ":", "await", "self", ".", "async_set_unique_id", "(", "unique_id", ")", "self", ".", "_abort_if_unique_id_configured", "(", ")" ]
[ 76, 4 ]
[ 79, 45 ]
python
en
['en', 'en', 'en']
True
AirVisualFlowHandler.async_get_options_flow
(config_entry)
Define the config flow to handle options.
Define the config flow to handle options.
def async_get_options_flow(config_entry): """Define the config flow to handle options.""" return AirVisualOptionsFlowHandler(config_entry)
[ "def", "async_get_options_flow", "(", "config_entry", ")", ":", "return", "AirVisualOptionsFlowHandler", "(", "config_entry", ")" ]
[ 83, 4 ]
[ 85, 56 ]
python
en
['en', 'en', 'en']
True
AirVisualFlowHandler.async_step_geography
(self, user_input=None)
Handle the initialization of the integration via the cloud API.
Handle the initialization of the integration via the cloud API.
async def async_step_geography(self, user_input=None): """Handle the initialization of the integration via the cloud API.""" if not user_input: return self.async_show_form( step_id="geography", data_schema=self.geography_schema ) self._geo_id = async_get_...
[ "async", "def", "async_step_geography", "(", "self", ",", "user_input", "=", "None", ")", ":", "if", "not", "user_input", ":", "return", "self", ".", "async_show_form", "(", "step_id", "=", "\"geography\"", ",", "data_schema", "=", "self", ".", "geography_sche...
[ 87, 4 ]
[ 111, 9 ]
python
en
['en', 'en', 'en']
True
AirVisualFlowHandler.async_step_geography_finish
(self, user_input, error_step, error_schema)
Validate a Cloud API key.
Validate a Cloud API key.
async def async_step_geography_finish(self, user_input, error_step, error_schema): """Validate a Cloud API key.""" websession = aiohttp_client.async_get_clientsession(self.hass) cloud_api = CloudAPI(user_input[CONF_API_KEY], session=websession) # If this is the first (and only the first...
[ "async", "def", "async_step_geography_finish", "(", "self", ",", "user_input", ",", "error_step", ",", "error_schema", ")", ":", "websession", "=", "aiohttp_client", ".", "async_get_clientsession", "(", "self", ".", "hass", ")", "cloud_api", "=", "CloudAPI", "(", ...
[ 113, 4 ]
[ 146, 9 ]
python
en
['en', 'bg', 'en']
True
AirVisualFlowHandler.async_step_node_pro
(self, user_input=None)
Handle the initialization of the integration with a Node/Pro.
Handle the initialization of the integration with a Node/Pro.
async def async_step_node_pro(self, user_input=None): """Handle the initialization of the integration with a Node/Pro.""" if not user_input: return self.async_show_form( step_id="node_pro", data_schema=self.node_pro_schema ) await self._async_set_unique_i...
[ "async", "def", "async_step_node_pro", "(", "self", ",", "user_input", "=", "None", ")", ":", "if", "not", "user_input", ":", "return", "self", ".", "async_show_form", "(", "step_id", "=", "\"node_pro\"", ",", "data_schema", "=", "self", ".", "node_pro_schema"...
[ 148, 4 ]
[ 174, 9 ]
python
en
['en', 'en', 'en']
True
AirVisualFlowHandler.async_step_reauth
(self, data)
Handle configuration by re-auth.
Handle configuration by re-auth.
async def async_step_reauth(self, data): """Handle configuration by re-auth.""" self._geo_id = async_get_geography_id(data) self._latitude = data[CONF_LATITUDE] self._longitude = data[CONF_LONGITUDE] return await self.async_step_reauth_confirm()
[ "async", "def", "async_step_reauth", "(", "self", ",", "data", ")", ":", "self", ".", "_geo_id", "=", "async_get_geography_id", "(", "data", ")", "self", ".", "_latitude", "=", "data", "[", "CONF_LATITUDE", "]", "self", ".", "_longitude", "=", "data", "[",...
[ 176, 4 ]
[ 182, 53 ]
python
en
['en', 'en', 'en']
True
AirVisualFlowHandler.async_step_reauth_confirm
(self, user_input=None)
Handle re-auth completion.
Handle re-auth completion.
async def async_step_reauth_confirm(self, user_input=None): """Handle re-auth completion.""" if not user_input: return self.async_show_form( step_id="reauth_confirm", data_schema=self.api_key_data_schema ) conf = { CONF_API_KEY: user_input[CON...
[ "async", "def", "async_step_reauth_confirm", "(", "self", ",", "user_input", "=", "None", ")", ":", "if", "not", "user_input", ":", "return", "self", ".", "async_show_form", "(", "step_id", "=", "\"reauth_confirm\"", ",", "data_schema", "=", "self", ".", "api_...
[ 184, 4 ]
[ 200, 9 ]
python
en
['en', 'en', 'en']
True
AirVisualFlowHandler.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 self.async_show_form( step_id="user", data_schema=self.pick_integration_type_schema ) if user_input["type"] == INTEGRATION_TYPE_GEOGRAPH...
[ "async", "def", "async_step_user", "(", "self", ",", "user_input", "=", "None", ")", ":", "if", "not", "user_input", ":", "return", "self", ".", "async_show_form", "(", "step_id", "=", "\"user\"", ",", "data_schema", "=", "self", ".", "pick_integration_type_sc...
[ 202, 4 ]
[ 211, 47 ]
python
en
['en', 'en', 'en']
True