Search is not available for this dataset
identifier
stringlengths
1
155
parameters
stringlengths
2
6.09k
docstring
stringlengths
11
63.4k
docstring_summary
stringlengths
0
63.4k
function
stringlengths
29
99.8k
function_tokens
list
start_point
list
end_point
list
language
stringclasses
1 value
docstring_language
stringlengths
2
7
docstring_language_predictions
stringlengths
18
23
is_langid_reliable
stringclasses
2 values
test_invalid_name_does_not_create
(hass, caplog)
Test invalid name.
Test invalid name.
async def test_invalid_name_does_not_create(hass, caplog): """Test invalid name.""" await setup.async_setup_component( hass, "alarm_control_panel", { "alarm_control_panel": { "platform": "template", "panels": { "bad name her...
[ "async", "def", "test_invalid_name_does_not_create", "(", "hass", ",", "caplog", ")", ":", "await", "setup", ".", "async_setup_component", "(", "hass", ",", "\"alarm_control_panel\"", ",", "{", "\"alarm_control_panel\"", ":", "{", "\"platform\"", ":", "\"template\"", ...
[ 282, 0 ]
[ 324, 51 ]
python
en
['en', 'et', 'en']
True
test_invalid_panel_does_not_create
(hass, caplog)
Test invalid alarm control panel.
Test invalid alarm control panel.
async def test_invalid_panel_does_not_create(hass, caplog): """Test invalid alarm control panel.""" await setup.async_setup_component( hass, "alarm_control_panel", { "alarm_control_panel": { "platform": "template", "wibble": {"test_panel": "Inv...
[ "async", "def", "test_invalid_panel_does_not_create", "(", "hass", ",", "caplog", ")", ":", "await", "setup", ".", "async_setup_component", "(", "hass", ",", "\"alarm_control_panel\"", ",", "{", "\"alarm_control_panel\"", ":", "{", "\"platform\"", ":", "\"template\"",...
[ 327, 0 ]
[ 345, 59 ]
python
en
['id', 'et', 'en']
False
test_no_panels_does_not_create
(hass, caplog)
Test if there are no panels -> no creation.
Test if there are no panels -> no creation.
async def test_no_panels_does_not_create(hass, caplog): """Test if there are no panels -> no creation.""" await setup.async_setup_component( hass, "alarm_control_panel", {"alarm_control_panel": {"platform": "template"}}, ) await hass.async_block_till_done() await hass.async_...
[ "async", "def", "test_no_panels_does_not_create", "(", "hass", ",", "caplog", ")", ":", "await", "setup", ".", "async_setup_component", "(", "hass", ",", "\"alarm_control_panel\"", ",", "{", "\"alarm_control_panel\"", ":", "{", "\"platform\"", ":", "\"template\"", "...
[ 348, 0 ]
[ 361, 72 ]
python
en
['en', 'en', 'en']
True
test_name
(hass)
Test the accessibility of the name attribute.
Test the accessibility of the name attribute.
async def test_name(hass): """Test the accessibility of the name attribute.""" await setup.async_setup_component( hass, "alarm_control_panel", { "alarm_control_panel": { "platform": "template", "panels": { "test_template_pan...
[ "async", "def", "test_name", "(", "hass", ")", ":", "await", "setup", ".", "async_setup_component", "(", "hass", ",", "\"alarm_control_panel\"", ",", "{", "\"alarm_control_panel\"", ":", "{", "\"platform\"", ":", "\"template\"", ",", "\"panels\"", ":", "{", "\"t...
[ 364, 0 ]
[ 409, 74 ]
python
en
['en', 'en', 'en']
True
test_arm_home_action
(hass)
Test arm home action.
Test arm home action.
async def test_arm_home_action(hass): """Test arm home action.""" await setup.async_setup_component( hass, "alarm_control_panel", { "alarm_control_panel": { "platform": "template", "panels": { "test_template_panel": { ...
[ "async", "def", "test_arm_home_action", "(", "hass", ")", ":", "await", "setup", ".", "async_setup_component", "(", "hass", ",", "\"alarm_control_panel\"", ",", "{", "\"alarm_control_panel\"", ":", "{", "\"platform\"", ":", "\"template\"", ",", "\"panels\"", ":", ...
[ 412, 0 ]
[ 456, 34 ]
python
en
['en', 'en', 'en']
True
test_arm_away_action
(hass)
Test arm away action.
Test arm away action.
async def test_arm_away_action(hass): """Test arm away action.""" await setup.async_setup_component( hass, "alarm_control_panel", { "alarm_control_panel": { "platform": "template", "panels": { "test_template_panel": { ...
[ "async", "def", "test_arm_away_action", "(", "hass", ")", ":", "await", "setup", ".", "async_setup_component", "(", "hass", ",", "\"alarm_control_panel\"", ",", "{", "\"alarm_control_panel\"", ":", "{", "\"platform\"", ":", "\"template\"", ",", "\"panels\"", ":", ...
[ 459, 0 ]
[ 503, 34 ]
python
en
['en', 'en', 'en']
True
test_arm_night_action
(hass)
Test arm night action.
Test arm night action.
async def test_arm_night_action(hass): """Test arm night action.""" await setup.async_setup_component( hass, "alarm_control_panel", { "alarm_control_panel": { "platform": "template", "panels": { "test_template_panel": { ...
[ "async", "def", "test_arm_night_action", "(", "hass", ")", ":", "await", "setup", ".", "async_setup_component", "(", "hass", ",", "\"alarm_control_panel\"", ",", "{", "\"alarm_control_panel\"", ":", "{", "\"platform\"", ":", "\"template\"", ",", "\"panels\"", ":", ...
[ 506, 0 ]
[ 550, 34 ]
python
en
['en', 'en', 'en']
True
test_disarm_action
(hass)
Test disarm action.
Test disarm action.
async def test_disarm_action(hass): """Test disarm action.""" await setup.async_setup_component( hass, "alarm_control_panel", { "alarm_control_panel": { "platform": "template", "panels": { "test_template_panel": { ...
[ "async", "def", "test_disarm_action", "(", "hass", ")", ":", "await", "setup", ".", "async_setup_component", "(", "hass", ",", "\"alarm_control_panel\"", ",", "{", "\"alarm_control_panel\"", ":", "{", "\"platform\"", ":", "\"template\"", ",", "\"panels\"", ":", "{...
[ 553, 0 ]
[ 597, 34 ]
python
en
['fr', 'en', 'en']
True
test_unique_id
(hass)
Test unique_id option only creates one alarm control panel per id.
Test unique_id option only creates one alarm control panel per id.
async def test_unique_id(hass): """Test unique_id option only creates one alarm control panel per id.""" await setup.async_setup_component( hass, "alarm_control_panel", { "alarm_control_panel": { "platform": "template", "panels": { ...
[ "async", "def", "test_unique_id", "(", "hass", ")", ":", "await", "setup", ".", "async_setup_component", "(", "hass", ",", "\"alarm_control_panel\"", ",", "{", "\"alarm_control_panel\"", ":", "{", "\"platform\"", ":", "\"template\"", ",", "\"panels\"", ":", "{", ...
[ 600, 0 ]
[ 626, 44 ]
python
en
['en', 'en', 'en']
True
async_setup_platform
(hass, config, async_add_entities, discovery_info)
Set up Netgear LTE sensor devices.
Set up Netgear LTE sensor devices.
async def async_setup_platform(hass, config, async_add_entities, discovery_info): """Set up Netgear LTE sensor devices.""" if discovery_info is None: return modem_data = hass.data[DATA_KEY].get_modem_data(discovery_info) if not modem_data or not modem_data.data: raise PlatformNotReady ...
[ "async", "def", "async_setup_platform", "(", "hass", ",", "config", ",", "async_add_entities", ",", "discovery_info", ")", ":", "if", "discovery_info", "is", "None", ":", "return", "modem_data", "=", "hass", ".", "data", "[", "DATA_KEY", "]", ".", "get_modem_d...
[ 8, 0 ]
[ 32, 31 ]
python
en
['oc', 'fr', 'en']
False
LTESensor.unit_of_measurement
(self)
Return the unit of measurement.
Return the unit of measurement.
def unit_of_measurement(self): """Return the unit of measurement.""" return SENSOR_UNITS[self.sensor_type]
[ "def", "unit_of_measurement", "(", "self", ")", ":", "return", "SENSOR_UNITS", "[", "self", ".", "sensor_type", "]" ]
[ 39, 4 ]
[ 41, 45 ]
python
en
['en', 'la', 'en']
True
SMSUnreadSensor.state
(self)
Return the state of the sensor.
Return the state of the sensor.
def state(self): """Return the state of the sensor.""" return sum(1 for x in self.modem_data.data.sms if x.unread)
[ "def", "state", "(", "self", ")", ":", "return", "sum", "(", "1", "for", "x", "in", "self", ".", "modem_data", ".", "data", ".", "sms", "if", "x", ".", "unread", ")" ]
[ 48, 4 ]
[ 50, 67 ]
python
en
['en', 'en', 'en']
True
SMSTotalSensor.state
(self)
Return the state of the sensor.
Return the state of the sensor.
def state(self): """Return the state of the sensor.""" return len(self.modem_data.data.sms)
[ "def", "state", "(", "self", ")", ":", "return", "len", "(", "self", ".", "modem_data", ".", "data", ".", "sms", ")" ]
[ 57, 4 ]
[ 59, 44 ]
python
en
['en', 'en', 'en']
True
UsageSensor.state
(self)
Return the state of the sensor.
Return the state of the sensor.
def state(self): """Return the state of the sensor.""" return round(self.modem_data.data.usage / 1024 ** 2, 1)
[ "def", "state", "(", "self", ")", ":", "return", "round", "(", "self", ".", "modem_data", ".", "data", ".", "usage", "/", "1024", "**", "2", ",", "1", ")" ]
[ 66, 4 ]
[ 68, 63 ]
python
en
['en', 'en', 'en']
True
GenericSensor.state
(self)
Return the state of the sensor.
Return the state of the sensor.
def state(self): """Return the state of the sensor.""" return getattr(self.modem_data.data, self.sensor_type)
[ "def", "state", "(", "self", ")", ":", "return", "getattr", "(", "self", ".", "modem_data", ".", "data", ",", "self", ".", "sensor_type", ")" ]
[ 75, 4 ]
[ 77, 62 ]
python
en
['en', 'en', 'en']
True
_async_reproduce_state
( hass: HomeAssistantType, state: State, *, context: Optional[Context] = None, reproduce_options: Optional[Dict[str, Any]] = None, )
Reproduce a single state.
Reproduce a single state.
async def _async_reproduce_state( hass: HomeAssistantType, state: State, *, context: Optional[Context] = None, reproduce_options: Optional[Dict[str, Any]] = None, ) -> None: """Reproduce a single state.""" cur_state = hass.states.get(state.entity_id) # Return if we can't find the entity...
[ "async", "def", "_async_reproduce_state", "(", "hass", ":", "HomeAssistantType", ",", "state", ":", "State", ",", "*", ",", "context", ":", "Optional", "[", "Context", "]", "=", "None", ",", "reproduce_options", ":", "Optional", "[", "Dict", "[", "str", ",...
[ 14, 0 ]
[ 39, 5 ]
python
en
['en', 'en', 'en']
True
async_reproduce_states
( hass: HomeAssistantType, states: Iterable[State], *, context: Optional[Context] = None, reproduce_options: Optional[Dict[str, Any]] = None, )
Reproduce Input text states.
Reproduce Input text states.
async def async_reproduce_states( hass: HomeAssistantType, states: Iterable[State], *, context: Optional[Context] = None, reproduce_options: Optional[Dict[str, Any]] = None, ) -> None: """Reproduce Input text states.""" # Reproduce states in parallel. await asyncio.gather( *( ...
[ "async", "def", "async_reproduce_states", "(", "hass", ":", "HomeAssistantType", ",", "states", ":", "Iterable", "[", "State", "]", ",", "*", ",", "context", ":", "Optional", "[", "Context", "]", "=", "None", ",", "reproduce_options", ":", "Optional", "[", ...
[ 42, 0 ]
[ 58, 5 ]
python
en
['en', 'en', 'en']
True
create_group
(hass, name)
Create a new person group. This is a legacy helper method. Do not use it for new tests.
Create a new person group.
def create_group(hass, name): """Create a new person group. This is a legacy helper method. Do not use it for new tests. """ data = {ATTR_NAME: name} hass.services.call(DOMAIN, SERVICE_CREATE_GROUP, data)
[ "def", "create_group", "(", "hass", ",", "name", ")", ":", "data", "=", "{", "ATTR_NAME", ":", "name", "}", "hass", ".", "services", ".", "call", "(", "DOMAIN", ",", "SERVICE_CREATE_GROUP", ",", "data", ")" ]
[ 23, 0 ]
[ 29, 58 ]
python
en
['en', 'en', 'en']
True
delete_group
(hass, name)
Delete a person group. This is a legacy helper method. Do not use it for new tests.
Delete a person group.
def delete_group(hass, name): """Delete a person group. This is a legacy helper method. Do not use it for new tests. """ data = {ATTR_NAME: name} hass.services.call(DOMAIN, SERVICE_DELETE_GROUP, data)
[ "def", "delete_group", "(", "hass", ",", "name", ")", ":", "data", "=", "{", "ATTR_NAME", ":", "name", "}", "hass", ".", "services", ".", "call", "(", "DOMAIN", ",", "SERVICE_DELETE_GROUP", ",", "data", ")" ]
[ 32, 0 ]
[ 38, 58 ]
python
en
['en', 'it', 'en']
True
train_group
(hass, group)
Train a person group. This is a legacy helper method. Do not use it for new tests.
Train a person group.
def train_group(hass, group): """Train a person group. This is a legacy helper method. Do not use it for new tests. """ data = {ATTR_GROUP: group} hass.services.call(DOMAIN, SERVICE_TRAIN_GROUP, data)
[ "def", "train_group", "(", "hass", ",", "group", ")", ":", "data", "=", "{", "ATTR_GROUP", ":", "group", "}", "hass", ".", "services", ".", "call", "(", "DOMAIN", ",", "SERVICE_TRAIN_GROUP", ",", "data", ")" ]
[ 41, 0 ]
[ 47, 57 ]
python
en
['en', 'en', 'en']
True
create_person
(hass, group, name)
Create a person in a group. This is a legacy helper method. Do not use it for new tests.
Create a person in a group.
def create_person(hass, group, name): """Create a person in a group. This is a legacy helper method. Do not use it for new tests. """ data = {ATTR_GROUP: group, ATTR_NAME: name} hass.services.call(DOMAIN, SERVICE_CREATE_PERSON, data)
[ "def", "create_person", "(", "hass", ",", "group", ",", "name", ")", ":", "data", "=", "{", "ATTR_GROUP", ":", "group", ",", "ATTR_NAME", ":", "name", "}", "hass", ".", "services", ".", "call", "(", "DOMAIN", ",", "SERVICE_CREATE_PERSON", ",", "data", ...
[ 50, 0 ]
[ 56, 59 ]
python
en
['en', 'en', 'en']
True
delete_person
(hass, group, name)
Delete a person in a group. This is a legacy helper method. Do not use it for new tests.
Delete a person in a group.
def delete_person(hass, group, name): """Delete a person in a group. This is a legacy helper method. Do not use it for new tests. """ data = {ATTR_GROUP: group, ATTR_NAME: name} hass.services.call(DOMAIN, SERVICE_DELETE_PERSON, data)
[ "def", "delete_person", "(", "hass", ",", "group", ",", "name", ")", ":", "data", "=", "{", "ATTR_GROUP", ":", "group", ",", "ATTR_NAME", ":", "name", "}", "hass", ".", "services", ".", "call", "(", "DOMAIN", ",", "SERVICE_DELETE_PERSON", ",", "data", ...
[ 59, 0 ]
[ 65, 59 ]
python
en
['en', 'en', 'en']
True
face_person
(hass, group, person, camera_entity)
Add a new face picture to a person. This is a legacy helper method. Do not use it for new tests.
Add a new face picture to a person.
def face_person(hass, group, person, camera_entity): """Add a new face picture to a person. This is a legacy helper method. Do not use it for new tests. """ data = {ATTR_GROUP: group, ATTR_PERSON: person, ATTR_CAMERA_ENTITY: camera_entity} hass.services.call(DOMAIN, SERVICE_FACE_PERSON, data)
[ "def", "face_person", "(", "hass", ",", "group", ",", "person", ",", "camera_entity", ")", ":", "data", "=", "{", "ATTR_GROUP", ":", "group", ",", "ATTR_PERSON", ":", "person", ",", "ATTR_CAMERA_ENTITY", ":", "camera_entity", "}", "hass", ".", "services", ...
[ 68, 0 ]
[ 74, 57 ]
python
en
['en', 'en', 'en']
True
TestMicrosoftFaceSetup.setup_method
(self)
Set up things to be run when tests are started.
Set up things to be run when tests are started.
def setup_method(self): """Set up things to be run when tests are started.""" self.hass = get_test_home_assistant() self.config = {mf.DOMAIN: {"api_key": "12345678abcdef"}} self.endpoint_url = f"https://westus.{mf.FACE_API_URL}"
[ "def", "setup_method", "(", "self", ")", ":", "self", ".", "hass", "=", "get_test_home_assistant", "(", ")", "self", ".", "config", "=", "{", "mf", ".", "DOMAIN", ":", "{", "\"api_key\"", ":", "\"12345678abcdef\"", "}", "}", "self", ".", "endpoint_url", ...
[ 80, 4 ]
[ 86, 63 ]
python
en
['en', 'en', 'en']
True
TestMicrosoftFaceSetup.teardown_method
(self)
Stop everything that was started.
Stop everything that was started.
def teardown_method(self): """Stop everything that was started.""" self.hass.stop()
[ "def", "teardown_method", "(", "self", ")", ":", "self", ".", "hass", ".", "stop", "(", ")" ]
[ 88, 4 ]
[ 90, 24 ]
python
en
['en', 'en', 'en']
True
TestMicrosoftFaceSetup.test_setup_component
(self, mock_update)
Set up component.
Set up component.
def test_setup_component(self, mock_update): """Set up component.""" with assert_setup_component(3, mf.DOMAIN): setup_component(self.hass, mf.DOMAIN, self.config)
[ "def", "test_setup_component", "(", "self", ",", "mock_update", ")", ":", "with", "assert_setup_component", "(", "3", ",", "mf", ".", "DOMAIN", ")", ":", "setup_component", "(", "self", ".", "hass", ",", "mf", ".", "DOMAIN", ",", "self", ".", "config", "...
[ 96, 4 ]
[ 99, 62 ]
python
en
['en', 'fr', 'en']
True
TestMicrosoftFaceSetup.test_setup_component_wrong_api_key
(self, mock_update)
Set up component without api key.
Set up component without api key.
def test_setup_component_wrong_api_key(self, mock_update): """Set up component without api key.""" with assert_setup_component(0, mf.DOMAIN): setup_component(self.hass, mf.DOMAIN, {mf.DOMAIN: {}})
[ "def", "test_setup_component_wrong_api_key", "(", "self", ",", "mock_update", ")", ":", "with", "assert_setup_component", "(", "0", ",", "mf", ".", "DOMAIN", ")", ":", "setup_component", "(", "self", ".", "hass", ",", "mf", ".", "DOMAIN", ",", "{", "mf", "...
[ 105, 4 ]
[ 108, 66 ]
python
en
['en', 'zu', 'en']
True
TestMicrosoftFaceSetup.test_setup_component_test_service
(self, mock_update)
Set up component.
Set up component.
def test_setup_component_test_service(self, mock_update): """Set up component.""" with assert_setup_component(3, mf.DOMAIN): setup_component(self.hass, mf.DOMAIN, self.config) assert self.hass.services.has_service(mf.DOMAIN, "create_group") assert self.hass.services.has_serv...
[ "def", "test_setup_component_test_service", "(", "self", ",", "mock_update", ")", ":", "with", "assert_setup_component", "(", "3", ",", "mf", ".", "DOMAIN", ")", ":", "setup_component", "(", "self", ".", "hass", ",", "mf", ".", "DOMAIN", ",", "self", ".", ...
[ 114, 4 ]
[ 124, 71 ]
python
en
['en', 'fr', 'en']
True
TestMicrosoftFaceSetup.test_setup_component_test_entities
(self, aioclient_mock)
Set up component.
Set up component.
def test_setup_component_test_entities(self, aioclient_mock): """Set up component.""" aioclient_mock.get( self.endpoint_url.format("persongroups"), text=load_fixture("microsoft_face_persongroups.json"), ) aioclient_mock.get( self.endpoint_url.format("p...
[ "def", "test_setup_component_test_entities", "(", "self", ",", "aioclient_mock", ")", ":", "aioclient_mock", ".", "get", "(", "self", ".", "endpoint_url", ".", "format", "(", "\"persongroups\"", ")", ",", "text", "=", "load_fixture", "(", "\"microsoft_face_persongro...
[ 126, 4 ]
[ 164, 9 ]
python
en
['en', 'fr', 'en']
True
TestMicrosoftFaceSetup.test_service_groups
(self, mock_update, aioclient_mock)
Set up component, test groups services.
Set up component, test groups services.
def test_service_groups(self, mock_update, aioclient_mock): """Set up component, test groups services.""" aioclient_mock.put( self.endpoint_url.format("persongroups/service_group"), status=200, text="{}", ) aioclient_mock.delete( self.endpo...
[ "def", "test_service_groups", "(", "self", ",", "mock_update", ",", "aioclient_mock", ")", ":", "aioclient_mock", ".", "put", "(", "self", ".", "endpoint_url", ".", "format", "(", "\"persongroups/service_group\"", ")", ",", "status", "=", "200", ",", "text", "...
[ 170, 4 ]
[ 198, 50 ]
python
en
['en', 'en', 'en']
True
TestMicrosoftFaceSetup.test_service_person
(self, aioclient_mock)
Set up component, test person services.
Set up component, test person services.
def test_service_person(self, aioclient_mock): """Set up component, test person services.""" aioclient_mock.get( self.endpoint_url.format("persongroups"), text=load_fixture("microsoft_face_persongroups.json"), ) aioclient_mock.get( self.endpoint_url.fo...
[ "def", "test_service_person", "(", "self", ",", "aioclient_mock", ")", ":", "aioclient_mock", ".", "get", "(", "self", ".", "endpoint_url", ".", "format", "(", "\"persongroups\"", ")", ",", "text", "=", "load_fixture", "(", "\"microsoft_face_persongroups.json\"", ...
[ 200, 4 ]
[ 251, 53 ]
python
en
['en', 'fr', 'en']
True
TestMicrosoftFaceSetup.test_service_train
(self, mock_update, aioclient_mock)
Set up component, test train groups services.
Set up component, test train groups services.
def test_service_train(self, mock_update, aioclient_mock): """Set up component, test train groups services.""" with assert_setup_component(3, mf.DOMAIN): setup_component(self.hass, mf.DOMAIN, self.config) aioclient_mock.post( self.endpoint_url.format("persongroups/servic...
[ "def", "test_service_train", "(", "self", ",", "mock_update", ",", "aioclient_mock", ")", ":", "with", "assert_setup_component", "(", "3", ",", "mf", ".", "DOMAIN", ")", ":", "setup_component", "(", "self", ".", "hass", ",", "mf", ".", "DOMAIN", ",", "self...
[ 257, 4 ]
[ 271, 50 ]
python
en
['en', 'fr', 'en']
True
TestMicrosoftFaceSetup.test_service_face
(self, camera_mock, aioclient_mock)
Set up component, test person face services.
Set up component, test person face services.
def test_service_face(self, camera_mock, aioclient_mock): """Set up component, test person face services.""" aioclient_mock.get( self.endpoint_url.format("persongroups"), text=load_fixture("microsoft_face_persongroups.json"), ) aioclient_mock.get( self...
[ "def", "test_service_face", "(", "self", ",", "camera_mock", ",", "aioclient_mock", ")", ":", "aioclient_mock", ".", "get", "(", "self", ".", "endpoint_url", ".", "format", "(", "\"persongroups\"", ")", ",", "text", "=", "load_fixture", "(", "\"microsoft_face_pe...
[ 277, 4 ]
[ 311, 57 ]
python
en
['en', 'fr', 'en']
True
TestMicrosoftFaceSetup.test_service_status_400
(self, mock_update, aioclient_mock)
Set up component, test groups services with error.
Set up component, test groups services with error.
def test_service_status_400(self, mock_update, aioclient_mock): """Set up component, test groups services with error.""" aioclient_mock.put( self.endpoint_url.format("persongroups/service_group"), status=400, text="{'error': {'message': 'Error'}}", ) ...
[ "def", "test_service_status_400", "(", "self", ",", "mock_update", ",", "aioclient_mock", ")", ":", "aioclient_mock", ".", "put", "(", "self", ".", "endpoint_url", ".", "format", "(", "\"persongroups/service_group\"", ")", ",", "status", "=", "400", ",", "text",...
[ 317, 4 ]
[ 333, 50 ]
python
en
['en', 'en', 'en']
True
TestMicrosoftFaceSetup.test_service_status_timeout
(self, mock_update, aioclient_mock)
Set up component, test groups services with timeout.
Set up component, test groups services with timeout.
def test_service_status_timeout(self, mock_update, aioclient_mock): """Set up component, test groups services with timeout.""" aioclient_mock.put( self.endpoint_url.format("persongroups/service_group"), status=400, exc=asyncio.TimeoutError(), ) with a...
[ "def", "test_service_status_timeout", "(", "self", ",", "mock_update", ",", "aioclient_mock", ")", ":", "aioclient_mock", ".", "put", "(", "self", ".", "endpoint_url", ".", "format", "(", "\"persongroups/service_group\"", ")", ",", "status", "=", "400", ",", "ex...
[ 339, 4 ]
[ 355, 50 ]
python
en
['en', 'en', 'en']
True
nonnegative_softmax_kernel_feature_creator
( data, projection_matrix, attention_dims_t, batch_dims_t, precision, is_query, normalize_data=True, eps=0.0001 )
Constructs nonnegative kernel features for fast softmax attention Args: data: input for which features are computes projection_matrix: random matrix used to compute features attention_dims_t: tuple of attention dimensions batch_dims_t: tuple of batch dimensions precision: precisi...
Constructs nonnegative kernel features for fast softmax attention
def nonnegative_softmax_kernel_feature_creator( data, projection_matrix, attention_dims_t, batch_dims_t, precision, is_query, normalize_data=True, eps=0.0001 ): """ Constructs nonnegative kernel features for fast softmax attention Args: data: input for which features are computes projection...
[ "def", "nonnegative_softmax_kernel_feature_creator", "(", "data", ",", "projection_matrix", ",", "attention_dims_t", ",", "batch_dims_t", ",", "precision", ",", "is_query", ",", "normalize_data", "=", "True", ",", "eps", "=", "0.0001", ")", ":", "del", "attention_di...
[ 40, 0 ]
[ 91, 20 ]
python
en
['en', 'error', 'th']
False
sincos_softmax_kernel_feature_creator
( data, projection_matrix, attention_dims_t, batch_dims_t, precision, normalize_data=True )
Constructs kernel sin-cos features for fast softmax attention Args: data: input for which features are computes projection_matrix: random matrix used to compute features attention_dims_t: tuple of attention dimensions batch_dims_t: tuple of batch dimensions precision: precision p...
Constructs kernel sin-cos features for fast softmax attention
def sincos_softmax_kernel_feature_creator( data, projection_matrix, attention_dims_t, batch_dims_t, precision, normalize_data=True ): """ Constructs kernel sin-cos features for fast softmax attention Args: data: input for which features are computes projection_matrix: random matrix used to ...
[ "def", "sincos_softmax_kernel_feature_creator", "(", "data", ",", "projection_matrix", ",", "attention_dims_t", ",", "batch_dims_t", ",", "precision", ",", "normalize_data", "=", "True", ")", ":", "if", "normalize_data", ":", "# We have: exp(qk^T/sqrt{d}) = exp(|q|^2/2sqrt{...
[ 94, 0 ]
[ 141, 21 ]
python
en
['en', 'error', 'th']
False
generalized_kernel_feature_creator
( data, projection_matrix, batch_dims_t, precision, kernel_fn, kernel_epsilon, normalize_data )
Constructs kernel features for fast generalized attention Args: data: input for which features are computes projection_matrix: matrix used to compute features batch_dims_t: tuple of batch dimensions precision: precision parameter kernel_fn: kernel function used kernel_epsil...
Constructs kernel features for fast generalized attention
def generalized_kernel_feature_creator( data, projection_matrix, batch_dims_t, precision, kernel_fn, kernel_epsilon, normalize_data ): """ Constructs kernel features for fast generalized attention Args: data: input for which features are computes projection_matrix: matrix used to compute fe...
[ "def", "generalized_kernel_feature_creator", "(", "data", ",", "projection_matrix", ",", "batch_dims_t", ",", "precision", ",", "kernel_fn", ",", "kernel_epsilon", ",", "normalize_data", ")", ":", "if", "normalize_data", ":", "data_normalizer", "=", "1.0", "/", "(",...
[ 144, 0 ]
[ 179, 21 ]
python
en
['en', 'error', 'th']
False
make_fast_softmax_attention
( qkv_dim, renormalize_attention=True, numerical_stabilizer=0.000001, nb_features=256, ortho_features=True, ortho_scaling=0.0, redraw_features=True, unidirectional=False, nonnegative_features=True, lax_scan_unroll=1, )
Construct a fast softmax attention method.
Construct a fast softmax attention method.
def make_fast_softmax_attention( qkv_dim, renormalize_attention=True, numerical_stabilizer=0.000001, nb_features=256, ortho_features=True, ortho_scaling=0.0, redraw_features=True, unidirectional=False, nonnegative_features=True, lax_scan_unroll=1, ): """Construct a fast softm...
[ "def", "make_fast_softmax_attention", "(", "qkv_dim", ",", "renormalize_attention", "=", "True", ",", "numerical_stabilizer", "=", "0.000001", ",", "nb_features", "=", "256", ",", "ortho_features", "=", "True", ",", "ortho_scaling", "=", "0.0", ",", "redraw_features...
[ 182, 0 ]
[ 240, 23 ]
python
en
['en', 'en', 'en']
True
make_fast_generalized_attention
( qkv_dim, renormalize_attention=True, numerical_stabilizer=0.0, nb_features=256, features_type="deterministic", kernel_fn=jax.nn.relu, kernel_epsilon=0.001, redraw_features=False, unidirectional=False, lax_scan_unroll=1, )
Construct a fast generalized attention menthod.
Construct a fast generalized attention menthod.
def make_fast_generalized_attention( qkv_dim, renormalize_attention=True, numerical_stabilizer=0.0, nb_features=256, features_type="deterministic", kernel_fn=jax.nn.relu, kernel_epsilon=0.001, redraw_features=False, unidirectional=False, lax_scan_unroll=1, ): """Construct a f...
[ "def", "make_fast_generalized_attention", "(", "qkv_dim", ",", "renormalize_attention", "=", "True", ",", "numerical_stabilizer", "=", "0.0", ",", "nb_features", "=", "256", ",", "features_type", "=", "\"deterministic\"", ",", "kernel_fn", "=", "jax", ".", "nn", "...
[ 243, 0 ]
[ 284, 23 ]
python
en
['en', 'en', 'en']
True
FastAttention.dot_product_attention
( self, query, key, value, dtype=jnp.float32, bias=None, axis=None, broadcast_dropout=True, dropout_rng=None, dropout_rate=0.0, deterministic=False, precision=None, )
Computes dot-product attention given query, key, and value. This is the core function for applying fast approximate dot-product attention. It calculates the attention weights given query and key and combines the values using the attention weights. This function supports multi-dimensional inputs...
Computes dot-product attention given query, key, and value. This is the core function for applying fast approximate dot-product attention. It calculates the attention weights given query and key and combines the values using the attention weights. This function supports multi-dimensional inputs
def dot_product_attention( self, query, key, value, dtype=jnp.float32, bias=None, axis=None, broadcast_dropout=True, dropout_rng=None, dropout_rate=0.0, deterministic=False, precision=None, ): """ Compute...
[ "def", "dot_product_attention", "(", "self", ",", "query", ",", "key", ",", "value", ",", "dtype", "=", "jnp", ".", "float32", ",", "bias", "=", "None", ",", "axis", "=", "None", ",", "broadcast_dropout", "=", "True", ",", "dropout_rng", "=", "None", "...
[ 360, 4 ]
[ 400, 52 ]
python
en
['en', 'error', 'th']
False
test_user_form
(hass, cfupdate_flow)
Test we get the user initiated form.
Test we get the user initiated form.
async def test_user_form(hass, cfupdate_flow): """Test we get the user initiated form.""" await async_setup_component(hass, "persistent_notification", {}) result = await hass.config_entries.flow.async_init( DOMAIN, context={CONF_SOURCE: SOURCE_USER} ) assert result["type"] == RESULT_TYPE_FO...
[ "async", "def", "test_user_form", "(", "hass", ",", "cfupdate_flow", ")", ":", "await", "async_setup_component", "(", "hass", ",", "\"persistent_notification\"", ",", "{", "}", ")", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "asyn...
[ 29, 0 ]
[ 79, 48 ]
python
en
['en', 'en', 'en']
True
test_user_form_cannot_connect
(hass, cfupdate_flow)
Test we handle cannot connect error.
Test we handle cannot connect error.
async def test_user_form_cannot_connect(hass, cfupdate_flow): """Test we handle cannot connect error.""" instance = cfupdate_flow.return_value result = await hass.config_entries.flow.async_init( DOMAIN, context={CONF_SOURCE: SOURCE_USER} ) instance.get_zones.side_effect = CloudflareConnect...
[ "async", "def", "test_user_form_cannot_connect", "(", "hass", ",", "cfupdate_flow", ")", ":", "instance", "=", "cfupdate_flow", ".", "return_value", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "DOMAIN", ",", "conte...
[ 82, 0 ]
[ 97, 57 ]
python
en
['en', 'en', 'en']
True
test_user_form_invalid_auth
(hass, cfupdate_flow)
Test we handle invalid auth error.
Test we handle invalid auth error.
async def test_user_form_invalid_auth(hass, cfupdate_flow): """Test we handle invalid auth error.""" instance = cfupdate_flow.return_value result = await hass.config_entries.flow.async_init( DOMAIN, context={CONF_SOURCE: SOURCE_USER} ) instance.get_zones.side_effect = CloudflareAuthenticat...
[ "async", "def", "test_user_form_invalid_auth", "(", "hass", ",", "cfupdate_flow", ")", ":", "instance", "=", "cfupdate_flow", ".", "return_value", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "DOMAIN", ",", "context...
[ 100, 0 ]
[ 115, 55 ]
python
de
['de', 'et', 'en']
False
test_user_form_invalid_zone
(hass, cfupdate_flow)
Test we handle invalid zone error.
Test we handle invalid zone error.
async def test_user_form_invalid_zone(hass, cfupdate_flow): """Test we handle invalid zone error.""" instance = cfupdate_flow.return_value result = await hass.config_entries.flow.async_init( DOMAIN, context={CONF_SOURCE: SOURCE_USER} ) instance.get_zones.side_effect = CloudflareZoneExcepti...
[ "async", "def", "test_user_form_invalid_zone", "(", "hass", ",", "cfupdate_flow", ")", ":", "instance", "=", "cfupdate_flow", ".", "return_value", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "DOMAIN", ",", "context...
[ 118, 0 ]
[ 133, 55 ]
python
en
['nl', 'sr', 'en']
False
test_user_form_unexpected_exception
(hass, cfupdate_flow)
Test we handle unexpected exception.
Test we handle unexpected exception.
async def test_user_form_unexpected_exception(hass, cfupdate_flow): """Test we handle unexpected exception.""" instance = cfupdate_flow.return_value result = await hass.config_entries.flow.async_init( DOMAIN, context={CONF_SOURCE: SOURCE_USER} ) instance.get_zones.side_effect = Exception()...
[ "async", "def", "test_user_form_unexpected_exception", "(", "hass", ",", "cfupdate_flow", ")", ":", "instance", "=", "cfupdate_flow", ".", "return_value", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "DOMAIN", ",", ...
[ 136, 0 ]
[ 151, 50 ]
python
en
['de', 'en', 'en']
True
test_user_form_single_instance_allowed
(hass)
Test that configuring more than one instance is rejected.
Test that configuring more than one instance is rejected.
async def test_user_form_single_instance_allowed(hass): """Test that configuring more than one instance is rejected.""" entry = MockConfigEntry(domain=DOMAIN, data=ENTRY_CONFIG) entry.add_to_hass(hass) result = await hass.config_entries.flow.async_init( DOMAIN, context={CONF_SOURCE: SOU...
[ "async", "def", "test_user_form_single_instance_allowed", "(", "hass", ")", ":", "entry", "=", "MockConfigEntry", "(", "domain", "=", "DOMAIN", ",", "data", "=", "ENTRY_CONFIG", ")", "entry", ".", "add_to_hass", "(", "hass", ")", "result", "=", "await", "hass"...
[ 154, 0 ]
[ 165, 56 ]
python
en
['en', 'en', 'en']
True
shift_tokens_right
(input_ids: torch.Tensor, pad_token_id: int, decoder_start_token_id: int)
Shift input ids one token to the right.
Shift input ids one token to the right.
def shift_tokens_right(input_ids: torch.Tensor, pad_token_id: int, decoder_start_token_id: int): """ Shift input ids one token to the right. """ shifted_input_ids = input_ids.new_zeros(input_ids.shape) shifted_input_ids[:, 1:] = input_ids[:, :-1].clone() shifted_input_ids[:, 0] = decoder_start_t...
[ "def", "shift_tokens_right", "(", "input_ids", ":", "torch", ".", "Tensor", ",", "pad_token_id", ":", "int", ",", "decoder_start_token_id", ":", "int", ")", ":", "shifted_input_ids", "=", "input_ids", ".", "new_zeros", "(", "input_ids", ".", "shape", ")", "shi...
[ 63, 0 ]
[ 75, 28 ]
python
en
['en', 'error', 'th']
False
_make_causal_mask
(input_ids_shape: torch.Size, dtype: torch.dtype, past_key_values_length: int = 0)
Make causal mask used for bi-directional self-attention.
Make causal mask used for bi-directional self-attention.
def _make_causal_mask(input_ids_shape: torch.Size, dtype: torch.dtype, past_key_values_length: int = 0): """ Make causal mask used for bi-directional self-attention. """ bsz, tgt_len = input_ids_shape mask = torch.full((tgt_len, tgt_len), float("-inf")) mask_cond = torch.arange(mask.size(-1)) ...
[ "def", "_make_causal_mask", "(", "input_ids_shape", ":", "torch", ".", "Size", ",", "dtype", ":", "torch", ".", "dtype", ",", "past_key_values_length", ":", "int", "=", "0", ")", ":", "bsz", ",", "tgt_len", "=", "input_ids_shape", "mask", "=", "torch", "."...
[ 79, 0 ]
[ 91, 91 ]
python
en
['en', 'error', 'th']
False
_expand_mask
(mask: torch.Tensor, dtype: torch.dtype, tgt_len: Optional[int] = None)
Expands attention_mask from `[bsz, seq_len]` to `[bsz, 1, tgt_seq_len, src_seq_len]`.
Expands attention_mask from `[bsz, seq_len]` to `[bsz, 1, tgt_seq_len, src_seq_len]`.
def _expand_mask(mask: torch.Tensor, dtype: torch.dtype, tgt_len: Optional[int] = None): """ Expands attention_mask from `[bsz, seq_len]` to `[bsz, 1, tgt_seq_len, src_seq_len]`. """ bsz, src_len = mask.size() tgt_len = tgt_len if tgt_len is not None else src_len expanded_mask = mask[:, None, N...
[ "def", "_expand_mask", "(", "mask", ":", "torch", ".", "Tensor", ",", "dtype", ":", "torch", ".", "dtype", ",", "tgt_len", ":", "Optional", "[", "int", "]", "=", "None", ")", ":", "bsz", ",", "src_len", "=", "mask", ".", "size", "(", ")", "tgt_len"...
[ 95, 0 ]
[ 106, 82 ]
python
en
['en', 'error', 'th']
False
BlenderbotLearnedPositionalEmbedding.forward
(self, input_ids_shape: torch.Size, past_key_values_length: int = 0)
`input_ids_shape` is expected to be [bsz x seqlen].
`input_ids_shape` is expected to be [bsz x seqlen].
def forward(self, input_ids_shape: torch.Size, past_key_values_length: int = 0): """`input_ids_shape` is expected to be [bsz x seqlen].""" bsz, seq_len = input_ids_shape[:2] positions = torch.arange( past_key_values_length, past_key_values_length + seq_len, dtype=torch.long, device=s...
[ "def", "forward", "(", "self", ",", "input_ids_shape", ":", "torch", ".", "Size", ",", "past_key_values_length", ":", "int", "=", "0", ")", ":", "bsz", ",", "seq_len", "=", "input_ids_shape", "[", ":", "2", "]", "positions", "=", "torch", ".", "arange", ...
[ 117, 4 ]
[ 123, 41 ]
python
en
['en', 'en', 'en']
True
BlenderbotAttention.forward
( self, hidden_states: torch.Tensor, key_value_states: Optional[torch.Tensor] = None, past_key_value: Optional[Tuple[torch.Tensor]] = None, attention_mask: Optional[torch.Tensor] = None, layer_head_mask: Optional[torch.Tensor] = None, output_attentions: bool = Fal...
Input shape: Batch x Time x Channel
Input shape: Batch x Time x Channel
def forward( self, hidden_states: torch.Tensor, key_value_states: Optional[torch.Tensor] = None, past_key_value: Optional[Tuple[torch.Tensor]] = None, attention_mask: Optional[torch.Tensor] = None, layer_head_mask: Optional[torch.Tensor] = None, output_attentions:...
[ "def", "forward", "(", "self", ",", "hidden_states", ":", "torch", ".", "Tensor", ",", "key_value_states", ":", "Optional", "[", "torch", ".", "Tensor", "]", "=", "None", ",", "past_key_value", ":", "Optional", "[", "Tuple", "[", "torch", ".", "Tensor", ...
[ 157, 4 ]
[ 266, 65 ]
python
en
['en', 'pl', 'en']
True
BlenderbotEncoderLayer.forward
( self, hidden_states: torch.Tensor, attention_mask: torch.Tensor, layer_head_mask: torch.Tensor, output_attentions: bool = False, )
Args: hidden_states (:obj:`torch.FloatTensor`): input to the layer of shape `(seq_len, batch, embed_dim)` attention_mask (:obj:`torch.FloatTensor`): attention mask of size `(batch, 1, tgt_len, src_len)` where padding elements are indicated by very large negative values. ...
Args: hidden_states (:obj:`torch.FloatTensor`): input to the layer of shape `(seq_len, batch, embed_dim)` attention_mask (:obj:`torch.FloatTensor`): attention mask of size `(batch, 1, tgt_len, src_len)` where padding elements are indicated by very large negative values. ...
def forward( self, hidden_states: torch.Tensor, attention_mask: torch.Tensor, layer_head_mask: torch.Tensor, output_attentions: bool = False, ): """ Args: hidden_states (:obj:`torch.FloatTensor`): input to the layer of shape `(seq_len, batch, embed...
[ "def", "forward", "(", "self", ",", "hidden_states", ":", "torch", ".", "Tensor", ",", "attention_mask", ":", "torch", ".", "Tensor", ",", "layer_head_mask", ":", "torch", ".", "Tensor", ",", "output_attentions", ":", "bool", "=", "False", ",", ")", ":", ...
[ 287, 4 ]
[ 335, 22 ]
python
en
['en', 'error', 'th']
False
BlenderbotDecoderLayer.forward
( self, hidden_states: torch.Tensor, attention_mask: Optional[torch.Tensor] = None, encoder_hidden_states: Optional[torch.Tensor] = None, encoder_attention_mask: Optional[torch.Tensor] = None, layer_head_mask: Optional[torch.Tensor] = None, encoder_layer_head_mask...
Args: hidden_states (:obj:`torch.FloatTensor`): input to the layer of shape `(seq_len, batch, embed_dim)` attention_mask (:obj:`torch.FloatTensor`): attention mask of size `(batch, 1, tgt_len, src_len)` where padding elements are indicated by very large negative values. ...
Args: hidden_states (:obj:`torch.FloatTensor`): input to the layer of shape `(seq_len, batch, embed_dim)` attention_mask (:obj:`torch.FloatTensor`): attention mask of size `(batch, 1, tgt_len, src_len)` where padding elements are indicated by very large negative values. ...
def forward( self, hidden_states: torch.Tensor, attention_mask: Optional[torch.Tensor] = None, encoder_hidden_states: Optional[torch.Tensor] = None, encoder_attention_mask: Optional[torch.Tensor] = None, layer_head_mask: Optional[torch.Tensor] = None, encoder_laye...
[ "def", "forward", "(", "self", ",", "hidden_states", ":", "torch", ".", "Tensor", ",", "attention_mask", ":", "Optional", "[", "torch", ".", "Tensor", "]", "=", "None", ",", "encoder_hidden_states", ":", "Optional", "[", "torch", ".", "Tensor", "]", "=", ...
[ 366, 4 ]
[ 452, 22 ]
python
en
['en', 'error', 'th']
False
BlenderbotEncoder.forward
( self, input_ids=None, attention_mask=None, head_mask=None, inputs_embeds=None, output_attentions=None, output_hidden_states=None, return_dict=None, )
r""" Args: input_ids (:obj:`torch.LongTensor` of shape :obj:`(batch_size, sequence_length)`): Indices of input sequence tokens in the vocabulary. Padding will be ignored by default should you provide it. Indices can be obtained using :class:`~transfor...
r""" Args: input_ids (:obj:`torch.LongTensor` of shape :obj:`(batch_size, sequence_length)`): Indices of input sequence tokens in the vocabulary. Padding will be ignored by default should you provide it.
def forward( self, input_ids=None, attention_mask=None, head_mask=None, inputs_embeds=None, output_attentions=None, output_hidden_states=None, return_dict=None, ): r""" Args: input_ids (:obj:`torch.LongTensor` of shape :obj:...
[ "def", "forward", "(", "self", ",", "input_ids", "=", "None", ",", "attention_mask", "=", "None", ",", "head_mask", "=", "None", ",", "inputs_embeds", "=", "None", ",", "output_attentions", "=", "None", ",", "output_hidden_states", "=", "None", ",", "return_...
[ 644, 4 ]
[ 774, 9 ]
python
cy
['en', 'cy', 'hi']
False
BlenderbotDecoder.forward
( self, input_ids=None, attention_mask=None, encoder_hidden_states=None, encoder_attention_mask=None, head_mask=None, encoder_head_mask=None, past_key_values=None, inputs_embeds=None, use_cache=None, output_attentions=None, ...
r""" Args: input_ids (:obj:`torch.LongTensor` of shape :obj:`(batch_size, sequence_length)`): Indices of input sequence tokens in the vocabulary. Padding will be ignored by default should you provide it. Indices can be obtained using :class:`~transfor...
r""" Args: input_ids (:obj:`torch.LongTensor` of shape :obj:`(batch_size, sequence_length)`): Indices of input sequence tokens in the vocabulary. Padding will be ignored by default should you provide it.
def forward( self, input_ids=None, attention_mask=None, encoder_hidden_states=None, encoder_attention_mask=None, head_mask=None, encoder_head_mask=None, past_key_values=None, inputs_embeds=None, use_cache=None, output_attentions=Non...
[ "def", "forward", "(", "self", ",", "input_ids", "=", "None", ",", "attention_mask", "=", "None", ",", "encoder_hidden_states", "=", "None", ",", "encoder_attention_mask", "=", "None", ",", "head_mask", "=", "None", ",", "encoder_head_mask", "=", "None", ",", ...
[ 833, 4 ]
[ 1042, 9 ]
python
cy
['en', 'cy', 'hi']
False
BlenderbotForCausalLM.forward
( self, input_ids=None, attention_mask=None, encoder_hidden_states=None, encoder_attention_mask=None, head_mask=None, encoder_head_mask=None, past_key_values=None, inputs_embeds=None, labels=None, use_cache=None, output_atte...
r""" Args: input_ids (:obj:`torch.LongTensor` of shape :obj:`(batch_size, sequence_length)`): Indices of input sequence tokens in the vocabulary. Padding will be ignored by default should you provide it. Indices can be obtained using :class:`~transfor...
r""" Args: input_ids (:obj:`torch.LongTensor` of shape :obj:`(batch_size, sequence_length)`): Indices of input sequence tokens in the vocabulary. Padding will be ignored by default should you provide it.
def forward( self, input_ids=None, attention_mask=None, encoder_hidden_states=None, encoder_attention_mask=None, head_mask=None, encoder_head_mask=None, past_key_values=None, inputs_embeds=None, labels=None, use_cache=None, ...
[ "def", "forward", "(", "self", ",", "input_ids", "=", "None", ",", "attention_mask", "=", "None", ",", "encoder_hidden_states", "=", "None", ",", "encoder_attention_mask", "=", "None", ",", "head_mask", "=", "None", ",", "encoder_head_mask", "=", "None", ",", ...
[ 1394, 4 ]
[ 1529, 9 ]
python
cy
['en', 'cy', 'hi']
False
ecobee_date
(date_string)
Validate a date_string as valid for the ecobee API.
Validate a date_string as valid for the ecobee API.
def ecobee_date(date_string): """Validate a date_string as valid for the ecobee API.""" try: datetime.strptime(date_string, "%Y-%m-%d") except ValueError as err: raise vol.Invalid("Date does not match ecobee date format YYYY-MM-DD") from err return date_string
[ "def", "ecobee_date", "(", "date_string", ")", ":", "try", ":", "datetime", ".", "strptime", "(", "date_string", ",", "\"%Y-%m-%d\"", ")", "except", "ValueError", "as", "err", ":", "raise", "vol", ".", "Invalid", "(", "\"Date does not match ecobee date format YYYY...
[ 6, 0 ]
[ 12, 22 ]
python
en
['en', 'en', 'en']
True
ecobee_time
(time_string)
Validate a time_string as valid for the ecobee API.
Validate a time_string as valid for the ecobee API.
def ecobee_time(time_string): """Validate a time_string as valid for the ecobee API.""" try: datetime.strptime(time_string, "%H:%M:%S") except ValueError as err: raise vol.Invalid( "Time does not match ecobee 24-hour time format HH:MM:SS" ) from err return time_string
[ "def", "ecobee_time", "(", "time_string", ")", ":", "try", ":", "datetime", ".", "strptime", "(", "time_string", ",", "\"%H:%M:%S\"", ")", "except", "ValueError", "as", "err", ":", "raise", "vol", ".", "Invalid", "(", "\"Time does not match ecobee 24-hour time for...
[ 15, 0 ]
[ 23, 22 ]
python
en
['en', 'en', 'en']
True
async_setup_platform
(hass, config, async_add_entities, discovery_info=None)
Discover and configure Somfy covers.
Discover and configure Somfy covers.
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None): """Discover and configure Somfy covers.""" if discovery_info is None: return somfy_mylink = hass.data[DATA_SOMFY_MYLINK] cover_list = [] try: mylink_status = await somfy_mylink.status_info() ex...
[ "async", "def", "async_setup_platform", "(", "hass", ",", "config", ",", "async_add_entities", ",", "discovery_info", "=", "None", ")", ":", "if", "discovery_info", "is", "None", ":", "return", "somfy_mylink", "=", "hass", ".", "data", "[", "DATA_SOMFY_MYLINK", ...
[ 15, 0 ]
[ 43, 34 ]
python
en
['en', 'en', 'en']
True
SomfyShade.__init__
( self, somfy_mylink, target_id, name="SomfyShade", reverse=False, device_class=DEVICE_CLASS_WINDOW, )
Initialize the cover.
Initialize the cover.
def __init__( self, somfy_mylink, target_id, name="SomfyShade", reverse=False, device_class=DEVICE_CLASS_WINDOW, ): """Initialize the cover.""" self.somfy_mylink = somfy_mylink self._target_id = target_id self._name = name self....
[ "def", "__init__", "(", "self", ",", "somfy_mylink", ",", "target_id", ",", "name", "=", "\"SomfyShade\"", ",", "reverse", "=", "False", ",", "device_class", "=", "DEVICE_CLASS_WINDOW", ",", ")", ":", "self", ".", "somfy_mylink", "=", "somfy_mylink", "self", ...
[ 49, 4 ]
[ 62, 41 ]
python
en
['en', 'en', 'en']
True
SomfyShade.unique_id
(self)
Return the unique ID of this cover.
Return the unique ID of this cover.
def unique_id(self): """Return the unique ID of this cover.""" return self._target_id
[ "def", "unique_id", "(", "self", ")", ":", "return", "self", ".", "_target_id" ]
[ 65, 4 ]
[ 67, 30 ]
python
en
['en', 'en', 'en']
True
SomfyShade.name
(self)
Return the name of the cover.
Return the name of the cover.
def name(self): """Return the name of the cover.""" return self._name
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "_name" ]
[ 70, 4 ]
[ 72, 25 ]
python
en
['en', 'en', 'en']
True
SomfyShade.is_closed
(self)
Return if the cover is closed.
Return if the cover is closed.
def is_closed(self): """Return if the cover is closed.""" return None
[ "def", "is_closed", "(", "self", ")", ":", "return", "None" ]
[ 75, 4 ]
[ 77, 19 ]
python
en
['en', 'en', 'en']
True
SomfyShade.assumed_state
(self)
Let HA know the integration is assumed state.
Let HA know the integration is assumed state.
def assumed_state(self): """Let HA know the integration is assumed state.""" return True
[ "def", "assumed_state", "(", "self", ")", ":", "return", "True" ]
[ 80, 4 ]
[ 82, 19 ]
python
en
['en', 'en', 'en']
True
SomfyShade.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" ]
[ 85, 4 ]
[ 87, 33 ]
python
en
['en', 'en', 'en']
True
SomfyShade.async_open_cover
(self, **kwargs)
Wrap Homeassistant calls to open the cover.
Wrap Homeassistant calls to open the cover.
async def async_open_cover(self, **kwargs): """Wrap Homeassistant calls to open the cover.""" if not self._reverse: await self.somfy_mylink.move_up(self._target_id) else: await self.somfy_mylink.move_down(self._target_id)
[ "async", "def", "async_open_cover", "(", "self", ",", "*", "*", "kwargs", ")", ":", "if", "not", "self", ".", "_reverse", ":", "await", "self", ".", "somfy_mylink", ".", "move_up", "(", "self", ".", "_target_id", ")", "else", ":", "await", "self", ".",...
[ 89, 4 ]
[ 94, 62 ]
python
en
['en', 'en', 'en']
True
SomfyShade.async_close_cover
(self, **kwargs)
Wrap Homeassistant calls to close the cover.
Wrap Homeassistant calls to close the cover.
async def async_close_cover(self, **kwargs): """Wrap Homeassistant calls to close the cover.""" if not self._reverse: await self.somfy_mylink.move_down(self._target_id) else: await self.somfy_mylink.move_up(self._target_id)
[ "async", "def", "async_close_cover", "(", "self", ",", "*", "*", "kwargs", ")", ":", "if", "not", "self", ".", "_reverse", ":", "await", "self", ".", "somfy_mylink", ".", "move_down", "(", "self", ".", "_target_id", ")", "else", ":", "await", "self", "...
[ 96, 4 ]
[ 101, 60 ]
python
en
['en', 'en', 'en']
True
SomfyShade.async_stop_cover
(self, **kwargs)
Stop the cover.
Stop the cover.
async def async_stop_cover(self, **kwargs): """Stop the cover.""" await self.somfy_mylink.move_stop(self._target_id)
[ "async", "def", "async_stop_cover", "(", "self", ",", "*", "*", "kwargs", ")", ":", "await", "self", ".", "somfy_mylink", ".", "move_stop", "(", "self", ".", "_target_id", ")" ]
[ 103, 4 ]
[ 105, 58 ]
python
en
['en', 'en', 'en']
True
AlexaCapability.__init__
(self, entity: State, instance: Optional[str] = None)
Initialize an Alexa capability.
Initialize an Alexa capability.
def __init__(self, entity: State, instance: Optional[str] = None): """Initialize an Alexa capability.""" self.entity = entity self.instance = instance
[ "def", "__init__", "(", "self", ",", "entity", ":", "State", ",", "instance", ":", "Optional", "[", "str", "]", "=", "None", ")", ":", "self", ".", "entity", "=", "entity", "self", ".", "instance", "=", "instance" ]
[ 75, 4 ]
[ 78, 32 ]
python
it
['ro', 'pl', 'it']
False
AlexaCapability.name
(self)
Return the Alexa API name of this interface.
Return the Alexa API name of this interface.
def name(self) -> str: """Return the Alexa API name of this interface.""" raise NotImplementedError
[ "def", "name", "(", "self", ")", "->", "str", ":", "raise", "NotImplementedError" ]
[ 80, 4 ]
[ 82, 33 ]
python
en
['en', 'mi', 'en']
True
AlexaCapability.properties_supported
()
Return what properties this entity supports.
Return what properties this entity supports.
def properties_supported() -> List[dict]: """Return what properties this entity supports.""" return []
[ "def", "properties_supported", "(", ")", "->", "List", "[", "dict", "]", ":", "return", "[", "]" ]
[ 85, 4 ]
[ 87, 17 ]
python
en
['en', 'en', 'en']
True
AlexaCapability.properties_proactively_reported
()
Return True if properties asynchronously reported.
Return True if properties asynchronously reported.
def properties_proactively_reported() -> bool: """Return True if properties asynchronously reported.""" return False
[ "def", "properties_proactively_reported", "(", ")", "->", "bool", ":", "return", "False" ]
[ 90, 4 ]
[ 92, 20 ]
python
en
['en', 'en', 'en']
True
AlexaCapability.properties_retrievable
()
Return True if properties can be retrieved.
Return True if properties can be retrieved.
def properties_retrievable() -> bool: """Return True if properties can be retrieved.""" return False
[ "def", "properties_retrievable", "(", ")", "->", "bool", ":", "return", "False" ]
[ 95, 4 ]
[ 97, 20 ]
python
en
['en', 'af', 'en']
True
AlexaCapability.properties_non_controllable
()
Return True if non controllable.
Return True if non controllable.
def properties_non_controllable() -> bool: """Return True if non controllable.""" return None
[ "def", "properties_non_controllable", "(", ")", "->", "bool", ":", "return", "None" ]
[ 100, 4 ]
[ 102, 19 ]
python
it
['it', 'en', 'it']
True
AlexaCapability.get_property
(name)
Read and return a property. Return value should be a dict, or raise UnsupportedProperty. Properties can also have a timeOfSample and uncertaintyInMilliseconds, but returning those metadata is not yet implemented.
Read and return a property.
def get_property(name): """Read and return a property. Return value should be a dict, or raise UnsupportedProperty. Properties can also have a timeOfSample and uncertaintyInMilliseconds, but returning those metadata is not yet implemented. """ raise UnsupportedProperty(...
[ "def", "get_property", "(", "name", ")", ":", "raise", "UnsupportedProperty", "(", "name", ")" ]
[ 105, 4 ]
[ 113, 39 ]
python
en
['en', 'en', 'en']
True
AlexaCapability.supports_deactivation
()
Applicable only to scenes.
Applicable only to scenes.
def supports_deactivation(): """Applicable only to scenes.""" return None
[ "def", "supports_deactivation", "(", ")", ":", "return", "None" ]
[ 116, 4 ]
[ 118, 19 ]
python
en
['en', 'en', 'en']
True
AlexaCapability.capability_proactively_reported
()
Return True if the capability is proactively reported. Set properties_proactively_reported() for proactively reported properties. Applicable to DoorbellEventSource.
Return True if the capability is proactively reported.
def capability_proactively_reported(): """Return True if the capability is proactively reported. Set properties_proactively_reported() for proactively reported properties. Applicable to DoorbellEventSource. """ return None
[ "def", "capability_proactively_reported", "(", ")", ":", "return", "None" ]
[ 121, 4 ]
[ 127, 19 ]
python
en
['en', 'en', 'en']
True
AlexaCapability.capability_resources
()
Return the capability object. Applicable to ToggleController, RangeController, and ModeController interfaces.
Return the capability object.
def capability_resources(): """Return the capability object. Applicable to ToggleController, RangeController, and ModeController interfaces. """ return []
[ "def", "capability_resources", "(", ")", ":", "return", "[", "]" ]
[ 130, 4 ]
[ 135, 17 ]
python
en
['en', 'en', 'en']
True
AlexaCapability.configuration
()
Return the configuration object. Applicable to the ThermostatController, SecurityControlPanel, ModeController, RangeController, and EventDetectionSensor.
Return the configuration object.
def configuration(): """Return the configuration object. Applicable to the ThermostatController, SecurityControlPanel, ModeController, RangeController, and EventDetectionSensor. """ return []
[ "def", "configuration", "(", ")", ":", "return", "[", "]" ]
[ 138, 4 ]
[ 144, 17 ]
python
en
['en', 'en', 'en']
True
AlexaCapability.configurations
()
Return the configurations object. The plural configurations object is different that the singular configuration object. Applicable to EqualizerController interface.
Return the configurations object.
def configurations(): """Return the configurations object. The plural configurations object is different that the singular configuration object. Applicable to EqualizerController interface. """ return []
[ "def", "configurations", "(", ")", ":", "return", "[", "]" ]
[ 147, 4 ]
[ 153, 17 ]
python
en
['en', 'en', 'en']
True
AlexaCapability.inputs
()
Applicable only to media players.
Applicable only to media players.
def inputs(): """Applicable only to media players.""" return []
[ "def", "inputs", "(", ")", ":", "return", "[", "]" ]
[ 156, 4 ]
[ 158, 17 ]
python
en
['en', 'en', 'en']
True
AlexaCapability.semantics
()
Return the semantics object. Applicable to ToggleController, RangeController, and ModeController interfaces.
Return the semantics object.
def semantics(): """Return the semantics object. Applicable to ToggleController, RangeController, and ModeController interfaces. """ return []
[ "def", "semantics", "(", ")", ":", "return", "[", "]" ]
[ 161, 4 ]
[ 166, 17 ]
python
en
['en', 'ja', 'en']
True
AlexaCapability.supported_operations
()
Return the supportedOperations object.
Return the supportedOperations object.
def supported_operations(): """Return the supportedOperations object.""" return []
[ "def", "supported_operations", "(", ")", ":", "return", "[", "]" ]
[ 169, 4 ]
[ 171, 17 ]
python
en
['en', 'en', 'en']
True
AlexaCapability.camera_stream_configurations
()
Applicable only to CameraStreamController.
Applicable only to CameraStreamController.
def camera_stream_configurations(): """Applicable only to CameraStreamController.""" return None
[ "def", "camera_stream_configurations", "(", ")", ":", "return", "None" ]
[ 174, 4 ]
[ 176, 19 ]
python
en
['en', 'en', 'en']
True
AlexaCapability.serialize_discovery
(self)
Serialize according to the Discovery API.
Serialize according to the Discovery API.
def serialize_discovery(self): """Serialize according to the Discovery API.""" result = {"type": "AlexaInterface", "interface": self.name(), "version": "3"} instance = self.instance if instance is not None: result["instance"] = instance properties_supported = self.p...
[ "def", "serialize_discovery", "(", "self", ")", ":", "result", "=", "{", "\"type\"", ":", "\"AlexaInterface\"", ",", "\"interface\"", ":", "self", ".", "name", "(", ")", ",", "\"version\"", ":", "\"3\"", "}", "instance", "=", "self", ".", "instance", "if",...
[ 178, 4 ]
[ 235, 21 ]
python
en
['en', 'en', 'en']
True
AlexaCapability.serialize_properties
(self)
Return properties serialized for an API response.
Return properties serialized for an API response.
def serialize_properties(self): """Return properties serialized for an API response.""" for prop in self.properties_supported(): prop_name = prop["name"] try: prop_value = self.get_property(prop_name) except UnsupportedProperty: raise ...
[ "def", "serialize_properties", "(", "self", ")", ":", "for", "prop", "in", "self", ".", "properties_supported", "(", ")", ":", "prop_name", "=", "prop", "[", "\"name\"", "]", "try", ":", "prop_value", "=", "self", ".", "get_property", "(", "prop_name", ")"...
[ 237, 4 ]
[ 268, 24 ]
python
en
['en', 'no', 'en']
True
Alexa.name
(self)
Return the Alexa API name of this interface.
Return the Alexa API name of this interface.
def name(self): """Return the Alexa API name of this interface.""" return "Alexa"
[ "def", "name", "(", "self", ")", ":", "return", "\"Alexa\"" ]
[ 295, 4 ]
[ 297, 22 ]
python
en
['en', 'mi', 'en']
True
AlexaEndpointHealth.__init__
(self, hass, entity)
Initialize the entity.
Initialize the entity.
def __init__(self, hass, entity): """Initialize the entity.""" super().__init__(entity) self.hass = hass
[ "def", "__init__", "(", "self", ",", "hass", ",", "entity", ")", ":", "super", "(", ")", ".", "__init__", "(", "entity", ")", "self", ".", "hass", "=", "hass" ]
[ 319, 4 ]
[ 322, 24 ]
python
en
['en', 'en', 'en']
True
AlexaEndpointHealth.name
(self)
Return the Alexa API name of this interface.
Return the Alexa API name of this interface.
def name(self): """Return the Alexa API name of this interface.""" return "Alexa.EndpointHealth"
[ "def", "name", "(", "self", ")", ":", "return", "\"Alexa.EndpointHealth\"" ]
[ 324, 4 ]
[ 326, 37 ]
python
en
['en', 'mi', 'en']
True
AlexaEndpointHealth.properties_supported
(self)
Return what properties this entity supports.
Return what properties this entity supports.
def properties_supported(self): """Return what properties this entity supports.""" return [{"name": "connectivity"}]
[ "def", "properties_supported", "(", "self", ")", ":", "return", "[", "{", "\"name\"", ":", "\"connectivity\"", "}", "]" ]
[ 328, 4 ]
[ 330, 41 ]
python
en
['en', 'en', 'en']
True
AlexaEndpointHealth.properties_proactively_reported
(self)
Return True if properties asynchronously reported.
Return True if properties asynchronously reported.
def properties_proactively_reported(self): """Return True if properties asynchronously reported.""" return True
[ "def", "properties_proactively_reported", "(", "self", ")", ":", "return", "True" ]
[ 332, 4 ]
[ 334, 19 ]
python
en
['en', 'en', 'en']
True
AlexaEndpointHealth.properties_retrievable
(self)
Return True if properties can be retrieved.
Return True if properties can be retrieved.
def properties_retrievable(self): """Return True if properties can be retrieved.""" return True
[ "def", "properties_retrievable", "(", "self", ")", ":", "return", "True" ]
[ 336, 4 ]
[ 338, 19 ]
python
en
['en', 'af', 'en']
True
AlexaEndpointHealth.get_property
(self, name)
Read and return a property.
Read and return a property.
def get_property(self, name): """Read and return a property.""" if name != "connectivity": raise UnsupportedProperty(name) if self.entity.state == STATE_UNAVAILABLE: return {"value": "UNREACHABLE"} return {"value": "OK"}
[ "def", "get_property", "(", "self", ",", "name", ")", ":", "if", "name", "!=", "\"connectivity\"", ":", "raise", "UnsupportedProperty", "(", "name", ")", "if", "self", ".", "entity", ".", "state", "==", "STATE_UNAVAILABLE", ":", "return", "{", "\"value\"", ...
[ 340, 4 ]
[ 347, 30 ]
python
en
['en', 'en', 'en']
True
AlexaPowerController.name
(self)
Return the Alexa API name of this interface.
Return the Alexa API name of this interface.
def name(self): """Return the Alexa API name of this interface.""" return "Alexa.PowerController"
[ "def", "name", "(", "self", ")", ":", "return", "\"Alexa.PowerController\"" ]
[ 369, 4 ]
[ 371, 38 ]
python
en
['en', 'mi', 'en']
True
AlexaPowerController.properties_supported
(self)
Return what properties this entity supports.
Return what properties this entity supports.
def properties_supported(self): """Return what properties this entity supports.""" return [{"name": "powerState"}]
[ "def", "properties_supported", "(", "self", ")", ":", "return", "[", "{", "\"name\"", ":", "\"powerState\"", "}", "]" ]
[ 373, 4 ]
[ 375, 39 ]
python
en
['en', 'en', 'en']
True
AlexaPowerController.properties_proactively_reported
(self)
Return True if properties asynchronously reported.
Return True if properties asynchronously reported.
def properties_proactively_reported(self): """Return True if properties asynchronously reported.""" return True
[ "def", "properties_proactively_reported", "(", "self", ")", ":", "return", "True" ]
[ 377, 4 ]
[ 379, 19 ]
python
en
['en', 'en', 'en']
True
AlexaPowerController.properties_retrievable
(self)
Return True if properties can be retrieved.
Return True if properties can be retrieved.
def properties_retrievable(self): """Return True if properties can be retrieved.""" return True
[ "def", "properties_retrievable", "(", "self", ")", ":", "return", "True" ]
[ 381, 4 ]
[ 383, 19 ]
python
en
['en', 'af', 'en']
True
AlexaPowerController.get_property
(self, name)
Read and return a property.
Read and return a property.
def get_property(self, name): """Read and return a property.""" if name != "powerState": raise UnsupportedProperty(name) if self.entity.domain == climate.DOMAIN: is_on = self.entity.state != climate.HVAC_MODE_OFF elif self.entity.domain == vacuum.DOMAIN: ...
[ "def", "get_property", "(", "self", ",", "name", ")", ":", "if", "name", "!=", "\"powerState\"", ":", "raise", "UnsupportedProperty", "(", "name", ")", "if", "self", ".", "entity", ".", "domain", "==", "climate", ".", "DOMAIN", ":", "is_on", "=", "self",...
[ 385, 4 ]
[ 400, 39 ]
python
en
['en', 'en', 'en']
True
AlexaLockController.name
(self)
Return the Alexa API name of this interface.
Return the Alexa API name of this interface.
def name(self): """Return the Alexa API name of this interface.""" return "Alexa.LockController"
[ "def", "name", "(", "self", ")", ":", "return", "\"Alexa.LockController\"" ]
[ 427, 4 ]
[ 429, 37 ]
python
en
['en', 'mi', 'en']
True