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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
AlarmPanel.async_connect | (self, now=None) | Connect to and setup a Konnected device. | Connect to and setup a Konnected device. | async def async_connect(self, now=None):
"""Connect to and setup a Konnected device."""
if self.connected:
return
if self.cancel_connect_retry:
# cancel any pending connect attempt and try now
self.cancel_connect_retry()
try:
self.client ... | [
"async",
"def",
"async_connect",
"(",
"self",
",",
"now",
"=",
"None",
")",
":",
"if",
"self",
".",
"connected",
":",
"return",
"if",
"self",
".",
"cancel_connect_retry",
":",
"# cancel any pending connect attempt and try now",
"self",
".",
"cancel_connect_retry",
... | [
104,
4
] | [
162,
9
] | python | en | ['en', 'en', 'en'] | True |
AlarmPanel.update_switch | (self, zone, state, momentary=None, times=None, pause=None) | Update the state of a switchable output. | Update the state of a switchable output. | async def update_switch(self, zone, state, momentary=None, times=None, pause=None):
"""Update the state of a switchable output."""
try:
if self.client:
if self.api_version == CONF_ZONE:
return await self.client.put_zone(
zone,
... | [
"async",
"def",
"update_switch",
"(",
"self",
",",
"zone",
",",
"state",
",",
"momentary",
"=",
"None",
",",
"times",
"=",
"None",
",",
"pause",
"=",
"None",
")",
":",
"try",
":",
"if",
"self",
".",
"client",
":",
"if",
"self",
".",
"api_version",
... | [
164,
4
] | [
189,
27
] | python | en | ['en', 'en', 'en'] | True |
AlarmPanel.async_save_data | (self) | Save the device configuration to `hass.data`. | Save the device configuration to `hass.data`. | async def async_save_data(self):
"""Save the device configuration to `hass.data`."""
binary_sensors = {}
for entity in self.options.get(CONF_BINARY_SENSORS) or []:
zone = entity[CONF_ZONE]
binary_sensors[zone] = {
CONF_TYPE: entity[CONF_TYPE],
... | [
"async",
"def",
"async_save_data",
"(",
"self",
")",
":",
"binary_sensors",
"=",
"{",
"}",
"for",
"entity",
"in",
"self",
".",
"options",
".",
"get",
"(",
"CONF_BINARY_SENSORS",
")",
"or",
"[",
"]",
":",
"zone",
"=",
"entity",
"[",
"CONF_ZONE",
"]",
"b... | [
191,
4
] | [
271,
74
] | python | en | ['en', 'en', 'en'] | True |
AlarmPanel.async_binary_sensor_configuration | (self) | Return the configuration map for syncing binary sensors. | Return the configuration map for syncing binary sensors. | def async_binary_sensor_configuration(self):
"""Return the configuration map for syncing binary sensors."""
return [
self.format_zone(p) for p in self.stored_configuration[CONF_BINARY_SENSORS]
] | [
"def",
"async_binary_sensor_configuration",
"(",
"self",
")",
":",
"return",
"[",
"self",
".",
"format_zone",
"(",
"p",
")",
"for",
"p",
"in",
"self",
".",
"stored_configuration",
"[",
"CONF_BINARY_SENSORS",
"]",
"]"
] | [
274,
4
] | [
278,
9
] | python | en | ['en', 'en', 'en'] | True |
AlarmPanel.async_actuator_configuration | (self) | Return the configuration map for syncing actuators. | Return the configuration map for syncing actuators. | def async_actuator_configuration(self):
"""Return the configuration map for syncing actuators."""
return [
self.format_zone(
data[CONF_ZONE],
{"trigger": (0 if data.get(CONF_ACTIVATION) in [0, STATE_LOW] else 1)},
)
for data in self.sto... | [
"def",
"async_actuator_configuration",
"(",
"self",
")",
":",
"return",
"[",
"self",
".",
"format_zone",
"(",
"data",
"[",
"CONF_ZONE",
"]",
",",
"{",
"\"trigger\"",
":",
"(",
"0",
"if",
"data",
".",
"get",
"(",
"CONF_ACTIVATION",
")",
"in",
"[",
"0",
... | [
281,
4
] | [
289,
9
] | python | en | ['en', 'en', 'en'] | True |
AlarmPanel.async_dht_sensor_configuration | (self) | Return the configuration map for syncing DHT sensors. | Return the configuration map for syncing DHT sensors. | def async_dht_sensor_configuration(self):
"""Return the configuration map for syncing DHT sensors."""
return [
self.format_zone(
sensor[CONF_ZONE], {CONF_POLL_INTERVAL: sensor[CONF_POLL_INTERVAL]}
)
for sensor in self.stored_configuration[CONF_SENSORS]... | [
"def",
"async_dht_sensor_configuration",
"(",
"self",
")",
":",
"return",
"[",
"self",
".",
"format_zone",
"(",
"sensor",
"[",
"CONF_ZONE",
"]",
",",
"{",
"CONF_POLL_INTERVAL",
":",
"sensor",
"[",
"CONF_POLL_INTERVAL",
"]",
"}",
")",
"for",
"sensor",
"in",
"... | [
292,
4
] | [
300,
9
] | python | en | ['en', 'en', 'en'] | True |
AlarmPanel.async_ds18b20_sensor_configuration | (self) | Return the configuration map for syncing DS18B20 sensors. | Return the configuration map for syncing DS18B20 sensors. | def async_ds18b20_sensor_configuration(self):
"""Return the configuration map for syncing DS18B20 sensors."""
return [
self.format_zone(sensor[CONF_ZONE])
for sensor in self.stored_configuration[CONF_SENSORS]
if sensor[CONF_TYPE] == "ds18b20"
] | [
"def",
"async_ds18b20_sensor_configuration",
"(",
"self",
")",
":",
"return",
"[",
"self",
".",
"format_zone",
"(",
"sensor",
"[",
"CONF_ZONE",
"]",
")",
"for",
"sensor",
"in",
"self",
".",
"stored_configuration",
"[",
"CONF_SENSORS",
"]",
"if",
"sensor",
"[",... | [
303,
4
] | [
309,
9
] | python | en | ['en', 'en', 'en'] | True |
AlarmPanel.async_update_initial_states | (self) | Update the initial state of each sensor from status poll. | Update the initial state of each sensor from status poll. | async def async_update_initial_states(self):
"""Update the initial state of each sensor from status poll."""
for sensor_data in self.status.get("sensors"):
sensor_config = self.stored_configuration[CONF_BINARY_SENSORS].get(
sensor_data.get(CONF_ZONE, sensor_data.get(CONF_PIN)... | [
"async",
"def",
"async_update_initial_states",
"(",
"self",
")",
":",
"for",
"sensor_data",
"in",
"self",
".",
"status",
".",
"get",
"(",
"\"sensors\"",
")",
":",
"sensor_config",
"=",
"self",
".",
"stored_configuration",
"[",
"CONF_BINARY_SENSORS",
"]",
".",
... | [
311,
4
] | [
323,
84
] | python | en | ['en', 'en', 'en'] | True |
AlarmPanel.async_desired_settings_payload | (self) | Return a dict representing the desired device configuration. | Return a dict representing the desired device configuration. | def async_desired_settings_payload(self):
"""Return a dict representing the desired device configuration."""
# keeping self.hass.data check for backwards compatibility
# newly configured integrations store this in the config entry
desired_api_host = self.options.get(CONF_API_HOST) or (
... | [
"def",
"async_desired_settings_payload",
"(",
"self",
")",
":",
"# keeping self.hass.data check for backwards compatibility",
"# newly configured integrations store this in the config entry",
"desired_api_host",
"=",
"self",
".",
"options",
".",
"get",
"(",
"CONF_API_HOST",
")",
... | [
326,
4
] | [
344,
9
] | python | en | ['en', 'en', 'en'] | True |
AlarmPanel.async_current_settings_payload | (self) | Return a dict of configuration currently stored on the device. | Return a dict of configuration currently stored on the device. | def async_current_settings_payload(self):
"""Return a dict of configuration currently stored on the device."""
settings = self.status["settings"]
if not settings:
settings = {}
return {
"sensors": [
{self.api_version: s[self.api_version]}
... | [
"def",
"async_current_settings_payload",
"(",
"self",
")",
":",
"settings",
"=",
"self",
".",
"status",
"[",
"\"settings\"",
"]",
"if",
"not",
"settings",
":",
"settings",
"=",
"{",
"}",
"return",
"{",
"\"sensors\"",
":",
"[",
"{",
"self",
".",
"api_versio... | [
347,
4
] | [
365,
9
] | python | en | ['en', 'en', 'en'] | True |
AlarmPanel.async_sync_device_config | (self) | Sync the new zone configuration to the Konnected device if needed. | Sync the new zone configuration to the Konnected device if needed. | async def async_sync_device_config(self):
"""Sync the new zone configuration to the Konnected device if needed."""
_LOGGER.debug(
"Device %s settings payload: %s",
self.device_id,
self.async_desired_settings_payload(),
)
if (
self.async_des... | [
"async",
"def",
"async_sync_device_config",
"(",
"self",
")",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Device %s settings payload: %s\"",
",",
"self",
".",
"device_id",
",",
"self",
".",
"async_desired_settings_payload",
"(",
")",
",",
")",
"if",
"(",
"self",
".",
... | [
367,
4
] | [
379,
83
] | python | en | ['en', 'en', 'en'] | True |
async_setup_platform | (hass, config, async_add_entities, discovery_info=None) | Set up the scenes stored in the LIFX Cloud. | Set up the scenes stored in the LIFX Cloud. | async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
"""Set up the scenes stored in the LIFX Cloud."""
token = config.get(CONF_TOKEN)
timeout = config.get(CONF_TIMEOUT)
headers = {AUTHORIZATION: f"Bearer {token}"}
url = "https://api.lifx.com/v1/scenes"
try:
... | [
"async",
"def",
"async_setup_platform",
"(",
"hass",
",",
"config",
",",
"async_add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"token",
"=",
"config",
".",
"get",
"(",
"CONF_TOKEN",
")",
"timeout",
"=",
"config",
".",
"get",
"(",
"CONF_TIMEOUT"... | [
34,
0
] | [
63,
16
] | python | en | ['en', 'en', 'en'] | True |
LifxCloudScene.__init__ | (self, hass, headers, timeout, scene_data) | Initialize the scene. | Initialize the scene. | def __init__(self, hass, headers, timeout, scene_data):
"""Initialize the scene."""
self.hass = hass
self._headers = headers
self._timeout = timeout
self._name = scene_data["name"]
self._uuid = scene_data["uuid"] | [
"def",
"__init__",
"(",
"self",
",",
"hass",
",",
"headers",
",",
"timeout",
",",
"scene_data",
")",
":",
"self",
".",
"hass",
"=",
"hass",
"self",
".",
"_headers",
"=",
"headers",
"self",
".",
"_timeout",
"=",
"timeout",
"self",
".",
"_name",
"=",
"... | [
69,
4
] | [
75,
39
] | python | en | ['en', 'it', 'en'] | True |
LifxCloudScene.name | (self) | Return the name of the scene. | Return the name of the scene. | def name(self):
"""Return the name of the scene."""
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | [
78,
4
] | [
80,
25
] | python | en | ['en', 'ig', 'en'] | True |
LifxCloudScene.async_activate | (self, **kwargs: Any) | Activate the scene. | Activate the scene. | async def async_activate(self, **kwargs: Any) -> None:
"""Activate the scene."""
url = f"https://api.lifx.com/v1/scenes/scene_id:{self._uuid}/activate"
try:
httpsession = async_get_clientsession(self.hass)
with async_timeout.timeout(self._timeout):
await ... | [
"async",
"def",
"async_activate",
"(",
"self",
",",
"*",
"*",
"kwargs",
":",
"Any",
")",
"->",
"None",
":",
"url",
"=",
"f\"https://api.lifx.com/v1/scenes/scene_id:{self._uuid}/activate\"",
"try",
":",
"httpsession",
"=",
"async_get_clientsession",
"(",
"self",
".",... | [
82,
4
] | [
92,
49
] | python | en | ['en', 'it', 'en'] | True |
async_attach_trigger | (
hass: HomeAssistant,
config: ConfigType,
action: AutomationActionType,
automation_info: AutomationTriggerInfo,
) | Listen for state changes based on configuration. | Listen for state changes based on configuration. | async def async_attach_trigger(
hass: HomeAssistant,
config: ConfigType,
action: AutomationActionType,
automation_info: AutomationTriggerInfo,
) -> CALLBACK_TYPE:
"""Listen for state changes based on configuration."""
return await toggle_entity.async_attach_trigger(
hass, config, action,... | [
"async",
"def",
"async_attach_trigger",
"(",
"hass",
":",
"HomeAssistant",
",",
"config",
":",
"ConfigType",
",",
"action",
":",
"AutomationActionType",
",",
"automation_info",
":",
"AutomationTriggerInfo",
",",
")",
"->",
"CALLBACK_TYPE",
":",
"return",
"await",
... | [
23,
0
] | [
32,
5
] | python | en | ['en', 'en', 'en'] | True |
async_get_triggers | (
hass: HomeAssistant, device_id: str
) | List device triggers. | List device triggers. | async def async_get_triggers(
hass: HomeAssistant, device_id: str
) -> list[dict[str, Any]]:
"""List device triggers."""
return await toggle_entity.async_get_triggers(hass, device_id, DOMAIN) | [
"async",
"def",
"async_get_triggers",
"(",
"hass",
":",
"HomeAssistant",
",",
"device_id",
":",
"str",
")",
"->",
"list",
"[",
"dict",
"[",
"str",
",",
"Any",
"]",
"]",
":",
"return",
"await",
"toggle_entity",
".",
"async_get_triggers",
"(",
"hass",
",",
... | [
35,
0
] | [
39,
74
] | python | en | ['fr', '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 await toggle_entity.async_get_trigger_capabilities(hass, config) | [
"async",
"def",
"async_get_trigger_capabilities",
"(",
"hass",
":",
"HomeAssistant",
",",
"config",
":",
"ConfigType",
")",
"->",
"dict",
"[",
"str",
",",
"vol",
".",
"Schema",
"]",
":",
"return",
"await",
"toggle_entity",
".",
"async_get_trigger_capabilities",
... | [
42,
0
] | [
46,
75
] | python | en | ['en', 'la', 'en'] | True |
generate_metadata | (build_env, backend) | Generate metadata using mechanisms described in PEP 517.
Returns the generated metadata directory.
| Generate metadata using mechanisms described in PEP 517. | def generate_metadata(build_env, backend):
# type: (BuildEnvironment, Pep517HookCaller) -> str
"""Generate metadata using mechanisms described in PEP 517.
Returns the generated metadata directory.
"""
metadata_tmpdir = TempDirectory(
kind="modern-metadata", globally_managed=True
)
... | [
"def",
"generate_metadata",
"(",
"build_env",
",",
"backend",
")",
":",
"# type: (BuildEnvironment, Pep517HookCaller) -> str",
"metadata_tmpdir",
"=",
"TempDirectory",
"(",
"kind",
"=",
"\"modern-metadata\"",
",",
"globally_managed",
"=",
"True",
")",
"metadata_dir",
"=",... | [
14,
0
] | [
36,
51
] | python | en | ['en', 'nl', 'en'] | True |
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."""
devices = config.get(CONF_DEVICES)
lights = []
logger = logging.getLogger(__name__)
scsgate = hass.data[DOMAIN]
if devices:
for entity_info in devices.values():
if entity_... | [
"def",
"setup_platform",
"(",
"hass",
",",
"config",
",",
"add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"devices",
"=",
"config",
".",
"get",
"(",
"CONF_DEVICES",
")",
"lights",
"=",
"[",
"]",
"logger",
"=",
"logging",
".",
"getLogger",
"... | [
17,
0
] | [
40,
43
] | python | en | ['en', 'en', 'en'] | True |
SCSGateLight.__init__ | (self, scs_id, name, logger, scsgate) | Initialize the light. | Initialize the light. | def __init__(self, scs_id, name, logger, scsgate):
"""Initialize the light."""
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... | [
46,
4
] | [
52,
31
] | python | en | ['en', 'en', 'en'] | True |
SCSGateLight.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"
] | [
55,
4
] | [
57,
27
] | python | en | ['en', 'la', 'en'] | True |
SCSGateLight.should_poll | (self) | No polling needed for a SCSGate light. | No polling needed for a SCSGate light. | def should_poll(self):
"""No polling needed for a SCSGate light."""
return False | [
"def",
"should_poll",
"(",
"self",
")",
":",
"return",
"False"
] | [
60,
4
] | [
62,
20
] | python | en | ['en', 'en', 'en'] | True |
SCSGateLight.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"
] | [
65,
4
] | [
67,
25
] | python | en | ['en', 'en', 'en'] | True |
SCSGateLight.is_on | (self) | Return true if light is on. | Return true if light is on. | def is_on(self):
"""Return true if light is on."""
return self._toggled | [
"def",
"is_on",
"(",
"self",
")",
":",
"return",
"self",
".",
"_toggled"
] | [
70,
4
] | [
72,
28
] | python | en | ['en', 'et', 'en'] | True |
SCSGateLight.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",
"=",
"... | [
74,
4
] | [
80,
39
] | python | en | ['en', 'en', 'en'] | True |
SCSGateLight.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",
"=",
... | [
82,
4
] | [
88,
39
] | python | en | ['en', 'en', 'en'] | True |
SCSGateLight.process_event | (self, message) | Handle a SCSGate message related with this light. | Handle a SCSGate message related with this light. | def process_event(self, message):
"""Handle a SCSGate message related with this light."""
if self._toggled == message.toggled:
self._logger.info(
"Light %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",
"(",
"\"Light %s, ignoring message %s because state already active\"",
",",
"self",
".",
"_sc... | [
90,
4
] | [
110,
9
] | python | en | ['en', 'en', 'en'] | True |
async_setup_platform | (
hass: HomeAssistant, config: ConfigType, async_add_entities, discovery_info=None
) | Read configuration and create Modbus fans. | Read configuration and create Modbus fans. | async def async_setup_platform(
hass: HomeAssistant, config: ConfigType, async_add_entities, discovery_info=None
):
"""Read configuration and create Modbus fans."""
if discovery_info is None: # pragma: no cover
return
fans = []
for entry in discovery_info[CONF_FANS]:
hub: ModbusHub... | [
"async",
"def",
"async_setup_platform",
"(",
"hass",
":",
"HomeAssistant",
",",
"config",
":",
"ConfigType",
",",
"async_add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"if",
"discovery_info",
"is",
"None",
":",
"# pragma: no cover",
"return",
"fans",... | [
19,
0
] | [
30,
28
] | python | en | ['en', 'en', 'en'] | True |
ModbusFan.async_turn_on | (
self,
speed: str | None = None,
percentage: int | None = None,
preset_mode: str | None = None,
**kwargs,
) | Set fan on. | Set fan on. | async def async_turn_on(
self,
speed: str | None = None,
percentage: int | None = None,
preset_mode: str | None = None,
**kwargs,
) -> None:
"""Set fan on."""
await self.async_turn(self.command_on) | [
"async",
"def",
"async_turn_on",
"(",
"self",
",",
"speed",
":",
"str",
"|",
"None",
"=",
"None",
",",
"percentage",
":",
"int",
"|",
"None",
"=",
"None",
",",
"preset_mode",
":",
"str",
"|",
"None",
"=",
"None",
",",
"*",
"*",
"kwargs",
",",
")",
... | [
36,
4
] | [
44,
46
] | python | da | ['da', 'fy', 'en'] | False |
ModbusFan.is_on | (self) | Return true if fan is on.
This is needed due to the ongoing conversion of fan.
| Return true if fan is on. | def is_on(self):
"""Return true if fan is on.
This is needed due to the ongoing conversion of fan.
"""
return self._attr_is_on | [
"def",
"is_on",
"(",
"self",
")",
":",
"return",
"self",
".",
"_attr_is_on"
] | [
47,
4
] | [
52,
31
] | python | en | ['en', 'fy', 'en'] | True |
is_valid_config_entry | (hass, logger, api_key, origin, destination) | Return whether the config entry data is valid. | Return whether the config entry data is valid. | def is_valid_config_entry(hass, logger, api_key, origin, destination):
"""Return whether the config entry data is valid."""
origin = resolve_location(hass, logger, origin)
destination = resolve_location(hass, logger, destination)
client = Client(api_key, timeout=10)
try:
distance_matrix(clie... | [
"def",
"is_valid_config_entry",
"(",
"hass",
",",
"logger",
",",
"api_key",
",",
"origin",
",",
"destination",
")",
":",
"origin",
"=",
"resolve_location",
"(",
"hass",
",",
"logger",
",",
"origin",
")",
"destination",
"=",
"resolve_location",
"(",
"hass",
"... | [
10,
0
] | [
19,
15
] | python | en | ['en', 'en', 'en'] | True |
resolve_location | (hass, logger, loc) | Resolve a location. | Resolve a location. | def resolve_location(hass, logger, loc):
"""Resolve a location."""
if loc.split(".", 1)[0] in TRACKABLE_DOMAINS:
return get_location_from_entity(hass, logger, loc)
return resolve_zone(hass, loc) | [
"def",
"resolve_location",
"(",
"hass",
",",
"logger",
",",
"loc",
")",
":",
"if",
"loc",
".",
"split",
"(",
"\".\"",
",",
"1",
")",
"[",
"0",
"]",
"in",
"TRACKABLE_DOMAINS",
":",
"return",
"get_location_from_entity",
"(",
"hass",
",",
"logger",
",",
"... | [
22,
0
] | [
27,
34
] | python | en | ['es', 'en', 'en'] | True |
get_location_from_entity | (hass, logger, entity_id) | Get the location from the entity state or attributes. | Get the location from the entity state or attributes. | def get_location_from_entity(hass, logger, entity_id):
"""Get the location from the entity state or attributes."""
entity = hass.states.get(entity_id)
if entity is None:
logger.error("Unable to find entity %s", entity_id)
return None
# Check if the entity has location attributes
if... | [
"def",
"get_location_from_entity",
"(",
"hass",
",",
"logger",
",",
"entity_id",
")",
":",
"entity",
"=",
"hass",
".",
"states",
".",
"get",
"(",
"entity_id",
")",
"if",
"entity",
"is",
"None",
":",
"logger",
".",
"error",
"(",
"\"Unable to find entity %s\""... | [
30,
0
] | [
55,
15
] | python | en | ['en', 'en', 'en'] | True |
get_location_from_attributes | (entity) | Get the lat/long string from an entities attributes. | Get the lat/long string from an entities attributes. | def get_location_from_attributes(entity):
"""Get the lat/long string from an entities attributes."""
attr = entity.attributes
return f"{attr.get(ATTR_LATITUDE)},{attr.get(ATTR_LONGITUDE)}" | [
"def",
"get_location_from_attributes",
"(",
"entity",
")",
":",
"attr",
"=",
"entity",
".",
"attributes",
"return",
"f\"{attr.get(ATTR_LATITUDE)},{attr.get(ATTR_LONGITUDE)}\""
] | [
58,
0
] | [
61,
66
] | python | en | ['en', 'en', 'en'] | True |
resolve_zone | (hass, friendly_name) | Resolve a location from a zone's friendly name. | Resolve a location from a zone's friendly name. | def resolve_zone(hass, friendly_name):
"""Resolve a location from a zone's friendly name."""
entities = hass.states.all()
for entity in entities:
if entity.domain == "zone" and entity.name == friendly_name:
return get_location_from_attributes(entity)
return friendly_name | [
"def",
"resolve_zone",
"(",
"hass",
",",
"friendly_name",
")",
":",
"entities",
"=",
"hass",
".",
"states",
".",
"all",
"(",
")",
"for",
"entity",
"in",
"entities",
":",
"if",
"entity",
".",
"domain",
"==",
"\"zone\"",
"and",
"entity",
".",
"name",
"==... | [
64,
0
] | [
71,
24
] | python | en | ['en', 'en', 'en'] | True |
validate_input | (hass: HomeAssistant, data: dict[str, Any]) | Validate the user input allows us to connect.
Data has the keys from STEP_USER_DATA_SCHEMA with values provided by the user.
| Validate the user input allows us to connect. | async def validate_input(hass: HomeAssistant, data: dict[str, Any]) -> dict[str, Any]:
"""Validate the user input allows us to connect.
Data has the keys from STEP_USER_DATA_SCHEMA with values provided by the user.
"""
# TODO validate the data can be used to set up a connection.
# If your PyPI pac... | [
"async",
"def",
"validate_input",
"(",
"hass",
":",
"HomeAssistant",
",",
"data",
":",
"dict",
"[",
"str",
",",
"Any",
"]",
")",
"->",
"dict",
"[",
"str",
",",
"Any",
"]",
":",
"# TODO validate the data can be used to set up a connection.",
"# If your PyPI package... | [
42,
0
] | [
66,
42
] | python | en | ['en', 'en', 'en'] | True |
PlaceholderHub.__init__ | (self, host: str) | Initialize. | Initialize. | def __init__(self, host: str) -> None:
"""Initialize."""
self.host = host | [
"def",
"__init__",
"(",
"self",
",",
"host",
":",
"str",
")",
"->",
"None",
":",
"self",
".",
"host",
"=",
"host"
] | [
33,
4
] | [
35,
24
] | python | en | ['en', 'en', 'it'] | False |
PlaceholderHub.authenticate | (self, username: str, password: str) | Test if we can authenticate with the host. | Test if we can authenticate with the host. | async def authenticate(self, username: str, password: str) -> bool:
"""Test if we can authenticate with the host."""
return True | [
"async",
"def",
"authenticate",
"(",
"self",
",",
"username",
":",
"str",
",",
"password",
":",
"str",
")",
"->",
"bool",
":",
"return",
"True"
] | [
37,
4
] | [
39,
19
] | python | en | ['en', 'en', 'en'] | True |
ConfigFlow.async_step_user | (
self, user_input: dict[str, Any] | None = None
) | Handle the initial step. | Handle the initial step. | async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> FlowResult:
"""Handle the initial step."""
if user_input is None:
return self.async_show_form(
step_id="user", data_schema=STEP_USER_DATA_SCHEMA
)
errors = {}
... | [
"async",
"def",
"async_step_user",
"(",
"self",
",",
"user_input",
":",
"dict",
"[",
"str",
",",
"Any",
"]",
"|",
"None",
"=",
"None",
")",
"->",
"FlowResult",
":",
"if",
"user_input",
"is",
"None",
":",
"return",
"self",
".",
"async_show_form",
"(",
"... | [
74,
4
] | [
99,
9
] | python | en | ['en', 'en', 'en'] | True |
ScanningLoader.loadTestsFromModule | (self, module, pattern=None) | Return a suite of all tests cases contained in the given module
If the module is a package, load tests from all the modules in it.
If the module has an ``additional_tests`` function, call it and add
the return value to the tests.
| Return a suite of all tests cases contained in the given module | def loadTestsFromModule(self, module, pattern=None):
"""Return a suite of all tests cases contained in the given module
If the module is a package, load tests from all the modules in it.
If the module has an ``additional_tests`` function, call it and add
the return value to the tests.
... | [
"def",
"loadTestsFromModule",
"(",
"self",
",",
"module",
",",
"pattern",
"=",
"None",
")",
":",
"if",
"module",
"in",
"self",
".",
"_visited",
":",
"return",
"None",
"self",
".",
"_visited",
".",
"add",
"(",
"module",
")",
"tests",
"=",
"[",
"]",
"t... | [
23,
4
] | [
54,
27
] | python | en | ['en', 'en', 'en'] | True |
test.with_project_on_sys_path | (self, func) |
Backward compatibility for project_on_sys_path context.
|
Backward compatibility for project_on_sys_path context.
| def with_project_on_sys_path(self, func):
"""
Backward compatibility for project_on_sys_path context.
"""
with self.project_on_sys_path():
func() | [
"def",
"with_project_on_sys_path",
"(",
"self",
",",
"func",
")",
":",
"with",
"self",
".",
"project_on_sys_path",
"(",
")",
":",
"func",
"(",
")"
] | [
117,
4
] | [
122,
18
] | python | en | ['en', 'error', 'th'] | False |
test.paths_on_pythonpath | (paths) |
Add the indicated paths to the head of the PYTHONPATH environment
variable so that subprocesses will also see the packages at
these paths.
Do this in a context that restores the value on exit.
|
Add the indicated paths to the head of the PYTHONPATH environment
variable so that subprocesses will also see the packages at
these paths. | def paths_on_pythonpath(paths):
"""
Add the indicated paths to the head of the PYTHONPATH environment
variable so that subprocesses will also see the packages at
these paths.
Do this in a context that restores the value on exit.
"""
nothing = object()
ori... | [
"def",
"paths_on_pythonpath",
"(",
"paths",
")",
":",
"nothing",
"=",
"object",
"(",
")",
"orig_pythonpath",
"=",
"os",
".",
"environ",
".",
"get",
"(",
"'PYTHONPATH'",
",",
"nothing",
")",
"current_pythonpath",
"=",
"os",
".",
"environ",
".",
"get",
"(",
... | [
172,
4
] | [
194,
58
] | python | en | ['en', 'error', 'th'] | False |
test.install_dists | (dist) |
Install the requirements indicated by self.distribution and
return an iterable of the dists that were built.
|
Install the requirements indicated by self.distribution and
return an iterable of the dists that were built.
| def install_dists(dist):
"""
Install the requirements indicated by self.distribution and
return an iterable of the dists that were built.
"""
ir_d = dist.fetch_build_eggs(dist.install_requires)
tr_d = dist.fetch_build_eggs(dist.tests_require or [])
er_d = dist.fet... | [
"def",
"install_dists",
"(",
"dist",
")",
":",
"ir_d",
"=",
"dist",
".",
"fetch_build_eggs",
"(",
"dist",
".",
"install_requires",
")",
"tr_d",
"=",
"dist",
".",
"fetch_build_eggs",
"(",
"dist",
".",
"tests_require",
"or",
"[",
"]",
")",
"er_d",
"=",
"di... | [
197,
4
] | [
208,
48
] | python | en | ['en', 'error', 'th'] | False |
test._resolve_as_ep | (val) |
Load the indicated attribute value, called, as a as if it were
specified as an entry point.
|
Load the indicated attribute value, called, as a as if it were
specified as an entry point.
| def _resolve_as_ep(val):
"""
Load the indicated attribute value, called, as a as if it were
specified as an entry point.
"""
if val is None:
return
parsed = EntryPoint.parse("x=" + val)
return parsed.resolve()() | [
"def",
"_resolve_as_ep",
"(",
"val",
")",
":",
"if",
"val",
"is",
"None",
":",
"return",
"parsed",
"=",
"EntryPoint",
".",
"parse",
"(",
"\"x=\"",
"+",
"val",
")",
"return",
"parsed",
".",
"resolve",
"(",
")",
"(",
")"
] | [
265,
4
] | [
273,
33
] | python | en | ['en', 'error', 'th'] | False |
_xml_escape | (data) | Escape &, <, >, ", ', etc. in a string of data. | Escape &, <, >, ", ', etc. in a string of data. | def _xml_escape(data):
"""Escape &, <, >, ", ', etc. in a string of data."""
# ampersand must be replaced first
from_symbols = '&><"\''
to_symbols = ('&'+s+';' for s in "amp gt lt quot apos".split())
for from_,to_ in zip(from_symbols, to_symbols):
data = data.replace(from_, to_)
... | [
"def",
"_xml_escape",
"(",
"data",
")",
":",
"# ampersand must be replaced first\r",
"from_symbols",
"=",
"'&><\"\\''",
"to_symbols",
"=",
"(",
"'&'",
"+",
"s",
"+",
"';'",
"for",
"s",
"in",
"\"amp gt lt quot apos\"",
".",
"split",
"(",
")",
")",
"for",
"from_... | [
184,
0
] | [
192,
15
] | python | en | ['en', 'en', 'en'] | True |
col | (loc,strg) | Returns current column within a string, counting newlines as line separators.
The first column is number 1.
Note: the default parsing behavior is to expand tabs in the input string
before starting the parsing process. See L{I{ParserElement.parseString}<ParserElement.parseString>} for more information
... | Returns current column within a string, counting newlines as line separators.
The first column is number 1.
Note: the default parsing behavior is to expand tabs in the input string
before starting the parsing process. See L{I{ParserElement.parseString}<ParserElement.parseString>} for more information
... | def col (loc,strg):
"""Returns current column within a string, counting newlines as line separators.
The first column is number 1.
Note: the default parsing behavior is to expand tabs in the input string
before starting the parsing process. See L{I{ParserElement.parseString}<ParserElement.parseStrin... | [
"def",
"col",
"(",
"loc",
",",
"strg",
")",
":",
"s",
"=",
"strg",
"return",
"1",
"if",
"0",
"<",
"loc",
"<",
"len",
"(",
"s",
")",
"and",
"s",
"[",
"loc",
"-",
"1",
"]",
"==",
"'\\n'",
"else",
"loc",
"-",
"s",
".",
"rfind",
"(",
"\"\\n\"",... | [
967,
0
] | [
978,
82
] | python | en | ['en', 'en', 'en'] | True |
lineno | (loc,strg) | Returns current line number within a string, counting newlines as line separators.
The first line is number 1.
Note: the default parsing behavior is to expand tabs in the input string
before starting the parsing process. See L{I{ParserElement.parseString}<ParserElement.parseString>} for more information
... | Returns current line number within a string, counting newlines as line separators.
The first line is number 1.
Note: the default parsing behavior is to expand tabs in the input string
before starting the parsing process. See L{I{ParserElement.parseString}<ParserElement.parseString>} for more information
... | def lineno(loc,strg):
"""Returns current line number within a string, counting newlines as line separators.
The first line is number 1.
Note: the default parsing behavior is to expand tabs in the input string
before starting the parsing process. See L{I{ParserElement.parseString}<ParserElement.parse... | [
"def",
"lineno",
"(",
"loc",
",",
"strg",
")",
":",
"return",
"strg",
".",
"count",
"(",
"\"\\n\"",
",",
"0",
",",
"loc",
")",
"+",
"1"
] | [
980,
0
] | [
990,
37
] | python | en | ['en', 'en', 'en'] | True |
line | ( loc, strg ) | Returns the line of text containing loc within a string, counting newlines as line separators.
| Returns the line of text containing loc within a string, counting newlines as line separators.
| def line( loc, strg ):
"""Returns the line of text containing loc within a string, counting newlines as line separators.
"""
lastCR = strg.rfind("\n", 0, loc)
nextCR = strg.find("\n", loc)
if nextCR >= 0:
return strg[lastCR+1:nextCR]
else:
return strg[lastCR+1:] | [
"def",
"line",
"(",
"loc",
",",
"strg",
")",
":",
"lastCR",
"=",
"strg",
".",
"rfind",
"(",
"\"\\n\"",
",",
"0",
",",
"loc",
")",
"nextCR",
"=",
"strg",
".",
"find",
"(",
"\"\\n\"",
",",
"loc",
")",
"if",
"nextCR",
">=",
"0",
":",
"return",
"st... | [
992,
0
] | [
1000,
30
] | python | en | ['en', 'en', 'en'] | True |
nullDebugAction | (*args) | Do-nothing' debug action, to suppress debugging output during parsing. | Do-nothing' debug action, to suppress debugging output during parsing. | def nullDebugAction(*args):
"""'Do-nothing' debug action, to suppress debugging output during parsing."""
pass | [
"def",
"nullDebugAction",
"(",
"*",
"args",
")",
":",
"pass"
] | [
1011,
0
] | [
1013,
8
] | python | en | ['en', 'jv', 'en'] | True |
ParseBaseException._from_exception | (cls, pe) |
internal factory method to simplify creating one type of ParseException
from another - avoids having __init__ signature conflicts among subclasses
|
internal factory method to simplify creating one type of ParseException
from another - avoids having __init__ signature conflicts among subclasses
| def _from_exception(cls, pe):
"""
internal factory method to simplify creating one type of ParseException
from another - avoids having __init__ signature conflicts among subclasses
"""
return cls(pe.pstr, pe.loc, pe.msg, pe.parserElement) | [
"def",
"_from_exception",
"(",
"cls",
",",
"pe",
")",
":",
"return",
"cls",
"(",
"pe",
".",
"pstr",
",",
"pe",
".",
"loc",
",",
"pe",
".",
"msg",
",",
"pe",
".",
"parserElement",
")"
] | [
220,
4
] | [
225,
61
] | python | en | ['en', 'ja', 'th'] | False |
ParseBaseException.__getattr__ | ( self, aname ) | supported attributes by name are:
- lineno - returns the line number of the exception text
- col - returns the column number of the exception text
- line - returns the line containing the exception text
| supported attributes by name are:
- lineno - returns the line number of the exception text
- col - returns the column number of the exception text
- line - returns the line containing the exception text
| def __getattr__( self, aname ):
"""supported attributes by name are:
- lineno - returns the line number of the exception text
- col - returns the column number of the exception text
- line - returns the line containing the exception text
"""
if( aname ==... | [
"def",
"__getattr__",
"(",
"self",
",",
"aname",
")",
":",
"if",
"(",
"aname",
"==",
"\"lineno\"",
")",
":",
"return",
"lineno",
"(",
"self",
".",
"loc",
",",
"self",
".",
"pstr",
")",
"elif",
"(",
"aname",
"in",
"(",
"\"col\"",
",",
"\"column\"",
... | [
227,
4
] | [
240,
39
] | python | en | ['en', 'en', 'en'] | True |
ParseBaseException.markInputline | ( self, markerString = ">!<" ) | Extracts the exception line from the input string, and marks
the location of the exception with a special symbol.
| Extracts the exception line from the input string, and marks
the location of the exception with a special symbol.
| def markInputline( self, markerString = ">!<" ):
"""Extracts the exception line from the input string, and marks
the location of the exception with a special symbol.
"""
line_str = self.line
line_column = self.column - 1
if markerString:
line_str = "... | [
"def",
"markInputline",
"(",
"self",
",",
"markerString",
"=",
"\">!<\"",
")",
":",
"line_str",
"=",
"self",
".",
"line",
"line_column",
"=",
"self",
".",
"column",
"-",
"1",
"if",
"markerString",
":",
"line_str",
"=",
"\"\"",
".",
"join",
"(",
"(",
"l... | [
247,
4
] | [
256,
31
] | python | en | ['en', 'en', 'en'] | True |
ParseResults.haskeys | ( self ) | Since keys() returns an iterator, this method is helpful in bypassing
code that looks for the existence of any defined results names. | Since keys() returns an iterator, this method is helpful in bypassing
code that looks for the existence of any defined results names. | def haskeys( self ):
"""Since keys() returns an iterator, this method is helpful in bypassing
code that looks for the existence of any defined results names."""
return bool(self.__tokdict) | [
"def",
"haskeys",
"(",
"self",
")",
":",
"return",
"bool",
"(",
"self",
".",
"__tokdict",
")"
] | [
505,
4
] | [
508,
35
] | python | en | ['en', 'en', 'en'] | True |
ParseResults.pop | ( self, *args, **kwargs) |
Removes and returns item at specified index (default=C{last}).
Supports both C{list} and C{dict} semantics for C{pop()}. If passed no
argument or an integer argument, it will use C{list} semantics
and pop tokens from the list of parsed tokens. If passed a
non-integer argum... |
Removes and returns item at specified index (default=C{last}).
Supports both C{list} and C{dict} semantics for C{pop()}. If passed no
argument or an integer argument, it will use C{list} semantics
and pop tokens from the list of parsed tokens. If passed a
non-integer argum... | def pop( self, *args, **kwargs):
"""
Removes and returns item at specified index (default=C{last}).
Supports both C{list} and C{dict} semantics for C{pop()}. If passed no
argument or an integer argument, it will use C{list} semantics
and pop tokens from the list of parsed to... | [
"def",
"pop",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"args",
":",
"args",
"=",
"[",
"-",
"1",
"]",
"for",
"k",
",",
"v",
"in",
"kwargs",
".",
"items",
"(",
")",
":",
"if",
"k",
"==",
"'default'",
":",... | [
510,
4
] | [
560,
31
] | python | en | ['en', 'ja', 'th'] | False |
ParseResults.get | (self, key, defaultValue=None) |
Returns named result matching the given key, or if there is no
such name, then returns the given C{defaultValue} or C{None} if no
C{defaultValue} is specified.
Similar to C{dict.get()}.
Example::
integer = Word(nums)
date_str = integer(... |
Returns named result matching the given key, or if there is no
such name, then returns the given C{defaultValue} or C{None} if no
C{defaultValue} is specified.
Similar to C{dict.get()}.
Example::
integer = Word(nums)
date_str = integer(... | def get(self, key, defaultValue=None):
"""
Returns named result matching the given key, or if there is no
such name, then returns the given C{defaultValue} or C{None} if no
C{defaultValue} is specified.
Similar to C{dict.get()}.
Example::
in... | [
"def",
"get",
"(",
"self",
",",
"key",
",",
"defaultValue",
"=",
"None",
")",
":",
"if",
"key",
"in",
"self",
":",
"return",
"self",
"[",
"key",
"]",
"else",
":",
"return",
"defaultValue"
] | [
562,
4
] | [
582,
31
] | python | en | ['en', 'ja', 'th'] | False |
ParseResults.insert | ( self, index, insStr ) |
Inserts new element at location index in the list of parsed tokens.
Similar to C{list.insert()}.
Example::
print(OneOrMore(Word(nums)).parseString("0 123 321")) # -> ['0', '123', '321']
# use a parse action to insert the parse location in the front of ... |
Inserts new element at location index in the list of parsed tokens.
Similar to C{list.insert()}.
Example::
print(OneOrMore(Word(nums)).parseString("0 123 321")) # -> ['0', '123', '321']
# use a parse action to insert the parse location in the front of ... | def insert( self, index, insStr ):
"""
Inserts new element at location index in the list of parsed tokens.
Similar to C{list.insert()}.
Example::
print(OneOrMore(Word(nums)).parseString("0 123 321")) # -> ['0', '123', '321']
# use a parse actio... | [
"def",
"insert",
"(",
"self",
",",
"index",
",",
"insStr",
")",
":",
"self",
".",
"__toklist",
".",
"insert",
"(",
"index",
",",
"insStr",
")",
"# fixup indices in token dictionary\r",
"for",
"name",
",",
"occurrences",
"in",
"self",
".",
"__tokdict",
".",
... | [
584,
4
] | [
602,
94
] | python | en | ['en', 'ja', 'th'] | False |
ParseResults.append | ( self, item ) |
Add single element to end of ParseResults list of elements.
Example::
print(OneOrMore(Word(nums)).parseString("0 123 321")) # -> ['0', '123', '321']
# use a parse action to compute the sum of the parsed integers, and add it to the end
def append_... |
Add single element to end of ParseResults list of elements.
Example::
print(OneOrMore(Word(nums)).parseString("0 123 321")) # -> ['0', '123', '321']
# use a parse action to compute the sum of the parsed integers, and add it to the end
def append_... | def append( self, item ):
"""
Add single element to end of ParseResults list of elements.
Example::
print(OneOrMore(Word(nums)).parseString("0 123 321")) # -> ['0', '123', '321']
# use a parse action to compute the sum of the parsed integers, and add ... | [
"def",
"append",
"(",
"self",
",",
"item",
")",
":",
"self",
".",
"__toklist",
".",
"append",
"(",
"item",
")"
] | [
604,
4
] | [
616,
35
] | python | en | ['en', 'ja', 'th'] | False |
ParseResults.extend | ( self, itemseq ) |
Add sequence of elements to end of ParseResults list of elements.
Example::
patt = OneOrMore(Word(alphas))
# use a parse action to append the reverse of the matched strings, to make a palindrome
def make_palindrome(tokens):
token... |
Add sequence of elements to end of ParseResults list of elements.
Example::
patt = OneOrMore(Word(alphas))
# use a parse action to append the reverse of the matched strings, to make a palindrome
def make_palindrome(tokens):
token... | def extend( self, itemseq ):
"""
Add sequence of elements to end of ParseResults list of elements.
Example::
patt = OneOrMore(Word(alphas))
# use a parse action to append the reverse of the matched strings, to make a palindrome
def make_p... | [
"def",
"extend",
"(",
"self",
",",
"itemseq",
")",
":",
"if",
"isinstance",
"(",
"itemseq",
",",
"ParseResults",
")",
":",
"self",
"+=",
"itemseq",
"else",
":",
"self",
".",
"__toklist",
".",
"extend",
"(",
"itemseq",
")"
] | [
618,
4
] | [
634,
42
] | python | en | ['en', 'ja', 'th'] | False |
ParseResults.clear | ( self ) |
Clear all elements and results names.
|
Clear all elements and results names.
| def clear( self ):
"""
Clear all elements and results names.
"""
del self.__toklist[:]
self.__tokdict.clear() | [
"def",
"clear",
"(",
"self",
")",
":",
"del",
"self",
".",
"__toklist",
"[",
":",
"]",
"self",
".",
"__tokdict",
".",
"clear",
"(",
")"
] | [
636,
4
] | [
641,
30
] | python | en | ['en', 'ja', 'th'] | False |
ParseResults.asList | ( self ) |
Returns the parse results as a nested list of matching tokens, all converted to strings.
Example::
patt = OneOrMore(Word(alphas))
result = patt.parseString("sldkj lsdkj sldkj")
# even though the result prints in string-like form, it is actually a pyparsing Par... |
Returns the parse results as a nested list of matching tokens, all converted to strings.
Example::
patt = OneOrMore(Word(alphas))
result = patt.parseString("sldkj lsdkj sldkj")
# even though the result prints in string-like form, it is actually a pyparsing Par... | def asList( self ):
"""
Returns the parse results as a nested list of matching tokens, all converted to strings.
Example::
patt = OneOrMore(Word(alphas))
result = patt.parseString("sldkj lsdkj sldkj")
# even though the result prints in string-like form... | [
"def",
"asList",
"(",
"self",
")",
":",
"return",
"[",
"res",
".",
"asList",
"(",
")",
"if",
"isinstance",
"(",
"res",
",",
"ParseResults",
")",
"else",
"res",
"for",
"res",
"in",
"self",
".",
"__toklist",
"]"
] | [
703,
4
] | [
717,
96
] | python | en | ['en', 'ja', 'th'] | False |
ParseResults.asDict | ( self ) |
Returns the named parse results as a nested dictionary.
Example::
integer = Word(nums)
date_str = integer("year") + '/' + integer("month") + '/' + integer("day")
result = date_str.parseString('12/31/1999')
print(type(result), repr(re... |
Returns the named parse results as a nested dictionary.
Example::
integer = Word(nums)
date_str = integer("year") + '/' + integer("month") + '/' + integer("day")
result = date_str.parseString('12/31/1999')
print(type(result), repr(re... | def asDict( self ):
"""
Returns the named parse results as a nested dictionary.
Example::
integer = Word(nums)
date_str = integer("year") + '/' + integer("month") + '/' + integer("day")
result = date_str.parseString('12/31/1999')
... | [
"def",
"asDict",
"(",
"self",
")",
":",
"if",
"PY_3",
":",
"item_fn",
"=",
"self",
".",
"items",
"else",
":",
"item_fn",
"=",
"self",
".",
"iteritems",
"def",
"toItem",
"(",
"obj",
")",
":",
"if",
"isinstance",
"(",
"obj",
",",
"ParseResults",
")",
... | [
719,
4
] | [
752,
55
] | python | en | ['en', 'ja', 'th'] | False |
ParseResults.copy | ( self ) |
Returns a new copy of a C{ParseResults} object.
|
Returns a new copy of a C{ParseResults} object.
| def copy( self ):
"""
Returns a new copy of a C{ParseResults} object.
"""
ret = ParseResults( self.__toklist )
ret.__tokdict = self.__tokdict.copy()
ret.__parent = self.__parent
ret.__accumNames.update( self.__accumNames )
ret.__name = self.__name
... | [
"def",
"copy",
"(",
"self",
")",
":",
"ret",
"=",
"ParseResults",
"(",
"self",
".",
"__toklist",
")",
"ret",
".",
"__tokdict",
"=",
"self",
".",
"__tokdict",
".",
"copy",
"(",
")",
"ret",
".",
"__parent",
"=",
"self",
".",
"__parent",
"ret",
".",
"... | [
754,
4
] | [
763,
18
] | python | en | ['en', 'ja', 'th'] | False |
ParseResults.asXML | ( self, doctag=None, namedItemsOnly=False, indent="", formatted=True ) |
(Deprecated) Returns the parse results as XML. Tags are created for tokens and lists that have defined results names.
|
(Deprecated) Returns the parse results as XML. Tags are created for tokens and lists that have defined results names.
| def asXML( self, doctag=None, namedItemsOnly=False, indent="", formatted=True ):
"""
(Deprecated) Returns the parse results as XML. Tags are created for tokens and lists that have defined results names.
"""
nl = "\n"
out = []
namedItems = dict((v[1],k) for (k,vlist)... | [
"def",
"asXML",
"(",
"self",
",",
"doctag",
"=",
"None",
",",
"namedItemsOnly",
"=",
"False",
",",
"indent",
"=",
"\"\"",
",",
"formatted",
"=",
"True",
")",
":",
"nl",
"=",
"\"\\n\"",
"out",
"=",
"[",
"]",
"namedItems",
"=",
"dict",
"(",
"(",
"v",... | [
765,
4
] | [
824,
27
] | python | en | ['en', 'ja', 'th'] | False |
ParseResults.getName | (self) | r"""
Returns the results name for this token expression. Useful when several
different expressions might match at a particular location.
Example::
integer = Word(nums)
ssn_expr = Regex(r"\d\d\d-\d\d-\d\d\d\d")
house_number_expr = Suppress('#') + Word(... | r"""
Returns the results name for this token expression. Useful when several
different expressions might match at a particular location.
Example::
integer = Word(nums)
ssn_expr = Regex(r"\d\d\d-\d\d-\d\d\d\d")
house_number_expr = Suppress('#') + Word(... | def getName(self):
r"""
Returns the results name for this token expression. Useful when several
different expressions might match at a particular location.
Example::
integer = Word(nums)
ssn_expr = Regex(r"\d\d\d-\d\d-\d\d\d\d")
house_number_... | [
"def",
"getName",
"(",
"self",
")",
":",
"if",
"self",
".",
"__name",
":",
"return",
"self",
".",
"__name",
"elif",
"self",
".",
"__parent",
":",
"par",
"=",
"self",
".",
"__parent",
"(",
")",
"if",
"par",
":",
"return",
"par",
".",
"__lookup",
"("... | [
833,
4
] | [
868,
23
] | python | cy | ['en', 'cy', 'hi'] | False |
ParseResults.dump | (self, indent='', depth=0, full=True) |
Diagnostic method for listing out the contents of a C{ParseResults}.
Accepts an optional C{indent} argument so that this string can be embedded
in a nested display of other data.
Example::
integer = Word(nums)
date_str = integer("year") + '/' + integer("m... |
Diagnostic method for listing out the contents of a C{ParseResults}.
Accepts an optional C{indent} argument so that this string can be embedded
in a nested display of other data.
Example::
integer = Word(nums)
date_str = integer("year") + '/' + integer("m... | def dump(self, indent='', depth=0, full=True):
"""
Diagnostic method for listing out the contents of a C{ParseResults}.
Accepts an optional C{indent} argument so that this string can be embedded
in a nested display of other data.
Example::
integer = Word(nums)... | [
"def",
"dump",
"(",
"self",
",",
"indent",
"=",
"''",
",",
"depth",
"=",
"0",
",",
"full",
"=",
"True",
")",
":",
"out",
"=",
"[",
"]",
"NL",
"=",
"'\\n'",
"out",
".",
"append",
"(",
"indent",
"+",
"_ustr",
"(",
"self",
".",
"asList",
"(",
")... | [
870,
4
] | [
913,
27
] | python | en | ['en', 'ja', 'th'] | False |
ParseResults.pprint | (self, *args, **kwargs) |
Pretty-printer for parsed results as a list, using the C{pprint} module.
Accepts additional positional or keyword args as defined for the
C{pprint.pprint} method. (U{http://docs.python.org/3/library/pprint.html#pprint.pprint})
Example::
ident = Word(alphas, alphanums... |
Pretty-printer for parsed results as a list, using the C{pprint} module.
Accepts additional positional or keyword args as defined for the
C{pprint.pprint} method. (U{http://docs.python.org/3/library/pprint.html#pprint.pprint})
Example::
ident = Word(alphas, alphanums... | def pprint(self, *args, **kwargs):
"""
Pretty-printer for parsed results as a list, using the C{pprint} module.
Accepts additional positional or keyword args as defined for the
C{pprint.pprint} method. (U{http://docs.python.org/3/library/pprint.html#pprint.pprint})
Exampl... | [
"def",
"pprint",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"pprint",
".",
"pprint",
"(",
"self",
".",
"asList",
"(",
")",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | [
915,
4
] | [
936,
53
] | python | en | ['en', 'ja', 'th'] | False |
ParserElement.setDefaultWhitespaceChars | ( chars ) | r"""
Overrides the default whitespace chars
Example::
# default whitespace chars are space, <TAB> and newline
OneOrMore(Word(alphas)).parseString("abc def\nghi jkl") # -> ['abc', 'def', 'ghi', 'jkl']
# change to just treat newline as significant
... | r"""
Overrides the default whitespace chars
Example::
# default whitespace chars are space, <TAB> and newline
OneOrMore(Word(alphas)).parseString("abc def\nghi jkl") # -> ['abc', 'def', 'ghi', 'jkl']
# change to just treat newline as significant
... | def setDefaultWhitespaceChars( chars ):
r"""
Overrides the default whitespace chars
Example::
# default whitespace chars are space, <TAB> and newline
OneOrMore(Word(alphas)).parseString("abc def\nghi jkl") # -> ['abc', 'def', 'ghi', 'jkl']
... | [
"def",
"setDefaultWhitespaceChars",
"(",
"chars",
")",
":",
"ParserElement",
".",
"DEFAULT_WHITE_CHARS",
"=",
"chars"
] | [
1108,
4
] | [
1120,
49
] | python | cy | ['en', 'cy', 'hi'] | False |
ParserElement.inlineLiteralsUsing | (cls) |
Set class to be used for inclusion of string literals into a parser.
Example::
# default literal class used is Literal
integer = Word(nums)
date_str = integer("year") + '/' + integer("month") + '/' + integer("day")
date_str.pa... |
Set class to be used for inclusion of string literals into a parser.
Example::
# default literal class used is Literal
integer = Word(nums)
date_str = integer("year") + '/' + integer("month") + '/' + integer("day")
date_str.pa... | def inlineLiteralsUsing(cls):
"""
Set class to be used for inclusion of string literals into a parser.
Example::
# default literal class used is Literal
integer = Word(nums)
date_str = integer("year") + '/' + integer("month") + '/' + integer("d... | [
"def",
"inlineLiteralsUsing",
"(",
"cls",
")",
":",
"ParserElement",
".",
"_literalStringClass",
"=",
"cls"
] | [
1123,
4
] | [
1141,
47
] | python | en | ['en', 'ja', 'th'] | False |
ParserElement.copy | ( self ) |
Make a copy of this C{ParserElement}. Useful for defining different parse actions
for the same parsing pattern, using copies of the original parse element.
Example::
integer = Word(nums).setParseAction(lambda toks: int(toks[0]))
integerK = integer.copy().... |
Make a copy of this C{ParserElement}. Useful for defining different parse actions
for the same parsing pattern, using copies of the original parse element.
Example::
integer = Word(nums).setParseAction(lambda toks: int(toks[0]))
integerK = integer.copy().... | def copy( self ):
"""
Make a copy of this C{ParserElement}. Useful for defining different parse actions
for the same parsing pattern, using copies of the original parse element.
Example::
integer = Word(nums).setParseAction(lambda toks: int(toks[0]))
... | [
"def",
"copy",
"(",
"self",
")",
":",
"cpy",
"=",
"copy",
".",
"copy",
"(",
"self",
")",
"cpy",
".",
"parseAction",
"=",
"self",
".",
"parseAction",
"[",
":",
"]",
"cpy",
".",
"ignoreExprs",
"=",
"self",
".",
"ignoreExprs",
"[",
":",
"]",
"if",
"... | [
1166,
4
] | [
1187,
18
] | python | en | ['en', 'ja', 'th'] | False |
ParserElement.setName | ( self, name ) |
Define name for this expression, makes debugging and exception messages clearer.
Example::
Word(nums).parseString("ABC") # -> Exception: Expected W:(0123...) (at char 0), (line:1, col:1)
Word(nums).setName("integer").parseString("ABC") # -> Exception: Expected in... |
Define name for this expression, makes debugging and exception messages clearer.
Example::
Word(nums).parseString("ABC") # -> Exception: Expected W:(0123...) (at char 0), (line:1, col:1)
Word(nums).setName("integer").parseString("ABC") # -> Exception: Expected in... | def setName( self, name ):
"""
Define name for this expression, makes debugging and exception messages clearer.
Example::
Word(nums).parseString("ABC") # -> Exception: Expected W:(0123...) (at char 0), (line:1, col:1)
Word(nums).setName("integer").parseStr... | [
"def",
"setName",
"(",
"self",
",",
"name",
")",
":",
"self",
".",
"name",
"=",
"name",
"self",
".",
"errmsg",
"=",
"\"Expected \"",
"+",
"self",
".",
"name",
"if",
"hasattr",
"(",
"self",
",",
"\"exception\"",
")",
":",
"self",
".",
"exception",
"."... | [
1189,
4
] | [
1201,
19
] | python | en | ['en', 'ja', 'th'] | False |
ParserElement.setResultsName | ( self, name, listAllMatches=False ) |
Define name for referencing matching tokens as a nested attribute
of the returned parse results.
NOTE: this returns a *copy* of the original C{ParserElement} object;
this is so that the client can define a basic element, such as an
integer, and reference it in multiple plac... |
Define name for referencing matching tokens as a nested attribute
of the returned parse results.
NOTE: this returns a *copy* of the original C{ParserElement} object;
this is so that the client can define a basic element, such as an
integer, and reference it in multiple plac... | def setResultsName( self, name, listAllMatches=False ):
"""
Define name for referencing matching tokens as a nested attribute
of the returned parse results.
NOTE: this returns a *copy* of the original C{ParserElement} object;
this is so that the client can define a basic ele... | [
"def",
"setResultsName",
"(",
"self",
",",
"name",
",",
"listAllMatches",
"=",
"False",
")",
":",
"newself",
"=",
"self",
".",
"copy",
"(",
")",
"if",
"name",
".",
"endswith",
"(",
"\"*\"",
")",
":",
"name",
"=",
"name",
"[",
":",
"-",
"1",
"]",
... | [
1203,
4
] | [
1229,
22
] | python | en | ['en', 'ja', 'th'] | False |
ParserElement.setBreak | (self,breakFlag = True) | Method to invoke the Python pdb debugger when this element is
about to be parsed. Set C{breakFlag} to True to enable, False to
disable.
| Method to invoke the Python pdb debugger when this element is
about to be parsed. Set C{breakFlag} to True to enable, False to
disable.
| def setBreak(self,breakFlag = True):
"""Method to invoke the Python pdb debugger when this element is
about to be parsed. Set C{breakFlag} to True to enable, False to
disable.
"""
if breakFlag:
_parseMethod = self._parse
def breaker(instring, ... | [
"def",
"setBreak",
"(",
"self",
",",
"breakFlag",
"=",
"True",
")",
":",
"if",
"breakFlag",
":",
"_parseMethod",
"=",
"self",
".",
"_parse",
"def",
"breaker",
"(",
"instring",
",",
"loc",
",",
"doActions",
"=",
"True",
",",
"callPreParse",
"=",
"True",
... | [
1231,
4
] | [
1247,
19
] | python | en | ['en', 'en', 'en'] | True |
ParserElement.setParseAction | ( self, *fns, **kwargs ) |
Define one or more actions to perform when successfully matching parse element definition.
Parse action fn is a callable method with 0-3 arguments, called as C{fn(s,loc,toks)},
C{fn(loc,toks)}, C{fn(toks)}, or just C{fn()}, where:
- s = the original string being parsed (see note ... |
Define one or more actions to perform when successfully matching parse element definition.
Parse action fn is a callable method with 0-3 arguments, called as C{fn(s,loc,toks)},
C{fn(loc,toks)}, C{fn(toks)}, or just C{fn()}, where:
- s = the original string being parsed (see note ... | def setParseAction( self, *fns, **kwargs ):
"""
Define one or more actions to perform when successfully matching parse element definition.
Parse action fn is a callable method with 0-3 arguments, called as C{fn(s,loc,toks)},
C{fn(loc,toks)}, C{fn(toks)}, or just C{fn()}, where:
... | [
"def",
"setParseAction",
"(",
"self",
",",
"*",
"fns",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"parseAction",
"=",
"list",
"(",
"map",
"(",
"_trim_arity",
",",
"list",
"(",
"fns",
")",
")",
")",
"self",
".",
"callDuringTry",
"=",
"kwargs",
... | [
1249,
4
] | [
1285,
19
] | python | en | ['en', 'ja', 'th'] | False |
ParserElement.addParseAction | ( self, *fns, **kwargs ) |
Add one or more parse actions to expression's list of parse actions. See L{I{setParseAction}<setParseAction>}.
See examples in L{I{copy}<copy>}.
|
Add one or more parse actions to expression's list of parse actions. See L{I{setParseAction}<setParseAction>}.
See examples in L{I{copy}<copy>}.
| def addParseAction( self, *fns, **kwargs ):
"""
Add one or more parse actions to expression's list of parse actions. See L{I{setParseAction}<setParseAction>}.
See examples in L{I{copy}<copy>}.
"""
self.parseAction += list(map(_trim_arity, list(fns)))
self.... | [
"def",
"addParseAction",
"(",
"self",
",",
"*",
"fns",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"parseAction",
"+=",
"list",
"(",
"map",
"(",
"_trim_arity",
",",
"list",
"(",
"fns",
")",
")",
")",
"self",
".",
"callDuringTry",
"=",
"self",
"... | [
1287,
4
] | [
1295,
19
] | python | en | ['en', 'ja', 'th'] | False |
ParserElement.addCondition | (self, *fns, **kwargs) | Add a boolean predicate function to expression's list of parse actions. See
L{I{setParseAction}<setParseAction>} for function call signatures. Unlike C{setParseAction},
functions passed to C{addCondition} need to return boolean success/fail of the condition.
Optional keyword arguments:
... | Add a boolean predicate function to expression's list of parse actions. See
L{I{setParseAction}<setParseAction>} for function call signatures. Unlike C{setParseAction},
functions passed to C{addCondition} need to return boolean success/fail of the condition.
Optional keyword arguments:
... | def addCondition(self, *fns, **kwargs):
"""Add a boolean predicate function to expression's list of parse actions. See
L{I{setParseAction}<setParseAction>} for function call signatures. Unlike C{setParseAction},
functions passed to C{addCondition} need to return boolean success/fail of the ... | [
"def",
"addCondition",
"(",
"self",
",",
"*",
"fns",
",",
"*",
"*",
"kwargs",
")",
":",
"msg",
"=",
"kwargs",
".",
"get",
"(",
"\"message\"",
",",
"\"failed user-defined condition\"",
")",
"exc_type",
"=",
"ParseFatalException",
"if",
"kwargs",
".",
"get",
... | [
1297,
4
] | [
1322,
19
] | python | en | ['en', 'en', 'en'] | True |
ParserElement.setFailAction | ( self, fn ) | Define action to perform if parsing fails at this expression.
Fail acton fn is a callable function that takes the arguments
C{fn(s,loc,expr,err)} where:
- s = string being parsed
- loc = location where expression match was attempted and failed
- expr = the ... | Define action to perform if parsing fails at this expression.
Fail acton fn is a callable function that takes the arguments
C{fn(s,loc,expr,err)} where:
- s = string being parsed
- loc = location where expression match was attempted and failed
- expr = the ... | def setFailAction( self, fn ):
"""Define action to perform if parsing fails at this expression.
Fail acton fn is a callable function that takes the arguments
C{fn(s,loc,expr,err)} where:
- s = string being parsed
- loc = location where expression match was atte... | [
"def",
"setFailAction",
"(",
"self",
",",
"fn",
")",
":",
"self",
".",
"failAction",
"=",
"fn",
"return",
"self"
] | [
1324,
4
] | [
1335,
19
] | python | en | ['en', 'en', 'en'] | True |
ParserElement.enablePackrat | (cache_size_limit=128) | Enables "packrat" parsing, which adds memoizing to the parsing logic.
Repeated parse attempts at the same string location (which happens
often in many complex grammars) can immediately return a cached value,
instead of re-executing parsing/validating code. Memoizing is done of
... | Enables "packrat" parsing, which adds memoizing to the parsing logic.
Repeated parse attempts at the same string location (which happens
often in many complex grammars) can immediately return a cached value,
instead of re-executing parsing/validating code. Memoizing is done of
... | def enablePackrat(cache_size_limit=128):
"""Enables "packrat" parsing, which adds memoizing to the parsing logic.
Repeated parse attempts at the same string location (which happens
often in many complex grammars) can immediately return a cached value,
instead of re-executing... | [
"def",
"enablePackrat",
"(",
"cache_size_limit",
"=",
"128",
")",
":",
"if",
"not",
"ParserElement",
".",
"_packratEnabled",
":",
"ParserElement",
".",
"_packratEnabled",
"=",
"True",
"if",
"cache_size_limit",
"is",
"None",
":",
"ParserElement",
".",
"packrat_cach... | [
1573,
4
] | [
1605,
60
] | python | en | ['en', 'en', 'en'] | True |
ParserElement.parseString | ( self, instring, parseAll=False ) |
Execute the parse expression with the given string.
This is the main interface to the client code, once the complete
expression has been built.
If you want the grammar to require that the entire input string be
successfully parsed, then set C{parseAll} to True (equivalent... |
Execute the parse expression with the given string.
This is the main interface to the client code, once the complete
expression has been built.
If you want the grammar to require that the entire input string be
successfully parsed, then set C{parseAll} to True (equivalent... | def parseString( self, instring, parseAll=False ):
"""
Execute the parse expression with the given string.
This is the main interface to the client code, once the complete
expression has been built.
If you want the grammar to require that the entire input string be
... | [
"def",
"parseString",
"(",
"self",
",",
"instring",
",",
"parseAll",
"=",
"False",
")",
":",
"ParserElement",
".",
"resetCache",
"(",
")",
"if",
"not",
"self",
".",
"streamlined",
":",
"self",
".",
"streamline",
"(",
")",
"#~ self.saveAsList = True\r",
"for"... | [
1607,
4
] | [
1655,
25
] | python | en | ['en', 'ja', 'th'] | False |
ParserElement.scanString | ( self, instring, maxMatches=_MAX_INT, overlap=False ) |
Scan the input string for expression matches. Each match will return the
matching tokens, start location, and end location. May be called with optional
C{maxMatches} argument, to clip scanning after 'n' matches are found. If
C{overlap} is specified, then overlapping matches will ... |
Scan the input string for expression matches. Each match will return the
matching tokens, start location, and end location. May be called with optional
C{maxMatches} argument, to clip scanning after 'n' matches are found. If
C{overlap} is specified, then overlapping matches will ... | def scanString( self, instring, maxMatches=_MAX_INT, overlap=False ):
"""
Scan the input string for expression matches. Each match will return the
matching tokens, start location, and end location. May be called with optional
C{maxMatches} argument, to clip scanning after 'n' match... | [
"def",
"scanString",
"(",
"self",
",",
"instring",
",",
"maxMatches",
"=",
"_MAX_INT",
",",
"overlap",
"=",
"False",
")",
":",
"if",
"not",
"self",
".",
"streamlined",
":",
"self",
".",
"streamline",
"(",
")",
"for",
"e",
"in",
"self",
".",
"ignoreExpr... | [
1657,
4
] | [
1726,
25
] | python | en | ['en', 'ja', 'th'] | False |
ParserElement.transformString | ( self, instring ) |
Extension to C{L{scanString}}, to modify matching text with modified tokens that may
be returned from a parse action. To use C{transformString}, define a grammar and
attach a parse action to it that modifies the returned token list.
Invoking C{transformString()} on a target string ... |
Extension to C{L{scanString}}, to modify matching text with modified tokens that may
be returned from a parse action. To use C{transformString}, define a grammar and
attach a parse action to it that modifies the returned token list.
Invoking C{transformString()} on a target string ... | def transformString( self, instring ):
"""
Extension to C{L{scanString}}, to modify matching text with modified tokens that may
be returned from a parse action. To use C{transformString}, define a grammar and
attach a parse action to it that modifies the returned token list.
... | [
"def",
"transformString",
"(",
"self",
",",
"instring",
")",
":",
"out",
"=",
"[",
"]",
"lastE",
"=",
"0",
"# force preservation of <TAB>s, to minimize unwanted transformation of string, and to\r",
"# keep string locs straight between transformString and scanString\r",
"self",
".... | [
1728,
4
] | [
1769,
25
] | python | en | ['en', 'ja', 'th'] | False |
ParserElement.searchString | ( self, instring, maxMatches=_MAX_INT ) |
Another extension to C{L{scanString}}, simplifying the access to the tokens found
to match the given parse expression. May be called with optional
C{maxMatches} argument, to clip searching after 'n' matches are found.
Example::
# a capitalized word starts wit... |
Another extension to C{L{scanString}}, simplifying the access to the tokens found
to match the given parse expression. May be called with optional
C{maxMatches} argument, to clip searching after 'n' matches are found.
Example::
# a capitalized word starts wit... | def searchString( self, instring, maxMatches=_MAX_INT ):
"""
Another extension to C{L{scanString}}, simplifying the access to the tokens found
to match the given parse expression. May be called with optional
C{maxMatches} argument, to clip searching after 'n' matches are found.
... | [
"def",
"searchString",
"(",
"self",
",",
"instring",
",",
"maxMatches",
"=",
"_MAX_INT",
")",
":",
"try",
":",
"return",
"ParseResults",
"(",
"[",
"t",
"for",
"t",
",",
"s",
",",
"e",
"in",
"self",
".",
"scanString",
"(",
"instring",
",",
"maxMatches",... | [
1771,
4
] | [
1796,
25
] | python | en | ['en', 'ja', 'th'] | False |
ParserElement.split | (self, instring, maxsplit=_MAX_INT, includeSeparators=False) |
Generator method to split a string using the given expression as a separator.
May be called with optional C{maxsplit} argument, to limit the number of splits;
and the optional C{includeSeparators} argument (default=C{False}), if the separating
matching text should be included in the... |
Generator method to split a string using the given expression as a separator.
May be called with optional C{maxsplit} argument, to limit the number of splits;
and the optional C{includeSeparators} argument (default=C{False}), if the separating
matching text should be included in the... | def split(self, instring, maxsplit=_MAX_INT, includeSeparators=False):
"""
Generator method to split a string using the given expression as a separator.
May be called with optional C{maxsplit} argument, to limit the number of splits;
and the optional C{includeSeparators} argument (de... | [
"def",
"split",
"(",
"self",
",",
"instring",
",",
"maxsplit",
"=",
"_MAX_INT",
",",
"includeSeparators",
"=",
"False",
")",
":",
"splits",
"=",
"0",
"last",
"=",
"0",
"for",
"t",
",",
"s",
",",
"e",
"in",
"self",
".",
"scanString",
"(",
"instring",
... | [
1798,
4
] | [
1818,
29
] | python | en | ['en', 'ja', 'th'] | False |
ParserElement.__add__ | (self, other ) |
Implementation of + operator - returns C{L{And}}. Adding strings to a ParserElement
converts them to L{Literal}s by default.
Example::
greet = Word(alphas) + "," + Word(alphas) + "!"
hello = "Hello, World!"
print (hello, "->", greet.parseStrin... |
Implementation of + operator - returns C{L{And}}. Adding strings to a ParserElement
converts them to L{Literal}s by default.
Example::
greet = Word(alphas) + "," + Word(alphas) + "!"
hello = "Hello, World!"
print (hello, "->", greet.parseStrin... | def __add__(self, other ):
"""
Implementation of + operator - returns C{L{And}}. Adding strings to a ParserElement
converts them to L{Literal}s by default.
Example::
greet = Word(alphas) + "," + Word(alphas) + "!"
hello = "Hello, World!"
... | [
"def",
"__add__",
"(",
"self",
",",
"other",
")",
":",
"if",
"isinstance",
"(",
"other",
",",
"basestring",
")",
":",
"other",
"=",
"ParserElement",
".",
"_literalStringClass",
"(",
"other",
")",
"if",
"not",
"isinstance",
"(",
"other",
",",
"ParserElement... | [
1820,
4
] | [
1838,
37
] | python | en | ['en', 'ja', 'th'] | False |
ParserElement.__radd__ | (self, other ) |
Implementation of + operator when left operand is not a C{L{ParserElement}}
|
Implementation of + operator when left operand is not a C{L{ParserElement}}
| def __radd__(self, other ):
"""
Implementation of + operator when left operand is not a C{L{ParserElement}}
"""
if isinstance( other, basestring ):
other = ParserElement._literalStringClass( other )
if not isinstance( other, ParserElement ):
warning... | [
"def",
"__radd__",
"(",
"self",
",",
"other",
")",
":",
"if",
"isinstance",
"(",
"other",
",",
"basestring",
")",
":",
"other",
"=",
"ParserElement",
".",
"_literalStringClass",
"(",
"other",
")",
"if",
"not",
"isinstance",
"(",
"other",
",",
"ParserElemen... | [
1840,
4
] | [
1850,
27
] | python | en | ['en', 'ja', 'th'] | False |
ParserElement.__sub__ | (self, other) |
Implementation of - operator, returns C{L{And}} with error stop
|
Implementation of - operator, returns C{L{And}} with error stop
| def __sub__(self, other):
"""
Implementation of - operator, returns C{L{And}} with error stop
"""
if isinstance( other, basestring ):
other = ParserElement._literalStringClass( other )
if not isinstance( other, ParserElement ):
warnings.warn("Cannot... | [
"def",
"__sub__",
"(",
"self",
",",
"other",
")",
":",
"if",
"isinstance",
"(",
"other",
",",
"basestring",
")",
":",
"other",
"=",
"ParserElement",
".",
"_literalStringClass",
"(",
"other",
")",
"if",
"not",
"isinstance",
"(",
"other",
",",
"ParserElement... | [
1852,
4
] | [
1862,
46
] | python | en | ['en', 'ja', 'th'] | False |
ParserElement.__rsub__ | (self, other ) |
Implementation of - operator when left operand is not a C{L{ParserElement}}
|
Implementation of - operator when left operand is not a C{L{ParserElement}}
| def __rsub__(self, other ):
"""
Implementation of - operator when left operand is not a C{L{ParserElement}}
"""
if isinstance( other, basestring ):
other = ParserElement._literalStringClass( other )
if not isinstance( other, ParserElement ):
warning... | [
"def",
"__rsub__",
"(",
"self",
",",
"other",
")",
":",
"if",
"isinstance",
"(",
"other",
",",
"basestring",
")",
":",
"other",
"=",
"ParserElement",
".",
"_literalStringClass",
"(",
"other",
")",
"if",
"not",
"isinstance",
"(",
"other",
",",
"ParserElemen... | [
1864,
4
] | [
1874,
27
] | python | en | ['en', 'ja', 'th'] | False |
ParserElement.__mul__ | (self,other) |
Implementation of * operator, allows use of C{expr * 3} in place of
C{expr + expr + expr}. Expressions may also me multiplied by a 2-integer
tuple, similar to C{{min,max}} multipliers in regular expressions. Tuples
may also include C{None} as in:
- C{expr*(n,None)} or C{... |
Implementation of * operator, allows use of C{expr * 3} in place of
C{expr + expr + expr}. Expressions may also me multiplied by a 2-integer
tuple, similar to C{{min,max}} multipliers in regular expressions. Tuples
may also include C{None} as in:
- C{expr*(n,None)} or C{... | def __mul__(self,other):
"""
Implementation of * operator, allows use of C{expr * 3} in place of
C{expr + expr + expr}. Expressions may also me multiplied by a 2-integer
tuple, similar to C{{min,max}} multipliers in regular expressions. Tuples
may also include C{None} as i... | [
"def",
"__mul__",
"(",
"self",
",",
"other",
")",
":",
"if",
"isinstance",
"(",
"other",
",",
"int",
")",
":",
"minElements",
",",
"optElements",
"=",
"other",
",",
"0",
"elif",
"isinstance",
"(",
"other",
",",
"tuple",
")",
":",
"other",
"=",
"(",
... | [
1876,
4
] | [
1942,
18
] | python | en | ['en', 'ja', 'th'] | False |
ParserElement.__or__ | (self, other ) |
Implementation of | operator - returns C{L{MatchFirst}}
|
Implementation of | operator - returns C{L{MatchFirst}}
| def __or__(self, other ):
"""
Implementation of | operator - returns C{L{MatchFirst}}
"""
if isinstance( other, basestring ):
other = ParserElement._literalStringClass( other )
if not isinstance( other, ParserElement ):
warnings.warn("Cannot combine... | [
"def",
"__or__",
"(",
"self",
",",
"other",
")",
":",
"if",
"isinstance",
"(",
"other",
",",
"basestring",
")",
":",
"other",
"=",
"ParserElement",
".",
"_literalStringClass",
"(",
"other",
")",
"if",
"not",
"isinstance",
"(",
"other",
",",
"ParserElement"... | [
1947,
4
] | [
1957,
44
] | python | en | ['en', 'ja', 'th'] | False |
ParserElement.__ror__ | (self, other ) |
Implementation of | operator when left operand is not a C{L{ParserElement}}
|
Implementation of | operator when left operand is not a C{L{ParserElement}}
| def __ror__(self, other ):
"""
Implementation of | operator when left operand is not a C{L{ParserElement}}
"""
if isinstance( other, basestring ):
other = ParserElement._literalStringClass( other )
if not isinstance( other, ParserElement ):
warnings... | [
"def",
"__ror__",
"(",
"self",
",",
"other",
")",
":",
"if",
"isinstance",
"(",
"other",
",",
"basestring",
")",
":",
"other",
"=",
"ParserElement",
".",
"_literalStringClass",
"(",
"other",
")",
"if",
"not",
"isinstance",
"(",
"other",
",",
"ParserElement... | [
1959,
4
] | [
1969,
27
] | python | en | ['en', 'ja', 'th'] | False |
ParserElement.__xor__ | (self, other ) |
Implementation of ^ operator - returns C{L{Or}}
|
Implementation of ^ operator - returns C{L{Or}}
| def __xor__(self, other ):
"""
Implementation of ^ operator - returns C{L{Or}}
"""
if isinstance( other, basestring ):
other = ParserElement._literalStringClass( other )
if not isinstance( other, ParserElement ):
warnings.warn("Cannot combine elemen... | [
"def",
"__xor__",
"(",
"self",
",",
"other",
")",
":",
"if",
"isinstance",
"(",
"other",
",",
"basestring",
")",
":",
"other",
"=",
"ParserElement",
".",
"_literalStringClass",
"(",
"other",
")",
"if",
"not",
"isinstance",
"(",
"other",
",",
"ParserElement... | [
1971,
4
] | [
1981,
36
] | python | en | ['en', 'ja', 'th'] | False |
ParserElement.__rxor__ | (self, other ) |
Implementation of ^ operator when left operand is not a C{L{ParserElement}}
|
Implementation of ^ operator when left operand is not a C{L{ParserElement}}
| def __rxor__(self, other ):
"""
Implementation of ^ operator when left operand is not a C{L{ParserElement}}
"""
if isinstance( other, basestring ):
other = ParserElement._literalStringClass( other )
if not isinstance( other, ParserElement ):
warning... | [
"def",
"__rxor__",
"(",
"self",
",",
"other",
")",
":",
"if",
"isinstance",
"(",
"other",
",",
"basestring",
")",
":",
"other",
"=",
"ParserElement",
".",
"_literalStringClass",
"(",
"other",
")",
"if",
"not",
"isinstance",
"(",
"other",
",",
"ParserElemen... | [
1983,
4
] | [
1993,
27
] | python | en | ['en', 'ja', 'th'] | False |
ParserElement.__and__ | (self, other ) |
Implementation of & operator - returns C{L{Each}}
|
Implementation of & operator - returns C{L{Each}}
| def __and__(self, other ):
"""
Implementation of & operator - returns C{L{Each}}
"""
if isinstance( other, basestring ):
other = ParserElement._literalStringClass( other )
if not isinstance( other, ParserElement ):
warnings.warn("Cannot combine elem... | [
"def",
"__and__",
"(",
"self",
",",
"other",
")",
":",
"if",
"isinstance",
"(",
"other",
",",
"basestring",
")",
":",
"other",
"=",
"ParserElement",
".",
"_literalStringClass",
"(",
"other",
")",
"if",
"not",
"isinstance",
"(",
"other",
",",
"ParserElement... | [
1995,
4
] | [
2005,
38
] | python | en | ['en', 'ja', 'th'] | False |
ParserElement.__rand__ | (self, other ) |
Implementation of & operator when left operand is not a C{L{ParserElement}}
|
Implementation of & operator when left operand is not a C{L{ParserElement}}
| def __rand__(self, other ):
"""
Implementation of & operator when left operand is not a C{L{ParserElement}}
"""
if isinstance( other, basestring ):
other = ParserElement._literalStringClass( other )
if not isinstance( other, ParserElement ):
warning... | [
"def",
"__rand__",
"(",
"self",
",",
"other",
")",
":",
"if",
"isinstance",
"(",
"other",
",",
"basestring",
")",
":",
"other",
"=",
"ParserElement",
".",
"_literalStringClass",
"(",
"other",
")",
"if",
"not",
"isinstance",
"(",
"other",
",",
"ParserElemen... | [
2007,
4
] | [
2017,
27
] | python | en | ['en', 'ja', 'th'] | False |
ParserElement.__invert__ | ( self ) |
Implementation of ~ operator - returns C{L{NotAny}}
|
Implementation of ~ operator - returns C{L{NotAny}}
| def __invert__( self ):
"""
Implementation of ~ operator - returns C{L{NotAny}}
"""
return NotAny( self ) | [
"def",
"__invert__",
"(",
"self",
")",
":",
"return",
"NotAny",
"(",
"self",
")"
] | [
2019,
4
] | [
2023,
29
] | python | en | ['en', 'ja', 'th'] | False |
ParserElement.__call__ | (self, name=None) |
Shortcut for C{L{setResultsName}}, with C{listAllMatches=False}.
If C{name} is given with a trailing C{'*'} character, then C{listAllMatches} will be
passed as C{True}.
If C{name} is omitted, same as calling C{L{copy}}.
Example::
# thes... |
Shortcut for C{L{setResultsName}}, with C{listAllMatches=False}.
If C{name} is given with a trailing C{'*'} character, then C{listAllMatches} will be
passed as C{True}.
If C{name} is omitted, same as calling C{L{copy}}.
Example::
# thes... | def __call__(self, name=None):
"""
Shortcut for C{L{setResultsName}}, with C{listAllMatches=False}.
If C{name} is given with a trailing C{'*'} character, then C{listAllMatches} will be
passed as C{True}.
If C{name} is omitted, same as calling C{L{copy}... | [
"def",
"__call__",
"(",
"self",
",",
"name",
"=",
"None",
")",
":",
"if",
"name",
"is",
"not",
"None",
":",
"return",
"self",
".",
"setResultsName",
"(",
"name",
")",
"else",
":",
"return",
"self",
".",
"copy",
"(",
")"
] | [
2025,
4
] | [
2042,
30
] | python | en | ['en', 'ja', 'th'] | False |
ParserElement.suppress | ( self ) |
Suppresses the output of this C{ParserElement}; useful to keep punctuation from
cluttering up returned output.
|
Suppresses the output of this C{ParserElement}; useful to keep punctuation from
cluttering up returned output.
| def suppress( self ):
"""
Suppresses the output of this C{ParserElement}; useful to keep punctuation from
cluttering up returned output.
"""
return Suppress( self ) | [
"def",
"suppress",
"(",
"self",
")",
":",
"return",
"Suppress",
"(",
"self",
")"
] | [
2044,
4
] | [
2049,
31
] | python | en | ['en', 'ja', 'th'] | False |
ParserElement.leaveWhitespace | ( self ) |
Disables the skipping of whitespace before matching the characters in the
C{ParserElement}'s defined pattern. This is normally only used internally by
the pyparsing module, but may be needed in some whitespace-sensitive grammars.
|
Disables the skipping of whitespace before matching the characters in the
C{ParserElement}'s defined pattern. This is normally only used internally by
the pyparsing module, but may be needed in some whitespace-sensitive grammars.
| def leaveWhitespace( self ):
"""
Disables the skipping of whitespace before matching the characters in the
C{ParserElement}'s defined pattern. This is normally only used internally by
the pyparsing module, but may be needed in some whitespace-sensitive grammars.
"""
... | [
"def",
"leaveWhitespace",
"(",
"self",
")",
":",
"self",
".",
"skipWhitespace",
"=",
"False",
"return",
"self"
] | [
2051,
4
] | [
2058,
19
] | python | en | ['en', 'ja', 'th'] | False |
ParserElement.setWhitespaceChars | ( self, chars ) |
Overrides the default whitespace chars
|
Overrides the default whitespace chars
| def setWhitespaceChars( self, chars ):
"""
Overrides the default whitespace chars
"""
self.skipWhitespace = True
self.whiteChars = chars
self.copyDefaultWhiteChars = False
return self | [
"def",
"setWhitespaceChars",
"(",
"self",
",",
"chars",
")",
":",
"self",
".",
"skipWhitespace",
"=",
"True",
"self",
".",
"whiteChars",
"=",
"chars",
"self",
".",
"copyDefaultWhiteChars",
"=",
"False",
"return",
"self"
] | [
2060,
4
] | [
2067,
19
] | python | en | ['en', 'ja', 'th'] | False |
ParserElement.parseWithTabs | ( self ) |
Overrides default behavior to expand C{<TAB>}s to spaces before parsing the input string.
Must be called before C{parseString} when the input grammar contains elements that
match C{<TAB>} characters.
|
Overrides default behavior to expand C{<TAB>}s to spaces before parsing the input string.
Must be called before C{parseString} when the input grammar contains elements that
match C{<TAB>} characters.
| def parseWithTabs( self ):
"""
Overrides default behavior to expand C{<TAB>}s to spaces before parsing the input string.
Must be called before C{parseString} when the input grammar contains elements that
match C{<TAB>} characters.
"""
self.keepTabs = True
r... | [
"def",
"parseWithTabs",
"(",
"self",
")",
":",
"self",
".",
"keepTabs",
"=",
"True",
"return",
"self"
] | [
2069,
4
] | [
2076,
19
] | python | en | ['en', 'ja', 'th'] | False |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.