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
handle_webhook
(hass, webhook_id, request)
Handle webhook callback. iOS sets the "topic" as part of the payload. Android does not set a topic but adds headers to the request.
Handle webhook callback.
async def handle_webhook(hass, webhook_id, request): """Handle webhook callback. iOS sets the "topic" as part of the payload. Android does not set a topic but adds headers to the request. """ context = hass.data[DOMAIN]["context"] topic_base = re.sub("/#$", "", context.mqtt_topic) try: ...
[ "async", "def", "handle_webhook", "(", "hass", ",", "webhook_id", ",", "request", ")", ":", "context", "=", "hass", ".", "data", "[", "DOMAIN", "]", "[", "\"context\"", "]", "topic_base", "=", "re", ".", "sub", "(", "\"/#$\"", ",", "\"\"", ",", "contex...
[ 153, 0 ]
[ 211, 34 ]
python
en
['en', 'xh', 'en']
True
OwnTracksContext.__init__
( self, hass, secret, max_gps_accuracy, import_waypoints, waypoint_whitelist, region_mapping, events_only, mqtt_topic, )
Initialize an OwnTracks context.
Initialize an OwnTracks context.
def __init__( self, hass, secret, max_gps_accuracy, import_waypoints, waypoint_whitelist, region_mapping, events_only, mqtt_topic, ): """Initialize an OwnTracks context.""" self.hass = hass self.secret = secret s...
[ "def", "__init__", "(", "self", ",", "hass", ",", "secret", ",", "max_gps_accuracy", ",", "import_waypoints", ",", "waypoint_whitelist", ",", "region_mapping", ",", "events_only", ",", "mqtt_topic", ",", ")", ":", "self", ".", "hass", "=", "hass", "self", "....
[ 217, 4 ]
[ 239, 30 ]
python
en
['en', 'en', 'en']
True
OwnTracksContext.async_valid_accuracy
(self, message)
Check if we should ignore this message.
Check if we should ignore this message.
def async_valid_accuracy(self, message): """Check if we should ignore this message.""" acc = message.get("acc") if acc is None: return False try: acc = float(acc) except ValueError: return False if acc == 0: _LOGGER.warni...
[ "def", "async_valid_accuracy", "(", "self", ",", "message", ")", ":", "acc", "=", "message", ".", "get", "(", "\"acc\"", ")", "if", "acc", "is", "None", ":", "return", "False", "try", ":", "acc", "=", "float", "(", "acc", ")", "except", "ValueError", ...
[ 242, 4 ]
[ 271, 19 ]
python
en
['en', 'en', 'en']
True
OwnTracksContext.set_async_see
(self, func)
Set a new async_see function.
Set a new async_see function.
def set_async_see(self, func): """Set a new async_see function.""" self.async_see = func for msg in self._pending_msg: func(**msg) self._pending_msg.clear()
[ "def", "set_async_see", "(", "self", ",", "func", ")", ":", "self", ".", "async_see", "=", "func", "for", "msg", "in", "self", ".", "_pending_msg", ":", "func", "(", "*", "*", "msg", ")", "self", ".", "_pending_msg", ".", "clear", "(", ")" ]
[ 274, 4 ]
[ 279, 33 ]
python
en
['en', 'en', 'en']
True
OwnTracksContext.async_see
(self, **data)
Send a see message to the device tracker.
Send a see message to the device tracker.
def async_see(self, **data): """Send a see message to the device tracker.""" self._pending_msg.append(data)
[ "def", "async_see", "(", "self", ",", "*", "*", "data", ")", ":", "self", ".", "_pending_msg", ".", "append", "(", "data", ")" ]
[ 283, 4 ]
[ 285, 38 ]
python
en
['en', 'en', 'en']
True
OwnTracksContext.async_see_beacons
(self, hass, dev_id, kwargs_param)
Set active beacons to the current location.
Set active beacons to the current location.
def async_see_beacons(self, hass, dev_id, kwargs_param): """Set active beacons to the current location.""" kwargs = kwargs_param.copy() # Mobile beacons should always be set to the location of the # tracking device. I get the device state and make the necessary # changes to kwar...
[ "def", "async_see_beacons", "(", "self", ",", "hass", ",", "dev_id", ",", "kwargs_param", ")", ":", "kwargs", "=", "kwargs_param", ".", "copy", "(", ")", "# Mobile beacons should always be set to the location of the", "# tracking device. I get the device state and make the ne...
[ 288, 4 ]
[ 315, 36 ]
python
en
['en', 'en', 'en']
True
async_process_devices
(hass, manager)
Assign devices to proper component.
Assign devices to proper component.
async def async_process_devices(hass, manager): """Assign devices to proper component.""" devices = {} devices[VS_SWITCHES] = [] devices[VS_FANS] = [] devices[VS_LIGHTS] = [] await hass.async_add_executor_job(manager.update) if manager.fans: devices[VS_FANS].extend(manager.fans) ...
[ "async", "def", "async_process_devices", "(", "hass", ",", "manager", ")", ":", "devices", "=", "{", "}", "devices", "[", "VS_SWITCHES", "]", "=", "[", "]", "devices", "[", "VS_FANS", "]", "=", "[", "]", "devices", "[", "VS_LIGHTS", "]", "=", "[", "]...
[ 10, 0 ]
[ 39, 18 ]
python
en
['en', 'en', 'en']
True
VeSyncDevice.__init__
(self, device)
Initialize the VeSync device.
Initialize the VeSync device.
def __init__(self, device): """Initialize the VeSync device.""" self.device = device
[ "def", "__init__", "(", "self", ",", "device", ")", ":", "self", ".", "device", "=", "device" ]
[ 45, 4 ]
[ 47, 28 ]
python
en
['en', 'cs', 'en']
True
VeSyncDevice.unique_id
(self)
Return the ID of this device.
Return the ID of this device.
def unique_id(self): """Return the ID of this device.""" if isinstance(self.device.sub_device_no, int): return f"{self.device.cid}{str(self.device.sub_device_no)}" return self.device.cid
[ "def", "unique_id", "(", "self", ")", ":", "if", "isinstance", "(", "self", ".", "device", ".", "sub_device_no", ",", "int", ")", ":", "return", "f\"{self.device.cid}{str(self.device.sub_device_no)}\"", "return", "self", ".", "device", ".", "cid" ]
[ 50, 4 ]
[ 54, 30 ]
python
en
['en', 'en', 'en']
True
VeSyncDevice.name
(self)
Return the name of the device.
Return the name of the device.
def name(self): """Return the name of the device.""" return self.device.device_name
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "device", ".", "device_name" ]
[ 57, 4 ]
[ 59, 38 ]
python
en
['en', 'en', 'en']
True
VeSyncDevice.is_on
(self)
Return True if device is on.
Return True if device is on.
def is_on(self): """Return True if device is on.""" return self.device.device_status == "on"
[ "def", "is_on", "(", "self", ")", ":", "return", "self", ".", "device", ".", "device_status", "==", "\"on\"" ]
[ 62, 4 ]
[ 64, 48 ]
python
en
['en', 'fy', 'en']
True
VeSyncDevice.available
(self)
Return True if device is available.
Return True if device is available.
def available(self) -> bool: """Return True if device is available.""" return self.device.connection_status == "online"
[ "def", "available", "(", "self", ")", "->", "bool", ":", "return", "self", ".", "device", ".", "connection_status", "==", "\"online\"" ]
[ 67, 4 ]
[ 69, 56 ]
python
en
['en', 'en', 'en']
True
VeSyncDevice.turn_off
(self, **kwargs)
Turn the device off.
Turn the device off.
def turn_off(self, **kwargs): """Turn the device off.""" self.device.turn_off()
[ "def", "turn_off", "(", "self", ",", "*", "*", "kwargs", ")", ":", "self", ".", "device", ".", "turn_off", "(", ")" ]
[ 71, 4 ]
[ 73, 30 ]
python
en
['en', 'en', 'en']
True
VeSyncDevice.update
(self)
Update vesync device.
Update vesync device.
def update(self): """Update vesync device.""" self.device.update()
[ "def", "update", "(", "self", ")", ":", "self", ".", "device", ".", "update", "(", ")" ]
[ 75, 4 ]
[ 77, 28 ]
python
cs
['fr', 'cs', 'tr']
False
ConfigFlow.async_get_options_flow
(config_entry)
Get the options flow for this handler.
Get the options flow for this handler.
def async_get_options_flow(config_entry): """Get the options flow for this handler.""" return OptionsFlowHandler(config_entry)
[ "def", "async_get_options_flow", "(", "config_entry", ")", ":", "return", "OptionsFlowHandler", "(", "config_entry", ")" ]
[ 23, 4 ]
[ 25, 47 ]
python
en
['en', 'en', 'en']
True
ConfigFlow.async_step_user
(self, user_input=None)
Handle the initial step.
Handle the initial step.
async def async_step_user(self, user_input=None): """Handle the initial step.""" errors = {} config_entry = self._async_current_entries() if config_entry: return self.async_abort(reason="single_instance_allowed") errors = {} if user_input is not None: ...
[ "async", "def", "async_step_user", "(", "self", ",", "user_input", "=", "None", ")", ":", "errors", "=", "{", "}", "config_entry", "=", "self", ".", "_async_current_entries", "(", ")", "if", "config_entry", ":", "return", "self", ".", "async_abort", "(", "...
[ 27, 4 ]
[ 67, 9 ]
python
en
['en', 'en', 'en']
True
OptionsFlowHandler.__init__
(self, config_entry)
Initialize options flow.
Initialize options flow.
def __init__(self, config_entry): """Initialize options flow.""" self.config_entry = config_entry
[ "def", "__init__", "(", "self", ",", "config_entry", ")", ":", "self", ".", "config_entry", "=", "config_entry" ]
[ 73, 4 ]
[ 75, 40 ]
python
en
['en', 'en', 'en']
True
OptionsFlowHandler.async_step_init
(self, user_input=None)
Manage options.
Manage options.
async def async_step_init(self, user_input=None): """Manage options.""" if user_input is not None: return self.async_create_entry(title="", data=user_input) return self.async_show_form( step_id="init", data_schema=vol.Schema( { ...
[ "async", "def", "async_step_init", "(", "self", ",", "user_input", "=", "None", ")", ":", "if", "user_input", "is", "not", "None", ":", "return", "self", ".", "async_create_entry", "(", "title", "=", "\"\"", ",", "data", "=", "user_input", ")", "return", ...
[ 77, 4 ]
[ 101, 9 ]
python
en
['en', 'en', 'en']
False
TypeHolderExample.__init__
(self, string_item=None, number_item=None, float_item=None, integer_item=None, bool_item=None, array_item=None, local_vars_configuration=None)
TypeHolderExample - a model defined in OpenAPI
TypeHolderExample - a model defined in OpenAPI
def __init__(self, string_item=None, number_item=None, float_item=None, integer_item=None, bool_item=None, array_item=None, local_vars_configuration=None): # noqa: E501 """TypeHolderExample - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configu...
[ "def", "__init__", "(", "self", ",", "string_item", "=", "None", ",", "number_item", "=", "None", ",", "float_item", "=", "None", ",", "integer_item", "=", "None", ",", "bool_item", "=", "None", ",", "array_item", "=", "None", ",", "local_vars_configuration"...
[ 52, 4 ]
[ 71, 36 ]
python
en
['en', 'en', 'en']
True
TypeHolderExample.string_item
(self)
Gets the string_item of this TypeHolderExample. # noqa: E501 :return: The string_item of this TypeHolderExample. # noqa: E501 :rtype: str
Gets the string_item of this TypeHolderExample. # noqa: E501
def string_item(self): """Gets the string_item of this TypeHolderExample. # noqa: E501 :return: The string_item of this TypeHolderExample. # noqa: E501 :rtype: str """ return self._string_item
[ "def", "string_item", "(", "self", ")", ":", "return", "self", ".", "_string_item" ]
[ 74, 4 ]
[ 81, 32 ]
python
en
['en', 'en', 'en']
True
TypeHolderExample.string_item
(self, string_item)
Sets the string_item of this TypeHolderExample. :param string_item: The string_item of this TypeHolderExample. # noqa: E501 :type string_item: str
Sets the string_item of this TypeHolderExample.
def string_item(self, string_item): """Sets the string_item of this TypeHolderExample. :param string_item: The string_item of this TypeHolderExample. # noqa: E501 :type string_item: str """ if self.local_vars_configuration.client_side_validation and string_item is None: # noq...
[ "def", "string_item", "(", "self", ",", "string_item", ")", ":", "if", "self", ".", "local_vars_configuration", ".", "client_side_validation", "and", "string_item", "is", "None", ":", "# noqa: E501", "raise", "ValueError", "(", "\"Invalid value for `string_item`, must n...
[ 84, 4 ]
[ 94, 39 ]
python
en
['en', 'en', 'en']
True
TypeHolderExample.number_item
(self)
Gets the number_item of this TypeHolderExample. # noqa: E501 :return: The number_item of this TypeHolderExample. # noqa: E501 :rtype: float
Gets the number_item of this TypeHolderExample. # noqa: E501
def number_item(self): """Gets the number_item of this TypeHolderExample. # noqa: E501 :return: The number_item of this TypeHolderExample. # noqa: E501 :rtype: float """ return self._number_item
[ "def", "number_item", "(", "self", ")", ":", "return", "self", ".", "_number_item" ]
[ 97, 4 ]
[ 104, 32 ]
python
en
['en', 'en', 'en']
True
TypeHolderExample.number_item
(self, number_item)
Sets the number_item of this TypeHolderExample. :param number_item: The number_item of this TypeHolderExample. # noqa: E501 :type number_item: float
Sets the number_item of this TypeHolderExample.
def number_item(self, number_item): """Sets the number_item of this TypeHolderExample. :param number_item: The number_item of this TypeHolderExample. # noqa: E501 :type number_item: float """ if self.local_vars_configuration.client_side_validation and number_item is None: # n...
[ "def", "number_item", "(", "self", ",", "number_item", ")", ":", "if", "self", ".", "local_vars_configuration", ".", "client_side_validation", "and", "number_item", "is", "None", ":", "# noqa: E501", "raise", "ValueError", "(", "\"Invalid value for `number_item`, must n...
[ 107, 4 ]
[ 117, 39 ]
python
en
['en', 'en', 'en']
True
TypeHolderExample.float_item
(self)
Gets the float_item of this TypeHolderExample. # noqa: E501 :return: The float_item of this TypeHolderExample. # noqa: E501 :rtype: float
Gets the float_item of this TypeHolderExample. # noqa: E501
def float_item(self): """Gets the float_item of this TypeHolderExample. # noqa: E501 :return: The float_item of this TypeHolderExample. # noqa: E501 :rtype: float """ return self._float_item
[ "def", "float_item", "(", "self", ")", ":", "return", "self", ".", "_float_item" ]
[ 120, 4 ]
[ 127, 31 ]
python
en
['en', 'en', 'en']
True
TypeHolderExample.float_item
(self, float_item)
Sets the float_item of this TypeHolderExample. :param float_item: The float_item of this TypeHolderExample. # noqa: E501 :type float_item: float
Sets the float_item of this TypeHolderExample.
def float_item(self, float_item): """Sets the float_item of this TypeHolderExample. :param float_item: The float_item of this TypeHolderExample. # noqa: E501 :type float_item: float """ if self.local_vars_configuration.client_side_validation and float_item is None: # noqa: E5...
[ "def", "float_item", "(", "self", ",", "float_item", ")", ":", "if", "self", ".", "local_vars_configuration", ".", "client_side_validation", "and", "float_item", "is", "None", ":", "# noqa: E501", "raise", "ValueError", "(", "\"Invalid value for `float_item`, must not b...
[ 130, 4 ]
[ 140, 37 ]
python
en
['en', 'en', 'en']
True
TypeHolderExample.integer_item
(self)
Gets the integer_item of this TypeHolderExample. # noqa: E501 :return: The integer_item of this TypeHolderExample. # noqa: E501 :rtype: int
Gets the integer_item of this TypeHolderExample. # noqa: E501
def integer_item(self): """Gets the integer_item of this TypeHolderExample. # noqa: E501 :return: The integer_item of this TypeHolderExample. # noqa: E501 :rtype: int """ return self._integer_item
[ "def", "integer_item", "(", "self", ")", ":", "return", "self", ".", "_integer_item" ]
[ 143, 4 ]
[ 150, 33 ]
python
en
['en', 'en', 'en']
True
TypeHolderExample.integer_item
(self, integer_item)
Sets the integer_item of this TypeHolderExample. :param integer_item: The integer_item of this TypeHolderExample. # noqa: E501 :type integer_item: int
Sets the integer_item of this TypeHolderExample.
def integer_item(self, integer_item): """Sets the integer_item of this TypeHolderExample. :param integer_item: The integer_item of this TypeHolderExample. # noqa: E501 :type integer_item: int """ if self.local_vars_configuration.client_side_validation and integer_item is None:...
[ "def", "integer_item", "(", "self", ",", "integer_item", ")", ":", "if", "self", ".", "local_vars_configuration", ".", "client_side_validation", "and", "integer_item", "is", "None", ":", "# noqa: E501", "raise", "ValueError", "(", "\"Invalid value for `integer_item`, mu...
[ 153, 4 ]
[ 163, 41 ]
python
en
['en', 'en', 'en']
True
TypeHolderExample.bool_item
(self)
Gets the bool_item of this TypeHolderExample. # noqa: E501 :return: The bool_item of this TypeHolderExample. # noqa: E501 :rtype: bool
Gets the bool_item of this TypeHolderExample. # noqa: E501
def bool_item(self): """Gets the bool_item of this TypeHolderExample. # noqa: E501 :return: The bool_item of this TypeHolderExample. # noqa: E501 :rtype: bool """ return self._bool_item
[ "def", "bool_item", "(", "self", ")", ":", "return", "self", ".", "_bool_item" ]
[ 166, 4 ]
[ 173, 30 ]
python
en
['en', 'en', 'en']
True
TypeHolderExample.bool_item
(self, bool_item)
Sets the bool_item of this TypeHolderExample. :param bool_item: The bool_item of this TypeHolderExample. # noqa: E501 :type bool_item: bool
Sets the bool_item of this TypeHolderExample.
def bool_item(self, bool_item): """Sets the bool_item of this TypeHolderExample. :param bool_item: The bool_item of this TypeHolderExample. # noqa: E501 :type bool_item: bool """ if self.local_vars_configuration.client_side_validation and bool_item is None: # noqa: E501 ...
[ "def", "bool_item", "(", "self", ",", "bool_item", ")", ":", "if", "self", ".", "local_vars_configuration", ".", "client_side_validation", "and", "bool_item", "is", "None", ":", "# noqa: E501", "raise", "ValueError", "(", "\"Invalid value for `bool_item`, must not be `N...
[ 176, 4 ]
[ 186, 35 ]
python
en
['en', 'en', 'en']
True
TypeHolderExample.array_item
(self)
Gets the array_item of this TypeHolderExample. # noqa: E501 :return: The array_item of this TypeHolderExample. # noqa: E501 :rtype: list[int]
Gets the array_item of this TypeHolderExample. # noqa: E501
def array_item(self): """Gets the array_item of this TypeHolderExample. # noqa: E501 :return: The array_item of this TypeHolderExample. # noqa: E501 :rtype: list[int] """ return self._array_item
[ "def", "array_item", "(", "self", ")", ":", "return", "self", ".", "_array_item" ]
[ 189, 4 ]
[ 196, 31 ]
python
en
['en', 'en', 'en']
True
TypeHolderExample.array_item
(self, array_item)
Sets the array_item of this TypeHolderExample. :param array_item: The array_item of this TypeHolderExample. # noqa: E501 :type array_item: list[int]
Sets the array_item of this TypeHolderExample.
def array_item(self, array_item): """Sets the array_item of this TypeHolderExample. :param array_item: The array_item of this TypeHolderExample. # noqa: E501 :type array_item: list[int] """ if self.local_vars_configuration.client_side_validation and array_item is None: # noqa...
[ "def", "array_item", "(", "self", ",", "array_item", ")", ":", "if", "self", ".", "local_vars_configuration", ".", "client_side_validation", "and", "array_item", "is", "None", ":", "# noqa: E501", "raise", "ValueError", "(", "\"Invalid value for `array_item`, must not b...
[ 199, 4 ]
[ 209, 37 ]
python
en
['en', 'en', 'en']
True
TypeHolderExample.to_dict
(self, serialize=False)
Returns the model properties as a dict
Returns the model properties as a dict
def to_dict(self, serialize=False): """Returns the model properties as a dict""" result = {} def convert(x): if hasattr(x, "to_dict"): args = inspect.getargspec(x.to_dict).args if len(args) == 1: return x.to_dict() ...
[ "def", "to_dict", "(", "self", ",", "serialize", "=", "False", ")", ":", "result", "=", "{", "}", "def", "convert", "(", "x", ")", ":", "if", "hasattr", "(", "x", ",", "\"to_dict\"", ")", ":", "args", "=", "inspect", ".", "getargspec", "(", "x", ...
[ 211, 4 ]
[ 241, 21 ]
python
en
['en', 'en', 'en']
True
TypeHolderExample.to_str
(self)
Returns the string representation of the model
Returns the string representation of the model
def to_str(self): """Returns the string representation of the model""" return pprint.pformat(self.to_dict())
[ "def", "to_str", "(", "self", ")", ":", "return", "pprint", ".", "pformat", "(", "self", ".", "to_dict", "(", ")", ")" ]
[ 243, 4 ]
[ 245, 45 ]
python
en
['en', 'en', 'en']
True
TypeHolderExample.__repr__
(self)
For `print` and `pprint`
For `print` and `pprint`
def __repr__(self): """For `print` and `pprint`""" return self.to_str()
[ "def", "__repr__", "(", "self", ")", ":", "return", "self", ".", "to_str", "(", ")" ]
[ 247, 4 ]
[ 249, 28 ]
python
en
['en', 'en', 'en']
True
TypeHolderExample.__eq__
(self, other)
Returns true if both objects are equal
Returns true if both objects are equal
def __eq__(self, other): """Returns true if both objects are equal""" if not isinstance(other, TypeHolderExample): return False return self.to_dict() == other.to_dict()
[ "def", "__eq__", "(", "self", ",", "other", ")", ":", "if", "not", "isinstance", "(", "other", ",", "TypeHolderExample", ")", ":", "return", "False", "return", "self", ".", "to_dict", "(", ")", "==", "other", ".", "to_dict", "(", ")" ]
[ 251, 4 ]
[ 256, 48 ]
python
en
['en', 'en', 'en']
True
TypeHolderExample.__ne__
(self, other)
Returns true if both objects are not equal
Returns true if both objects are not equal
def __ne__(self, other): """Returns true if both objects are not equal""" if not isinstance(other, TypeHolderExample): return True return self.to_dict() != other.to_dict()
[ "def", "__ne__", "(", "self", ",", "other", ")", ":", "if", "not", "isinstance", "(", "other", ",", "TypeHolderExample", ")", ":", "return", "True", "return", "self", ".", "to_dict", "(", ")", "!=", "other", ".", "to_dict", "(", ")" ]
[ 258, 4 ]
[ 263, 48 ]
python
en
['en', 'en', 'en']
True
load
(root)
Given a source directory (root) of a package, return an importlib.metadata.Distribution object with metadata build from that package.
Given a source directory (root) of a package, return an importlib.metadata.Distribution object with metadata build from that package.
def load(root): """ Given a source directory (root) of a package, return an importlib.metadata.Distribution object with metadata build from that package. """ root = os.path.expanduser(root) system = compat_system(root) builder = functools.partial(build, source_dir=root, system=system) ...
[ "def", "load", "(", "root", ")", ":", "root", "=", "os", ".", "path", ".", "expanduser", "(", "root", ")", "system", "=", "compat_system", "(", "root", ")", "builder", "=", "functools", ".", "partial", "(", "build", ",", "source_dir", "=", "root", ",...
[ 61, 0 ]
[ 71, 42 ]
python
en
['en', 'error', 'th']
False
test_egg_release_file_read_and_written
(archive, remove)
Verify the egg release file is read from file and written to the archive
Verify the egg release file is read from file and written to the archive
def test_egg_release_file_read_and_written(archive, remove): ''' Verify the egg release file is read from file and written to the archive ''' if six.PY3: open_name = 'builtins.open' else: open_name = '__builtin__.open' with patch(open_name, create=True) as mock_open: ...
[ "def", "test_egg_release_file_read_and_written", "(", "archive", ",", "remove", ")", ":", "if", "six", ".", "PY3", ":", "open_name", "=", "'builtins.open'", "else", ":", "open_name", "=", "'__builtin__.open'", "with", "patch", "(", "open_name", ",", "create", "=...
[ 10, 0 ]
[ 26, 95 ]
python
en
['en', 'error', 'th']
False
test_egg_release_file_read_and_written_no_delete
(archive, remove)
Verify the egg release file is read from file and written to the archive, even if the file cannot be deleted
Verify the egg release file is read from file and written to the archive, even if the file cannot be deleted
def test_egg_release_file_read_and_written_no_delete(archive, remove): ''' Verify the egg release file is read from file and written to the archive, even if the file cannot be deleted ''' if six.PY3: open_name = 'builtins.open' else: open_name = '__builtin__.open' remove.sid...
[ "def", "test_egg_release_file_read_and_written_no_delete", "(", "archive", ",", "remove", ")", ":", "if", "six", ".", "PY3", ":", "open_name", "=", "'builtins.open'", "else", ":", "open_name", "=", "'__builtin__.open'", "remove", ".", "side_effect", "=", "OSError", ...
[ 31, 0 ]
[ 49, 95 ]
python
en
['en', 'error', 'th']
False
test_egg_release_file_read_and_written_no_read
(archive, remove)
Verify that when the egg release file cannot be read, a blank string is written to the archive
Verify that when the egg release file cannot be read, a blank string is written to the archive
def test_egg_release_file_read_and_written_no_read(archive, remove): ''' Verify that when the egg release file cannot be read, a blank string is written to the archive ''' if six.PY3: open_name = 'builtins.open' else: open_name = '__builtin__.open' remove.side_effect = OSErr...
[ "def", "test_egg_release_file_read_and_written_no_read", "(", "archive", ",", "remove", ")", ":", "if", "six", ".", "PY3", ":", "open_name", "=", "'builtins.open'", "else", ":", "open_name", "=", "'__builtin__.open'", "remove", ".", "side_effect", "=", "OSError", ...
[ 54, 0 ]
[ 72, 85 ]
python
en
['en', 'error', 'th']
False
async_setup_addon_panel
(hass: HomeAssistant, hassio)
Add-on Ingress Panel setup.
Add-on Ingress Panel setup.
async def async_setup_addon_panel(hass: HomeAssistant, hassio): """Add-on Ingress Panel setup.""" hassio_addon_panel = HassIOAddonPanel(hass, hassio) hass.http.register_view(hassio_addon_panel) # If panels are exists panels = await hassio_addon_panel.get_panels() if not panels: return ...
[ "async", "def", "async_setup_addon_panel", "(", "hass", ":", "HomeAssistant", ",", "hassio", ")", ":", "hassio_addon_panel", "=", "HassIOAddonPanel", "(", "hass", ",", "hassio", ")", "hass", ".", "http", ".", "register_view", "(", "hassio_addon_panel", ")", "# I...
[ 16, 0 ]
[ 34, 32 ]
python
en
['en', 'jv', 'en']
True
_register_panel
(hass, addon, data)
Init coroutine to register the panel.
Init coroutine to register the panel.
async def _register_panel(hass, addon, data): """Init coroutine to register the panel.""" await hass.components.panel_custom.async_register_panel( frontend_url_path=addon, webcomponent_name="hassio-main", sidebar_title=data[ATTR_TITLE], sidebar_icon=data[ATTR_ICON], js_ur...
[ "async", "def", "_register_panel", "(", "hass", ",", "addon", ",", "data", ")", ":", "await", "hass", ".", "components", ".", "panel_custom", ".", "async_register_panel", "(", "frontend_url_path", "=", "addon", ",", "webcomponent_name", "=", "\"hassio-main\"", "...
[ 77, 0 ]
[ 88, 5 ]
python
en
['en', 'en', 'en']
True
HassIOAddonPanel.__init__
(self, hass, hassio)
Initialize WebView.
Initialize WebView.
def __init__(self, hass, hassio): """Initialize WebView.""" self.hass = hass self.hassio = hassio
[ "def", "__init__", "(", "self", ",", "hass", ",", "hassio", ")", ":", "self", ".", "hass", "=", "hass", "self", ".", "hassio", "=", "hassio" ]
[ 43, 4 ]
[ 46, 28 ]
python
en
['en', 'en', 'it']
False
HassIOAddonPanel.post
(self, request, addon)
Handle new add-on panel requests.
Handle new add-on panel requests.
async def post(self, request, addon): """Handle new add-on panel requests.""" panels = await self.get_panels() # Panel exists for add-on slug if addon not in panels or not panels[addon][ATTR_ENABLE]: _LOGGER.error("Panel is not enable for %s", addon) return web.R...
[ "async", "def", "post", "(", "self", ",", "request", ",", "addon", ")", ":", "panels", "=", "await", "self", ".", "get_panels", "(", ")", "# Panel exists for add-on slug", "if", "addon", "not", "in", "panels", "or", "not", "panels", "[", "addon", "]", "[...
[ 48, 4 ]
[ 60, 29 ]
python
en
['it', 'en', 'en']
True
HassIOAddonPanel.delete
(self, request, addon)
Handle remove add-on panel requests.
Handle remove add-on panel requests.
async def delete(self, request, addon): """Handle remove add-on panel requests.""" self.hass.components.frontend.async_remove_panel(addon) return web.Response()
[ "async", "def", "delete", "(", "self", ",", "request", ",", "addon", ")", ":", "self", ".", "hass", ".", "components", ".", "frontend", ".", "async_remove_panel", "(", "addon", ")", "return", "web", ".", "Response", "(", ")" ]
[ 62, 4 ]
[ 65, 29 ]
python
en
['it', 'en', 'en']
True
HassIOAddonPanel.get_panels
(self)
Return panels add-on info data.
Return panels add-on info data.
async def get_panels(self): """Return panels add-on info data.""" try: data = await self.hassio.get_ingress_panels() return data[ATTR_PANELS] except HassioAPIError as err: _LOGGER.error("Can't read panel info: %s", err) return {}
[ "async", "def", "get_panels", "(", "self", ")", ":", "try", ":", "data", "=", "await", "self", ".", "hassio", ".", "get_ingress_panels", "(", ")", "return", "data", "[", "ATTR_PANELS", "]", "except", "HassioAPIError", "as", "err", ":", "_LOGGER", ".", "e...
[ 67, 4 ]
[ 74, 17 ]
python
en
['lv', 'no', 'en']
False
ConfigFlow.async_get_options_flow
( config_entry: config_entries.ConfigEntry, )
Define the config flow to handle options.
Define the config flow to handle options.
def async_get_options_flow( config_entry: config_entries.ConfigEntry, ) -> config_entries.OptionsFlow: """Define the config flow to handle options.""" return RecollectWasteOptionsFlowHandler(config_entry)
[ "def", "async_get_options_flow", "(", "config_entry", ":", "config_entries", ".", "ConfigEntry", ",", ")", "->", "config_entries", ".", "OptionsFlow", ":", "return", "RecollectWasteOptionsFlowHandler", "(", "config_entry", ")" ]
[ 29, 4 ]
[ 33, 61 ]
python
en
['en', 'en', 'en']
True
ConfigFlow.async_step_user
( self, user_input: dict[str, Any] | None = None )
Handle configuration via the UI.
Handle configuration via the UI.
async def async_step_user( self, user_input: dict[str, Any] | None = None ) -> FlowResult: """Handle configuration via the UI.""" if user_input is None: return self.async_show_form( step_id="user", data_schema=DATA_SCHEMA, errors={} ) unique_i...
[ "async", "def", "async_step_user", "(", "self", ",", "user_input", ":", "dict", "[", "str", ",", "Any", "]", "|", "None", "=", "None", ")", "->", "FlowResult", ":", "if", "user_input", "is", "None", ":", "return", "self", ".", "async_show_form", "(", "...
[ 35, 4 ]
[ 70, 9 ]
python
en
['en', 'haw', 'en']
True
RecollectWasteOptionsFlowHandler.__init__
(self, entry: config_entries.ConfigEntry)
Initialize.
Initialize.
def __init__(self, entry: config_entries.ConfigEntry) -> None: """Initialize.""" self._entry = entry
[ "def", "__init__", "(", "self", ",", "entry", ":", "config_entries", ".", "ConfigEntry", ")", "->", "None", ":", "self", ".", "_entry", "=", "entry" ]
[ 76, 4 ]
[ 78, 27 ]
python
en
['en', 'en', 'it']
False
RecollectWasteOptionsFlowHandler.async_step_init
( self, user_input: dict[str, Any] | None = None )
Manage the options.
Manage the options.
async def async_step_init( self, user_input: dict[str, Any] | None = None ) -> FlowResult: """Manage the options.""" if user_input is not None: return self.async_create_entry(title="", data=user_input) return self.async_show_form( step_id="init", ...
[ "async", "def", "async_step_init", "(", "self", ",", "user_input", ":", "dict", "[", "str", ",", "Any", "]", "|", "None", "=", "None", ")", "->", "FlowResult", ":", "if", "user_input", "is", "not", "None", ":", "return", "self", ".", "async_create_entry"...
[ 80, 4 ]
[ 97, 9 ]
python
en
['en', 'en', 'en']
True
TestPetApi.test_add_pet
(self)
Test case for add_pet Add a new pet to the store # noqa: E501
Test case for add_pet
def test_add_pet(self): """Test case for add_pet Add a new pet to the store # noqa: E501 """ pass
[ "def", "test_add_pet", "(", "self", ")", ":", "pass" ]
[ 27, 4 ]
[ 32, 12 ]
python
en
['en', 'en', 'en']
True
TestPetApi.test_delete_pet
(self)
Test case for delete_pet Deletes a pet # noqa: E501
Test case for delete_pet
def test_delete_pet(self): """Test case for delete_pet Deletes a pet # noqa: E501 """ pass
[ "def", "test_delete_pet", "(", "self", ")", ":", "pass" ]
[ 34, 4 ]
[ 39, 12 ]
python
da
['da', 'fr', 'en']
False
TestPetApi.test_find_pets_by_status
(self)
Test case for find_pets_by_status Finds Pets by status # noqa: E501
Test case for find_pets_by_status
def test_find_pets_by_status(self): """Test case for find_pets_by_status Finds Pets by status # noqa: E501 """ pass
[ "def", "test_find_pets_by_status", "(", "self", ")", ":", "pass" ]
[ 41, 4 ]
[ 46, 12 ]
python
en
['en', 'en', 'en']
True
TestPetApi.test_find_pets_by_tags
(self)
Test case for find_pets_by_tags Finds Pets by tags # noqa: E501
Test case for find_pets_by_tags
def test_find_pets_by_tags(self): """Test case for find_pets_by_tags Finds Pets by tags # noqa: E501 """ pass
[ "def", "test_find_pets_by_tags", "(", "self", ")", ":", "pass" ]
[ 48, 4 ]
[ 53, 12 ]
python
en
['en', 'en', 'en']
True
TestPetApi.test_get_pet_by_id
(self)
Test case for get_pet_by_id Find pet by ID # noqa: E501
Test case for get_pet_by_id
def test_get_pet_by_id(self): """Test case for get_pet_by_id Find pet by ID # noqa: E501 """ pass
[ "def", "test_get_pet_by_id", "(", "self", ")", ":", "pass" ]
[ 55, 4 ]
[ 60, 12 ]
python
en
['da', 'en', 'en']
True
TestPetApi.test_update_pet
(self)
Test case for update_pet Update an existing pet # noqa: E501
Test case for update_pet
def test_update_pet(self): """Test case for update_pet Update an existing pet # noqa: E501 """ pass
[ "def", "test_update_pet", "(", "self", ")", ":", "pass" ]
[ 62, 4 ]
[ 67, 12 ]
python
en
['en', 'en', 'en']
True
TestPetApi.test_update_pet_with_form
(self)
Test case for update_pet_with_form Updates a pet in the store with form data # noqa: E501
Test case for update_pet_with_form
def test_update_pet_with_form(self): """Test case for update_pet_with_form Updates a pet in the store with form data # noqa: E501 """ pass
[ "def", "test_update_pet_with_form", "(", "self", ")", ":", "pass" ]
[ 69, 4 ]
[ 74, 12 ]
python
en
['en', 'en', 'en']
True
TestPetApi.test_upload_file
(self)
Test case for upload_file uploads an image # noqa: E501
Test case for upload_file
def test_upload_file(self): """Test case for upload_file uploads an image # noqa: E501 """ pass
[ "def", "test_upload_file", "(", "self", ")", ":", "pass" ]
[ 76, 4 ]
[ 81, 12 ]
python
en
['en', 'da', 'en']
True
TestPetApi.test_upload_file_with_required_file
(self)
Test case for upload_file_with_required_file uploads an image (required) # noqa: E501
Test case for upload_file_with_required_file
def test_upload_file_with_required_file(self): """Test case for upload_file_with_required_file uploads an image (required) # noqa: E501 """ pass
[ "def", "test_upload_file_with_required_file", "(", "self", ")", ":", "pass" ]
[ 83, 4 ]
[ 88, 12 ]
python
en
['en', 'en', 'en']
True
async_setup
(hass: HomeAssistant, config: ConfigType)
Set up the xbox component.
Set up the xbox component.
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up the xbox component.""" hass.data[DOMAIN] = {} if DOMAIN not in config: return True config_flow.OAuth2FlowHandler.async_register_implementation( hass, config_entry_oauth2_flow.LocalOAuth2Implementa...
[ "async", "def", "async_setup", "(", "hass", ":", "HomeAssistant", ",", "config", ":", "ConfigType", ")", "->", "bool", ":", "hass", ".", "data", "[", "DOMAIN", "]", "=", "{", "}", "if", "DOMAIN", "not", "in", "config", ":", "return", "True", "config_fl...
[ 53, 0 ]
[ 72, 15 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
(hass: HomeAssistant, entry: ConfigEntry)
Set up xbox from a config entry.
Set up xbox from a config entry.
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: """Set up xbox from a config entry.""" implementation = ( await config_entry_oauth2_flow.async_get_config_entry_implementation( hass, entry ) ) session = config_entry_oauth2_flow.OAuth2Session(hass,...
[ "async", "def", "async_setup_entry", "(", "hass", ":", "HomeAssistant", ",", "entry", ":", "ConfigEntry", ")", "->", "bool", ":", "implementation", "=", "(", "await", "config_entry_oauth2_flow", ".", "async_get_config_entry_implementation", "(", "hass", ",", "entry"...
[ 75, 0 ]
[ 106, 15 ]
python
en
['en', 'en', 'en']
True
async_unload_entry
(hass: HomeAssistant, entry: ConfigEntry)
Unload a config entry.
Unload a config entry.
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry): """Unload a config entry.""" unload_ok = await hass.config_entries.async_unload_platforms(entry, PLATFORMS) if unload_ok: # Unsub from coordinator updates hass.data[DOMAIN][entry.entry_id]["sensor_unsub"]() hass.d...
[ "async", "def", "async_unload_entry", "(", "hass", ":", "HomeAssistant", ",", "entry", ":", "ConfigEntry", ")", ":", "unload_ok", "=", "await", "hass", ".", "config_entries", ".", "async_unload_platforms", "(", "entry", ",", "PLATFORMS", ")", "if", "unload_ok", ...
[ 109, 0 ]
[ 118, 20 ]
python
en
['en', 'es', 'en']
True
_build_presence_data
(person: Person)
Build presence data from a person.
Build presence data from a person.
def _build_presence_data(person: Person) -> PresenceData: """Build presence data from a person.""" active_app: PresenceDetail | None = None with suppress(StopIteration): active_app = next( presence for presence in person.presence_details if presence.is_primary ) return Prese...
[ "def", "_build_presence_data", "(", "person", ":", "Person", ")", "->", "PresenceData", ":", "active_app", ":", "PresenceDetail", "|", "None", "=", "None", "with", "suppress", "(", "StopIteration", ")", ":", "active_app", "=", "next", "(", "presence", "for", ...
[ 237, 0 ]
[ 257, 5 ]
python
en
['en', 'en', 'en']
True
XboxUpdateCoordinator.__init__
( self, hass: HomeAssistant, client: XboxLiveClient, consoles: SmartglassConsoleList, )
Initialize.
Initialize.
def __init__( self, hass: HomeAssistant, client: XboxLiveClient, consoles: SmartglassConsoleList, ) -> None: """Initialize.""" super().__init__( hass, _LOGGER, name=DOMAIN, update_interval=timedelta(seconds=10), ...
[ "def", "__init__", "(", "self", ",", "hass", ":", "HomeAssistant", ",", "client", ":", "XboxLiveClient", ",", "consoles", ":", "SmartglassConsoleList", ",", ")", "->", "None", ":", "super", "(", ")", ".", "__init__", "(", "hass", ",", "_LOGGER", ",", "na...
[ 157, 4 ]
[ 172, 55 ]
python
en
['en', 'en', 'it']
False
XboxUpdateCoordinator._async_update_data
(self)
Fetch the latest console status.
Fetch the latest console status.
async def _async_update_data(self) -> XboxData: """Fetch the latest console status.""" # Update Console Status new_console_data: dict[str, ConsoleData] = {} for console in self.consoles.result: current_state: ConsoleData | None = self.data.consoles.get(console.id) ...
[ "async", "def", "_async_update_data", "(", "self", ")", "->", "XboxData", ":", "# Update Console Status", "new_console_data", ":", "dict", "[", "str", ",", "ConsoleData", "]", "=", "{", "}", "for", "console", "in", "self", ".", "consoles", ".", "result", ":"...
[ 174, 4 ]
[ 234, 56 ]
python
en
['en', 'en', 'en']
True
_command_line_ok
(_cache=None)
Return True if command line does not contain any help or display requests.
Return True if command line does not contain any help or display requests.
def _command_line_ok(_cache=None): """ Return True if command line does not contain any help or display requests. """ if _cache: return _cache[0] elif _cache is None: _cache = [] ok = True display_opts = ['--'+n for n in Distribution.display_option_names] for o in Distrib...
[ "def", "_command_line_ok", "(", "_cache", "=", "None", ")", ":", "if", "_cache", ":", "return", "_cache", "[", "0", "]", "elif", "_cache", "is", "None", ":", "_cache", "=", "[", "]", "ok", "=", "True", "display_opts", "=", "[", "'--'", "+", "n", "f...
[ 71, 0 ]
[ 89, 13 ]
python
en
['en', 'en', 'en']
True
serialize
(input, tree="etree", encoding=None, **serializer_opts)
Serializes the input token stream using the specified treewalker :arg input: the token stream to serialize :arg tree: the treewalker to use :arg encoding: the encoding to use :arg serializer_opts: any options to pass to the :py:class:`html5lib.serializer.HTMLSerializer` that gets created ...
Serializes the input token stream using the specified treewalker
def serialize(input, tree="etree", encoding=None, **serializer_opts): """Serializes the input token stream using the specified treewalker :arg input: the token stream to serialize :arg tree: the treewalker to use :arg encoding: the encoding to use :arg serializer_opts: any options to pass to the...
[ "def", "serialize", "(", "input", ",", "tree", "=", "\"etree\"", ",", "encoding", "=", "None", ",", "*", "*", "serializer_opts", ")", ":", "# XXX: Should we cache this?", "walker", "=", "treewalkers", ".", "getTreeWalker", "(", "tree", ")", "s", "=", "HTMLSe...
[ 74, 0 ]
[ 100, 44 ]
python
en
['en', 'en', 'en']
True
HTMLSerializer.__init__
(self, **kwargs)
Initialize HTMLSerializer :arg inject_meta_charset: Whether or not to inject the meta charset. Defaults to ``True``. :arg quote_attr_values: Whether to quote attribute values that don't require quoting per legacy browser behavior (``"legacy"``), when required by th...
Initialize HTMLSerializer
def __init__(self, **kwargs): """Initialize HTMLSerializer :arg inject_meta_charset: Whether or not to inject the meta charset. Defaults to ``True``. :arg quote_attr_values: Whether to quote attribute values that don't require quoting per legacy browser behavior (``"le...
[ "def", "__init__", "(", "self", ",", "*", "*", "kwargs", ")", ":", "unexpected_args", "=", "frozenset", "(", "kwargs", ")", "-", "frozenset", "(", "self", ".", "options", ")", "if", "len", "(", "unexpected_args", ")", ">", "0", ":", "raise", "TypeError...
[ 134, 4 ]
[ 221, 27 ]
python
de
['de', 'en', 'nl']
False
HTMLSerializer.render
(self, treewalker, encoding=None)
Serializes the stream from the treewalker into a string :arg treewalker: the treewalker to serialize :arg encoding: the string encoding to use :returns: the serialized tree Example: >>> from html5lib import parse, getTreeWalker >>> from html5lib.serializer import HTM...
Serializes the stream from the treewalker into a string
def render(self, treewalker, encoding=None): """Serializes the stream from the treewalker into a string :arg treewalker: the treewalker to serialize :arg encoding: the string encoding to use :returns: the serialized tree Example: >>> from html5lib import parse, getTr...
[ "def", "render", "(", "self", ",", "treewalker", ",", "encoding", "=", "None", ")", ":", "if", "encoding", ":", "return", "b\"\"", ".", "join", "(", "list", "(", "self", ".", "serialize", "(", "treewalker", ",", "encoding", ")", ")", ")", "else", ":"...
[ 374, 4 ]
[ 397, 60 ]
python
en
['en', 'en', 'en']
True
com_port
()
Mock of a serial port.
Mock of a serial port.
def com_port(): """Mock of a serial port.""" port = serial.tools.list_ports_common.ListPortInfo("/dev/ttyUSB1234") port.serial_number = "1234" port.manufacturer = "Virtual serial port" port.device = "/dev/ttyUSB1234" port.description = "Some serial port" return port
[ "def", "com_port", "(", ")", ":", "port", "=", "serial", ".", "tools", ".", "list_ports_common", ".", "ListPortInfo", "(", "\"/dev/ttyUSB1234\"", ")", "port", ".", "serial_number", "=", "\"1234\"", "port", ".", "manufacturer", "=", "\"Virtual serial port\"", "po...
[ 18, 0 ]
[ 26, 15 ]
python
en
['en', 'en', 'en']
True
test_setup_network
(hass, dsmr_connection_send_validate_fixture)
Test we can setup network.
Test we can setup network.
async def test_setup_network(hass, dsmr_connection_send_validate_fixture): """Test we can setup network.""" result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) assert result["type"] == "form" assert result["step_id"] == "user" ass...
[ "async", "def", "test_setup_network", "(", "hass", ",", "dsmr_connection_send_validate_fixture", ")", ":", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "DOMAIN", ",", "context", "=", "{", "\"source\"", ":", "config_...
[ 29, 0 ]
[ 62, 58 ]
python
en
['en', 'en', 'en']
True
test_setup_serial
(com_mock, hass, dsmr_connection_send_validate_fixture)
Test we can setup serial.
Test we can setup serial.
async def test_setup_serial(com_mock, hass, dsmr_connection_send_validate_fixture): """Test we can setup serial.""" port = com_port() result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) assert result["type"] == "form" assert resu...
[ "async", "def", "test_setup_serial", "(", "com_mock", ",", "hass", ",", "dsmr_connection_send_validate_fixture", ")", ":", "port", "=", "com_port", "(", ")", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "DOMAIN", ...
[ 66, 0 ]
[ 99, 58 ]
python
en
['en', 'en', 'en']
True
test_setup_serial_manual
( com_mock, hass, dsmr_connection_send_validate_fixture )
Test we can setup serial with manual entry.
Test we can setup serial with manual entry.
async def test_setup_serial_manual( com_mock, hass, dsmr_connection_send_validate_fixture ): """Test we can setup serial with manual entry.""" result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) assert result["type"] == "form" ass...
[ "async", "def", "test_setup_serial_manual", "(", "com_mock", ",", "hass", ",", "dsmr_connection_send_validate_fixture", ")", ":", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "DOMAIN", ",", "context", "=", "{", "\"s...
[ 103, 0 ]
[ 144, 58 ]
python
en
['en', 'en', 'en']
True
test_setup_serial_fail
(com_mock, hass, dsmr_connection_send_validate_fixture)
Test failed serial connection.
Test failed serial connection.
async def test_setup_serial_fail(com_mock, hass, dsmr_connection_send_validate_fixture): """Test failed serial connection.""" (connection_factory, transport, protocol) = dsmr_connection_send_validate_fixture await setup.async_setup_component(hass, "persistent_notification", {}) port = com_port() ...
[ "async", "def", "test_setup_serial_fail", "(", "com_mock", ",", "hass", ",", "dsmr_connection_send_validate_fixture", ")", ":", "(", "connection_factory", ",", "transport", ",", "protocol", ")", "=", "dsmr_connection_send_validate_fixture", "await", "setup", ".", "async...
[ 148, 0 ]
[ 189, 57 ]
python
en
['en', 'ga', 'en']
True
test_setup_serial_wrong_telegram
( com_mock, hass, dsmr_connection_send_validate_fixture )
Test failed telegram data.
Test failed telegram data.
async def test_setup_serial_wrong_telegram( com_mock, hass, dsmr_connection_send_validate_fixture ): """Test failed telegram data.""" (connection_factory, transport, protocol) = dsmr_connection_send_validate_fixture await setup.async_setup_component(hass, "persistent_notification", {}) port = com_...
[ "async", "def", "test_setup_serial_wrong_telegram", "(", "com_mock", ",", "hass", ",", "dsmr_connection_send_validate_fixture", ")", ":", "(", "connection_factory", ",", "transport", ",", "protocol", ")", "=", "dsmr_connection_send_validate_fixture", "await", "setup", "."...
[ 193, 0 ]
[ 228, 61 ]
python
en
['en', 'no', 'en']
True
test_import_usb
(hass, dsmr_connection_send_validate_fixture)
Test we can import.
Test we can import.
async def test_import_usb(hass, dsmr_connection_send_validate_fixture): """Test we can import.""" await setup.async_setup_component(hass, "persistent_notification", {}) entry_data = { "port": "/dev/ttyUSB0", "dsmr_version": "2.2", "precision": 4, "reconnect_interval": 30, ...
[ "async", "def", "test_import_usb", "(", "hass", ",", "dsmr_connection_send_validate_fixture", ")", ":", "await", "setup", ".", "async_setup_component", "(", "hass", ",", "\"persistent_notification\"", ",", "{", "}", ")", "entry_data", "=", "{", "\"port\"", ":", "\...
[ 231, 0 ]
[ 251, 58 ]
python
en
['en', 'en', 'en']
True
test_import_usb_failed_connection
( hass, dsmr_connection_send_validate_fixture )
Test we can import.
Test we can import.
async def test_import_usb_failed_connection( hass, dsmr_connection_send_validate_fixture ): """Test we can import.""" (connection_factory, transport, protocol) = dsmr_connection_send_validate_fixture await setup.async_setup_component(hass, "persistent_notification", {}) entry_data = { "por...
[ "async", "def", "test_import_usb_failed_connection", "(", "hass", ",", "dsmr_connection_send_validate_fixture", ")", ":", "(", "connection_factory", ",", "transport", ",", "protocol", ")", "=", "dsmr_connection_send_validate_fixture", "await", "setup", ".", "async_setup_com...
[ 254, 0 ]
[ 288, 47 ]
python
en
['en', 'en', 'en']
True
test_import_usb_no_data
(hass, dsmr_connection_send_validate_fixture)
Test we can import.
Test we can import.
async def test_import_usb_no_data(hass, dsmr_connection_send_validate_fixture): """Test we can import.""" (connection_factory, transport, protocol) = dsmr_connection_send_validate_fixture await setup.async_setup_component(hass, "persistent_notification", {}) entry_data = { "port": "/dev/ttyUSB...
[ "async", "def", "test_import_usb_no_data", "(", "hass", ",", "dsmr_connection_send_validate_fixture", ")", ":", "(", "connection_factory", ",", "transport", ",", "protocol", ")", "=", "dsmr_connection_send_validate_fixture", "await", "setup", ".", "async_setup_component", ...
[ 291, 0 ]
[ 320, 51 ]
python
en
['en', 'en', 'en']
True
test_import_usb_wrong_telegram
(hass, dsmr_connection_send_validate_fixture)
Test we can import.
Test we can import.
async def test_import_usb_wrong_telegram(hass, dsmr_connection_send_validate_fixture): """Test we can import.""" (connection_factory, transport, protocol) = dsmr_connection_send_validate_fixture await setup.async_setup_component(hass, "persistent_notification", {}) entry_data = { "port": "/dev...
[ "async", "def", "test_import_usb_wrong_telegram", "(", "hass", ",", "dsmr_connection_send_validate_fixture", ")", ":", "(", "connection_factory", ",", "transport", ",", "protocol", ")", "=", "dsmr_connection_send_validate_fixture", "await", "setup", ".", "async_setup_compon...
[ 323, 0 ]
[ 346, 51 ]
python
en
['en', 'en', 'en']
True
test_import_network
(hass, dsmr_connection_send_validate_fixture)
Test we can import from network.
Test we can import from network.
async def test_import_network(hass, dsmr_connection_send_validate_fixture): """Test we can import from network.""" await setup.async_setup_component(hass, "persistent_notification", {}) entry_data = { "host": "localhost", "port": "1234", "dsmr_version": "2.2", "precision": 4...
[ "async", "def", "test_import_network", "(", "hass", ",", "dsmr_connection_send_validate_fixture", ")", ":", "await", "setup", ".", "async_setup_component", "(", "hass", ",", "\"persistent_notification\"", ",", "{", "}", ")", "entry_data", "=", "{", "\"host\"", ":", ...
[ 349, 0 ]
[ 370, 58 ]
python
en
['en', 'en', 'en']
True
test_import_update
(hass, dsmr_connection_send_validate_fixture)
Test we can import.
Test we can import.
async def test_import_update(hass, dsmr_connection_send_validate_fixture): """Test we can import.""" await setup.async_setup_component(hass, "persistent_notification", {}) entry_data = { "port": "/dev/ttyUSB0", "dsmr_version": "2.2", "precision": 4, "reconnect_interval": 30,...
[ "async", "def", "test_import_update", "(", "hass", ",", "dsmr_connection_send_validate_fixture", ")", ":", "await", "setup", ".", "async_setup_component", "(", "hass", ",", "\"persistent_notification\"", ",", "{", "}", ")", "entry_data", "=", "{", "\"port\"", ":", ...
[ 373, 0 ]
[ 419, 39 ]
python
en
['en', 'en', 'en']
True
test_options_flow
(hass)
Test options flow.
Test options flow.
async def test_options_flow(hass): """Test options flow.""" await setup.async_setup_component(hass, "persistent_notification", {}) entry_data = { "port": "/dev/ttyUSB0", "dsmr_version": "2.2", "precision": 4, "reconnect_interval": 30, } entry = MockConfigEntry( ...
[ "async", "def", "test_options_flow", "(", "hass", ")", ":", "await", "setup", ".", "async_setup_component", "(", "hass", ",", "\"persistent_notification\"", ",", "{", "}", ")", "entry_data", "=", "{", "\"port\"", ":", "\"/dev/ttyUSB0\"", ",", "\"dsmr_version\"", ...
[ 422, 0 ]
[ 459, 55 ]
python
en
['en', 'fr', 'en']
True
test_import_luxembourg
(hass, dsmr_connection_send_validate_fixture)
Test we can import.
Test we can import.
async def test_import_luxembourg(hass, dsmr_connection_send_validate_fixture): """Test we can import.""" await setup.async_setup_component(hass, "persistent_notification", {}) entry_data = { "port": "/dev/ttyUSB0", "dsmr_version": "5L", "precision": 4, "reconnect_interval": ...
[ "async", "def", "test_import_luxembourg", "(", "hass", ",", "dsmr_connection_send_validate_fixture", ")", ":", "await", "setup", ".", "async_setup_component", "(", "hass", ",", "\"persistent_notification\"", ",", "{", "}", ")", "entry_data", "=", "{", "\"port\"", ":...
[ 462, 0 ]
[ 482, 58 ]
python
en
['en', 'en', 'en']
True
test_import_sweden
(hass, dsmr_connection_send_validate_fixture)
Test we can import.
Test we can import.
async def test_import_sweden(hass, dsmr_connection_send_validate_fixture): """Test we can import.""" await setup.async_setup_component(hass, "persistent_notification", {}) entry_data = { "port": "/dev/ttyUSB0", "dsmr_version": "5S", "precision": 4, "reconnect_interval": 30, ...
[ "async", "def", "test_import_sweden", "(", "hass", ",", "dsmr_connection_send_validate_fixture", ")", ":", "await", "setup", ".", "async_setup_component", "(", "hass", ",", "\"persistent_notification\"", ",", "{", "}", ")", "entry_data", "=", "{", "\"port\"", ":", ...
[ 485, 0 ]
[ 505, 65 ]
python
en
['en', 'en', 'en']
True
test_get_serial_by_id_no_dir
()
Test serial by id conversion if there's no /dev/serial/by-id.
Test serial by id conversion if there's no /dev/serial/by-id.
def test_get_serial_by_id_no_dir(): """Test serial by id conversion if there's no /dev/serial/by-id.""" p1 = patch("os.path.isdir", MagicMock(return_value=False)) p2 = patch("os.scandir") with p1 as is_dir_mock, p2 as scan_mock: res = config_flow.get_serial_by_id(sentinel.path) assert re...
[ "def", "test_get_serial_by_id_no_dir", "(", ")", ":", "p1", "=", "patch", "(", "\"os.path.isdir\"", ",", "MagicMock", "(", "return_value", "=", "False", ")", ")", "p2", "=", "patch", "(", "\"os.scandir\"", ")", "with", "p1", "as", "is_dir_mock", ",", "p2", ...
[ 508, 0 ]
[ 516, 40 ]
python
en
['en', 'en', 'en']
True
test_get_serial_by_id
()
Test serial by id conversion.
Test serial by id conversion.
def test_get_serial_by_id(): """Test serial by id conversion.""" p1 = patch("os.path.isdir", MagicMock(return_value=True)) p2 = patch("os.scandir") def _realpath(path): if path is sentinel.matched_link: return sentinel.path return sentinel.serial_link_path p3 = patch("o...
[ "def", "test_get_serial_by_id", "(", ")", ":", "p1", "=", "patch", "(", "\"os.path.isdir\"", ",", "MagicMock", "(", "return_value", "=", "True", ")", ")", "p2", "=", "patch", "(", "\"os.scandir\"", ")", "def", "_realpath", "(", "path", ")", ":", "if", "p...
[ 519, 0 ]
[ 552, 40 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
(hass: HomeAssistant, entry: ConfigEntry)
Set up HVV from a config entry.
Set up HVV from a config entry.
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: """Set up HVV from a config entry.""" hub = GTIHub( entry.data[CONF_HOST], entry.data[CONF_USERNAME], entry.data[CONF_PASSWORD], aiohttp_client.async_get_clientsession(hass), ) hass.data.setde...
[ "async", "def", "async_setup_entry", "(", "hass", ":", "HomeAssistant", ",", "entry", ":", "ConfigEntry", ")", "->", "bool", ":", "hub", "=", "GTIHub", "(", "entry", ".", "data", "[", "CONF_HOST", "]", ",", "entry", ".", "data", "[", "CONF_USERNAME", "]"...
[ 15, 0 ]
[ 30, 15 ]
python
en
['en', 'en', 'en']
True
async_unload_entry
(hass: HomeAssistant, entry: ConfigEntry)
Unload a config entry.
Unload a config entry.
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry): """Unload a config entry.""" return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
[ "async", "def", "async_unload_entry", "(", "hass", ":", "HomeAssistant", ",", "entry", ":", "ConfigEntry", ")", ":", "return", "await", "hass", ".", "config_entries", ".", "async_unload_platforms", "(", "entry", ",", "PLATFORMS", ")" ]
[ 33, 0 ]
[ 35, 77 ]
python
en
['en', 'es', 'en']
True
test_no_entities
(hass, aioclient_mock)
Test the update_clients function when no clients are found.
Test the update_clients function when no clients are found.
async def test_no_entities(hass, aioclient_mock): """Test the update_clients function when no clients are found.""" await setup_unifi_integration(hass, aioclient_mock) assert len(hass.states.async_entity_ids(TRACKER_DOMAIN)) == 0
[ "async", "def", "test_no_entities", "(", "hass", ",", "aioclient_mock", ")", ":", "await", "setup_unifi_integration", "(", "hass", ",", "aioclient_mock", ")", "assert", "len", "(", "hass", ".", "states", ".", "async_entity_ids", "(", "TRACKER_DOMAIN", ")", ")", ...
[ 33, 0 ]
[ 37, 65 ]
python
en
['en', 'en', 'en']
True
test_tracked_wireless_clients
(hass, aioclient_mock, mock_unifi_websocket)
Verify tracking of wireless clients.
Verify tracking of wireless clients.
async def test_tracked_wireless_clients(hass, aioclient_mock, mock_unifi_websocket): """Verify tracking of wireless clients.""" client = { "ap_mac": "00:00:00:00:02:01", "essid": "ssid", "hostname": "client", "ip": "10.0.0.1", "is_wired": False, "last_seen": 15626...
[ "async", "def", "test_tracked_wireless_clients", "(", "hass", ",", "aioclient_mock", ",", "mock_unifi_websocket", ")", ":", "client", "=", "{", "\"ap_mac\"", ":", "\"00:00:00:00:02:01\"", ",", "\"essid\"", ":", "\"ssid\"", ",", "\"hostname\"", ":", "\"client\"", ","...
[ 40, 0 ]
[ 139, 71 ]
python
en
['en', 'en', 'en']
True
test_tracked_clients
(hass, aioclient_mock, mock_unifi_websocket)
Test the update_items function with some clients.
Test the update_items function with some clients.
async def test_tracked_clients(hass, aioclient_mock, mock_unifi_websocket): """Test the update_items function with some clients.""" client_1 = { "ap_mac": "00:00:00:00:02:01", "essid": "ssid", "hostname": "client_1", "ip": "10.0.0.1", "is_wired": False, "last_seen...
[ "async", "def", "test_tracked_clients", "(", "hass", ",", "aioclient_mock", ",", "mock_unifi_websocket", ")", ":", "client_1", "=", "{", "\"ap_mac\"", ":", "\"00:00:00:00:02:01\"", ",", "\"essid\"", ":", "\"ssid\"", ",", "\"hostname\"", ":", "\"client_1\"", ",", "...
[ 142, 0 ]
[ 216, 73 ]
python
en
['en', 'en', 'en']
True
test_tracked_devices
(hass, aioclient_mock, mock_unifi_websocket)
Test the update_items function with some devices.
Test the update_items function with some devices.
async def test_tracked_devices(hass, aioclient_mock, mock_unifi_websocket): """Test the update_items function with some devices.""" device_1 = { "board_rev": 3, "device_id": "mock-id", "has_fan": True, "fan_level": 0, "ip": "10.0.1.1", "last_seen": 1562600145, ...
[ "async", "def", "test_tracked_devices", "(", "hass", ",", "aioclient_mock", ",", "mock_unifi_websocket", ")", ":", "device_1", "=", "{", "\"board_rev\"", ":", "3", ",", "\"device_id\"", ":", "\"mock-id\"", ",", "\"has_fan\"", ":", "True", ",", "\"fan_level\"", "...
[ 219, 0 ]
[ 341, 51 ]
python
en
['en', 'en', 'en']
True
test_remove_clients
(hass, aioclient_mock, mock_unifi_websocket)
Test the remove_items function with some clients.
Test the remove_items function with some clients.
async def test_remove_clients(hass, aioclient_mock, mock_unifi_websocket): """Test the remove_items function with some clients.""" client_1 = { "essid": "ssid", "hostname": "client_1", "is_wired": False, "last_seen": 1562600145, "mac": "00:00:00:00:00:01", } clien...
[ "async", "def", "test_remove_clients", "(", "hass", ",", "aioclient_mock", ",", "mock_unifi_websocket", ")", ":", "client_1", "=", "{", "\"essid\"", ":", "\"ssid\"", ",", "\"hostname\"", ":", "\"client_1\"", ",", "\"is_wired\"", ":", "False", ",", "\"last_seen\"",...
[ 344, 0 ]
[ 380, 53 ]
python
en
['en', 'en', 'en']
True
test_controller_state_change
(hass, aioclient_mock, mock_unifi_websocket)
Verify entities state reflect on controller becoming unavailable.
Verify entities state reflect on controller becoming unavailable.
async def test_controller_state_change(hass, aioclient_mock, mock_unifi_websocket): """Verify entities state reflect on controller becoming unavailable.""" client = { "essid": "ssid", "hostname": "client", "is_wired": False, "last_seen": 1562600145, "mac": "00:00:00:00:00...
[ "async", "def", "test_controller_state_change", "(", "hass", ",", "aioclient_mock", ",", "mock_unifi_websocket", ")", ":", "client", "=", "{", "\"essid\"", ":", "\"ssid\"", ",", "\"hostname\"", ":", "\"client\"", ",", "\"is_wired\"", ":", "False", ",", "\"last_see...
[ 383, 0 ]
[ 433, 71 ]
python
en
['en', 'en', 'en']
True
test_option_track_clients
(hass, aioclient_mock)
Test the tracking of clients can be turned off.
Test the tracking of clients can be turned off.
async def test_option_track_clients(hass, aioclient_mock): """Test the tracking of clients can be turned off.""" wireless_client = { "essid": "ssid", "hostname": "wireless_client", "is_wired": False, "last_seen": 1562600145, "mac": "00:00:00:00:00:01", } wired_cli...
[ "async", "def", "test_option_track_clients", "(", "hass", ",", "aioclient_mock", ")", ":", "wireless_client", "=", "{", "\"essid\"", ":", "\"ssid\"", ",", "\"hostname\"", ":", "\"wireless_client\"", ",", "\"is_wired\"", ":", "False", ",", "\"last_seen\"", ":", "15...
[ 436, 0 ]
[ 499, 51 ]
python
en
['en', 'en', 'en']
True
test_option_track_wired_clients
(hass, aioclient_mock)
Test the tracking of wired clients can be turned off.
Test the tracking of wired clients can be turned off.
async def test_option_track_wired_clients(hass, aioclient_mock): """Test the tracking of wired clients can be turned off.""" wireless_client = { "essid": "ssid", "hostname": "wireless_client", "is_wired": False, "last_seen": 1562600145, "mac": "00:00:00:00:00:01", } ...
[ "async", "def", "test_option_track_wired_clients", "(", "hass", ",", "aioclient_mock", ")", ":", "wireless_client", "=", "{", "\"essid\"", ":", "\"ssid\"", ",", "\"hostname\"", ":", "\"wireless_client\"", ",", "\"is_wired\"", ":", "False", ",", "\"last_seen\"", ":",...
[ 502, 0 ]
[ 565, 51 ]
python
en
['en', 'en', 'en']
True
test_option_track_devices
(hass, aioclient_mock)
Test the tracking of devices can be turned off.
Test the tracking of devices can be turned off.
async def test_option_track_devices(hass, aioclient_mock): """Test the tracking of devices can be turned off.""" client = { "hostname": "client", "is_wired": True, "last_seen": 1562600145, "mac": "00:00:00:00:00:01", } device = { "board_rev": 3, "device_id...
[ "async", "def", "test_option_track_devices", "(", "hass", ",", "aioclient_mock", ")", ":", "client", "=", "{", "\"hostname\"", ":", "\"client\"", ",", "\"is_wired\"", ":", "True", ",", "\"last_seen\"", ":", "1562600145", ",", "\"mac\"", ":", "\"00:00:00:00:00:01\"...
[ 568, 0 ]
[ 618, 51 ]
python
en
['en', 'en', 'en']
True
test_option_ssid_filter
(hass, aioclient_mock, mock_unifi_websocket)
Test the SSID filter works. Client will travel from a supported SSID to an unsupported ssid. Client on SSID2 will be removed on change of options.
Test the SSID filter works.
async def test_option_ssid_filter(hass, aioclient_mock, mock_unifi_websocket): """Test the SSID filter works. Client will travel from a supported SSID to an unsupported ssid. Client on SSID2 will be removed on change of options. """ client = { "essid": "ssid", "hostname": "client", ...
[ "async", "def", "test_option_ssid_filter", "(", "hass", ",", "aioclient_mock", ",", "mock_unifi_websocket", ")", ":", "client", "=", "{", "\"essid\"", ":", "\"ssid\"", ",", "\"hostname\"", ":", "\"client\"", ",", "\"is_wired\"", ":", "False", ",", "\"last_seen\"",...
[ 621, 0 ]
[ 749, 84 ]
python
en
['en', 'en', 'en']
True
test_wireless_client_go_wired_issue
( hass, aioclient_mock, mock_unifi_websocket )
Test the solution to catch wireless device go wired UniFi issue. UniFi has a known issue that when a wireless device goes away it sometimes gets marked as wired.
Test the solution to catch wireless device go wired UniFi issue.
async def test_wireless_client_go_wired_issue( hass, aioclient_mock, mock_unifi_websocket ): """Test the solution to catch wireless device go wired UniFi issue. UniFi has a known issue that when a wireless device goes away it sometimes gets marked as wired. """ client = { "essid": "ssid", ...
[ "async", "def", "test_wireless_client_go_wired_issue", "(", "hass", ",", "aioclient_mock", ",", "mock_unifi_websocket", ")", ":", "client", "=", "{", "\"essid\"", ":", "\"ssid\"", ",", "\"hostname\"", ":", "\"client\"", ",", "\"ip\"", ":", "\"10.0.0.1\"", ",", "\"...
[ 752, 0 ]
[ 833, 55 ]
python
en
['en', 'en', 'en']
True
test_option_ignore_wired_bug
(hass, aioclient_mock, mock_unifi_websocket)
Test option to ignore wired bug.
Test option to ignore wired bug.
async def test_option_ignore_wired_bug(hass, aioclient_mock, mock_unifi_websocket): """Test option to ignore wired bug.""" client = { "ap_mac": "00:00:00:00:02:01", "essid": "ssid", "hostname": "client", "ip": "10.0.0.1", "is_wired": False, "last_seen": dt_util.as...
[ "async", "def", "test_option_ignore_wired_bug", "(", "hass", ",", "aioclient_mock", ",", "mock_unifi_websocket", ")", ":", "client", "=", "{", "\"ap_mac\"", ":", "\"00:00:00:00:02:01\"", ",", "\"essid\"", ":", "\"ssid\"", ",", "\"hostname\"", ":", "\"client\"", ",",...
[ 836, 0 ]
[ 915, 55 ]
python
en
['en', 'en', 'en']
True