Search is not available for this dataset
identifier stringlengths 1 155 | parameters stringlengths 2 6.09k | docstring stringlengths 11 63.4k | docstring_summary stringlengths 0 63.4k | function stringlengths 29 99.8k | function_tokens list | start_point list | end_point list | language stringclasses 1
value | docstring_language stringlengths 2 7 | docstring_language_predictions stringlengths 18 23 | is_langid_reliable stringclasses 2
values |
|---|---|---|---|---|---|---|---|---|---|---|---|
async_setup_entry | (
hass: HomeAssistant,
config_entry: ConfigEntry,
async_add_entities: AddEntitiesCallback,
) | Set up sensors for device. | Set up sensors for device. | async def async_setup_entry(
hass: HomeAssistant,
config_entry: ConfigEntry,
async_add_entities: AddEntitiesCallback,
) -> None:
"""Set up sensors for device."""
if config_entry.data["sleep_period"]:
await async_setup_entry_attribute_entities(
hass,
config_entry,
... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
":",
"HomeAssistant",
",",
"config_entry",
":",
"ConfigEntry",
",",
"async_add_entities",
":",
"AddEntitiesCallback",
",",
")",
"->",
"None",
":",
"if",
"config_entry",
".",
"data",
"[",
"\"sleep_period\"",
"]",
... | [
115,
0
] | [
139,
9
] | python | en | ['en', 'en', 'en'] | True |
ShellyBinarySensor.is_on | (self) | Return true if sensor state is on. | Return true if sensor state is on. | def is_on(self) -> bool:
"""Return true if sensor state is on."""
return bool(self.attribute_value) | [
"def",
"is_on",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"bool",
"(",
"self",
".",
"attribute_value",
")"
] | [
146,
4
] | [
148,
41
] | python | en | ['en', 'et', 'en'] | True |
ShellyRestBinarySensor.is_on | (self) | Return true if REST sensor state is on. | Return true if REST sensor state is on. | def is_on(self) -> bool:
"""Return true if REST sensor state is on."""
return bool(self.attribute_value) | [
"def",
"is_on",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"bool",
"(",
"self",
".",
"attribute_value",
")"
] | [
155,
4
] | [
157,
41
] | python | en | ['en', 'mt', 'en'] | True |
ShellySleepingBinarySensor.is_on | (self) | Return true if sensor state is on. | Return true if sensor state is on. | def is_on(self) -> bool:
"""Return true if sensor state is on."""
if self.block is not None:
return bool(self.attribute_value)
return self.last_state == STATE_ON | [
"def",
"is_on",
"(",
"self",
")",
"->",
"bool",
":",
"if",
"self",
".",
"block",
"is",
"not",
"None",
":",
"return",
"bool",
"(",
"self",
".",
"attribute_value",
")",
"return",
"self",
".",
"last_state",
"==",
"STATE_ON"
] | [
166,
4
] | [
171,
42
] | python | en | ['en', 'et', 'en'] | True |
to_sax | (walker, handler) | Call SAX-like content handler based on treewalker walker
:arg walker: the treewalker to use to walk the tree to convert it
:arg handler: SAX handler to use
| Call SAX-like content handler based on treewalker walker | def to_sax(walker, handler):
"""Call SAX-like content handler based on treewalker walker
:arg walker: the treewalker to use to walk the tree to convert it
:arg handler: SAX handler to use
"""
handler.startDocument()
for prefix, namespace in prefix_mapping.items():
handler.startPrefixM... | [
"def",
"to_sax",
"(",
"walker",
",",
"handler",
")",
":",
"handler",
".",
"startDocument",
"(",
")",
"for",
"prefix",
",",
"namespace",
"in",
"prefix_mapping",
".",
"items",
"(",
")",
":",
"handler",
".",
"startPrefixMapping",
"(",
"prefix",
",",
"namespac... | [
12,
0
] | [
49,
25
] | python | en | ['en', 'no', 'en'] | True |
OVOEnergyFlowHandler.__init__ | (self) | Initialize the flow. | Initialize the flow. | def __init__(self):
"""Initialize the flow."""
self.username = None | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"username",
"=",
"None"
] | [
21,
4
] | [
23,
28
] | python | en | ['en', 'en', 'en'] | True |
OVOEnergyFlowHandler.async_step_user | (self, user_input=None) | Handle a flow initiated by the user. | Handle a flow initiated by the user. | async def async_step_user(self, user_input=None):
"""Handle a flow initiated by the user."""
errors = {}
if user_input is not None:
client = OVOEnergy()
try:
authenticated = await client.authenticate(
user_input[CONF_USERNAME], user_inp... | [
"async",
"def",
"async_step_user",
"(",
"self",
",",
"user_input",
"=",
"None",
")",
":",
"errors",
"=",
"{",
"}",
"if",
"user_input",
"is",
"not",
"None",
":",
"client",
"=",
"OVOEnergy",
"(",
")",
"try",
":",
"authenticated",
"=",
"await",
"client",
... | [
25,
4
] | [
53,
9
] | python | en | ['en', 'en', 'en'] | True |
OVOEnergyFlowHandler.async_step_reauth | (self, user_input) | Handle configuration by re-auth. | Handle configuration by re-auth. | async def async_step_reauth(self, user_input):
"""Handle configuration by re-auth."""
errors = {}
if user_input and user_input.get(CONF_USERNAME):
self.username = user_input[CONF_USERNAME]
self.context["title_placeholders"] = {CONF_USERNAME: self.username}
if user_... | [
"async",
"def",
"async_step_reauth",
"(",
"self",
",",
"user_input",
")",
":",
"errors",
"=",
"{",
"}",
"if",
"user_input",
"and",
"user_input",
".",
"get",
"(",
"CONF_USERNAME",
")",
":",
"self",
".",
"username",
"=",
"user_input",
"[",
"CONF_USERNAME",
"... | [
55,
4
] | [
88,
9
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (hass, config_entry, async_add_entities) | Set up the iRobot Roomba vacuum cleaner. | Set up the iRobot Roomba vacuum cleaner. | async def async_setup_entry(hass, config_entry, async_add_entities):
"""Set up the iRobot Roomba vacuum cleaner."""
domain_data = hass.data[DOMAIN][config_entry.entry_id]
roomba = domain_data[ROOMBA_SESSION]
blid = domain_data[BLID]
# Get the capabilities of our unit
state = roomba_reported_sta... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
",",
"config_entry",
",",
"async_add_entities",
")",
":",
"domain_data",
"=",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"[",
"config_entry",
".",
"entry_id",
"]",
"roomba",
"=",
"domain_data",
"[",
"ROOMBA_SESSI... | [
7,
0
] | [
26,
42
] | python | en | ['en', 'en', 'en'] | True |
get_model_detection_function | (model) | Get a tf.function for detection. | Get a tf.function for detection. | def get_model_detection_function(model):
"""Get a tf.function for detection."""
@tf.function
def detect_fn(image):
"""Detect objects in image."""
image, shapes = model.preprocess(image)
prediction_dict = model.predict(image, shapes)
detections = model.postprocess(prediction... | [
"def",
"get_model_detection_function",
"(",
"model",
")",
":",
"@",
"tf",
".",
"function",
"def",
"detect_fn",
"(",
"image",
")",
":",
"\"\"\"Detect objects in image.\"\"\"",
"image",
",",
"shapes",
"=",
"model",
".",
"preprocess",
"(",
"image",
")",
"prediction... | [
82,
0
] | [
95,
20
] | python | en | ['da', 'en', 'en'] | True |
setup_platform | (hass, config, add_entities, discovery_info=None) | Set up the TensorFlow image processing platform. | Set up the TensorFlow image processing platform. | def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the TensorFlow image processing platform."""
model_config = config[CONF_MODEL]
model_dir = model_config.get(CONF_MODEL_DIR) or hass.config.path("tensorflow")
labels = model_config.get(CONF_LABELS) or hass.config.path(
... | [
"def",
"setup_platform",
"(",
"hass",
",",
"config",
",",
"add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"model_config",
"=",
"config",
"[",
"CONF_MODEL",
"]",
"model_dir",
"=",
"model_config",
".",
"get",
"(",
"CONF_MODEL_DIR",
")",
"or",
"ha... | [
98,
0
] | [
199,
26
] | python | en | ['en', 'jv', 'en'] | True |
TensorFlowImageProcessor.__init__ | (
self,
hass,
camera_entity,
name,
category_index,
config,
) | Initialize the TensorFlow entity. | Initialize the TensorFlow entity. | def __init__(
self,
hass,
camera_entity,
name,
category_index,
config,
):
"""Initialize the TensorFlow entity."""
model_config = config.get(CONF_MODEL)
self.hass = hass
self._camera_entity = camera_entity
if name:
se... | [
"def",
"__init__",
"(",
"self",
",",
"hass",
",",
"camera_entity",
",",
"name",
",",
"category_index",
",",
"config",
",",
")",
":",
"model_config",
"=",
"config",
".",
"get",
"(",
"CONF_MODEL",
")",
"self",
".",
"hass",
"=",
"hass",
"self",
".",
"_cam... | [
205,
4
] | [
263,
30
] | python | en | ['en', 'pl', 'en'] | True |
TensorFlowImageProcessor.camera_entity | (self) | Return camera entity id from process pictures. | Return camera entity id from process pictures. | def camera_entity(self):
"""Return camera entity id from process pictures."""
return self._camera_entity | [
"def",
"camera_entity",
"(",
"self",
")",
":",
"return",
"self",
".",
"_camera_entity"
] | [
266,
4
] | [
268,
34
] | python | en | ['en', 'en', 'en'] | True |
TensorFlowImageProcessor.name | (self) | Return the name of the image processor. | Return the name of the image processor. | def name(self):
"""Return the name of the image processor."""
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | [
271,
4
] | [
273,
25
] | python | en | ['en', 'en', 'en'] | True |
TensorFlowImageProcessor.state | (self) | Return the state of the entity. | Return the state of the entity. | def state(self):
"""Return the state of the entity."""
return self._total_matches | [
"def",
"state",
"(",
"self",
")",
":",
"return",
"self",
".",
"_total_matches"
] | [
276,
4
] | [
278,
34
] | python | en | ['en', 'en', 'en'] | True |
TensorFlowImageProcessor.extra_state_attributes | (self) | Return device specific state attributes. | Return device specific state attributes. | def extra_state_attributes(self):
"""Return device specific state attributes."""
return {
ATTR_MATCHES: self._matches,
ATTR_SUMMARY: {
category: len(values) for category, values in self._matches.items()
},
ATTR_TOTAL_MATCHES: self._total_ma... | [
"def",
"extra_state_attributes",
"(",
"self",
")",
":",
"return",
"{",
"ATTR_MATCHES",
":",
"self",
".",
"_matches",
",",
"ATTR_SUMMARY",
":",
"{",
"category",
":",
"len",
"(",
"values",
")",
"for",
"category",
",",
"values",
"in",
"self",
".",
"_matches",... | [
281,
4
] | [
290,
9
] | python | en | ['fr', 'en', 'en'] | True |
TensorFlowImageProcessor.process_image | (self, image) | Process the image. | Process the image. | def process_image(self, image):
"""Process the image."""
model = self.hass.data[DOMAIN][CONF_MODEL]
if not model:
_LOGGER.debug("Model not yet ready")
return
start = time.perf_counter()
try:
import cv2 # pylint: disable=import-outside-topleve... | [
"def",
"process_image",
"(",
"self",
",",
"image",
")",
":",
"model",
"=",
"self",
".",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"[",
"CONF_MODEL",
"]",
"if",
"not",
"model",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Model not yet ready\"",
")",
"return",
... | [
334,
4
] | [
427,
56
] | python | en | ['en', 'en', 'en'] | True |
ApiResponse.__init__ | (self, code=None, type=None, message=None) | ApiResponse - a model defined in OpenAPI
:param code: The code of this ApiResponse. # noqa: E501
:type code: int
:param type: The type of this ApiResponse. # noqa: E501
:type type: str
:param message: The message of this ApiResponse. # noqa: E501
:type message: str
... | ApiResponse - a model defined in OpenAPI | def __init__(self, code=None, type=None, message=None): # noqa: E501
"""ApiResponse - a model defined in OpenAPI
:param code: The code of this ApiResponse. # noqa: E501
:type code: int
:param type: The type of this ApiResponse. # noqa: E501
:type type: str
:param mess... | [
"def",
"__init__",
"(",
"self",
",",
"code",
"=",
"None",
",",
"type",
"=",
"None",
",",
"message",
"=",
"None",
")",
":",
"# noqa: E501",
"self",
".",
"openapi_types",
"=",
"{",
"'code'",
":",
"int",
",",
"'type'",
":",
"str",
",",
"'message'",
":",... | [
17,
4
] | [
41,
31
] | python | en | ['en', 'en', 'en'] | True |
ApiResponse.from_dict | (cls, dikt) | Returns the dict as a model
:param dikt: A dict.
:type: dict
:return: The ApiResponse of this ApiResponse. # noqa: E501
:rtype: ApiResponse
| Returns the dict as a model | def from_dict(cls, dikt):
"""Returns the dict as a model
:param dikt: A dict.
:type: dict
:return: The ApiResponse of this ApiResponse. # noqa: E501
:rtype: ApiResponse
"""
return util.deserialize_model(dikt, cls) | [
"def",
"from_dict",
"(",
"cls",
",",
"dikt",
")",
":",
"return",
"util",
".",
"deserialize_model",
"(",
"dikt",
",",
"cls",
")"
] | [
44,
4
] | [
52,
48
] | python | en | ['en', 'en', 'en'] | True |
ApiResponse.code | (self) | Gets the code of this ApiResponse.
:return: The code of this ApiResponse.
:rtype: int
| Gets the code of this ApiResponse. | def code(self):
"""Gets the code of this ApiResponse.
:return: The code of this ApiResponse.
:rtype: int
"""
return self._code | [
"def",
"code",
"(",
"self",
")",
":",
"return",
"self",
".",
"_code"
] | [
55,
4
] | [
62,
25
] | python | en | ['en', 'en', 'en'] | True |
ApiResponse.code | (self, code) | Sets the code of this ApiResponse.
:param code: The code of this ApiResponse.
:type code: int
| Sets the code of this ApiResponse. | def code(self, code):
"""Sets the code of this ApiResponse.
:param code: The code of this ApiResponse.
:type code: int
"""
self._code = code | [
"def",
"code",
"(",
"self",
",",
"code",
")",
":",
"self",
".",
"_code",
"=",
"code"
] | [
65,
4
] | [
73,
25
] | python | en | ['en', 'en', 'en'] | True |
ApiResponse.type | (self) | Gets the type of this ApiResponse.
:return: The type of this ApiResponse.
:rtype: str
| Gets the type of this ApiResponse. | def type(self):
"""Gets the type of this ApiResponse.
:return: The type of this ApiResponse.
:rtype: str
"""
return self._type | [
"def",
"type",
"(",
"self",
")",
":",
"return",
"self",
".",
"_type"
] | [
76,
4
] | [
83,
25
] | python | en | ['en', 'en', 'en'] | True |
ApiResponse.type | (self, type) | Sets the type of this ApiResponse.
:param type: The type of this ApiResponse.
:type type: str
| Sets the type of this ApiResponse. | def type(self, type):
"""Sets the type of this ApiResponse.
:param type: The type of this ApiResponse.
:type type: str
"""
self._type = type | [
"def",
"type",
"(",
"self",
",",
"type",
")",
":",
"self",
".",
"_type",
"=",
"type"
] | [
86,
4
] | [
94,
25
] | python | en | ['en', 'en', 'en'] | True |
ApiResponse.message | (self) | Gets the message of this ApiResponse.
:return: The message of this ApiResponse.
:rtype: str
| Gets the message of this ApiResponse. | def message(self):
"""Gets the message of this ApiResponse.
:return: The message of this ApiResponse.
:rtype: str
"""
return self._message | [
"def",
"message",
"(",
"self",
")",
":",
"return",
"self",
".",
"_message"
] | [
97,
4
] | [
104,
28
] | python | en | ['en', 'en', 'en'] | True |
ApiResponse.message | (self, message) | Sets the message of this ApiResponse.
:param message: The message of this ApiResponse.
:type message: str
| Sets the message of this ApiResponse. | def message(self, message):
"""Sets the message of this ApiResponse.
:param message: The message of this ApiResponse.
:type message: str
"""
self._message = message | [
"def",
"message",
"(",
"self",
",",
"message",
")",
":",
"self",
".",
"_message",
"=",
"message"
] | [
107,
4
] | [
115,
31
] | python | en | ['en', 'en', 'en'] | True |
async_get_triggers | (
hass: HomeAssistant, device_id: str
) | List device triggers for Vacuum devices. | List device triggers for Vacuum devices. | async def async_get_triggers(
hass: HomeAssistant, device_id: str
) -> list[dict[str, Any]]:
"""List device triggers for Vacuum devices."""
registry = await entity_registry.async_get_registry(hass)
triggers = []
# Get all the integrations entities for this device
for entry in entity_registry.as... | [
"async",
"def",
"async_get_triggers",
"(",
"hass",
":",
"HomeAssistant",
",",
"device_id",
":",
"str",
")",
"->",
"list",
"[",
"dict",
"[",
"str",
",",
"Any",
"]",
"]",
":",
"registry",
"=",
"await",
"entity_registry",
".",
"async_get_registry",
"(",
"hass... | [
38,
0
] | [
61,
19
] | python | en | ['de', 'en', 'en'] | True |
async_get_trigger_capabilities | (
hass: HomeAssistant, config: ConfigType
) | List trigger capabilities. | List trigger capabilities. | async def async_get_trigger_capabilities(
hass: HomeAssistant, config: ConfigType
) -> dict[str, vol.Schema]:
"""List trigger capabilities."""
return {
"extra_fields": vol.Schema(
{vol.Optional(CONF_FOR): cv.positive_time_period_dict}
)
} | [
"async",
"def",
"async_get_trigger_capabilities",
"(",
"hass",
":",
"HomeAssistant",
",",
"config",
":",
"ConfigType",
")",
"->",
"dict",
"[",
"str",
",",
"vol",
".",
"Schema",
"]",
":",
"return",
"{",
"\"extra_fields\"",
":",
"vol",
".",
"Schema",
"(",
"{... | [
64,
0
] | [
72,
5
] | python | en | ['en', 'la', 'en'] | True |
async_attach_trigger | (
hass: HomeAssistant,
config: ConfigType,
action: AutomationActionType,
automation_info: AutomationTriggerInfo,
) | Attach a trigger. | Attach a trigger. | async def async_attach_trigger(
hass: HomeAssistant,
config: ConfigType,
action: AutomationActionType,
automation_info: AutomationTriggerInfo,
) -> CALLBACK_TYPE:
"""Attach a trigger."""
if config[CONF_TYPE] == "cleaning":
to_state = STATE_CLEANING
else:
to_state = STATE_DOCK... | [
"async",
"def",
"async_attach_trigger",
"(",
"hass",
":",
"HomeAssistant",
",",
"config",
":",
"ConfigType",
",",
"action",
":",
"AutomationActionType",
",",
"automation_info",
":",
"AutomationTriggerInfo",
",",
")",
"->",
"CALLBACK_TYPE",
":",
"if",
"config",
"["... | [
75,
0
] | [
97,
5
] | python | en | ['en', 'lb', 'en'] | True |
async_setup_entry | (hass: HomeAssistant, entry: ConfigEntry) | Do setup of Gogogate2. | Do setup of Gogogate2. | async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Do setup of Gogogate2."""
# Update the config entry.
config_updates = {}
if CONF_DEVICE not in entry.data:
config_updates = {
**entry.data,
**{CONF_DEVICE: DEVICE_TYPE_GOGOGATE2},
}
... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
":",
"HomeAssistant",
",",
"entry",
":",
"ConfigEntry",
")",
"->",
"bool",
":",
"# Update the config entry.",
"config_updates",
"=",
"{",
"}",
"if",
"CONF_DEVICE",
"not",
"in",
"entry",
".",
"data",
":",
"confi... | [
14,
0
] | [
33,
15
] | python | en | ['en', 'zu', 'en'] | True |
async_unload_entry | (hass: HomeAssistant, entry: ConfigEntry) | Unload Gogogate2 config entry. | Unload Gogogate2 config entry. | async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Unload Gogogate2 config entry."""
return await hass.config_entries.async_unload_platforms(entry, PLATFORMS) | [
"async",
"def",
"async_unload_entry",
"(",
"hass",
":",
"HomeAssistant",
",",
"entry",
":",
"ConfigEntry",
")",
"->",
"bool",
":",
"return",
"await",
"hass",
".",
"config_entries",
".",
"async_unload_platforms",
"(",
"entry",
",",
"PLATFORMS",
")"
] | [
36,
0
] | [
38,
77
] | python | en | ['da', 'en', 'en'] | True |
test_request_context_middleware | (aiohttp_client) | Test that request context is set from middleware. | Test that request context is set from middleware. | async def test_request_context_middleware(aiohttp_client):
"""Test that request context is set from middleware."""
context = ContextVar("request", default=None)
app = web.Application()
async def mock_handler(request):
"""Return the real IP as text."""
request_context = context.get()
... | [
"async",
"def",
"test_request_context_middleware",
"(",
"aiohttp_client",
")",
":",
"context",
"=",
"ContextVar",
"(",
"\"request\"",
",",
"default",
"=",
"None",
")",
"app",
"=",
"web",
".",
"Application",
"(",
")",
"async",
"def",
"mock_handler",
"(",
"reque... | [
8,
0
] | [
32,
32
] | python | en | ['en', 'en', 'en'] | True |
shades | (name: str) | Create motorized shades with given name. | Create motorized shades with given name. | def shades(name: str):
"""Create motorized shades with given name."""
return {"name": name, "type": DeviceType.MOTORIZED_SHADES} | [
"def",
"shades",
"(",
"name",
":",
"str",
")",
":",
"return",
"{",
"\"name\"",
":",
"name",
",",
"\"type\"",
":",
"DeviceType",
".",
"MOTORIZED_SHADES",
"}"
] | [
27,
0
] | [
29,
62
] | python | en | ['en', 'en', 'en'] | True |
test_entity_registry | (hass: core.HomeAssistant) | Tests that the devices are registered in the entity registry. | Tests that the devices are registered in the entity registry. | async def test_entity_registry(hass: core.HomeAssistant):
"""Tests that the devices are registered in the entity registry."""
await setup_platform(
hass,
COVER_DOMAIN,
shades("name-1"),
bond_version={"bondid": "test-hub-id"},
bond_device_id="test-device-id",
)
re... | [
"async",
"def",
"test_entity_registry",
"(",
"hass",
":",
"core",
".",
"HomeAssistant",
")",
":",
"await",
"setup_platform",
"(",
"hass",
",",
"COVER_DOMAIN",
",",
"shades",
"(",
"\"name-1\"",
")",
",",
"bond_version",
"=",
"{",
"\"bondid\"",
":",
"\"test-hub-... | [
32,
0
] | [
44,
59
] | python | en | ['en', 'en', 'en'] | True |
test_open_cover | (hass: core.HomeAssistant) | Tests that open cover command delegates to API. | Tests that open cover command delegates to API. | async def test_open_cover(hass: core.HomeAssistant):
"""Tests that open cover command delegates to API."""
await setup_platform(
hass, COVER_DOMAIN, shades("name-1"), bond_device_id="test-device-id"
)
with patch_bond_action() as mock_open, patch_bond_device_state():
await hass.services.... | [
"async",
"def",
"test_open_cover",
"(",
"hass",
":",
"core",
".",
"HomeAssistant",
")",
":",
"await",
"setup_platform",
"(",
"hass",
",",
"COVER_DOMAIN",
",",
"shades",
"(",
"\"name-1\"",
")",
",",
"bond_device_id",
"=",
"\"test-device-id\"",
")",
"with",
"pat... | [
47,
0
] | [
62,
70
] | python | en | ['en', 'en', 'en'] | True |
test_close_cover | (hass: core.HomeAssistant) | Tests that close cover command delegates to API. | Tests that close cover command delegates to API. | async def test_close_cover(hass: core.HomeAssistant):
"""Tests that close cover command delegates to API."""
await setup_platform(
hass, COVER_DOMAIN, shades("name-1"), bond_device_id="test-device-id"
)
with patch_bond_action() as mock_close, patch_bond_device_state():
await hass.servic... | [
"async",
"def",
"test_close_cover",
"(",
"hass",
":",
"core",
".",
"HomeAssistant",
")",
":",
"await",
"setup_platform",
"(",
"hass",
",",
"COVER_DOMAIN",
",",
"shades",
"(",
"\"name-1\"",
")",
",",
"bond_device_id",
"=",
"\"test-device-id\"",
")",
"with",
"pa... | [
65,
0
] | [
80,
72
] | python | en | ['en', 'en', 'en'] | True |
test_stop_cover | (hass: core.HomeAssistant) | Tests that stop cover command delegates to API. | Tests that stop cover command delegates to API. | async def test_stop_cover(hass: core.HomeAssistant):
"""Tests that stop cover command delegates to API."""
await setup_platform(
hass, COVER_DOMAIN, shades("name-1"), bond_device_id="test-device-id"
)
with patch_bond_action() as mock_hold, patch_bond_device_state():
await hass.services.... | [
"async",
"def",
"test_stop_cover",
"(",
"hass",
":",
"core",
".",
"HomeAssistant",
")",
":",
"await",
"setup_platform",
"(",
"hass",
",",
"COVER_DOMAIN",
",",
"shades",
"(",
"\"name-1\"",
")",
",",
"bond_device_id",
"=",
"\"test-device-id\"",
")",
"with",
"pat... | [
83,
0
] | [
98,
70
] | python | en | ['en', 'en', 'en'] | True |
test_update_reports_open_cover | (hass: core.HomeAssistant) | Tests that update command sets correct state when Bond API reports cover is open. | Tests that update command sets correct state when Bond API reports cover is open. | async def test_update_reports_open_cover(hass: core.HomeAssistant):
"""Tests that update command sets correct state when Bond API reports cover is open."""
await setup_platform(hass, COVER_DOMAIN, shades("name-1"))
with patch_bond_device_state(return_value={"open": 1}):
async_fire_time_changed(hass... | [
"async",
"def",
"test_update_reports_open_cover",
"(",
"hass",
":",
"core",
".",
"HomeAssistant",
")",
":",
"await",
"setup_platform",
"(",
"hass",
",",
"COVER_DOMAIN",
",",
"shades",
"(",
"\"name-1\"",
")",
")",
"with",
"patch_bond_device_state",
"(",
"return_val... | [
101,
0
] | [
109,
58
] | python | en | ['en', 'en', 'en'] | True |
test_update_reports_closed_cover | (hass: core.HomeAssistant) | Tests that update command sets correct state when Bond API reports cover is closed. | Tests that update command sets correct state when Bond API reports cover is closed. | async def test_update_reports_closed_cover(hass: core.HomeAssistant):
"""Tests that update command sets correct state when Bond API reports cover is closed."""
await setup_platform(hass, COVER_DOMAIN, shades("name-1"))
with patch_bond_device_state(return_value={"open": 0}):
async_fire_time_changed(... | [
"async",
"def",
"test_update_reports_closed_cover",
"(",
"hass",
":",
"core",
".",
"HomeAssistant",
")",
":",
"await",
"setup_platform",
"(",
"hass",
",",
"COVER_DOMAIN",
",",
"shades",
"(",
"\"name-1\"",
")",
")",
"with",
"patch_bond_device_state",
"(",
"return_v... | [
112,
0
] | [
120,
60
] | python | en | ['en', 'en', 'en'] | True |
test_cover_available | (hass: core.HomeAssistant) | Tests that available state is updated based on API errors. | Tests that available state is updated based on API errors. | async def test_cover_available(hass: core.HomeAssistant):
"""Tests that available state is updated based on API errors."""
await help_test_entity_available(
hass, COVER_DOMAIN, shades("name-1"), "cover.name_1"
) | [
"async",
"def",
"test_cover_available",
"(",
"hass",
":",
"core",
".",
"HomeAssistant",
")",
":",
"await",
"help_test_entity_available",
"(",
"hass",
",",
"COVER_DOMAIN",
",",
"shades",
"(",
"\"name-1\"",
")",
",",
"\"cover.name_1\"",
")"
] | [
123,
0
] | [
127,
5
] | python | en | ['en', 'en', 'en'] | True |
mock_entry | (hass) | Create a mock light entity. | Create a mock light entity. | async def mock_entry(hass):
"""Create a mock light entity."""
return MockConfigEntry(domain=DOMAIN) | [
"async",
"def",
"mock_entry",
"(",
"hass",
")",
":",
"return",
"MockConfigEntry",
"(",
"domain",
"=",
"DOMAIN",
")"
] | [
38,
0
] | [
40,
41
] | python | en | ['en', 'sm', 'en'] | True |
mock_light | (hass, mock_entry) | Create a mock light entity. | Create a mock light entity. | async def mock_light(hass, mock_entry):
"""Create a mock light entity."""
await setup.async_setup_component(hass, "persistent_notification", {})
light = MagicMock(spec=pykulersky.Light)
light.address = "AA:BB:CC:11:22:33"
light.name = "Bedroom"
light.connect.return_value = True
light.get_co... | [
"async",
"def",
"mock_light",
"(",
"hass",
",",
"mock_entry",
")",
":",
"await",
"setup",
".",
"async_setup_component",
"(",
"hass",
",",
"\"persistent_notification\"",
",",
"{",
"}",
")",
"light",
"=",
"MagicMock",
"(",
"spec",
"=",
"pykulersky",
".",
"Ligh... | [
44,
0
] | [
63,
19
] | python | en | ['en', 'sm', 'en'] | True |
test_init | (hass, mock_light) | Test platform setup. | Test platform setup. | async def test_init(hass, mock_light):
"""Test platform setup."""
state = hass.states.get("light.bedroom")
assert state.state == STATE_OFF
assert dict(state.attributes) == {
ATTR_FRIENDLY_NAME: "Bedroom",
ATTR_SUPPORTED_COLOR_MODES: [COLOR_MODE_RGBW],
ATTR_SUPPORTED_FEATURES: 0,
... | [
"async",
"def",
"test_init",
"(",
"hass",
",",
"mock_light",
")",
":",
"state",
"=",
"hass",
".",
"states",
".",
"get",
"(",
"\"light.bedroom\"",
")",
"assert",
"state",
".",
"state",
"==",
"STATE_OFF",
"assert",
"dict",
"(",
"state",
".",
"attributes",
... | [
66,
0
] | [
80,
39
] | python | en | ['en', 'da', 'en'] | True |
test_remove_entry | (hass, mock_light, mock_entry) | Test platform setup. | Test platform setup. | async def test_remove_entry(hass, mock_light, mock_entry):
"""Test platform setup."""
assert hass.data[DOMAIN][DATA_ADDRESSES] == {"AA:BB:CC:11:22:33"}
assert DATA_DISCOVERY_SUBSCRIPTION in hass.data[DOMAIN]
await hass.config_entries.async_remove(mock_entry.entry_id)
assert mock_light.disconnect.c... | [
"async",
"def",
"test_remove_entry",
"(",
"hass",
",",
"mock_light",
",",
"mock_entry",
")",
":",
"assert",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"[",
"DATA_ADDRESSES",
"]",
"==",
"{",
"\"AA:BB:CC:11:22:33\"",
"}",
"assert",
"DATA_DISCOVERY_SUBSCRIPTION",
"in... | [
83,
0
] | [
91,
34
] | python | en | ['en', 'da', 'en'] | True |
test_remove_entry_exceptions_caught | (hass, mock_light, mock_entry) | Assert that disconnect exceptions are caught. | Assert that disconnect exceptions are caught. | async def test_remove_entry_exceptions_caught(hass, mock_light, mock_entry):
"""Assert that disconnect exceptions are caught."""
mock_light.disconnect.side_effect = pykulersky.PykulerskyException("Mock error")
await hass.config_entries.async_remove(mock_entry.entry_id)
assert mock_light.disconnect.call... | [
"async",
"def",
"test_remove_entry_exceptions_caught",
"(",
"hass",
",",
"mock_light",
",",
"mock_entry",
")",
":",
"mock_light",
".",
"disconnect",
".",
"side_effect",
"=",
"pykulersky",
".",
"PykulerskyException",
"(",
"\"Mock error\"",
")",
"await",
"hass",
".",
... | [
94,
0
] | [
99,
39
] | python | en | ['en', 'en', 'en'] | True |
test_update_exception | (hass, mock_light) | Test platform setup. | Test platform setup. | async def test_update_exception(hass, mock_light):
"""Test platform setup."""
await setup.async_setup_component(hass, "persistent_notification", {})
mock_light.get_color.side_effect = pykulersky.PykulerskyException
await hass.helpers.entity_component.async_update_entity("light.bedroom")
state = has... | [
"async",
"def",
"test_update_exception",
"(",
"hass",
",",
"mock_light",
")",
":",
"await",
"setup",
".",
"async_setup_component",
"(",
"hass",
",",
"\"persistent_notification\"",
",",
"{",
"}",
")",
"mock_light",
".",
"get_color",
".",
"side_effect",
"=",
"pyku... | [
102,
0
] | [
110,
43
] | python | en | ['en', 'da', 'en'] | True |
test_light_turn_on | (hass, mock_light) | Test KulerSkyLight turn_on. | Test KulerSkyLight turn_on. | async def test_light_turn_on(hass, mock_light):
"""Test KulerSkyLight turn_on."""
mock_light.get_color.return_value = (255, 255, 255, 255)
await hass.services.async_call(
"light",
"turn_on",
{ATTR_ENTITY_ID: "light.bedroom"},
blocking=True,
)
await hass.async_block_ti... | [
"async",
"def",
"test_light_turn_on",
"(",
"hass",
",",
"mock_light",
")",
":",
"mock_light",
".",
"get_color",
".",
"return_value",
"=",
"(",
"255",
",",
"255",
",",
"255",
",",
"255",
")",
"await",
"hass",
".",
"services",
".",
"async_call",
"(",
"\"li... | [
113,
0
] | [
167,
58
] | python | et | ['et', 'et', 'en'] | True |
test_light_turn_off | (hass, mock_light) | Test KulerSkyLight turn_on. | Test KulerSkyLight turn_on. | async def test_light_turn_off(hass, mock_light):
"""Test KulerSkyLight turn_on."""
mock_light.get_color.return_value = (0, 0, 0, 0)
await hass.services.async_call(
"light",
"turn_off",
{ATTR_ENTITY_ID: "light.bedroom"},
blocking=True,
)
await hass.async_block_till_don... | [
"async",
"def",
"test_light_turn_off",
"(",
"hass",
",",
"mock_light",
")",
":",
"mock_light",
".",
"get_color",
".",
"return_value",
"=",
"(",
"0",
",",
"0",
",",
"0",
",",
"0",
")",
"await",
"hass",
".",
"services",
".",
"async_call",
"(",
"\"light\"",... | [
170,
0
] | [
180,
55
] | python | et | ['et', 'et', 'en'] | True |
test_light_update | (hass, mock_light) | Test KulerSkyLight update. | Test KulerSkyLight update. | async def test_light_update(hass, mock_light):
"""Test KulerSkyLight update."""
utcnow = dt_util.utcnow()
state = hass.states.get("light.bedroom")
assert state.state == STATE_OFF
assert dict(state.attributes) == {
ATTR_FRIENDLY_NAME: "Bedroom",
ATTR_SUPPORTED_COLOR_MODES: [COLOR_MOD... | [
"async",
"def",
"test_light_update",
"(",
"hass",
",",
"mock_light",
")",
":",
"utcnow",
"=",
"dt_util",
".",
"utcnow",
"(",
")",
"state",
"=",
"hass",
".",
"states",
".",
"get",
"(",
"\"light.bedroom\"",
")",
"assert",
"state",
".",
"state",
"==",
"STAT... | [
183,
0
] | [
267,
5
] | python | et | ['et', 'fy', 'it'] | False |
load_approximate_nearest_neighbours_index | (
linker_paths: LinkerPaths,
ef_search: int = 200,
) |
Load an approximate nearest neighbours index from disk.
Parameters
----------
linker_paths: LinkerPaths, required.
Contains the paths to the data required for the entity linker.
ef_search: int, optional (default = 200)
Controls speed performance at query time. Max value is 2000,
... |
Load an approximate nearest neighbours index from disk. | def load_approximate_nearest_neighbours_index(
linker_paths: LinkerPaths,
ef_search: int = 200,
) -> FloatIndex:
"""
Load an approximate nearest neighbours index from disk.
Parameters
----------
linker_paths: LinkerPaths, required.
Contains the paths to the data required for the ent... | [
"def",
"load_approximate_nearest_neighbours_index",
"(",
"linker_paths",
":",
"LinkerPaths",
",",
"ef_search",
":",
"int",
"=",
"200",
",",
")",
"->",
"FloatIndex",
":",
"concept_alias_tfidfs",
"=",
"scipy",
".",
"sparse",
".",
"load_npz",
"(",
"cached_path",
"(",... | [
115,
0
] | [
144,
20
] | python | en | ['en', 'error', 'th'] | False |
create_tfidf_ann_index | (
out_path: str, kb: KnowledgeBase = None
) |
Build tfidf vectorizer and ann index.
Parameters
----------
out_path: str, required.
The path where the various model pieces will be saved.
kb : KnowledgeBase, optional.
The kb items to generate the index and vectors for.
|
Build tfidf vectorizer and ann index. | def create_tfidf_ann_index(
out_path: str, kb: KnowledgeBase = None
) -> Tuple[List[str], TfidfVectorizer, FloatIndex]:
"""
Build tfidf vectorizer and ann index.
Parameters
----------
out_path: str, required.
The path where the various model pieces will be saved.
kb : KnowledgeBase,... | [
"def",
"create_tfidf_ann_index",
"(",
"out_path",
":",
"str",
",",
"kb",
":",
"KnowledgeBase",
"=",
"None",
")",
"->",
"Tuple",
"[",
"List",
"[",
"str",
"]",
",",
"TfidfVectorizer",
",",
"FloatIndex",
"]",
":",
"tfidf_vectorizer_path",
"=",
"f\"{out_path}/tfid... | [
359,
0
] | [
460,
55
] | python | en | ['en', 'error', 'th'] | False |
CandidateGenerator.nmslib_knn_with_zero_vectors | (
self, vectors: numpy.ndarray, k: int
) |
ann_index.knnQueryBatch crashes if any of the vectors is all zeros.
This function is a wrapper around `ann_index.knnQueryBatch` that solves this problem. It works as follows:
- remove empty vectors from `vectors`.
- call `ann_index.knnQueryBatch` with the non-empty vectors only. This re... |
ann_index.knnQueryBatch crashes if any of the vectors is all zeros.
This function is a wrapper around `ann_index.knnQueryBatch` that solves this problem. It works as follows:
- remove empty vectors from `vectors`.
- call `ann_index.knnQueryBatch` with the non-empty vectors only. This re... | def nmslib_knn_with_zero_vectors(
self, vectors: numpy.ndarray, k: int
) -> Tuple[numpy.ndarray, numpy.ndarray]:
"""
ann_index.knnQueryBatch crashes if any of the vectors is all zeros.
This function is a wrapper around `ann_index.knnQueryBatch` that solves this problem. It works as f... | [
"def",
"nmslib_knn_with_zero_vectors",
"(",
"self",
",",
"vectors",
":",
"numpy",
".",
"ndarray",
",",
"k",
":",
"int",
")",
"->",
"Tuple",
"[",
"numpy",
".",
"ndarray",
",",
"numpy",
".",
"ndarray",
"]",
":",
"empty_vectors_boolean_flags",
"=",
"numpy",
"... | [
237,
4
] | [
286,
53
] | python | en | ['en', 'error', 'th'] | False |
CandidateGenerator.__call__ | (
self, mention_texts: List[str], k: int
) |
Given a list of mention texts, returns a list of candidate neighbors.
NOTE: Because we include canonical name aliases in the ann index, the list
of candidates returned will not necessarily be of length k for each candidate,
because we then map these to canonical ids only.
NOTE... |
Given a list of mention texts, returns a list of candidate neighbors. | def __call__(
self, mention_texts: List[str], k: int
) -> List[List[MentionCandidate]]:
"""
Given a list of mention texts, returns a list of candidate neighbors.
NOTE: Because we include canonical name aliases in the ann index, the list
of candidates returned will not necess... | [
"def",
"__call__",
"(",
"self",
",",
"mention_texts",
":",
"List",
"[",
"str",
"]",
",",
"k",
":",
"int",
")",
"->",
"List",
"[",
"List",
"[",
"MentionCandidate",
"]",
"]",
":",
"if",
"self",
".",
"verbose",
":",
"print",
"(",
"f\"Generating candidates... | [
288,
4
] | [
356,
39
] | python | en | ['en', 'error', 'th'] | False |
TestFakeClassnameTags123Api.test_test_classname | (self) | Test case for test_classname
To test class name in snake case # noqa: E501
| Test case for test_classname | def test_test_classname(self):
"""Test case for test_classname
To test class name in snake case # noqa: E501
"""
pass | [
"def",
"test_test_classname",
"(",
"self",
")",
":",
"pass"
] | [
30,
4
] | [
35,
12
] | python | en | ['en', 'en', 'en'] | True |
async_register | (
hass: HomeAssistant, register: system_health.SystemHealthRegistration
) | Register system health callbacks. | Register system health callbacks. | def async_register(
hass: HomeAssistant, register: system_health.SystemHealthRegistration
) -> None:
"""Register system health callbacks."""
register.async_register_info(system_health_info) | [
"def",
"async_register",
"(",
"hass",
":",
"HomeAssistant",
",",
"register",
":",
"system_health",
".",
"SystemHealthRegistration",
")",
"->",
"None",
":",
"register",
".",
"async_register_info",
"(",
"system_health_info",
")"
] | [
11,
0
] | [
15,
52
] | python | en | ['en', 'sv', 'en'] | True |
system_health_info | (hass) | Get info for the info page. | Get info for the info page. | async def system_health_info(hass):
"""Get info for the info page."""
health_info = {}
config_entry_id = next(
iter(hass.data[DOMAIN])
) # Only first ISY is supported for now
isy: ISY = hass.data[DOMAIN][config_entry_id][ISY994_ISY]
entry = hass.config_entries.async_get_entry(config_e... | [
"async",
"def",
"system_health_info",
"(",
"hass",
")",
":",
"health_info",
"=",
"{",
"}",
"config_entry_id",
"=",
"next",
"(",
"iter",
"(",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
")",
")",
"# Only first ISY is supported for now",
"isy",
":",
"ISY",
"=",
... | [
18,
0
] | [
35,
22
] | python | en | ['en', 'en', 'en'] | True |
create_initialized_headless_egl_display | () | Creates an initialized EGL display directly on a device. | Creates an initialized EGL display directly on a device. | def create_initialized_headless_egl_display():
"""Creates an initialized EGL display directly on a device."""
for device in egl_get_devices():
display = egl.eglGetPlatformDisplayEXT(EGL_PLATFORM_DEVICE_EXT, device, None)
if display != egl.EGL_NO_DISPLAY and egl.eglGetError() == egl.EGL_SUCCESS:
... | [
"def",
"create_initialized_headless_egl_display",
"(",
")",
":",
"for",
"device",
"in",
"egl_get_devices",
"(",
")",
":",
"display",
"=",
"egl",
".",
"eglGetPlatformDisplayEXT",
"(",
"EGL_PLATFORM_DEVICE_EXT",
",",
"device",
",",
"None",
")",
"if",
"display",
"!="... | [
80,
0
] | [
96,
27
] | python | en | ['en', 'en', 'en'] | True |
create_opengl_context | (surface_size=(640, 480)) | Create offscreen OpenGL context and make it current.
Users are expected to directly use EGL API in case more advanced
context management is required.
Args:
surface_size: (width, height), size of the offscreen rendering surface.
| Create offscreen OpenGL context and make it current.
Users are expected to directly use EGL API in case more advanced
context management is required.
Args:
surface_size: (width, height), size of the offscreen rendering surface.
| def create_opengl_context(surface_size=(640, 480)):
"""Create offscreen OpenGL context and make it current.
Users are expected to directly use EGL API in case more advanced
context management is required.
Args:
surface_size: (width, height), size of the offscreen rendering surface.
"""
egl_di... | [
"def",
"create_opengl_context",
"(",
"surface_size",
"=",
"(",
"640",
",",
"480",
")",
")",
":",
"egl_display",
"=",
"create_initialized_headless_egl_display",
"(",
")",
"if",
"egl_display",
"==",
"egl",
".",
"EGL_NO_DISPLAY",
":",
"raise",
"ImportError",
"(",
"... | [
98,
0
] | [
141,
66
] | python | en | ['en', 'en', 'en'] | True |
_async_has_devices | (hass) | Return if there are devices that can be discovered. | Return if there are devices that can be discovered. | async def _async_has_devices(hass) -> bool:
"""Return if there are devices that can be discovered."""
# Check if there are any devices that can be discovered in the network.
try:
devices = await pykulersky.discover()
except pykulersky.PykulerskyException as exc:
_LOGGER.error("Unable to ... | [
"async",
"def",
"_async_has_devices",
"(",
"hass",
")",
"->",
"bool",
":",
"# Check if there are any devices that can be discovered in the network.",
"try",
":",
"devices",
"=",
"await",
"pykulersky",
".",
"discover",
"(",
")",
"except",
"pykulersky",
".",
"PykulerskyEx... | [
12,
0
] | [
20,
27
] | python | en | ['en', 'en', 'en'] | True |
HomePlusControlOAuth2Implementation.__init__ | (
self,
hass: HomeAssistant,
config_data: dict,
) | HomePlusControlOAuth2Implementation Constructor.
Initialize the authentication implementation for the Legrand Home+ Control API.
Args:
hass (HomeAssistant): HomeAssistant core object.
config_data (dict): Configuration data that complies with the config Schema
... | HomePlusControlOAuth2Implementation Constructor. | def __init__(
self,
hass: HomeAssistant,
config_data: dict,
) -> None:
"""HomePlusControlOAuth2Implementation Constructor.
Initialize the authentication implementation for the Legrand Home+ Control API.
Args:
hass (HomeAssistant): HomeAssistant core ... | [
"def",
"__init__",
"(",
"self",
",",
"hass",
":",
"HomeAssistant",
",",
"config_data",
":",
"dict",
",",
")",
"->",
"None",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"hass",
"=",
"hass",
",",
"domain",
"=",
"DOMAIN",
",",
"client_id",
"=",
"confi... | [
25,
4
] | [
47,
66
] | python | en | ['en', 'en', 'en'] | False |
HomePlusControlOAuth2Implementation.name | (self) | Name of the implementation. | Name of the implementation. | def name(self) -> str:
"""Name of the implementation."""
return "Home+ Control" | [
"def",
"name",
"(",
"self",
")",
"->",
"str",
":",
"return",
"\"Home+ Control\""
] | [
50,
4
] | [
52,
30
] | python | en | ['en', 'en', 'en'] | True |
setup_platform | (hass, config, add_entities, discovery_info=None) | Set up the pyLoad sensors. | Set up the pyLoad sensors. | def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the pyLoad sensors."""
host = config.get(CONF_HOST)
port = config.get(CONF_PORT)
protocol = "https" if config[CONF_SSL] else "http"
name = config.get(CONF_NAME)
username = config.get(CONF_USERNAME)
password = conf... | [
"def",
"setup_platform",
"(",
"hass",
",",
"config",
",",
"add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"host",
"=",
"config",
".",
"get",
"(",
"CONF_HOST",
")",
"port",
"=",
"config",
".",
"get",
"(",
"CONF_PORT",
")",
"protocol",
"=",
... | [
48,
0
] | [
75,
31
] | python | en | ['en', 'bg', 'en'] | True |
PyLoadSensor.__init__ | (self, api, sensor_type, client_name) | Initialize a new pyLoad sensor. | Initialize a new pyLoad sensor. | def __init__(self, api, sensor_type, client_name):
"""Initialize a new pyLoad sensor."""
self._name = f"{client_name} {sensor_type[1]}"
self.type = sensor_type[0]
self.api = api
self._state = None
self._unit_of_measurement = sensor_type[2] | [
"def",
"__init__",
"(",
"self",
",",
"api",
",",
"sensor_type",
",",
"client_name",
")",
":",
"self",
".",
"_name",
"=",
"f\"{client_name} {sensor_type[1]}\"",
"self",
".",
"type",
"=",
"sensor_type",
"[",
"0",
"]",
"self",
".",
"api",
"=",
"api",
"self",
... | [
81,
4
] | [
87,
50
] | python | en | ['en', 'ca', 'en'] | True |
PyLoadSensor.name | (self) | Return the name of the sensor. | Return the name of the sensor. | def name(self):
"""Return the name of the sensor."""
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | [
90,
4
] | [
92,
25
] | python | en | ['en', 'mi', 'en'] | True |
PyLoadSensor.native_value | (self) | Return the state of the sensor. | Return the state of the sensor. | def native_value(self):
"""Return the state of the sensor."""
return self._state | [
"def",
"native_value",
"(",
"self",
")",
":",
"return",
"self",
".",
"_state"
] | [
95,
4
] | [
97,
26
] | python | en | ['en', 'en', 'en'] | True |
PyLoadSensor.native_unit_of_measurement | (self) | Return the unit of measurement of this entity, if any. | Return the unit of measurement of this entity, if any. | def native_unit_of_measurement(self):
"""Return the unit of measurement of this entity, if any."""
return self._unit_of_measurement | [
"def",
"native_unit_of_measurement",
"(",
"self",
")",
":",
"return",
"self",
".",
"_unit_of_measurement"
] | [
100,
4
] | [
102,
40
] | python | en | ['en', 'en', 'en'] | True |
PyLoadSensor.update | (self) | Update state of sensor. | Update state of sensor. | def update(self):
"""Update state of sensor."""
try:
self.api.update()
except requests.exceptions.ConnectionError:
# Error calling the API, already logged in api.update()
return
if self.api.status is None:
_LOGGER.debug(
"U... | [
"def",
"update",
"(",
"self",
")",
":",
"try",
":",
"self",
".",
"api",
".",
"update",
"(",
")",
"except",
"requests",
".",
"exceptions",
".",
"ConnectionError",
":",
"# Error calling the API, already logged in api.update()",
"return",
"if",
"self",
".",
"api",
... | [
104,
4
] | [
127,
31
] | python | en | ['en', 'co', 'en'] | True |
PyLoadAPI.__init__ | (self, api_url, username=None, password=None) | Initialize pyLoad API and set headers needed later. | Initialize pyLoad API and set headers needed later. | def __init__(self, api_url, username=None, password=None):
"""Initialize pyLoad API and set headers needed later."""
self.api_url = api_url
self.status = None
self.headers = {CONTENT_TYPE: CONTENT_TYPE_JSON}
if username is not None and password is not None:
self.payl... | [
"def",
"__init__",
"(",
"self",
",",
"api_url",
",",
"username",
"=",
"None",
",",
"password",
"=",
"None",
")",
":",
"self",
".",
"api_url",
"=",
"api_url",
"self",
".",
"status",
"=",
"None",
"self",
".",
"headers",
"=",
"{",
"CONTENT_TYPE",
":",
"... | [
133,
4
] | [
142,
21
] | python | en | ['en', 'en', 'en'] | True |
PyLoadAPI.post | (self) | Send a POST request and return the response as a dict. | Send a POST request and return the response as a dict. | def post(self):
"""Send a POST request and return the response as a dict."""
try:
response = requests.post(
f"{self.api_url}statusServer",
cookies=self.login.cookies,
headers=self.headers,
timeout=5,
)
re... | [
"def",
"post",
"(",
"self",
")",
":",
"try",
":",
"response",
"=",
"requests",
".",
"post",
"(",
"f\"{self.api_url}statusServer\"",
",",
"cookies",
"=",
"self",
".",
"login",
".",
"cookies",
",",
"headers",
"=",
"self",
".",
"headers",
",",
"timeout",
"=... | [
144,
4
] | [
159,
17
] | python | en | ['en', 'en', 'en'] | True |
PyLoadAPI.update | (self) | Update cached response. | Update cached response. | def update(self):
"""Update cached response."""
self.status = self.post() | [
"def",
"update",
"(",
"self",
")",
":",
"self",
".",
"status",
"=",
"self",
".",
"post",
"(",
")"
] | [
162,
4
] | [
164,
33
] | python | en | ['en', 'en', 'en'] | True |
TestNullableClass.make_instance | (self, include_optional) | Test NullableClass
include_option is a boolean, when False only required
params are included, when True both required and
optional params are included | Test NullableClass
include_option is a boolean, when False only required
params are included, when True both required and
optional params are included | def make_instance(self, include_optional):
"""Test NullableClass
include_option is a boolean, when False only required
params are included, when True both required and
optional params are included """
# model = petstore_api.models.nullable_class.NullableClass() # noq... | [
"def",
"make_instance",
"(",
"self",
",",
"include_optional",
")",
":",
"# model = petstore_api.models.nullable_class.NullableClass() # noqa: E501",
"if",
"include_optional",
":",
"return",
"NullableClass",
"(",
"integer_prop",
"=",
"56",
",",
"number_prop",
"=",
"1.337",
... | [
30,
4
] | [
65,
9
] | python | it | ['it', 'lb', 'it'] | False |
TestNullableClass.testNullableClass | (self) | Test NullableClass | Test NullableClass | def testNullableClass(self):
"""Test NullableClass"""
inst_req_only = self.make_instance(include_optional=False)
inst_req_and_optional = self.make_instance(include_optional=True) | [
"def",
"testNullableClass",
"(",
"self",
")",
":",
"inst_req_only",
"=",
"self",
".",
"make_instance",
"(",
"include_optional",
"=",
"False",
")",
"inst_req_and_optional",
"=",
"self",
".",
"make_instance",
"(",
"include_optional",
"=",
"True",
")"
] | [
67,
4
] | [
70,
73
] | python | it | ['it', 'lb', 'it'] | False |
setup_platform | (hass, config, add_entities, discovery_info=None) | Set up the SCSGate switches. | Set up the SCSGate switches. | def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the SCSGate switches."""
logger = logging.getLogger(__name__)
scsgate = hass.data[DOMAIN]
_setup_traditional_switches(
logger=logger,
config=config,
scsgate=scsgate,
add_entities_callback=add_... | [
"def",
"setup_platform",
"(",
"hass",
",",
"config",
",",
"add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"logger",
"=",
"logging",
".",
"getLogger",
"(",
"__name__",
")",
"scsgate",
"=",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"_setup_tradi... | [
23,
0
] | [
35,
86
] | python | en | ['en', 'en', 'en'] | True |
_setup_traditional_switches | (logger, config, scsgate, add_entities_callback) | Add traditional SCSGate switches. | Add traditional SCSGate switches. | def _setup_traditional_switches(logger, config, scsgate, add_entities_callback):
"""Add traditional SCSGate switches."""
traditional = config.get(CONF_TRADITIONAL)
switches = []
if traditional:
for entity_info in traditional.values():
if entity_info[CONF_SCS_ID] in scsgate.devices:
... | [
"def",
"_setup_traditional_switches",
"(",
"logger",
",",
"config",
",",
"scsgate",
",",
"add_entities_callback",
")",
":",
"traditional",
"=",
"config",
".",
"get",
"(",
"CONF_TRADITIONAL",
")",
"switches",
"=",
"[",
"]",
"if",
"traditional",
":",
"for",
"ent... | [
38,
0
] | [
59,
45
] | python | en | ['en', 'en', 'en'] | True |
_setup_scenario_switches | (logger, config, scsgate, hass) | Add only SCSGate scenario switches. | Add only SCSGate scenario switches. | def _setup_scenario_switches(logger, config, scsgate, hass):
"""Add only SCSGate scenario switches."""
scenario = config.get(CONF_SCENARIO)
if scenario:
for entity_info in scenario.values():
if entity_info[CONF_SCS_ID] in scsgate.devices:
continue
name = ent... | [
"def",
"_setup_scenario_switches",
"(",
"logger",
",",
"config",
",",
"scsgate",
",",
"hass",
")",
":",
"scenario",
"=",
"config",
".",
"get",
"(",
"CONF_SCENARIO",
")",
"if",
"scenario",
":",
"for",
"entity_info",
"in",
"scenario",
".",
"values",
"(",
")"... | [
62,
0
] | [
79,
38
] | python | en | ['en', 'en', 'en'] | True |
SCSGateSwitch.__init__ | (self, scs_id, name, logger, scsgate) | Initialize the switch. | Initialize the switch. | def __init__(self, scs_id, name, logger, scsgate):
"""Initialize the switch."""
self._name = name
self._scs_id = scs_id
self._toggled = False
self._logger = logger
self._scsgate = scsgate | [
"def",
"__init__",
"(",
"self",
",",
"scs_id",
",",
"name",
",",
"logger",
",",
"scsgate",
")",
":",
"self",
".",
"_name",
"=",
"name",
"self",
".",
"_scs_id",
"=",
"scs_id",
"self",
".",
"_toggled",
"=",
"False",
"self",
".",
"_logger",
"=",
"logger... | [
85,
4
] | [
91,
31
] | python | en | ['en', 'en', 'en'] | True |
SCSGateSwitch.scs_id | (self) | Return the SCS ID. | Return the SCS ID. | def scs_id(self):
"""Return the SCS ID."""
return self._scs_id | [
"def",
"scs_id",
"(",
"self",
")",
":",
"return",
"self",
".",
"_scs_id"
] | [
94,
4
] | [
96,
27
] | python | en | ['en', 'la', 'en'] | True |
SCSGateSwitch.should_poll | (self) | No polling needed. | No polling needed. | def should_poll(self):
"""No polling needed."""
return False | [
"def",
"should_poll",
"(",
"self",
")",
":",
"return",
"False"
] | [
99,
4
] | [
101,
20
] | python | en | ['en', 'en', 'en'] | True |
SCSGateSwitch.name | (self) | Return the name of the device if any. | Return the name of the device if any. | def name(self):
"""Return the name of the device if any."""
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | [
104,
4
] | [
106,
25
] | python | en | ['en', 'en', 'en'] | True |
SCSGateSwitch.is_on | (self) | Return true if switch is on. | Return true if switch is on. | def is_on(self):
"""Return true if switch is on."""
return self._toggled | [
"def",
"is_on",
"(",
"self",
")",
":",
"return",
"self",
".",
"_toggled"
] | [
109,
4
] | [
111,
28
] | python | en | ['en', 'fy', 'en'] | True |
SCSGateSwitch.turn_on | (self, **kwargs) | Turn the device on. | Turn the device on. | def turn_on(self, **kwargs):
"""Turn the device on."""
self._scsgate.append_task(ToggleStatusTask(target=self._scs_id, toggled=True))
self._toggled = True
self.schedule_update_ha_state() | [
"def",
"turn_on",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_scsgate",
".",
"append_task",
"(",
"ToggleStatusTask",
"(",
"target",
"=",
"self",
".",
"_scs_id",
",",
"toggled",
"=",
"True",
")",
")",
"self",
".",
"_toggled",
"=",
"... | [
113,
4
] | [
119,
39
] | python | en | ['en', 'en', 'en'] | True |
SCSGateSwitch.turn_off | (self, **kwargs) | Turn the device off. | Turn the device off. | def turn_off(self, **kwargs):
"""Turn the device off."""
self._scsgate.append_task(ToggleStatusTask(target=self._scs_id, toggled=False))
self._toggled = False
self.schedule_update_ha_state() | [
"def",
"turn_off",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_scsgate",
".",
"append_task",
"(",
"ToggleStatusTask",
"(",
"target",
"=",
"self",
".",
"_scs_id",
",",
"toggled",
"=",
"False",
")",
")",
"self",
".",
"_toggled",
"=",
... | [
121,
4
] | [
127,
39
] | python | en | ['en', 'en', 'en'] | True |
SCSGateSwitch.process_event | (self, message) | Handle a SCSGate message related with this switch. | Handle a SCSGate message related with this switch. | def process_event(self, message):
"""Handle a SCSGate message related with this switch."""
if self._toggled == message.toggled:
self._logger.info(
"Switch %s, ignoring message %s because state already active",
self._scs_id,
message,
... | [
"def",
"process_event",
"(",
"self",
",",
"message",
")",
":",
"if",
"self",
".",
"_toggled",
"==",
"message",
".",
"toggled",
":",
"self",
".",
"_logger",
".",
"info",
"(",
"\"Switch %s, ignoring message %s because state already active\"",
",",
"self",
".",
"_s... | [
129,
4
] | [
149,
9
] | python | en | ['en', 'en', 'en'] | True |
SCSGateScenarioSwitch.__init__ | (self, scs_id, name, logger, hass) | Initialize the scenario. | Initialize the scenario. | def __init__(self, scs_id, name, logger, hass):
"""Initialize the scenario."""
self._name = name
self._scs_id = scs_id
self._logger = logger
self._hass = hass | [
"def",
"__init__",
"(",
"self",
",",
"scs_id",
",",
"name",
",",
"logger",
",",
"hass",
")",
":",
"self",
".",
"_name",
"=",
"name",
"self",
".",
"_scs_id",
"=",
"scs_id",
"self",
".",
"_logger",
"=",
"logger",
"self",
".",
"_hass",
"=",
"hass"
] | [
159,
4
] | [
164,
25
] | python | en | ['en', 'la', 'en'] | True |
SCSGateScenarioSwitch.scs_id | (self) | Return the SCS ID. | Return the SCS ID. | def scs_id(self):
"""Return the SCS ID."""
return self._scs_id | [
"def",
"scs_id",
"(",
"self",
")",
":",
"return",
"self",
".",
"_scs_id"
] | [
167,
4
] | [
169,
27
] | python | en | ['en', 'la', 'en'] | True |
SCSGateScenarioSwitch.name | (self) | Return the name of the device if any. | Return the name of the device if any. | def name(self):
"""Return the name of the device if any."""
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | [
172,
4
] | [
174,
25
] | python | en | ['en', 'en', 'en'] | True |
SCSGateScenarioSwitch.process_event | (self, message) | Handle a SCSGate message related with this switch. | Handle a SCSGate message related with this switch. | def process_event(self, message):
"""Handle a SCSGate message related with this switch."""
if isinstance(message, StateMessage):
scenario_id = message.bytes[4]
elif isinstance(message, ScenarioTriggeredMessage):
scenario_id = message.scenario
else:
se... | [
"def",
"process_event",
"(",
"self",
",",
"message",
")",
":",
"if",
"isinstance",
"(",
"message",
",",
"StateMessage",
")",
":",
"scenario_id",
"=",
"message",
".",
"bytes",
"[",
"4",
"]",
"elif",
"isinstance",
"(",
"message",
",",
"ScenarioTriggeredMessage... | [
176,
4
] | [
190,
9
] | python | en | ['en', 'en', 'en'] | True |
setup_platform | (hass, config, add_entities, discovery_info=None) | Set up the GeoRSS component. | Set up the GeoRSS component. | def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the GeoRSS component."""
latitude = config.get(CONF_LATITUDE, hass.config.latitude)
longitude = config.get(CONF_LONGITUDE, hass.config.longitude)
url = config.get(CONF_URL)
radius_in_km = config.get(CONF_RADIUS)
name ... | [
"def",
"setup_platform",
"(",
"hass",
",",
"config",
",",
"add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"latitude",
"=",
"config",
".",
"get",
"(",
"CONF_LATITUDE",
",",
"hass",
".",
"config",
".",
"latitude",
")",
"longitude",
"=",
"config... | [
58,
0
] | [
94,
31
] | python | en | ['en', 'en', 'en'] | True |
GeoRssServiceSensor.__init__ | (
self, coordinates, url, radius, category, service_name, unit_of_measurement
) | Initialize the sensor. | Initialize the sensor. | def __init__(
self, coordinates, url, radius, category, service_name, unit_of_measurement
):
"""Initialize the sensor."""
self._category = category
self._service_name = service_name
self._state = None
self._state_attributes = None
self._unit_of_measurement = u... | [
"def",
"__init__",
"(",
"self",
",",
"coordinates",
",",
"url",
",",
"radius",
",",
"category",
",",
"service_name",
",",
"unit_of_measurement",
")",
":",
"self",
".",
"_category",
"=",
"category",
"self",
".",
"_service_name",
"=",
"service_name",
"self",
"... | [
100,
4
] | [
115,
9
] | python | en | ['en', 'en', 'en'] | True |
GeoRssServiceSensor.name | (self) | Return the name of the sensor. | Return the name of the sensor. | def name(self):
"""Return the name of the sensor."""
return f"{self._service_name} {'Any' if self._category is None else self._category}" | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"f\"{self._service_name} {'Any' if self._category is None else self._category}\""
] | [
118,
4
] | [
120,
92
] | python | en | ['en', 'mi', 'en'] | True |
GeoRssServiceSensor.native_value | (self) | Return the state of the sensor. | Return the state of the sensor. | def native_value(self):
"""Return the state of the sensor."""
return self._state | [
"def",
"native_value",
"(",
"self",
")",
":",
"return",
"self",
".",
"_state"
] | [
123,
4
] | [
125,
26
] | python | en | ['en', 'en', 'en'] | True |
GeoRssServiceSensor.native_unit_of_measurement | (self) | Return the unit of measurement. | Return the unit of measurement. | def native_unit_of_measurement(self):
"""Return the unit of measurement."""
return self._unit_of_measurement | [
"def",
"native_unit_of_measurement",
"(",
"self",
")",
":",
"return",
"self",
".",
"_unit_of_measurement"
] | [
128,
4
] | [
130,
40
] | python | en | ['en', 'la', 'en'] | True |
GeoRssServiceSensor.icon | (self) | Return the default icon to use in the frontend. | Return the default icon to use in the frontend. | def icon(self):
"""Return the default icon to use in the frontend."""
return DEFAULT_ICON | [
"def",
"icon",
"(",
"self",
")",
":",
"return",
"DEFAULT_ICON"
] | [
133,
4
] | [
135,
27
] | python | en | ['en', 'en', 'en'] | True |
GeoRssServiceSensor.extra_state_attributes | (self) | Return the state attributes. | Return the state attributes. | def extra_state_attributes(self):
"""Return the state attributes."""
return self._state_attributes | [
"def",
"extra_state_attributes",
"(",
"self",
")",
":",
"return",
"self",
".",
"_state_attributes"
] | [
138,
4
] | [
140,
37
] | python | en | ['en', 'en', 'en'] | True |
GeoRssServiceSensor.update | (self) | Update this sensor from the GeoRSS service. | Update this sensor from the GeoRSS service. | def update(self):
"""Update this sensor from the GeoRSS service."""
status, feed_entries = self._feed.update()
if status == UPDATE_OK:
_LOGGER.debug(
"Adding events to sensor %s: %s", self.entity_id, feed_entries
)
self._state = len(feed_entri... | [
"def",
"update",
"(",
"self",
")",
":",
"status",
",",
"feed_entries",
"=",
"self",
".",
"_feed",
".",
"update",
"(",
")",
"if",
"status",
"==",
"UPDATE_OK",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Adding events to sensor %s: %s\"",
",",
"self",
".",
"entity... | [
142,
4
] | [
166,
39
] | python | en | ['en', 'en', 'en'] | True |
test_redact_called_classic | (redact) |
Verify that redact is always called during classic collection
|
Verify that redact is always called during classic collection
| def test_redact_called_classic(redact):
'''
Verify that redact is always called during classic collection
'''
conf = InsightsConfig()
upload_conf = {'commands': [], 'files': [], 'globs': []}
rm_conf = {'test': 'test'}
branch_info = {'test1': 'test2'}
blacklist_report = {'test3': 'test4'}... | [
"def",
"test_redact_called_classic",
"(",
"redact",
")",
":",
"conf",
"=",
"InsightsConfig",
"(",
")",
"upload_conf",
"=",
"{",
"'commands'",
":",
"[",
"]",
",",
"'files'",
":",
"[",
"]",
",",
"'globs'",
":",
"[",
"]",
"}",
"rm_conf",
"=",
"{",
"'test'... | [
19,
0
] | [
30,
43
] | python | en | ['en', 'error', 'th'] | False |
test_redact_called_core | (redact) |
Verify that redact is always called during core collection
|
Verify that redact is always called during core collection
| def test_redact_called_core(redact):
'''
Verify that redact is always called during core collection
'''
conf = InsightsConfig(core_collect=True)
upload_conf = None
rm_conf = {'test': 'test'}
branch_info = {'test1': 'test2'}
blacklist_report = {'test3': 'test4'}
dc = CoreCollector(con... | [
"def",
"test_redact_called_core",
"(",
"redact",
")",
":",
"conf",
"=",
"InsightsConfig",
"(",
"core_collect",
"=",
"True",
")",
"upload_conf",
"=",
"None",
"rm_conf",
"=",
"{",
"'test'",
":",
"'test'",
"}",
"branch_info",
"=",
"{",
"'test1'",
":",
"'test2'"... | [
41,
0
] | [
52,
43
] | python | en | ['en', 'error', 'th'] | False |
test_redact_call_walk | (walk) |
Verify that redact() calls os.walk and when an
an archive structure is present in /var/tmp/**/insights-*
|
Verify that redact() calls os.walk and when an
an archive structure is present in /var/tmp/**/insights-*
| def test_redact_call_walk(walk):
'''
Verify that redact() calls os.walk and when an
an archive structure is present in /var/tmp/**/insights-*
'''
conf = InsightsConfig()
arch = InsightsArchive(conf)
arch.create_archive_dir()
dc = DataCollector(conf, arch)
rm_conf = {}
dc.redact... | [
"def",
"test_redact_call_walk",
"(",
"walk",
")",
":",
"conf",
"=",
"InsightsConfig",
"(",
")",
"arch",
"=",
"InsightsArchive",
"(",
"conf",
")",
"arch",
".",
"create_archive_dir",
"(",
")",
"dc",
"=",
"DataCollector",
"(",
"conf",
",",
"arch",
")",
"rm_co... | [
56,
0
] | [
69,
50
] | python | en | ['en', 'error', 'th'] | False |
test_redact_call_walk_core | (walk) |
Verify that redact() calls os.walk and when an
an archive structure is present in /var/tmp/**/insights-*
With core collection, /data is added to the path
|
Verify that redact() calls os.walk and when an
an archive structure is present in /var/tmp/**/insights-*
With core collection, /data is added to the path
| def test_redact_call_walk_core(walk):
'''
Verify that redact() calls os.walk and when an
an archive structure is present in /var/tmp/**/insights-*
With core collection, /data is added to the path
'''
conf = InsightsConfig(core_collect=True)
arch = InsightsArchive(conf)
arch.create_archiv... | [
"def",
"test_redact_call_walk_core",
"(",
"walk",
")",
":",
"conf",
"=",
"InsightsConfig",
"(",
"core_collect",
"=",
"True",
")",
"arch",
"=",
"InsightsArchive",
"(",
"conf",
")",
"arch",
".",
"create_archive_dir",
"(",
")",
"dc",
"=",
"DataCollector",
"(",
... | [
74,
0
] | [
88,
72
] | python | en | ['en', 'error', 'th'] | False |
test_redact_call_process_redaction | (_process_content_redaction) |
Verify that redact() calls _process_content_redaction
then writes the returned data back to the same file
Also verifies that the "exclude" parameter is None and the
"regex" parameter is False in the _process_content_redaction
call when rm_conf is empty
|
Verify that redact() calls _process_content_redaction
then writes the returned data back to the same file | def test_redact_call_process_redaction(_process_content_redaction):
'''
Verify that redact() calls _process_content_redaction
then writes the returned data back to the same file
Also verifies that the "exclude" parameter is None and the
"regex" parameter is False in the _process_content_redaction
... | [
"def",
"test_redact_call_process_redaction",
"(",
"_process_content_redaction",
")",
":",
"conf",
"=",
"InsightsConfig",
"(",
")",
"arch",
"=",
"InsightsArchive",
"(",
"conf",
")",
"arch",
".",
"create_archive_dir",
"(",
")",
"# put something in the archive to redact",
... | [
92,
0
] | [
122,
124
] | python | en | ['en', 'error', 'th'] | False |
test_redact_exclude_regex | (_process_content_redaction) |
Verify that the _process_content_redaction call is made with
exclude == list of strings and regex == True when a list of
regex strings is defined in rm_conf
|
Verify that the _process_content_redaction call is made with
exclude == list of strings and regex == True when a list of
regex strings is defined in rm_conf
| def test_redact_exclude_regex(_process_content_redaction):
'''
Verify that the _process_content_redaction call is made with
exclude == list of strings and regex == True when a list of
regex strings is defined in rm_conf
'''
conf = InsightsConfig()
arch = InsightsArchive(conf)
arch.create... | [
"def",
"test_redact_exclude_regex",
"(",
"_process_content_redaction",
")",
":",
"conf",
"=",
"InsightsConfig",
"(",
")",
"arch",
"=",
"InsightsArchive",
"(",
"conf",
")",
"arch",
".",
"create_archive_dir",
"(",
")",
"# put something in the archive to redact",
"test_fil... | [
126,
0
] | [
151,
95
] | python | en | ['en', 'error', 'th'] | False |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.