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
FloDeviceDataUpdateCoordinator.__init__
( self, hass: HomeAssistantType, api_client: API, location_id: str, device_id: str )
Initialize the device.
Initialize the device.
def __init__( self, hass: HomeAssistantType, api_client: API, location_id: str, device_id: str ): """Initialize the device.""" self.hass: HomeAssistantType = hass self.api_client: API = api_client self._flo_location_id: str = location_id self._flo_device_id: str = dev...
[ "def", "__init__", "(", "self", ",", "hass", ":", "HomeAssistantType", ",", "api_client", ":", "API", ",", "location_id", ":", "str", ",", "device_id", ":", "str", ")", ":", "self", ".", "hass", ":", "HomeAssistantType", "=", "hass", "self", ".", "api_cl...
[ 22, 4 ]
[ 38, 9 ]
python
en
['en', 'en', 'en']
True
FloDeviceDataUpdateCoordinator._async_update_data
(self)
Update data via library.
Update data via library.
async def _async_update_data(self): """Update data via library.""" try: async with timeout(10): await asyncio.gather( *[self._update_device(), self._update_consumption_data()] ) except (RequestError) as error: raise Upda...
[ "async", "def", "_async_update_data", "(", "self", ")", ":", "try", ":", "async", "with", "timeout", "(", "10", ")", ":", "await", "asyncio", ".", "gather", "(", "*", "[", "self", ".", "_update_device", "(", ")", ",", "self", ".", "_update_consumption_da...
[ 40, 4 ]
[ 48, 48 ]
python
en
['fr', 'en', 'en']
True
FloDeviceDataUpdateCoordinator.location_id
(self)
Return Flo location id.
Return Flo location id.
def location_id(self) -> str: """Return Flo location id.""" return self._flo_location_id
[ "def", "location_id", "(", "self", ")", "->", "str", ":", "return", "self", ".", "_flo_location_id" ]
[ 51, 4 ]
[ 53, 36 ]
python
en
['it', 'et', 'en']
False
FloDeviceDataUpdateCoordinator.id
(self)
Return Flo device id.
Return Flo device id.
def id(self) -> str: """Return Flo device id.""" return self._flo_device_id
[ "def", "id", "(", "self", ")", "->", "str", ":", "return", "self", ".", "_flo_device_id" ]
[ 56, 4 ]
[ 58, 34 ]
python
en
['it', 'et', 'en']
False
FloDeviceDataUpdateCoordinator.device_name
(self)
Return device name.
Return device name.
def device_name(self) -> str: """Return device name.""" return f"{self.manufacturer} {self.model}"
[ "def", "device_name", "(", "self", ")", "->", "str", ":", "return", "f\"{self.manufacturer} {self.model}\"" ]
[ 61, 4 ]
[ 63, 50 ]
python
en
['es', 'sl', 'en']
False
FloDeviceDataUpdateCoordinator.manufacturer
(self)
Return manufacturer for device.
Return manufacturer for device.
def manufacturer(self) -> str: """Return manufacturer for device.""" return self._manufacturer
[ "def", "manufacturer", "(", "self", ")", "->", "str", ":", "return", "self", ".", "_manufacturer" ]
[ 66, 4 ]
[ 68, 33 ]
python
da
['da', 'da', 'en']
True
FloDeviceDataUpdateCoordinator.mac_address
(self)
Return ieee address for device.
Return ieee address for device.
def mac_address(self) -> str: """Return ieee address for device.""" return self._device_information["macAddress"]
[ "def", "mac_address", "(", "self", ")", "->", "str", ":", "return", "self", ".", "_device_information", "[", "\"macAddress\"", "]" ]
[ 71, 4 ]
[ 73, 53 ]
python
en
['en', 'en', 'en']
True
FloDeviceDataUpdateCoordinator.model
(self)
Return model for device.
Return model for device.
def model(self) -> str: """Return model for device.""" return self._device_information["deviceModel"]
[ "def", "model", "(", "self", ")", "->", "str", ":", "return", "self", ".", "_device_information", "[", "\"deviceModel\"", "]" ]
[ 76, 4 ]
[ 78, 54 ]
python
da
['da', 'no', 'en']
False
FloDeviceDataUpdateCoordinator.rssi
(self)
Return rssi for device.
Return rssi for device.
def rssi(self) -> float: """Return rssi for device.""" return self._device_information["connectivity"]["rssi"]
[ "def", "rssi", "(", "self", ")", "->", "float", ":", "return", "self", ".", "_device_information", "[", "\"connectivity\"", "]", "[", "\"rssi\"", "]" ]
[ 81, 4 ]
[ 83, 63 ]
python
en
['da', 'en', 'en']
True
FloDeviceDataUpdateCoordinator.last_heard_from_time
(self)
Return lastHeardFromTime for device.
Return lastHeardFromTime for device.
def last_heard_from_time(self) -> str: """Return lastHeardFromTime for device.""" return self._device_information["lastHeardFromTime"]
[ "def", "last_heard_from_time", "(", "self", ")", "->", "str", ":", "return", "self", ".", "_device_information", "[", "\"lastHeardFromTime\"", "]" ]
[ 86, 4 ]
[ 88, 60 ]
python
en
['es', 'no', 'en']
False
FloDeviceDataUpdateCoordinator.device_type
(self)
Return the device type for the device.
Return the device type for the device.
def device_type(self) -> str: """Return the device type for the device.""" return self._device_information["deviceType"]
[ "def", "device_type", "(", "self", ")", "->", "str", ":", "return", "self", ".", "_device_information", "[", "\"deviceType\"", "]" ]
[ 91, 4 ]
[ 93, 53 ]
python
en
['en', 'en', 'en']
True
FloDeviceDataUpdateCoordinator.available
(self)
Return True if device is available.
Return True if device is available.
def available(self) -> bool: """Return True if device is available.""" return self.last_update_success and self._device_information["isConnected"]
[ "def", "available", "(", "self", ")", "->", "bool", ":", "return", "self", ".", "last_update_success", "and", "self", ".", "_device_information", "[", "\"isConnected\"", "]" ]
[ 96, 4 ]
[ 98, 83 ]
python
en
['en', 'en', 'en']
True
FloDeviceDataUpdateCoordinator.current_system_mode
(self)
Return the current system mode.
Return the current system mode.
def current_system_mode(self) -> str: """Return the current system mode.""" return self._device_information["systemMode"]["lastKnown"]
[ "def", "current_system_mode", "(", "self", ")", "->", "str", ":", "return", "self", ".", "_device_information", "[", "\"systemMode\"", "]", "[", "\"lastKnown\"", "]" ]
[ 101, 4 ]
[ 103, 66 ]
python
en
['en', 'en', 'en']
True
FloDeviceDataUpdateCoordinator.target_system_mode
(self)
Return the target system mode.
Return the target system mode.
def target_system_mode(self) -> str: """Return the target system mode.""" return self._device_information["systemMode"]["target"]
[ "def", "target_system_mode", "(", "self", ")", "->", "str", ":", "return", "self", ".", "_device_information", "[", "\"systemMode\"", "]", "[", "\"target\"", "]" ]
[ 106, 4 ]
[ 108, 63 ]
python
en
['en', 'da', 'en']
True
FloDeviceDataUpdateCoordinator.current_flow_rate
(self)
Return current flow rate in gpm.
Return current flow rate in gpm.
def current_flow_rate(self) -> float: """Return current flow rate in gpm.""" return self._device_information["telemetry"]["current"]["gpm"]
[ "def", "current_flow_rate", "(", "self", ")", "->", "float", ":", "return", "self", ".", "_device_information", "[", "\"telemetry\"", "]", "[", "\"current\"", "]", "[", "\"gpm\"", "]" ]
[ 111, 4 ]
[ 113, 70 ]
python
en
['en', 'en', 'en']
True
FloDeviceDataUpdateCoordinator.current_psi
(self)
Return the current pressure in psi.
Return the current pressure in psi.
def current_psi(self) -> float: """Return the current pressure in psi.""" return self._device_information["telemetry"]["current"]["psi"]
[ "def", "current_psi", "(", "self", ")", "->", "float", ":", "return", "self", ".", "_device_information", "[", "\"telemetry\"", "]", "[", "\"current\"", "]", "[", "\"psi\"", "]" ]
[ 116, 4 ]
[ 118, 70 ]
python
en
['en', 'co', 'en']
True
FloDeviceDataUpdateCoordinator.temperature
(self)
Return the current temperature in degrees F.
Return the current temperature in degrees F.
def temperature(self) -> float: """Return the current temperature in degrees F.""" return self._device_information["telemetry"]["current"]["tempF"]
[ "def", "temperature", "(", "self", ")", "->", "float", ":", "return", "self", ".", "_device_information", "[", "\"telemetry\"", "]", "[", "\"current\"", "]", "[", "\"tempF\"", "]" ]
[ 121, 4 ]
[ 123, 72 ]
python
en
['en', 'en', 'en']
True
FloDeviceDataUpdateCoordinator.consumption_today
(self)
Return the current consumption for today in gallons.
Return the current consumption for today in gallons.
def consumption_today(self) -> float: """Return the current consumption for today in gallons.""" return self._water_usage["aggregations"]["sumTotalGallonsConsumed"]
[ "def", "consumption_today", "(", "self", ")", "->", "float", ":", "return", "self", ".", "_water_usage", "[", "\"aggregations\"", "]", "[", "\"sumTotalGallonsConsumed\"", "]" ]
[ 126, 4 ]
[ 128, 75 ]
python
en
['en', 'en', 'en']
True
FloDeviceDataUpdateCoordinator.firmware_version
(self)
Return the firmware version for the device.
Return the firmware version for the device.
def firmware_version(self) -> str: """Return the firmware version for the device.""" return self._device_information["fwVersion"]
[ "def", "firmware_version", "(", "self", ")", "->", "str", ":", "return", "self", ".", "_device_information", "[", "\"fwVersion\"", "]" ]
[ 131, 4 ]
[ 133, 52 ]
python
en
['en', 'en', 'en']
True
FloDeviceDataUpdateCoordinator.serial_number
(self)
Return the serial number for the device.
Return the serial number for the device.
def serial_number(self) -> str: """Return the serial number for the device.""" return self._device_information["serialNumber"]
[ "def", "serial_number", "(", "self", ")", "->", "str", ":", "return", "self", ".", "_device_information", "[", "\"serialNumber\"", "]" ]
[ 136, 4 ]
[ 138, 55 ]
python
en
['en', 'en', 'en']
True
FloDeviceDataUpdateCoordinator.pending_info_alerts_count
(self)
Return the number of pending info alerts for the device.
Return the number of pending info alerts for the device.
def pending_info_alerts_count(self) -> int: """Return the number of pending info alerts for the device.""" return self._device_information["notifications"]["pending"]["infoCount"]
[ "def", "pending_info_alerts_count", "(", "self", ")", "->", "int", ":", "return", "self", ".", "_device_information", "[", "\"notifications\"", "]", "[", "\"pending\"", "]", "[", "\"infoCount\"", "]" ]
[ 141, 4 ]
[ 143, 80 ]
python
en
['en', 'en', 'en']
True
FloDeviceDataUpdateCoordinator.pending_warning_alerts_count
(self)
Return the number of pending warning alerts for the device.
Return the number of pending warning alerts for the device.
def pending_warning_alerts_count(self) -> int: """Return the number of pending warning alerts for the device.""" return self._device_information["notifications"]["pending"]["warningCount"]
[ "def", "pending_warning_alerts_count", "(", "self", ")", "->", "int", ":", "return", "self", ".", "_device_information", "[", "\"notifications\"", "]", "[", "\"pending\"", "]", "[", "\"warningCount\"", "]" ]
[ 146, 4 ]
[ 148, 83 ]
python
en
['en', 'en', 'en']
True
FloDeviceDataUpdateCoordinator.pending_critical_alerts_count
(self)
Return the number of pending critical alerts for the device.
Return the number of pending critical alerts for the device.
def pending_critical_alerts_count(self) -> int: """Return the number of pending critical alerts for the device.""" return self._device_information["notifications"]["pending"]["criticalCount"]
[ "def", "pending_critical_alerts_count", "(", "self", ")", "->", "int", ":", "return", "self", ".", "_device_information", "[", "\"notifications\"", "]", "[", "\"pending\"", "]", "[", "\"criticalCount\"", "]" ]
[ 151, 4 ]
[ 153, 84 ]
python
en
['en', 'en', 'en']
True
FloDeviceDataUpdateCoordinator.has_alerts
(self)
Return True if any alert counts are greater than zero.
Return True if any alert counts are greater than zero.
def has_alerts(self) -> bool: """Return True if any alert counts are greater than zero.""" return bool( self.pending_info_alerts_count or self.pending_warning_alerts_count or self.pending_warning_alerts_count )
[ "def", "has_alerts", "(", "self", ")", "->", "bool", ":", "return", "bool", "(", "self", ".", "pending_info_alerts_count", "or", "self", ".", "pending_warning_alerts_count", "or", "self", ".", "pending_warning_alerts_count", ")" ]
[ 156, 4 ]
[ 162, 9 ]
python
en
['en', 'en', 'en']
True
FloDeviceDataUpdateCoordinator.last_known_valve_state
(self)
Return the last known valve state for the device.
Return the last known valve state for the device.
def last_known_valve_state(self) -> str: """Return the last known valve state for the device.""" return self._device_information["valve"]["lastKnown"]
[ "def", "last_known_valve_state", "(", "self", ")", "->", "str", ":", "return", "self", ".", "_device_information", "[", "\"valve\"", "]", "[", "\"lastKnown\"", "]" ]
[ 165, 4 ]
[ 167, 61 ]
python
en
['en', 'en', 'en']
True
FloDeviceDataUpdateCoordinator.target_valve_state
(self)
Return the target valve state for the device.
Return the target valve state for the device.
def target_valve_state(self) -> str: """Return the target valve state for the device.""" return self._device_information["valve"]["target"]
[ "def", "target_valve_state", "(", "self", ")", "->", "str", ":", "return", "self", ".", "_device_information", "[", "\"valve\"", "]", "[", "\"target\"", "]" ]
[ 170, 4 ]
[ 172, 58 ]
python
en
['en', 'en', 'en']
True
FloDeviceDataUpdateCoordinator.async_set_mode_home
(self)
Set the Flo location to home mode.
Set the Flo location to home mode.
async def async_set_mode_home(self): """Set the Flo location to home mode.""" await self.api_client.location.set_mode_home(self._flo_location_id)
[ "async", "def", "async_set_mode_home", "(", "self", ")", ":", "await", "self", ".", "api_client", ".", "location", ".", "set_mode_home", "(", "self", ".", "_flo_location_id", ")" ]
[ 174, 4 ]
[ 176, 75 ]
python
en
['en', 'pt', 'en']
True
FloDeviceDataUpdateCoordinator.async_set_mode_away
(self)
Set the Flo location to away mode.
Set the Flo location to away mode.
async def async_set_mode_away(self): """Set the Flo location to away mode.""" await self.api_client.location.set_mode_away(self._flo_location_id)
[ "async", "def", "async_set_mode_away", "(", "self", ")", ":", "await", "self", ".", "api_client", ".", "location", ".", "set_mode_away", "(", "self", ".", "_flo_location_id", ")" ]
[ 178, 4 ]
[ 180, 75 ]
python
en
['en', 'en', 'en']
True
FloDeviceDataUpdateCoordinator.async_set_mode_sleep
(self, sleep_minutes, revert_to_mode)
Set the Flo location to sleep mode.
Set the Flo location to sleep mode.
async def async_set_mode_sleep(self, sleep_minutes, revert_to_mode): """Set the Flo location to sleep mode.""" await self.api_client.location.set_mode_sleep( self._flo_location_id, sleep_minutes, revert_to_mode )
[ "async", "def", "async_set_mode_sleep", "(", "self", ",", "sleep_minutes", ",", "revert_to_mode", ")", ":", "await", "self", ".", "api_client", ".", "location", ".", "set_mode_sleep", "(", "self", ".", "_flo_location_id", ",", "sleep_minutes", ",", "revert_to_mode...
[ 182, 4 ]
[ 186, 9 ]
python
en
['en', 'el-Latn', 'en']
True
FloDeviceDataUpdateCoordinator.async_run_health_test
(self)
Run a Flo device health test.
Run a Flo device health test.
async def async_run_health_test(self): """Run a Flo device health test.""" await self.api_client.device.run_health_test(self._flo_device_id)
[ "async", "def", "async_run_health_test", "(", "self", ")", ":", "await", "self", ".", "api_client", ".", "device", ".", "run_health_test", "(", "self", ".", "_flo_device_id", ")" ]
[ 188, 4 ]
[ 190, 73 ]
python
en
['it', 'ga', 'en']
False
FloDeviceDataUpdateCoordinator._update_device
(self, *_)
Update the device information from the API.
Update the device information from the API.
async def _update_device(self, *_) -> None: """Update the device information from the API.""" self._device_information = await self.api_client.device.get_info( self._flo_device_id ) _LOGGER.debug("Flo device data: %s", self._device_information)
[ "async", "def", "_update_device", "(", "self", ",", "*", "_", ")", "->", "None", ":", "self", ".", "_device_information", "=", "await", "self", ".", "api_client", ".", "device", ".", "get_info", "(", "self", ".", "_flo_device_id", ")", "_LOGGER", ".", "d...
[ 192, 4 ]
[ 197, 70 ]
python
en
['en', 'en', 'en']
True
FloDeviceDataUpdateCoordinator._update_consumption_data
(self, *_)
Update water consumption data from the API.
Update water consumption data from the API.
async def _update_consumption_data(self, *_) -> None: """Update water consumption data from the API.""" today = dt_util.now().date() start_date = datetime(today.year, today.month, today.day, 0, 0) end_date = datetime(today.year, today.month, today.day, 23, 59, 59, 999000) self._w...
[ "async", "def", "_update_consumption_data", "(", "self", ",", "*", "_", ")", "->", "None", ":", "today", "=", "dt_util", ".", "now", "(", ")", ".", "date", "(", ")", "start_date", "=", "datetime", "(", "today", ".", "year", ",", "today", ".", "month"...
[ 199, 4 ]
[ 207, 76 ]
python
en
['en', 'en', 'en']
True
create_mock_client
()
Create a mock Hyperion client.
Create a mock Hyperion client.
def create_mock_client(): """Create a mock Hyperion client.""" mock_client = Mock() mock_client.async_client_connect = AsyncMock(return_value=True) mock_client.adjustment = None mock_client.effects = None mock_client.id = "%s:%i" % (TEST_HOST, TEST_PORT) return mock_client
[ "def", "create_mock_client", "(", ")", ":", "mock_client", "=", "Mock", "(", ")", "mock_client", ".", "async_client_connect", "=", "AsyncMock", "(", "return_value", "=", "True", ")", "mock_client", ".", "adjustment", "=", "None", "mock_client", ".", "effects", ...
[ 22, 0 ]
[ 29, 22 ]
python
en
['en', 'en', 'en']
True
call_registered_callback
(client, key, *args, **kwargs)
Call a Hyperion entity callback that was registered with the client.
Call a Hyperion entity callback that was registered with the client.
def call_registered_callback(client, key, *args, **kwargs): """Call a Hyperion entity callback that was registered with the client.""" return client.set_callbacks.call_args[0][0][key](*args, **kwargs)
[ "def", "call_registered_callback", "(", "client", ",", "key", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "client", ".", "set_callbacks", ".", "call_args", "[", "0", "]", "[", "0", "]", "[", "key", "]", "(", "*", "args", ",", "*"...
[ 32, 0 ]
[ 34, 69 ]
python
en
['en', 'en', 'en']
True
setup_entity
(hass, client=None)
Add a test Hyperion entity to hass.
Add a test Hyperion entity to hass.
async def setup_entity(hass, client=None): """Add a test Hyperion entity to hass.""" client = client or create_mock_client() with patch("hyperion.client.HyperionClient", return_value=client): assert await async_setup_component( hass, DOMAIN, { DOMA...
[ "async", "def", "setup_entity", "(", "hass", ",", "client", "=", "None", ")", ":", "client", "=", "client", "or", "create_mock_client", "(", ")", "with", "patch", "(", "\"hyperion.client.HyperionClient\"", ",", "return_value", "=", "client", ")", ":", "assert"...
[ 37, 0 ]
[ 54, 38 ]
python
en
['en', 'en', 'en']
True
test_setup_platform
(hass)
Test setting up the platform.
Test setting up the platform.
async def test_setup_platform(hass): """Test setting up the platform.""" client = create_mock_client() await setup_entity(hass, client=client) assert hass.states.get(TEST_ENTITY_ID) is not None
[ "async", "def", "test_setup_platform", "(", "hass", ")", ":", "client", "=", "create_mock_client", "(", ")", "await", "setup_entity", "(", "hass", ",", "client", "=", "client", ")", "assert", "hass", ".", "states", ".", "get", "(", "TEST_ENTITY_ID", ")", "...
[ 57, 0 ]
[ 61, 54 ]
python
en
['en', 'da', 'en']
True
test_setup_platform_not_ready
(hass)
Test the platform not being ready.
Test the platform not being ready.
async def test_setup_platform_not_ready(hass): """Test the platform not being ready.""" client = create_mock_client() client.async_client_connect = AsyncMock(return_value=False) await setup_entity(hass, client=client) assert hass.states.get(TEST_ENTITY_ID) is None
[ "async", "def", "test_setup_platform_not_ready", "(", "hass", ")", ":", "client", "=", "create_mock_client", "(", ")", "client", ".", "async_client_connect", "=", "AsyncMock", "(", "return_value", "=", "False", ")", "await", "setup_entity", "(", "hass", ",", "cl...
[ 64, 0 ]
[ 70, 50 ]
python
en
['en', 'en', 'en']
True
test_light_basic_properies
(hass)
Test the basic properties.
Test the basic properties.
async def test_light_basic_properies(hass): """Test the basic properties.""" client = create_mock_client() await setup_entity(hass, client=client) entity_state = hass.states.get(TEST_ENTITY_ID) assert entity_state.state == "on" assert entity_state.attributes["brightness"] == 255 assert enti...
[ "async", "def", "test_light_basic_properies", "(", "hass", ")", ":", "client", "=", "create_mock_client", "(", ")", "await", "setup_entity", "(", "hass", ",", "client", "=", "client", ")", "entity_state", "=", "hass", ".", "states", ".", "get", "(", "TEST_EN...
[ 73, 0 ]
[ 90, 5 ]
python
en
['en', 'en', 'en']
True
test_light_async_turn_on
(hass)
Test turning the light on.
Test turning the light on.
async def test_light_async_turn_on(hass): """Test turning the light on.""" client = create_mock_client() await setup_entity(hass, client=client) # On (=), 100% (=), solid (=), [255,255,255] (=) client.async_send_set_color = AsyncMock(return_value=True) await hass.services.async_call( DO...
[ "async", "def", "test_light_async_turn_on", "(", "hass", ")", ":", "client", "=", "create_mock_client", "(", ")", "await", "setup_entity", "(", "hass", ",", "client", "=", "client", ")", "# On (=), 100% (=), solid (=), [255,255,255] (=)", "client", ".", "async_send_se...
[ 93, 0 ]
[ 286, 50 ]
python
en
['en', 'en', 'en']
True
test_light_async_turn_off
(hass)
Test turning the light off.
Test turning the light off.
async def test_light_async_turn_off(hass): """Test turning the light off.""" client = create_mock_client() await setup_entity(hass, client=client) client.async_send_set_component = AsyncMock(return_value=True) await hass.services.async_call( DOMAIN, SERVICE_TURN_OFF, {ATTR_ENTITY_ID: TEST_E...
[ "async", "def", "test_light_async_turn_off", "(", "hass", ")", ":", "client", "=", "create_mock_client", "(", ")", "await", "setup_entity", "(", "hass", ",", "client", "=", "client", ")", "client", ".", "async_send_set_component", "=", "AsyncMock", "(", "return_...
[ 289, 0 ]
[ 317, 53 ]
python
en
['en', 'en', 'en']
True
test_light_async_updates_from_hyperion_client
(hass)
Test receiving a variety of Hyperion client callbacks.
Test receiving a variety of Hyperion client callbacks.
async def test_light_async_updates_from_hyperion_client(hass): """Test receiving a variety of Hyperion client callbacks.""" client = create_mock_client() await setup_entity(hass, client=client) # Bright change gets accepted. brightness = 10 client.adjustment = [{const.KEY_BRIGHTNESS: brightness...
[ "async", "def", "test_light_async_updates_from_hyperion_client", "(", "hass", ")", ":", "client", "=", "create_mock_client", "(", ")", "await", "setup_entity", "(", "hass", ",", "client", "=", "client", ")", "# Bright change gets accepted.", "brightness", "=", "10", ...
[ 320, 0 ]
[ 406, 37 ]
python
en
['en', 'en', 'en']
True
test_full_state_loaded_on_start
(hass)
Test receiving a variety of Hyperion client callbacks.
Test receiving a variety of Hyperion client callbacks.
async def test_full_state_loaded_on_start(hass): """Test receiving a variety of Hyperion client callbacks.""" client = create_mock_client() # Update full state (should call all update methods). brightness = 25 client.adjustment = [{const.KEY_BRIGHTNESS: brightness}] client.visible_priority = { ...
[ "async", "def", "test_full_state_loaded_on_start", "(", "hass", ")", ":", "client", "=", "create_mock_client", "(", ")", "# Update full state (should call all update methods).", "brightness", "=", "25", "client", ".", "adjustment", "=", "[", "{", "const", ".", "KEY_BR...
[ 409, 0 ]
[ 429, 64 ]
python
en
['en', 'en', 'en']
True
device_reg
(hass)
Return an empty, loaded, registry.
Return an empty, loaded, registry.
def device_reg(hass): """Return an empty, loaded, registry.""" return mock_device_registry(hass)
[ "def", "device_reg", "(", "hass", ")", ":", "return", "mock_device_registry", "(", "hass", ")" ]
[ 20, 0 ]
[ 22, 37 ]
python
en
['en', 'fy', 'en']
True
entity_reg
(hass)
Return an empty, loaded, registry.
Return an empty, loaded, registry.
def entity_reg(hass): """Return an empty, loaded, registry.""" return mock_registry(hass)
[ "def", "entity_reg", "(", "hass", ")", ":", "return", "mock_registry", "(", "hass", ")" ]
[ 26, 0 ]
[ 28, 30 ]
python
en
['en', 'fy', 'en']
True
calls
(hass)
Track calls to a mock service.
Track calls to a mock service.
def calls(hass): """Track calls to a mock service.""" return async_mock_service(hass, "test", "automation")
[ "def", "calls", "(", "hass", ")", ":", "return", "async_mock_service", "(", "hass", ",", "\"test\"", ",", "\"automation\"", ")" ]
[ 32, 0 ]
[ 34, 57 ]
python
en
['en', 'en', 'en']
True
test_get_triggers
(hass, device_reg, entity_reg)
Test we get the expected triggers from a NEW_DOMAIN.
Test we get the expected triggers from a NEW_DOMAIN.
async def test_get_triggers(hass, device_reg, entity_reg): """Test we get the expected triggers from a NEW_DOMAIN.""" config_entry = MockConfigEntry(domain="test", data={}) config_entry.add_to_hass(hass) device_entry = device_reg.async_get_or_create( config_entry_id=config_entry.entry_id, ...
[ "async", "def", "test_get_triggers", "(", "hass", ",", "device_reg", ",", "entity_reg", ")", ":", "config_entry", "=", "MockConfigEntry", "(", "domain", "=", "\"test\"", ",", "data", "=", "{", "}", ")", "config_entry", ".", "add_to_hass", "(", "hass", ")", ...
[ 37, 0 ]
[ 63, 50 ]
python
en
['en', 'en', 'en']
True
test_if_fires_on_state_change
(hass, calls)
Test for turn_on and turn_off triggers firing.
Test for turn_on and turn_off triggers firing.
async def test_if_fires_on_state_change(hass, calls): """Test for turn_on and turn_off triggers firing.""" hass.states.async_set("NEW_DOMAIN.entity", STATE_OFF) assert await async_setup_component( hass, automation.DOMAIN, { automation.DOMAIN: [ { ...
[ "async", "def", "test_if_fires_on_state_change", "(", "hass", ",", "calls", ")", ":", "hass", ".", "states", ".", "async_set", "(", "\"NEW_DOMAIN.entity\"", ",", "STATE_OFF", ")", "assert", "await", "async_setup_component", "(", "hass", ",", "automation", ".", "...
[ 66, 0 ]
[ 131, 5 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
(hass, config_entry, async_add_entities)
Set up the Smile binary_sensors from a config entry.
Set up the Smile binary_sensors from a config entry.
async def async_setup_entry(hass, config_entry, async_add_entities): """Set up the Smile binary_sensors from a config entry.""" api = hass.data[DOMAIN][config_entry.entry_id]["api"] coordinator = hass.data[DOMAIN][config_entry.entry_id][COORDINATOR] entities = [] is_thermostat = api.single_master_t...
[ "async", "def", "async_setup_entry", "(", "hass", ",", "config_entry", ",", "async_add_entities", ")", ":", "api", "=", "hass", ".", "data", "[", "DOMAIN", "]", "[", "config_entry", ".", "entry_id", "]", "[", "\"api\"", "]", "coordinator", "=", "hass", "."...
[ 28, 0 ]
[ 66, 38 ]
python
en
['en', 'en', 'en']
True
SmileBinarySensor.__init__
(self, api, coordinator, name, dev_id, binary_sensor)
Initialise the binary_sensor.
Initialise the binary_sensor.
def __init__(self, api, coordinator, name, dev_id, binary_sensor): """Initialise the binary_sensor.""" super().__init__(api, coordinator, name, dev_id) self._binary_sensor = binary_sensor self._icon = None self._is_on = False if dev_id == self._api.heater_id: ...
[ "def", "__init__", "(", "self", ",", "api", ",", "coordinator", ",", "name", ",", "dev_id", ",", "binary_sensor", ")", ":", "super", "(", ")", ".", "__init__", "(", "api", ",", "coordinator", ",", "name", ",", "dev_id", ")", "self", ".", "_binary_senso...
[ 72, 4 ]
[ 90, 53 ]
python
en
['en', 'ig', 'en']
True
SmileBinarySensor.icon
(self)
Return the icon of this entity.
Return the icon of this entity.
def icon(self): """Return the icon of this entity.""" return self._icon
[ "def", "icon", "(", "self", ")", ":", "return", "self", ".", "_icon" ]
[ 93, 4 ]
[ 95, 25 ]
python
en
['en', 'en', 'en']
True
SmileBinarySensor.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._is_on
[ "def", "is_on", "(", "self", ")", ":", "return", "self", ".", "_is_on" ]
[ 98, 4 ]
[ 100, 26 ]
python
en
['en', 'fy', 'en']
True
SmileBinarySensor._async_process_data
(self)
Update the entity.
Update the entity.
def _async_process_data(self): """Update the entity.""" raise NotImplementedError
[ "def", "_async_process_data", "(", "self", ")", ":", "raise", "NotImplementedError" ]
[ 103, 4 ]
[ 105, 33 ]
python
en
['en', 'en', 'en']
True
PwBinarySensor._async_process_data
(self)
Update the entity.
Update the entity.
def _async_process_data(self): """Update the entity.""" data = self._api.get_device_data(self._dev_id) if not data: _LOGGER.error("Received no data for device %s", self._binary_sensor) self.async_write_ha_state() return if self._binary_sensor not in ...
[ "def", "_async_process_data", "(", "self", ")", ":", "data", "=", "self", ".", "_api", ".", "get_device_data", "(", "self", ".", "_dev_id", ")", "if", "not", "data", ":", "_LOGGER", ".", "error", "(", "\"Received no data for device %s\"", ",", "self", ".", ...
[ 112, 4 ]
[ 132, 35 ]
python
en
['en', 'en', 'en']
True
PwNotifySensor.__init__
(self, api, coordinator, name, dev_id, binary_sensor)
Set up the Plugwise API.
Set up the Plugwise API.
def __init__(self, api, coordinator, name, dev_id, binary_sensor): """Set up the Plugwise API.""" super().__init__(api, coordinator, name, dev_id, binary_sensor) self._attributes = {}
[ "def", "__init__", "(", "self", ",", "api", ",", "coordinator", ",", "name", ",", "dev_id", ",", "binary_sensor", ")", ":", "super", "(", ")", ".", "__init__", "(", "api", ",", "coordinator", ",", "name", ",", "dev_id", ",", "binary_sensor", ")", "self...
[ 138, 4 ]
[ 142, 29 ]
python
en
['en', 'zu', 'en']
True
PwNotifySensor.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" ]
[ 145, 4 ]
[ 147, 31 ]
python
en
['en', 'en', 'en']
True
PwNotifySensor._async_process_data
(self)
Update the entity.
Update the entity.
def _async_process_data(self): """Update the entity.""" notify = self._api.notifications for severity in SEVERITIES: self._attributes[f"{severity}_msg"] = [] self._is_on = False self._icon = NO_NOTIFICATION_ICON if notify: self._is_on = True ...
[ "def", "_async_process_data", "(", "self", ")", ":", "notify", "=", "self", ".", "_api", ".", "notifications", "for", "severity", "in", "SEVERITIES", ":", "self", ".", "_attributes", "[", "f\"{severity}_msg\"", "]", "=", "[", "]", "self", ".", "_is_on", "=...
[ 150, 4 ]
[ 171, 35 ]
python
en
['en', 'en', 'en']
True
test_form
(hass)
Test we get the form.
Test we get the form.
async def test_form(hass): """Test we get the form.""" await setup.async_setup_component(hass, "persistent_notification", {}) result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) assert result["type"] == "form" assert result["errors...
[ "async", "def", "test_form", "(", "hass", ")", ":", "await", "setup", ".", "async_setup_component", "(", "hass", ",", "\"persistent_notification\"", ",", "{", "}", ")", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(...
[ 15, 0 ]
[ 42, 48 ]
python
en
['en', 'en', 'en']
True
mock_controller
()
Mock a successful _host_in_configuration_exists.
Mock a successful _host_in_configuration_exists.
def mock_controller(): """Mock a successful _host_in_configuration_exists.""" with patch( "homeassistant.components.solarlog.config_flow.SolarLogConfigFlow._test_connection", return_value=True, ): yield
[ "def", "mock_controller", "(", ")", ":", "with", "patch", "(", "\"homeassistant.components.solarlog.config_flow.SolarLogConfigFlow._test_connection\"", ",", "return_value", "=", "True", ",", ")", ":", "yield" ]
[ 46, 0 ]
[ 52, 13 ]
python
en
['en', 'en', 'en']
True
init_config_flow
(hass)
Init a configuration flow.
Init a configuration flow.
def init_config_flow(hass): """Init a configuration flow.""" flow = config_flow.SolarLogConfigFlow() flow.hass = hass return flow
[ "def", "init_config_flow", "(", "hass", ")", ":", "flow", "=", "config_flow", ".", "SolarLogConfigFlow", "(", ")", "flow", ".", "hass", "=", "hass", "return", "flow" ]
[ 55, 0 ]
[ 59, 15 ]
python
en
['es', 'fr', 'en']
False
test_user
(hass, test_connect)
Test user config.
Test user config.
async def test_user(hass, test_connect): """Test user config.""" flow = init_config_flow(hass) result = await flow.async_step_user() assert result["type"] == data_entry_flow.RESULT_TYPE_FORM assert result["step_id"] == "user" # tets with all provided result = await flow.async_step_user({CO...
[ "async", "def", "test_user", "(", "hass", ",", "test_connect", ")", ":", "flow", "=", "init_config_flow", "(", "hass", ")", "result", "=", "await", "flow", ".", "async_step_user", "(", ")", "assert", "result", "[", "\"type\"", "]", "==", "data_entry_flow", ...
[ 62, 0 ]
[ 74, 44 ]
python
en
['en', 'da', 'en']
True
test_import
(hass, test_connect)
Test import step.
Test import step.
async def test_import(hass, test_connect): """Test import step.""" flow = init_config_flow(hass) # import with only host result = await flow.async_step_import({CONF_HOST: HOST}) assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY assert result["title"] == "solarlog" assert res...
[ "async", "def", "test_import", "(", "hass", ",", "test_connect", ")", ":", "flow", "=", "init_config_flow", "(", "hass", ")", "# import with only host", "result", "=", "await", "flow", ".", "async_step_import", "(", "{", "CONF_HOST", ":", "HOST", "}", ")", "...
[ 77, 0 ]
[ 97, 44 ]
python
de
['de', 'sd', 'en']
False
test_abort_if_already_setup
(hass, test_connect)
Test we abort if the device is already setup.
Test we abort if the device is already setup.
async def test_abort_if_already_setup(hass, test_connect): """Test we abort if the device is already setup.""" flow = init_config_flow(hass) MockConfigEntry( domain="solarlog", data={CONF_NAME: NAME, CONF_HOST: HOST} ).add_to_hass(hass) # Should fail, same HOST different NAME (default) ...
[ "async", "def", "test_abort_if_already_setup", "(", "hass", ",", "test_connect", ")", ":", "flow", "=", "init_config_flow", "(", "hass", ")", "MockConfigEntry", "(", "domain", "=", "\"solarlog\"", ",", "data", "=", "{", "CONF_NAME", ":", "NAME", ",", "CONF_HOS...
[ 100, 0 ]
[ 133, 56 ]
python
en
['en', 'en', 'en']
True
async_setup
(hass, config)
Set up the image processing.
Set up the image processing.
async def async_setup(hass, config): """Set up the image processing.""" component = EntityComponent(_LOGGER, DOMAIN, hass, SCAN_INTERVAL) await component.async_setup(config) async def async_scan_service(service): """Service handler for scan.""" image_entities = await component.async_ex...
[ "async", "def", "async_setup", "(", "hass", ",", "config", ")", ":", "component", "=", "EntityComponent", "(", "_LOGGER", ",", "DOMAIN", ",", "hass", ",", "SCAN_INTERVAL", ")", "await", "component", ".", "async_setup", "(", "config", ")", "async", "def", "...
[ 65, 0 ]
[ 87, 15 ]
python
en
['en', 'en', 'en']
True
ImageProcessingEntity.camera_entity
(self)
Return camera entity id from process pictures.
Return camera entity id from process pictures.
def camera_entity(self): """Return camera entity id from process pictures.""" return None
[ "def", "camera_entity", "(", "self", ")", ":", "return", "None" ]
[ 96, 4 ]
[ 98, 19 ]
python
en
['en', 'en', 'en']
True
ImageProcessingEntity.confidence
(self)
Return minimum confidence for do some things.
Return minimum confidence for do some things.
def confidence(self): """Return minimum confidence for do some things.""" return None
[ "def", "confidence", "(", "self", ")", ":", "return", "None" ]
[ 101, 4 ]
[ 103, 19 ]
python
en
['en', 'en', 'en']
True
ImageProcessingEntity.process_image
(self, image)
Process image.
Process image.
def process_image(self, image): """Process image.""" raise NotImplementedError()
[ "def", "process_image", "(", "self", ",", "image", ")", ":", "raise", "NotImplementedError", "(", ")" ]
[ 105, 4 ]
[ 107, 35 ]
python
en
['en', 'ny', 'en']
False
ImageProcessingEntity.async_process_image
(self, image)
Process image.
Process image.
async def async_process_image(self, image): """Process image.""" return await self.hass.async_add_executor_job(self.process_image, image)
[ "async", "def", "async_process_image", "(", "self", ",", "image", ")", ":", "return", "await", "self", ".", "hass", ".", "async_add_executor_job", "(", "self", ".", "process_image", ",", "image", ")" ]
[ 109, 4 ]
[ 111, 80 ]
python
en
['en', 'ny', 'en']
False
ImageProcessingEntity.async_update
(self)
Update image and process it. This method is a coroutine.
Update image and process it.
async def async_update(self): """Update image and process it. This method is a coroutine. """ camera = self.hass.components.camera image = None try: image = await camera.async_get_image( self.camera_entity, timeout=self.timeout ) ...
[ "async", "def", "async_update", "(", "self", ")", ":", "camera", "=", "self", ".", "hass", ".", "components", ".", "camera", "image", "=", "None", "try", ":", "image", "=", "await", "camera", ".", "async_get_image", "(", "self", ".", "camera_entity", ","...
[ 113, 4 ]
[ 131, 53 ]
python
en
['en', 'en', 'en']
True
ImageProcessingFaceEntity.__init__
(self)
Initialize base face identify/verify entity.
Initialize base face identify/verify entity.
def __init__(self): """Initialize base face identify/verify entity.""" self.faces = [] self.total_faces = 0
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "faces", "=", "[", "]", "self", ".", "total_faces", "=", "0" ]
[ 137, 4 ]
[ 140, 28 ]
python
en
['en', 'cs', 'en']
True
ImageProcessingFaceEntity.state
(self)
Return the state of the entity.
Return the state of the entity.
def state(self): """Return the state of the entity.""" confidence = 0 state = None # No confidence support if not self.confidence: return self.total_faces # Search high confidence for face in self.faces: if ATTR_CONFIDENCE not in face: ...
[ "def", "state", "(", "self", ")", ":", "confidence", "=", "0", "state", "=", "None", "# No confidence support", "if", "not", "self", ".", "confidence", ":", "return", "self", ".", "total_faces", "# Search high confidence", "for", "face", "in", "self", ".", "...
[ 143, 4 ]
[ 165, 20 ]
python
en
['en', 'en', 'en']
True
ImageProcessingFaceEntity.device_class
(self)
Return the class of this device, from component DEVICE_CLASSES.
Return the class of this device, from component DEVICE_CLASSES.
def device_class(self): """Return the class of this device, from component DEVICE_CLASSES.""" return "face"
[ "def", "device_class", "(", "self", ")", ":", "return", "\"face\"" ]
[ 168, 4 ]
[ 170, 21 ]
python
en
['en', 'en', 'en']
True
ImageProcessingFaceEntity.state_attributes
(self)
Return device specific state attributes.
Return device specific state attributes.
def state_attributes(self): """Return device specific state attributes.""" return {ATTR_FACES: self.faces, ATTR_TOTAL_FACES: self.total_faces}
[ "def", "state_attributes", "(", "self", ")", ":", "return", "{", "ATTR_FACES", ":", "self", ".", "faces", ",", "ATTR_TOTAL_FACES", ":", "self", ".", "total_faces", "}" ]
[ 173, 4 ]
[ 175, 75 ]
python
en
['fr', 'en', 'en']
True
ImageProcessingFaceEntity.process_faces
(self, faces, total)
Send event with detected faces and store data.
Send event with detected faces and store data.
def process_faces(self, faces, total): """Send event with detected faces and store data.""" run_callback_threadsafe( self.hass.loop, self.async_process_faces, faces, total ).result()
[ "def", "process_faces", "(", "self", ",", "faces", ",", "total", ")", ":", "run_callback_threadsafe", "(", "self", ".", "hass", ".", "loop", ",", "self", ".", "async_process_faces", ",", "faces", ",", "total", ")", ".", "result", "(", ")" ]
[ 177, 4 ]
[ 181, 18 ]
python
en
['en', 'en', 'en']
True
ImageProcessingFaceEntity.async_process_faces
(self, faces, total)
Send event with detected faces and store data. known are a dict in follow format: [ { ATTR_CONFIDENCE: 80, ATTR_NAME: 'Name', ATTR_AGE: 12.0, ATTR_GENDER: 'man', ATTR_MOTION: 'smile', ATTR_GLASSES: 'sunglass...
Send event with detected faces and store data.
def async_process_faces(self, faces, total): """Send event with detected faces and store data. known are a dict in follow format: [ { ATTR_CONFIDENCE: 80, ATTR_NAME: 'Name', ATTR_AGE: 12.0, ATTR_GENDER: 'man', ATT...
[ "def", "async_process_faces", "(", "self", ",", "faces", ",", "total", ")", ":", "# Send events", "for", "face", "in", "faces", ":", "if", "ATTR_CONFIDENCE", "in", "face", "and", "self", ".", "confidence", ":", "if", "face", "[", "ATTR_CONFIDENCE", "]", "<...
[ 184, 4 ]
[ 212, 32 ]
python
en
['en', 'en', 'en']
True
test_snips_config
(hass, mqtt_mock)
Test Snips Config.
Test Snips Config.
async def test_snips_config(hass, mqtt_mock): """Test Snips Config.""" result = await async_setup_component( hass, "snips", { "snips": { "feedback_sounds": True, "probability_threshold": 0.5, "site_ids": ["default", "remote"], ...
[ "async", "def", "test_snips_config", "(", "hass", ",", "mqtt_mock", ")", ":", "result", "=", "await", "async_setup_component", "(", "hass", ",", "\"snips\"", ",", "{", "\"snips\"", ":", "{", "\"feedback_sounds\"", ":", "True", ",", "\"probability_threshold\"", "...
[ 15, 0 ]
[ 28, 17 ]
python
da
['en', 'da', 'it']
False
test_snips_bad_config
(hass, mqtt_mock)
Test Snips bad config.
Test Snips bad config.
async def test_snips_bad_config(hass, mqtt_mock): """Test Snips bad config.""" result = await async_setup_component( hass, "snips", { "snips": { "feedback_sounds": "on", "probability": "none", "site_ids": "default", ...
[ "async", "def", "test_snips_bad_config", "(", "hass", ",", "mqtt_mock", ")", ":", "result", "=", "await", "async_setup_component", "(", "hass", ",", "\"snips\"", ",", "{", "\"snips\"", ":", "{", "\"feedback_sounds\"", ":", "\"on\"", ",", "\"probability\"", ":", ...
[ 31, 0 ]
[ 44, 21 ]
python
en
['en', 'da', 'en']
True
test_snips_config_feedback_on
(hass, mqtt_mock)
Test Snips Config.
Test Snips Config.
async def test_snips_config_feedback_on(hass, mqtt_mock): """Test Snips Config.""" calls = async_mock_service(hass, "mqtt", "publish", MQTT_PUBLISH_SCHEMA) result = await async_setup_component( hass, "snips", {"snips": {"feedback_sounds": True}} ) assert result await hass.async_block_til...
[ "async", "def", "test_snips_config_feedback_on", "(", "hass", ",", "mqtt_mock", ")", ":", "calls", "=", "async_mock_service", "(", "hass", ",", "\"mqtt\"", ",", "\"publish\"", ",", "MQTT_PUBLISH_SCHEMA", ")", "result", "=", "await", "async_setup_component", "(", "...
[ 47, 0 ]
[ 62, 34 ]
python
da
['en', 'da', 'it']
False
test_snips_config_feedback_off
(hass, mqtt_mock)
Test Snips Config.
Test Snips Config.
async def test_snips_config_feedback_off(hass, mqtt_mock): """Test Snips Config.""" calls = async_mock_service(hass, "mqtt", "publish", MQTT_PUBLISH_SCHEMA) result = await async_setup_component( hass, "snips", {"snips": {"feedback_sounds": False}} ) assert result await hass.async_block_t...
[ "async", "def", "test_snips_config_feedback_off", "(", "hass", ",", "mqtt_mock", ")", ":", "calls", "=", "async_mock_service", "(", "hass", ",", "\"mqtt\"", ",", "\"publish\"", ",", "MQTT_PUBLISH_SCHEMA", ")", "result", "=", "await", "async_setup_component", "(", ...
[ 65, 0 ]
[ 80, 38 ]
python
da
['en', 'da', 'it']
False
test_snips_config_no_feedback
(hass, mqtt_mock)
Test Snips Config.
Test Snips Config.
async def test_snips_config_no_feedback(hass, mqtt_mock): """Test Snips Config.""" calls = async_mock_service(hass, "snips", "say") result = await async_setup_component(hass, "snips", {"snips": {}}) assert result await hass.async_block_till_done() assert len(calls) == 0
[ "async", "def", "test_snips_config_no_feedback", "(", "hass", ",", "mqtt_mock", ")", ":", "calls", "=", "async_mock_service", "(", "hass", ",", "\"snips\"", ",", "\"say\"", ")", "result", "=", "await", "async_setup_component", "(", "hass", ",", "\"snips\"", ",",...
[ 83, 0 ]
[ 89, 26 ]
python
da
['en', 'da', 'it']
False
test_snips_intent
(hass, mqtt_mock)
Test intent via Snips.
Test intent via Snips.
async def test_snips_intent(hass, mqtt_mock): """Test intent via Snips.""" result = await async_setup_component(hass, "snips", {"snips": {}}) assert result payload = """ { "siteId": "default", "sessionId": "1234567890ABCDEF", "input": "turn the lights green", "intent"...
[ "async", "def", "test_snips_intent", "(", "hass", ",", "mqtt_mock", ")", ":", "result", "=", "await", "async_setup_component", "(", "hass", ",", "\"snips\"", ",", "{", "\"snips\"", ":", "{", "}", "}", ")", "assert", "result", "payload", "=", "\"\"\"\n {\n...
[ 92, 0 ]
[ 134, 55 ]
python
da
['en', 'da', 'it']
False
test_snips_service_intent
(hass, mqtt_mock)
Test ServiceIntentHandler via Snips.
Test ServiceIntentHandler via Snips.
async def test_snips_service_intent(hass, mqtt_mock): """Test ServiceIntentHandler via Snips.""" hass.states.async_set("light.kitchen", "off") calls = async_mock_service(hass, "light", "turn_on") result = await async_setup_component(hass, "snips", {"snips": {}}) assert result payload = """ {...
[ "async", "def", "test_snips_service_intent", "(", "hass", ",", "mqtt_mock", ")", ":", "hass", ".", "states", ".", "async_set", "(", "\"light.kitchen\"", ",", "\"off\"", ")", "calls", "=", "async_mock_service", "(", "hass", ",", "\"light\"", ",", "\"turn_on\"", ...
[ 137, 0 ]
[ 176, 41 ]
python
da
['da', 'lb', 'it']
False
test_snips_intent_with_duration
(hass, mqtt_mock)
Test intent with Snips duration.
Test intent with Snips duration.
async def test_snips_intent_with_duration(hass, mqtt_mock): """Test intent with Snips duration.""" result = await async_setup_component(hass, "snips", {"snips": {}}) assert result payload = """ { "input": "set a timer of five minutes", "intent": { "intentName": "SetTimer", ...
[ "async", "def", "test_snips_intent_with_duration", "(", "hass", ",", "mqtt_mock", ")", ":", "result", "=", "await", "async_setup_component", "(", "hass", ",", "\"snips\"", ",", "{", "\"snips\"", ":", "{", "}", "}", ")", "assert", "result", "payload", "=", "\...
[ 179, 0 ]
[ 229, 5 ]
python
en
['en', 'en', 'en']
True
test_intent_speech_response
(hass, mqtt_mock)
Test intent speech response via Snips.
Test intent speech response via Snips.
async def test_intent_speech_response(hass, mqtt_mock): """Test intent speech response via Snips.""" calls = async_mock_service(hass, "mqtt", "publish", MQTT_PUBLISH_SCHEMA) result = await async_setup_component(hass, "snips", {"snips": {}}) assert result result = await async_setup_component( ...
[ "async", "def", "test_intent_speech_response", "(", "hass", ",", "mqtt_mock", ")", ":", "calls", "=", "async_mock_service", "(", "hass", ",", "\"mqtt\"", ",", "\"publish\"", ",", "MQTT_PUBLISH_SCHEMA", ")", "result", "=", "await", "async_setup_component", "(", "ha...
[ 232, 0 ]
[ 268, 55 ]
python
cs
['cs', 'lb', 'en']
False
test_unknown_intent
(hass, caplog, mqtt_mock)
Test unknown intent.
Test unknown intent.
async def test_unknown_intent(hass, caplog, mqtt_mock): """Test unknown intent.""" caplog.set_level(logging.WARNING) result = await async_setup_component(hass, "snips", {"snips": {}}) assert result payload = """ { "input": "I don't know what I am supposed to do", "sessionId": "ab...
[ "async", "def", "test_unknown_intent", "(", "hass", ",", "caplog", ",", "mqtt_mock", ")", ":", "caplog", ".", "set_level", "(", "logging", ".", "WARNING", ")", "result", "=", "await", "async_setup_component", "(", "hass", ",", "\"snips\"", ",", "{", "\"snips...
[ 271, 0 ]
[ 289, 65 ]
python
en
['en', 'de', 'en']
True
test_snips_intent_user
(hass, mqtt_mock)
Test intentName format user_XXX__intentName.
Test intentName format user_XXX__intentName.
async def test_snips_intent_user(hass, mqtt_mock): """Test intentName format user_XXX__intentName.""" result = await async_setup_component(hass, "snips", {"snips": {}}) assert result payload = """ { "input": "what to do", "intent": { "intentName": "user_ABCDEF123__Lights"...
[ "async", "def", "test_snips_intent_user", "(", "hass", ",", "mqtt_mock", ")", ":", "result", "=", "await", "async_setup_component", "(", "hass", ",", "\"snips\"", ",", "{", "\"snips\"", ":", "{", "}", "}", ")", "assert", "result", "payload", "=", "\"\"\"\n ...
[ 292, 0 ]
[ 313, 41 ]
python
en
['en', 'de', 'en']
True
test_snips_intent_username
(hass, mqtt_mock)
Test intentName format username:intentName.
Test intentName format username:intentName.
async def test_snips_intent_username(hass, mqtt_mock): """Test intentName format username:intentName.""" result = await async_setup_component(hass, "snips", {"snips": {}}) assert result payload = """ { "input": "what to do", "intent": { "intentName": "username:Lights", ...
[ "async", "def", "test_snips_intent_username", "(", "hass", ",", "mqtt_mock", ")", ":", "result", "=", "await", "async_setup_component", "(", "hass", ",", "\"snips\"", ",", "{", "\"snips\"", ":", "{", "}", "}", ")", "assert", "result", "payload", "=", "\"\"\"...
[ 316, 0 ]
[ 337, 41 ]
python
en
['en', 'da', 'en']
True
test_snips_low_probability
(hass, caplog, mqtt_mock)
Test intent via Snips.
Test intent via Snips.
async def test_snips_low_probability(hass, caplog, mqtt_mock): """Test intent via Snips.""" caplog.set_level(logging.WARNING) result = await async_setup_component( hass, "snips", {"snips": {"probability_threshold": 0.5}} ) assert result payload = """ { "input": "I am not sure...
[ "async", "def", "test_snips_low_probability", "(", "hass", ",", "caplog", ",", "mqtt_mock", ")", ":", "caplog", ".", "set_level", "(", "logging", ".", "WARNING", ")", "result", "=", "await", "async_setup_component", "(", "hass", ",", "\"snips\"", ",", "{", "...
[ 340, 0 ]
[ 361, 72 ]
python
da
['en', 'da', 'it']
False
test_intent_special_slots
(hass, mqtt_mock)
Test intent special slot values via Snips.
Test intent special slot values via Snips.
async def test_intent_special_slots(hass, mqtt_mock): """Test intent special slot values via Snips.""" calls = async_mock_service(hass, "light", "turn_on") result = await async_setup_component(hass, "snips", {"snips": {}}) assert result result = await async_setup_component( hass, "in...
[ "async", "def", "test_intent_special_slots", "(", "hass", ",", "mqtt_mock", ")", ":", "calls", "=", "async_mock_service", "(", "hass", ",", "\"light\"", ",", "\"turn_on\"", ")", "result", "=", "await", "async_setup_component", "(", "hass", ",", "\"snips\"", ",",...
[ 364, 0 ]
[ 405, 48 ]
python
en
['en', 'en', 'en']
True
test_snips_say
(hass)
Test snips say with invalid config.
Test snips say with invalid config.
async def test_snips_say(hass): """Test snips say with invalid config.""" calls = async_mock_service(hass, "snips", "say", snips.SERVICE_SCHEMA_SAY) data = {"text": "Hello"} await hass.services.async_call("snips", "say", data) await hass.async_block_till_done() assert len(calls) == 1 assert...
[ "async", "def", "test_snips_say", "(", "hass", ")", ":", "calls", "=", "async_mock_service", "(", "hass", ",", "\"snips\"", ",", "\"say\"", ",", "snips", ".", "SERVICE_SCHEMA_SAY", ")", "data", "=", "{", "\"text\"", ":", "\"Hello\"", "}", "await", "hass", ...
[ 408, 0 ]
[ 418, 43 ]
python
en
['en', 'en', 'en']
True
test_snips_say_action
(hass)
Test snips say_action with invalid config.
Test snips say_action with invalid config.
async def test_snips_say_action(hass): """Test snips say_action with invalid config.""" calls = async_mock_service( hass, "snips", "say_action", snips.SERVICE_SCHEMA_SAY_ACTION ) data = {"text": "Hello", "intent_filter": ["myIntent"]} await hass.services.async_call("snips", "say_action", da...
[ "async", "def", "test_snips_say_action", "(", "hass", ")", ":", "calls", "=", "async_mock_service", "(", "hass", ",", "\"snips\"", ",", "\"say_action\"", ",", "snips", ".", "SERVICE_SCHEMA_SAY_ACTION", ")", "data", "=", "{", "\"text\"", ":", "\"Hello\"", ",", ...
[ 421, 0 ]
[ 435, 57 ]
python
en
['en', 'en', 'en']
True
test_snips_say_invalid_config
(hass)
Test snips say with invalid config.
Test snips say with invalid config.
async def test_snips_say_invalid_config(hass): """Test snips say with invalid config.""" calls = async_mock_service(hass, "snips", "say", snips.SERVICE_SCHEMA_SAY) data = {"text": "Hello", "badKey": "boo"} with pytest.raises(vol.Invalid): await hass.services.async_call("snips", "say", data) ...
[ "async", "def", "test_snips_say_invalid_config", "(", "hass", ")", ":", "calls", "=", "async_mock_service", "(", "hass", ",", "\"snips\"", ",", "\"say\"", ",", "snips", ".", "SERVICE_SCHEMA_SAY", ")", "data", "=", "{", "\"text\"", ":", "\"Hello\"", ",", "\"bad...
[ 438, 0 ]
[ 447, 26 ]
python
en
['en', 'en', 'en']
True
test_snips_say_action_invalid
(hass)
Test snips say_action with invalid config.
Test snips say_action with invalid config.
async def test_snips_say_action_invalid(hass): """Test snips say_action with invalid config.""" calls = async_mock_service( hass, "snips", "say_action", snips.SERVICE_SCHEMA_SAY_ACTION ) data = {"text": "Hello", "can_be_enqueued": "notabool"} with pytest.raises(vol.Invalid): await ...
[ "async", "def", "test_snips_say_action_invalid", "(", "hass", ")", ":", "calls", "=", "async_mock_service", "(", "hass", ",", "\"snips\"", ",", "\"say_action\"", ",", "snips", ".", "SERVICE_SCHEMA_SAY_ACTION", ")", "data", "=", "{", "\"text\"", ":", "\"Hello\"", ...
[ 450, 0 ]
[ 462, 26 ]
python
en
['en', 'en', 'en']
True
test_snips_feedback_on
(hass)
Test snips say with invalid config.
Test snips say with invalid config.
async def test_snips_feedback_on(hass): """Test snips say with invalid config.""" calls = async_mock_service( hass, "snips", "feedback_on", snips.SERVICE_SCHEMA_FEEDBACK ) data = {"site_id": "remote"} await hass.services.async_call("snips", "feedback_on", data) await hass.async_block_ti...
[ "async", "def", "test_snips_feedback_on", "(", "hass", ")", ":", "calls", "=", "async_mock_service", "(", "hass", ",", "\"snips\"", ",", "\"feedback_on\"", ",", "snips", ".", "SERVICE_SCHEMA_FEEDBACK", ")", "data", "=", "{", "\"site_id\"", ":", "\"remote\"", "}"...
[ 465, 0 ]
[ 478, 47 ]
python
en
['en', 'en', 'en']
True
test_snips_feedback_off
(hass)
Test snips say with invalid config.
Test snips say with invalid config.
async def test_snips_feedback_off(hass): """Test snips say with invalid config.""" calls = async_mock_service( hass, "snips", "feedback_off", snips.SERVICE_SCHEMA_FEEDBACK ) data = {"site_id": "remote"} await hass.services.async_call("snips", "feedback_off", data) await hass.async_block...
[ "async", "def", "test_snips_feedback_off", "(", "hass", ")", ":", "calls", "=", "async_mock_service", "(", "hass", ",", "\"snips\"", ",", "\"feedback_off\"", ",", "snips", ".", "SERVICE_SCHEMA_FEEDBACK", ")", "data", "=", "{", "\"site_id\"", ":", "\"remote\"", "...
[ 481, 0 ]
[ 494, 47 ]
python
en
['en', 'en', 'en']
True
test_snips_feedback_config
(hass)
Test snips say with invalid config.
Test snips say with invalid config.
async def test_snips_feedback_config(hass): """Test snips say with invalid config.""" calls = async_mock_service( hass, "snips", "feedback_on", snips.SERVICE_SCHEMA_FEEDBACK ) data = {"site_id": "remote", "test": "test"} with pytest.raises(vol.Invalid): await hass.services.async_cal...
[ "async", "def", "test_snips_feedback_config", "(", "hass", ")", ":", "calls", "=", "async_mock_service", "(", "hass", ",", "\"snips\"", ",", "\"feedback_on\"", ",", "snips", ".", "SERVICE_SCHEMA_FEEDBACK", ")", "data", "=", "{", "\"site_id\"", ":", "\"remote\"", ...
[ 497, 0 ]
[ 508, 26 ]
python
en
['en', 'en', 'en']
True
StreamitSender.run
(self)
Entry point of this process.
Entry point of this process.
def run(self): """Entry point of this process.""" loop = asyncio.get_event_loop() loop.run_until_complete(self._start(loop)) try: loop.run_forever() except Exception as e: print(e)
[ "def", "run", "(", "self", ")", ":", "loop", "=", "asyncio", ".", "get_event_loop", "(", ")", "loop", ".", "run_until_complete", "(", "self", ".", "_start", "(", "loop", ")", ")", "try", ":", "loop", ".", "run_forever", "(", ")", "except", "Exception",...
[ 39, 4 ]
[ 48, 20 ]
python
en
['en', 'en', 'en']
True
FullyConnectedBlock._build_layer
(self, input_dim, output_dim, head: bool = False)
Build basic layer. BN -> Linear -> Activation -> Dropout
Build basic layer.
def _build_layer(self, input_dim, output_dim, head: bool = False): """Build basic layer. BN -> Linear -> Activation -> Dropout """ components = [] if self._batch_norm: components.append(("batch_norm", nn.BatchNorm1d(input_dim))) components.append(("linear", n...
[ "def", "_build_layer", "(", "self", ",", "input_dim", ",", "output_dim", ",", "head", ":", "bool", "=", "False", ")", ":", "components", "=", "[", "]", "if", "self", ".", "_batch_norm", ":", "components", ".", "append", "(", "(", "\"batch_norm\"", ",", ...
[ 98, 4 ]
[ 111, 53 ]
python
en
['en', 'ja', 'en']
True
normalize
(inputs, epsilon=1e-8, scope="ln")
Applies layer normalization. Args: inputs: A tensor with 2 or more dimensions, where the first dimension has `batch_size`. epsilon: A floating number. A very small number for preventing ZeroDivision Error. scope: Optional scope for `variable_scope`. reuse: Boolean, whether to reuse ...
Applies layer normalization.
def normalize(inputs, epsilon=1e-8, scope="ln"): '''Applies layer normalization. Args: inputs: A tensor with 2 or more dimensions, where the first dimension has `batch_size`. epsilon: A floating number. A very small number for preventing ZeroDivision Error. ...
[ "def", "normalize", "(", "inputs", ",", "epsilon", "=", "1e-8", ",", "scope", "=", "\"ln\"", ")", ":", "with", "tf", ".", "variable_scope", "(", "scope", ")", ":", "inputs_shape", "=", "inputs", ".", "get_shape", "(", ")", "params_shape", "=", "inputs_sh...
[ 27, 0 ]
[ 53, 18 ]
python
en
['es', 'en', 'en']
True
multihead_attention
(queries, keys, scope="multihead_attention", num_units=None, num_heads=4, dropout_rate=0, is_training=True, causality=False)
Applies multihead attention. Args: queries: A 3d tensor with shape of [N, T_q, C_q]. keys: A 3d tensor with shape of [N, T_k, C_k]. num_units: A cdscalar. Attention size. dropout_rate: A floating point number. is_training: Boolean. Controller of mechanism for dropout. causality:...
Applies multihead attention.
def multihead_attention(queries, keys, scope="multihead_attention", num_units=None, num_heads=4, dropout_rate=0, is_training=True, causality=False): ...
[ "def", "multihead_attention", "(", "queries", ",", "keys", ",", "scope", "=", "\"multihead_attention\"", ",", "num_units", "=", "None", ",", "num_heads", "=", "4", ",", "dropout_rate", "=", "0", ",", "is_training", "=", "True", ",", "causality", "=", "False"...
[ 56, 0 ]
[ 163, 18 ]
python
en
['fi', 'en', 'en']
True
positional_encoding
(inputs, num_units=None, zero_pad=True, scale=True, scope="positional_encoding", reuse=None)
Return positinal embedding.
Return positinal embedding.
def positional_encoding(inputs, num_units=None, zero_pad=True, scale=True, scope="positional_encoding", reuse=None): ''' Return positinal embedding. ''' Shape = tf.shape(inputs) N ...
[ "def", "positional_encoding", "(", "inputs", ",", "num_units", "=", "None", ",", "zero_pad", "=", "True", ",", "scale", "=", "True", ",", "scope", "=", "\"positional_encoding\"", ",", "reuse", "=", "None", ")", ":", "Shape", "=", "tf", ".", "shape", "(",...
[ 166, 0 ]
[ 204, 22 ]
python
en
['en', 'error', 'th']
False