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
air_conditioner_fixture
(device_factory)
Fixture returns a air conditioner.
Fixture returns a air conditioner.
def air_conditioner_fixture(device_factory): """Fixture returns a air conditioner.""" device = device_factory( "Air Conditioner", capabilities=[ Capability.air_conditioner_mode, Capability.demand_response_load_control, Capability.air_conditioner_fan_mode, ...
[ "def", "air_conditioner_fixture", "(", "device_factory", ")", ":", "device", "=", "device_factory", "(", "\"Air Conditioner\"", ",", "capabilities", "=", "[", "Capability", ".", "air_conditioner_mode", ",", "Capability", ".", "demand_response_load_control", ",", "Capabi...
[ 150, 0 ]
[ 198, 17 ]
python
en
['en', 'ca', 'en']
True
test_legacy_thermostat_entity_state
(hass, legacy_thermostat)
Tests the state attributes properly match the thermostat type.
Tests the state attributes properly match the thermostat type.
async def test_legacy_thermostat_entity_state(hass, legacy_thermostat): """Tests the state attributes properly match the thermostat type.""" await setup_platform(hass, CLIMATE_DOMAIN, devices=[legacy_thermostat]) state = hass.states.get("climate.legacy_thermostat") assert state.state == HVAC_MODE_HEAT_C...
[ "async", "def", "test_legacy_thermostat_entity_state", "(", "hass", ",", "legacy_thermostat", ")", ":", "await", "setup_platform", "(", "hass", ",", "CLIMATE_DOMAIN", ",", "devices", "=", "[", "legacy_thermostat", "]", ")", "state", "=", "hass", ".", "states", "...
[ 201, 0 ]
[ 224, 61 ]
python
en
['en', 'en', 'en']
True
test_basic_thermostat_entity_state
(hass, basic_thermostat)
Tests the state attributes properly match the thermostat type.
Tests the state attributes properly match the thermostat type.
async def test_basic_thermostat_entity_state(hass, basic_thermostat): """Tests the state attributes properly match the thermostat type.""" await setup_platform(hass, CLIMATE_DOMAIN, devices=[basic_thermostat]) state = hass.states.get("climate.basic_thermostat") assert state.state == HVAC_MODE_OFF as...
[ "async", "def", "test_basic_thermostat_entity_state", "(", "hass", ",", "basic_thermostat", ")", ":", "await", "setup_platform", "(", "hass", ",", "CLIMATE_DOMAIN", ",", "devices", "=", "[", "basic_thermostat", "]", ")", "state", "=", "hass", ".", "states", ".",...
[ 227, 0 ]
[ 243, 61 ]
python
en
['en', 'en', 'en']
True
test_thermostat_entity_state
(hass, thermostat)
Tests the state attributes properly match the thermostat type.
Tests the state attributes properly match the thermostat type.
async def test_thermostat_entity_state(hass, thermostat): """Tests the state attributes properly match the thermostat type.""" await setup_platform(hass, CLIMATE_DOMAIN, devices=[thermostat]) state = hass.states.get("climate.thermostat") assert state.state == HVAC_MODE_HEAT assert ( state.at...
[ "async", "def", "test_thermostat_entity_state", "(", "hass", ",", "thermostat", ")", ":", "await", "setup_platform", "(", "hass", ",", "CLIMATE_DOMAIN", ",", "devices", "=", "[", "thermostat", "]", ")", "state", "=", "hass", ".", "states", ".", "get", "(", ...
[ 246, 0 ]
[ 269, 56 ]
python
en
['en', 'en', 'en']
True
test_buggy_thermostat_entity_state
(hass, buggy_thermostat)
Tests the state attributes properly match the thermostat type.
Tests the state attributes properly match the thermostat type.
async def test_buggy_thermostat_entity_state(hass, buggy_thermostat): """Tests the state attributes properly match the thermostat type.""" await setup_platform(hass, CLIMATE_DOMAIN, devices=[buggy_thermostat]) state = hass.states.get("climate.buggy_thermostat") assert state.state == STATE_UNKNOWN as...
[ "async", "def", "test_buggy_thermostat_entity_state", "(", "hass", ",", "buggy_thermostat", ")", ":", "await", "setup_platform", "(", "hass", ",", "CLIMATE_DOMAIN", ",", "devices", "=", "[", "buggy_thermostat", "]", ")", "state", "=", "hass", ".", "states", ".",...
[ 272, 0 ]
[ 284, 50 ]
python
en
['en', 'en', 'en']
True
test_buggy_thermostat_invalid_mode
(hass, buggy_thermostat)
Tests when an invalid operation mode is included.
Tests when an invalid operation mode is included.
async def test_buggy_thermostat_invalid_mode(hass, buggy_thermostat): """Tests when an invalid operation mode is included.""" buggy_thermostat.status.update_attribute_value( Attribute.supported_thermostat_modes, ["heat", "emergency heat", "other"] ) await setup_platform(hass, CLIMATE_DOMAIN, dev...
[ "async", "def", "test_buggy_thermostat_invalid_mode", "(", "hass", ",", "buggy_thermostat", ")", ":", "buggy_thermostat", ".", "status", ".", "update_attribute_value", "(", "Attribute", ".", "supported_thermostat_modes", ",", "[", "\"heat\"", ",", "\"emergency heat\"", ...
[ 287, 0 ]
[ 294, 64 ]
python
en
['en', 'en', 'en']
True
test_air_conditioner_entity_state
(hass, air_conditioner)
Tests when an invalid operation mode is included.
Tests when an invalid operation mode is included.
async def test_air_conditioner_entity_state(hass, air_conditioner): """Tests when an invalid operation mode is included.""" await setup_platform(hass, CLIMATE_DOMAIN, devices=[air_conditioner]) state = hass.states.get("climate.air_conditioner") assert state.state == HVAC_MODE_HEAT_COOL assert ( ...
[ "async", "def", "test_air_conditioner_entity_state", "(", "hass", ",", "air_conditioner", ")", ":", "await", "setup_platform", "(", "hass", ",", "CLIMATE_DOMAIN", ",", "devices", "=", "[", "air_conditioner", "]", ")", "state", "=", "hass", ".", "states", ".", ...
[ 297, 0 ]
[ 331, 78 ]
python
en
['en', 'en', 'en']
True
test_set_fan_mode
(hass, thermostat, air_conditioner)
Test the fan mode is set successfully.
Test the fan mode is set successfully.
async def test_set_fan_mode(hass, thermostat, air_conditioner): """Test the fan mode is set successfully.""" await setup_platform(hass, CLIMATE_DOMAIN, devices=[thermostat, air_conditioner]) entity_ids = ["climate.thermostat", "climate.air_conditioner"] await hass.services.async_call( CLIMATE_DO...
[ "async", "def", "test_set_fan_mode", "(", "hass", ",", "thermostat", ",", "air_conditioner", ")", ":", "await", "setup_platform", "(", "hass", ",", "CLIMATE_DOMAIN", ",", "devices", "=", "[", "thermostat", ",", "air_conditioner", "]", ")", "entity_ids", "=", "...
[ 334, 0 ]
[ 346, 67 ]
python
en
['en', 'fy', 'en']
True
test_set_hvac_mode
(hass, thermostat, air_conditioner)
Test the hvac mode is set successfully.
Test the hvac mode is set successfully.
async def test_set_hvac_mode(hass, thermostat, air_conditioner): """Test the hvac mode is set successfully.""" await setup_platform(hass, CLIMATE_DOMAIN, devices=[thermostat, air_conditioner]) entity_ids = ["climate.thermostat", "climate.air_conditioner"] await hass.services.async_call( CLIMATE_...
[ "async", "def", "test_set_hvac_mode", "(", "hass", ",", "thermostat", ",", "air_conditioner", ")", ":", "await", "setup_platform", "(", "hass", ",", "CLIMATE_DOMAIN", ",", "devices", "=", "[", "thermostat", ",", "air_conditioner", "]", ")", "entity_ids", "=", ...
[ 349, 0 ]
[ 362, 55 ]
python
en
['en', 'en', 'en']
True
test_ac_set_hvac_mode_from_off
(hass, air_conditioner)
Test setting HVAC mode when the unit is off.
Test setting HVAC mode when the unit is off.
async def test_ac_set_hvac_mode_from_off(hass, air_conditioner): """Test setting HVAC mode when the unit is off.""" air_conditioner.status.update_attribute_value( Attribute.air_conditioner_mode, "heat" ) air_conditioner.status.update_attribute_value(Attribute.switch, "off") await setup_platf...
[ "async", "def", "test_ac_set_hvac_mode_from_off", "(", "hass", ",", "air_conditioner", ")", ":", "air_conditioner", ".", "status", ".", "update_attribute_value", "(", "Attribute", ".", "air_conditioner_mode", ",", "\"heat\"", ")", "air_conditioner", ".", "status", "."...
[ 365, 0 ]
[ 384, 45 ]
python
en
['en', 'en', 'en']
True
test_ac_set_hvac_mode_off
(hass, air_conditioner)
Test the AC HVAC mode can be turned off set successfully.
Test the AC HVAC mode can be turned off set successfully.
async def test_ac_set_hvac_mode_off(hass, air_conditioner): """Test the AC HVAC mode can be turned off set successfully.""" await setup_platform(hass, CLIMATE_DOMAIN, devices=[air_conditioner]) state = hass.states.get("climate.air_conditioner") assert state.state != HVAC_MODE_OFF await hass.services...
[ "async", "def", "test_ac_set_hvac_mode_off", "(", "hass", ",", "air_conditioner", ")", ":", "await", "setup_platform", "(", "hass", ",", "CLIMATE_DOMAIN", ",", "devices", "=", "[", "air_conditioner", "]", ")", "state", "=", "hass", ".", "states", ".", "get", ...
[ 387, 0 ]
[ 399, 39 ]
python
en
['en', 'en', 'en']
True
test_set_temperature_heat_mode
(hass, thermostat)
Test the temperature is set successfully when in heat mode.
Test the temperature is set successfully when in heat mode.
async def test_set_temperature_heat_mode(hass, thermostat): """Test the temperature is set successfully when in heat mode.""" thermostat.status.thermostat_mode = "heat" await setup_platform(hass, CLIMATE_DOMAIN, devices=[thermostat]) await hass.services.async_call( CLIMATE_DOMAIN, SERVIC...
[ "async", "def", "test_set_temperature_heat_mode", "(", "hass", ",", "thermostat", ")", ":", "thermostat", ".", "status", ".", "thermostat_mode", "=", "\"heat\"", "await", "setup_platform", "(", "hass", ",", "CLIMATE_DOMAIN", ",", "devices", "=", "[", "thermostat",...
[ 402, 0 ]
[ 415, 53 ]
python
en
['en', 'en', 'en']
True
test_set_temperature_cool_mode
(hass, thermostat)
Test the temperature is set successfully when in cool mode.
Test the temperature is set successfully when in cool mode.
async def test_set_temperature_cool_mode(hass, thermostat): """Test the temperature is set successfully when in cool mode.""" thermostat.status.thermostat_mode = "cool" await setup_platform(hass, CLIMATE_DOMAIN, devices=[thermostat]) await hass.services.async_call( CLIMATE_DOMAIN, SERVIC...
[ "async", "def", "test_set_temperature_cool_mode", "(", "hass", ",", "thermostat", ")", ":", "thermostat", ".", "status", ".", "thermostat_mode", "=", "\"cool\"", "await", "setup_platform", "(", "hass", ",", "CLIMATE_DOMAIN", ",", "devices", "=", "[", "thermostat",...
[ 418, 0 ]
[ 429, 51 ]
python
en
['en', 'en', 'en']
True
test_set_temperature
(hass, thermostat)
Test the temperature is set successfully.
Test the temperature is set successfully.
async def test_set_temperature(hass, thermostat): """Test the temperature is set successfully.""" thermostat.status.thermostat_mode = "auto" await setup_platform(hass, CLIMATE_DOMAIN, devices=[thermostat]) await hass.services.async_call( CLIMATE_DOMAIN, SERVICE_SET_TEMPERATURE, {...
[ "async", "def", "test_set_temperature", "(", "hass", ",", "thermostat", ")", ":", "thermostat", ".", "status", ".", "thermostat_mode", "=", "\"auto\"", "await", "setup_platform", "(", "hass", ",", "CLIMATE_DOMAIN", ",", "devices", "=", "[", "thermostat", "]", ...
[ 432, 0 ]
[ 448, 57 ]
python
en
['en', 'en', 'en']
True
test_set_temperature_ac
(hass, air_conditioner)
Test the temperature is set successfully.
Test the temperature is set successfully.
async def test_set_temperature_ac(hass, air_conditioner): """Test the temperature is set successfully.""" await setup_platform(hass, CLIMATE_DOMAIN, devices=[air_conditioner]) await hass.services.async_call( CLIMATE_DOMAIN, SERVICE_SET_TEMPERATURE, {ATTR_ENTITY_ID: "climate.air_condi...
[ "async", "def", "test_set_temperature_ac", "(", "hass", ",", "air_conditioner", ")", ":", "await", "setup_platform", "(", "hass", ",", "CLIMATE_DOMAIN", ",", "devices", "=", "[", "air_conditioner", "]", ")", "await", "hass", ".", "services", ".", "async_call", ...
[ 451, 0 ]
[ 461, 51 ]
python
en
['en', 'en', 'en']
True
test_set_temperature_ac_with_mode
(hass, air_conditioner)
Test the temperature is set successfully.
Test the temperature is set successfully.
async def test_set_temperature_ac_with_mode(hass, air_conditioner): """Test the temperature is set successfully.""" await setup_platform(hass, CLIMATE_DOMAIN, devices=[air_conditioner]) await hass.services.async_call( CLIMATE_DOMAIN, SERVICE_SET_TEMPERATURE, { ATTR_ENTITY...
[ "async", "def", "test_set_temperature_ac_with_mode", "(", "hass", ",", "air_conditioner", ")", ":", "await", "setup_platform", "(", "hass", ",", "CLIMATE_DOMAIN", ",", "devices", "=", "[", "air_conditioner", "]", ")", "await", "hass", ".", "services", ".", "asyn...
[ 464, 0 ]
[ 479, 40 ]
python
en
['en', 'en', 'en']
True
test_set_temperature_ac_with_mode_from_off
(hass, air_conditioner)
Test the temp and mode is set successfully when the unit is off.
Test the temp and mode is set successfully when the unit is off.
async def test_set_temperature_ac_with_mode_from_off(hass, air_conditioner): """Test the temp and mode is set successfully when the unit is off.""" air_conditioner.status.update_attribute_value( Attribute.air_conditioner_mode, "heat" ) air_conditioner.status.update_attribute_value(Attribute.swit...
[ "async", "def", "test_set_temperature_ac_with_mode_from_off", "(", "hass", ",", "air_conditioner", ")", ":", "air_conditioner", ".", "status", ".", "update_attribute_value", "(", "Attribute", ".", "air_conditioner_mode", ",", "\"heat\"", ")", "air_conditioner", ".", "st...
[ 482, 0 ]
[ 502, 40 ]
python
en
['en', 'en', 'en']
True
test_set_temperature_ac_with_mode_to_off
(hass, air_conditioner)
Test the temp and mode is set successfully to turn off the unit.
Test the temp and mode is set successfully to turn off the unit.
async def test_set_temperature_ac_with_mode_to_off(hass, air_conditioner): """Test the temp and mode is set successfully to turn off the unit.""" await setup_platform(hass, CLIMATE_DOMAIN, devices=[air_conditioner]) assert hass.states.get("climate.air_conditioner").state != HVAC_MODE_OFF await hass.serv...
[ "async", "def", "test_set_temperature_ac_with_mode_to_off", "(", "hass", ",", "air_conditioner", ")", ":", "await", "setup_platform", "(", "hass", ",", "CLIMATE_DOMAIN", ",", "devices", "=", "[", "air_conditioner", "]", ")", "assert", "hass", ".", "states", ".", ...
[ 505, 0 ]
[ 521, 39 ]
python
en
['en', 'en', 'en']
True
test_set_temperature_with_mode
(hass, thermostat)
Test the temperature and mode is set successfully.
Test the temperature and mode is set successfully.
async def test_set_temperature_with_mode(hass, thermostat): """Test the temperature and mode is set successfully.""" await setup_platform(hass, CLIMATE_DOMAIN, devices=[thermostat]) await hass.services.async_call( CLIMATE_DOMAIN, SERVICE_SET_TEMPERATURE, { ATTR_ENTITY_ID:...
[ "async", "def", "test_set_temperature_with_mode", "(", "hass", ",", "thermostat", ")", ":", "await", "setup_platform", "(", "hass", ",", "CLIMATE_DOMAIN", ",", "devices", "=", "[", "thermostat", "]", ")", "await", "hass", ".", "services", ".", "async_call", "(...
[ 524, 0 ]
[ 541, 45 ]
python
en
['en', 'en', 'en']
True
test_set_turn_off
(hass, air_conditioner)
Test the a/c is turned off successfully.
Test the a/c is turned off successfully.
async def test_set_turn_off(hass, air_conditioner): """Test the a/c is turned off successfully.""" await setup_platform(hass, CLIMATE_DOMAIN, devices=[air_conditioner]) state = hass.states.get("climate.air_conditioner") assert state.state == HVAC_MODE_HEAT_COOL await hass.services.async_call( ...
[ "async", "def", "test_set_turn_off", "(", "hass", ",", "air_conditioner", ")", ":", "await", "setup_platform", "(", "hass", ",", "CLIMATE_DOMAIN", ",", "devices", "=", "[", "air_conditioner", "]", ")", "state", "=", "hass", ".", "states", ".", "get", "(", ...
[ 544, 0 ]
[ 553, 39 ]
python
en
['en', 'en', 'en']
True
test_set_turn_on
(hass, air_conditioner)
Test the a/c is turned on successfully.
Test the a/c is turned on successfully.
async def test_set_turn_on(hass, air_conditioner): """Test the a/c is turned on successfully.""" air_conditioner.status.update_attribute_value(Attribute.switch, "off") await setup_platform(hass, CLIMATE_DOMAIN, devices=[air_conditioner]) state = hass.states.get("climate.air_conditioner") assert stat...
[ "async", "def", "test_set_turn_on", "(", "hass", ",", "air_conditioner", ")", ":", "air_conditioner", ".", "status", ".", "update_attribute_value", "(", "Attribute", ".", "switch", ",", "\"off\"", ")", "await", "setup_platform", "(", "hass", ",", "CLIMATE_DOMAIN",...
[ 556, 0 ]
[ 566, 45 ]
python
en
['en', 'en', 'en']
True
test_entity_and_device_attributes
(hass, thermostat)
Test the attributes of the entries are correct.
Test the attributes of the entries are correct.
async def test_entity_and_device_attributes(hass, thermostat): """Test the attributes of the entries are correct.""" await setup_platform(hass, CLIMATE_DOMAIN, devices=[thermostat]) entity_registry = er.async_get(hass) device_registry = dr.async_get(hass) entry = entity_registry.async_get("climate....
[ "async", "def", "test_entity_and_device_attributes", "(", "hass", ",", "thermostat", ")", ":", "await", "setup_platform", "(", "hass", ",", "CLIMATE_DOMAIN", ",", "devices", "=", "[", "thermostat", "]", ")", "entity_registry", "=", "er", ".", "async_get", "(", ...
[ 569, 0 ]
[ 583, 46 ]
python
en
['en', 'en', 'en']
True
TestOuterComposite.testOuterComposite
(self)
Test OuterComposite
Test OuterComposite
def testOuterComposite(self): """Test OuterComposite""" # FIXME: construct object with mandatory attributes with example values # model = petstore_api.models.outer_composite.OuterComposite() # noqa: E501 pass
[ "def", "testOuterComposite", "(", "self", ")", ":", "# FIXME: construct object with mandatory attributes with example values", "# model = petstore_api.models.outer_composite.OuterComposite() # noqa: E501", "pass" ]
[ 30, 4 ]
[ 34, 12 ]
python
en
['en', 'en', 'en']
False
create_mock_motioneye_client
()
Create mock motionEye client.
Create mock motionEye client.
def create_mock_motioneye_client() -> AsyncMock: """Create mock motionEye client.""" mock_client = AsyncMock() mock_client.async_client_login = AsyncMock(return_value={}) mock_client.async_get_cameras = AsyncMock(return_value=TEST_CAMERAS) mock_client.async_client_close = AsyncMock(return_value=True...
[ "def", "create_mock_motioneye_client", "(", ")", "->", "AsyncMock", ":", "mock_client", "=", "AsyncMock", "(", ")", "mock_client", ".", "async_client_login", "=", "AsyncMock", "(", "return_value", "=", "{", "}", ")", "mock_client", ".", "async_get_cameras", "=", ...
[ 141, 0 ]
[ 149, 22 ]
python
en
['en', 'fy', 'en']
True
create_mock_motioneye_config_entry
( hass: HomeAssistant, data: dict[str, Any] | None = None, options: dict[str, Any] | None = None, )
Add a test config entry.
Add a test config entry.
def create_mock_motioneye_config_entry( hass: HomeAssistant, data: dict[str, Any] | None = None, options: dict[str, Any] | None = None, ) -> ConfigEntry: """Add a test config entry.""" config_entry: MockConfigEntry = MockConfigEntry( entry_id=TEST_CONFIG_ENTRY_ID, domain=DOMAIN, ...
[ "def", "create_mock_motioneye_config_entry", "(", "hass", ":", "HomeAssistant", ",", "data", ":", "dict", "[", "str", ",", "Any", "]", "|", "None", "=", "None", ",", "options", ":", "dict", "[", "str", ",", "Any", "]", "|", "None", "=", "None", ",", ...
[ 152, 0 ]
[ 166, 23 ]
python
en
['en', 'cy', 'en']
True
setup_mock_motioneye_config_entry
( hass: HomeAssistant, config_entry: ConfigEntry | None = None, client: Mock | None = None, )
Create and setup a mock motionEye config entry.
Create and setup a mock motionEye config entry.
async def setup_mock_motioneye_config_entry( hass: HomeAssistant, config_entry: ConfigEntry | None = None, client: Mock | None = None, ) -> ConfigEntry: """Create and setup a mock motionEye config entry.""" await async_process_ha_core_config( hass, {"external_url": "https://example....
[ "async", "def", "setup_mock_motioneye_config_entry", "(", "hass", ":", "HomeAssistant", ",", "config_entry", ":", "ConfigEntry", "|", "None", "=", "None", ",", "client", ":", "Mock", "|", "None", "=", "None", ",", ")", "->", "ConfigEntry", ":", "await", "asy...
[ 169, 0 ]
[ 190, 23 ]
python
en
['en', 'en', 'en']
True
AlternativesOutput.parse_content
(self, content)
Parse the output of the ``alternatives`` command.
Parse the output of the ``alternatives`` command.
def parse_content(self, content): """ Parse the output of the ``alternatives`` command. """ self.program = None self.status = None self.link = None self.best = None self.paths = [] current_path = None # Set up instance variable for...
[ "def", "parse_content", "(", "self", ",", "content", ")", ":", "self", ".", "program", "=", "None", "self", ".", "status", "=", "None", "self", ".", "link", "=", "None", "self", ".", "best", "=", "None", "self", ".", "paths", "=", "[", "]", "curren...
[ 77, 4 ]
[ 125, 41 ]
python
en
['en', 'error', 'th']
False
handle_whois
(irc, source, command, args)
Handle WHOIS queries.
Handle WHOIS queries.
def handle_whois(irc, source, command, args): """Handle WHOIS queries.""" target = args['target'] user = irc.users.get(target) f = lambda num, source, text: irc.numeric(irc.sid, num, source, text) # Get the server that the target is on. server = irc.get_server(target) if user is None: # ...
[ "def", "handle_whois", "(", "irc", ",", "source", ",", "command", ",", "args", ")", ":", "target", "=", "args", "[", "'target'", "]", "user", "=", "irc", ".", "users", ".", "get", "(", "target", ")", "f", "=", "lambda", "num", ",", "source", ",", ...
[ 11, 0 ]
[ 124, 51 ]
python
en
['es', 'fr', 'en']
False
handle_mode
(irc, source, command, args)
Protect against forced deoper attempts.
Protect against forced deoper attempts.
def handle_mode(irc, source, command, args): """Protect against forced deoper attempts.""" target = args['target'] modes = args['modes'] # If the sender is not a PyLink client, and the target IS a protected # client, revert any forced deoper attempts. if irc.is_internal_client(target) and not ir...
[ "def", "handle_mode", "(", "irc", ",", "source", ",", "command", ",", "args", ")", ":", "target", "=", "args", "[", "'target'", "]", "modes", "=", "args", "[", "'modes'", "]", "# If the sender is not a PyLink client, and the target IS a protected", "# client, revert...
[ 127, 0 ]
[ 135, 53 ]
python
en
['en', 'en', 'en']
True
handle_operup
(irc, source, command, args)
Logs successful oper-ups on networks.
Logs successful oper-ups on networks.
def handle_operup(irc, source, command, args): """Logs successful oper-ups on networks.""" otype = args.get('text', 'IRC Operator') log.debug("(%s) Successful oper-up (opertype %r) from %s", irc.name, otype, irc.get_hostmask(source)) irc.users[source].opertype = otype
[ "def", "handle_operup", "(", "irc", ",", "source", ",", "command", ",", "args", ")", ":", "otype", "=", "args", ".", "get", "(", "'text'", ",", "'IRC Operator'", ")", "log", ".", "debug", "(", "\"(%s) Successful oper-up (opertype %r) from %s\"", ",", "irc", ...
[ 138, 0 ]
[ 142, 38 ]
python
en
['en', 'en', 'en']
True
handle_services_login
(irc, source, command, args)
Sets services login status for users.
Sets services login status for users.
def handle_services_login(irc, source, command, args): """Sets services login status for users.""" try: irc.users[source].services_account = args['text'] except KeyError: # User doesn't exist log.debug("(%s) Ignoring early account name setting for %s (UID hasn't been sent yet)", irc.name, ...
[ "def", "handle_services_login", "(", "irc", ",", "source", ",", "command", ",", "args", ")", ":", "try", ":", "irc", ".", "users", "[", "source", "]", ".", "services_account", "=", "args", "[", "'text'", "]", "except", "KeyError", ":", "# User doesn't exis...
[ 146, 0 ]
[ 152, 113 ]
python
en
['en', 'en', 'en']
True
handle_version
(irc, source, command, args)
Handles requests for the PyLink server version.
Handles requests for the PyLink server version.
def handle_version(irc, source, command, args): """Handles requests for the PyLink server version.""" # 351 syntax is usually "<server version>. <server hostname> :<anything else you want to add> fullversion = irc.version() irc.numeric(irc.sid, 351, source, fullversion)
[ "def", "handle_version", "(", "irc", ",", "source", ",", "command", ",", "args", ")", ":", "# 351 syntax is usually \"<server version>. <server hostname> :<anything else you want to add>", "fullversion", "=", "irc", ".", "version", "(", ")", "irc", ".", "numeric", "(", ...
[ 156, 0 ]
[ 160, 50 ]
python
en
['en', 'en', 'en']
True
handle_time
(irc, source, command, args)
Handles requests for the PyLink server time.
Handles requests for the PyLink server time.
def handle_time(irc, source, command, args): """Handles requests for the PyLink server time.""" timestring = time.ctime() irc.numeric(irc.sid, 391, source, '%s :%s' % (irc.hostname(), timestring))
[ "def", "handle_time", "(", "irc", ",", "source", ",", "command", ",", "args", ")", ":", "timestring", "=", "time", ".", "ctime", "(", ")", "irc", ".", "numeric", "(", "irc", ".", "sid", ",", "391", ",", "source", ",", "'%s :%s'", "%", "(", "irc", ...
[ 163, 0 ]
[ 166, 78 ]
python
en
['en', 'en', 'en']
True
_state_cleanup_core
(irc, source, channel)
Handles PART and KICK on clientbot-like networks (where only the users and channels we see are available) by deleting channels when we leave and users when they leave all shared channels.
Handles PART and KICK on clientbot-like networks (where only the users and channels we see are available) by deleting channels when we leave and users when they leave all shared channels.
def _state_cleanup_core(irc, source, channel): """ Handles PART and KICK on clientbot-like networks (where only the users and channels we see are available) by deleting channels when we leave and users when they leave all shared channels. """ if irc.has_cap('visible-state-only'): # Delete ch...
[ "def", "_state_cleanup_core", "(", "irc", ",", "source", ",", "channel", ")", ":", "if", "irc", ".", "has_cap", "(", "'visible-state-only'", ")", ":", "# Delete channels that we were removed from.", "if", "irc", ".", "pseudoclient", "and", "source", "==", "irc", ...
[ 169, 0 ]
[ 190, 34 ]
python
en
['en', 'error', 'th']
False
_state_cleanup_mode
(irc, source, command, args)
Cleans up and removes empty channels when -P (permanent mode) is removed from them.
Cleans up and removes empty channels when -P (permanent mode) is removed from them.
def _state_cleanup_mode(irc, source, command, args): """ Cleans up and removes empty channels when -P (permanent mode) is removed from them. """ target = args['target'] if target in irc.channels and 'permanent' in irc.cmodes: c = irc.channels[target] mode = '-%s' % irc.cmodes['perman...
[ "def", "_state_cleanup_mode", "(", "irc", ",", "source", ",", "command", ",", "args", ")", ":", "target", "=", "args", "[", "'target'", "]", "if", "target", "in", "irc", ".", "channels", "and", "'permanent'", "in", "irc", ".", "cmodes", ":", "c", "=", ...
[ 201, 0 ]
[ 213, 60 ]
python
en
['en', 'error', 'th']
False
mock_collector
()
Fixture with import collector that adds all referenced nodes.
Fixture with import collector that adds all referenced nodes.
def mock_collector(): """Fixture with import collector that adds all referenced nodes.""" collector = ImportCollector(None) collector.unfiltered_referenced = set() collector._add_reference = collector.unfiltered_referenced.add return collector
[ "def", "mock_collector", "(", ")", ":", "collector", "=", "ImportCollector", "(", "None", ")", "collector", ".", "unfiltered_referenced", "=", "set", "(", ")", "collector", ".", "_add_reference", "=", "collector", ".", "unfiltered_referenced", ".", "add", "retur...
[ 9, 0 ]
[ 14, 20 ]
python
en
['en', 'en', 'en']
True
test_child_import
(mock_collector)
Test detecting a child_import reference.
Test detecting a child_import reference.
def test_child_import(mock_collector): """Test detecting a child_import reference.""" mock_collector.visit( ast.parse( """ from homeassistant.components import child_import """ ) ) assert mock_collector.unfiltered_referenced == {"child_import"}
[ "def", "test_child_import", "(", "mock_collector", ")", ":", "mock_collector", ".", "visit", "(", "ast", ".", "parse", "(", "\"\"\"\nfrom homeassistant.components import child_import\n\"\"\"", ")", ")", "assert", "mock_collector", ".", "unfiltered_referenced", "==", "{", ...
[ 17, 0 ]
[ 26, 67 ]
python
en
['en', 'en', 'en']
True
test_subimport
(mock_collector)
Test detecting a subimport reference.
Test detecting a subimport reference.
def test_subimport(mock_collector): """Test detecting a subimport reference.""" mock_collector.visit( ast.parse( """ from homeassistant.components.subimport.smart_home import EVENT_ALEXA_SMART_HOME """ ) ) assert mock_collector.unfiltered_referenced == {"subimport"}
[ "def", "test_subimport", "(", "mock_collector", ")", ":", "mock_collector", ".", "visit", "(", "ast", ".", "parse", "(", "\"\"\"\nfrom homeassistant.components.subimport.smart_home import EVENT_ALEXA_SMART_HOME\n\"\"\"", ")", ")", "assert", "mock_collector", ".", "unfiltered_...
[ 29, 0 ]
[ 38, 64 ]
python
en
['da', 'en', 'en']
True
test_child_import_field
(mock_collector)
Test detecting a child_import_field reference.
Test detecting a child_import_field reference.
def test_child_import_field(mock_collector): """Test detecting a child_import_field reference.""" mock_collector.visit( ast.parse( """ from homeassistant.components.child_import_field import bla """ ) ) assert mock_collector.unfiltered_referenced == {"child_import_field"}
[ "def", "test_child_import_field", "(", "mock_collector", ")", ":", "mock_collector", ".", "visit", "(", "ast", ".", "parse", "(", "\"\"\"\nfrom homeassistant.components.child_import_field import bla\n\"\"\"", ")", ")", "assert", "mock_collector", ".", "unfiltered_referenced",...
[ 41, 0 ]
[ 50, 73 ]
python
en
['en', 'en', 'en']
True
test_renamed_absolute
(mock_collector)
Test detecting a renamed_absolute reference.
Test detecting a renamed_absolute reference.
def test_renamed_absolute(mock_collector): """Test detecting a renamed_absolute reference.""" mock_collector.visit( ast.parse( """ import homeassistant.components.renamed_absolute as hue """ ) ) assert mock_collector.unfiltered_referenced == {"renamed_absolute"}
[ "def", "test_renamed_absolute", "(", "mock_collector", ")", ":", "mock_collector", ".", "visit", "(", "ast", ".", "parse", "(", "\"\"\"\nimport homeassistant.components.renamed_absolute as hue\n\"\"\"", ")", ")", "assert", "mock_collector", ".", "unfiltered_referenced", "==...
[ 53, 0 ]
[ 62, 71 ]
python
en
['en', 'en', 'en']
True
test_hass_components_var
(mock_collector)
Test detecting a hass_components_var reference.
Test detecting a hass_components_var reference.
def test_hass_components_var(mock_collector): """Test detecting a hass_components_var reference.""" mock_collector.visit( ast.parse( """ def bla(hass): hass.components.hass_components_var.async_do_something() """ ) ) assert mock_collector.unfiltered_referenced == {"hass_c...
[ "def", "test_hass_components_var", "(", "mock_collector", ")", ":", "mock_collector", ".", "visit", "(", "ast", ".", "parse", "(", "\"\"\"\ndef bla(hass):\n hass.components.hass_components_var.async_do_something()\n\"\"\"", ")", ")", "assert", "mock_collector", ".", "unfil...
[ 65, 0 ]
[ 75, 74 ]
python
en
['en', 'en', 'en']
True
test_hass_components_class
(mock_collector)
Test detecting a hass_components_class reference.
Test detecting a hass_components_class reference.
def test_hass_components_class(mock_collector): """Test detecting a hass_components_class reference.""" mock_collector.visit( ast.parse( """ class Hello: def something(self): self.hass.components.hass_components_class.async_yo() """ ) ) assert mock_collector.unfil...
[ "def", "test_hass_components_class", "(", "mock_collector", ")", ":", "mock_collector", ".", "visit", "(", "ast", ".", "parse", "(", "\"\"\"\nclass Hello:\n def something(self):\n self.hass.components.hass_components_class.async_yo()\n\"\"\"", ")", ")", "assert", "mock_...
[ 78, 0 ]
[ 89, 76 ]
python
en
['en', 'en', 'en']
True
test_all_imports
(mock_collector)
Test all imports together.
Test all imports together.
def test_all_imports(mock_collector): """Test all imports together.""" mock_collector.visit( ast.parse( """ from homeassistant.components import child_import from homeassistant.components.subimport.smart_home import EVENT_ALEXA_SMART_HOME from homeassistant.components.child_import_field im...
[ "def", "test_all_imports", "(", "mock_collector", ")", ":", "mock_collector", ".", "visit", "(", "ast", ".", "parse", "(", "\"\"\"\nfrom homeassistant.components import child_import\n\nfrom homeassistant.components.subimport.smart_home import EVENT_ALEXA_SMART_HOME\n\nfrom homeassistant....
[ 92, 0 ]
[ 121, 5 ]
python
en
['en', 'en', 'en']
True
setup_platform
(hass, config, add_entities, discovery_info=None)
Set up the Ebus sensor.
Set up the Ebus sensor.
def setup_platform(hass, config, add_entities, discovery_info=None): """Set up the Ebus sensor.""" ebusd_api = hass.data[DOMAIN] monitored_conditions = discovery_info["monitored_conditions"] name = discovery_info["client_name"] dev = [] for condition in monitored_conditions: dev.append(...
[ "def", "setup_platform", "(", "hass", ",", "config", ",", "add_entities", ",", "discovery_info", "=", "None", ")", ":", "ebusd_api", "=", "hass", ".", "data", "[", "DOMAIN", "]", "monitored_conditions", "=", "discovery_info", "[", "\"monitored_conditions\"", "]"...
[ 21, 0 ]
[ 33, 27 ]
python
en
['en', 'pt', 'en']
True
EbusdSensor.__init__
(self, data, sensor, name)
Initialize the sensor.
Initialize the sensor.
def __init__(self, data, sensor, name): """Initialize the sensor.""" self._state = None self._client_name = name ( self._name, self._unit_of_measurement, self._icon, self._type, self._device_class, ) = sensor sel...
[ "def", "__init__", "(", "self", ",", "data", ",", "sensor", ",", "name", ")", ":", "self", ".", "_state", "=", "None", "self", ".", "_client_name", "=", "name", "(", "self", ".", "_name", ",", "self", ".", "_unit_of_measurement", ",", "self", ".", "_...
[ 39, 4 ]
[ 50, 24 ]
python
en
['en', 'en', 'en']
True
EbusdSensor.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}\"" ]
[ 53, 4 ]
[ 55, 50 ]
python
en
['en', 'mi', 'en']
True
EbusdSensor.native_value
(self)
Return the state of the sensor.
Return the state of the sensor.
def native_value(self): """Return the state of the sensor.""" return self._state
[ "def", "native_value", "(", "self", ")", ":", "return", "self", ".", "_state" ]
[ 58, 4 ]
[ 60, 26 ]
python
en
['en', 'en', 'en']
True
EbusdSensor.extra_state_attributes
(self)
Return the device state attributes.
Return the device state attributes.
def extra_state_attributes(self): """Return the device state attributes.""" if self._type == 1 and self._state is not None: schedule = { TIME_FRAME1_BEGIN: None, TIME_FRAME1_END: None, TIME_FRAME2_BEGIN: None, TIME_FRAME2_END: N...
[ "def", "extra_state_attributes", "(", "self", ")", ":", "if", "self", ".", "_type", "==", "1", "and", "self", ".", "_state", "is", "not", "None", ":", "schedule", "=", "{", "TIME_FRAME1_BEGIN", ":", "None", ",", "TIME_FRAME1_END", ":", "None", ",", "TIME...
[ 63, 4 ]
[ 83, 19 ]
python
en
['en', 'en', 'en']
True
EbusdSensor.device_class
(self)
Return the class of this device, from component DEVICE_CLASSES.
Return the class of this device, from component DEVICE_CLASSES.
def device_class(self): """Return the class of this device, from component DEVICE_CLASSES.""" return self._device_class
[ "def", "device_class", "(", "self", ")", ":", "return", "self", ".", "_device_class" ]
[ 86, 4 ]
[ 88, 33 ]
python
en
['en', 'en', 'en']
True
EbusdSensor.icon
(self)
Icon to use in the frontend, if any.
Icon to use in the frontend, if any.
def icon(self): """Icon to use in the frontend, if any.""" return self._icon
[ "def", "icon", "(", "self", ")", ":", "return", "self", ".", "_icon" ]
[ 91, 4 ]
[ 93, 25 ]
python
en
['en', 'en', 'en']
True
EbusdSensor.native_unit_of_measurement
(self)
Return the unit of measurement.
Return the unit of measurement.
def native_unit_of_measurement(self): """Return the unit of measurement.""" return self._unit_of_measurement
[ "def", "native_unit_of_measurement", "(", "self", ")", ":", "return", "self", ".", "_unit_of_measurement" ]
[ 96, 4 ]
[ 98, 40 ]
python
en
['en', 'la', 'en']
True
EbusdSensor.update
(self)
Fetch new state data for the sensor.
Fetch new state data for the sensor.
def update(self): """Fetch new state data for the sensor.""" try: self.data.update(self._name, self._type) if self._name not in self.data.value: return self._state = self.data.value[self._name] except RuntimeError: _LOGGER.debug("E...
[ "def", "update", "(", "self", ")", ":", "try", ":", "self", ".", "data", ".", "update", "(", "self", ".", "_name", ",", "self", ".", "_type", ")", "if", "self", ".", "_name", "not", "in", "self", ".", "data", ".", "value", ":", "return", "self", ...
[ 101, 4 ]
[ 110, 55 ]
python
en
['en', 'en', 'en']
True
async_setup_platform
(hass, config)
Set up the Telegram broadcast platform.
Set up the Telegram broadcast platform.
async def async_setup_platform(hass, config): """Set up the Telegram broadcast platform.""" bot = initialize_bot(config) bot_config = await hass.async_add_executor_job(bot.getMe) _LOGGER.debug( "Telegram broadcast platform setup with bot %s", bot_config["username"] ) return True
[ "async", "def", "async_setup_platform", "(", "hass", ",", "config", ")", ":", "bot", "=", "initialize_bot", "(", "config", ")", "bot_config", "=", "await", "hass", ".", "async_add_executor_job", "(", "bot", ".", "getMe", ")", "_LOGGER", ".", "debug", "(", ...
[ 8, 0 ]
[ 16, 15 ]
python
en
['en', 'da', 'en']
True
_make_cron_re
()
Make the regular expression that matches a crontab 'cron' line. Each field has a set of allowed values, and can then be in a range, and be listed with dashes. A range can be stepped with the '/' modifier, and ranges can be in a list. A field can also be '*', or '*' divided in steps. The best wa...
Make the regular expression that matches a crontab 'cron' line.
def _make_cron_re(): """ Make the regular expression that matches a crontab 'cron' line. Each field has a set of allowed values, and can then be in a range, and be listed with dashes. A range can be stepped with the '/' modifier, and ranges can be in a list. A field can also be '*', or '*' divide...
[ "def", "_make_cron_re", "(", ")", ":", "range_", "=", "r\"{val}(?:-{val}(?:/\\d+)?)?\"", "template", "=", "r\"(?P<{name}>\"", "+", "\"(?:\\*(?:/\\d+)?|{r}(?:,{r})*)\"", ".", "format", "(", "r", "=", "range_", ")", "+", "\")\\s+\"", "return", "(", "r'^\\s*'", "+", ...
[ 7, 0 ]
[ 31, 5 ]
python
en
['en', 'error', 'th']
False
CrontabL.__getitem__
(self, idx)
Get the n'th item from the crontab table. Arguments: idx(int): The index of the crontab line, starting from 0. Returns: (dict): the number of items
Get the n'th item from the crontab table.
def __getitem__(self, idx): """ Get the n'th item from the crontab table. Arguments: idx(int): The index of the crontab line, starting from 0. Returns: (dict): the number of items """ return self.data[idx]
[ "def", "__getitem__", "(", "self", ",", "idx", ")", ":", "return", "self", ".", "data", "[", "idx", "]" ]
[ 157, 4 ]
[ 167, 29 ]
python
en
['en', 'error', 'th']
False
CrontabL.__iter__
(self)
Iterates through the list of crontab entries. Yields: (dict): The next parsed crontab entry.
Iterates through the list of crontab entries.
def __iter__(self): """ Iterates through the list of crontab entries. Yields: (dict): The next parsed crontab entry. """ for row in self.data: yield row
[ "def", "__iter__", "(", "self", ")", ":", "for", "row", "in", "self", ".", "data", ":", "yield", "row" ]
[ 169, 4 ]
[ 177, 21 ]
python
en
['en', 'error', 'th']
False
CrontabL.search
(self, filter_str)
list: Returns list of dicts for lines that have `filter_str` in the command.
list: Returns list of dicts for lines that have `filter_str` in the command.
def search(self, filter_str): """list: Returns list of dicts for lines that have `filter_str` in the command.""" return [r for r in self.data if filter_str in r['command']]
[ "def", "search", "(", "self", ",", "filter_str", ")", ":", "return", "[", "r", "for", "r", "in", "self", ".", "data", "if", "filter_str", "in", "r", "[", "'command'", "]", "]" ]
[ 179, 4 ]
[ 182, 67 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
(hass, config_entry, async_add_entities)
Set up Homekit covers.
Set up Homekit covers.
async def async_setup_entry(hass, config_entry, async_add_entities): """Set up Homekit covers.""" hkid = config_entry.data["AccessoryPairingID"] conn = hass.data[KNOWN_DEVICES][hkid] @callback def async_add_service(service): entity_class = ENTITY_TYPES.get(service.short_type) if not...
[ "async", "def", "async_setup_entry", "(", "hass", ",", "config_entry", ",", "async_add_entities", ")", ":", "hkid", "=", "config_entry", ".", "data", "[", "\"AccessoryPairingID\"", "]", "conn", "=", "hass", ".", "data", "[", "KNOWN_DEVICES", "]", "[", "hkid", ...
[ 36, 0 ]
[ 50, 40 ]
python
en
['en', 'mi', 'en']
True
HomeKitGarageDoorCover.device_class
(self)
Define this cover as a garage door.
Define this cover as a garage door.
def device_class(self): """Define this cover as a garage door.""" return "garage"
[ "def", "device_class", "(", "self", ")", ":", "return", "\"garage\"" ]
[ 57, 4 ]
[ 59, 23 ]
python
en
['en', 'en', 'en']
True
HomeKitGarageDoorCover.get_characteristic_types
(self)
Define the homekit characteristics the entity cares about.
Define the homekit characteristics the entity cares about.
def get_characteristic_types(self): """Define the homekit characteristics the entity cares about.""" return [ CharacteristicsTypes.DOOR_STATE_CURRENT, CharacteristicsTypes.DOOR_STATE_TARGET, CharacteristicsTypes.OBSTRUCTION_DETECTED, ]
[ "def", "get_characteristic_types", "(", "self", ")", ":", "return", "[", "CharacteristicsTypes", ".", "DOOR_STATE_CURRENT", ",", "CharacteristicsTypes", ".", "DOOR_STATE_TARGET", ",", "CharacteristicsTypes", ".", "OBSTRUCTION_DETECTED", ",", "]" ]
[ 61, 4 ]
[ 67, 9 ]
python
en
['en', 'en', 'en']
True
HomeKitGarageDoorCover.supported_features
(self)
Flag supported features.
Flag supported features.
def supported_features(self): """Flag supported features.""" return SUPPORT_OPEN | SUPPORT_CLOSE
[ "def", "supported_features", "(", "self", ")", ":", "return", "SUPPORT_OPEN", "|", "SUPPORT_CLOSE" ]
[ 70, 4 ]
[ 72, 43 ]
python
en
['da', 'en', 'en']
True
HomeKitGarageDoorCover.state
(self)
Return the current state of the garage door.
Return the current state of the garage door.
def state(self): """Return the current state of the garage door.""" value = self.service.value(CharacteristicsTypes.DOOR_STATE_CURRENT) return CURRENT_GARAGE_STATE_MAP[value]
[ "def", "state", "(", "self", ")", ":", "value", "=", "self", ".", "service", ".", "value", "(", "CharacteristicsTypes", ".", "DOOR_STATE_CURRENT", ")", "return", "CURRENT_GARAGE_STATE_MAP", "[", "value", "]" ]
[ 75, 4 ]
[ 78, 46 ]
python
en
['en', 'en', 'en']
True
HomeKitGarageDoorCover.is_closed
(self)
Return true if cover is closed, else False.
Return true if cover is closed, else False.
def is_closed(self): """Return true if cover is closed, else False.""" return self.state == STATE_CLOSED
[ "def", "is_closed", "(", "self", ")", ":", "return", "self", ".", "state", "==", "STATE_CLOSED" ]
[ 81, 4 ]
[ 83, 41 ]
python
en
['en', 'en', 'en']
True
HomeKitGarageDoorCover.is_closing
(self)
Return if the cover is closing or not.
Return if the cover is closing or not.
def is_closing(self): """Return if the cover is closing or not.""" return self.state == STATE_CLOSING
[ "def", "is_closing", "(", "self", ")", ":", "return", "self", ".", "state", "==", "STATE_CLOSING" ]
[ 86, 4 ]
[ 88, 42 ]
python
en
['en', 'en', 'en']
True
HomeKitGarageDoorCover.is_opening
(self)
Return if the cover is opening or not.
Return if the cover is opening or not.
def is_opening(self): """Return if the cover is opening or not.""" return self.state == STATE_OPENING
[ "def", "is_opening", "(", "self", ")", ":", "return", "self", ".", "state", "==", "STATE_OPENING" ]
[ 91, 4 ]
[ 93, 42 ]
python
en
['en', 'en', 'en']
True
HomeKitGarageDoorCover.async_open_cover
(self, **kwargs)
Send open command.
Send open command.
async def async_open_cover(self, **kwargs): """Send open command.""" await self.set_door_state(STATE_OPEN)
[ "async", "def", "async_open_cover", "(", "self", ",", "*", "*", "kwargs", ")", ":", "await", "self", ".", "set_door_state", "(", "STATE_OPEN", ")" ]
[ 95, 4 ]
[ 97, 45 ]
python
en
['en', 'it', 'en']
True
HomeKitGarageDoorCover.async_close_cover
(self, **kwargs)
Send close command.
Send close command.
async def async_close_cover(self, **kwargs): """Send close command.""" await self.set_door_state(STATE_CLOSED)
[ "async", "def", "async_close_cover", "(", "self", ",", "*", "*", "kwargs", ")", ":", "await", "self", ".", "set_door_state", "(", "STATE_CLOSED", ")" ]
[ 99, 4 ]
[ 101, 47 ]
python
en
['en', 'pt', 'en']
True
HomeKitGarageDoorCover.set_door_state
(self, state)
Send state command.
Send state command.
async def set_door_state(self, state): """Send state command.""" await self.async_put_characteristics( {CharacteristicsTypes.DOOR_STATE_TARGET: TARGET_GARAGE_STATE_MAP[state]} )
[ "async", "def", "set_door_state", "(", "self", ",", "state", ")", ":", "await", "self", ".", "async_put_characteristics", "(", "{", "CharacteristicsTypes", ".", "DOOR_STATE_TARGET", ":", "TARGET_GARAGE_STATE_MAP", "[", "state", "]", "}", ")" ]
[ 103, 4 ]
[ 107, 9 ]
python
en
['en', 'en', 'en']
True
HomeKitGarageDoorCover.extra_state_attributes
(self)
Return the optional state attributes.
Return the optional state attributes.
def extra_state_attributes(self): """Return the optional state attributes.""" obstruction_detected = self.service.value( CharacteristicsTypes.OBSTRUCTION_DETECTED ) return {"obstruction-detected": obstruction_detected is True}
[ "def", "extra_state_attributes", "(", "self", ")", ":", "obstruction_detected", "=", "self", ".", "service", ".", "value", "(", "CharacteristicsTypes", ".", "OBSTRUCTION_DETECTED", ")", "return", "{", "\"obstruction-detected\"", ":", "obstruction_detected", "is", "Tru...
[ 110, 4 ]
[ 115, 69 ]
python
en
['en', 'en', 'en']
True
HomeKitWindowCover.get_characteristic_types
(self)
Define the homekit characteristics the entity cares about.
Define the homekit characteristics the entity cares about.
def get_characteristic_types(self): """Define the homekit characteristics the entity cares about.""" return [ CharacteristicsTypes.POSITION_STATE, CharacteristicsTypes.POSITION_CURRENT, CharacteristicsTypes.POSITION_TARGET, CharacteristicsTypes.POSITION_HO...
[ "def", "get_characteristic_types", "(", "self", ")", ":", "return", "[", "CharacteristicsTypes", ".", "POSITION_STATE", ",", "CharacteristicsTypes", ".", "POSITION_CURRENT", ",", "CharacteristicsTypes", ".", "POSITION_TARGET", ",", "CharacteristicsTypes", ".", "POSITION_H...
[ 121, 4 ]
[ 133, 9 ]
python
en
['en', 'en', 'en']
True
HomeKitWindowCover.supported_features
(self)
Flag supported features.
Flag supported features.
def supported_features(self): """Flag supported features.""" features = SUPPORT_OPEN | SUPPORT_CLOSE | SUPPORT_SET_POSITION if self.service.has(CharacteristicsTypes.POSITION_HOLD): features |= SUPPORT_STOP supports_tilt = any( ( self.service.has(...
[ "def", "supported_features", "(", "self", ")", ":", "features", "=", "SUPPORT_OPEN", "|", "SUPPORT_CLOSE", "|", "SUPPORT_SET_POSITION", "if", "self", ".", "service", ".", "has", "(", "CharacteristicsTypes", ".", "POSITION_HOLD", ")", ":", "features", "|=", "SUPP...
[ 136, 4 ]
[ 155, 23 ]
python
en
['da', 'en', 'en']
True
HomeKitWindowCover.current_cover_position
(self)
Return the current position of cover.
Return the current position of cover.
def current_cover_position(self): """Return the current position of cover.""" return self.service.value(CharacteristicsTypes.POSITION_CURRENT)
[ "def", "current_cover_position", "(", "self", ")", ":", "return", "self", ".", "service", ".", "value", "(", "CharacteristicsTypes", ".", "POSITION_CURRENT", ")" ]
[ 158, 4 ]
[ 160, 72 ]
python
en
['en', 'en', 'en']
True
HomeKitWindowCover.is_closed
(self)
Return true if cover is closed, else False.
Return true if cover is closed, else False.
def is_closed(self): """Return true if cover is closed, else False.""" return self.current_cover_position == 0
[ "def", "is_closed", "(", "self", ")", ":", "return", "self", ".", "current_cover_position", "==", "0" ]
[ 163, 4 ]
[ 165, 47 ]
python
en
['en', 'en', 'en']
True
HomeKitWindowCover.is_closing
(self)
Return if the cover is closing or not.
Return if the cover is closing or not.
def is_closing(self): """Return if the cover is closing or not.""" value = self.service.value(CharacteristicsTypes.POSITION_STATE) state = CURRENT_WINDOW_STATE_MAP[value] return state == STATE_CLOSING
[ "def", "is_closing", "(", "self", ")", ":", "value", "=", "self", ".", "service", ".", "value", "(", "CharacteristicsTypes", ".", "POSITION_STATE", ")", "state", "=", "CURRENT_WINDOW_STATE_MAP", "[", "value", "]", "return", "state", "==", "STATE_CLOSING" ]
[ 168, 4 ]
[ 172, 37 ]
python
en
['en', 'en', 'en']
True
HomeKitWindowCover.is_opening
(self)
Return if the cover is opening or not.
Return if the cover is opening or not.
def is_opening(self): """Return if the cover is opening or not.""" value = self.service.value(CharacteristicsTypes.POSITION_STATE) state = CURRENT_WINDOW_STATE_MAP[value] return state == STATE_OPENING
[ "def", "is_opening", "(", "self", ")", ":", "value", "=", "self", ".", "service", ".", "value", "(", "CharacteristicsTypes", ".", "POSITION_STATE", ")", "state", "=", "CURRENT_WINDOW_STATE_MAP", "[", "value", "]", "return", "state", "==", "STATE_OPENING" ]
[ 175, 4 ]
[ 179, 37 ]
python
en
['en', 'en', 'en']
True
HomeKitWindowCover.is_horizontal_tilt
(self)
Return True if the service has a horizontal tilt characteristic.
Return True if the service has a horizontal tilt characteristic.
def is_horizontal_tilt(self): """Return True if the service has a horizontal tilt characteristic.""" return ( self.service.value(CharacteristicsTypes.HORIZONTAL_TILT_CURRENT) is not None )
[ "def", "is_horizontal_tilt", "(", "self", ")", ":", "return", "(", "self", ".", "service", ".", "value", "(", "CharacteristicsTypes", ".", "HORIZONTAL_TILT_CURRENT", ")", "is", "not", "None", ")" ]
[ 182, 4 ]
[ 186, 9 ]
python
en
['en', 'en', 'en']
True
HomeKitWindowCover.is_vertical_tilt
(self)
Return True if the service has a vertical tilt characteristic.
Return True if the service has a vertical tilt characteristic.
def is_vertical_tilt(self): """Return True if the service has a vertical tilt characteristic.""" return ( self.service.value(CharacteristicsTypes.VERTICAL_TILT_CURRENT) is not None )
[ "def", "is_vertical_tilt", "(", "self", ")", ":", "return", "(", "self", ".", "service", ".", "value", "(", "CharacteristicsTypes", ".", "VERTICAL_TILT_CURRENT", ")", "is", "not", "None", ")" ]
[ 189, 4 ]
[ 193, 9 ]
python
en
['en', 'en', 'en']
True
HomeKitWindowCover.current_cover_tilt_position
(self)
Return current position of cover tilt.
Return current position of cover tilt.
def current_cover_tilt_position(self): """Return current position of cover tilt.""" tilt_position = self.service.value(CharacteristicsTypes.VERTICAL_TILT_CURRENT) if not tilt_position: tilt_position = self.service.value( CharacteristicsTypes.HORIZONTAL_TILT_CURRENT ...
[ "def", "current_cover_tilt_position", "(", "self", ")", ":", "tilt_position", "=", "self", ".", "service", ".", "value", "(", "CharacteristicsTypes", ".", "VERTICAL_TILT_CURRENT", ")", "if", "not", "tilt_position", ":", "tilt_position", "=", "self", ".", "service"...
[ 196, 4 ]
[ 203, 28 ]
python
en
['en', 'da', 'en']
True
HomeKitWindowCover.async_stop_cover
(self, **kwargs)
Send hold command.
Send hold command.
async def async_stop_cover(self, **kwargs): """Send hold command.""" await self.async_put_characteristics({CharacteristicsTypes.POSITION_HOLD: 1})
[ "async", "def", "async_stop_cover", "(", "self", ",", "*", "*", "kwargs", ")", ":", "await", "self", ".", "async_put_characteristics", "(", "{", "CharacteristicsTypes", ".", "POSITION_HOLD", ":", "1", "}", ")" ]
[ 205, 4 ]
[ 207, 85 ]
python
en
['en', 'en', 'en']
True
HomeKitWindowCover.async_open_cover
(self, **kwargs)
Send open command.
Send open command.
async def async_open_cover(self, **kwargs): """Send open command.""" await self.async_set_cover_position(position=100)
[ "async", "def", "async_open_cover", "(", "self", ",", "*", "*", "kwargs", ")", ":", "await", "self", ".", "async_set_cover_position", "(", "position", "=", "100", ")" ]
[ 209, 4 ]
[ 211, 57 ]
python
en
['en', 'it', 'en']
True
HomeKitWindowCover.async_close_cover
(self, **kwargs)
Send close command.
Send close command.
async def async_close_cover(self, **kwargs): """Send close command.""" await self.async_set_cover_position(position=0)
[ "async", "def", "async_close_cover", "(", "self", ",", "*", "*", "kwargs", ")", ":", "await", "self", ".", "async_set_cover_position", "(", "position", "=", "0", ")" ]
[ 213, 4 ]
[ 215, 55 ]
python
en
['en', 'pt', 'en']
True
HomeKitWindowCover.async_set_cover_position
(self, **kwargs)
Send position command.
Send position command.
async def async_set_cover_position(self, **kwargs): """Send position command.""" position = kwargs[ATTR_POSITION] await self.async_put_characteristics( {CharacteristicsTypes.POSITION_TARGET: position} )
[ "async", "def", "async_set_cover_position", "(", "self", ",", "*", "*", "kwargs", ")", ":", "position", "=", "kwargs", "[", "ATTR_POSITION", "]", "await", "self", ".", "async_put_characteristics", "(", "{", "CharacteristicsTypes", ".", "POSITION_TARGET", ":", "p...
[ 217, 4 ]
[ 222, 9 ]
python
en
['en', 'fr', 'en']
True
HomeKitWindowCover.async_set_cover_tilt_position
(self, **kwargs)
Move the cover tilt to a specific position.
Move the cover tilt to a specific position.
async def async_set_cover_tilt_position(self, **kwargs): """Move the cover tilt to a specific position.""" tilt_position = kwargs[ATTR_TILT_POSITION] if self.is_vertical_tilt: await self.async_put_characteristics( {CharacteristicsTypes.VERTICAL_TILT_TARGET: tilt_posit...
[ "async", "def", "async_set_cover_tilt_position", "(", "self", ",", "*", "*", "kwargs", ")", ":", "tilt_position", "=", "kwargs", "[", "ATTR_TILT_POSITION", "]", "if", "self", ".", "is_vertical_tilt", ":", "await", "self", ".", "async_put_characteristics", "(", "...
[ 224, 4 ]
[ 234, 13 ]
python
en
['en', 'en', 'en']
True
HomeKitWindowCover.extra_state_attributes
(self)
Return the optional state attributes.
Return the optional state attributes.
def extra_state_attributes(self): """Return the optional state attributes.""" obstruction_detected = self.service.value( CharacteristicsTypes.OBSTRUCTION_DETECTED ) if not obstruction_detected: return {} return {"obstruction-detected": obstruction_detected...
[ "def", "extra_state_attributes", "(", "self", ")", ":", "obstruction_detected", "=", "self", ".", "service", ".", "value", "(", "CharacteristicsTypes", ".", "OBSTRUCTION_DETECTED", ")", "if", "not", "obstruction_detected", ":", "return", "{", "}", "return", "{", ...
[ 237, 4 ]
[ 244, 61 ]
python
en
['en', 'en', 'en']
True
_async_reproduce_state
( hass: HomeAssistant, state: State, *, context: Context | None = None, reproduce_options: dict[str, Any] | None = None, )
Reproduce a single state.
Reproduce a single state.
async def _async_reproduce_state( hass: HomeAssistant, state: State, *, context: Context | None = None, reproduce_options: dict[str, Any] | None = None, ) -> None: """Reproduce a single state.""" cur_state = hass.states.get(state.entity_id) if cur_state is None: _LOGGER.warning(...
[ "async", "def", "_async_reproduce_state", "(", "hass", ":", "HomeAssistant", ",", "state", ":", "State", ",", "*", ",", "context", ":", "Context", "|", "None", "=", "None", ",", "reproduce_options", ":", "dict", "[", "str", ",", "Any", "]", "|", "None", ...
[ 24, 0 ]
[ 57, 5 ]
python
en
['en', 'en', 'en']
True
async_reproduce_states
( hass: HomeAssistant, states: Iterable[State], *, context: Context | None = None, reproduce_options: dict[str, Any] | None = None, )
Reproduce Automation states.
Reproduce Automation states.
async def async_reproduce_states( hass: HomeAssistant, states: Iterable[State], *, context: Context | None = None, reproduce_options: dict[str, Any] | None = None, ) -> None: """Reproduce Automation states.""" await asyncio.gather( *( _async_reproduce_state( ...
[ "async", "def", "async_reproduce_states", "(", "hass", ":", "HomeAssistant", ",", "states", ":", "Iterable", "[", "State", "]", ",", "*", ",", "context", ":", "Context", "|", "None", "=", "None", ",", "reproduce_options", ":", "dict", "[", "str", ",", "A...
[ 60, 0 ]
[ 75, 5 ]
python
en
['en', 'en', 'en']
True
TestParentPet.testParentPet
(self)
Test ParentPet
Test ParentPet
def testParentPet(self): """Test ParentPet""" # FIXME: construct object with mandatory attributes with example values # model = ParentPet() # noqa: E501 pass
[ "def", "testParentPet", "(", "self", ")", ":", "# FIXME: construct object with mandatory attributes with example values", "# model = ParentPet() # noqa: E501", "pass" ]
[ 32, 4 ]
[ 36, 12 ]
python
en
['en', 'de', 'en']
False
async_setup_platform
( hass: HomeAssistant, config: ConfigType, async_add_entities, discovery_info=None )
Set up the Genius Hub sensor entities.
Set up the Genius Hub sensor entities.
async def async_setup_platform( hass: HomeAssistant, config: ConfigType, async_add_entities, discovery_info=None ) -> None: """Set up the Genius Hub sensor entities.""" if discovery_info is None: return broker = hass.data[DOMAIN]["broker"] switches = [ GeniusBinarySensor(broker, d,...
[ "async", "def", "async_setup_platform", "(", "hass", ":", "HomeAssistant", ",", "config", ":", "ConfigType", ",", "async_add_entities", ",", "discovery_info", "=", "None", ")", "->", "None", ":", "if", "discovery_info", "is", "None", ":", "return", "broker", "...
[ 10, 0 ]
[ 25, 56 ]
python
en
['en', 'et', 'en']
True
GeniusBinarySensor.__init__
(self, broker, device, state_attr)
Initialize the binary sensor.
Initialize the binary sensor.
def __init__(self, broker, device, state_attr) -> None: """Initialize the binary sensor.""" super().__init__(broker, device) self._state_attr = state_attr if device.type[:21] == "Dual Channel Receiver": self._name = f"{device.type[:21]} {device.id}" else: ...
[ "def", "__init__", "(", "self", ",", "broker", ",", "device", ",", "state_attr", ")", "->", "None", ":", "super", "(", ")", ".", "__init__", "(", "broker", ",", "device", ")", "self", ".", "_state_attr", "=", "state_attr", "if", "device", ".", "type", ...
[ 31, 4 ]
[ 40, 53 ]
python
en
['en', 'haw', 'en']
True
GeniusBinarySensor.is_on
(self)
Return the status of the sensor.
Return the status of the sensor.
def is_on(self) -> bool: """Return the status of the sensor.""" return self._device.data["state"][self._state_attr]
[ "def", "is_on", "(", "self", ")", "->", "bool", ":", "return", "self", ".", "_device", ".", "data", "[", "\"state\"", "]", "[", "self", ".", "_state_attr", "]" ]
[ 43, 4 ]
[ 45, 59 ]
python
en
['en', 'id', 'en']
True
async_activate_log_queue_handler
(hass: HomeAssistant)
Migrate the existing log handlers to use the queue. This allows us to avoid blocking I/O and formatting messages in the event loop as log messages are written in another thread.
Migrate the existing log handlers to use the queue.
def async_activate_log_queue_handler(hass: HomeAssistant) -> None: """ Migrate the existing log handlers to use the queue. This allows us to avoid blocking I/O and formatting messages in the event loop as log messages are written in another thread. """ simple_queue = queue.SimpleQueue() # type...
[ "def", "async_activate_log_queue_handler", "(", "hass", ":", "HomeAssistant", ")", "->", "None", ":", "simple_queue", "=", "queue", ".", "SimpleQueue", "(", ")", "# type: ignore", "queue_handler", "=", "HomeAssistantQueueHandler", "(", "simple_queue", ")", "logging", ...
[ 55, 0 ]
[ 86, 84 ]
python
en
['en', 'error', 'th']
False
log_exception
(format_err: Callable[..., Any], *args: Any)
Log an exception with additional context.
Log an exception with additional context.
def log_exception(format_err: Callable[..., Any], *args: Any) -> None: """Log an exception with additional context.""" module = inspect.getmodule(inspect.stack(context=0)[1].frame) if module is not None: module_name = module.__name__ else: # If Python is unable to access the sources file...
[ "def", "log_exception", "(", "format_err", ":", "Callable", "[", "...", ",", "Any", "]", ",", "*", "args", ":", "Any", ")", "->", "None", ":", "module", "=", "inspect", ".", "getmodule", "(", "inspect", ".", "stack", "(", "context", "=", "0", ")", ...
[ 89, 0 ]
[ 104, 73 ]
python
en
['en', 'en', 'en']
True
catch_log_exception
( # type: ignore func: Callable[..., Awaitable[Any]], format_err: Callable[..., Any], *args: Any )
Overload for Callables that return an Awaitable.
Overload for Callables that return an Awaitable.
def catch_log_exception( # type: ignore func: Callable[..., Awaitable[Any]], format_err: Callable[..., Any], *args: Any ) -> Callable[..., Awaitable[None]]: """Overload for Callables that return an Awaitable."""
[ "def", "catch_log_exception", "(", "# type: ignore", "func", ":", "Callable", "[", "...", ",", "Awaitable", "[", "Any", "]", "]", ",", "format_err", ":", "Callable", "[", "...", ",", "Any", "]", ",", "*", "args", ":", "Any", ")", "->", "Callable", "[",...
[ 108, 0 ]
[ 111, 58 ]
python
en
['en', 'en', 'en']
True
catch_log_exception
( func: Callable[..., Any], format_err: Callable[..., Any], *args: Any )
Overload for Callables that return Any.
Overload for Callables that return Any.
def catch_log_exception( func: Callable[..., Any], format_err: Callable[..., Any], *args: Any ) -> Callable[..., None]: """Overload for Callables that return Any."""
[ "def", "catch_log_exception", "(", "func", ":", "Callable", "[", "...", ",", "Any", "]", ",", "format_err", ":", "Callable", "[", "...", ",", "Any", "]", ",", "*", "args", ":", "Any", ")", "->", "Callable", "[", "...", ",", "None", "]", ":" ]
[ 115, 0 ]
[ 118, 49 ]
python
en
['en', 'en', 'en']
True
catch_log_exception
( func: Callable[..., Any], format_err: Callable[..., Any], *args: Any )
Decorate a callback to catch and log exceptions.
Decorate a callback to catch and log exceptions.
def catch_log_exception( func: Callable[..., Any], format_err: Callable[..., Any], *args: Any ) -> Callable[..., None] | Callable[..., Awaitable[None]]: """Decorate a callback to catch and log exceptions.""" # Check for partials to properly determine if coroutine function check_func = func while is...
[ "def", "catch_log_exception", "(", "func", ":", "Callable", "[", "...", ",", "Any", "]", ",", "format_err", ":", "Callable", "[", "...", ",", "Any", "]", ",", "*", "args", ":", "Any", ")", "->", "Callable", "[", "...", ",", "None", "]", "|", "Calla...
[ 121, 0 ]
[ 159, 23 ]
python
en
['en', 'en', 'en']
True
catch_log_coro_exception
( target: Coroutine[Any, Any, Any], format_err: Callable[..., Any], *args: Any )
Decorate a coroutine to catch and log exceptions.
Decorate a coroutine to catch and log exceptions.
def catch_log_coro_exception( target: Coroutine[Any, Any, Any], format_err: Callable[..., Any], *args: Any ) -> Coroutine[Any, Any, Any]: """Decorate a coroutine to catch and log exceptions.""" async def coro_wrapper(*args: Any) -> Any: """Catch and log exception.""" try: return...
[ "def", "catch_log_coro_exception", "(", "target", ":", "Coroutine", "[", "Any", ",", "Any", ",", "Any", "]", ",", "format_err", ":", "Callable", "[", "...", ",", "Any", "]", ",", "*", "args", ":", "Any", ")", "->", "Coroutine", "[", "Any", ",", "Any"...
[ 162, 0 ]
[ 175, 25 ]
python
en
['en', 'en', 'en']
True
async_create_catching_coro
(target: Coroutine)
Wrap a coroutine to catch and log exceptions. The exception will be logged together with a stacktrace of where the coroutine was wrapped. target: target coroutine.
Wrap a coroutine to catch and log exceptions.
def async_create_catching_coro(target: Coroutine) -> Coroutine: """Wrap a coroutine to catch and log exceptions. The exception will be logged together with a stacktrace of where the coroutine was wrapped. target: target coroutine. """ trace = traceback.extract_stack() wrapped_target = catc...
[ "def", "async_create_catching_coro", "(", "target", ":", "Coroutine", ")", "->", "Coroutine", ":", "trace", "=", "traceback", ".", "extract_stack", "(", ")", "wrapped_target", "=", "catch_log_coro_exception", "(", "target", ",", "lambda", "*", "args", ":", "\"Ex...
[ 178, 0 ]
[ 195, 25 ]
python
en
['en', 'en', 'en']
True
HideSensitiveDataFilter.__init__
(self, text: str)
Initialize sensitive data filter.
Initialize sensitive data filter.
def __init__(self, text: str) -> None: """Initialize sensitive data filter.""" super().__init__() self.text = text
[ "def", "__init__", "(", "self", ",", "text", ":", "str", ")", "->", "None", ":", "super", "(", ")", ".", "__init__", "(", ")", "self", ".", "text", "=", "text" ]
[ 20, 4 ]
[ 23, 24 ]
python
co
['it', 'co', 'en']
False
HideSensitiveDataFilter.filter
(self, record: logging.LogRecord)
Hide sensitive data in messages.
Hide sensitive data in messages.
def filter(self, record: logging.LogRecord) -> bool: """Hide sensitive data in messages.""" record.msg = record.msg.replace(self.text, "*******") return True
[ "def", "filter", "(", "self", ",", "record", ":", "logging", ".", "LogRecord", ")", "->", "bool", ":", "record", ".", "msg", "=", "record", ".", "msg", ".", "replace", "(", "self", ".", "text", ",", "\"*******\"", ")", "return", "True" ]
[ 25, 4 ]
[ 29, 19 ]
python
en
['it', 'en', 'en']
True
HomeAssistantQueueHandler.handle
(self, record: logging.LogRecord)
Conditionally emit the specified logging record. Depending on which filters have been added to the handler, push the new records onto the backing Queue. The default python logger Handler acquires a lock in the parent class which we do not need as SimpleQueue is already...
Conditionally emit the specified logging record.
def handle(self, record: logging.LogRecord) -> Any: """ Conditionally emit the specified logging record. Depending on which filters have been added to the handler, push the new records onto the backing Queue. The default python logger Handler acquires a lock in the pare...
[ "def", "handle", "(", "self", ",", "record", ":", "logging", ".", "LogRecord", ")", "->", "Any", ":", "return_value", "=", "self", ".", "filter", "(", "record", ")", "if", "return_value", ":", "self", ".", "emit", "(", "record", ")", "return", "return_...
[ 35, 4 ]
[ 51, 27 ]
python
en
['en', 'error', 'th']
False