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
async_setup_entry
(hass, config_entry)
Set up PS4 from a config entry.
Set up PS4 from a config entry.
async def async_setup_entry(hass, config_entry): """Set up PS4 from a config entry.""" hass.async_create_task( hass.config_entries.async_forward_entry_setup(config_entry, "media_player") ) return True
[ "async", "def", "async_setup_entry", "(", "hass", ",", "config_entry", ")", ":", "hass", ".", "async_create_task", "(", "hass", ".", "config_entries", ".", "async_forward_entry_setup", "(", "config_entry", ",", "\"media_player\"", ")", ")", "return", "True" ]
[ 62, 0 ]
[ 67, 15 ]
python
en
['en', 'en', 'en']
True
async_unload_entry
(hass, entry)
Unload a PS4 config entry.
Unload a PS4 config entry.
async def async_unload_entry(hass, entry): """Unload a PS4 config entry.""" await hass.config_entries.async_forward_entry_unload(entry, "media_player") return True
[ "async", "def", "async_unload_entry", "(", "hass", ",", "entry", ")", ":", "await", "hass", ".", "config_entries", ".", "async_forward_entry_unload", "(", "entry", ",", "\"media_player\"", ")", "return", "True" ]
[ 70, 0 ]
[ 73, 15 ]
python
en
['en', 'en', 'en']
True
async_migrate_entry
(hass, entry)
Migrate old entry.
Migrate old entry.
async def async_migrate_entry(hass, entry): """Migrate old entry.""" config_entries = hass.config_entries data = entry.data version = entry.version _LOGGER.debug("Migrating PS4 entry from Version %s", version) reason = { 1: "Region codes have changed", 2: "Format for Unique ID ...
[ "async", "def", "async_migrate_entry", "(", "hass", ",", "entry", ")", ":", "config_entries", "=", "hass", ".", "config_entries", "data", "=", "entry", ".", "data", "version", "=", "entry", ".", "version", "_LOGGER", ".", "debug", "(", "\"Migrating PS4 entry f...
[ 76, 0 ]
[ 150, 16 ]
python
en
['en', 'en', 'en']
True
format_unique_id
(creds, mac_address)
Use last 4 Chars of credential as suffix. Unique ID per PSN user.
Use last 4 Chars of credential as suffix. Unique ID per PSN user.
def format_unique_id(creds, mac_address): """Use last 4 Chars of credential as suffix. Unique ID per PSN user.""" suffix = creds[-4:] return f"{mac_address}_{suffix}"
[ "def", "format_unique_id", "(", "creds", ",", "mac_address", ")", ":", "suffix", "=", "creds", "[", "-", "4", ":", "]", "return", "f\"{mac_address}_{suffix}\"" ]
[ 153, 0 ]
[ 156, 36 ]
python
en
['en', 'en', 'en']
True
load_games
(hass: HomeAssistantType, unique_id: str)
Load games for sources.
Load games for sources.
def load_games(hass: HomeAssistantType, unique_id: str) -> dict: """Load games for sources.""" g_file = hass.config.path(GAMES_FILE.format(unique_id)) try: games = load_json(g_file) except HomeAssistantError as error: games = {} _LOGGER.error("Failed to load games file: %s", erro...
[ "def", "load_games", "(", "hass", ":", "HomeAssistantType", ",", "unique_id", ":", "str", ")", "->", "dict", ":", "g_file", "=", "hass", ".", "config", ".", "path", "(", "GAMES_FILE", ".", "format", "(", "unique_id", ")", ")", "try", ":", "games", "=",...
[ 159, 0 ]
[ 175, 16 ]
python
en
['en', 'en', 'en']
True
save_games
(hass: HomeAssistantType, games: dict, unique_id: str)
Save games to file.
Save games to file.
def save_games(hass: HomeAssistantType, games: dict, unique_id: str): """Save games to file.""" g_file = hass.config.path(GAMES_FILE.format(unique_id)) try: save_json(g_file, games) except OSError as error: _LOGGER.error("Could not save game list, %s", error)
[ "def", "save_games", "(", "hass", ":", "HomeAssistantType", ",", "games", ":", "dict", ",", "unique_id", ":", "str", ")", ":", "g_file", "=", "hass", ".", "config", ".", "path", "(", "GAMES_FILE", ".", "format", "(", "unique_id", ")", ")", "try", ":", ...
[ 178, 0 ]
[ 184, 60 ]
python
en
['en', 'en', 'en']
True
_reformat_data
(hass: HomeAssistantType, games: dict, unique_id: str)
Reformat data to correct format.
Reformat data to correct format.
def _reformat_data(hass: HomeAssistantType, games: dict, unique_id: str) -> dict: """Reformat data to correct format.""" data_reformatted = False for game, data in games.items(): # Convert str format to dict format. if not isinstance(data, dict): # Use existing title. Assign def...
[ "def", "_reformat_data", "(", "hass", ":", "HomeAssistantType", ",", "games", ":", "dict", ",", "unique_id", ":", "str", ")", "->", "dict", ":", "data_reformatted", "=", "False", "for", "game", ",", "data", "in", "games", ".", "items", "(", ")", ":", "...
[ 187, 0 ]
[ 207, 16 ]
python
en
['en', 'en', 'en']
True
service_handle
(hass: HomeAssistantType)
Handle for services.
Handle for services.
def service_handle(hass: HomeAssistantType): """Handle for services.""" async def async_service_command(call): """Service for sending commands.""" entity_ids = call.data[ATTR_ENTITY_ID] command = call.data[ATTR_COMMAND] for device in hass.data[PS4_DATA].devices: if d...
[ "def", "service_handle", "(", "hass", ":", "HomeAssistantType", ")", ":", "async", "def", "async_service_command", "(", "call", ")", ":", "\"\"\"Service for sending commands.\"\"\"", "entity_ids", "=", "call", ".", "data", "[", "ATTR_ENTITY_ID", "]", "command", "=",...
[ 210, 0 ]
[ 223, 5 ]
python
en
['en', 'en', 'en']
True
PS4Data.__init__
(self)
Init Class.
Init Class.
def __init__(self): """Init Class.""" self.devices = [] self.protocol = None
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "devices", "=", "[", "]", "self", ".", "protocol", "=", "None" ]
[ 45, 4 ]
[ 48, 28 ]
python
en
['en', 'mt', 'en']
False
test_form
(hass)
Test we get the form.
Test we get the form.
async def test_form(hass): """Test we get the form.""" result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) assert result["type"] == "form" assert result["errors"] == {} with patch( "homeassistant.components.ruckus_unleashe...
[ "async", "def", "test_form", "(", "hass", ")", ":", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "DOMAIN", ",", "context", "=", "{", "\"source\"", ":", "config_entries", ".", "SOURCE_USER", "}", ")", "assert",...
[ 14, 0 ]
[ 47, 48 ]
python
en
['en', 'en', 'en']
True
test_form_invalid_auth
(hass)
Test we handle invalid auth.
Test we handle invalid auth.
async def test_form_invalid_auth(hass): """Test we handle invalid auth.""" result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) with patch( "homeassistant.components.ruckus_unleashed.Ruckus.connect", side_effect=Authenticat...
[ "async", "def", "test_form_invalid_auth", "(", "hass", ")", ":", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "DOMAIN", ",", "context", "=", "{", "\"source\"", ":", "config_entries", ".", "SOURCE_USER", "}", ")"...
[ 50, 0 ]
[ 66, 56 ]
python
en
['en', 'en', 'en']
True
test_form_cannot_connect
(hass)
Test we handle cannot connect error.
Test we handle cannot connect error.
async def test_form_cannot_connect(hass): """Test we handle cannot connect error.""" result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) with patch( "homeassistant.components.ruckus_unleashed.Ruckus.connect", side_effect=C...
[ "async", "def", "test_form_cannot_connect", "(", "hass", ")", ":", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "DOMAIN", ",", "context", "=", "{", "\"source\"", ":", "config_entries", ".", "SOURCE_USER", "}", "...
[ 69, 0 ]
[ 85, 58 ]
python
en
['en', 'en', 'en']
True
test_form_unknown_error
(hass)
Test we handle unknown error.
Test we handle unknown error.
async def test_form_unknown_error(hass): """Test we handle unknown error.""" result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) with patch( "homeassistant.components.ruckus_unleashed.Ruckus.connect", side_effect=Exception...
[ "async", "def", "test_form_unknown_error", "(", "hass", ")", ":", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "DOMAIN", ",", "context", "=", "{", "\"source\"", ":", "config_entries", ".", "SOURCE_USER", "}", ")...
[ 88, 0 ]
[ 104, 51 ]
python
en
['en', 'de', 'en']
True
test_form_cannot_connect_unknown_serial
(hass)
Test we handle cannot connect error on invalid serial number.
Test we handle cannot connect error on invalid serial number.
async def test_form_cannot_connect_unknown_serial(hass): """Test we handle cannot connect error on invalid serial number.""" 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_cannot_connect_unknown_serial", "(", "hass", ")", ":", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "DOMAIN", ",", "context", "=", "{", "\"source\"", ":", "config_entries", ".", "SOURCE_US...
[ 107, 0 ]
[ 131, 58 ]
python
en
['en', 'en', 'en']
True
test_form_duplicate_error
(hass)
Test we handle duplicate error.
Test we handle duplicate error.
async def test_form_duplicate_error(hass): """Test we handle duplicate error.""" result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) with patch( "homeassistant.components.ruckus_unleashed.Ruckus.connect", return_value=None...
[ "async", "def", "test_form_duplicate_error", "(", "hass", ")", ":", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "DOMAIN", ",", "context", "=", "{", "\"source\"", ":", "config_entries", ".", "SOURCE_USER", "}", ...
[ 134, 0 ]
[ 171, 52 ]
python
en
['fr', 'nl', 'en']
False
store
(hass)
Mock store.
Mock store.
def store(hass): """Mock store.""" return auth_store.AuthStore(hass)
[ "def", "store", "(", "hass", ")", ":", "return", "auth_store", ".", "AuthStore", "(", "hass", ")" ]
[ 16, 0 ]
[ 18, 37 ]
python
en
['en', 'fy', 'en']
False
provider
(hass, store)
Mock provider.
Mock provider.
def provider(hass, store): """Mock provider.""" return command_line.CommandLineAuthProvider( hass, store, { CONF_TYPE: "command_line", command_line.CONF_COMMAND: os.path.join( os.path.dirname(__file__), "test_command_line_cmd.sh" ), ...
[ "def", "provider", "(", "hass", ",", "store", ")", ":", "return", "command_line", ".", "CommandLineAuthProvider", "(", "hass", ",", "store", ",", "{", "CONF_TYPE", ":", "\"command_line\"", ",", "command_line", ".", "CONF_COMMAND", ":", "os", ".", "path", "."...
[ 22, 0 ]
[ 35, 5 ]
python
en
['en', 'sv', 'en']
False
manager
(hass, store, provider)
Mock manager.
Mock manager.
def manager(hass, store, provider): """Mock manager.""" return AuthManager(hass, store, {(provider.type, provider.id): provider}, {})
[ "def", "manager", "(", "hass", ",", "store", ",", "provider", ")", ":", "return", "AuthManager", "(", "hass", ",", "store", ",", "{", "(", "provider", ".", "type", ",", "provider", ".", "id", ")", ":", "provider", "}", ",", "{", "}", ")" ]
[ 39, 0 ]
[ 41, 81 ]
python
da
['id', 'da', 'en']
False
test_create_new_credential
(manager, provider)
Test that we create a new credential.
Test that we create a new credential.
async def test_create_new_credential(manager, provider): """Test that we create a new credential.""" credentials = await provider.async_get_or_create_credentials( {"username": "good-user", "password": "good-pass"} ) assert credentials.is_new is True user = await manager.async_get_or_create_...
[ "async", "def", "test_create_new_credential", "(", "manager", ",", "provider", ")", ":", "credentials", "=", "await", "provider", ".", "async_get_or_create_credentials", "(", "{", "\"username\"", ":", "\"good-user\"", ",", "\"password\"", ":", "\"good-pass\"", "}", ...
[ 44, 0 ]
[ 52, 25 ]
python
en
['en', 'en', 'en']
True
test_match_existing_credentials
(store, provider)
See if we match existing users.
See if we match existing users.
async def test_match_existing_credentials(store, provider): """See if we match existing users.""" existing = auth_models.Credentials( id=uuid.uuid4(), auth_provider_type="command_line", auth_provider_id=None, data={"username": "good-user"}, is_new=False, ) provide...
[ "async", "def", "test_match_existing_credentials", "(", "store", ",", "provider", ")", ":", "existing", "=", "auth_models", ".", "Credentials", "(", "id", "=", "uuid", ".", "uuid4", "(", ")", ",", "auth_provider_type", "=", "\"command_line\"", ",", "auth_provide...
[ 55, 0 ]
[ 68, 34 ]
python
en
['en', 'en', 'en']
True
test_invalid_username
(provider)
Test we raise if incorrect user specified.
Test we raise if incorrect user specified.
async def test_invalid_username(provider): """Test we raise if incorrect user specified.""" with pytest.raises(command_line.InvalidAuthError): await provider.async_validate_login("bad-user", "good-pass")
[ "async", "def", "test_invalid_username", "(", "provider", ")", ":", "with", "pytest", ".", "raises", "(", "command_line", ".", "InvalidAuthError", ")", ":", "await", "provider", ".", "async_validate_login", "(", "\"bad-user\"", ",", "\"good-pass\"", ")" ]
[ 71, 0 ]
[ 74, 68 ]
python
en
['en', 'en', 'en']
True
test_invalid_password
(provider)
Test we raise if incorrect password specified.
Test we raise if incorrect password specified.
async def test_invalid_password(provider): """Test we raise if incorrect password specified.""" with pytest.raises(command_line.InvalidAuthError): await provider.async_validate_login("good-user", "bad-pass")
[ "async", "def", "test_invalid_password", "(", "provider", ")", ":", "with", "pytest", ".", "raises", "(", "command_line", ".", "InvalidAuthError", ")", ":", "await", "provider", ".", "async_validate_login", "(", "\"good-user\"", ",", "\"bad-pass\"", ")" ]
[ 77, 0 ]
[ 80, 68 ]
python
en
['fr', 'en', 'en']
True
test_good_auth
(provider)
Test nothing is raised with good credentials.
Test nothing is raised with good credentials.
async def test_good_auth(provider): """Test nothing is raised with good credentials.""" await provider.async_validate_login("good-user", "good-pass")
[ "async", "def", "test_good_auth", "(", "provider", ")", ":", "await", "provider", ".", "async_validate_login", "(", "\"good-user\"", ",", "\"good-pass\"", ")" ]
[ 83, 0 ]
[ 85, 65 ]
python
en
['en', 'en', 'en']
True
test_good_auth_with_meta
(manager, provider)
Test metadata is added upon successful authentication.
Test metadata is added upon successful authentication.
async def test_good_auth_with_meta(manager, provider): """Test metadata is added upon successful authentication.""" provider.config[command_line.CONF_ARGS] = ["--with-meta"] provider.config[command_line.CONF_META] = True await provider.async_validate_login("good-user", "good-pass") credentials = a...
[ "async", "def", "test_good_auth_with_meta", "(", "manager", ",", "provider", ")", ":", "provider", ".", "config", "[", "command_line", ".", "CONF_ARGS", "]", "=", "[", "\"--with-meta\"", "]", "provider", ".", "config", "[", "command_line", ".", "CONF_META", "]...
[ 88, 0 ]
[ 102, 25 ]
python
en
['en', 'en', 'en']
True
test_utf_8_username_password
(provider)
Test that we create a new credential.
Test that we create a new credential.
async def test_utf_8_username_password(provider): """Test that we create a new credential.""" credentials = await provider.async_get_or_create_credentials( {"username": "ßßß", "password": "äöü"} ) assert credentials.is_new is True
[ "async", "def", "test_utf_8_username_password", "(", "provider", ")", ":", "credentials", "=", "await", "provider", ".", "async_get_or_create_credentials", "(", "{", "\"username\"", ":", "\"ßßß\", \"", "p", "ssword\": \"", "ä", "ü\"}", "", ")", "assert", "credential...
[ 105, 0 ]
[ 110, 37 ]
python
en
['en', 'en', 'en']
True
test_login_flow_validates
(provider)
Test login flow.
Test login flow.
async def test_login_flow_validates(provider): """Test login flow.""" flow = await provider.async_login_flow({}) result = await flow.async_step_init() assert result["type"] == data_entry_flow.RESULT_TYPE_FORM result = await flow.async_step_init( {"username": "bad-user", "password": "bad-pas...
[ "async", "def", "test_login_flow_validates", "(", "provider", ")", ":", "flow", "=", "await", "provider", ".", "async_login_flow", "(", "{", "}", ")", "result", "=", "await", "flow", ".", "async_step_init", "(", ")", "assert", "result", "[", "\"type\"", "]",...
[ 113, 0 ]
[ 129, 52 ]
python
en
['en', 'fy', 'en']
True
test_strip_username
(provider)
Test authentication works with username with whitespace around.
Test authentication works with username with whitespace around.
async def test_strip_username(provider): """Test authentication works with username with whitespace around.""" flow = await provider.async_login_flow({}) result = await flow.async_step_init( {"username": "\t\ngood-user ", "password": "good-pass"} ) assert result["type"] == data_entry_flow.RE...
[ "async", "def", "test_strip_username", "(", "provider", ")", ":", "flow", "=", "await", "provider", ".", "async_login_flow", "(", "{", "}", ")", "result", "=", "await", "flow", ".", "async_step_init", "(", "{", "\"username\"", ":", "\"\\t\\ngood-user \"", ",",...
[ 132, 0 ]
[ 139, 52 ]
python
en
['en', 'en', 'en']
True
SimRandom.seed
(self, seed_num: int)
Set seed for simulator random objects. NOTE: This method will affect all the random object that get from this class. Args: seed_num (int): Seed to set, must be an integer.
Set seed for simulator random objects.
def seed(self, seed_num: int): """Set seed for simulator random objects. NOTE: This method will affect all the random object that get from this class. Args: seed_num (int): Seed to set, must be an integer. """ assert type(seed_num) is int self._...
[ "def", "seed", "(", "self", ",", "seed_num", ":", "int", ")", ":", "assert", "type", "(", "seed_num", ")", "is", "int", "self", ".", "_seed", "=", "seed_num", "self", ".", "_index", "=", "0", "for", "key", ",", "rand", "in", "self", ".", "_rand_ins...
[ 35, 4 ]
[ 57, 28 ]
python
en
['en', 'en', 'en']
True
SimRandom.get_seed
(self, key: str = None)
Get seed of current random generator. NOTE: This will only return the seed of first random object that specified by user (or default). Args: key(str): Key of item to get. Returns: int: If key is None return seed for 1st instance (same as what passed to seed...
Get seed of current random generator.
def get_seed(self, key: str = None) -> int: """Get seed of current random generator. NOTE: This will only return the seed of first random object that specified by user (or default). Args: key(str): Key of item to get. Returns: int: If key is None re...
[ "def", "get_seed", "(", "self", ",", "key", ":", "str", "=", "None", ")", "->", "int", ":", "if", "key", "is", "not", "None", ":", "return", "self", ".", "_seed_dict", ".", "get", "(", "key", ",", "None", ")", "return", "self", ".", "_seed" ]
[ 72, 4 ]
[ 88, 25 ]
python
en
['en', 'en', 'en']
True
EventPool.gen
(self, tick: int, event_type: object, payload: object, is_cascade: bool = False)
Generate an event. Args: tick (int): Tick of the event will be trigger. event_type (object): Type of new event. payload (object): Payload attached to this event. is_cascade (bool): Is the new event is cascade event. Returns: Event: AtomEvent ...
Generate an event.
def gen(self, tick: int, event_type: object, payload: object, is_cascade: bool = False) -> Event: """Generate an event. Args: tick (int): Tick of the event will be trigger. event_type (object): Type of new event. payload (object): Payload attached to this event. ...
[ "def", "gen", "(", "self", ",", "tick", ":", "int", ",", "event_type", ":", "object", ",", "payload", ":", "object", ",", "is_cascade", ":", "bool", "=", "False", ")", "->", "Event", ":", "if", "is_cascade", ":", "event", "=", "self", ".", "_pop", ...
[ 26, 4 ]
[ 51, 20 ]
python
en
['en', 'en', 'it']
True
EventPool.recycle
(self, events: Union[Event, EventList])
Recycle specified event for further using. Args: events (Union[Event, EventList]): Event object(s) to recycle.
Recycle specified event for further using.
def recycle(self, events: Union[Event, EventList]): """Recycle specified event for further using. Args: events (Union[Event, EventList]): Event object(s) to recycle. """ if type(events) != list and type(events) != EventLinkedList: events = [events] for e...
[ "def", "recycle", "(", "self", ",", "events", ":", "Union", "[", "Event", ",", "EventList", "]", ")", ":", "if", "type", "(", "events", ")", "!=", "list", "and", "type", "(", "events", ")", "!=", "EventLinkedList", ":", "events", "=", "[", "events", ...
[ 53, 4 ]
[ 64, 35 ]
python
en
['en', 'en', 'en']
True
EventPool._append
(self, event: Event)
Append event to related pool
Append event to related pool
def _append(self, event: Event): """Append event to related pool""" if event: # Deattach the payload before recycle. event.payload = None event._next_event_ = None event.state = EventState.FINISHED if isinstance(event, CascadeEvent): ...
[ "def", "_append", "(", "self", ",", "event", ":", "Event", ")", ":", "if", "event", ":", "# Deattach the payload before recycle.", "event", ".", "payload", "=", "None", "event", ".", "_next_event_", "=", "None", "event", ".", "state", "=", "EventState", ".",...
[ 66, 4 ]
[ 77, 45 ]
python
en
['en', 'en', 'en']
True
EventPool._pop
(self, cntr: EventList, event_cls_type: type)
Pop an event from related pool, generate buffer events if not enough.
Pop an event from related pool, generate buffer events if not enough.
def _pop(self, cntr: EventList, event_cls_type: type): """Pop an event from related pool, generate buffer events if not enough.""" if len(cntr) == 0: return event_cls_type(None, None, None, None) else: return cntr.pop()
[ "def", "_pop", "(", "self", ",", "cntr", ":", "EventList", ",", "event_cls_type", ":", "type", ")", ":", "if", "len", "(", "cntr", ")", "==", "0", ":", "return", "event_cls_type", "(", "None", ",", "None", ",", "None", ",", "None", ")", "else", ":"...
[ 79, 4 ]
[ 84, 29 ]
python
en
['en', 'en', 'en']
True
x10_command
(command)
Execute X10 command and check output.
Execute X10 command and check output.
def x10_command(command): """Execute X10 command and check output.""" return check_output(["heyu"] + command.split(" "), stderr=STDOUT)
[ "def", "x10_command", "(", "command", ")", ":", "return", "check_output", "(", "[", "\"heyu\"", "]", "+", "command", ".", "split", "(", "\" \"", ")", ",", "stderr", "=", "STDOUT", ")" ]
[ 29, 0 ]
[ 31, 69 ]
python
en
['en', 'en', 'en']
True
get_unit_status
(code)
Get on/off status for given unit.
Get on/off status for given unit.
def get_unit_status(code): """Get on/off status for given unit.""" output = check_output(["heyu", "onstate", code]) return int(output.decode("utf-8")[0])
[ "def", "get_unit_status", "(", "code", ")", ":", "output", "=", "check_output", "(", "[", "\"heyu\"", ",", "\"onstate\"", ",", "code", "]", ")", "return", "int", "(", "output", ".", "decode", "(", "\"utf-8\"", ")", "[", "0", "]", ")" ]
[ 34, 0 ]
[ 37, 41 ]
python
en
['da', 'en', 'en']
True
setup_platform
(hass, config, add_entities, discovery_info=None)
Set up the x10 Light platform.
Set up the x10 Light platform.
def setup_platform(hass, config, add_entities, discovery_info=None): """Set up the x10 Light platform.""" is_cm11a = True try: x10_command("info") except CalledProcessError as err: _LOGGER.info("Assuming that the device is CM17A: %s", err.output) is_cm11a = False add_entitie...
[ "def", "setup_platform", "(", "hass", ",", "config", ",", "add_entities", ",", "discovery_info", "=", "None", ")", ":", "is_cm11a", "=", "True", "try", ":", "x10_command", "(", "\"info\"", ")", "except", "CalledProcessError", "as", "err", ":", "_LOGGER", "."...
[ 40, 0 ]
[ 49, 77 ]
python
en
['en', 'lv', 'en']
True
X10Light.__init__
(self, light, is_cm11a)
Initialize an X10 Light.
Initialize an X10 Light.
def __init__(self, light, is_cm11a): """Initialize an X10 Light.""" self._name = light["name"] self._id = light["id"] self._brightness = 0 self._state = False self._is_cm11a = is_cm11a
[ "def", "__init__", "(", "self", ",", "light", ",", "is_cm11a", ")", ":", "self", ".", "_name", "=", "light", "[", "\"name\"", "]", "self", ".", "_id", "=", "light", "[", "\"id\"", "]", "self", ".", "_brightness", "=", "0", "self", ".", "_state", "=...
[ 55, 4 ]
[ 61, 33 ]
python
en
['en', 'lb', 'nl']
False
X10Light.name
(self)
Return the display name of this light.
Return the display name of this light.
def name(self): """Return the display name of this light.""" return self._name
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "_name" ]
[ 64, 4 ]
[ 66, 25 ]
python
en
['en', 'en', 'en']
True
X10Light.brightness
(self)
Return the brightness of the light.
Return the brightness of the light.
def brightness(self): """Return the brightness of the light.""" return self._brightness
[ "def", "brightness", "(", "self", ")", ":", "return", "self", ".", "_brightness" ]
[ 69, 4 ]
[ 71, 31 ]
python
en
['en', 'no', 'en']
True
X10Light.is_on
(self)
Return true if light is on.
Return true if light is on.
def is_on(self): """Return true if light is on.""" return self._state
[ "def", "is_on", "(", "self", ")", ":", "return", "self", ".", "_state" ]
[ 74, 4 ]
[ 76, 26 ]
python
en
['en', 'et', 'en']
True
X10Light.supported_features
(self)
Flag supported features.
Flag supported features.
def supported_features(self): """Flag supported features.""" return SUPPORT_X10
[ "def", "supported_features", "(", "self", ")", ":", "return", "SUPPORT_X10" ]
[ 79, 4 ]
[ 81, 26 ]
python
en
['da', 'en', 'en']
True
X10Light.turn_on
(self, **kwargs)
Instruct the light to turn on.
Instruct the light to turn on.
def turn_on(self, **kwargs): """Instruct the light to turn on.""" if self._is_cm11a: x10_command(f"on {self._id}") else: x10_command(f"fon {self._id}") self._brightness = kwargs.get(ATTR_BRIGHTNESS, 255) self._state = True
[ "def", "turn_on", "(", "self", ",", "*", "*", "kwargs", ")", ":", "if", "self", ".", "_is_cm11a", ":", "x10_command", "(", "f\"on {self._id}\"", ")", "else", ":", "x10_command", "(", "f\"fon {self._id}\"", ")", "self", ".", "_brightness", "=", "kwargs", "....
[ 83, 4 ]
[ 90, 26 ]
python
en
['en', 'en', 'en']
True
X10Light.turn_off
(self, **kwargs)
Instruct the light to turn off.
Instruct the light to turn off.
def turn_off(self, **kwargs): """Instruct the light to turn off.""" if self._is_cm11a: x10_command(f"off {self._id}") else: x10_command(f"foff {self._id}") self._state = False
[ "def", "turn_off", "(", "self", ",", "*", "*", "kwargs", ")", ":", "if", "self", ".", "_is_cm11a", ":", "x10_command", "(", "f\"off {self._id}\"", ")", "else", ":", "x10_command", "(", "f\"foff {self._id}\"", ")", "self", ".", "_state", "=", "False" ]
[ 92, 4 ]
[ 98, 27 ]
python
en
['en', 'en', 'en']
True
X10Light.update
(self)
Fetch update state.
Fetch update state.
def update(self): """Fetch update state.""" if self._is_cm11a: self._state = bool(get_unit_status(self._id)) else: # Not supported on CM17A pass
[ "def", "update", "(", "self", ")", ":", "if", "self", ".", "_is_cm11a", ":", "self", ".", "_state", "=", "bool", "(", "get_unit_status", "(", "self", ".", "_id", ")", ")", "else", ":", "# Not supported on CM17A", "pass" ]
[ 100, 4 ]
[ 106, 16 ]
python
en
['en', 'co', 'en']
True
start_cim_dashboard
(source_path: str, epoch_num: int, prefix: str)
Entrance of cim dashboard. Expected folder structure of Scenario CIM: -source_path --epoch_0: Data of each epoch. --ports.csv: Record ports' attributes in this file. --vessel.csv: Record vessels' attributes in this file. --matrices.csv: Record transfer volume informa...
Entrance of cim dashboard.
def start_cim_dashboard(source_path: str, epoch_num: int, prefix: str): """Entrance of cim dashboard. Expected folder structure of Scenario CIM: -source_path --epoch_0: Data of each epoch. --ports.csv: Record ports' attributes in this file. --vessel.csv: Record vessels' attr...
[ "def", "start_cim_dashboard", "(", "source_path", ":", "str", ",", "epoch_num", ":", "int", ",", "prefix", ":", "str", ")", ":", "option", "=", "st", ".", "sidebar", ".", "selectbox", "(", "label", "=", "\"Data Type\"", ",", "options", "=", "PanelViewChoic...
[ 18, 0 ]
[ 46, 57 ]
python
en
['en', 'cy', 'en']
True
render_inter_view
(source_path: str, epoch_num: int)
Show CIM inter-view plot. Args: source_path (str): The root path of the dumped snapshots data for the corresponding experiment. epoch_num (int): Total number of epoches, i.e. the total number of data folders since there is a folder per epoch.
Show CIM inter-view plot.
def render_inter_view(source_path: str, epoch_num: int): """Show CIM inter-view plot. Args: source_path (str): The root path of the dumped snapshots data for the corresponding experiment. epoch_num (int): Total number of epoches, i.e. the total number of data folders since there is ...
[ "def", "render_inter_view", "(", "source_path", ":", "str", ",", "epoch_num", ":", "int", ")", ":", "helper", ".", "render_h1_title", "(", "\"CIM Inter Epoch Data\"", ")", "sample_ratio", "=", "helper", ".", "get_sample_ratio_selection_list", "(", "epoch_num", ")", ...
[ 49, 0 ]
[ 80, 5 ]
python
en
['en', 'bg-Latn', 'en']
True
render_intra_view
(source_path: str, epoch_num: int, prefix: str)
Show CIM intra-view plot. Args: source_path (str): The root path of the dumped snapshots data for the corresponding experiment. epoch_num (int) : Total number of epoches, i.e. the total number of data folders since there is a folder per epoch. prefix (str): Prefix of data folde...
Show CIM intra-view plot.
def render_intra_view(source_path: str, epoch_num: int, prefix: str): """Show CIM intra-view plot. Args: source_path (str): The root path of the dumped snapshots data for the corresponding experiment. epoch_num (int) : Total number of epoches, i.e. the total number of data folders s...
[ "def", "render_intra_view", "(", "source_path", ":", "str", ",", "epoch_num", ":", "int", ",", "prefix", ":", "str", ")", ":", "selected_epoch", "=", "st", ".", "sidebar", ".", "select_slider", "(", "label", "=", "\"Choose an Epoch:\"", ",", "options", "=", ...
[ 83, 0 ]
[ 135, 9 ]
python
en
['en', 'pt', 'en']
True
_generate_inter_view_panel
(data: pd.DataFrame, down_pooling_range: List[float])
Generate inter-view plot. Args: data (pd.Dataframe): Summary(cross-epoch) data. down_pooling_range (List[float]): Sampling data index list.
Generate inter-view plot.
def _generate_inter_view_panel(data: pd.DataFrame, down_pooling_range: List[float]): """Generate inter-view plot. Args: data (pd.Dataframe): Summary(cross-epoch) data. down_pooling_range (List[float]): Sampling data index list. """ data["Epoch Index"] = list(down_pooling_range) data...
[ "def", "_generate_inter_view_panel", "(", "data", ":", "pd", ".", "DataFrame", ",", "down_pooling_range", ":", "List", "[", "float", "]", ")", ":", "data", "[", "\"Epoch Index\"", "]", "=", "list", "(", "down_pooling_range", ")", "data_melt", "=", "data", "....
[ 138, 0 ]
[ 172, 36 ]
python
en
['pl', 'en', 'en']
True
_render_intra_view_by_ports
( data_ports: pd.DataFrame, ports_index: int, index_name_conversion: pd.DataFrame, attribute_option_candidates: List[str], snapshot_num: int )
Show intra-view data by ports. Args: data_ports (pd.Dataframe): Filtered port data. ports_index (int):Index of port of current data. index_name_conversion (pd.Dataframe): Relationship of index and name. attribute_option_candidates (List[str]): All options for users to choose. ...
Show intra-view data by ports.
def _render_intra_view_by_ports( data_ports: pd.DataFrame, ports_index: int, index_name_conversion: pd.DataFrame, attribute_option_candidates: List[str], snapshot_num: int ): """ Show intra-view data by ports. Args: data_ports (pd.Dataframe): Filtered port data. ports_index (int):Index ...
[ "def", "_render_intra_view_by_ports", "(", "data_ports", ":", "pd", ".", "DataFrame", ",", "ports_index", ":", "int", ",", "index_name_conversion", ":", "pd", ".", "DataFrame", ",", "attribute_option_candidates", ":", "List", "[", "str", "]", ",", "snapshot_num", ...
[ 175, 0 ]
[ 218, 5 ]
python
en
['en', 'en', 'en']
True
_render_intra_view_by_snapshot
( source_path: str, option_epoch: int, data_ports: pd.DataFrame, snapshots_index: List[int], index_name_conversion: pd.DataFrame, attribute_option_candidates: List[str], ports_num: int, prefix: str )
Show intra-view data by snapshot. Args: source_path (str): The root path of the dumped snapshots data for the corresponding experiment. option_epoch (int): Index of selected epoch. data_ports (pd.Dataframe): Filtered port data. snapshots_index (List[int]): Index of selected snapsho...
Show intra-view data by snapshot.
def _render_intra_view_by_snapshot( source_path: str, option_epoch: int, data_ports: pd.DataFrame, snapshots_index: List[int], index_name_conversion: pd.DataFrame, attribute_option_candidates: List[str], ports_num: int, prefix: str ): """ Show intra-view data by snapshot. Args: source_path (str...
[ "def", "_render_intra_view_by_snapshot", "(", "source_path", ":", "str", ",", "option_epoch", ":", "int", ",", "data_ports", ":", "pd", ".", "DataFrame", ",", "snapshots_index", ":", "List", "[", "int", "]", ",", "index_name_conversion", ":", "pd", ".", "DataF...
[ 221, 0 ]
[ 268, 103 ]
python
en
['en', 'en', 'en']
True
_generate_intra_panel_by_ports
( data: pd.DataFrame, option_port_name: str, snapshot_num: int, snapshot_sample_num: float, attribute_option: List[str] = None )
Generate intra-view plot. View info within different resource holders(In this senario, ports) in the same epoch. Change snapshot sampling num freely. Args: data (pd.Dataframe): Filtered data within selected conditions. option_port_name (str): Condition for filtering the name attribute in t...
Generate intra-view plot.
def _generate_intra_panel_by_ports( data: pd.DataFrame, option_port_name: str, snapshot_num: int, snapshot_sample_num: float, attribute_option: List[str] = None ): """Generate intra-view plot. View info within different resource holders(In this senario, ports) in the same epoch. Change snapshot sam...
[ "def", "_generate_intra_panel_by_ports", "(", "data", ":", "pd", ".", "DataFrame", ",", "option_port_name", ":", "str", ",", "snapshot_num", ":", "int", ",", "snapshot_sample_num", ":", "float", ",", "attribute_option", ":", "List", "[", "str", "]", "=", "None...
[ 271, 0 ]
[ 327, 35 ]
python
en
['en', 'en', 'it']
True
_generate_intra_panel_accumulated_by_snapshot
( data: pd.DataFrame, snapshot_index: int, ports_num: int, index_name_conversion: pd.DataFrame, sample_ratio: List[float] )
Generate intra-view accumulated plot by snapshot. Args: data (pd.Dataframe): Filtered data within selected conditions. snapshot_index (int): user-selected snapshot index. ports_num (int): Number of ports. index_name_conversion (pd.Dataframe): Relationship between index and name. ...
Generate intra-view accumulated plot by snapshot.
def _generate_intra_panel_accumulated_by_snapshot( data: pd.DataFrame, snapshot_index: int, ports_num: int, index_name_conversion: pd.DataFrame, sample_ratio: List[float] ): """Generate intra-view accumulated plot by snapshot. Args: data (pd.Dataframe): Filtered data within selected conditions....
[ "def", "_generate_intra_panel_accumulated_by_snapshot", "(", "data", ":", "pd", ".", "DataFrame", ",", "snapshot_index", ":", "int", ",", "ports_num", ":", "int", ",", "index_name_conversion", ":", "pd", ".", "DataFrame", ",", "sample_ratio", ":", "List", "[", "...
[ 330, 0 ]
[ 372, 36 ]
python
en
['en', 'en', 'en']
True
_generate_intra_panel_accumulated_by_ports
( data: pd.DataFrame, option_port_name: str, snapshot_num: int, snapshot_sample_num: float )
Generate intra-view accumulated plot by ports. Args: data (pd.Dataframe): Filtered data within selected conditions. option_port_name (str): Condition for filtering the name attribute in the data. snapshot_num (int): Number of snapshots. snapshot_sample_num (float): Number of sampled...
Generate intra-view accumulated plot by ports.
def _generate_intra_panel_accumulated_by_ports( data: pd.DataFrame, option_port_name: str, snapshot_num: int, snapshot_sample_num: float ): """Generate intra-view accumulated plot by ports. Args: data (pd.Dataframe): Filtered data within selected conditions. option_port_name (str): Conditio...
[ "def", "_generate_intra_panel_accumulated_by_ports", "(", "data", ":", "pd", ".", "DataFrame", ",", "option_port_name", ":", "str", ",", "snapshot_num", ":", "int", ",", "snapshot_sample_num", ":", "float", ")", ":", "info_selector", "=", "CIMItemOption", ".", "ba...
[ 375, 0 ]
[ 421, 35 ]
python
en
['en', 'en', 'en']
True
_generate_intra_panel_by_snapshot
( data: pd.DataFrame, snapshot_index: int, ports_num: int, index_name_conversion: pd.DataFrame, sample_ratio: List[float], attribute_option: List[str] = None )
Generate intra-view plot. View info within different snapshot in the same epoch. Args: data (pd.Dataframe): Filtered data within selected conditions. snapshot_index (int): user-selected snapshot index. ports_num (int): Number of ports. index_name_conversion (pd.Dataframe): Rela...
Generate intra-view plot.
def _generate_intra_panel_by_snapshot( data: pd.DataFrame, snapshot_index: int, ports_num: int, index_name_conversion: pd.DataFrame, sample_ratio: List[float], attribute_option: List[str] = None ): """Generate intra-view plot. View info within different snapshot in the same epoch. Args: da...
[ "def", "_generate_intra_panel_by_snapshot", "(", "data", ":", "pd", ".", "DataFrame", ",", "snapshot_index", ":", "int", ",", "ports_num", ":", "int", ",", "index_name_conversion", ":", "pd", ".", "DataFrame", ",", "sample_ratio", ":", "List", "[", "float", "]...
[ 424, 0 ]
[ 474, 36 ]
python
en
['en', 'en', 'it']
True
_render_intra_panel_vessel
(source_path: str, prefix: str, option_epoch: int, snapshot_index: int)
Show vessel info of selected snapshot. Args: source_path (str): The root path of the dumped snapshots data for the corresponding experiment. prefix (str): Prefix of data folders. option_epoch (int): Selected index of epoch. snapshot_index (int): Index of selected snapshot folder. ...
Show vessel info of selected snapshot.
def _render_intra_panel_vessel(source_path: str, prefix: str, option_epoch: int, snapshot_index: int): """Show vessel info of selected snapshot. Args: source_path (str): The root path of the dumped snapshots data for the corresponding experiment. prefix (str): Prefix of data folders. op...
[ "def", "_render_intra_panel_vessel", "(", "source_path", ":", "str", ",", "prefix", ":", "str", ",", "option_epoch", ":", "int", ",", "snapshot_index", ":", "int", ")", ":", "data_vessel", "=", "helper", ".", "read_detail_csv", "(", "os", ".", "path", ".", ...
[ 477, 0 ]
[ 494, 74 ]
python
en
['en', 'en', 'en']
True
_generate_intra_panel_vessel
(data_vessel: pd.DataFrame, snapshot_index: int, vessels_num: int)
Generate vessel data plot. Args: data_vessel (pd.Dataframe): Data of vessel information within selected snapshot index. snapshot_index (int): User-selected snapshot index. vessels_num (int): Number of vessels.
Generate vessel data plot.
def _generate_intra_panel_vessel(data_vessel: pd.DataFrame, snapshot_index: int, vessels_num: int): """Generate vessel data plot. Args: data_vessel (pd.Dataframe): Data of vessel information within selected snapshot index. snapshot_index (int): User-selected snapshot index. vessels_num ...
[ "def", "_generate_intra_panel_vessel", "(", "data_vessel", ":", "pd", ".", "DataFrame", ",", "snapshot_index", ":", "int", ",", "vessels_num", ":", "int", ")", ":", "helper", ".", "render_h3_title", "(", "f\"SnapShot-{snapshot_index}: Vessel Attributes\"", ")", "# Get...
[ 497, 0 ]
[ 540, 43 ]
python
fr
['fr', 'mt', 'it']
False
_render_intra_heat_map
( source_path: str, scenario: GlobalScenarios, epoch_index: int, snapshot_index: int, prefix: str )
Get matrix data and provide entrance to heat map of different scenario. Args: source_path (str): The root path of the dumped snapshots data for the corresponding experiment. scenario (GlobalScenarios): Name of current scenario: CIM. epoch_index (int): Selected epoch index. snapshot...
Get matrix data and provide entrance to heat map of different scenario.
def _render_intra_heat_map( source_path: str, scenario: GlobalScenarios, epoch_index: int, snapshot_index: int, prefix: str ): """Get matrix data and provide entrance to heat map of different scenario. Args: source_path (str): The root path of the dumped snapshots data for the corresponding experim...
[ "def", "_render_intra_heat_map", "(", "source_path", ":", "str", ",", "scenario", ":", "GlobalScenarios", ",", "epoch_index", ":", "int", ",", "snapshot_index", ":", "int", ",", "prefix", ":", "str", ")", ":", "matrix_data", "=", "pd", ".", "read_csv", "(", ...
[ 543, 0 ]
[ 564, 62 ]
python
en
['en', 'en', 'en']
True
_generate_intra_heat_map
(matrix_data: str)
Filter matrix data and generate transfer volume heat map. Args: matrix_data (str): List of transfer volume within selected snapshot index in string format.
Filter matrix data and generate transfer volume heat map.
def _generate_intra_heat_map(matrix_data: str): """Filter matrix data and generate transfer volume heat map. Args: matrix_data (str): List of transfer volume within selected snapshot index in string format. """ matrix_data = matrix_data.replace("[", "") matrix_data = matrix_data.replace("]"...
[ "def", "_generate_intra_heat_map", "(", "matrix_data", ":", "str", ")", ":", "matrix_data", "=", "matrix_data", ".", "replace", "(", "\"[\"", ",", "\"\"", ")", "matrix_data", "=", "matrix_data", ".", "replace", "(", "\"]\"", ",", "\"\"", ")", "matrix_data", ...
[ 567, 0 ]
[ 599, 45 ]
python
en
['nl', 'en', 'en']
True
_generate_top_k_summary
(data: pd.DataFrame, snapshot_index: int, index_name_conversion: pd.DataFrame)
Generate CIM top k summary. Args: data (pd.Dataframe): Data of current snapshot. snapshot_index (int): Selected snapshot index. index_name_conversion (pd.Dataframe): Relationship between index and name.
Generate CIM top k summary.
def _generate_top_k_summary(data: pd.DataFrame, snapshot_index: int, index_name_conversion: pd.DataFrame): """Generate CIM top k summary. Args: data (pd.Dataframe): Data of current snapshot. snapshot_index (int): Selected snapshot index. index_name_conversion (pd.Dataframe): Relationshi...
[ "def", "_generate_top_k_summary", "(", "data", ":", "pd", ".", "DataFrame", ",", "snapshot_index", ":", "int", ",", "index_name_conversion", ":", "pd", ".", "DataFrame", ")", ":", "data_summary", "=", "data", "[", "data", "[", "\"frame_index\"", "]", "==", "...
[ 602, 0 ]
[ 634, 9 ]
python
cs
['cs', 'la', 'hi']
False
get_cpu_temp
()
Get CPU temperature.
Get CPU temperature.
def get_cpu_temp(): """Get CPU temperature.""" res = os.popen("vcgencmd measure_temp").readline() t_cpu = float(res.replace("temp=", "").replace("'C\n", "")) return t_cpu
[ "def", "get_cpu_temp", "(", ")", ":", "res", "=", "os", ".", "popen", "(", "\"vcgencmd measure_temp\"", ")", ".", "readline", "(", ")", "t_cpu", "=", "float", "(", "res", ".", "replace", "(", "\"temp=\"", ",", "\"\"", ")", ".", "replace", "(", "\"'C\\n...
[ 43, 0 ]
[ 47, 16 ]
python
en
['en', 'la', 'en']
True
get_average
(temp_base)
Use moving average to get better readings.
Use moving average to get better readings.
def get_average(temp_base): """Use moving average to get better readings.""" if not hasattr(get_average, "temp"): get_average.temp = [temp_base, temp_base, temp_base] get_average.temp[2] = get_average.temp[1] get_average.temp[1] = get_average.temp[0] get_average.temp[0] = temp_base temp_...
[ "def", "get_average", "(", "temp_base", ")", ":", "if", "not", "hasattr", "(", "get_average", ",", "\"temp\"", ")", ":", "get_average", ".", "temp", "=", "[", "temp_base", ",", "temp_base", ",", "temp_base", "]", "get_average", ".", "temp", "[", "2", "]"...
[ 50, 0 ]
[ 58, 19 ]
python
en
['en', 'en', 'en']
True
setup_platform
(hass, config, add_entities, discovery_info=None)
Set up the Sense HAT sensor platform.
Set up the Sense HAT sensor platform.
def setup_platform(hass, config, add_entities, discovery_info=None): """Set up the Sense HAT sensor platform.""" data = SenseHatData(config.get(CONF_IS_HAT_ATTACHED)) dev = [] for variable in config[CONF_DISPLAY_OPTIONS]: dev.append(SenseHatSensor(data, variable)) add_entities(dev, True)
[ "def", "setup_platform", "(", "hass", ",", "config", ",", "add_entities", ",", "discovery_info", "=", "None", ")", ":", "data", "=", "SenseHatData", "(", "config", ".", "get", "(", "CONF_IS_HAT_ATTACHED", ")", ")", "dev", "=", "[", "]", "for", "variable", ...
[ 61, 0 ]
[ 68, 27 ]
python
en
['en', 'da', 'en']
True
SenseHatSensor.__init__
(self, data, sensor_types)
Initialize the sensor.
Initialize the sensor.
def __init__(self, data, sensor_types): """Initialize the sensor.""" self.data = data self._name = SENSOR_TYPES[sensor_types][0] self._unit_of_measurement = SENSOR_TYPES[sensor_types][1] self.type = sensor_types self._state = None
[ "def", "__init__", "(", "self", ",", "data", ",", "sensor_types", ")", ":", "self", ".", "data", "=", "data", "self", ".", "_name", "=", "SENSOR_TYPES", "[", "sensor_types", "]", "[", "0", "]", "self", ".", "_unit_of_measurement", "=", "SENSOR_TYPES", "[...
[ 74, 4 ]
[ 80, 26 ]
python
en
['en', 'en', 'en']
True
SenseHatSensor.name
(self)
Return the name of the sensor.
Return the name of the sensor.
def name(self): """Return the name of the sensor.""" return self._name
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "_name" ]
[ 83, 4 ]
[ 85, 25 ]
python
en
['en', 'mi', 'en']
True
SenseHatSensor.state
(self)
Return the state of the sensor.
Return the state of the sensor.
def state(self): """Return the state of the sensor.""" return self._state
[ "def", "state", "(", "self", ")", ":", "return", "self", ".", "_state" ]
[ 88, 4 ]
[ 90, 26 ]
python
en
['en', 'en', 'en']
True
SenseHatSensor.unit_of_measurement
(self)
Return the unit the value is expressed in.
Return the unit the value is expressed in.
def unit_of_measurement(self): """Return the unit the value is expressed in.""" return self._unit_of_measurement
[ "def", "unit_of_measurement", "(", "self", ")", ":", "return", "self", ".", "_unit_of_measurement" ]
[ 93, 4 ]
[ 95, 40 ]
python
en
['en', 'en', 'en']
True
SenseHatSensor.update
(self)
Get the latest data and updates the states.
Get the latest data and updates the states.
def update(self): """Get the latest data and updates the states.""" self.data.update() if not self.data.humidity: _LOGGER.error("Don't receive data") return if self.type == "temperature": self._state = self.data.temperature if self.type == "hu...
[ "def", "update", "(", "self", ")", ":", "self", ".", "data", ".", "update", "(", ")", "if", "not", "self", ".", "data", ".", "humidity", ":", "_LOGGER", ".", "error", "(", "\"Don't receive data\"", ")", "return", "if", "self", ".", "type", "==", "\"t...
[ 97, 4 ]
[ 109, 44 ]
python
en
['en', 'en', 'en']
True
SenseHatData.__init__
(self, is_hat_attached)
Initialize the data object.
Initialize the data object.
def __init__(self, is_hat_attached): """Initialize the data object.""" self.temperature = None self.humidity = None self.pressure = None self.is_hat_attached = is_hat_attached
[ "def", "__init__", "(", "self", ",", "is_hat_attached", ")", ":", "self", ".", "temperature", "=", "None", "self", ".", "humidity", "=", "None", "self", ".", "pressure", "=", "None", "self", ".", "is_hat_attached", "=", "is_hat_attached" ]
[ 115, 4 ]
[ 120, 46 ]
python
en
['en', 'en', 'en']
True
SenseHatData.update
(self)
Get the latest data from Sense HAT.
Get the latest data from Sense HAT.
def update(self): """Get the latest data from Sense HAT.""" sense = SenseHat() temp_from_h = sense.get_temperature_from_humidity() temp_from_p = sense.get_temperature_from_pressure() t_total = (temp_from_h + temp_from_p) / 2 if self.is_hat_attached: t_cpu = ...
[ "def", "update", "(", "self", ")", ":", "sense", "=", "SenseHat", "(", ")", "temp_from_h", "=", "sense", ".", "get_temperature_from_humidity", "(", ")", "temp_from_p", "=", "sense", ".", "get_temperature_from_pressure", "(", ")", "t_total", "=", "(", "temp_fro...
[ 123, 4 ]
[ 140, 44 ]
python
en
['en', 'en', 'en']
True
setup_platform
(hass, config, add_entities, discovery_info=None)
Set up the rtorrent sensors.
Set up the rtorrent sensors.
def setup_platform(hass, config, add_entities, discovery_info=None): """Set up the rtorrent sensors.""" url = config[CONF_URL] name = config[CONF_NAME] try: rtorrent = xmlrpc.client.ServerProxy(url) except (xmlrpc.client.ProtocolError, ConnectionRefusedError) as ex: _LOGGER.error("C...
[ "def", "setup_platform", "(", "hass", ",", "config", ",", "add_entities", ",", "discovery_info", "=", "None", ")", ":", "url", "=", "config", "[", "CONF_URL", "]", "name", "=", "config", "[", "CONF_NAME", "]", "try", ":", "rtorrent", "=", "xmlrpc", ".", ...
[ 54, 0 ]
[ 68, 21 ]
python
en
['en', 'bg', 'en']
True
format_speed
(speed)
Return a bytes/s measurement as a human readable string.
Return a bytes/s measurement as a human readable string.
def format_speed(speed): """Return a bytes/s measurement as a human readable string.""" kb_spd = float(speed) / 1024 return round(kb_spd, 2 if kb_spd < 0.1 else 1)
[ "def", "format_speed", "(", "speed", ")", ":", "kb_spd", "=", "float", "(", "speed", ")", "/", "1024", "return", "round", "(", "kb_spd", ",", "2", "if", "kb_spd", "<", "0.1", "else", "1", ")" ]
[ 71, 0 ]
[ 74, 50 ]
python
en
['en', 'en', 'en']
True
RTorrentSensor.__init__
(self, sensor_type, rtorrent_client, client_name)
Initialize the sensor.
Initialize the sensor.
def __init__(self, sensor_type, rtorrent_client, client_name): """Initialize the sensor.""" self._name = SENSOR_TYPES[sensor_type][0] self.client = rtorrent_client self.type = sensor_type self.client_name = client_name self._state = None self._unit_of_measurement ...
[ "def", "__init__", "(", "self", ",", "sensor_type", ",", "rtorrent_client", ",", "client_name", ")", ":", "self", ".", "_name", "=", "SENSOR_TYPES", "[", "sensor_type", "]", "[", "0", "]", "self", ".", "client", "=", "rtorrent_client", "self", ".", "type",...
[ 80, 4 ]
[ 89, 31 ]
python
en
['en', 'en', 'en']
True
RTorrentSensor.name
(self)
Return the name of the sensor.
Return the name of the sensor.
def name(self): """Return the name of the sensor.""" return f"{self.client_name} {self._name}"
[ "def", "name", "(", "self", ")", ":", "return", "f\"{self.client_name} {self._name}\"" ]
[ 92, 4 ]
[ 94, 49 ]
python
en
['en', 'mi', 'en']
True
RTorrentSensor.state
(self)
Return the state of the sensor.
Return the state of the sensor.
def state(self): """Return the state of the sensor.""" return self._state
[ "def", "state", "(", "self", ")", ":", "return", "self", ".", "_state" ]
[ 97, 4 ]
[ 99, 26 ]
python
en
['en', 'en', 'en']
True
RTorrentSensor.available
(self)
Return true if device is available.
Return true if device is available.
def available(self): """Return true if device is available.""" return self._available
[ "def", "available", "(", "self", ")", ":", "return", "self", ".", "_available" ]
[ 102, 4 ]
[ 104, 30 ]
python
en
['en', 'en', 'en']
True
RTorrentSensor.unit_of_measurement
(self)
Return the unit of measurement of this entity, if any.
Return the unit of measurement of this entity, if any.
def unit_of_measurement(self): """Return the unit of measurement of this entity, if any.""" return self._unit_of_measurement
[ "def", "unit_of_measurement", "(", "self", ")", ":", "return", "self", ".", "_unit_of_measurement" ]
[ 107, 4 ]
[ 109, 40 ]
python
en
['en', 'en', 'en']
True
RTorrentSensor.update
(self)
Get the latest data from rtorrent and updates the state.
Get the latest data from rtorrent and updates the state.
def update(self): """Get the latest data from rtorrent and updates the state.""" multicall = xmlrpc.client.MultiCall(self.client) multicall.throttle.global_up.rate() multicall.throttle.global_down.rate() multicall.d.multicall2("", "main") multicall.d.multicall2("", "stopp...
[ "def", "update", "(", "self", ")", ":", "multicall", "=", "xmlrpc", ".", "client", ".", "MultiCall", "(", "self", ".", "client", ")", "multicall", ".", "throttle", ".", "global_up", ".", "rate", "(", ")", "multicall", ".", "throttle", ".", "global_down",...
[ 111, 4 ]
[ 177, 45 ]
python
en
['en', 'en', 'en']
True
is_internal_request
(hass: HomeAssistant)
Test if the current request is internal.
Test if the current request is internal.
def is_internal_request(hass: HomeAssistant) -> bool: """Test if the current request is internal.""" try: _get_internal_url(hass, require_current_request=True) return True except NoURLAvailableError: return False
[ "def", "is_internal_request", "(", "hass", ":", "HomeAssistant", ")", "->", "bool", ":", "try", ":", "_get_internal_url", "(", "hass", ",", "require_current_request", "=", "True", ")", "return", "True", "except", "NoURLAvailableError", ":", "return", "False" ]
[ 27, 0 ]
[ 33, 20 ]
python
en
['en', 'en', 'en']
True
get_url
( hass: HomeAssistant, *, require_current_request: bool = False, require_ssl: bool = False, require_standard_port: bool = False, allow_internal: bool = True, allow_external: bool = True, allow_cloud: bool = True, allow_ip: bool = True, prefer_external: bool = False, prefer_cl...
Get a URL to this instance.
Get a URL to this instance.
def get_url( hass: HomeAssistant, *, require_current_request: bool = False, require_ssl: bool = False, require_standard_port: bool = False, allow_internal: bool = True, allow_external: bool = True, allow_cloud: bool = True, allow_ip: bool = True, prefer_external: bool = False, ...
[ "def", "get_url", "(", "hass", ":", "HomeAssistant", ",", "*", ",", "require_current_request", ":", "bool", "=", "False", ",", "require_ssl", ":", "bool", "=", "False", ",", "require_standard_port", ":", "bool", "=", "False", ",", "allow_internal", ":", "boo...
[ 37, 0 ]
[ 122, 29 ]
python
en
['en', 'en', 'en']
True
_get_request_host
()
Get the host address of the current request.
Get the host address of the current request.
def _get_request_host() -> Optional[str]: """Get the host address of the current request.""" request = current_request.get() if request is None: raise NoURLAvailableError return yarl.URL(request.url).host
[ "def", "_get_request_host", "(", ")", "->", "Optional", "[", "str", "]", ":", "request", "=", "current_request", ".", "get", "(", ")", "if", "request", "is", "None", ":", "raise", "NoURLAvailableError", "return", "yarl", ".", "URL", "(", "request", ".", ...
[ 125, 0 ]
[ 130, 37 ]
python
en
['en', 'en', 'en']
True
_get_internal_url
( hass: HomeAssistant, *, allow_ip: bool = True, require_current_request: bool = False, require_ssl: bool = False, require_standard_port: bool = False, )
Get internal URL of this instance.
Get internal URL of this instance.
def _get_internal_url( hass: HomeAssistant, *, allow_ip: bool = True, require_current_request: bool = False, require_ssl: bool = False, require_standard_port: bool = False, ) -> str: """Get internal URL of this instance.""" if hass.config.internal_url: internal_url = yarl.URL(has...
[ "def", "_get_internal_url", "(", "hass", ":", "HomeAssistant", ",", "*", ",", "allow_ip", ":", "bool", "=", "True", ",", "require_current_request", ":", "bool", "=", "False", ",", "require_ssl", ":", "bool", "=", "False", ",", "require_standard_port", ":", "...
[ 134, 0 ]
[ 180, 29 ]
python
en
['en', 'en', 'en']
True
_get_external_url
( hass: HomeAssistant, *, allow_cloud: bool = True, allow_ip: bool = True, prefer_cloud: bool = False, require_current_request: bool = False, require_ssl: bool = False, require_standard_port: bool = False, )
Get external URL of this instance.
Get external URL of this instance.
def _get_external_url( hass: HomeAssistant, *, allow_cloud: bool = True, allow_ip: bool = True, prefer_cloud: bool = False, require_current_request: bool = False, require_ssl: bool = False, require_standard_port: bool = False, ) -> str: """Get external URL of this instance.""" if...
[ "def", "_get_external_url", "(", "hass", ":", "HomeAssistant", ",", "*", ",", "allow_cloud", ":", "bool", "=", "True", ",", "allow_ip", ":", "bool", "=", "True", ",", "prefer_cloud", ":", "bool", "=", "False", ",", "require_current_request", ":", "bool", "...
[ 184, 0 ]
[ 236, 29 ]
python
en
['en', 'en', 'en']
True
_get_cloud_url
(hass: HomeAssistant, require_current_request: bool = False)
Get external Home Assistant Cloud URL of this instance.
Get external Home Assistant Cloud URL of this instance.
def _get_cloud_url(hass: HomeAssistant, require_current_request: bool = False) -> str: """Get external Home Assistant Cloud URL of this instance.""" if "cloud" in hass.config.components: try: cloud_url = yarl.URL(cast(str, hass.components.cloud.async_remote_ui_url())) except hass.com...
[ "def", "_get_cloud_url", "(", "hass", ":", "HomeAssistant", ",", "require_current_request", ":", "bool", "=", "False", ")", "->", "str", ":", "if", "\"cloud\"", "in", "hass", ".", "config", ".", "components", ":", "try", ":", "cloud_url", "=", "yarl", ".",...
[ 240, 0 ]
[ 251, 29 ]
python
en
['en', 'en', 'en']
True
_get_deprecated_base_url
( hass: HomeAssistant, *, internal: bool = False, allow_ip: bool = True, require_current_request: bool = False, require_ssl: bool = False, require_standard_port: bool = False, )
Work with the deprecated `base_url`, used as fallback.
Work with the deprecated `base_url`, used as fallback.
def _get_deprecated_base_url( hass: HomeAssistant, *, internal: bool = False, allow_ip: bool = True, require_current_request: bool = False, require_ssl: bool = False, require_standard_port: bool = False, ) -> str: """Work with the deprecated `base_url`, used as fallback.""" if hass.c...
[ "def", "_get_deprecated_base_url", "(", "hass", ":", "HomeAssistant", ",", "*", ",", "internal", ":", "bool", "=", "False", ",", "allow_ip", ":", "bool", "=", "True", ",", "require_current_request", ":", "bool", "=", "False", ",", "require_ssl", ":", "bool",...
[ 255, 0 ]
[ 298, 29 ]
python
en
['en', 'en', 'en']
True
solarlog_entries
(hass: HomeAssistant)
Return the hosts already configured.
Return the hosts already configured.
def solarlog_entries(hass: HomeAssistant): """Return the hosts already configured.""" return { entry.data[CONF_HOST] for entry in hass.config_entries.async_entries(DOMAIN) }
[ "def", "solarlog_entries", "(", "hass", ":", "HomeAssistant", ")", ":", "return", "{", "entry", ".", "data", "[", "CONF_HOST", "]", "for", "entry", "in", "hass", ".", "config_entries", ".", "async_entries", "(", "DOMAIN", ")", "}" ]
[ 19, 0 ]
[ 23, 5 ]
python
en
['en', 'ga', 'en']
True
SolarLogConfigFlow.__init__
(self)
Initialize the config flow.
Initialize the config flow.
def __init__(self) -> None: """Initialize the config flow.""" self._errors = {}
[ "def", "__init__", "(", "self", ")", "->", "None", ":", "self", ".", "_errors", "=", "{", "}" ]
[ 32, 4 ]
[ 34, 25 ]
python
en
['en', 'en', 'en']
True
SolarLogConfigFlow._host_in_configuration_exists
(self, host)
Return True if host exists in configuration.
Return True if host exists in configuration.
def _host_in_configuration_exists(self, host) -> bool: """Return True if host exists in configuration.""" if host in solarlog_entries(self.hass): return True return False
[ "def", "_host_in_configuration_exists", "(", "self", ",", "host", ")", "->", "bool", ":", "if", "host", "in", "solarlog_entries", "(", "self", ".", "hass", ")", ":", "return", "True", "return", "False" ]
[ 36, 4 ]
[ 40, 20 ]
python
en
['en', 'en', 'en']
True
SolarLogConfigFlow._test_connection
(self, host)
Check if we can connect to the Solar-Log device.
Check if we can connect to the Solar-Log device.
async def _test_connection(self, host): """Check if we can connect to the Solar-Log device.""" try: await self.hass.async_add_executor_job(SolarLog, host) return True except (OSError, HTTPError, Timeout): self._errors[CONF_HOST] = "cannot_connect" ...
[ "async", "def", "_test_connection", "(", "self", ",", "host", ")", ":", "try", ":", "await", "self", ".", "hass", ".", "async_add_executor_job", "(", "SolarLog", ",", "host", ")", "return", "True", "except", "(", "OSError", ",", "HTTPError", ",", "Timeout"...
[ 42, 4 ]
[ 53, 20 ]
python
en
['en', 'en', 'en']
True
SolarLogConfigFlow.async_step_user
(self, user_input=None)
Step when user initializes a integration.
Step when user initializes a integration.
async def async_step_user(self, user_input=None): """Step when user initializes a integration.""" self._errors = {} if user_input is not None: # set some defaults in case we need to return to the form name = slugify(user_input.get(CONF_NAME, DEFAULT_NAME)) hos...
[ "async", "def", "async_step_user", "(", "self", ",", "user_input", "=", "None", ")", ":", "self", ".", "_errors", "=", "{", "}", "if", "user_input", "is", "not", "None", ":", "# set some defaults in case we need to return to the form", "name", "=", "slugify", "(...
[ 55, 4 ]
[ 92, 9 ]
python
en
['en', 'en', 'en']
True
SolarLogConfigFlow.async_step_import
(self, user_input=None)
Import a config entry.
Import a config entry.
async def async_step_import(self, user_input=None): """Import a config entry.""" host_entry = user_input.get(CONF_HOST, DEFAULT_HOST) url = urlparse(host_entry, "http") netloc = url.netloc or url.path path = url.path if url.netloc else "" url = ParseResult("http", netloc...
[ "async", "def", "async_step_import", "(", "self", ",", "user_input", "=", "None", ")", ":", "host_entry", "=", "user_input", ".", "get", "(", "CONF_HOST", ",", "DEFAULT_HOST", ")", "url", "=", "urlparse", "(", "host_entry", ",", "\"http\"", ")", "netloc", ...
[ 94, 4 ]
[ 106, 53 ]
python
en
['en', 'en', 'en']
True
setup_platform
(hass, platform)
Set up the ring platform and prerequisites.
Set up the ring platform and prerequisites.
async def setup_platform(hass, platform): """Set up the ring platform and prerequisites.""" MockConfigEntry(domain=DOMAIN, data={"username": "foo", "token": {}}).add_to_hass( hass ) with patch("homeassistant.components.ring.PLATFORMS", [platform]): assert await async_setup_component(hass...
[ "async", "def", "setup_platform", "(", "hass", ",", "platform", ")", ":", "MockConfigEntry", "(", "domain", "=", "DOMAIN", ",", "data", "=", "{", "\"username\"", ":", "\"foo\"", ",", "\"token\"", ":", "{", "}", "}", ")", ".", "add_to_hass", "(", "hass", ...
[ 8, 0 ]
[ 15, 38 ]
python
en
['en', 'en', 'en']
True
validate_json_files
(integration: Integration)
Validate JSON files for integration.
Validate JSON files for integration.
def validate_json_files(integration: Integration): """Validate JSON files for integration.""" for json_file in integration.path.glob("**/*.json"): if not json_file.is_file(): continue try: json.loads(json_file.read_text()) except json.JSONDecodeError: ...
[ "def", "validate_json_files", "(", "integration", ":", "Integration", ")", ":", "for", "json_file", "in", "integration", ".", "path", ".", "glob", "(", "\"**/*.json\"", ")", ":", "if", "not", "json_file", ".", "is_file", "(", ")", ":", "continue", "try", "...
[ 7, 0 ]
[ 19, 10 ]
python
en
['en', 'da', 'en']
True
validate
(integrations: Dict[str, Integration], config)
Handle JSON files inside integrations.
Handle JSON files inside integrations.
def validate(integrations: Dict[str, Integration], config): """Handle JSON files inside integrations.""" if not config.specific_integrations: return for integration in integrations.values(): if not integration.manifest: continue validate_json_files(integration)
[ "def", "validate", "(", "integrations", ":", "Dict", "[", "str", ",", "Integration", "]", ",", "config", ")", ":", "if", "not", "config", ".", "specific_integrations", ":", "return", "for", "integration", "in", "integrations", ".", "values", "(", ")", ":",...
[ 22, 0 ]
[ 31, 40 ]
python
en
['en', 'da', 'en']
True
async_setup_entry
(hass, config_entry, async_add_entities)
Set up OpenWeatherMap sensor entities based on a config entry.
Set up OpenWeatherMap sensor entities based on a config entry.
async def async_setup_entry(hass, config_entry, async_add_entities): """Set up OpenWeatherMap sensor entities based on a config entry.""" domain_data = hass.data[DOMAIN][config_entry.entry_id] name = domain_data[ENTRY_NAME] weather_coordinator = domain_data[ENTRY_WEATHER_COORDINATOR] weather_sensor...
[ "async", "def", "async_setup_entry", "(", "hass", ",", "config_entry", ",", "async_add_entities", ")", ":", "domain_data", "=", "hass", ".", "data", "[", "DOMAIN", "]", "[", "config_entry", ".", "entry_id", "]", "name", "=", "domain_data", "[", "ENTRY_NAME", ...
[ 15, 0 ]
[ 49, 32 ]
python
en
['en', 'en', 'en']
True
OpenWeatherMapSensor.__init__
( self, name, unique_id, sensor_type, sensor_configuration, weather_coordinator: WeatherUpdateCoordinator, )
Initialize the sensor.
Initialize the sensor.
def __init__( self, name, unique_id, sensor_type, sensor_configuration, weather_coordinator: WeatherUpdateCoordinator, ): """Initialize the sensor.""" super().__init__( name, unique_id, sensor_type, sensor_configuration, weather_coordinator...
[ "def", "__init__", "(", "self", ",", "name", ",", "unique_id", ",", "sensor_type", ",", "sensor_configuration", ",", "weather_coordinator", ":", "WeatherUpdateCoordinator", ",", ")", ":", "super", "(", ")", ".", "__init__", "(", "name", ",", "unique_id", ",", ...
[ 55, 4 ]
[ 67, 55 ]
python
en
['en', 'en', 'en']
True
OpenWeatherMapSensor.state
(self)
Return the state of the device.
Return the state of the device.
def state(self): """Return the state of the device.""" return self._weather_coordinator.data.get(self._sensor_type, None)
[ "def", "state", "(", "self", ")", ":", "return", "self", ".", "_weather_coordinator", ".", "data", ".", "get", "(", "self", ".", "_sensor_type", ",", "None", ")" ]
[ 70, 4 ]
[ 72, 74 ]
python
en
['en', 'en', 'en']
True
OpenWeatherMapForecastSensor.__init__
( self, name, unique_id, sensor_type, sensor_configuration, weather_coordinator: WeatherUpdateCoordinator, )
Initialize the sensor.
Initialize the sensor.
def __init__( self, name, unique_id, sensor_type, sensor_configuration, weather_coordinator: WeatherUpdateCoordinator, ): """Initialize the sensor.""" super().__init__( name, unique_id, sensor_type, sensor_configuration, weather_coordinator...
[ "def", "__init__", "(", "self", ",", "name", ",", "unique_id", ",", "sensor_type", ",", "sensor_configuration", ",", "weather_coordinator", ":", "WeatherUpdateCoordinator", ",", ")", ":", "super", "(", ")", ".", "__init__", "(", "name", ",", "unique_id", ",", ...
[ 78, 4 ]
[ 90, 55 ]
python
en
['en', 'en', 'en']
True
OpenWeatherMapForecastSensor.state
(self)
Return the state of the device.
Return the state of the device.
def state(self): """Return the state of the device.""" forecasts = self._weather_coordinator.data.get(ATTR_API_FORECAST) if forecasts is not None and len(forecasts) > 0: return forecasts[0].get(self._sensor_type, None) return None
[ "def", "state", "(", "self", ")", ":", "forecasts", "=", "self", ".", "_weather_coordinator", ".", "data", ".", "get", "(", "ATTR_API_FORECAST", ")", "if", "forecasts", "is", "not", "None", "and", "len", "(", "forecasts", ")", ">", "0", ":", "return", ...
[ 93, 4 ]
[ 98, 19 ]
python
en
['en', 'en', 'en']
True
AdvantageAirConfigFlow.async_step_user
(self, user_input=None)
Get configuration from the user.
Get configuration from the user.
async def async_step_user(self, user_input=None): """Get configuration from the user.""" errors = {} if user_input: ip_address = user_input[CONF_IP_ADDRESS] port = user_input[CONF_PORT] try: data = await advantage_air( ip_a...
[ "async", "def", "async_step_user", "(", "self", ",", "user_input", "=", "None", ")", ":", "errors", "=", "{", "}", "if", "user_input", ":", "ip_address", "=", "user_input", "[", "CONF_IP_ADDRESS", "]", "port", "=", "user_input", "[", "CONF_PORT", "]", "try...
[ 27, 4 ]
[ 56, 9 ]
python
en
['en', 'en', 'en']
True
test_device_remove
( hass, mqtt_mock, caplog, device_reg, entity_reg, setup_tasmota )
Test removing a discovered device through device registry.
Test removing a discovered device through device registry.
async def test_device_remove( hass, mqtt_mock, caplog, device_reg, entity_reg, setup_tasmota ): """Test removing a discovered device through device registry.""" config = copy.deepcopy(DEFAULT_CONFIG) mac = config["mac"] async_fire_mqtt_message(hass, f"{DEFAULT_PREFIX}/{mac}/config", json.dumps(conf...
[ "async", "def", "test_device_remove", "(", "hass", ",", "mqtt_mock", ",", "caplog", ",", "device_reg", ",", "entity_reg", ",", "setup_tasmota", ")", ":", "config", "=", "copy", ".", "deepcopy", "(", "DEFAULT_CONFIG", ")", "mac", "=", "config", "[", "\"mac\""...
[ 13, 0 ]
[ 41, 5 ]
python
en
['en', 'en', 'en']
True