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
TuyaScene.activate
(self, **kwargs: Any)
Activate the scene.
Activate the scene.
def activate(self, **kwargs: Any) -> None: """Activate the scene.""" self._tuya.activate()
[ "def", "activate", "(", "self", ",", "*", "*", "kwargs", ":", "Any", ")", "->", "None", ":", "self", ".", "_tuya", ".", "activate", "(", ")" ]
[ 58, 4 ]
[ 60, 29 ]
python
en
['en', 'it', '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_conditions
(hass, device_reg, entity_reg)
Test we get the expected conditions from a climate.
Test we get the expected conditions from a climate.
async def test_get_conditions(hass, device_reg, entity_reg): """Test we get the expected conditions from a climate.""" 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_conditions", "(", "hass", ",", "device_reg", ",", "entity_reg", ")", ":", "config_entry", "=", "MockConfigEntry", "(", "domain", "=", "\"test\"", ",", "data", "=", "{", "}", ")", "config_entry", ".", "add_to_hass", "(", "hass", ")",...
[ 37, 0 ]
[ 73, 54 ]
python
en
['en', 'en', 'en']
True
test_get_conditions_hvac_only
(hass, device_reg, entity_reg)
Test we get the expected conditions from a climate.
Test we get the expected conditions from a climate.
async def test_get_conditions_hvac_only(hass, device_reg, entity_reg): """Test we get the expected conditions from a climate.""" 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...
[ "async", "def", "test_get_conditions_hvac_only", "(", "hass", ",", "device_reg", ",", "entity_reg", ")", ":", "config_entry", "=", "MockConfigEntry", "(", "domain", "=", "\"test\"", ",", "data", "=", "{", "}", ")", "config_entry", ".", "add_to_hass", "(", "has...
[ 76, 0 ]
[ 105, 54 ]
python
en
['en', 'en', 'en']
True
test_if_state
(hass, calls)
Test for turn_on and turn_off conditions.
Test for turn_on and turn_off conditions.
async def test_if_state(hass, calls): """Test for turn_on and turn_off conditions.""" hass.states.async_set( "climate.entity", const.HVAC_MODE_COOL, { const.ATTR_HVAC_MODE: const.HVAC_MODE_COOL, const.ATTR_PRESET_MODE: const.PRESET_AWAY, }, ) asse...
[ "async", "def", "test_if_state", "(", "hass", ",", "calls", ")", ":", "hass", ".", "states", ".", "async_set", "(", "\"climate.entity\"", ",", "const", ".", "HVAC_MODE_COOL", ",", "{", "const", ".", "ATTR_HVAC_MODE", ":", "const", ".", "HVAC_MODE_COOL", ",",...
[ 108, 0 ]
[ 202, 26 ]
python
en
['en', 'en', 'en']
True
EventLinkedList.clear
(self)
Clear current events.
Clear current events.
def clear(self): """Clear current events.""" # We just drop the next events reference, GC or EventPool will collect them. self._head._next_event_ = None self._tail = self._head self._count = 0
[ "def", "clear", "(", "self", ")", ":", "# We just drop the next events reference, GC or EventPool will collect them.", "self", ".", "_head", ".", "_next_event_", "=", "None", "self", ".", "_tail", "=", "self", ".", "_head", "self", ".", "_count", "=", "0" ]
[ 47, 4 ]
[ 53, 23 ]
python
en
['fr', 'en', 'en']
True
EventLinkedList.append
(self, event: Event)
Append an event to the end. Args: event (Event): New event to append.
Append an event to the end.
def append(self, event: Event): """Append an event to the end. Args: event (Event): New event to append. """ # Link to the tail, update the tail. self._tail._next_event_ = event self._tail = event # Counting. self._count += 1
[ "def", "append", "(", "self", ",", "event", ":", "Event", ")", ":", "# Link to the tail, update the tail.", "self", ".", "_tail", ".", "_next_event_", "=", "event", "self", ".", "_tail", "=", "event", "# Counting.", "self", ".", "_count", "+=", "1" ]
[ 55, 4 ]
[ 66, 24 ]
python
en
['en', 'en', 'en']
True
EventLinkedList.insert
(self, event: Event)
Insert an event to the head, will be the first one to pop. Args: event (Event): Event to insert.
Insert an event to the head, will be the first one to pop.
def insert(self, event: Event): """Insert an event to the head, will be the first one to pop. Args: event (Event): Event to insert. """ # Link to head, update head. event._next_event_ = self._head._next_event_ self._head._next_event_ = event # Counti...
[ "def", "insert", "(", "self", ",", "event", ":", "Event", ")", ":", "# Link to head, update head.", "event", ".", "_next_event_", "=", "self", ".", "_head", ".", "_next_event_", "self", ".", "_head", ".", "_next_event_", "=", "event", "# Counting.", "self", ...
[ 68, 4 ]
[ 79, 24 ]
python
en
['en', 'en', 'en']
True
EventLinkedList.pop
(self)
Pop first event that its state is not Finished. Returns: Union[Event, EventList]: A list of decision events if current event is decision event, or an AtomEvent.
Pop first event that its state is not Finished.
def pop(self) -> Union[Event, EventList]: """Pop first event that its state is not Finished. Returns: Union[Event, EventList]: A list of decision events if current event is decision event, or an AtomEvent. """ event: Event = self._head._next_event_ while event is no...
[ "def", "pop", "(", "self", ")", "->", "Union", "[", "Event", ",", "EventList", "]", ":", "event", ":", "Event", "=", "self", ".", "_head", ".", "_next_event_", "while", "event", "is", "not", "None", ":", "# We will remove event from list until its state is FIN...
[ 81, 4 ]
[ 125, 19 ]
python
en
['en', 'en', 'en']
True
EventLinkedList.__len__
(self)
Length of current list.
Length of current list.
def __len__(self): """Length of current list.""" return self._count
[ "def", "__len__", "(", "self", ")", ":", "return", "self", ".", "_count" ]
[ 127, 4 ]
[ 129, 26 ]
python
en
['en', 'en', 'en']
True
EventLinkedList.__iter__
(self)
Beginning of for loopping.
Beginning of for loopping.
def __iter__(self): """Beginning of for loopping.""" self._iter_cur_event = self._head return self
[ "def", "__iter__", "(", "self", ")", ":", "self", ".", "_iter_cur_event", "=", "self", ".", "_head", "return", "self" ]
[ 131, 4 ]
[ 135, 19 ]
python
en
['en', 'en', 'en']
True
EventLinkedList.__next__
(self)
Get next item for 'for' loopping.
Get next item for 'for' loopping.
def __next__(self): """Get next item for 'for' loopping.""" event: Event = None if self._iter_cur_event is None: raise StopIteration() if self._iter_cur_event is not None: event = self._iter_cur_event._next_event_ if event is None: r...
[ "def", "__next__", "(", "self", ")", ":", "event", ":", "Event", "=", "None", "if", "self", ".", "_iter_cur_event", "is", "None", ":", "raise", "StopIteration", "(", ")", "if", "self", ".", "_iter_cur_event", "is", "not", "None", ":", "event", "=", "se...
[ 137, 4 ]
[ 152, 20 ]
python
en
['en', 'en', 'en']
True
EventLinkedList._extract_sub_events
(self, event: Event)
Extract sub events (immediate events) of CascadeEvent to the head. Args: event (Event): Event to extract.
Extract sub events (immediate events) of CascadeEvent to the head.
def _extract_sub_events(self, event: Event): """Extract sub events (immediate events) of CascadeEvent to the head. Args: event (Event): Event to extract. """ if type(event) == CascadeEvent: # Make immediate event list as the head of current list. if e...
[ "def", "_extract_sub_events", "(", "self", ",", "event", ":", "Event", ")", ":", "if", "type", "(", "event", ")", "==", "CascadeEvent", ":", "# Make immediate event list as the head of current list.", "if", "event", ".", "_last_immediate_event", "is", "not", "None",...
[ 154, 4 ]
[ 170, 50 ]
python
en
['en', 'en', 'en']
True
setup
(hass, config)
Set up an Arlo component.
Set up an Arlo component.
def setup(hass, config): """Set up an Arlo component.""" conf = config[DOMAIN] username = conf[CONF_USERNAME] password = conf[CONF_PASSWORD] scan_interval = conf[CONF_SCAN_INTERVAL] try: arlo = PyArlo(username, password, preload=False) if not arlo.is_connected: retu...
[ "def", "setup", "(", "hass", ",", "config", ")", ":", "conf", "=", "config", "[", "DOMAIN", "]", "username", "=", "conf", "[", "CONF_USERNAME", "]", "password", "=", "conf", "[", "CONF_PASSWORD", "]", "scan_interval", "=", "conf", "[", "CONF_SCAN_INTERVAL"...
[ 42, 0 ]
[ 86, 15 ]
python
en
['en', 'en', 'en']
True
Auth.__init__
(self, hass, client_id, client_secret)
Initialize the Auth class.
Initialize the Auth class.
def __init__(self, hass, client_id, client_secret): """Initialize the Auth class.""" self.hass = hass self.client_id = client_id self.client_secret = client_secret self._prefs = None self._store = hass.helpers.storage.Store(STORAGE_VERSION, STORAGE_KEY) self._g...
[ "def", "__init__", "(", "self", ",", "hass", ",", "client_id", ",", "client_secret", ")", ":", "self", ".", "hass", "=", "hass", "self", ".", "client_id", "=", "client_id", "self", ".", "client_secret", "=", "client_secret", "self", ".", "_prefs", "=", "...
[ 30, 4 ]
[ 40, 45 ]
python
en
['en', 'en', 'en']
True
Auth.async_do_auth
(self, accept_grant_code)
Do authentication with an AcceptGrant code.
Do authentication with an AcceptGrant code.
async def async_do_auth(self, accept_grant_code): """Do authentication with an AcceptGrant code.""" # access token not retrieved yet for the first time, so this should # be an access token request lwa_params = { "grant_type": "authorization_code", "code": accept_...
[ "async", "def", "async_do_auth", "(", "self", ",", "accept_grant_code", ")", ":", "# access token not retrieved yet for the first time, so this should", "# be an access token request", "lwa_params", "=", "{", "\"grant_type\"", ":", "\"authorization_code\"", ",", "\"code\"", ":"...
[ 42, 4 ]
[ 58, 62 ]
python
en
['en', 'en', 'en']
True
Auth.async_invalidate_access_token
(self)
Invalidate access token.
Invalidate access token.
def async_invalidate_access_token(self): """Invalidate access token.""" self._prefs[STORAGE_ACCESS_TOKEN] = None
[ "def", "async_invalidate_access_token", "(", "self", ")", ":", "self", ".", "_prefs", "[", "STORAGE_ACCESS_TOKEN", "]", "=", "None" ]
[ 61, 4 ]
[ 63, 48 ]
python
en
['en', 'fi', 'en']
True
Auth.async_get_access_token
(self)
Perform access token or token refresh request.
Perform access token or token refresh request.
async def async_get_access_token(self): """Perform access token or token refresh request.""" async with self._get_token_lock: if self._prefs is None: await self.async_load_preferences() if self.is_token_valid(): _LOGGER.debug("Token still valid, u...
[ "async", "def", "async_get_access_token", "(", "self", ")", ":", "async", "with", "self", ".", "_get_token_lock", ":", "if", "self", ".", "_prefs", "is", "None", ":", "await", "self", ".", "async_load_preferences", "(", ")", "if", "self", ".", "is_token_vali...
[ 65, 4 ]
[ 87, 66 ]
python
en
['en', 'nl', 'en']
True
Auth.is_token_valid
(self)
Check if a token is already loaded and if it is still valid.
Check if a token is already loaded and if it is still valid.
def is_token_valid(self): """Check if a token is already loaded and if it is still valid.""" if not self._prefs[STORAGE_ACCESS_TOKEN]: return False expire_time = dt.parse_datetime(self._prefs[STORAGE_EXPIRE_TIME]) preemptive_expire_time = expire_time - timedelta( ...
[ "def", "is_token_valid", "(", "self", ")", ":", "if", "not", "self", ".", "_prefs", "[", "STORAGE_ACCESS_TOKEN", "]", ":", "return", "False", "expire_time", "=", "dt", ".", "parse_datetime", "(", "self", ".", "_prefs", "[", "STORAGE_EXPIRE_TIME", "]", ")", ...
[ 90, 4 ]
[ 100, 51 ]
python
en
['en', 'en', 'en']
True
Auth.async_load_preferences
(self)
Load preferences with stored tokens.
Load preferences with stored tokens.
async def async_load_preferences(self): """Load preferences with stored tokens.""" self._prefs = await self._store.async_load() if self._prefs is None: self._prefs = { STORAGE_ACCESS_TOKEN: None, STORAGE_REFRESH_TOKEN: None, STORAGE_EX...
[ "async", "def", "async_load_preferences", "(", "self", ")", ":", "self", ".", "_prefs", "=", "await", "self", ".", "_store", ".", "async_load", "(", ")", "if", "self", ".", "_prefs", "is", "None", ":", "self", ".", "_prefs", "=", "{", "STORAGE_ACCESS_TOK...
[ 139, 4 ]
[ 148, 13 ]
python
en
['en', 'en', 'en']
True
Auth._async_update_preferences
(self, access_token, refresh_token, expire_time)
Update user preferences.
Update user preferences.
async def _async_update_preferences(self, access_token, refresh_token, expire_time): """Update user preferences.""" if self._prefs is None: await self.async_load_preferences() if access_token is not None: self._prefs[STORAGE_ACCESS_TOKEN] = access_token if refres...
[ "async", "def", "_async_update_preferences", "(", "self", ",", "access_token", ",", "refresh_token", ",", "expire_time", ")", ":", "if", "self", ".", "_prefs", "is", "None", ":", "await", "self", ".", "async_load_preferences", "(", ")", "if", "access_token", "...
[ 150, 4 ]
[ 161, 49 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
(hass, config_entry, async_add_entities)
Set up the Insteon switches from a config entry.
Set up the Insteon switches from a config entry.
async def async_setup_entry(hass, config_entry, async_add_entities): """Set up the Insteon switches from a config entry.""" def add_entities(discovery_info=None): """Add the Insteon entities for the platform.""" async_add_insteon_entities( hass, SWITCH_DOMAIN, InsteonSwitchEntity, a...
[ "async", "def", "async_setup_entry", "(", "hass", ",", "config_entry", ",", "async_add_entities", ")", ":", "def", "add_entities", "(", "discovery_info", "=", "None", ")", ":", "\"\"\"Add the Insteon entities for the platform.\"\"\"", "async_add_insteon_entities", "(", "h...
[ 9, 0 ]
[ 20, 18 ]
python
en
['en', 'en', 'en']
True
InsteonSwitchEntity.is_on
(self)
Return the boolean response if the node is on.
Return the boolean response if the node is on.
def is_on(self): """Return the boolean response if the node is on.""" return bool(self._insteon_device_group.value)
[ "def", "is_on", "(", "self", ")", ":", "return", "bool", "(", "self", ".", "_insteon_device_group", ".", "value", ")" ]
[ 27, 4 ]
[ 29, 53 ]
python
en
['en', 'en', 'en']
True
InsteonSwitchEntity.async_turn_on
(self, **kwargs)
Turn switch on.
Turn switch on.
async def async_turn_on(self, **kwargs): """Turn switch on.""" await self._insteon_device.async_on(group=self._insteon_device_group.group)
[ "async", "def", "async_turn_on", "(", "self", ",", "*", "*", "kwargs", ")", ":", "await", "self", ".", "_insteon_device", ".", "async_on", "(", "group", "=", "self", ".", "_insteon_device_group", ".", "group", ")" ]
[ 31, 4 ]
[ 33, 83 ]
python
en
['en', 'en', 'en']
True
InsteonSwitchEntity.async_turn_off
(self, **kwargs)
Turn switch off.
Turn switch off.
async def async_turn_off(self, **kwargs): """Turn switch off.""" await self._insteon_device.async_off(group=self._insteon_device_group.group)
[ "async", "def", "async_turn_off", "(", "self", ",", "*", "*", "kwargs", ")", ":", "await", "self", ".", "_insteon_device", ".", "async_off", "(", "group", "=", "self", ".", "_insteon_device_group", ".", "group", ")" ]
[ 35, 4 ]
[ 37, 84 ]
python
en
['en', 'en', 'en']
True
create_auth_code
(hass, client_id: str, user: User)
Create an authorization code to fetch tokens.
Create an authorization code to fetch tokens.
def create_auth_code(hass, client_id: str, user: User) -> str: """Create an authorization code to fetch tokens.""" return hass.data[DOMAIN](client_id, user)
[ "def", "create_auth_code", "(", "hass", ",", "client_id", ":", "str", ",", "user", ":", "User", ")", "->", "str", ":", "return", "hass", ".", "data", "[", "DOMAIN", "]", "(", "client_id", ",", "user", ")" ]
[ 182, 0 ]
[ 184, 45 ]
python
en
['en', 'en', 'en']
True
async_setup
(hass, config)
Component to allow users to login.
Component to allow users to login.
async def async_setup(hass, config): """Component to allow users to login.""" store_result, retrieve_result = _create_auth_code_store() hass.data[DOMAIN] = store_result hass.http.register_view(TokenView(retrieve_result)) hass.http.register_view(LinkUserView(retrieve_result)) hass.components.w...
[ "async", "def", "async_setup", "(", "hass", ",", "config", ")", ":", "store_result", ",", "retrieve_result", "=", "_create_auth_code_store", "(", ")", "hass", ".", "data", "[", "DOMAIN", "]", "=", "store_result", "hass", ".", "http", ".", "register_view", "(...
[ 187, 0 ]
[ 219, 15 ]
python
en
['en', 'en', 'en']
True
_create_auth_code_store
()
Create an in memory store.
Create an in memory store.
def _create_auth_code_store(): """Create an in memory store.""" temp_results = {} @callback def store_result(client_id, result): """Store flow result and return a code to retrieve it.""" if isinstance(result, User): result_type = RESULT_TYPE_USER elif isinstance(resu...
[ "def", "_create_auth_code_store", "(", ")", ":", "temp_results", "=", "{", "}", "@", "callback", "def", "store_result", "(", "client_id", ",", "result", ")", ":", "\"\"\"Store flow result and return a code to retrieve it.\"\"\"", "if", "isinstance", "(", "result", ","...
[ 389, 0 ]
[ 430, 40 ]
python
en
['en', 'en', 'en']
True
websocket_current_user
( hass: HomeAssistant, connection: websocket_api.ActiveConnection, msg )
Return the current user.
Return the current user.
async def websocket_current_user( hass: HomeAssistant, connection: websocket_api.ActiveConnection, msg ): """Return the current user.""" user = connection.user enabled_modules = await hass.auth.async_get_enabled_mfa(user) connection.send_message( websocket_api.result_message( ms...
[ "async", "def", "websocket_current_user", "(", "hass", ":", "HomeAssistant", ",", "connection", ":", "websocket_api", ".", "ActiveConnection", ",", "msg", ")", ":", "user", "=", "connection", ".", "user", "enabled_modules", "=", "await", "hass", ".", "auth", "...
[ 435, 0 ]
[ 467, 5 ]
python
en
['en', 'en', 'en']
True
websocket_create_long_lived_access_token
( hass: HomeAssistant, connection: websocket_api.ActiveConnection, msg )
Create or a long-lived access token.
Create or a long-lived access token.
async def websocket_create_long_lived_access_token( hass: HomeAssistant, connection: websocket_api.ActiveConnection, msg ): """Create or a long-lived access token.""" refresh_token = await hass.auth.async_create_refresh_token( connection.user, client_name=msg["client_name"], client_i...
[ "async", "def", "websocket_create_long_lived_access_token", "(", "hass", ":", "HomeAssistant", ",", "connection", ":", "websocket_api", ".", "ActiveConnection", ",", "msg", ")", ":", "refresh_token", "=", "await", "hass", ".", "auth", ".", "async_create_refresh_token"...
[ 472, 0 ]
[ 486, 82 ]
python
en
['en', 'en', 'en']
True
websocket_refresh_tokens
( hass: HomeAssistant, connection: websocket_api.ActiveConnection, msg )
Return metadata of users refresh tokens.
Return metadata of users refresh tokens.
def websocket_refresh_tokens( hass: HomeAssistant, connection: websocket_api.ActiveConnection, msg ): """Return metadata of users refresh tokens.""" current_id = connection.refresh_token_id connection.send_message( websocket_api.result_message( msg["id"], [ ...
[ "def", "websocket_refresh_tokens", "(", "hass", ":", "HomeAssistant", ",", "connection", ":", "websocket_api", ".", "ActiveConnection", ",", "msg", ")", ":", "current_id", "=", "connection", ".", "refresh_token_id", "connection", ".", "send_message", "(", "websocket...
[ 491, 0 ]
[ 514, 5 ]
python
en
['en', 'sn', 'en']
True
websocket_delete_refresh_token
( hass: HomeAssistant, connection: websocket_api.ActiveConnection, msg )
Handle a delete refresh token request.
Handle a delete refresh token request.
async def websocket_delete_refresh_token( hass: HomeAssistant, connection: websocket_api.ActiveConnection, msg ): """Handle a delete refresh token request.""" refresh_token = connection.user.refresh_tokens.get(msg["refresh_token_id"]) if refresh_token is None: return websocket_api.error_message...
[ "async", "def", "websocket_delete_refresh_token", "(", "hass", ":", "HomeAssistant", ",", "connection", ":", "websocket_api", ".", "ActiveConnection", ",", "msg", ")", ":", "refresh_token", "=", "connection", ".", "user", ".", "refresh_tokens", ".", "get", "(", ...
[ 519, 0 ]
[ 532, 72 ]
python
en
['en', 'de', 'en']
True
websocket_sign_path
( hass: HomeAssistant, connection: websocket_api.ActiveConnection, msg )
Handle a sign path request.
Handle a sign path request.
def websocket_sign_path( hass: HomeAssistant, connection: websocket_api.ActiveConnection, msg ): """Handle a sign path request.""" connection.send_message( websocket_api.result_message( msg["id"], { "path": async_sign_path( hass, ...
[ "def", "websocket_sign_path", "(", "hass", ":", "HomeAssistant", ",", "connection", ":", "websocket_api", ".", "ActiveConnection", ",", "msg", ")", ":", "connection", ".", "send_message", "(", "websocket_api", ".", "result_message", "(", "msg", "[", "\"id\"", "]...
[ 537, 0 ]
[ 553, 5 ]
python
en
['en', 'en', 'en']
True
TokenView.__init__
(self, retrieve_user)
Initialize the token view.
Initialize the token view.
def __init__(self, retrieve_user): """Initialize the token view.""" self._retrieve_user = retrieve_user
[ "def", "__init__", "(", "self", ",", "retrieve_user", ")", ":", "self", ".", "_retrieve_user", "=", "retrieve_user" ]
[ 230, 4 ]
[ 232, 43 ]
python
en
['en', 'en', 'en']
True
TokenView.post
(self, request)
Grant a token.
Grant a token.
async def post(self, request): """Grant a token.""" hass = request.app["hass"] data = await request.post() grant_type = data.get("grant_type") # IndieAuth 6.3.5 # The revocation endpoint is the same as the token endpoint. # The revocation request includes an add...
[ "async", "def", "post", "(", "self", ",", "request", ")", ":", "hass", "=", "request", ".", "app", "[", "\"hass\"", "]", "data", "=", "await", "request", ".", "post", "(", ")", "grant_type", "=", "data", ".", "get", "(", "\"grant_type\"", ")", "# Ind...
[ 235, 4 ]
[ 257, 9 ]
python
en
['en', 'gl', 'en']
True
TokenView._async_handle_revoke_token
(self, hass, data)
Handle revoke token request.
Handle revoke token request.
async def _async_handle_revoke_token(self, hass, data): """Handle revoke token request.""" # OAuth 2.0 Token Revocation [RFC7009] # 2.2 The authorization server responds with HTTP status code 200 # if the token has been revoked successfully or if the client # submitted an invalid...
[ "async", "def", "_async_handle_revoke_token", "(", "self", ",", "hass", ",", "data", ")", ":", "# OAuth 2.0 Token Revocation [RFC7009]", "# 2.2 The authorization server responds with HTTP status code 200", "# if the token has been revoked successfully or if the client", "# submitted an i...
[ 259, 4 ]
[ 276, 43 ]
python
nl
['nl', 'nl', 'en']
True
TokenView._async_handle_auth_code
(self, hass, data, remote_addr)
Handle authorization code request.
Handle authorization code request.
async def _async_handle_auth_code(self, hass, data, remote_addr): """Handle authorization code request.""" client_id = data.get("client_id") if client_id is None or not indieauth.verify_client_id(client_id): return self.json( {"error": "invalid_request", "error_descri...
[ "async", "def", "_async_handle_auth_code", "(", "self", ",", "hass", ",", "data", ",", "remote_addr", ")", ":", "client_id", "=", "data", ".", "get", "(", "\"client_id\"", ")", "if", "client_id", "is", "None", "or", "not", "indieauth", ".", "verify_client_id...
[ 278, 4 ]
[ 324, 9 ]
python
en
['de', 'en', 'en']
True
TokenView._async_handle_refresh_token
(self, hass, data, remote_addr)
Handle authorization code request.
Handle authorization code request.
async def _async_handle_refresh_token(self, hass, data, remote_addr): """Handle authorization code request.""" client_id = data.get("client_id") if client_id is not None and not indieauth.verify_client_id(client_id): return self.json( {"error": "invalid_request", "err...
[ "async", "def", "_async_handle_refresh_token", "(", "self", ",", "hass", ",", "data", ",", "remote_addr", ")", ":", "client_id", "=", "data", ".", "get", "(", "\"client_id\"", ")", "if", "client_id", "is", "not", "None", "and", "not", "indieauth", ".", "ve...
[ 326, 4 ]
[ 358, 9 ]
python
en
['de', 'en', 'en']
True
LinkUserView.__init__
(self, retrieve_credentials)
Initialize the link user view.
Initialize the link user view.
def __init__(self, retrieve_credentials): """Initialize the link user view.""" self._retrieve_credentials = retrieve_credentials
[ "def", "__init__", "(", "self", ",", "retrieve_credentials", ")", ":", "self", ".", "_retrieve_credentials", "=", "retrieve_credentials" ]
[ 367, 4 ]
[ 369, 57 ]
python
en
['en', 'en', 'en']
True
LinkUserView.post
(self, request, data)
Link a user.
Link a user.
async def post(self, request, data): """Link a user.""" hass = request.app["hass"] user = request["hass_user"] credentials = self._retrieve_credentials( data["client_id"], RESULT_TYPE_CREDENTIALS, data["code"] ) if credentials is None: return sel...
[ "async", "def", "post", "(", "self", ",", "request", ",", "data", ")", ":", "hass", "=", "request", ".", "app", "[", "\"hass\"", "]", "user", "=", "request", "[", "\"hass_user\"", "]", "credentials", "=", "self", ".", "_retrieve_credentials", "(", "data"...
[ 372, 4 ]
[ 385, 47 ]
python
en
['es', 'en', 'en']
True
FlaubertConfig.__init__
(self, layerdrop=0.0, pre_norm=False, pad_token_id=2, bos_token_id=0, **kwargs)
Constructs FlaubertConfig.
Constructs FlaubertConfig.
def __init__(self, layerdrop=0.0, pre_norm=False, pad_token_id=2, bos_token_id=0, **kwargs): """Constructs FlaubertConfig.""" super().__init__(pad_token_id=pad_token_id, bos_token_id=bos_token_id, **kwargs) self.layerdrop = layerdrop self.pre_norm = pre_norm
[ "def", "__init__", "(", "self", ",", "layerdrop", "=", "0.0", ",", "pre_norm", "=", "False", ",", "pad_token_id", "=", "2", ",", "bos_token_id", "=", "0", ",", "*", "*", "kwargs", ")", ":", "super", "(", ")", ".", "__init__", "(", "pad_token_id", "="...
[ 136, 4 ]
[ 140, 32 ]
python
de
['en', 'de', 'it']
False
setup_platform
(hass, config, add_entities, discovery_info=None)
Set up the Verisure platform.
Set up the Verisure platform.
def setup_platform(hass, config, add_entities, discovery_info=None): """Set up the Verisure platform.""" sensors = [] hub.update_overview() if int(hub.config.get(CONF_THERMOMETERS, 1)): sensors.extend( [ VerisureThermometer(device_label) for device_la...
[ "def", "setup_platform", "(", "hass", ",", "config", ",", "add_entities", ",", "discovery_info", "=", "None", ")", ":", "sensors", "=", "[", "]", "hub", ".", "update_overview", "(", ")", "if", "int", "(", "hub", ".", "config", ".", "get", "(", "CONF_TH...
[ 7, 0 ]
[ 42, 25 ]
python
en
['en', 'lv', 'en']
True
VerisureThermometer.__init__
(self, device_label)
Initialize the sensor.
Initialize the sensor.
def __init__(self, device_label): """Initialize the sensor.""" self._device_label = device_label
[ "def", "__init__", "(", "self", ",", "device_label", ")", ":", "self", ".", "_device_label", "=", "device_label" ]
[ 48, 4 ]
[ 50, 41 ]
python
en
['en', 'en', 'en']
True
VerisureThermometer.name
(self)
Return the name of the device.
Return the name of the device.
def name(self): """Return the name of the device.""" return ( hub.get_first( "$.climateValues[?(@.deviceLabel=='%s')].deviceArea", self._device_label ) + " temperature" )
[ "def", "name", "(", "self", ")", ":", "return", "(", "hub", ".", "get_first", "(", "\"$.climateValues[?(@.deviceLabel=='%s')].deviceArea\"", ",", "self", ".", "_device_label", ")", "+", "\" temperature\"", ")" ]
[ 53, 4 ]
[ 60, 9 ]
python
en
['en', 'en', 'en']
True
VerisureThermometer.state
(self)
Return the state of the device.
Return the state of the device.
def state(self): """Return the state of the device.""" return hub.get_first( "$.climateValues[?(@.deviceLabel=='%s')].temperature", self._device_label )
[ "def", "state", "(", "self", ")", ":", "return", "hub", ".", "get_first", "(", "\"$.climateValues[?(@.deviceLabel=='%s')].temperature\"", ",", "self", ".", "_device_label", ")" ]
[ 63, 4 ]
[ 67, 9 ]
python
en
['en', 'en', 'en']
True
VerisureThermometer.available
(self)
Return True if entity is available.
Return True if entity is available.
def available(self): """Return True if entity is available.""" return ( hub.get_first( "$.climateValues[?(@.deviceLabel=='%s')].temperature", self._device_label, ) is not None )
[ "def", "available", "(", "self", ")", ":", "return", "(", "hub", ".", "get_first", "(", "\"$.climateValues[?(@.deviceLabel=='%s')].temperature\"", ",", "self", ".", "_device_label", ",", ")", "is", "not", "None", ")" ]
[ 70, 4 ]
[ 78, 9 ]
python
en
['en', 'en', 'en']
True
VerisureThermometer.unit_of_measurement
(self)
Return the unit of measurement of this entity.
Return the unit of measurement of this entity.
def unit_of_measurement(self): """Return the unit of measurement of this entity.""" return TEMP_CELSIUS
[ "def", "unit_of_measurement", "(", "self", ")", ":", "return", "TEMP_CELSIUS" ]
[ 81, 4 ]
[ 83, 27 ]
python
en
['en', 'en', 'en']
True
VerisureThermometer.update
(self)
Update the sensor.
Update the sensor.
def update(self): """Update the sensor.""" hub.update_overview()
[ "def", "update", "(", "self", ")", ":", "hub", ".", "update_overview", "(", ")" ]
[ 86, 4 ]
[ 88, 29 ]
python
en
['en', 'nl', 'en']
True
VerisureHygrometer.__init__
(self, device_label)
Initialize the sensor.
Initialize the sensor.
def __init__(self, device_label): """Initialize the sensor.""" self._device_label = device_label
[ "def", "__init__", "(", "self", ",", "device_label", ")", ":", "self", ".", "_device_label", "=", "device_label" ]
[ 94, 4 ]
[ 96, 41 ]
python
en
['en', 'en', 'en']
True
VerisureHygrometer.name
(self)
Return the name of the device.
Return the name of the device.
def name(self): """Return the name of the device.""" return ( hub.get_first( "$.climateValues[?(@.deviceLabel=='%s')].deviceArea", self._device_label ) + " humidity" )
[ "def", "name", "(", "self", ")", ":", "return", "(", "hub", ".", "get_first", "(", "\"$.climateValues[?(@.deviceLabel=='%s')].deviceArea\"", ",", "self", ".", "_device_label", ")", "+", "\" humidity\"", ")" ]
[ 99, 4 ]
[ 106, 9 ]
python
en
['en', 'en', 'en']
True
VerisureHygrometer.state
(self)
Return the state of the device.
Return the state of the device.
def state(self): """Return the state of the device.""" return hub.get_first( "$.climateValues[?(@.deviceLabel=='%s')].humidity", self._device_label )
[ "def", "state", "(", "self", ")", ":", "return", "hub", ".", "get_first", "(", "\"$.climateValues[?(@.deviceLabel=='%s')].humidity\"", ",", "self", ".", "_device_label", ")" ]
[ 109, 4 ]
[ 113, 9 ]
python
en
['en', 'en', 'en']
True
VerisureHygrometer.available
(self)
Return True if entity is available.
Return True if entity is available.
def available(self): """Return True if entity is available.""" return ( hub.get_first( "$.climateValues[?(@.deviceLabel=='%s')].humidity", self._device_label ) is not None )
[ "def", "available", "(", "self", ")", ":", "return", "(", "hub", ".", "get_first", "(", "\"$.climateValues[?(@.deviceLabel=='%s')].humidity\"", ",", "self", ".", "_device_label", ")", "is", "not", "None", ")" ]
[ 116, 4 ]
[ 123, 9 ]
python
en
['en', 'en', 'en']
True
VerisureHygrometer.unit_of_measurement
(self)
Return the unit of measurement of this entity.
Return the unit of measurement of this entity.
def unit_of_measurement(self): """Return the unit of measurement of this entity.""" return PERCENTAGE
[ "def", "unit_of_measurement", "(", "self", ")", ":", "return", "PERCENTAGE" ]
[ 126, 4 ]
[ 128, 25 ]
python
en
['en', 'en', 'en']
True
VerisureHygrometer.update
(self)
Update the sensor.
Update the sensor.
def update(self): """Update the sensor.""" hub.update_overview()
[ "def", "update", "(", "self", ")", ":", "hub", ".", "update_overview", "(", ")" ]
[ 131, 4 ]
[ 133, 29 ]
python
en
['en', 'nl', 'en']
True
VerisureMouseDetection.__init__
(self, device_label)
Initialize the sensor.
Initialize the sensor.
def __init__(self, device_label): """Initialize the sensor.""" self._device_label = device_label
[ "def", "__init__", "(", "self", ",", "device_label", ")", ":", "self", ".", "_device_label", "=", "device_label" ]
[ 139, 4 ]
[ 141, 41 ]
python
en
['en', 'en', 'en']
True
VerisureMouseDetection.name
(self)
Return the name of the device.
Return the name of the device.
def name(self): """Return the name of the device.""" return ( hub.get_first( "$.eventCounts[?(@.deviceLabel=='%s')].area", self._device_label ) + " mouse" )
[ "def", "name", "(", "self", ")", ":", "return", "(", "hub", ".", "get_first", "(", "\"$.eventCounts[?(@.deviceLabel=='%s')].area\"", ",", "self", ".", "_device_label", ")", "+", "\" mouse\"", ")" ]
[ 144, 4 ]
[ 151, 9 ]
python
en
['en', 'en', 'en']
True
VerisureMouseDetection.state
(self)
Return the state of the device.
Return the state of the device.
def state(self): """Return the state of the device.""" return hub.get_first( "$.eventCounts[?(@.deviceLabel=='%s')].detections", self._device_label )
[ "def", "state", "(", "self", ")", ":", "return", "hub", ".", "get_first", "(", "\"$.eventCounts[?(@.deviceLabel=='%s')].detections\"", ",", "self", ".", "_device_label", ")" ]
[ 154, 4 ]
[ 158, 9 ]
python
en
['en', 'en', 'en']
True
VerisureMouseDetection.available
(self)
Return True if entity is available.
Return True if entity is available.
def available(self): """Return True if entity is available.""" return ( hub.get_first("$.eventCounts[?(@.deviceLabel=='%s')]", self._device_label) is not None )
[ "def", "available", "(", "self", ")", ":", "return", "(", "hub", ".", "get_first", "(", "\"$.eventCounts[?(@.deviceLabel=='%s')]\"", ",", "self", ".", "_device_label", ")", "is", "not", "None", ")" ]
[ 161, 4 ]
[ 166, 9 ]
python
en
['en', 'en', 'en']
True
VerisureMouseDetection.unit_of_measurement
(self)
Return the unit of measurement of this entity.
Return the unit of measurement of this entity.
def unit_of_measurement(self): """Return the unit of measurement of this entity.""" return "Mice"
[ "def", "unit_of_measurement", "(", "self", ")", ":", "return", "\"Mice\"" ]
[ 169, 4 ]
[ 171, 21 ]
python
en
['en', 'en', 'en']
True
VerisureMouseDetection.update
(self)
Update the sensor.
Update the sensor.
def update(self): """Update the sensor.""" hub.update_overview()
[ "def", "update", "(", "self", ")", ":", "hub", ".", "update_overview", "(", ")" ]
[ 174, 4 ]
[ 176, 29 ]
python
en
['en', 'nl', 'en']
True
round_temp
(temperature)
Round a temperature to the resolution of the thermostat. RadioThermostats can handle 0.5 degree temps so the input temperature is rounded to that value and returned.
Round a temperature to the resolution of the thermostat.
def round_temp(temperature): """Round a temperature to the resolution of the thermostat. RadioThermostats can handle 0.5 degree temps so the input temperature is rounded to that value and returned. """ return round(temperature * 2.0) / 2.0
[ "def", "round_temp", "(", "temperature", ")", ":", "return", "round", "(", "temperature", "*", "2.0", ")", "/", "2.0" ]
[ 82, 0 ]
[ 88, 41 ]
python
en
['en', 'en', 'en']
True
setup_platform
(hass, config, add_entities, discovery_info=None)
Set up the Radio Thermostat.
Set up the Radio Thermostat.
def setup_platform(hass, config, add_entities, discovery_info=None): """Set up the Radio Thermostat.""" hosts = [] if CONF_HOST in config: hosts = config[CONF_HOST] else: hosts.append(radiotherm.discover.discover_address()) if hosts is None: _LOGGER.error("No Radiotherm Ther...
[ "def", "setup_platform", "(", "hass", ",", "config", ",", "add_entities", ",", "discovery_info", "=", "None", ")", ":", "hosts", "=", "[", "]", "if", "CONF_HOST", "in", "config", ":", "hosts", "=", "config", "[", "CONF_HOST", "]", "else", ":", "hosts", ...
[ 102, 0 ]
[ 124, 30 ]
python
en
['en', 'ja', 'en']
True
RadioThermostat.__init__
(self, device, hold_temp)
Initialize the thermostat.
Initialize the thermostat.
def __init__(self, device, hold_temp): """Initialize the thermostat.""" self.device = device self._target_temperature = None self._current_temperature = None self._current_humidity = None self._current_operation = HVAC_MODE_OFF self._name = None self._fmod...
[ "def", "__init__", "(", "self", ",", "device", ",", "hold_temp", ")", ":", "self", ".", "device", "=", "device", "self", ".", "_target_temperature", "=", "None", "self", ".", "_current_temperature", "=", "None", "self", ".", "_current_humidity", "=", "None",...
[ 130, 4 ]
[ 150, 81 ]
python
en
['en', 'en', 'en']
True
RadioThermostat.supported_features
(self)
Return the list of supported features.
Return the list of supported features.
def supported_features(self): """Return the list of supported features.""" return SUPPORT_FLAGS
[ "def", "supported_features", "(", "self", ")", ":", "return", "SUPPORT_FLAGS" ]
[ 153, 4 ]
[ 155, 28 ]
python
en
['en', 'en', 'en']
True
RadioThermostat.async_added_to_hass
(self)
Register callbacks.
Register callbacks.
async def async_added_to_hass(self): """Register callbacks.""" # Set the time on the device. This shouldn't be in the # constructor because it's a network call. We can't put it in # update() because calling it will clear any temporary mode or # temperature in the thermostat. S...
[ "async", "def", "async_added_to_hass", "(", "self", ")", ":", "# Set the time on the device. This shouldn't be in the", "# constructor because it's a network call. We can't put it in", "# update() because calling it will clear any temporary mode or", "# temperature in the thermostat. So add i...
[ 157, 4 ]
[ 164, 46 ]
python
en
['en', 'no', 'en']
False
RadioThermostat.name
(self)
Return the name of the Radio Thermostat.
Return the name of the Radio Thermostat.
def name(self): """Return the name of the Radio Thermostat.""" return self._name
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "_name" ]
[ 167, 4 ]
[ 169, 25 ]
python
en
['en', 'en', 'en']
True
RadioThermostat.temperature_unit
(self)
Return the unit of measurement.
Return the unit of measurement.
def temperature_unit(self): """Return the unit of measurement.""" return TEMP_FAHRENHEIT
[ "def", "temperature_unit", "(", "self", ")", ":", "return", "TEMP_FAHRENHEIT" ]
[ 172, 4 ]
[ 174, 30 ]
python
en
['en', 'la', 'en']
True
RadioThermostat.precision
(self)
Return the precision of the system.
Return the precision of the system.
def precision(self): """Return the precision of the system.""" return PRECISION_HALVES
[ "def", "precision", "(", "self", ")", ":", "return", "PRECISION_HALVES" ]
[ 177, 4 ]
[ 179, 31 ]
python
en
['en', 'en', 'en']
True
RadioThermostat.device_state_attributes
(self)
Return the device specific state attributes.
Return the device specific state attributes.
def device_state_attributes(self): """Return the device specific state attributes.""" return {ATTR_FAN_ACTION: self._fstate}
[ "def", "device_state_attributes", "(", "self", ")", ":", "return", "{", "ATTR_FAN_ACTION", ":", "self", ".", "_fstate", "}" ]
[ 182, 4 ]
[ 184, 46 ]
python
en
['en', 'en', 'en']
True
RadioThermostat.fan_modes
(self)
List of available fan modes.
List of available fan modes.
def fan_modes(self): """List of available fan modes.""" if self._is_model_ct80: return CT80_FAN_OPERATION_LIST return CT30_FAN_OPERATION_LIST
[ "def", "fan_modes", "(", "self", ")", ":", "if", "self", ".", "_is_model_ct80", ":", "return", "CT80_FAN_OPERATION_LIST", "return", "CT30_FAN_OPERATION_LIST" ]
[ 187, 4 ]
[ 191, 38 ]
python
en
['en', 'en', 'en']
True
RadioThermostat.fan_mode
(self)
Return whether the fan is on.
Return whether the fan is on.
def fan_mode(self): """Return whether the fan is on.""" return self._fmode
[ "def", "fan_mode", "(", "self", ")", ":", "return", "self", ".", "_fmode" ]
[ 194, 4 ]
[ 196, 26 ]
python
en
['en', 'en', 'en']
True
RadioThermostat.set_fan_mode
(self, fan_mode)
Turn fan on/off.
Turn fan on/off.
def set_fan_mode(self, fan_mode): """Turn fan on/off.""" code = FAN_MODE_TO_CODE.get(fan_mode) if code is not None: self.device.fmode = code
[ "def", "set_fan_mode", "(", "self", ",", "fan_mode", ")", ":", "code", "=", "FAN_MODE_TO_CODE", ".", "get", "(", "fan_mode", ")", "if", "code", "is", "not", "None", ":", "self", ".", "device", ".", "fmode", "=", "code" ]
[ 198, 4 ]
[ 202, 36 ]
python
en
['en', 'fy', 'en']
True
RadioThermostat.current_temperature
(self)
Return the current temperature.
Return the current temperature.
def current_temperature(self): """Return the current temperature.""" return self._current_temperature
[ "def", "current_temperature", "(", "self", ")", ":", "return", "self", ".", "_current_temperature" ]
[ 205, 4 ]
[ 207, 40 ]
python
en
['en', 'la', 'en']
True
RadioThermostat.current_humidity
(self)
Return the current temperature.
Return the current temperature.
def current_humidity(self): """Return the current temperature.""" return self._current_humidity
[ "def", "current_humidity", "(", "self", ")", ":", "return", "self", ".", "_current_humidity" ]
[ 210, 4 ]
[ 212, 37 ]
python
en
['en', 'la', 'en']
True
RadioThermostat.hvac_mode
(self)
Return the current operation. head, cool idle.
Return the current operation. head, cool idle.
def hvac_mode(self): """Return the current operation. head, cool idle.""" return self._current_operation
[ "def", "hvac_mode", "(", "self", ")", ":", "return", "self", ".", "_current_operation" ]
[ 215, 4 ]
[ 217, 38 ]
python
en
['en', 'en', 'en']
True
RadioThermostat.hvac_modes
(self)
Return the operation modes list.
Return the operation modes list.
def hvac_modes(self): """Return the operation modes list.""" return OPERATION_LIST
[ "def", "hvac_modes", "(", "self", ")", ":", "return", "OPERATION_LIST" ]
[ 220, 4 ]
[ 222, 29 ]
python
en
['en', 'en', 'en']
True
RadioThermostat.hvac_action
(self)
Return the current running hvac operation if supported.
Return the current running hvac operation if supported.
def hvac_action(self): """Return the current running hvac operation if supported.""" if self.hvac_mode == HVAC_MODE_OFF: return None return self._tstate
[ "def", "hvac_action", "(", "self", ")", ":", "if", "self", ".", "hvac_mode", "==", "HVAC_MODE_OFF", ":", "return", "None", "return", "self", ".", "_tstate" ]
[ 225, 4 ]
[ 229, 27 ]
python
en
['en', 'en', 'en']
True
RadioThermostat.target_temperature
(self)
Return the temperature we try to reach.
Return the temperature we try to reach.
def target_temperature(self): """Return the temperature we try to reach.""" return self._target_temperature
[ "def", "target_temperature", "(", "self", ")", ":", "return", "self", ".", "_target_temperature" ]
[ 232, 4 ]
[ 234, 39 ]
python
en
['en', 'en', 'en']
True
RadioThermostat.preset_mode
(self)
Return the current preset mode, e.g., home, away, temp.
Return the current preset mode, e.g., home, away, temp.
def preset_mode(self): """Return the current preset mode, e.g., home, away, temp.""" if self._program_mode == 0: return PRESET_HOME if self._program_mode == 1: return PRESET_ALTERNATE if self._program_mode == 2: return PRESET_AWAY if self._prog...
[ "def", "preset_mode", "(", "self", ")", ":", "if", "self", ".", "_program_mode", "==", "0", ":", "return", "PRESET_HOME", "if", "self", ".", "_program_mode", "==", "1", ":", "return", "PRESET_ALTERNATE", "if", "self", ".", "_program_mode", "==", "2", ":", ...
[ 237, 4 ]
[ 246, 33 ]
python
en
['en', 'pt', 'en']
True
RadioThermostat.preset_modes
(self)
Return a list of available preset modes.
Return a list of available preset modes.
def preset_modes(self): """Return a list of available preset modes.""" return PRESET_MODES
[ "def", "preset_modes", "(", "self", ")", ":", "return", "PRESET_MODES" ]
[ 249, 4 ]
[ 251, 27 ]
python
en
['en', 'en', 'en']
True
RadioThermostat.update
(self)
Update and validate the data from the thermostat.
Update and validate the data from the thermostat.
def update(self): """Update and validate the data from the thermostat.""" # Radio thermostats are very slow, and sometimes don't respond # very quickly. So we need to keep the number of calls to them # to a bare minimum or we'll hit the Home Assistant 10 sec warning. We # have ...
[ "def", "update", "(", "self", ")", ":", "# Radio thermostats are very slow, and sometimes don't respond", "# very quickly. So we need to keep the number of calls to them", "# to a bare minimum or we'll hit the Home Assistant 10 sec warning. We", "# have to make one call to /tstat to get temps bu...
[ 253, 4 ]
[ 316, 51 ]
python
en
['en', 'en', 'en']
True
RadioThermostat.set_temperature
(self, **kwargs)
Set new target temperature.
Set new target temperature.
def set_temperature(self, **kwargs): """Set new target temperature.""" temperature = kwargs.get(ATTR_TEMPERATURE) if temperature is None: return temperature = round_temp(temperature) if self._current_operation == HVAC_MODE_COOL: self.device.t_cool = temp...
[ "def", "set_temperature", "(", "self", ",", "*", "*", "kwargs", ")", ":", "temperature", "=", "kwargs", ".", "get", "(", "ATTR_TEMPERATURE", ")", "if", "temperature", "is", "None", ":", "return", "temperature", "=", "round_temp", "(", "temperature", ")", "...
[ 318, 4 ]
[ 343, 36 ]
python
en
['en', 'ca', 'en']
True
RadioThermostat.set_time
(self)
Set device time.
Set device time.
def set_time(self): """Set device time.""" # Calling this clears any local temperature override and # reverts to the scheduled temperature. now = dt_util.now() self.device.time = { "day": now.weekday(), "hour": now.hour, "minute": now.minute, ...
[ "def", "set_time", "(", "self", ")", ":", "# Calling this clears any local temperature override and", "# reverts to the scheduled temperature.", "now", "=", "dt_util", ".", "now", "(", ")", "self", ".", "device", ".", "time", "=", "{", "\"day\"", ":", "now", ".", ...
[ 345, 4 ]
[ 354, 9 ]
python
en
['fr', 'en', 'en']
True
RadioThermostat.set_hvac_mode
(self, hvac_mode)
Set operation mode (auto, cool, heat, off).
Set operation mode (auto, cool, heat, off).
def set_hvac_mode(self, hvac_mode): """Set operation mode (auto, cool, heat, off).""" if hvac_mode in (HVAC_MODE_OFF, HVAC_MODE_AUTO): self.device.tmode = TEMP_MODE_TO_CODE[hvac_mode] # Setting t_cool or t_heat automatically changes tmode. elif hvac_mode == HVAC_MODE_COOL: ...
[ "def", "set_hvac_mode", "(", "self", ",", "hvac_mode", ")", ":", "if", "hvac_mode", "in", "(", "HVAC_MODE_OFF", ",", "HVAC_MODE_AUTO", ")", ":", "self", ".", "device", ".", "tmode", "=", "TEMP_MODE_TO_CODE", "[", "hvac_mode", "]", "# Setting t_cool or t_heat aut...
[ 356, 4 ]
[ 365, 57 ]
python
en
['nl', 'ny', 'en']
False
RadioThermostat.set_preset_mode
(self, preset_mode)
Set Preset mode (Home, Alternate, Away, Holiday).
Set Preset mode (Home, Alternate, Away, Holiday).
def set_preset_mode(self, preset_mode): """Set Preset mode (Home, Alternate, Away, Holiday).""" if preset_mode in (PRESET_MODES): self.device.program_mode = PRESET_MODE_TO_CODE[preset_mode] else: _LOGGER.error( "preset_mode %s not in PRESET_MODES", ...
[ "def", "set_preset_mode", "(", "self", ",", "preset_mode", ")", ":", "if", "preset_mode", "in", "(", "PRESET_MODES", ")", ":", "self", ".", "device", ".", "program_mode", "=", "PRESET_MODE_TO_CODE", "[", "preset_mode", "]", "else", ":", "_LOGGER", ".", "erro...
[ 367, 4 ]
[ 375, 13 ]
python
de
['de', 'pt', 'en']
False
async_setup
(hass, config)
Component doesn't support configuration through configuration.yaml.
Component doesn't support configuration through configuration.yaml.
async def async_setup(hass, config): """Component doesn't support configuration through configuration.yaml.""" hass.data[UNIFI_WIRELESS_CLIENTS] = wireless_clients = UnifiWirelessClients(hass) await wireless_clients.async_load() return True
[ "async", "def", "async_setup", "(", "hass", ",", "config", ")", ":", "hass", ".", "data", "[", "UNIFI_WIRELESS_CLIENTS", "]", "=", "wireless_clients", "=", "UnifiWirelessClients", "(", "hass", ")", "await", "wireless_clients", ".", "async_load", "(", ")", "ret...
[ 19, 0 ]
[ 24, 15 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
(hass, config_entry)
Set up the UniFi component.
Set up the UniFi component.
async def async_setup_entry(hass, config_entry): """Set up the UniFi component.""" hass.data.setdefault(UNIFI_DOMAIN, {}) controller = UniFiController(hass, config_entry) if not await controller.async_setup(): return False hass.data[UNIFI_DOMAIN][config_entry.entry_id] = controller ha...
[ "async", "def", "async_setup_entry", "(", "hass", ",", "config_entry", ")", ":", "hass", ".", "data", ".", "setdefault", "(", "UNIFI_DOMAIN", ",", "{", "}", ")", "controller", "=", "UniFiController", "(", "hass", ",", "config_entry", ")", "if", "not", "awa...
[ 27, 0 ]
[ 53, 15 ]
python
en
['en', 'fr', 'en']
True
async_unload_entry
(hass, config_entry)
Unload a config entry.
Unload a config entry.
async def async_unload_entry(hass, config_entry): """Unload a config entry.""" controller = hass.data[UNIFI_DOMAIN].pop(config_entry.entry_id) return await controller.async_reset()
[ "async", "def", "async_unload_entry", "(", "hass", ",", "config_entry", ")", ":", "controller", "=", "hass", ".", "data", "[", "UNIFI_DOMAIN", "]", ".", "pop", "(", "config_entry", ".", "entry_id", ")", "return", "await", "controller", ".", "async_reset", "(...
[ 56, 0 ]
[ 59, 41 ]
python
en
['en', 'es', 'en']
True
UnifiWirelessClients.__init__
(self, hass)
Set up client storage.
Set up client storage.
def __init__(self, hass): """Set up client storage.""" self.hass = hass self.data = {} self._store = hass.helpers.storage.Store(STORAGE_VERSION, STORAGE_KEY)
[ "def", "__init__", "(", "self", ",", "hass", ")", ":", "self", ".", "hass", "=", "hass", "self", ".", "data", "=", "{", "}", "self", ".", "_store", "=", "hass", ".", "helpers", ".", "storage", ".", "Store", "(", "STORAGE_VERSION", ",", "STORAGE_KEY",...
[ 68, 4 ]
[ 72, 78 ]
python
en
['en', 'de', 'en']
True
UnifiWirelessClients.async_load
(self)
Load data from file.
Load data from file.
async def async_load(self): """Load data from file.""" data = await self._store.async_load() if data is not None: self.data = data
[ "async", "def", "async_load", "(", "self", ")", ":", "data", "=", "await", "self", ".", "_store", ".", "async_load", "(", ")", "if", "data", "is", "not", "None", ":", "self", ".", "data", "=", "data" ]
[ 74, 4 ]
[ 79, 28 ]
python
en
['en', 'en', 'en']
True
UnifiWirelessClients.get_data
(self, config_entry)
Get data related to a specific controller.
Get data related to a specific controller.
def get_data(self, config_entry): """Get data related to a specific controller.""" controller_id = get_controller_id_from_config_entry(config_entry) key = config_entry.entry_id if controller_id in self.data: key = controller_id data = self.data.get(key, {"wireless_de...
[ "def", "get_data", "(", "self", ",", "config_entry", ")", ":", "controller_id", "=", "get_controller_id_from_config_entry", "(", "config_entry", ")", "key", "=", "config_entry", ".", "entry_id", "if", "controller_id", "in", "self", ".", "data", ":", "key", "=", ...
[ 82, 4 ]
[ 90, 44 ]
python
en
['en', 'en', 'en']
True
UnifiWirelessClients.update_data
(self, data, config_entry)
Update data and schedule to save to file.
Update data and schedule to save to file.
def update_data(self, data, config_entry): """Update data and schedule to save to file.""" controller_id = get_controller_id_from_config_entry(config_entry) if controller_id in self.data: self.data.pop(controller_id) self.data[config_entry.entry_id] = {"wireless_devices": li...
[ "def", "update_data", "(", "self", ",", "data", ",", "config_entry", ")", ":", "controller_id", "=", "get_controller_id_from_config_entry", "(", "config_entry", ")", "if", "controller_id", "in", "self", ".", "data", ":", "self", ".", "data", ".", "pop", "(", ...
[ 93, 4 ]
[ 100, 68 ]
python
en
['en', 'en', 'en']
True
UnifiWirelessClients._data_to_save
(self)
Return data of UniFi wireless clients to store in a file.
Return data of UniFi wireless clients to store in a file.
def _data_to_save(self): """Return data of UniFi wireless clients to store in a file.""" return self.data
[ "def", "_data_to_save", "(", "self", ")", ":", "return", "self", ".", "data" ]
[ 103, 4 ]
[ 105, 24 ]
python
en
['en', 'en', 'en']
True
light_devices_fixture
(device_factory)
Fixture returns a set of mock light devices.
Fixture returns a set of mock light devices.
def light_devices_fixture(device_factory): """Fixture returns a set of mock light devices.""" return [ device_factory( "Dimmer 1", capabilities=[Capability.switch, Capability.switch_level], status={Attribute.switch: "on", Attribute.level: 100}, ), devi...
[ "def", "light_devices_fixture", "(", "device_factory", ")", ":", "return", "[", "device_factory", "(", "\"Dimmer 1\"", ",", "capabilities", "=", "[", "Capability", ".", "switch", ",", "Capability", ".", "switch_level", "]", ",", "status", "=", "{", "Attribute", ...
[ 28, 0 ]
[ 66, 5 ]
python
en
['en', 'en', 'en']
True
test_entity_state
(hass, light_devices)
Tests the state attributes properly match the light types.
Tests the state attributes properly match the light types.
async def test_entity_state(hass, light_devices): """Tests the state attributes properly match the light types.""" await setup_platform(hass, LIGHT_DOMAIN, devices=light_devices) # Dimmer 1 state = hass.states.get("light.dimmer_1") assert state.state == "on" assert ( state.attributes[AT...
[ "async", "def", "test_entity_state", "(", "hass", ",", "light_devices", ")", ":", "await", "setup_platform", "(", "hass", ",", "LIGHT_DOMAIN", ",", "devices", "=", "light_devices", ")", "# Dimmer 1", "state", "=", "hass", ".", "states", ".", "get", "(", "\"l...
[ 69, 0 ]
[ 101, 51 ]
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("Light 1", [Capability.switch, Capability.switch_level]) entity_registry = await hass.helpers.entity_registry.async_get_registry() device_registry...
[ "async", "def", "test_entity_and_device_attributes", "(", "hass", ",", "device_factory", ")", ":", "# Arrange", "device", "=", "device_factory", "(", "\"Light 1\"", ",", "[", "Capability", ".", "switch", ",", "Capability", ".", "switch_level", "]", ")", "entity_re...
[ 104, 0 ]
[ 121, 46 ]
python
en
['en', 'en', 'en']
True
test_turn_off
(hass, light_devices)
Test the light turns of successfully.
Test the light turns of successfully.
async def test_turn_off(hass, light_devices): """Test the light turns of successfully.""" # Arrange await setup_platform(hass, LIGHT_DOMAIN, devices=light_devices) # Act await hass.services.async_call( "light", "turn_off", {"entity_id": "light.color_dimmer_2"}, blocking=True ) # Asse...
[ "async", "def", "test_turn_off", "(", "hass", ",", "light_devices", ")", ":", "# Arrange", "await", "setup_platform", "(", "hass", ",", "LIGHT_DOMAIN", ",", "devices", "=", "light_devices", ")", "# Act", "await", "hass", ".", "services", ".", "async_call", "("...
[ 124, 0 ]
[ 135, 31 ]
python
en
['en', 'en', 'en']
True
test_turn_off_with_transition
(hass, light_devices)
Test the light turns of successfully with transition.
Test the light turns of successfully with transition.
async def test_turn_off_with_transition(hass, light_devices): """Test the light turns of successfully with transition.""" # Arrange await setup_platform(hass, LIGHT_DOMAIN, devices=light_devices) # Act await hass.services.async_call( "light", "turn_off", {ATTR_ENTITY_ID: "lig...
[ "async", "def", "test_turn_off_with_transition", "(", "hass", ",", "light_devices", ")", ":", "# Arrange", "await", "setup_platform", "(", "hass", ",", "LIGHT_DOMAIN", ",", "devices", "=", "light_devices", ")", "# Act", "await", "hass", ".", "services", ".", "as...
[ 138, 0 ]
[ 152, 31 ]
python
en
['en', 'en', 'en']
True