Search is not available for this dataset
identifier stringlengths 1 155 | parameters stringlengths 2 6.09k | docstring stringlengths 11 63.4k | docstring_summary stringlengths 0 63.4k | function stringlengths 29 99.8k | function_tokens list | start_point list | end_point list | language stringclasses 1
value | docstring_language stringlengths 2 7 | docstring_language_predictions stringlengths 18 23 | is_langid_reliable stringclasses 2
values |
|---|---|---|---|---|---|---|---|---|---|---|---|
test_proxy_config | (hass) | Test use_x_forwarded_for must config together with trusted_proxies. | Test use_x_forwarded_for must config together with trusted_proxies. | async def test_proxy_config(hass):
"""Test use_x_forwarded_for must config together with trusted_proxies."""
assert (
await async_setup_component(
hass,
"http",
{
"http": {
http.CONF_USE_X_FORWARDED_FOR: True,
ht... | [
"async",
"def",
"test_proxy_config",
"(",
"hass",
")",
":",
"assert",
"(",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"http\"",
",",
"{",
"\"http\"",
":",
"{",
"http",
".",
"CONF_USE_X_FORWARDED_FOR",
":",
"True",
",",
"http",
".",
"CONF_TRUSTED_PRO... | [
146,
0
] | [
160,
5
] | python | en | ['en', 'en', 'en'] | True |
test_proxy_config_only_use_xff | (hass) | Test use_x_forwarded_for must config together with trusted_proxies. | Test use_x_forwarded_for must config together with trusted_proxies. | async def test_proxy_config_only_use_xff(hass):
"""Test use_x_forwarded_for must config together with trusted_proxies."""
assert (
await async_setup_component(
hass, "http", {"http": {http.CONF_USE_X_FORWARDED_FOR: True}}
)
is not True
) | [
"async",
"def",
"test_proxy_config_only_use_xff",
"(",
"hass",
")",
":",
"assert",
"(",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"http\"",
",",
"{",
"\"http\"",
":",
"{",
"http",
".",
"CONF_USE_X_FORWARDED_FOR",
":",
"True",
"}",
"}",
")",
"is",
... | [
163,
0
] | [
170,
5
] | python | en | ['en', 'en', 'en'] | True |
test_proxy_config_only_trust_proxies | (hass) | Test use_x_forwarded_for must config together with trusted_proxies. | Test use_x_forwarded_for must config together with trusted_proxies. | async def test_proxy_config_only_trust_proxies(hass):
"""Test use_x_forwarded_for must config together with trusted_proxies."""
assert (
await async_setup_component(
hass, "http", {"http": {http.CONF_TRUSTED_PROXIES: ["127.0.0.1"]}}
)
is not True
) | [
"async",
"def",
"test_proxy_config_only_trust_proxies",
"(",
"hass",
")",
":",
"assert",
"(",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"http\"",
",",
"{",
"\"http\"",
":",
"{",
"http",
".",
"CONF_TRUSTED_PROXIES",
":",
"[",
"\"127.0.0.1\"",
"]",
"}"... | [
173,
0
] | [
180,
5
] | python | en | ['en', 'en', 'en'] | True |
test_ssl_profile_defaults_modern | (hass) | Test default ssl profile. | Test default ssl profile. | async def test_ssl_profile_defaults_modern(hass):
"""Test default ssl profile."""
assert await async_setup_component(hass, "http", {}) is True
hass.http.ssl_certificate = "bla"
with patch("ssl.SSLContext.load_cert_chain"), patch(
"homeassistant.util.ssl.server_context_modern",
side_eff... | [
"async",
"def",
"test_ssl_profile_defaults_modern",
"(",
"hass",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"http\"",
",",
"{",
"}",
")",
"is",
"True",
"hass",
".",
"http",
".",
"ssl_certificate",
"=",
"\"bla\"",
"with",
"patch",... | [
183,
0
] | [
196,
44
] | python | fr | ['fr', 'fr', 'en'] | True |
test_ssl_profile_change_intermediate | (hass) | Test setting ssl profile to intermediate. | Test setting ssl profile to intermediate. | async def test_ssl_profile_change_intermediate(hass):
"""Test setting ssl profile to intermediate."""
assert (
await async_setup_component(
hass, "http", {"http": {"ssl_profile": "intermediate"}}
)
is True
)
hass.http.ssl_certificate = "bla"
with patch("ssl.SSLC... | [
"async",
"def",
"test_ssl_profile_change_intermediate",
"(",
"hass",
")",
":",
"assert",
"(",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"http\"",
",",
"{",
"\"http\"",
":",
"{",
"\"ssl_profile\"",
":",
"\"intermediate\"",
"}",
"}",
")",
"is",
"True",... | [
199,
0
] | [
217,
44
] | python | en | ['en', 'it', 'en'] | True |
test_ssl_profile_change_modern | (hass) | Test setting ssl profile to modern. | Test setting ssl profile to modern. | async def test_ssl_profile_change_modern(hass):
"""Test setting ssl profile to modern."""
assert (
await async_setup_component(hass, "http", {"http": {"ssl_profile": "modern"}})
is True
)
hass.http.ssl_certificate = "bla"
with patch("ssl.SSLContext.load_cert_chain"), patch(
... | [
"async",
"def",
"test_ssl_profile_change_modern",
"(",
"hass",
")",
":",
"assert",
"(",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"http\"",
",",
"{",
"\"http\"",
":",
"{",
"\"ssl_profile\"",
":",
"\"modern\"",
"}",
"}",
")",
"is",
"True",
")",
"h... | [
220,
0
] | [
236,
44
] | python | en | ['en', 'en', 'en'] | True |
test_cors_defaults | (hass) | Test the CORS default settings. | Test the CORS default settings. | async def test_cors_defaults(hass):
"""Test the CORS default settings."""
with patch("homeassistant.components.http.setup_cors") as mock_setup:
assert await async_setup_component(hass, "http", {})
assert len(mock_setup.mock_calls) == 1
assert mock_setup.mock_calls[0][1][1] == ["https://cast.hom... | [
"async",
"def",
"test_cors_defaults",
"(",
"hass",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.http.setup_cors\"",
")",
"as",
"mock_setup",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"http\"",
",",
"{",
"}",
")",
"assert",... | [
239,
0
] | [
245,
79
] | python | en | ['en', 'en', 'en'] | True |
test_storing_config | (hass, aiohttp_client, aiohttp_unused_port) | Test that we store last working config. | Test that we store last working config. | async def test_storing_config(hass, aiohttp_client, aiohttp_unused_port):
"""Test that we store last working config."""
config = {
http.CONF_SERVER_PORT: aiohttp_unused_port(),
"use_x_forwarded_for": True,
"trusted_proxies": ["192.168.1.100"],
}
assert await async_setup_componen... | [
"async",
"def",
"test_storing_config",
"(",
"hass",
",",
"aiohttp_client",
",",
"aiohttp_unused_port",
")",
":",
"config",
"=",
"{",
"http",
".",
"CONF_SERVER_PORT",
":",
"aiohttp_unused_port",
"(",
")",
",",
"\"use_x_forwarded_for\"",
":",
"True",
",",
"\"trusted... | [
248,
0
] | [
262,
47
] | python | en | ['en', 'en', 'en'] | True |
test_use_of_base_url | (hass) | Test detection base_url usage when called without integration context. | Test detection base_url usage when called without integration context. | async def test_use_of_base_url(hass):
"""Test detection base_url usage when called without integration context."""
await async_setup_component(hass, "http", {"http": {}})
with patch(
"homeassistant.components.http.extract_stack",
return_value=[
Mock(
filename="/ho... | [
"async",
"def",
"test_use_of_base_url",
"(",
"hass",
")",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"http\"",
",",
"{",
"\"http\"",
":",
"{",
"}",
"}",
")",
"with",
"patch",
"(",
"\"homeassistant.components.http.extract_stack\"",
",",
"return_valu... | [
265,
0
] | [
288,
32
] | python | en | ['en', 'en', 'en'] | True |
test_use_of_base_url_integration | (hass, caplog) | Test detection base_url usage when called with integration context. | Test detection base_url usage when called with integration context. | async def test_use_of_base_url_integration(hass, caplog):
"""Test detection base_url usage when called with integration context."""
await async_setup_component(hass, "http", {"http": {}})
with patch(
"homeassistant.components.http.extract_stack",
return_value=[
Mock(
... | [
"async",
"def",
"test_use_of_base_url_integration",
"(",
"hass",
",",
"caplog",
")",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"http\"",
",",
"{",
"\"http\"",
":",
"{",
"}",
"}",
")",
"with",
"patch",
"(",
"\"homeassistant.components.http.extract_... | [
291,
0
] | [
319,
5
] | python | en | ['en', 'en', 'en'] | True |
test_use_of_base_url_integration_webhook | (hass, caplog) | Test detection base_url usage when called with integration context. | Test detection base_url usage when called with integration context. | async def test_use_of_base_url_integration_webhook(hass, caplog):
"""Test detection base_url usage when called with integration context."""
await async_setup_component(hass, "http", {"http": {}})
with patch(
"homeassistant.components.http.extract_stack",
return_value=[
Mock(
... | [
"async",
"def",
"test_use_of_base_url_integration_webhook",
"(",
"hass",
",",
"caplog",
")",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"http\"",
",",
"{",
"\"http\"",
":",
"{",
"}",
"}",
")",
"with",
"patch",
"(",
"\"homeassistant.components.http.... | [
322,
0
] | [
355,
5
] | python | en | ['en', 'en', 'en'] | True |
test_use_of_base_url_custom_component | (hass, caplog) | Test detection base_url usage when called with custom component context. | Test detection base_url usage when called with custom component context. | async def test_use_of_base_url_custom_component(hass, caplog):
"""Test detection base_url usage when called with custom component context."""
await async_setup_component(hass, "http", {"http": {}})
with patch(
"homeassistant.components.http.extract_stack",
return_value=[
Mock(
... | [
"async",
"def",
"test_use_of_base_url_custom_component",
"(",
"hass",
",",
"caplog",
")",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"http\"",
",",
"{",
"\"http\"",
":",
"{",
"}",
"}",
")",
"with",
"patch",
"(",
"\"homeassistant.components.http.ext... | [
358,
0
] | [
386,
5
] | python | en | ['en', 'en', 'en'] | True |
TestView.get | (self, request) | Return a get request. | Return a get request. | async def get(self, request):
"""Return a get request."""
return "hello" | [
"async",
"def",
"get",
"(",
"self",
",",
"request",
")",
":",
"return",
"\"hello\""
] | [
45,
4
] | [
47,
22
] | python | en | ['en', 'co', 'en'] | True |
test_brightness_light | (hass) | Test brightness trait support for light domain. | Test brightness trait support for light domain. | async def test_brightness_light(hass):
"""Test brightness trait support for light domain."""
assert helpers.get_google_type(light.DOMAIN, None) is not None
assert trait.BrightnessTrait.supported(light.DOMAIN, light.SUPPORT_BRIGHTNESS, None)
trt = trait.BrightnessTrait(
hass,
State("ligh... | [
"async",
"def",
"test_brightness_light",
"(",
"hass",
")",
":",
"assert",
"helpers",
".",
"get_google_type",
"(",
"light",
".",
"DOMAIN",
",",
"None",
")",
"is",
"not",
"None",
"assert",
"trait",
".",
"BrightnessTrait",
".",
"supported",
"(",
"light",
".",
... | [
71,
0
] | [
103,
5
] | python | en | ['en', 'no', 'en'] | True |
test_camera_stream | (hass) | Test camera stream trait support for camera domain. | Test camera stream trait support for camera domain. | async def test_camera_stream(hass):
"""Test camera stream trait support for camera domain."""
await async_process_ha_core_config(
hass,
{"external_url": "https://example.com"},
)
assert helpers.get_google_type(camera.DOMAIN, None) is not None
assert trait.CameraStreamTrait.supported(... | [
"async",
"def",
"test_camera_stream",
"(",
"hass",
")",
":",
"await",
"async_process_ha_core_config",
"(",
"hass",
",",
"{",
"\"external_url\"",
":",
"\"https://example.com\"",
"}",
",",
")",
"assert",
"helpers",
".",
"get_google_type",
"(",
"camera",
".",
"DOMAIN... | [
106,
0
] | [
136,
5
] | python | en | ['fr', 'en', 'en'] | True |
test_onoff_group | (hass) | Test OnOff trait support for group domain. | Test OnOff trait support for group domain. | async def test_onoff_group(hass):
"""Test OnOff trait support for group domain."""
assert helpers.get_google_type(group.DOMAIN, None) is not None
assert trait.OnOffTrait.supported(group.DOMAIN, 0, None)
trt_on = trait.OnOffTrait(hass, State("group.bla", STATE_ON), BASIC_CONFIG)
assert trt_on.sync_... | [
"async",
"def",
"test_onoff_group",
"(",
"hass",
")",
":",
"assert",
"helpers",
".",
"get_google_type",
"(",
"group",
".",
"DOMAIN",
",",
"None",
")",
"is",
"not",
"None",
"assert",
"trait",
".",
"OnOffTrait",
".",
"supported",
"(",
"group",
".",
"DOMAIN",... | [
139,
0
] | [
162,
61
] | python | en | ['en', 'en', 'en'] | True |
test_onoff_input_boolean | (hass) | Test OnOff trait support for input_boolean domain. | Test OnOff trait support for input_boolean domain. | async def test_onoff_input_boolean(hass):
"""Test OnOff trait support for input_boolean domain."""
assert helpers.get_google_type(input_boolean.DOMAIN, None) is not None
assert trait.OnOffTrait.supported(input_boolean.DOMAIN, 0, None)
trt_on = trait.OnOffTrait(hass, State("input_boolean.bla", STATE_ON)... | [
"async",
"def",
"test_onoff_input_boolean",
"(",
"hass",
")",
":",
"assert",
"helpers",
".",
"get_google_type",
"(",
"input_boolean",
".",
"DOMAIN",
",",
"None",
")",
"is",
"not",
"None",
"assert",
"trait",
".",
"OnOffTrait",
".",
"supported",
"(",
"input_bool... | [
165,
0
] | [
190,
69
] | python | en | ['fr', 'en', 'nl'] | False |
test_onoff_switch | (hass) | Test OnOff trait support for switch domain. | Test OnOff trait support for switch domain. | async def test_onoff_switch(hass):
"""Test OnOff trait support for switch domain."""
assert helpers.get_google_type(switch.DOMAIN, None) is not None
assert trait.OnOffTrait.supported(switch.DOMAIN, 0, None)
trt_on = trait.OnOffTrait(hass, State("switch.bla", STATE_ON), BASIC_CONFIG)
assert trt_on.... | [
"async",
"def",
"test_onoff_switch",
"(",
"hass",
")",
":",
"assert",
"helpers",
".",
"get_google_type",
"(",
"switch",
".",
"DOMAIN",
",",
"None",
")",
"is",
"not",
"None",
"assert",
"trait",
".",
"OnOffTrait",
".",
"supported",
"(",
"switch",
".",
"DOMAI... | [
193,
0
] | [
221,
62
] | python | en | ['en', 'en', 'en'] | True |
test_onoff_fan | (hass) | Test OnOff trait support for fan domain. | Test OnOff trait support for fan domain. | async def test_onoff_fan(hass):
"""Test OnOff trait support for fan domain."""
assert helpers.get_google_type(fan.DOMAIN, None) is not None
assert trait.OnOffTrait.supported(fan.DOMAIN, 0, None)
trt_on = trait.OnOffTrait(hass, State("fan.bla", STATE_ON), BASIC_CONFIG)
assert trt_on.sync_attributes... | [
"async",
"def",
"test_onoff_fan",
"(",
"hass",
")",
":",
"assert",
"helpers",
".",
"get_google_type",
"(",
"fan",
".",
"DOMAIN",
",",
"None",
")",
"is",
"not",
"None",
"assert",
"trait",
".",
"OnOffTrait",
".",
"supported",
"(",
"fan",
".",
"DOMAIN",
","... | [
224,
0
] | [
246,
59
] | python | en | ['fr', 'en', 'en'] | True |
test_onoff_light | (hass) | Test OnOff trait support for light domain. | Test OnOff trait support for light domain. | async def test_onoff_light(hass):
"""Test OnOff trait support for light domain."""
assert helpers.get_google_type(light.DOMAIN, None) is not None
assert trait.OnOffTrait.supported(light.DOMAIN, 0, None)
trt_on = trait.OnOffTrait(hass, State("light.bla", STATE_ON), BASIC_CONFIG)
assert trt_on.sync_... | [
"async",
"def",
"test_onoff_light",
"(",
"hass",
")",
":",
"assert",
"helpers",
".",
"get_google_type",
"(",
"light",
".",
"DOMAIN",
",",
"None",
")",
"is",
"not",
"None",
"assert",
"trait",
".",
"OnOffTrait",
".",
"supported",
"(",
"light",
".",
"DOMAIN",... | [
249,
0
] | [
272,
61
] | python | en | ['en', 'en', 'en'] | True |
test_onoff_media_player | (hass) | Test OnOff trait support for media_player domain. | Test OnOff trait support for media_player domain. | async def test_onoff_media_player(hass):
"""Test OnOff trait support for media_player domain."""
assert helpers.get_google_type(media_player.DOMAIN, None) is not None
assert trait.OnOffTrait.supported(media_player.DOMAIN, 0, None)
trt_on = trait.OnOffTrait(hass, State("media_player.bla", STATE_ON), BAS... | [
"async",
"def",
"test_onoff_media_player",
"(",
"hass",
")",
":",
"assert",
"helpers",
".",
"get_google_type",
"(",
"media_player",
".",
"DOMAIN",
",",
"None",
")",
"is",
"not",
"None",
"assert",
"trait",
".",
"OnOffTrait",
".",
"supported",
"(",
"media_player... | [
275,
0
] | [
299,
68
] | python | en | ['fr', 'en', 'en'] | True |
test_onoff_humidifier | (hass) | Test OnOff trait support for humidifier domain. | Test OnOff trait support for humidifier domain. | async def test_onoff_humidifier(hass):
"""Test OnOff trait support for humidifier domain."""
assert helpers.get_google_type(humidifier.DOMAIN, None) is not None
assert trait.OnOffTrait.supported(humidifier.DOMAIN, 0, None)
trt_on = trait.OnOffTrait(hass, State("humidifier.bla", STATE_ON), BASIC_CONFIG)... | [
"async",
"def",
"test_onoff_humidifier",
"(",
"hass",
")",
":",
"assert",
"helpers",
".",
"get_google_type",
"(",
"humidifier",
".",
"DOMAIN",
",",
"None",
")",
"is",
"not",
"None",
"assert",
"trait",
".",
"OnOffTrait",
".",
"supported",
"(",
"humidifier",
"... | [
302,
0
] | [
326,
66
] | python | en | ['en', 'en', 'en'] | True |
test_dock_vacuum | (hass) | Test dock trait support for vacuum domain. | Test dock trait support for vacuum domain. | async def test_dock_vacuum(hass):
"""Test dock trait support for vacuum domain."""
assert helpers.get_google_type(vacuum.DOMAIN, None) is not None
assert trait.DockTrait.supported(vacuum.DOMAIN, 0, None)
trt = trait.DockTrait(hass, State("vacuum.bla", vacuum.STATE_IDLE), BASIC_CONFIG)
assert trt.s... | [
"async",
"def",
"test_dock_vacuum",
"(",
"hass",
")",
":",
"assert",
"helpers",
".",
"get_google_type",
"(",
"vacuum",
".",
"DOMAIN",
",",
"None",
")",
"is",
"not",
"None",
"assert",
"trait",
".",
"DockTrait",
".",
"supported",
"(",
"vacuum",
".",
"DOMAIN"... | [
329,
0
] | [
343,
58
] | python | en | ['fr', 'en', 'en'] | True |
test_startstop_vacuum | (hass) | Test startStop trait support for vacuum domain. | Test startStop trait support for vacuum domain. | async def test_startstop_vacuum(hass):
"""Test startStop trait support for vacuum domain."""
assert helpers.get_google_type(vacuum.DOMAIN, None) is not None
assert trait.StartStopTrait.supported(vacuum.DOMAIN, 0, None)
trt = trait.StartStopTrait(
hass,
State(
"vacuum.bla",
... | [
"async",
"def",
"test_startstop_vacuum",
"(",
"hass",
")",
":",
"assert",
"helpers",
".",
"get_google_type",
"(",
"vacuum",
".",
"DOMAIN",
",",
"None",
")",
"is",
"not",
"None",
"assert",
"trait",
".",
"StartStopTrait",
".",
"supported",
"(",
"vacuum",
".",
... | [
346,
0
] | [
383,
66
] | python | en | ['fr', 'en', 'en'] | True |
test_color_setting_color_light | (hass) | Test ColorSpectrum trait support for light domain. | Test ColorSpectrum trait support for light domain. | async def test_color_setting_color_light(hass):
"""Test ColorSpectrum trait support for light domain."""
assert helpers.get_google_type(light.DOMAIN, None) is not None
assert not trait.ColorSettingTrait.supported(light.DOMAIN, 0, None)
assert trait.ColorSettingTrait.supported(light.DOMAIN, light.SUPPORT... | [
"async",
"def",
"test_color_setting_color_light",
"(",
"hass",
")",
":",
"assert",
"helpers",
".",
"get_google_type",
"(",
"light",
".",
"DOMAIN",
",",
"None",
")",
"is",
"not",
"None",
"assert",
"not",
"trait",
".",
"ColorSettingTrait",
".",
"supported",
"(",... | [
386,
0
] | [
440,
5
] | python | fr | ['fr', 'fr', 'en'] | True |
test_color_setting_temperature_light | (hass) | Test ColorTemperature trait support for light domain. | Test ColorTemperature trait support for light domain. | async def test_color_setting_temperature_light(hass):
"""Test ColorTemperature trait support for light domain."""
assert helpers.get_google_type(light.DOMAIN, None) is not None
assert not trait.ColorSettingTrait.supported(light.DOMAIN, 0, None)
assert trait.ColorSettingTrait.supported(
light.DOM... | [
"async",
"def",
"test_color_setting_temperature_light",
"(",
"hass",
")",
":",
"assert",
"helpers",
".",
"get_google_type",
"(",
"light",
".",
"DOMAIN",
",",
"None",
")",
"is",
"not",
"None",
"assert",
"not",
"trait",
".",
"ColorSettingTrait",
".",
"supported",
... | [
443,
0
] | [
493,
5
] | python | en | ['fr', 'en', 'en'] | True |
test_color_light_temperature_light_bad_temp | (hass) | Test ColorTemperature trait support for light domain. | Test ColorTemperature trait support for light domain. | async def test_color_light_temperature_light_bad_temp(hass):
"""Test ColorTemperature trait support for light domain."""
assert helpers.get_google_type(light.DOMAIN, None) is not None
assert not trait.ColorSettingTrait.supported(light.DOMAIN, 0, None)
assert trait.ColorSettingTrait.supported(
li... | [
"async",
"def",
"test_color_light_temperature_light_bad_temp",
"(",
"hass",
")",
":",
"assert",
"helpers",
".",
"get_google_type",
"(",
"light",
".",
"DOMAIN",
",",
"None",
")",
"is",
"not",
"None",
"assert",
"not",
"trait",
".",
"ColorSettingTrait",
".",
"suppo... | [
496,
0
] | [
518,
39
] | python | en | ['fr', 'en', 'en'] | True |
test_light_modes | (hass) | Test Light Mode trait. | Test Light Mode trait. | async def test_light_modes(hass):
"""Test Light Mode trait."""
assert helpers.get_google_type(light.DOMAIN, None) is not None
assert trait.ModesTrait.supported(light.DOMAIN, light.SUPPORT_EFFECT, None)
trt = trait.ModesTrait(
hass,
State(
"light.living_room",
lig... | [
"async",
"def",
"test_light_modes",
"(",
"hass",
")",
":",
"assert",
"helpers",
".",
"get_google_type",
"(",
"light",
".",
"DOMAIN",
",",
"None",
")",
"is",
"not",
"None",
"assert",
"trait",
".",
"ModesTrait",
".",
"supported",
"(",
"light",
".",
"DOMAIN",... | [
521,
0
] | [
586,
5
] | python | fr | ['fr', 'fr', 'en'] | True |
test_scene_scene | (hass) | Test Scene trait support for scene domain. | Test Scene trait support for scene domain. | async def test_scene_scene(hass):
"""Test Scene trait support for scene domain."""
assert helpers.get_google_type(scene.DOMAIN, None) is not None
assert trait.SceneTrait.supported(scene.DOMAIN, 0, None)
trt = trait.SceneTrait(hass, State("scene.bla", scene.STATE), BASIC_CONFIG)
assert trt.sync_attr... | [
"async",
"def",
"test_scene_scene",
"(",
"hass",
")",
":",
"assert",
"helpers",
".",
"get_google_type",
"(",
"scene",
".",
"DOMAIN",
",",
"None",
")",
"is",
"not",
"None",
"assert",
"trait",
".",
"SceneTrait",
".",
"supported",
"(",
"scene",
".",
"DOMAIN",... | [
589,
0
] | [
602,
57
] | python | en | ['fr', 'no', 'en'] | False |
test_scene_script | (hass) | Test Scene trait support for script domain. | Test Scene trait support for script domain. | async def test_scene_script(hass):
"""Test Scene trait support for script domain."""
assert helpers.get_google_type(script.DOMAIN, None) is not None
assert trait.SceneTrait.supported(script.DOMAIN, 0, None)
trt = trait.SceneTrait(hass, State("script.bla", STATE_OFF), BASIC_CONFIG)
assert trt.sync_a... | [
"async",
"def",
"test_scene_script",
"(",
"hass",
")",
":",
"assert",
"helpers",
".",
"get_google_type",
"(",
"script",
".",
"DOMAIN",
",",
"None",
")",
"is",
"not",
"None",
"assert",
"trait",
".",
"SceneTrait",
".",
"supported",
"(",
"script",
".",
"DOMAI... | [
605,
0
] | [
622,
58
] | python | en | ['fr', 'no', 'en'] | False |
test_temperature_setting_climate_onoff | (hass) | Test TemperatureSetting trait support for climate domain - range. | Test TemperatureSetting trait support for climate domain - range. | async def test_temperature_setting_climate_onoff(hass):
"""Test TemperatureSetting trait support for climate domain - range."""
assert helpers.get_google_type(climate.DOMAIN, None) is not None
assert trait.TemperatureSettingTrait.supported(climate.DOMAIN, 0, None)
hass.config.units.temperature_unit = T... | [
"async",
"def",
"test_temperature_setting_climate_onoff",
"(",
"hass",
")",
":",
"assert",
"helpers",
".",
"get_google_type",
"(",
"climate",
".",
"DOMAIN",
",",
"None",
")",
"is",
"not",
"None",
"assert",
"trait",
".",
"TemperatureSettingTrait",
".",
"supported",... | [
625,
0
] | [
667,
26
] | python | en | ['en', 'en', 'en'] | True |
test_temperature_setting_climate_no_modes | (hass) | Test TemperatureSetting trait support for climate domain not supporting any modes. | Test TemperatureSetting trait support for climate domain not supporting any modes. | async def test_temperature_setting_climate_no_modes(hass):
"""Test TemperatureSetting trait support for climate domain not supporting any modes."""
assert helpers.get_google_type(climate.DOMAIN, None) is not None
assert trait.TemperatureSettingTrait.supported(climate.DOMAIN, 0, None)
hass.config.units.... | [
"async",
"def",
"test_temperature_setting_climate_no_modes",
"(",
"hass",
")",
":",
"assert",
"helpers",
".",
"get_google_type",
"(",
"climate",
".",
"DOMAIN",
",",
"None",
")",
"is",
"not",
"None",
"assert",
"trait",
".",
"TemperatureSettingTrait",
".",
"supporte... | [
670,
0
] | [
693,
5
] | python | en | ['en', 'en', 'en'] | True |
test_temperature_setting_climate_range | (hass) | Test TemperatureSetting trait support for climate domain - range. | Test TemperatureSetting trait support for climate domain - range. | async def test_temperature_setting_climate_range(hass):
"""Test TemperatureSetting trait support for climate domain - range."""
assert helpers.get_google_type(climate.DOMAIN, None) is not None
assert trait.TemperatureSettingTrait.supported(climate.DOMAIN, 0, None)
hass.config.units.temperature_unit = T... | [
"async",
"def",
"test_temperature_setting_climate_range",
"(",
"hass",
")",
":",
"assert",
"helpers",
".",
"get_google_type",
"(",
"climate",
".",
"DOMAIN",
",",
"None",
")",
"is",
"not",
"None",
"assert",
"trait",
".",
"TemperatureSettingTrait",
".",
"supported",... | [
696,
0
] | [
775,
53
] | python | en | ['en', 'en', 'en'] | True |
test_temperature_setting_climate_setpoint | (hass) | Test TemperatureSetting trait support for climate domain - setpoint. | Test TemperatureSetting trait support for climate domain - setpoint. | async def test_temperature_setting_climate_setpoint(hass):
"""Test TemperatureSetting trait support for climate domain - setpoint."""
assert helpers.get_google_type(climate.DOMAIN, None) is not None
assert trait.TemperatureSettingTrait.supported(climate.DOMAIN, 0, None)
hass.config.units.temperature_un... | [
"async",
"def",
"test_temperature_setting_climate_setpoint",
"(",
"hass",
")",
":",
"assert",
"helpers",
".",
"get_google_type",
"(",
"climate",
".",
"DOMAIN",
",",
"None",
")",
"is",
"not",
"None",
"assert",
"trait",
".",
"TemperatureSettingTrait",
".",
"supporte... | [
778,
0
] | [
829,
81
] | python | en | ['en', 'en', 'en'] | True |
test_temperature_setting_climate_setpoint_auto | (hass) |
Test TemperatureSetting trait support for climate domain.
Setpoint in auto mode.
|
Test TemperatureSetting trait support for climate domain. | async def test_temperature_setting_climate_setpoint_auto(hass):
"""
Test TemperatureSetting trait support for climate domain.
Setpoint in auto mode.
"""
hass.config.units.temperature_unit = TEMP_CELSIUS
trt = trait.TemperatureSettingTrait(
hass,
State(
"climate.bla"... | [
"async",
"def",
"test_temperature_setting_climate_setpoint_auto",
"(",
"hass",
")",
":",
"hass",
".",
"config",
".",
"units",
".",
"temperature_unit",
"=",
"TEMP_CELSIUS",
"trt",
"=",
"trait",
".",
"TemperatureSettingTrait",
"(",
"hass",
",",
"State",
"(",
"\"clim... | [
832,
0
] | [
880,
81
] | python | en | ['en', 'error', 'th'] | False |
test_humidity_setting_humidifier_setpoint | (hass) | Test HumiditySetting trait support for humidifier domain - setpoint. | Test HumiditySetting trait support for humidifier domain - setpoint. | async def test_humidity_setting_humidifier_setpoint(hass):
"""Test HumiditySetting trait support for humidifier domain - setpoint."""
assert helpers.get_google_type(humidifier.DOMAIN, None) is not None
assert trait.HumiditySettingTrait.supported(humidifier.DOMAIN, 0, None)
trt = trait.HumiditySettingTr... | [
"async",
"def",
"test_humidity_setting_humidifier_setpoint",
"(",
"hass",
")",
":",
"assert",
"helpers",
".",
"get_google_type",
"(",
"humidifier",
".",
"DOMAIN",
",",
"None",
")",
"is",
"not",
"None",
"assert",
"trait",
".",
"HumiditySettingTrait",
".",
"supporte... | [
883,
0
] | [
916,
5
] | python | en | ['en', 'en', 'en'] | True |
test_lock_unlock_lock | (hass) | Test LockUnlock trait locking support for lock domain. | Test LockUnlock trait locking support for lock domain. | async def test_lock_unlock_lock(hass):
"""Test LockUnlock trait locking support for lock domain."""
assert helpers.get_google_type(lock.DOMAIN, None) is not None
assert trait.LockUnlockTrait.supported(lock.DOMAIN, lock.SUPPORT_OPEN, None)
assert trait.LockUnlockTrait.might_2fa(lock.DOMAIN, lock.SUPPORT_... | [
"async",
"def",
"test_lock_unlock_lock",
"(",
"hass",
")",
":",
"assert",
"helpers",
".",
"get_google_type",
"(",
"lock",
".",
"DOMAIN",
",",
"None",
")",
"is",
"not",
"None",
"assert",
"trait",
".",
"LockUnlockTrait",
".",
"supported",
"(",
"lock",
".",
"... | [
919,
0
] | [
940,
63
] | python | de | ['fr', 'de', 'en'] | False |
test_lock_unlock_unlock | (hass) | Test LockUnlock trait unlocking support for lock domain. | Test LockUnlock trait unlocking support for lock domain. | async def test_lock_unlock_unlock(hass):
"""Test LockUnlock trait unlocking support for lock domain."""
assert helpers.get_google_type(lock.DOMAIN, None) is not None
assert trait.LockUnlockTrait.supported(lock.DOMAIN, lock.SUPPORT_OPEN, None)
trt = trait.LockUnlockTrait(
hass, State("lock.front... | [
"async",
"def",
"test_lock_unlock_unlock",
"(",
"hass",
")",
":",
"assert",
"helpers",
".",
"get_google_type",
"(",
"lock",
".",
"DOMAIN",
",",
"None",
")",
"is",
"not",
"None",
"assert",
"trait",
".",
"LockUnlockTrait",
".",
"supported",
"(",
"lock",
".",
... | [
943,
0
] | [
1000,
26
] | python | de | ['fr', 'de', 'en'] | False |
test_arm_disarm_arm_away | (hass) | Test ArmDisarm trait Arming support for alarm_control_panel domain. | Test ArmDisarm trait Arming support for alarm_control_panel domain. | async def test_arm_disarm_arm_away(hass):
"""Test ArmDisarm trait Arming support for alarm_control_panel domain."""
assert helpers.get_google_type(alarm_control_panel.DOMAIN, None) is not None
assert trait.ArmDisArmTrait.supported(alarm_control_panel.DOMAIN, 0, None)
assert trait.ArmDisArmTrait.might_2f... | [
"async",
"def",
"test_arm_disarm_arm_away",
"(",
"hass",
")",
":",
"assert",
"helpers",
".",
"get_google_type",
"(",
"alarm_control_panel",
".",
"DOMAIN",
",",
"None",
")",
"is",
"not",
"None",
"assert",
"trait",
".",
"ArmDisArmTrait",
".",
"supported",
"(",
"... | [
1003,
0
] | [
1163,
9
] | python | en | ['en', 'en', 'en'] | True |
test_arm_disarm_disarm | (hass) | Test ArmDisarm trait Disarming support for alarm_control_panel domain. | Test ArmDisarm trait Disarming support for alarm_control_panel domain. | async def test_arm_disarm_disarm(hass):
"""Test ArmDisarm trait Disarming support for alarm_control_panel domain."""
assert helpers.get_google_type(alarm_control_panel.DOMAIN, None) is not None
assert trait.ArmDisArmTrait.supported(alarm_control_panel.DOMAIN, 0, None)
assert trait.ArmDisArmTrait.might_2... | [
"async",
"def",
"test_arm_disarm_disarm",
"(",
"hass",
")",
":",
"assert",
"helpers",
".",
"get_google_type",
"(",
"alarm_control_panel",
".",
"DOMAIN",
",",
"None",
")",
"is",
"not",
"None",
"assert",
"trait",
".",
"ArmDisArmTrait",
".",
"supported",
"(",
"al... | [
1166,
0
] | [
1309,
26
] | python | en | ['en', 'en', 'en'] | True |
test_fan_speed | (hass) | Test FanSpeed trait speed control support for fan domain. | Test FanSpeed trait speed control support for fan domain. | async def test_fan_speed(hass):
"""Test FanSpeed trait speed control support for fan domain."""
assert helpers.get_google_type(fan.DOMAIN, None) is not None
assert trait.FanSpeedTrait.supported(fan.DOMAIN, fan.SUPPORT_SET_SPEED, None)
trt = trait.FanSpeedTrait(
hass,
State(
... | [
"async",
"def",
"test_fan_speed",
"(",
"hass",
")",
":",
"assert",
"helpers",
".",
"get_google_type",
"(",
"fan",
".",
"DOMAIN",
",",
"None",
")",
"is",
"not",
"None",
"assert",
"trait",
".",
"FanSpeedTrait",
".",
"supported",
"(",
"fan",
".",
"DOMAIN",
... | [
1312,
0
] | [
1390,
83
] | python | en | ['en', 'fy', 'en'] | True |
test_climate_fan_speed | (hass) | Test FanSpeed trait speed control support for climate domain. | Test FanSpeed trait speed control support for climate domain. | async def test_climate_fan_speed(hass):
"""Test FanSpeed trait speed control support for climate domain."""
assert helpers.get_google_type(climate.DOMAIN, None) is not None
assert trait.FanSpeedTrait.supported(climate.DOMAIN, climate.SUPPORT_FAN_MODE, None)
trt = trait.FanSpeedTrait(
hass,
... | [
"async",
"def",
"test_climate_fan_speed",
"(",
"hass",
")",
":",
"assert",
"helpers",
".",
"get_google_type",
"(",
"climate",
".",
"DOMAIN",
",",
"None",
")",
"is",
"not",
"None",
"assert",
"trait",
".",
"FanSpeedTrait",
".",
"supported",
"(",
"climate",
"."... | [
1393,
0
] | [
1449,
5
] | python | en | ['en', 'en', 'en'] | True |
test_inputselector | (hass) | Test input selector trait. | Test input selector trait. | async def test_inputselector(hass):
"""Test input selector trait."""
assert helpers.get_google_type(media_player.DOMAIN, None) is not None
assert trait.InputSelectorTrait.supported(
media_player.DOMAIN, media_player.SUPPORT_SELECT_SOURCE, None
)
trt = trait.InputSelectorTrait(
hass,... | [
"async",
"def",
"test_inputselector",
"(",
"hass",
")",
":",
"assert",
"helpers",
".",
"get_google_type",
"(",
"media_player",
".",
"DOMAIN",
",",
"None",
")",
"is",
"not",
"None",
"assert",
"trait",
".",
"InputSelectorTrait",
".",
"supported",
"(",
"media_pla... | [
1452,
0
] | [
1511,
88
] | python | en | ['en', 'fr', 'en'] | True |
test_inputselector_nextprev | (hass, sources, source, source_next, source_prev) | Test input selector trait. | Test input selector trait. | async def test_inputselector_nextprev(hass, sources, source, source_next, source_prev):
"""Test input selector trait."""
trt = trait.InputSelectorTrait(
hass,
State(
"media_player.living_room",
media_player.STATE_PLAYING,
attributes={
media_pla... | [
"async",
"def",
"test_inputselector_nextprev",
"(",
"hass",
",",
"sources",
",",
"source",
",",
"source_next",
",",
"source_prev",
")",
":",
"trt",
"=",
"trait",
".",
"InputSelectorTrait",
"(",
"hass",
",",
"State",
"(",
"\"media_player.living_room\"",
",",
"med... | [
1522,
0
] | [
1564,
5
] | python | en | ['en', 'fr', 'en'] | True |
test_inputselector_nextprev_invalid | (hass, sources, source) | Test input selector trait. | Test input selector trait. | async def test_inputselector_nextprev_invalid(hass, sources, source):
"""Test input selector trait."""
trt = trait.InputSelectorTrait(
hass,
State(
"media_player.living_room",
media_player.STATE_PLAYING,
attributes={
media_player.ATTR_INPUT_SOU... | [
"async",
"def",
"test_inputselector_nextprev_invalid",
"(",
"hass",
",",
"sources",
",",
"source",
")",
":",
"trt",
"=",
"trait",
".",
"InputSelectorTrait",
"(",
"hass",
",",
"State",
"(",
"\"media_player.living_room\"",
",",
"media_player",
".",
"STATE_PLAYING",
... | [
1570,
0
] | [
1607,
9
] | python | en | ['en', 'fr', 'en'] | True |
test_modes_input_select | (hass) | Test Input Select Mode trait. | Test Input Select Mode trait. | async def test_modes_input_select(hass):
"""Test Input Select Mode trait."""
assert helpers.get_google_type(input_select.DOMAIN, None) is not None
assert trait.ModesTrait.supported(input_select.DOMAIN, None, None)
trt = trait.ModesTrait(
hass,
State("input_select.bla", "unavailable"),
... | [
"async",
"def",
"test_modes_input_select",
"(",
"hass",
")",
":",
"assert",
"helpers",
".",
"get_google_type",
"(",
"input_select",
".",
"DOMAIN",
",",
"None",
")",
"is",
"not",
"None",
"assert",
"trait",
".",
"ModesTrait",
".",
"supported",
"(",
"input_select... | [
1610,
0
] | [
1683,
78
] | python | en | ['fr', 'en', 'en'] | True |
test_modes_humidifier | (hass) | Test Humidifier Mode trait. | Test Humidifier Mode trait. | async def test_modes_humidifier(hass):
"""Test Humidifier Mode trait."""
assert helpers.get_google_type(humidifier.DOMAIN, None) is not None
assert trait.ModesTrait.supported(humidifier.DOMAIN, humidifier.SUPPORT_MODES, None)
trt = trait.ModesTrait(
hass,
State(
"humidifier.... | [
"async",
"def",
"test_modes_humidifier",
"(",
"hass",
")",
":",
"assert",
"helpers",
".",
"get_google_type",
"(",
"humidifier",
".",
"DOMAIN",
",",
"None",
")",
"is",
"not",
"None",
"assert",
"trait",
".",
"ModesTrait",
".",
"supported",
"(",
"humidifier",
"... | [
1686,
0
] | [
1760,
5
] | python | en | ['fr', 'en', 'en'] | True |
test_sound_modes | (hass) | Test Mode trait. | Test Mode trait. | async def test_sound_modes(hass):
"""Test Mode trait."""
assert helpers.get_google_type(media_player.DOMAIN, None) is not None
assert trait.ModesTrait.supported(
media_player.DOMAIN, media_player.SUPPORT_SELECT_SOUND_MODE, None
)
trt = trait.ModesTrait(
hass,
State(
... | [
"async",
"def",
"test_sound_modes",
"(",
"hass",
")",
":",
"assert",
"helpers",
".",
"get_google_type",
"(",
"media_player",
".",
"DOMAIN",
",",
"None",
")",
"is",
"not",
"None",
"assert",
"trait",
".",
"ModesTrait",
".",
"supported",
"(",
"media_player",
".... | [
1763,
0
] | [
1834,
5
] | python | fr | ['fr', 'fr', 'it'] | True |
test_openclose_cover | (hass) | Test OpenClose trait support for cover domain. | Test OpenClose trait support for cover domain. | async def test_openclose_cover(hass):
"""Test OpenClose trait support for cover domain."""
assert helpers.get_google_type(cover.DOMAIN, None) is not None
assert trait.OpenCloseTrait.supported(
cover.DOMAIN, cover.SUPPORT_SET_POSITION, None
)
trt = trait.OpenCloseTrait(
hass,
... | [
"async",
"def",
"test_openclose_cover",
"(",
"hass",
")",
":",
"assert",
"helpers",
".",
"get_google_type",
"(",
"cover",
".",
"DOMAIN",
",",
"None",
")",
"is",
"not",
"None",
"assert",
"trait",
".",
"OpenCloseTrait",
".",
"supported",
"(",
"cover",
".",
"... | [
1837,
0
] | [
1867,
83
] | python | en | ['fr', 'en', 'en'] | True |
test_openclose_cover_unknown_state | (hass) | Test OpenClose trait support for cover domain with unknown state. | Test OpenClose trait support for cover domain with unknown state. | async def test_openclose_cover_unknown_state(hass):
"""Test OpenClose trait support for cover domain with unknown state."""
assert helpers.get_google_type(cover.DOMAIN, None) is not None
assert trait.OpenCloseTrait.supported(
cover.DOMAIN, cover.SUPPORT_SET_POSITION, None
)
# No state
t... | [
"async",
"def",
"test_openclose_cover_unknown_state",
"(",
"hass",
")",
":",
"assert",
"helpers",
".",
"get_google_type",
"(",
"cover",
".",
"DOMAIN",
",",
"None",
")",
"is",
"not",
"None",
"assert",
"trait",
".",
"OpenCloseTrait",
".",
"supported",
"(",
"cove... | [
1870,
0
] | [
1897,
30
] | python | en | ['en', 'en', 'en'] | True |
test_openclose_cover_assumed_state | (hass) | Test OpenClose trait support for cover domain. | Test OpenClose trait support for cover domain. | async def test_openclose_cover_assumed_state(hass):
"""Test OpenClose trait support for cover domain."""
assert helpers.get_google_type(cover.DOMAIN, None) is not None
assert trait.OpenCloseTrait.supported(
cover.DOMAIN, cover.SUPPORT_SET_POSITION, None
)
trt = trait.OpenCloseTrait(
... | [
"async",
"def",
"test_openclose_cover_assumed_state",
"(",
"hass",
")",
":",
"assert",
"helpers",
".",
"get_google_type",
"(",
"cover",
".",
"DOMAIN",
",",
"None",
")",
"is",
"not",
"None",
"assert",
"trait",
".",
"OpenCloseTrait",
".",
"supported",
"(",
"cove... | [
1900,
0
] | [
1927,
82
] | python | en | ['fr', 'en', 'en'] | True |
test_openclose_cover_query_only | (hass) | Test OpenClose trait support for cover domain. | Test OpenClose trait support for cover domain. | async def test_openclose_cover_query_only(hass):
"""Test OpenClose trait support for cover domain."""
assert helpers.get_google_type(cover.DOMAIN, None) is not None
assert trait.OpenCloseTrait.supported(cover.DOMAIN, 0, None)
state = State(
"cover.bla",
cover.STATE_OPEN,
)
trt ... | [
"async",
"def",
"test_openclose_cover_query_only",
"(",
"hass",
")",
":",
"assert",
"helpers",
".",
"get_google_type",
"(",
"cover",
".",
"DOMAIN",
",",
"None",
")",
"is",
"not",
"None",
"assert",
"trait",
".",
"OpenCloseTrait",
".",
"supported",
"(",
"cover",... | [
1930,
0
] | [
1950,
57
] | python | en | ['fr', 'en', 'en'] | True |
test_openclose_cover_no_position | (hass) | Test OpenClose trait support for cover domain. | Test OpenClose trait support for cover domain. | async def test_openclose_cover_no_position(hass):
"""Test OpenClose trait support for cover domain."""
assert helpers.get_google_type(cover.DOMAIN, None) is not None
assert trait.OpenCloseTrait.supported(
cover.DOMAIN, cover.SUPPORT_OPEN | cover.SUPPORT_CLOSE, None
)
state = State(
... | [
"async",
"def",
"test_openclose_cover_no_position",
"(",
"hass",
")",
":",
"assert",
"helpers",
".",
"get_google_type",
"(",
"cover",
".",
"DOMAIN",
",",
"None",
")",
"is",
"not",
"None",
"assert",
"trait",
".",
"OpenCloseTrait",
".",
"supported",
"(",
"cover"... | [
1953,
0
] | [
2003,
87
] | python | en | ['fr', 'en', 'en'] | True |
test_openclose_cover_secure | (hass, device_class) | Test OpenClose trait support for cover domain. | Test OpenClose trait support for cover domain. | async def test_openclose_cover_secure(hass, device_class):
"""Test OpenClose trait support for cover domain."""
assert helpers.get_google_type(cover.DOMAIN, device_class) is not None
assert trait.OpenCloseTrait.supported(
cover.DOMAIN, cover.SUPPORT_SET_POSITION, device_class
)
assert trait.... | [
"async",
"def",
"test_openclose_cover_secure",
"(",
"hass",
",",
"device_class",
")",
":",
"assert",
"helpers",
".",
"get_google_type",
"(",
"cover",
".",
"DOMAIN",
",",
"device_class",
")",
"is",
"not",
"None",
"assert",
"trait",
".",
"OpenCloseTrait",
".",
"... | [
2010,
0
] | [
2064,
81
] | python | en | ['fr', 'en', 'en'] | True |
test_openclose_binary_sensor | (hass, device_class) | Test OpenClose trait support for binary_sensor domain. | Test OpenClose trait support for binary_sensor domain. | async def test_openclose_binary_sensor(hass, device_class):
"""Test OpenClose trait support for binary_sensor domain."""
assert helpers.get_google_type(binary_sensor.DOMAIN, device_class) is not None
assert trait.OpenCloseTrait.supported(binary_sensor.DOMAIN, 0, device_class)
trt = trait.OpenCloseTrait... | [
"async",
"def",
"test_openclose_binary_sensor",
"(",
"hass",
",",
"device_class",
")",
":",
"assert",
"helpers",
".",
"get_google_type",
"(",
"binary_sensor",
".",
"DOMAIN",
",",
"device_class",
")",
"is",
"not",
"None",
"assert",
"trait",
".",
"OpenCloseTrait",
... | [
2077,
0
] | [
2106,
55
] | python | en | ['fr', 'en', 'en'] | True |
test_volume_media_player | (hass) | Test volume trait support for media player domain. | Test volume trait support for media player domain. | async def test_volume_media_player(hass):
"""Test volume trait support for media player domain."""
assert helpers.get_google_type(media_player.DOMAIN, None) is not None
assert trait.VolumeTrait.supported(
media_player.DOMAIN,
media_player.SUPPORT_VOLUME_SET,
None,
)
trt = tr... | [
"async",
"def",
"test_volume_media_player",
"(",
"hass",
")",
":",
"assert",
"helpers",
".",
"get_google_type",
"(",
"media_player",
".",
"DOMAIN",
",",
"None",
")",
"is",
"not",
"None",
"assert",
"trait",
".",
"VolumeTrait",
".",
"supported",
"(",
"media_play... | [
2109,
0
] | [
2160,
5
] | python | en | ['fr', 'en', 'en'] | True |
test_volume_media_player_relative | (hass) | Test volume trait support for relative-volume-only media players. | Test volume trait support for relative-volume-only media players. | async def test_volume_media_player_relative(hass):
"""Test volume trait support for relative-volume-only media players."""
assert trait.VolumeTrait.supported(
media_player.DOMAIN,
media_player.SUPPORT_VOLUME_STEP,
None,
)
trt = trait.VolumeTrait(
hass,
State(
... | [
"async",
"def",
"test_volume_media_player_relative",
"(",
"hass",
")",
":",
"assert",
"trait",
".",
"VolumeTrait",
".",
"supported",
"(",
"media_player",
".",
"DOMAIN",
",",
"media_player",
".",
"SUPPORT_VOLUME_STEP",
",",
"None",
",",
")",
"trt",
"=",
"trait",
... | [
2163,
0
] | [
2227,
77
] | python | en | ['en', 'en', 'en'] | True |
test_media_player_mute | (hass) | Test volume trait support for muting. | Test volume trait support for muting. | async def test_media_player_mute(hass):
"""Test volume trait support for muting."""
assert trait.VolumeTrait.supported(
media_player.DOMAIN,
media_player.SUPPORT_VOLUME_STEP | media_player.SUPPORT_VOLUME_MUTE,
None,
)
trt = trait.VolumeTrait(
hass,
State(
... | [
"async",
"def",
"test_media_player_mute",
"(",
"hass",
")",
":",
"assert",
"trait",
".",
"VolumeTrait",
".",
"supported",
"(",
"media_player",
".",
"DOMAIN",
",",
"media_player",
".",
"SUPPORT_VOLUME_STEP",
"|",
"media_player",
".",
"SUPPORT_VOLUME_MUTE",
",",
"No... | [
2230,
0
] | [
2288,
5
] | python | en | ['fr', 'en', 'en'] | True |
test_temperature_setting_sensor | (hass) | Test TemperatureSetting trait support for temperature sensor. | Test TemperatureSetting trait support for temperature sensor. | async def test_temperature_setting_sensor(hass):
"""Test TemperatureSetting trait support for temperature sensor."""
assert (
helpers.get_google_type(sensor.DOMAIN, sensor.DEVICE_CLASS_TEMPERATURE)
is not None
)
assert not trait.TemperatureSettingTrait.supported(
sensor.DOMAIN, 0... | [
"async",
"def",
"test_temperature_setting_sensor",
"(",
"hass",
")",
":",
"assert",
"(",
"helpers",
".",
"get_google_type",
"(",
"sensor",
".",
"DOMAIN",
",",
"sensor",
".",
"DEVICE_CLASS_TEMPERATURE",
")",
"is",
"not",
"None",
")",
"assert",
"not",
"trait",
"... | [
2291,
0
] | [
2302,
5
] | python | en | ['en', 'la', 'en'] | True |
test_temperature_setting_sensor_data | (hass, unit_in, unit_out, state, ambient) | Test TemperatureSetting trait support for temperature sensor. | Test TemperatureSetting trait support for temperature sensor. | async def test_temperature_setting_sensor_data(hass, unit_in, unit_out, state, ambient):
"""Test TemperatureSetting trait support for temperature sensor."""
hass.config.units.temperature_unit = unit_in
trt = trait.TemperatureSettingTrait(
hass,
State(
"sensor.test", state, {ATTR... | [
"async",
"def",
"test_temperature_setting_sensor_data",
"(",
"hass",
",",
"unit_in",
",",
"unit_out",
",",
"state",
",",
"ambient",
")",
":",
"hass",
".",
"config",
".",
"units",
".",
"temperature_unit",
"=",
"unit_in",
"trt",
"=",
"trait",
".",
"TemperatureSe... | [
2314,
0
] | [
2335,
53
] | python | en | ['en', 'la', 'en'] | True |
test_humidity_setting_sensor | (hass) | Test HumiditySetting trait support for humidity sensor. | Test HumiditySetting trait support for humidity sensor. | async def test_humidity_setting_sensor(hass):
"""Test HumiditySetting trait support for humidity sensor."""
assert (
helpers.get_google_type(sensor.DOMAIN, sensor.DEVICE_CLASS_HUMIDITY) is not None
)
assert not trait.HumiditySettingTrait.supported(
sensor.DOMAIN, 0, sensor.DEVICE_CLASS_T... | [
"async",
"def",
"test_humidity_setting_sensor",
"(",
"hass",
")",
":",
"assert",
"(",
"helpers",
".",
"get_google_type",
"(",
"sensor",
".",
"DOMAIN",
",",
"sensor",
".",
"DEVICE_CLASS_HUMIDITY",
")",
"is",
"not",
"None",
")",
"assert",
"not",
"trait",
".",
... | [
2338,
0
] | [
2348,
5
] | python | en | ['en', 'en', 'en'] | True |
test_humidity_setting_sensor_data | (hass, state, ambient) | Test HumiditySetting trait support for humidity sensor. | Test HumiditySetting trait support for humidity sensor. | async def test_humidity_setting_sensor_data(hass, state, ambient):
"""Test HumiditySetting trait support for humidity sensor."""
trt = trait.HumiditySettingTrait(
hass,
State("sensor.test", state, {ATTR_DEVICE_CLASS: sensor.DEVICE_CLASS_HUMIDITY}),
BASIC_CONFIG,
)
assert trt.syn... | [
"async",
"def",
"test_humidity_setting_sensor_data",
"(",
"hass",
",",
"state",
",",
"ambient",
")",
":",
"trt",
"=",
"trait",
".",
"HumiditySettingTrait",
"(",
"hass",
",",
"State",
"(",
"\"sensor.test\"",
",",
"state",
",",
"{",
"ATTR_DEVICE_CLASS",
":",
"se... | [
2354,
0
] | [
2370,
52
] | python | en | ['en', 'en', 'en'] | True |
test_transport_control | (hass) | Test the TransportControlTrait. | Test the TransportControlTrait. | async def test_transport_control(hass):
"""Test the TransportControlTrait."""
assert helpers.get_google_type(media_player.DOMAIN, None) is not None
for feature in trait.MEDIA_COMMAND_SUPPORT_MAPPING.values():
assert trait.TransportControlTrait.supported(media_player.DOMAIN, feature, None)
now ... | [
"async",
"def",
"test_transport_control",
"(",
"hass",
")",
":",
"assert",
"helpers",
".",
"get_google_type",
"(",
"media_player",
".",
"DOMAIN",
",",
"None",
")",
"is",
"not",
"None",
"for",
"feature",
"in",
"trait",
".",
"MEDIA_COMMAND_SUPPORT_MAPPING",
".",
... | [
2373,
0
] | [
2487,
64
] | python | en | ['en', 'fr', 'en'] | True |
test_media_state | (hass, state) | Test the MediaStateTrait. | Test the MediaStateTrait. | async def test_media_state(hass, state):
"""Test the MediaStateTrait."""
assert helpers.get_google_type(media_player.DOMAIN, None) is not None
assert trait.TransportControlTrait.supported(
media_player.DOMAIN, media_player.SUPPORT_PLAY, None
)
trt = trait.MediaStateTrait(
hass,
... | [
"async",
"def",
"test_media_state",
"(",
"hass",
",",
"state",
")",
":",
"assert",
"helpers",
".",
"get_google_type",
"(",
"media_player",
".",
"DOMAIN",
",",
"None",
")",
"is",
"not",
"None",
"assert",
"trait",
".",
"TransportControlTrait",
".",
"supported",
... | [
2503,
0
] | [
2534,
5
] | python | en | ['en', 'fi', 'en'] | True |
HTMLCorpusReader.__init__ | (self, root, fileids=DOC_PATTERN,
word_tokenizer=WordPunctTokenizer(),
sent_tokenizer=nltk.data.LazyLoader(
'tokenizers/punkt/english.pickle'),
encoding='latin-1', **kwargs) |
Initialize the corpus reader. Categorization arguments
(``cat_pattern``, ``cat_map``, and ``cat_file``) are passed to
the ``CategorizedCorpusReader`` constructor. The remaining
arguments are passed to the ``CorpusReader`` constructor.
|
Initialize the corpus reader. Categorization arguments
(``cat_pattern``, ``cat_map``, and ``cat_file``) are passed to
the ``CategorizedCorpusReader`` constructor. The remaining
arguments are passed to the ``CorpusReader`` constructor.
| def __init__(self, root, fileids=DOC_PATTERN,
word_tokenizer=WordPunctTokenizer(),
sent_tokenizer=nltk.data.LazyLoader(
'tokenizers/punkt/english.pickle'),
encoding='latin-1', **kwargs):
"""
Initialize the corpus reader. Categoriza... | [
"def",
"__init__",
"(",
"self",
",",
"root",
",",
"fileids",
"=",
"DOC_PATTERN",
",",
"word_tokenizer",
"=",
"WordPunctTokenizer",
"(",
")",
",",
"sent_tokenizer",
"=",
"nltk",
".",
"data",
".",
"LazyLoader",
"(",
"'tokenizers/punkt/english.pickle'",
")",
",",
... | [
32,
4
] | [
52,
25
] | python | en | ['en', 'error', 'th'] | False |
HTMLCorpusReader.resolve | (self, fileids, categories) |
Returns a list of fileids or categories depending on what is passed
to each internal corpus reader function. Implemented similarly to
the NLTK ``CategorizedPlaintextCorpusReader``.
|
Returns a list of fileids or categories depending on what is passed
to each internal corpus reader function. Implemented similarly to
the NLTK ``CategorizedPlaintextCorpusReader``.
| def resolve(self, fileids, categories):
"""
Returns a list of fileids or categories depending on what is passed
to each internal corpus reader function. Implemented similarly to
the NLTK ``CategorizedPlaintextCorpusReader``.
"""
if fileids is not None and categories is no... | [
"def",
"resolve",
"(",
"self",
",",
"fileids",
",",
"categories",
")",
":",
"if",
"fileids",
"is",
"not",
"None",
"and",
"categories",
"is",
"not",
"None",
":",
"raise",
"ValueError",
"(",
"\"Specify fileids or categories, not both\"",
")",
"if",
"categories",
... | [
54,
4
] | [
65,
22
] | python | en | ['en', 'error', 'th'] | False |
HTMLCorpusReader.docs | (self, fileids=None, categories=None) |
Returns the complete text of an HTML document, closing the document
after we are done reading it and yielding it in a memory safe fashion.
|
Returns the complete text of an HTML document, closing the document
after we are done reading it and yielding it in a memory safe fashion.
| def docs(self, fileids=None, categories=None):
"""
Returns the complete text of an HTML document, closing the document
after we are done reading it and yielding it in a memory safe fashion.
"""
# Resolve the fileids and the categories
fileids = self.resolve(fileids, categ... | [
"def",
"docs",
"(",
"self",
",",
"fileids",
"=",
"None",
",",
"categories",
"=",
"None",
")",
":",
"# Resolve the fileids and the categories",
"fileids",
"=",
"self",
".",
"resolve",
"(",
"fileids",
",",
"categories",
")",
"# Create a generator, loading one document... | [
67,
4
] | [
78,
30
] | python | en | ['en', 'error', 'th'] | False |
HTMLCorpusReader.html | (self, fileids=None, categories=None) |
Returns the HTML content of each document, cleaning it using
the readability-lxml library.
|
Returns the HTML content of each document, cleaning it using
the readability-lxml library.
| def html(self, fileids=None, categories=None):
"""
Returns the HTML content of each document, cleaning it using
the readability-lxml library.
"""
for doc in self.docs(fileids, categories):
try:
yield Paper(doc).summary()
except Unparseable ... | [
"def",
"html",
"(",
"self",
",",
"fileids",
"=",
"None",
",",
"categories",
"=",
"None",
")",
":",
"for",
"doc",
"in",
"self",
".",
"docs",
"(",
"fileids",
",",
"categories",
")",
":",
"try",
":",
"yield",
"Paper",
"(",
"doc",
")",
".",
"summary",
... | [
80,
4
] | [
90,
24
] | python | en | ['en', 'error', 'th'] | False |
HTMLCorpusReader.paras | (self, fileids=None, categories=None) |
Uses BeautifulSoup to parse the paragraphs from the HTML.
|
Uses BeautifulSoup to parse the paragraphs from the HTML.
| def paras(self, fileids=None, categories=None):
"""
Uses BeautifulSoup to parse the paragraphs from the HTML.
"""
for html in self.html(fileids, categories):
soup = bs4.BeautifulSoup(html, 'lxml')
for element in soup.find_all(self._tags):
yield ele... | [
"def",
"paras",
"(",
"self",
",",
"fileids",
"=",
"None",
",",
"categories",
"=",
"None",
")",
":",
"for",
"html",
"in",
"self",
".",
"html",
"(",
"fileids",
",",
"categories",
")",
":",
"soup",
"=",
"bs4",
".",
"BeautifulSoup",
"(",
"html",
",",
"... | [
92,
4
] | [
100,
28
] | python | en | ['en', 'error', 'th'] | False |
HTMLCorpusReader.titles | (self, fileids=None, categories=None) |
Uses BeautifulSoup to identify titles from the
head tags within the HTML
|
Uses BeautifulSoup to identify titles from the
head tags within the HTML
| def titles(self, fileids=None, categories=None):
"""
Uses BeautifulSoup to identify titles from the
head tags within the HTML
"""
for doc in self.docs(fileids, categories):
soup = bs4.BeautifulSoup(doc, 'lxml')
try:
yield soup.title.text
... | [
"def",
"titles",
"(",
"self",
",",
"fileids",
"=",
"None",
",",
"categories",
"=",
"None",
")",
":",
"for",
"doc",
"in",
"self",
".",
"docs",
"(",
"fileids",
",",
"categories",
")",
":",
"soup",
"=",
"bs4",
".",
"BeautifulSoup",
"(",
"doc",
",",
"'... | [
102,
4
] | [
113,
24
] | python | en | ['en', 'error', 'th'] | False |
HTMLCorpusReader.sents | (self, fileids=None, categories=None) |
Uses the built in sentence tokenizer to extract sentences from the
paragraphs. Note that this method uses BeautifulSoup to parse HTML.
|
Uses the built in sentence tokenizer to extract sentences from the
paragraphs. Note that this method uses BeautifulSoup to parse HTML.
| def sents(self, fileids=None, categories=None):
"""
Uses the built in sentence tokenizer to extract sentences from the
paragraphs. Note that this method uses BeautifulSoup to parse HTML.
"""
for paragraph in self.paras(fileids, categories):
for sentence in sent_tokeni... | [
"def",
"sents",
"(",
"self",
",",
"fileids",
"=",
"None",
",",
"categories",
"=",
"None",
")",
":",
"for",
"paragraph",
"in",
"self",
".",
"paras",
"(",
"fileids",
",",
"categories",
")",
":",
"for",
"sentence",
"in",
"sent_tokenize",
"(",
"paragraph",
... | [
115,
4
] | [
122,
30
] | python | en | ['en', 'error', 'th'] | False |
HTMLCorpusReader.words | (self, fileids=None, categories=None) |
Uses the built in word tokenizer to extract tokens from sentences.
Note that this method uses BeautifulSoup to parse HTML content.
|
Uses the built in word tokenizer to extract tokens from sentences.
Note that this method uses BeautifulSoup to parse HTML content.
| def words(self, fileids=None, categories=None):
"""
Uses the built in word tokenizer to extract tokens from sentences.
Note that this method uses BeautifulSoup to parse HTML content.
"""
for sentence in self.sents(fileids, categories):
for token in wordpunct_tokenize(... | [
"def",
"words",
"(",
"self",
",",
"fileids",
"=",
"None",
",",
"categories",
"=",
"None",
")",
":",
"for",
"sentence",
"in",
"self",
".",
"sents",
"(",
"fileids",
",",
"categories",
")",
":",
"for",
"token",
"in",
"wordpunct_tokenize",
"(",
"sentence",
... | [
124,
4
] | [
131,
27
] | python | en | ['en', 'error', 'th'] | False |
HTMLCorpusReader.tokenize | (self, fileids=None, categories=None) |
Segments, tokenizes, and tags a document in the corpus.
|
Segments, tokenizes, and tags a document in the corpus.
| def tokenize(self, fileids=None, categories=None):
"""
Segments, tokenizes, and tags a document in the corpus.
"""
for paragraph in self.corpus.paras(fileids=fileid):
yield [
pos_tag(nltk.wordpunct_tokenize(sent))
for sent in nltk.sent_tokenize... | [
"def",
"tokenize",
"(",
"self",
",",
"fileids",
"=",
"None",
",",
"categories",
"=",
"None",
")",
":",
"for",
"paragraph",
"in",
"self",
".",
"corpus",
".",
"paras",
"(",
"fileids",
"=",
"fileid",
")",
":",
"yield",
"[",
"pos_tag",
"(",
"nltk",
".",
... | [
133,
4
] | [
141,
13
] | python | en | ['en', 'error', 'th'] | False |
HTMLCorpusReader.sizes | (self, fileids=None, categories=None) |
Returns a list of tuples, the fileid and the size on disk of the file.
This function is used to detect oddly large files in the corpus.
|
Returns a list of tuples, the fileid and the size on disk of the file.
This function is used to detect oddly large files in the corpus.
| def sizes(self, fileids=None, categories=None):
"""
Returns a list of tuples, the fileid and the size on disk of the file.
This function is used to detect oddly large files in the corpus.
"""
# Resolve the fileids and the categories
fileids = self.resolve(fileids, categor... | [
"def",
"sizes",
"(",
"self",
",",
"fileids",
"=",
"None",
",",
"categories",
"=",
"None",
")",
":",
"# Resolve the fileids and the categories",
"fileids",
"=",
"self",
".",
"resolve",
"(",
"fileids",
",",
"categories",
")",
"# Create a generator, getting every path ... | [
143,
4
] | [
153,
39
] | python | en | ['en', 'error', 'th'] | False |
HTMLCorpusReader.describe | (self, fileids=None, categories=None) |
Performs a single pass of the corpus and returns a dictionary with a
variety of metrics concerning the state of the corpus.
|
Performs a single pass of the corpus and returns a dictionary with a
variety of metrics concerning the state of the corpus.
| def describe(self, fileids=None, categories=None):
"""
Performs a single pass of the corpus and returns a dictionary with a
variety of metrics concerning the state of the corpus.
"""
# Structures to perform counting.
counts = nltk.FreqDist()
tokens = nltk.FreqDist... | [
"def",
"describe",
"(",
"self",
",",
"fileids",
"=",
"None",
",",
"categories",
"=",
"None",
")",
":",
"# Structures to perform counting.",
"counts",
"=",
"nltk",
".",
"FreqDist",
"(",
")",
"tokens",
"=",
"nltk",
".",
"FreqDist",
"(",
")",
"started",
"=",
... | [
155,
4
] | [
192,
9
] | python | en | ['en', 'error', 'th'] | False |
HTMLCorpusReader.describes | (self, fileids=None, categories=None) |
Returns a string representation of the describe command.
|
Returns a string representation of the describe command.
| def describes(self, fileids=None, categories=None):
"""
Returns a string representation of the describe command.
"""
return (
"HTML corpus contains {files} files in {topics} categories.\n"
"Structured as:\n"
" {paras} paragraphs ({ppdoc:0.3f} mean p... | [
"def",
"describes",
"(",
"self",
",",
"fileids",
"=",
"None",
",",
"categories",
"=",
"None",
")",
":",
"return",
"(",
"\"HTML corpus contains {files} files in {topics} categories.\\n\"",
"\"Structured as:\\n\"",
"\" {paras} paragraphs ({ppdoc:0.3f} mean paragraphs per file)\\... | [
194,
4
] | [
206,
54
] | python | en | ['en', 'error', 'th'] | False |
HTMLPickledCorpusReader.__init__ | (self, root, fileids=PKL_PATTERN, **kwargs) |
Initialize the corpus reader. Categorization arguments
(``cat_pattern``, ``cat_map``, and ``cat_file``) are passed to
the ``CategorizedCorpusReader`` constructor. The remaining arguments
are passed to the ``CorpusReader`` constructor.
|
Initialize the corpus reader. Categorization arguments
(``cat_pattern``, ``cat_map``, and ``cat_file``) are passed to
the ``CategorizedCorpusReader`` constructor. The remaining arguments
are passed to the ``CorpusReader`` constructor.
| def __init__(self, root, fileids=PKL_PATTERN, **kwargs):
"""
Initialize the corpus reader. Categorization arguments
(``cat_pattern``, ``cat_map``, and ``cat_file``) are passed to
the ``CategorizedCorpusReader`` constructor. The remaining arguments
are passed to the ``CorpusRead... | [
"def",
"__init__",
"(",
"self",
",",
"root",
",",
"fileids",
"=",
"PKL_PATTERN",
",",
"*",
"*",
"kwargs",
")",
":",
"# Add the default category pattern if not passed into the class.",
"if",
"not",
"any",
"(",
"key",
".",
"startswith",
"(",
"'cat_'",
")",
"for",
... | [
210,
4
] | [
222,
50
] | python | en | ['en', 'error', 'th'] | False |
HTMLPickledCorpusReader.resolve | (self, fileids, categories) |
Returns a list of fileids or categories depending on what is passed
to each internal corpus reader function. This primarily bubbles up to
the high level ``docs`` method, but is implemented here similar to
the nltk ``CategorizedPlaintextCorpusReader``.
|
Returns a list of fileids or categories depending on what is passed
to each internal corpus reader function. This primarily bubbles up to
the high level ``docs`` method, but is implemented here similar to
the nltk ``CategorizedPlaintextCorpusReader``.
| def resolve(self, fileids, categories):
"""
Returns a list of fileids or categories depending on what is passed
to each internal corpus reader function. This primarily bubbles up to
the high level ``docs`` method, but is implemented here similar to
the nltk ``CategorizedPlaintext... | [
"def",
"resolve",
"(",
"self",
",",
"fileids",
",",
"categories",
")",
":",
"if",
"fileids",
"is",
"not",
"None",
"and",
"categories",
"is",
"not",
"None",
":",
"raise",
"ValueError",
"(",
"\"Specify fileids or categories, not both\"",
")",
"if",
"categories",
... | [
224,
4
] | [
236,
22
] | python | en | ['en', 'error', 'th'] | False |
HTMLPickledCorpusReader.text | (self, fileids=None, categories=None) |
Returns the document loaded from a pickled object for every file in
the corpus. Similar to the BaleenCorpusReader, this uses a generator
to acheive memory safe iteration.
|
Returns the document loaded from a pickled object for every file in
the corpus. Similar to the BaleenCorpusReader, this uses a generator
to acheive memory safe iteration.
| def text(self, fileids=None, categories=None):
"""
Returns the document loaded from a pickled object for every file in
the corpus. Similar to the BaleenCorpusReader, this uses a generator
to acheive memory safe iteration.
"""
# Resolve the fileids and the categories
... | [
"def",
"text",
"(",
"self",
",",
"fileids",
"=",
"None",
",",
"categories",
"=",
"None",
")",
":",
"# Resolve the fileids and the categories",
"fileids",
"=",
"self",
".",
"resolve",
"(",
"fileids",
",",
"categories",
")",
"# Create a generator, loading one document... | [
238,
4
] | [
250,
36
] | python | en | ['en', 'error', 'th'] | False |
HTMLPickledCorpusReader.docs | (self, fileids=None, categories=None) |
Returns a generator of paragraphs where each paragraph is a list of
sentences, which is in turn a list of (token, tag) tuples.
|
Returns a generator of paragraphs where each paragraph is a list of
sentences, which is in turn a list of (token, tag) tuples.
| def docs(self, fileids=None, categories=None):
"""
Returns a generator of paragraphs where each paragraph is a list of
sentences, which is in turn a list of (token, tag) tuples.
"""
for doc in self.text(fileids, categories):
yield doc['document'] | [
"def",
"docs",
"(",
"self",
",",
"fileids",
"=",
"None",
",",
"categories",
"=",
"None",
")",
":",
"for",
"doc",
"in",
"self",
".",
"text",
"(",
"fileids",
",",
"categories",
")",
":",
"yield",
"doc",
"[",
"'document'",
"]"
] | [
252,
4
] | [
258,
33
] | python | en | ['en', 'error', 'th'] | False |
HTMLPickledCorpusReader.titles | (self, fileids=None, categories=None) |
Uses BeautifulSoup to identify titles from the
head tags within the HTML
|
Uses BeautifulSoup to identify titles from the
head tags within the HTML
| def titles(self, fileids=None, categories=None):
"""
Uses BeautifulSoup to identify titles from the
head tags within the HTML
"""
for doc in self.text(fileids, categories):
yield doc['title'] | [
"def",
"titles",
"(",
"self",
",",
"fileids",
"=",
"None",
",",
"categories",
"=",
"None",
")",
":",
"for",
"doc",
"in",
"self",
".",
"text",
"(",
"fileids",
",",
"categories",
")",
":",
"yield",
"doc",
"[",
"'title'",
"]"
] | [
260,
4
] | [
266,
30
] | python | en | ['en', 'error', 'th'] | False |
HTMLPickledCorpusReader.paras | (self, fileids=None, categories=None) |
Returns a generator of paragraphs where each paragraph is a list of
sentences, which is in turn a list of (token, tag) tuples.
|
Returns a generator of paragraphs where each paragraph is a list of
sentences, which is in turn a list of (token, tag) tuples.
| def paras(self, fileids=None, categories=None):
"""
Returns a generator of paragraphs where each paragraph is a list of
sentences, which is in turn a list of (token, tag) tuples.
"""
for doc in self.docs(fileids, categories):
for paragraph in doc:
yiel... | [
"def",
"paras",
"(",
"self",
",",
"fileids",
"=",
"None",
",",
"categories",
"=",
"None",
")",
":",
"for",
"doc",
"in",
"self",
".",
"docs",
"(",
"fileids",
",",
"categories",
")",
":",
"for",
"paragraph",
"in",
"doc",
":",
"yield",
"paragraph"
] | [
268,
4
] | [
275,
31
] | python | en | ['en', 'error', 'th'] | False |
HTMLPickledCorpusReader.sents | (self, fileids=None, categories=None) |
Returns a generator of sentences where each sentence is a list of
(token, tag) tuples.
|
Returns a generator of sentences where each sentence is a list of
(token, tag) tuples.
| def sents(self, fileids=None, categories=None):
"""
Returns a generator of sentences where each sentence is a list of
(token, tag) tuples.
"""
for paragraph in self.paras(fileids, categories):
for sentence in paragraph:
yield sentence | [
"def",
"sents",
"(",
"self",
",",
"fileids",
"=",
"None",
",",
"categories",
"=",
"None",
")",
":",
"for",
"paragraph",
"in",
"self",
".",
"paras",
"(",
"fileids",
",",
"categories",
")",
":",
"for",
"sentence",
"in",
"paragraph",
":",
"yield",
"senten... | [
277,
4
] | [
284,
30
] | python | en | ['en', 'error', 'th'] | False |
HTMLPickledCorpusReader.words | (self, fileids=None, categories=None) |
Returns a generator of (token, tag) tuples.
|
Returns a generator of (token, tag) tuples.
| def words(self, fileids=None, categories=None):
"""
Returns a generator of (token, tag) tuples.
"""
for token in self.tagged(fileids, categories):
yield token[0] | [
"def",
"words",
"(",
"self",
",",
"fileids",
"=",
"None",
",",
"categories",
"=",
"None",
")",
":",
"for",
"token",
"in",
"self",
".",
"tagged",
"(",
"fileids",
",",
"categories",
")",
":",
"yield",
"token",
"[",
"0",
"]"
] | [
291,
4
] | [
296,
26
] | python | en | ['en', 'error', 'th'] | False |
calls | (hass) | Track calls to a mock service. | Track calls to a mock service. | def calls(hass):
"""Track calls to a mock service."""
return async_mock_service(hass, "test", "automation") | [
"def",
"calls",
"(",
"hass",
")",
":",
"return",
"async_mock_service",
"(",
"hass",
",",
"\"test\"",
",",
"\"automation\"",
")"
] | [
25,
0
] | [
27,
57
] | python | en | ['en', 'en', 'en'] | True |
setup_comp | (hass) | Initialize components. | Initialize components. | def setup_comp(hass):
"""Initialize components."""
mock_component(hass, "group")
dt_util.set_default_time_zone(hass.config.time_zone)
hass.loop.run_until_complete(
async_setup_component(hass, sun.DOMAIN, {sun.DOMAIN: {sun.CONF_ELEVATION: 0}})
) | [
"def",
"setup_comp",
"(",
"hass",
")",
":",
"mock_component",
"(",
"hass",
",",
"\"group\"",
")",
"dt_util",
".",
"set_default_time_zone",
"(",
"hass",
".",
"config",
".",
"time_zone",
")",
"hass",
".",
"loop",
".",
"run_until_complete",
"(",
"async_setup_comp... | [
31,
0
] | [
37,
5
] | python | en | ['de', 'en', 'en'] | False |
test_sunset_trigger | (hass, calls, legacy_patchable_time) | Test the sunset trigger. | Test the sunset trigger. | async def test_sunset_trigger(hass, calls, legacy_patchable_time):
"""Test the sunset trigger."""
now = datetime(2015, 9, 15, 23, tzinfo=dt_util.UTC)
trigger_time = datetime(2015, 9, 16, 2, tzinfo=dt_util.UTC)
with patch("homeassistant.util.dt.utcnow", return_value=now):
await async_setup_compo... | [
"async",
"def",
"test_sunset_trigger",
"(",
"hass",
",",
"calls",
",",
"legacy_patchable_time",
")",
":",
"now",
"=",
"datetime",
"(",
"2015",
",",
"9",
",",
"15",
",",
"23",
",",
"tzinfo",
"=",
"dt_util",
".",
"UTC",
")",
"trigger_time",
"=",
"datetime"... | [
45,
0
] | [
83,
26
] | python | en | ['en', 'en', 'en'] | True |
test_sunrise_trigger | (hass, calls, legacy_patchable_time) | Test the sunrise trigger. | Test the sunrise trigger. | async def test_sunrise_trigger(hass, calls, legacy_patchable_time):
"""Test the sunrise trigger."""
now = datetime(2015, 9, 13, 23, tzinfo=dt_util.UTC)
trigger_time = datetime(2015, 9, 16, 14, tzinfo=dt_util.UTC)
with patch("homeassistant.util.dt.utcnow", return_value=now):
await async_setup_co... | [
"async",
"def",
"test_sunrise_trigger",
"(",
"hass",
",",
"calls",
",",
"legacy_patchable_time",
")",
":",
"now",
"=",
"datetime",
"(",
"2015",
",",
"9",
",",
"13",
",",
"23",
",",
"tzinfo",
"=",
"dt_util",
".",
"UTC",
")",
"trigger_time",
"=",
"datetime... | [
86,
0
] | [
105,
26
] | python | en | ['en', 'no', 'en'] | True |
test_sunset_trigger_with_offset | (hass, calls, legacy_patchable_time) | Test the sunset trigger with offset. | Test the sunset trigger with offset. | async def test_sunset_trigger_with_offset(hass, calls, legacy_patchable_time):
"""Test the sunset trigger with offset."""
now = datetime(2015, 9, 15, 23, tzinfo=dt_util.UTC)
trigger_time = datetime(2015, 9, 16, 2, 30, tzinfo=dt_util.UTC)
with patch("homeassistant.util.dt.utcnow", return_value=now):
... | [
"async",
"def",
"test_sunset_trigger_with_offset",
"(",
"hass",
",",
"calls",
",",
"legacy_patchable_time",
")",
":",
"now",
"=",
"datetime",
"(",
"2015",
",",
"9",
",",
"15",
",",
"23",
",",
"tzinfo",
"=",
"dt_util",
".",
"UTC",
")",
"trigger_time",
"=",
... | [
108,
0
] | [
138,
60
] | python | en | ['en', 'en', 'en'] | True |
test_sunrise_trigger_with_offset | (hass, calls, legacy_patchable_time) | Test the sunrise trigger with offset. | Test the sunrise trigger with offset. | async def test_sunrise_trigger_with_offset(hass, calls, legacy_patchable_time):
"""Test the sunrise trigger with offset."""
now = datetime(2015, 9, 13, 23, tzinfo=dt_util.UTC)
trigger_time = datetime(2015, 9, 16, 13, 30, tzinfo=dt_util.UTC)
with patch("homeassistant.util.dt.utcnow", return_value=now):
... | [
"async",
"def",
"test_sunrise_trigger_with_offset",
"(",
"hass",
",",
"calls",
",",
"legacy_patchable_time",
")",
":",
"now",
"=",
"datetime",
"(",
"2015",
",",
"9",
",",
"13",
",",
"23",
",",
"tzinfo",
"=",
"dt_util",
".",
"UTC",
")",
"trigger_time",
"=",... | [
141,
0
] | [
164,
26
] | python | en | ['en', 'en', 'en'] | True |
test_if_action_before_sunrise_no_offset | (hass, calls) |
Test if action was before sunrise.
Before sunrise is true from midnight until sunset, local time.
|
Test if action was before sunrise. | async def test_if_action_before_sunrise_no_offset(hass, calls):
"""
Test if action was before sunrise.
Before sunrise is true from midnight until sunset, local time.
"""
await async_setup_component(
hass,
automation.DOMAIN,
{
automation.DOMAIN: {
... | [
"async",
"def",
"test_if_action_before_sunrise_no_offset",
"(",
"hass",
",",
"calls",
")",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"automation",
".",
"DOMAIN",
",",
"{",
"automation",
".",
"DOMAIN",
":",
"{",
"\"trigger\"",
":",
"{",
"\"platform... | [
167,
0
] | [
213,
30
] | python | en | ['en', 'error', 'th'] | False |
test_if_action_after_sunrise_no_offset | (hass, calls) |
Test if action was after sunrise.
After sunrise is true from sunrise until midnight, local time.
|
Test if action was after sunrise. | async def test_if_action_after_sunrise_no_offset(hass, calls):
"""
Test if action was after sunrise.
After sunrise is true from sunrise until midnight, local time.
"""
await async_setup_component(
hass,
automation.DOMAIN,
{
automation.DOMAIN: {
"t... | [
"async",
"def",
"test_if_action_after_sunrise_no_offset",
"(",
"hass",
",",
"calls",
")",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"automation",
".",
"DOMAIN",
",",
"{",
"automation",
".",
"DOMAIN",
":",
"{",
"\"trigger\"",
":",
"{",
"\"platform\... | [
216,
0
] | [
262,
30
] | python | en | ['en', 'error', 'th'] | False |
test_if_action_before_sunrise_with_offset | (hass, calls) |
Test if action was before sunrise with offset.
Before sunrise is true from midnight until sunset, local time.
|
Test if action was before sunrise with offset. | async def test_if_action_before_sunrise_with_offset(hass, calls):
"""
Test if action was before sunrise with offset.
Before sunrise is true from midnight until sunset, local time.
"""
await async_setup_component(
hass,
automation.DOMAIN,
{
automation.DOMAIN: {
... | [
"async",
"def",
"test_if_action_before_sunrise_with_offset",
"(",
"hass",
",",
"calls",
")",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"automation",
".",
"DOMAIN",
",",
"{",
"automation",
".",
"DOMAIN",
":",
"{",
"\"trigger\"",
":",
"{",
"\"platfo... | [
265,
0
] | [
343,
30
] | python | en | ['en', 'error', 'th'] | False |
test_if_action_before_sunset_with_offset | (hass, calls) |
Test if action was before sunset with offset.
Before sunset is true from midnight until sunset, local time.
|
Test if action was before sunset with offset. | async def test_if_action_before_sunset_with_offset(hass, calls):
"""
Test if action was before sunset with offset.
Before sunset is true from midnight until sunset, local time.
"""
await async_setup_component(
hass,
automation.DOMAIN,
{
automation.DOMAIN: {
... | [
"async",
"def",
"test_if_action_before_sunset_with_offset",
"(",
"hass",
",",
"calls",
")",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"automation",
".",
"DOMAIN",
",",
"{",
"automation",
".",
"DOMAIN",
":",
"{",
"\"trigger\"",
":",
"{",
"\"platfor... | [
346,
0
] | [
424,
30
] | python | en | ['en', 'error', 'th'] | False |
test_if_action_after_sunrise_with_offset | (hass, calls) |
Test if action was after sunrise with offset.
After sunrise is true from sunrise until midnight, local time.
|
Test if action was after sunrise with offset. | async def test_if_action_after_sunrise_with_offset(hass, calls):
"""
Test if action was after sunrise with offset.
After sunrise is true from sunrise until midnight, local time.
"""
await async_setup_component(
hass,
automation.DOMAIN,
{
automation.DOMAIN: {
... | [
"async",
"def",
"test_if_action_after_sunrise_with_offset",
"(",
"hass",
",",
"calls",
")",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"automation",
".",
"DOMAIN",
",",
"{",
"automation",
".",
"DOMAIN",
":",
"{",
"\"trigger\"",
":",
"{",
"\"platfor... | [
427,
0
] | [
519,
30
] | python | en | ['en', 'error', 'th'] | False |
test_if_action_after_sunset_with_offset | (hass, calls) |
Test if action was after sunset with offset.
After sunset is true from sunset until midnight, local time.
|
Test if action was after sunset with offset. | async def test_if_action_after_sunset_with_offset(hass, calls):
"""
Test if action was after sunset with offset.
After sunset is true from sunset until midnight, local time.
"""
await async_setup_component(
hass,
automation.DOMAIN,
{
automation.DOMAIN: {
... | [
"async",
"def",
"test_if_action_after_sunset_with_offset",
"(",
"hass",
",",
"calls",
")",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"automation",
".",
"DOMAIN",
",",
"{",
"automation",
".",
"DOMAIN",
":",
"{",
"\"trigger\"",
":",
"{",
"\"platform... | [
522,
0
] | [
572,
30
] | python | en | ['en', 'error', 'th'] | False |
test_if_action_before_and_after_during | (hass, calls) |
Test if action was after sunset and before sunrise.
This is true from sunrise until sunset.
|
Test if action was after sunset and before sunrise. | async def test_if_action_before_and_after_during(hass, calls):
"""
Test if action was after sunset and before sunrise.
This is true from sunrise until sunset.
"""
await async_setup_component(
hass,
automation.DOMAIN,
{
automation.DOMAIN: {
"trigge... | [
"async",
"def",
"test_if_action_before_and_after_during",
"(",
"hass",
",",
"calls",
")",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"automation",
".",
"DOMAIN",
",",
"{",
"automation",
".",
"DOMAIN",
":",
"{",
"\"trigger\"",
":",
"{",
"\"platform\... | [
575,
0
] | [
632,
30
] | python | en | ['en', 'error', 'th'] | False |
test_if_action_before_sunrise_no_offset_kotzebue | (hass, calls) |
Test if action was before sunrise.
Local timezone: Alaska time
Location: Kotzebue, which has a very skewed local timezone with sunrise
at 7 AM and sunset at 3AM during summer
After sunrise is true from sunrise until midnight, local time.
|
Test if action was before sunrise. | async def test_if_action_before_sunrise_no_offset_kotzebue(hass, calls):
"""
Test if action was before sunrise.
Local timezone: Alaska time
Location: Kotzebue, which has a very skewed local timezone with sunrise
at 7 AM and sunset at 3AM during summer
After sunrise is true from sunrise until mi... | [
"async",
"def",
"test_if_action_before_sunrise_no_offset_kotzebue",
"(",
"hass",
",",
"calls",
")",
":",
"tz",
"=",
"dt_util",
".",
"get_time_zone",
"(",
"\"America/Anchorage\"",
")",
"dt_util",
".",
"set_default_time_zone",
"(",
"tz",
")",
"hass",
".",
"config",
... | [
635,
0
] | [
688,
30
] | python | en | ['en', 'error', 'th'] | False |
test_if_action_after_sunrise_no_offset_kotzebue | (hass, calls) |
Test if action was after sunrise.
Local timezone: Alaska time
Location: Kotzebue, which has a very skewed local timezone with sunrise
at 7 AM and sunset at 3AM during summer
Before sunrise is true from midnight until sunrise, local time.
|
Test if action was after sunrise. | async def test_if_action_after_sunrise_no_offset_kotzebue(hass, calls):
"""
Test if action was after sunrise.
Local timezone: Alaska time
Location: Kotzebue, which has a very skewed local timezone with sunrise
at 7 AM and sunset at 3AM during summer
Before sunrise is true from midnight until su... | [
"async",
"def",
"test_if_action_after_sunrise_no_offset_kotzebue",
"(",
"hass",
",",
"calls",
")",
":",
"tz",
"=",
"dt_util",
".",
"get_time_zone",
"(",
"\"America/Anchorage\"",
")",
"dt_util",
".",
"set_default_time_zone",
"(",
"tz",
")",
"hass",
".",
"config",
"... | [
691,
0
] | [
744,
30
] | python | en | ['en', 'error', 'th'] | False |
test_if_action_before_sunset_no_offset_kotzebue | (hass, calls) |
Test if action was before sunrise.
Local timezone: Alaska time
Location: Kotzebue, which has a very skewed local timezone with sunrise
at 7 AM and sunset at 3AM during summer
Before sunset is true from midnight until sunset, local time.
|
Test if action was before sunrise. | async def test_if_action_before_sunset_no_offset_kotzebue(hass, calls):
"""
Test if action was before sunrise.
Local timezone: Alaska time
Location: Kotzebue, which has a very skewed local timezone with sunrise
at 7 AM and sunset at 3AM during summer
Before sunset is true from midnight until su... | [
"async",
"def",
"test_if_action_before_sunset_no_offset_kotzebue",
"(",
"hass",
",",
"calls",
")",
":",
"tz",
"=",
"dt_util",
".",
"get_time_zone",
"(",
"\"America/Anchorage\"",
")",
"dt_util",
".",
"set_default_time_zone",
"(",
"tz",
")",
"hass",
".",
"config",
"... | [
747,
0
] | [
800,
30
] | 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.