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
SeventeenTrackSummarySensor.available
(self)
Return whether the entity is available.
Return whether the entity is available.
def available(self): """Return whether the entity is available.""" return self._state is not None
[ "def", "available", "(", "self", ")", ":", "return", "self", ".", "_state", "is", "not", "None" ]
[ 106, 4 ]
[ 108, 38 ]
python
en
['en', 'en', 'en']
True
SeventeenTrackSummarySensor.device_state_attributes
(self)
Return the device state attributes.
Return the device state attributes.
def device_state_attributes(self): """Return the device state attributes.""" return self._attrs
[ "def", "device_state_attributes", "(", "self", ")", ":", "return", "self", ".", "_attrs" ]
[ 111, 4 ]
[ 113, 26 ]
python
en
['en', 'en', 'en']
True
SeventeenTrackSummarySensor.icon
(self)
Return the icon.
Return the icon.
def icon(self): """Return the icon.""" return "mdi:package"
[ "def", "icon", "(", "self", ")", ":", "return", "\"mdi:package\"" ]
[ 116, 4 ]
[ 118, 28 ]
python
en
['en', 'sr', 'en']
True
SeventeenTrackSummarySensor.name
(self)
Return the name.
Return the name.
def name(self): """Return the name.""" return f"Seventeentrack Packages {self._status}"
[ "def", "name", "(", "self", ")", ":", "return", "f\"Seventeentrack Packages {self._status}\"" ]
[ 121, 4 ]
[ 123, 56 ]
python
en
['en', 'ig', 'en']
True
SeventeenTrackSummarySensor.state
(self)
Return the state.
Return the state.
def state(self): """Return the state.""" return self._state
[ "def", "state", "(", "self", ")", ":", "return", "self", ".", "_state" ]
[ 126, 4 ]
[ 128, 26 ]
python
en
['en', 'en', 'en']
True
SeventeenTrackSummarySensor.unique_id
(self)
Return a unique, Home Assistant friendly identifier for this entity.
Return a unique, Home Assistant friendly identifier for this entity.
def unique_id(self): """Return a unique, Home Assistant friendly identifier for this entity.""" return "summary_{}_{}".format(self._data.account_id, slugify(self._status))
[ "def", "unique_id", "(", "self", ")", ":", "return", "\"summary_{}_{}\"", ".", "format", "(", "self", ".", "_data", ".", "account_id", ",", "slugify", "(", "self", ".", "_status", ")", ")" ]
[ 131, 4 ]
[ 133, 83 ]
python
en
['en', 'en', 'en']
True
SeventeenTrackSummarySensor.unit_of_measurement
(self)
Return the unit the value is expressed in.
Return the unit the value is expressed in.
def unit_of_measurement(self): """Return the unit the value is expressed in.""" return "packages"
[ "def", "unit_of_measurement", "(", "self", ")", ":", "return", "\"packages\"" ]
[ 136, 4 ]
[ 138, 25 ]
python
en
['en', 'en', 'en']
True
SeventeenTrackSummarySensor.async_update
(self)
Update the sensor.
Update the sensor.
async def async_update(self): """Update the sensor.""" await self._data.async_update() package_data = [] for package in self._data.packages.values(): if package.status != self._status: continue package_data.append( { ...
[ "async", "def", "async_update", "(", "self", ")", ":", "await", "self", ".", "_data", ".", "async_update", "(", ")", "package_data", "=", "[", "]", "for", "package", "in", "self", ".", "_data", ".", "packages", ".", "values", "(", ")", ":", "if", "pa...
[ 140, 4 ]
[ 161, 58 ]
python
en
['en', 'nl', 'en']
True
SeventeenTrackPackageSensor.__init__
(self, data, package)
Initialize.
Initialize.
def __init__(self, data, package): """Initialize.""" self._attrs = { ATTR_ATTRIBUTION: DEFAULT_ATTRIBUTION, ATTR_DESTINATION_COUNTRY: package.destination_country, ATTR_INFO_TEXT: package.info_text, ATTR_LOCATION: package.location, ATTR_ORIGIN_C...
[ "def", "__init__", "(", "self", ",", "data", ",", "package", ")", ":", "self", ".", "_attrs", "=", "{", "ATTR_ATTRIBUTION", ":", "DEFAULT_ATTRIBUTION", ",", "ATTR_DESTINATION_COUNTRY", ":", "package", ".", "destination_country", ",", "ATTR_INFO_TEXT", ":", "pack...
[ 167, 4 ]
[ 183, 73 ]
python
en
['en', 'en', 'it']
False
SeventeenTrackPackageSensor.available
(self)
Return whether the entity is available.
Return whether the entity is available.
def available(self): """Return whether the entity is available.""" return self._data.packages.get(self._tracking_number) is not None
[ "def", "available", "(", "self", ")", ":", "return", "self", ".", "_data", ".", "packages", ".", "get", "(", "self", ".", "_tracking_number", ")", "is", "not", "None" ]
[ 186, 4 ]
[ 188, 73 ]
python
en
['en', 'en', 'en']
True
SeventeenTrackPackageSensor.device_state_attributes
(self)
Return the device state attributes.
Return the device state attributes.
def device_state_attributes(self): """Return the device state attributes.""" return self._attrs
[ "def", "device_state_attributes", "(", "self", ")", ":", "return", "self", ".", "_attrs" ]
[ 191, 4 ]
[ 193, 26 ]
python
en
['en', 'en', 'en']
True
SeventeenTrackPackageSensor.icon
(self)
Return the icon.
Return the icon.
def icon(self): """Return the icon.""" return "mdi:package"
[ "def", "icon", "(", "self", ")", ":", "return", "\"mdi:package\"" ]
[ 196, 4 ]
[ 198, 28 ]
python
en
['en', 'sr', 'en']
True
SeventeenTrackPackageSensor.name
(self)
Return the name.
Return the name.
def name(self): """Return the name.""" name = self._friendly_name if not name: name = self._tracking_number return f"Seventeentrack Package: {name}"
[ "def", "name", "(", "self", ")", ":", "name", "=", "self", ".", "_friendly_name", "if", "not", "name", ":", "name", "=", "self", ".", "_tracking_number", "return", "f\"Seventeentrack Package: {name}\"" ]
[ 201, 4 ]
[ 206, 48 ]
python
en
['en', 'ig', 'en']
True
SeventeenTrackPackageSensor.state
(self)
Return the state.
Return the state.
def state(self): """Return the state.""" return self._state
[ "def", "state", "(", "self", ")", ":", "return", "self", ".", "_state" ]
[ 209, 4 ]
[ 211, 26 ]
python
en
['en', 'en', 'en']
True
SeventeenTrackPackageSensor.unique_id
(self)
Return a unique, Home Assistant friendly identifier for this entity.
Return a unique, Home Assistant friendly identifier for this entity.
def unique_id(self): """Return a unique, Home Assistant friendly identifier for this entity.""" return UNIQUE_ID_TEMPLATE.format(self._data.account_id, self._tracking_number)
[ "def", "unique_id", "(", "self", ")", ":", "return", "UNIQUE_ID_TEMPLATE", ".", "format", "(", "self", ".", "_data", ".", "account_id", ",", "self", ".", "_tracking_number", ")" ]
[ 214, 4 ]
[ 216, 86 ]
python
en
['en', 'en', 'en']
True
SeventeenTrackPackageSensor.async_update
(self)
Update the sensor.
Update the sensor.
async def async_update(self): """Update the sensor.""" await self._data.async_update() if not self.available: # Entity cannot be removed while its being added async_call_later(self.hass, 1, self._remove) return package = self._data.packages.get(self....
[ "async", "def", "async_update", "(", "self", ")", ":", "await", "self", ".", "_data", ".", "async_update", "(", ")", "if", "not", "self", ".", "available", ":", "# Entity cannot be removed while its being added", "async_call_later", "(", "self", ".", "hass", ","...
[ 218, 4 ]
[ 241, 51 ]
python
en
['en', 'nl', 'en']
True
SeventeenTrackPackageSensor._remove
(self, *_)
Remove entity itself.
Remove entity itself.
async def _remove(self, *_): """Remove entity itself.""" await self.async_remove() reg = await self.hass.helpers.entity_registry.async_get_registry() entity_id = reg.async_get_entity_id( "sensor", "seventeentrack", UNIQUE_ID_TEMPLATE.format(self._data...
[ "async", "def", "_remove", "(", "self", ",", "*", "_", ")", ":", "await", "self", ".", "async_remove", "(", ")", "reg", "=", "await", "self", ".", "hass", ".", "helpers", ".", "entity_registry", ".", "async_get_registry", "(", ")", "entity_id", "=", "r...
[ 243, 4 ]
[ 254, 39 ]
python
en
['en', 'sr', 'en']
True
SeventeenTrackPackageSensor._notify_delivered
(self)
Notify when package is delivered.
Notify when package is delivered.
def _notify_delivered(self): """Notify when package is delivered.""" _LOGGER.info("Package delivered: %s", self._tracking_number) identification = ( self._friendly_name if self._friendly_name else self._tracking_number ) message = NOTIFICATION_DELIVERED_MESSAGE.forma...
[ "def", "_notify_delivered", "(", "self", ")", ":", "_LOGGER", ".", "info", "(", "\"Package delivered: %s\"", ",", "self", ".", "_tracking_number", ")", "identification", "=", "(", "self", ".", "_friendly_name", "if", "self", ".", "_friendly_name", "else", "self"...
[ 256, 4 ]
[ 271, 9 ]
python
en
['en', 'en', 'en']
True
SeventeenTrackData.__init__
( self, client, async_add_entities, scan_interval, show_archived, show_delivered )
Initialize.
Initialize.
def __init__( self, client, async_add_entities, scan_interval, show_archived, show_delivered ): """Initialize.""" self._async_add_entities = async_add_entities self._client = client self._scan_interval = scan_interval self._show_archived = show_archived self.a...
[ "def", "__init__", "(", "self", ",", "client", ",", "async_add_entities", ",", "scan_interval", ",", "show_archived", ",", "show_delivered", ")", ":", "self", ".", "_async_add_entities", "=", "async_add_entities", "self", ".", "_client", "=", "client", "self", "...
[ 277, 4 ]
[ 291, 32 ]
python
en
['en', 'en', 'it']
False
SeventeenTrackData._async_update
(self)
Get updated data from 17track.net.
Get updated data from 17track.net.
async def _async_update(self): """Get updated data from 17track.net.""" try: packages = await self._client.profile.packages( show_archived=self._show_archived ) _LOGGER.debug("New package data received: %s", packages) new_packages = {p.tr...
[ "async", "def", "_async_update", "(", "self", ")", ":", "try", ":", "packages", "=", "await", "self", ".", "_client", ".", "profile", ".", "packages", "(", "show_archived", "=", "self", ".", "_show_archived", ")", "_LOGGER", ".", "debug", "(", "\"New packa...
[ 293, 4 ]
[ 340, 29 ]
python
en
['en', 'en', 'en']
True
setup
(hass, base_config)
Start Homeworks controller.
Start Homeworks controller.
def setup(hass, base_config): """Start Homeworks controller.""" def hw_callback(msg_type, values): """Dispatch state changes.""" _LOGGER.debug("callback: %s, %s", msg_type, values) addr = values[0] signal = f"homeworks_entity_{addr}" dispatcher_send(hass, signal, msg_typ...
[ "def", "setup", "(", "hass", ",", "base_config", ")", ":", "def", "hw_callback", "(", "msg_type", ",", "values", ")", ":", "\"\"\"Dispatch state changes.\"\"\"", "_LOGGER", ".", "debug", "(", "\"callback: %s, %s\"", ",", "msg_type", ",", "values", ")", "addr", ...
[ 65, 0 ]
[ 92, 15 ]
python
en
['en', 'no', 'en']
True
HomeworksDevice.__init__
(self, controller, addr, name)
Initialize Homeworks device.
Initialize Homeworks device.
def __init__(self, controller, addr, name): """Initialize Homeworks device.""" self._addr = addr self._name = name self._controller = controller
[ "def", "__init__", "(", "self", ",", "controller", ",", "addr", ",", "name", ")", ":", "self", ".", "_addr", "=", "addr", "self", ".", "_name", "=", "name", "self", ".", "_controller", "=", "controller" ]
[ 98, 4 ]
[ 102, 37 ]
python
en
['es', 'pl', 'en']
False
HomeworksDevice.unique_id
(self)
Return a unique identifier.
Return a unique identifier.
def unique_id(self): """Return a unique identifier.""" return f"homeworks.{self._addr}"
[ "def", "unique_id", "(", "self", ")", ":", "return", "f\"homeworks.{self._addr}\"" ]
[ 105, 4 ]
[ 107, 40 ]
python
fr
['fr', 'fr', 'en']
True
HomeworksDevice.name
(self)
Device name.
Device name.
def name(self): """Device name.""" return self._name
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "_name" ]
[ 110, 4 ]
[ 112, 25 ]
python
en
['en', 'en', 'en']
False
HomeworksDevice.should_poll
(self)
No need to poll.
No need to poll.
def should_poll(self): """No need to poll.""" return False
[ "def", "should_poll", "(", "self", ")", ":", "return", "False" ]
[ 115, 4 ]
[ 117, 20 ]
python
en
['en', 'en', 'en']
True
HomeworksKeypadEvent.__init__
(self, hass, addr, name)
Register callback that will be used for signals.
Register callback that will be used for signals.
def __init__(self, hass, addr, name): """Register callback that will be used for signals.""" self._hass = hass self._addr = addr self._name = name self._id = slugify(self._name) signal = f"homeworks_entity_{self._addr}" async_dispatcher_connect(self._hass, signal,...
[ "def", "__init__", "(", "self", ",", "hass", ",", "addr", ",", "name", ")", ":", "self", ".", "_hass", "=", "hass", "self", ".", "_addr", "=", "addr", "self", ".", "_name", "=", "name", "self", ".", "_id", "=", "slugify", "(", "self", ".", "_name...
[ 127, 4 ]
[ 134, 75 ]
python
en
['en', 'en', 'en']
True
HomeworksKeypadEvent._update_callback
(self, msg_type, values)
Fire events if button is pressed or released.
Fire events if button is pressed or released.
def _update_callback(self, msg_type, values): """Fire events if button is pressed or released.""" if msg_type == HW_BUTTON_PRESSED: event = EVENT_BUTTON_PRESS elif msg_type == HW_BUTTON_RELEASED: event = EVENT_BUTTON_RELEASE else: return data ...
[ "def", "_update_callback", "(", "self", ",", "msg_type", ",", "values", ")", ":", "if", "msg_type", "==", "HW_BUTTON_PRESSED", ":", "event", "=", "EVENT_BUTTON_PRESS", "elif", "msg_type", "==", "HW_BUTTON_RELEASED", ":", "event", "=", "EVENT_BUTTON_RELEASE", "else...
[ 137, 4 ]
[ 147, 46 ]
python
en
['en', 'en', 'en']
True
retry
(func, func_args, attempts=1, wait=0)
Call function and re-execute it if it raises an Exception. :param func: the function to execute. :param func_args: the positional arguments of the function. :param attempts: the maximum number of attempts. Default: 1. :param wait: delay between attempts. Default: 0. :returns: the result of the...
Call function and re-execute it if it raises an Exception.
def retry(func, func_args, attempts=1, wait=0): """ Call function and re-execute it if it raises an Exception. :param func: the function to execute. :param func_args: the positional arguments of the function. :param attempts: the maximum number of attempts. Default: 1. :param wait: delay betwee...
[ "def", "retry", "(", "func", ",", "func_args", ",", "attempts", "=", "1", ",", "wait", "=", "0", ")", ":", "while", "attempts", ":", "try", ":", "return", "func", "(", "*", "func_args", ")", "except", "Exception", "as", "e", ":", "attempts", "-=", ...
[ 37, 0 ]
[ 56, 28 ]
python
en
['en', 'error', 'th']
False
generate_random_token
(token_length)
Generate CSPRNG compliant random tokens.
Generate CSPRNG compliant random tokens.
def generate_random_token(token_length): """Generate CSPRNG compliant random tokens.""" allowed_chars = "".join((string.ascii_letters, string.digits, "_", "-")) max_int = len(allowed_chars) - 1 system_random = random.SystemRandom() return "".join(allowed_chars[system_random.randint(0, max_int)] for...
[ "def", "generate_random_token", "(", "token_length", ")", ":", "allowed_chars", "=", "\"\"", ".", "join", "(", "(", "string", ".", "ascii_letters", ",", "string", ".", "digits", ",", "\"_\"", ",", "\"-\"", ")", ")", "max_int", "=", "len", "(", "allowed_cha...
[ 59, 0 ]
[ 65, 97 ]
python
en
['en', 'es', 'pt']
False
_run_server
(port, certificate=None, key=None)
Run NICE DCV authenticator server on localhost. The NICE DCV authenticator server *must* run with an appropriate user. :param port: the port in which you want to start the server :param certificate: the certificate to use if HTTPSs :param key: the private key to use if HTTPSs
Run NICE DCV authenticator server on localhost.
def _run_server(port, certificate=None, key=None): """ Run NICE DCV authenticator server on localhost. The NICE DCV authenticator server *must* run with an appropriate user. :param port: the port in which you want to start the server :param certificate: the certificate to use if HTTPSs :param ...
[ "def", "_run_server", "(", "port", ",", "certificate", "=", "None", ",", "key", "=", "None", ")", ":", "server_address", "=", "(", "\"localhost\"", ",", "port", ")", "httpd", "=", "ThreadedHTTPServer", "(", "server_address", ",", "DCVAuthenticator", ")", "if...
[ 394, 0 ]
[ 419, 25 ]
python
en
['en', 'error', 'th']
False
_parse_args
()
Parse command line arguments.
Parse command line arguments.
def _parse_args(): """Parse command line arguments.""" parser = argparse.ArgumentParser(description="Execute the ParallelCluster DCV External Authenticator") parser.add_argument("--port", help="The port in which you want to start the HTTP server", type=int) parser.add_argument("--certificate", help="The...
[ "def", "_parse_args", "(", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "\"Execute the ParallelCluster DCV External Authenticator\"", ")", "parser", ".", "add_argument", "(", "\"--port\"", ",", "help", "=", "\"The port in which yo...
[ 422, 0 ]
[ 428, 30 ]
python
en
['en', 'fr', 'en']
True
generate_sha512_hash
(*args)
Generate a salted sha512 of the given token.
Generate a salted sha512 of the given token.
def generate_sha512_hash(*args): """Generate a salted sha512 of the given token.""" salt = generate_random_token(256) hash_handler = hashlib.sha512() for item in args, salt: hash_handler.update(str(item).encode("utf-8")) return hash_handler.hexdigest()
[ "def", "generate_sha512_hash", "(", "*", "args", ")", ":", "salt", "=", "generate_random_token", "(", "256", ")", "hash_handler", "=", "hashlib", ".", "sha512", "(", ")", "for", "item", "in", "args", ",", "salt", ":", "hash_handler", ".", "update", "(", ...
[ 431, 0 ]
[ 439, 35 ]
python
en
['en', 'en', 'en']
True
_prepare_auth_folder
()
Delete old authorization files.
Delete old authorization files.
def _prepare_auth_folder(): """Delete old authorization files.""" for access_file in os.listdir(AUTHORIZATION_FILE_DIR): os.remove(os.path.join(AUTHORIZATION_FILE_DIR, access_file))
[ "def", "_prepare_auth_folder", "(", ")", ":", "for", "access_file", "in", "os", ".", "listdir", "(", "AUTHORIZATION_FILE_DIR", ")", ":", "os", ".", "remove", "(", "os", ".", "path", ".", "join", "(", "AUTHORIZATION_FILE_DIR", ",", "access_file", ")", ")" ]
[ 442, 0 ]
[ 445, 68 ]
python
en
['en', 'en', 'en']
True
fail
(message)
Print error message and exit(1). :param message: message to print
Print error message and exit(1).
def fail(message): """ Print error message and exit(1). :param message: message to print """ logger.error(message) exit(1)
[ "def", "fail", "(", "message", ")", ":", "logger", ".", "error", "(", "message", ")", "exit", "(", "1", ")" ]
[ 448, 0 ]
[ 455, 11 ]
python
en
['en', 'error', 'th']
False
_config_logger
()
Define a logger for pcluster_dcv_authenticator. :return: the logger
Define a logger for pcluster_dcv_authenticator.
def _config_logger(): """ Define a logger for pcluster_dcv_authenticator. :return: the logger """ try: logfile = os.path.expanduser(LOG_FILE_PATH) logdir = os.path.dirname(logfile) os.makedirs(logdir) except OSError as e: if e.errno == errno.EEXIST and os.path.is...
[ "def", "_config_logger", "(", ")", ":", "try", ":", "logfile", "=", "os", ".", "path", ".", "expanduser", "(", "LOG_FILE_PATH", ")", "logdir", "=", "os", ".", "path", ".", "dirname", "(", "logfile", ")", "os", ".", "makedirs", "(", "logdir", ")", "ex...
[ 458, 0 ]
[ 484, 17 ]
python
en
['en', 'error', 'th']
False
OneTimeTokenHandler.add_token
(self, token, token_info)
Add token and his corresponding information in the storage. :param token the token to store :param token_info a tuple of values associated to the token to store
Add token and his corresponding information in the storage.
def add_token(self, token, token_info): """ Add token and his corresponding information in the storage. :param token the token to store :param token_info a tuple of values associated to the token to store """ while len(self._tokens) >= self._max_number_of_tokens: ...
[ "def", "add_token", "(", "self", ",", "token", ",", "token_info", ")", ":", "while", "len", "(", "self", ".", "_tokens", ")", ">=", "self", ".", "_max_number_of_tokens", ":", "# Remove the first token stored", "self", ".", "_tokens", ".", "popitem", "(", "la...
[ 79, 4 ]
[ 90, 40 ]
python
en
['en', 'error', 'th']
False
OneTimeTokenHandler.get_token_info
(self, token)
Pop the token and return the related information if the token is present, else returns None.
Pop the token and return the related information if the token is present, else returns None.
def get_token_info(self, token): """Pop the token and return the related information if the token is present, else returns None.""" return self._tokens.pop(token, None)
[ "def", "get_token_info", "(", "self", ",", "token", ")", ":", "return", "self", ".", "_tokens", ".", "pop", "(", "token", ",", "None", ")" ]
[ 92, 4 ]
[ 94, 44 ]
python
en
['en', 'en', 'en']
True
DCVAuthenticator.do_GET
(self)
Handle GET requests coming from the user to obtain request and session tokens. The format of the request should be: curl -X GET -G http://localhost:<port> -d action=requestToken -d authUser=<username> -d sessionID=<ID> curl -X GET -G http://localhost:<port> -d action=sessionTok...
Handle GET requests coming from the user to obtain request and session tokens.
def do_GET(self): # noqa N802 """ Handle GET requests coming from the user to obtain request and session tokens. The format of the request should be: curl -X GET -G http://localhost:<port> -d action=requestToken -d authUser=<username> -d sessionID=<ID> curl -X GET -G ht...
[ "def", "do_GET", "(", "self", ")", ":", "# noqa N802", "try", ":", "logger", ".", "info", "(", "\"Validating user request..\"", ")", "# validate number of parameters", "parameters", "=", "dict", "(", "parse_qsl", "(", "urlparse", "(", "self", ".", "path", ")", ...
[ 148, 4 ]
[ 181, 39 ]
python
en
['en', 'error', 'th']
False
DCVAuthenticator.do_POST
(self)
Handle POST requests, coming from NICE DCV server. The format of the request is the following: curl -k http://localhost:<port> -d sessionId=<session-id> -d authenticationToken=<token>
Handle POST requests, coming from NICE DCV server.
def do_POST(self): # noqa N802 """ Handle POST requests, coming from NICE DCV server. The format of the request is the following: curl -k http://localhost:<port> -d sessionId=<session-id> -d authenticationToken=<token> """ try: length = int(self.headers[...
[ "def", "do_POST", "(", "self", ")", ":", "# noqa N802", "try", ":", "length", "=", "int", "(", "self", ".", "headers", "[", "\"Content-Length\"", "]", ")", "field_data", "=", "self", ".", "rfile", ".", "read", "(", "length", ")", ".", "decode", "(", ...
[ 183, 4 ]
[ 210, 35 ]
python
en
['en', 'error', 'th']
False
DCVAuthenticator.log_message
(self, fmt, *args)
Override Server log message by removing authentication actions.
Override Server log message by removing authentication actions.
def log_message(self, fmt, *args): """Override Server log message by removing authentication actions.""" if all(auth_action not in args[0] for auth_action in ["requestToken", "sectionToken"]): logger.info(fmt % args)
[ "def", "log_message", "(", "self", ",", "fmt", ",", "*", "args", ")", ":", "if", "all", "(", "auth_action", "not", "in", "args", "[", "0", "]", "for", "auth_action", "in", "[", "\"requestToken\"", ",", "\"sectionToken\"", "]", ")", ":", "logger", ".", ...
[ 212, 4 ]
[ 215, 35 ]
python
en
['en', 'en', 'en']
True
DCVAuthenticator._check_auth
(cls, session_id, session_token)
Check session token expiration to see if it is still valid for the given DCV session id.
Check session token expiration to see if it is still valid for the given DCV session id.
def _check_auth(cls, session_id, session_token): """Check session token expiration to see if it is still valid for the given DCV session id.""" # validate session and session token DCVAuthenticator._validate_param(session_id, DCVAuthenticator.SESSION_ID_REGEX, "sessionId") DCVAuthenticat...
[ "def", "_check_auth", "(", "cls", ",", "session_id", ",", "session_token", ")", ":", "# validate session and session token", "DCVAuthenticator", ".", "_validate_param", "(", "session_id", ",", "DCVAuthenticator", ".", "SESSION_ID_REGEX", ",", "\"sessionId\"", ")", "DCVA...
[ 248, 4 ]
[ 261, 34 ]
python
en
['en', 'en', 'en']
True
DCVAuthenticator._get_request_token
(cls, user, session_id)
Obtain the request token and the "access file" name required to obtain the session token. Generate a Request token, store in memory and returns a json containing the token itself and the name of the file the user must create in the AUTHORIZATION_FILE_DIR.
Obtain the request token and the "access file" name required to obtain the session token.
def _get_request_token(cls, user, session_id): """ Obtain the request token and the "access file" name required to obtain the session token. Generate a Request token, store in memory and returns a json containing the token itself and the name of the file the user must create in the AUTH...
[ "def", "_get_request_token", "(", "cls", ",", "user", ",", "session_id", ")", ":", "logger", ".", "info", "(", "\"New request for Request Token from user '{0}' and DCV Session Id '{1}'.\"", ".", "format", "(", "user", ",", "session_id", ")", ")", "# validate user and se...
[ 264, 4 ]
[ 287, 85 ]
python
en
['en', 'error', 'th']
False
DCVAuthenticator._get_session_token
(cls, request_token)
Obtain the session token to connect to the DCV session. Generate a Session token, store in memory and returns a json containing the token itself.
Obtain the session token to connect to the DCV session.
def _get_session_token(cls, request_token): """ Obtain the session token to connect to the DCV session. Generate a Session token, store in memory and returns a json containing the token itself. """ logger.info("New request for Session Token.") DCVAuthenticator._validate_...
[ "def", "_get_session_token", "(", "cls", ",", "request_token", ")", ":", "logger", ".", "info", "(", "\"New request for Session Token.\"", ")", "DCVAuthenticator", ".", "_validate_param", "(", "request_token", ",", "DCVAuthenticator", ".", "TOKEN_REGEX", ",", "\"reque...
[ 290, 4 ]
[ 339, 58 ]
python
en
['en', 'error', 'th']
False
DCVAuthenticator._is_session_valid
(user, session_id)
Verify if the DCV session exists and the ownership. # We are using ps aux to retrieve the list of sessions # because currently DCV doesn't allow list-session to list all session even for non-root user. # TODO change this method if DCV updates his behaviour.
Verify if the DCV session exists and the ownership.
def _is_session_valid(user, session_id): """ Verify if the DCV session exists and the ownership. # We are using ps aux to retrieve the list of sessions # because currently DCV doesn't allow list-session to list all session even for non-root user. # TODO change this method if DCV...
[ "def", "_is_session_valid", "(", "user", ",", "session_id", ")", ":", "logger", ".", "info", "(", "\"Verifying NICE DCV session validity..\"", ")", "# Remove the first and the last because they are the heading and empty, respectively", "processes", "=", "subprocess", ".", "chec...
[ 347, 4 ]
[ 364, 53 ]
python
en
['en', 'error', 'th']
False
DCVAuthenticator.check_dcv_process
(row, user, session_id)
Check if there is a dcvagent process running for the given user and for the given session_id.
Check if there is a dcvagent process running for the given user and for the given session_id.
def check_dcv_process(row, user, session_id): """Check if there is a dcvagent process running for the given user and for the given session_id.""" # row example: # centos 63 0.0 0.0 4348844 3108 ?? Ss 23Jul19 2:32.46 /usr/libexec/dcv/dcvagent --mode full \ # --session-id myses...
[ "def", "check_dcv_process", "(", "row", ",", "user", ",", "session_id", ")", ":", "# row example:", "# centos 63 0.0 0.0 4348844 3108 ?? Ss 23Jul19 2:32.46 /usr/libexec/dcv/dcvagent --mode full \\", "# --session-id mysession", "# ubuntu 2949 0.3 0.4 860568 34328 ? Sl 20:10 0:18...
[ 371, 4 ]
[ 387, 9 ]
python
en
['en', 'en', 'en']
True
test_switch
(hass, generic_data, sent_messages, switch_msg)
Test setting up config entry.
Test setting up config entry.
async def test_switch(hass, generic_data, sent_messages, switch_msg): """Test setting up config entry.""" receive_message = await setup_ozw(hass, fixture=generic_data) # Test loaded state = hass.states.get("switch.smart_plug_switch") assert state is not None assert state.state == "off" # T...
[ "async", "def", "test_switch", "(", "hass", ",", "generic_data", ",", "sent_messages", ",", "switch_msg", ")", ":", "receive_message", "=", "await", "setup_ozw", "(", "hass", ",", "fixture", "=", "generic_data", ")", "# Test loaded", "state", "=", "hass", ".",...
[ 4, 0 ]
[ 40, 70 ]
python
en
['en', 'en', 'en']
True
pyorbit_emcee
(config_in, input_datasets=None, return_output=None)
A dummy file is created to let the cpulimit script to proceed with the next step
A dummy file is created to let the cpulimit script to proceed with the next step
def pyorbit_emcee(config_in, input_datasets=None, return_output=None): optimize_dir_output = './' + config_in['output'] + '/optimize/' pyde_dir_output = './' + config_in['output'] + '/pyde/' emcee_dir_output = './' + config_in['output'] + '/emcee/' reloaded_optimize = False reloaded_pyde = False ...
[ "def", "pyorbit_emcee", "(", "config_in", ",", "input_datasets", "=", "None", ",", "return_output", "=", "None", ")", ":", "optimize_dir_output", "=", "'./'", "+", "config_in", "[", "'output'", "]", "+", "'/optimize/'", "pyde_dir_output", "=", "'./'", "+", "co...
[ 16, 0 ]
[ 288, 56 ]
python
en
['en', 'en', 'en']
True
async_setup
(hass: HomeAssistant, config: dict)
Set up the Smart Meter Texas component.
Set up the Smart Meter Texas component.
async def async_setup(hass: HomeAssistant, config: dict): """Set up the Smart Meter Texas component.""" hass.data.setdefault(DOMAIN, {}) return True
[ "async", "def", "async_setup", "(", "hass", ":", "HomeAssistant", ",", "config", ":", "dict", ")", ":", "hass", ".", "data", ".", "setdefault", "(", "DOMAIN", ",", "{", "}", ")", "return", "True" ]
[ 34, 0 ]
[ 37, 15 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
(hass: HomeAssistant, entry: ConfigEntry)
Set up Smart Meter Texas from a config entry.
Set up Smart Meter Texas from a config entry.
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): """Set up Smart Meter Texas from a config entry.""" username = entry.data[CONF_USERNAME] password = entry.data[CONF_PASSWORD] account = Account(username, password) smart_meter_texas_data = SmartMeterTexasData(hass, entry, accoun...
[ "async", "def", "async_setup_entry", "(", "hass", ":", "HomeAssistant", ",", "entry", ":", "ConfigEntry", ")", ":", "username", "=", "entry", ".", "data", "[", "CONF_USERNAME", "]", "password", "=", "entry", ".", "data", "[", "CONF_PASSWORD", "]", "account",...
[ 40, 0 ]
[ 90, 15 ]
python
en
['en', 'en', 'en']
True
async_unload_entry
(hass: HomeAssistant, entry: ConfigEntry)
Unload a config entry.
Unload a config entry.
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry): """Unload a config entry.""" unload_ok = all( await asyncio.gather( *[ hass.config_entries.async_forward_entry_unload(entry, component) for component in PLATFORMS ] ) ...
[ "async", "def", "async_unload_entry", "(", "hass", ":", "HomeAssistant", ",", "entry", ":", "ConfigEntry", ")", ":", "unload_ok", "=", "all", "(", "await", "asyncio", ".", "gather", "(", "*", "[", "hass", ".", "config_entries", ".", "async_forward_entry_unload...
[ 119, 0 ]
[ 132, 20 ]
python
en
['en', 'es', 'en']
True
SmartMeterTexasData.__init__
(self, hass: HomeAssistant, entry: ConfigEntry, account: Account)
Initialize the data coordintator.
Initialize the data coordintator.
def __init__(self, hass: HomeAssistant, entry: ConfigEntry, account: Account): """Initialize the data coordintator.""" self._entry = entry self.account = account websession = aiohttp_client.async_get_clientsession(hass) self.client = Client(websession, account) self.meter...
[ "def", "__init__", "(", "self", ",", "hass", ":", "HomeAssistant", ",", "entry", ":", "ConfigEntry", ",", "account", ":", "Account", ")", ":", "self", ".", "_entry", "=", "entry", "self", ".", "account", "=", "account", "websession", "=", "aiohttp_client",...
[ 96, 4 ]
[ 102, 24 ]
python
en
['en', 'en', 'en']
True
SmartMeterTexasData.setup
(self)
Fetch all of the user's meters.
Fetch all of the user's meters.
async def setup(self): """Fetch all of the user's meters.""" self.meters = await self.account.fetch_meters(self.client) _LOGGER.debug("Discovered %s meter(s)", len(self.meters))
[ "async", "def", "setup", "(", "self", ")", ":", "self", ".", "meters", "=", "await", "self", ".", "account", ".", "fetch_meters", "(", "self", ".", "client", ")", "_LOGGER", ".", "debug", "(", "\"Discovered %s meter(s)\"", ",", "len", "(", "self", ".", ...
[ 104, 4 ]
[ 107, 65 ]
python
en
['en', 'en', 'en']
True
SmartMeterTexasData.read_meters
(self)
Read each meter.
Read each meter.
async def read_meters(self): """Read each meter.""" for meter in self.meters: try: await meter.read_meter(self.client) except (SmartMeterTexasAPIError, SmartMeterTexasAuthError) as error: raise UpdateFailed(error) from error return self.met...
[ "async", "def", "read_meters", "(", "self", ")", ":", "for", "meter", "in", "self", ".", "meters", ":", "try", ":", "await", "meter", ".", "read_meter", "(", "self", ".", "client", ")", "except", "(", "SmartMeterTexasAPIError", ",", "SmartMeterTexasAuthError...
[ 109, 4 ]
[ 116, 26 ]
python
en
['en', 'af', 'en']
True
async_turn_on
(hass, entity_id=ENTITY_MATCH_ALL)
Turn on specified media player or all.
Turn on specified media player or all.
async def async_turn_on(hass, entity_id=ENTITY_MATCH_ALL): """Turn on specified media player or all.""" data = {ATTR_ENTITY_ID: entity_id} if entity_id else {} await hass.services.async_call(DOMAIN, SERVICE_TURN_ON, data, blocking=True)
[ "async", "def", "async_turn_on", "(", "hass", ",", "entity_id", "=", "ENTITY_MATCH_ALL", ")", ":", "data", "=", "{", "ATTR_ENTITY_ID", ":", "entity_id", "}", "if", "entity_id", "else", "{", "}", "await", "hass", ".", "services", ".", "async_call", "(", "DO...
[ 39, 0 ]
[ 42, 80 ]
python
en
['en', 'en', 'en']
True
turn_on
(hass, entity_id=ENTITY_MATCH_ALL)
Turn on specified media player or all.
Turn on specified media player or all.
def turn_on(hass, entity_id=ENTITY_MATCH_ALL): """Turn on specified media player or all.""" hass.add_job(async_turn_on, hass, entity_id)
[ "def", "turn_on", "(", "hass", ",", "entity_id", "=", "ENTITY_MATCH_ALL", ")", ":", "hass", ".", "add_job", "(", "async_turn_on", ",", "hass", ",", "entity_id", ")" ]
[ 46, 0 ]
[ 48, 48 ]
python
en
['en', 'en', 'en']
True
async_turn_off
(hass, entity_id=ENTITY_MATCH_ALL)
Turn off specified media player or all.
Turn off specified media player or all.
async def async_turn_off(hass, entity_id=ENTITY_MATCH_ALL): """Turn off specified media player or all.""" data = {ATTR_ENTITY_ID: entity_id} if entity_id else {} await hass.services.async_call(DOMAIN, SERVICE_TURN_OFF, data, blocking=True)
[ "async", "def", "async_turn_off", "(", "hass", ",", "entity_id", "=", "ENTITY_MATCH_ALL", ")", ":", "data", "=", "{", "ATTR_ENTITY_ID", ":", "entity_id", "}", "if", "entity_id", "else", "{", "}", "await", "hass", ".", "services", ".", "async_call", "(", "D...
[ 51, 0 ]
[ 54, 81 ]
python
en
['en', 'en', 'en']
True
turn_off
(hass, entity_id=ENTITY_MATCH_ALL)
Turn off specified media player or all.
Turn off specified media player or all.
def turn_off(hass, entity_id=ENTITY_MATCH_ALL): """Turn off specified media player or all.""" hass.add_job(async_turn_off, hass, entity_id)
[ "def", "turn_off", "(", "hass", ",", "entity_id", "=", "ENTITY_MATCH_ALL", ")", ":", "hass", ".", "add_job", "(", "async_turn_off", ",", "hass", ",", "entity_id", ")" ]
[ 58, 0 ]
[ 60, 49 ]
python
en
['en', 'en', 'en']
True
async_toggle
(hass, entity_id=ENTITY_MATCH_ALL)
Toggle specified media player or all.
Toggle specified media player or all.
async def async_toggle(hass, entity_id=ENTITY_MATCH_ALL): """Toggle specified media player or all.""" data = {ATTR_ENTITY_ID: entity_id} if entity_id else {} await hass.services.async_call(DOMAIN, SERVICE_TOGGLE, data, blocking=True)
[ "async", "def", "async_toggle", "(", "hass", ",", "entity_id", "=", "ENTITY_MATCH_ALL", ")", ":", "data", "=", "{", "ATTR_ENTITY_ID", ":", "entity_id", "}", "if", "entity_id", "else", "{", "}", "await", "hass", ".", "services", ".", "async_call", "(", "DOM...
[ 63, 0 ]
[ 66, 79 ]
python
en
['en', 'en', 'en']
True
toggle
(hass, entity_id=ENTITY_MATCH_ALL)
Toggle specified media player or all.
Toggle specified media player or all.
def toggle(hass, entity_id=ENTITY_MATCH_ALL): """Toggle specified media player or all.""" hass.add_job(async_toggle, hass, entity_id)
[ "def", "toggle", "(", "hass", ",", "entity_id", "=", "ENTITY_MATCH_ALL", ")", ":", "hass", ".", "add_job", "(", "async_toggle", ",", "hass", ",", "entity_id", ")" ]
[ 70, 0 ]
[ 72, 47 ]
python
en
['en', 'en', 'en']
True
async_volume_up
(hass, entity_id=ENTITY_MATCH_ALL)
Send the media player the command for volume up.
Send the media player the command for volume up.
async def async_volume_up(hass, entity_id=ENTITY_MATCH_ALL): """Send the media player the command for volume up.""" data = {ATTR_ENTITY_ID: entity_id} if entity_id else {} await hass.services.async_call(DOMAIN, SERVICE_VOLUME_UP, data, blocking=True)
[ "async", "def", "async_volume_up", "(", "hass", ",", "entity_id", "=", "ENTITY_MATCH_ALL", ")", ":", "data", "=", "{", "ATTR_ENTITY_ID", ":", "entity_id", "}", "if", "entity_id", "else", "{", "}", "await", "hass", ".", "services", ".", "async_call", "(", "...
[ 75, 0 ]
[ 78, 82 ]
python
en
['en', 'en', 'en']
True
volume_up
(hass, entity_id=ENTITY_MATCH_ALL)
Send the media player the command for volume up.
Send the media player the command for volume up.
def volume_up(hass, entity_id=ENTITY_MATCH_ALL): """Send the media player the command for volume up.""" hass.add_job(async_volume_up, hass, entity_id)
[ "def", "volume_up", "(", "hass", ",", "entity_id", "=", "ENTITY_MATCH_ALL", ")", ":", "hass", ".", "add_job", "(", "async_volume_up", ",", "hass", ",", "entity_id", ")" ]
[ 82, 0 ]
[ 84, 50 ]
python
en
['en', 'en', 'en']
True
async_volume_down
(hass, entity_id=ENTITY_MATCH_ALL)
Send the media player the command for volume down.
Send the media player the command for volume down.
async def async_volume_down(hass, entity_id=ENTITY_MATCH_ALL): """Send the media player the command for volume down.""" data = {ATTR_ENTITY_ID: entity_id} if entity_id else {} await hass.services.async_call(DOMAIN, SERVICE_VOLUME_DOWN, data, blocking=True)
[ "async", "def", "async_volume_down", "(", "hass", ",", "entity_id", "=", "ENTITY_MATCH_ALL", ")", ":", "data", "=", "{", "ATTR_ENTITY_ID", ":", "entity_id", "}", "if", "entity_id", "else", "{", "}", "await", "hass", ".", "services", ".", "async_call", "(", ...
[ 87, 0 ]
[ 90, 84 ]
python
en
['en', 'en', 'en']
True
volume_down
(hass, entity_id=ENTITY_MATCH_ALL)
Send the media player the command for volume down.
Send the media player the command for volume down.
def volume_down(hass, entity_id=ENTITY_MATCH_ALL): """Send the media player the command for volume down.""" hass.add_job(async_volume_down, hass, entity_id)
[ "def", "volume_down", "(", "hass", ",", "entity_id", "=", "ENTITY_MATCH_ALL", ")", ":", "hass", ".", "add_job", "(", "async_volume_down", ",", "hass", ",", "entity_id", ")" ]
[ 94, 0 ]
[ 96, 52 ]
python
en
['en', 'en', 'en']
True
async_mute_volume
(hass, mute, entity_id=ENTITY_MATCH_ALL)
Send the media player the command for muting the volume.
Send the media player the command for muting the volume.
async def async_mute_volume(hass, mute, entity_id=ENTITY_MATCH_ALL): """Send the media player the command for muting the volume.""" data = {ATTR_MEDIA_VOLUME_MUTED: mute} if entity_id: data[ATTR_ENTITY_ID] = entity_id await hass.services.async_call(DOMAIN, SERVICE_VOLUME_MUTE, data, blocking=T...
[ "async", "def", "async_mute_volume", "(", "hass", ",", "mute", ",", "entity_id", "=", "ENTITY_MATCH_ALL", ")", ":", "data", "=", "{", "ATTR_MEDIA_VOLUME_MUTED", ":", "mute", "}", "if", "entity_id", ":", "data", "[", "ATTR_ENTITY_ID", "]", "=", "entity_id", "...
[ 99, 0 ]
[ 106, 84 ]
python
en
['en', 'en', 'en']
True
mute_volume
(hass, mute, entity_id=ENTITY_MATCH_ALL)
Send the media player the command for muting the volume.
Send the media player the command for muting the volume.
def mute_volume(hass, mute, entity_id=ENTITY_MATCH_ALL): """Send the media player the command for muting the volume.""" hass.add_job(async_mute_volume, hass, mute, entity_id)
[ "def", "mute_volume", "(", "hass", ",", "mute", ",", "entity_id", "=", "ENTITY_MATCH_ALL", ")", ":", "hass", ".", "add_job", "(", "async_mute_volume", ",", "hass", ",", "mute", ",", "entity_id", ")" ]
[ 110, 0 ]
[ 112, 58 ]
python
en
['en', 'en', 'en']
True
async_set_volume_level
(hass, volume, entity_id=ENTITY_MATCH_ALL)
Send the media player the command for setting the volume.
Send the media player the command for setting the volume.
async def async_set_volume_level(hass, volume, entity_id=ENTITY_MATCH_ALL): """Send the media player the command for setting the volume.""" data = {ATTR_MEDIA_VOLUME_LEVEL: volume} if entity_id: data[ATTR_ENTITY_ID] = entity_id await hass.services.async_call(DOMAIN, SERVICE_VOLUME_SET, data, b...
[ "async", "def", "async_set_volume_level", "(", "hass", ",", "volume", ",", "entity_id", "=", "ENTITY_MATCH_ALL", ")", ":", "data", "=", "{", "ATTR_MEDIA_VOLUME_LEVEL", ":", "volume", "}", "if", "entity_id", ":", "data", "[", "ATTR_ENTITY_ID", "]", "=", "entity...
[ 115, 0 ]
[ 122, 83 ]
python
en
['en', 'en', 'en']
True
set_volume_level
(hass, volume, entity_id=ENTITY_MATCH_ALL)
Send the media player the command for setting the volume.
Send the media player the command for setting the volume.
def set_volume_level(hass, volume, entity_id=ENTITY_MATCH_ALL): """Send the media player the command for setting the volume.""" hass.add_job(async_set_volume_level, hass, volume, entity_id)
[ "def", "set_volume_level", "(", "hass", ",", "volume", ",", "entity_id", "=", "ENTITY_MATCH_ALL", ")", ":", "hass", ".", "add_job", "(", "async_set_volume_level", ",", "hass", ",", "volume", ",", "entity_id", ")" ]
[ 126, 0 ]
[ 128, 65 ]
python
en
['en', 'en', 'en']
True
async_media_play_pause
(hass, entity_id=ENTITY_MATCH_ALL)
Send the media player the command for play/pause.
Send the media player the command for play/pause.
async def async_media_play_pause(hass, entity_id=ENTITY_MATCH_ALL): """Send the media player the command for play/pause.""" data = {ATTR_ENTITY_ID: entity_id} if entity_id else {} await hass.services.async_call( DOMAIN, SERVICE_MEDIA_PLAY_PAUSE, data, blocking=True )
[ "async", "def", "async_media_play_pause", "(", "hass", ",", "entity_id", "=", "ENTITY_MATCH_ALL", ")", ":", "data", "=", "{", "ATTR_ENTITY_ID", ":", "entity_id", "}", "if", "entity_id", "else", "{", "}", "await", "hass", ".", "services", ".", "async_call", "...
[ 131, 0 ]
[ 136, 5 ]
python
en
['en', 'en', 'en']
True
media_play_pause
(hass, entity_id=ENTITY_MATCH_ALL)
Send the media player the command for play/pause.
Send the media player the command for play/pause.
def media_play_pause(hass, entity_id=ENTITY_MATCH_ALL): """Send the media player the command for play/pause.""" hass.add_job(async_media_play_pause, hass, entity_id)
[ "def", "media_play_pause", "(", "hass", ",", "entity_id", "=", "ENTITY_MATCH_ALL", ")", ":", "hass", ".", "add_job", "(", "async_media_play_pause", ",", "hass", ",", "entity_id", ")" ]
[ 140, 0 ]
[ 142, 57 ]
python
en
['en', 'en', 'en']
True
async_media_play
(hass, entity_id=ENTITY_MATCH_ALL)
Send the media player the command for play/pause.
Send the media player the command for play/pause.
async def async_media_play(hass, entity_id=ENTITY_MATCH_ALL): """Send the media player the command for play/pause.""" data = {ATTR_ENTITY_ID: entity_id} if entity_id else {} await hass.services.async_call(DOMAIN, SERVICE_MEDIA_PLAY, data, blocking=True)
[ "async", "def", "async_media_play", "(", "hass", ",", "entity_id", "=", "ENTITY_MATCH_ALL", ")", ":", "data", "=", "{", "ATTR_ENTITY_ID", ":", "entity_id", "}", "if", "entity_id", "else", "{", "}", "await", "hass", ".", "services", ".", "async_call", "(", ...
[ 145, 0 ]
[ 148, 83 ]
python
en
['en', 'en', 'en']
True
media_play
(hass, entity_id=ENTITY_MATCH_ALL)
Send the media player the command for play/pause.
Send the media player the command for play/pause.
def media_play(hass, entity_id=ENTITY_MATCH_ALL): """Send the media player the command for play/pause.""" hass.add_job(async_media_play, hass, entity_id)
[ "def", "media_play", "(", "hass", ",", "entity_id", "=", "ENTITY_MATCH_ALL", ")", ":", "hass", ".", "add_job", "(", "async_media_play", ",", "hass", ",", "entity_id", ")" ]
[ 152, 0 ]
[ 154, 51 ]
python
en
['en', 'en', 'en']
True
async_media_pause
(hass, entity_id=ENTITY_MATCH_ALL)
Send the media player the command for pause.
Send the media player the command for pause.
async def async_media_pause(hass, entity_id=ENTITY_MATCH_ALL): """Send the media player the command for pause.""" data = {ATTR_ENTITY_ID: entity_id} if entity_id else {} await hass.services.async_call(DOMAIN, SERVICE_MEDIA_PAUSE, data, blocking=True)
[ "async", "def", "async_media_pause", "(", "hass", ",", "entity_id", "=", "ENTITY_MATCH_ALL", ")", ":", "data", "=", "{", "ATTR_ENTITY_ID", ":", "entity_id", "}", "if", "entity_id", "else", "{", "}", "await", "hass", ".", "services", ".", "async_call", "(", ...
[ 157, 0 ]
[ 160, 84 ]
python
en
['en', 'en', 'en']
True
media_pause
(hass, entity_id=ENTITY_MATCH_ALL)
Send the media player the command for pause.
Send the media player the command for pause.
def media_pause(hass, entity_id=ENTITY_MATCH_ALL): """Send the media player the command for pause.""" hass.add_job(async_media_pause, hass, entity_id)
[ "def", "media_pause", "(", "hass", ",", "entity_id", "=", "ENTITY_MATCH_ALL", ")", ":", "hass", ".", "add_job", "(", "async_media_pause", ",", "hass", ",", "entity_id", ")" ]
[ 164, 0 ]
[ 166, 52 ]
python
en
['en', 'en', 'en']
True
async_media_stop
(hass, entity_id=ENTITY_MATCH_ALL)
Send the media player the command for stop.
Send the media player the command for stop.
async def async_media_stop(hass, entity_id=ENTITY_MATCH_ALL): """Send the media player the command for stop.""" data = {ATTR_ENTITY_ID: entity_id} if entity_id else {} await hass.services.async_call(DOMAIN, SERVICE_MEDIA_STOP, data, blocking=True)
[ "async", "def", "async_media_stop", "(", "hass", ",", "entity_id", "=", "ENTITY_MATCH_ALL", ")", ":", "data", "=", "{", "ATTR_ENTITY_ID", ":", "entity_id", "}", "if", "entity_id", "else", "{", "}", "await", "hass", ".", "services", ".", "async_call", "(", ...
[ 169, 0 ]
[ 172, 83 ]
python
en
['en', 'en', 'en']
True
media_stop
(hass, entity_id=ENTITY_MATCH_ALL)
Send the media player the command for stop.
Send the media player the command for stop.
def media_stop(hass, entity_id=ENTITY_MATCH_ALL): """Send the media player the command for stop.""" hass.add_job(async_media_stop, hass, entity_id)
[ "def", "media_stop", "(", "hass", ",", "entity_id", "=", "ENTITY_MATCH_ALL", ")", ":", "hass", ".", "add_job", "(", "async_media_stop", ",", "hass", ",", "entity_id", ")" ]
[ 176, 0 ]
[ 178, 51 ]
python
en
['en', 'en', 'en']
True
async_media_next_track
(hass, entity_id=ENTITY_MATCH_ALL)
Send the media player the command for next track.
Send the media player the command for next track.
async def async_media_next_track(hass, entity_id=ENTITY_MATCH_ALL): """Send the media player the command for next track.""" data = {ATTR_ENTITY_ID: entity_id} if entity_id else {} await hass.services.async_call( DOMAIN, SERVICE_MEDIA_NEXT_TRACK, data, blocking=True )
[ "async", "def", "async_media_next_track", "(", "hass", ",", "entity_id", "=", "ENTITY_MATCH_ALL", ")", ":", "data", "=", "{", "ATTR_ENTITY_ID", ":", "entity_id", "}", "if", "entity_id", "else", "{", "}", "await", "hass", ".", "services", ".", "async_call", "...
[ 181, 0 ]
[ 186, 5 ]
python
en
['en', 'en', 'en']
True
media_next_track
(hass, entity_id=ENTITY_MATCH_ALL)
Send the media player the command for next track.
Send the media player the command for next track.
def media_next_track(hass, entity_id=ENTITY_MATCH_ALL): """Send the media player the command for next track.""" hass.add_job(async_media_next_track, hass, entity_id)
[ "def", "media_next_track", "(", "hass", ",", "entity_id", "=", "ENTITY_MATCH_ALL", ")", ":", "hass", ".", "add_job", "(", "async_media_next_track", ",", "hass", ",", "entity_id", ")" ]
[ 190, 0 ]
[ 192, 57 ]
python
en
['en', 'en', 'en']
True
async_media_previous_track
(hass, entity_id=ENTITY_MATCH_ALL)
Send the media player the command for prev track.
Send the media player the command for prev track.
async def async_media_previous_track(hass, entity_id=ENTITY_MATCH_ALL): """Send the media player the command for prev track.""" data = {ATTR_ENTITY_ID: entity_id} if entity_id else {} await hass.services.async_call( DOMAIN, SERVICE_MEDIA_PREVIOUS_TRACK, data, blocking=True )
[ "async", "def", "async_media_previous_track", "(", "hass", ",", "entity_id", "=", "ENTITY_MATCH_ALL", ")", ":", "data", "=", "{", "ATTR_ENTITY_ID", ":", "entity_id", "}", "if", "entity_id", "else", "{", "}", "await", "hass", ".", "services", ".", "async_call",...
[ 195, 0 ]
[ 200, 5 ]
python
en
['en', 'en', 'en']
True
media_previous_track
(hass, entity_id=ENTITY_MATCH_ALL)
Send the media player the command for prev track.
Send the media player the command for prev track.
def media_previous_track(hass, entity_id=ENTITY_MATCH_ALL): """Send the media player the command for prev track.""" hass.add_job(async_media_previous_track, hass, entity_id)
[ "def", "media_previous_track", "(", "hass", ",", "entity_id", "=", "ENTITY_MATCH_ALL", ")", ":", "hass", ".", "add_job", "(", "async_media_previous_track", ",", "hass", ",", "entity_id", ")" ]
[ 204, 0 ]
[ 206, 61 ]
python
en
['en', 'en', 'en']
True
async_media_seek
(hass, position, entity_id=ENTITY_MATCH_ALL)
Send the media player the command to seek in current playing media.
Send the media player the command to seek in current playing media.
async def async_media_seek(hass, position, entity_id=ENTITY_MATCH_ALL): """Send the media player the command to seek in current playing media.""" data = {ATTR_ENTITY_ID: entity_id} if entity_id else {} data[ATTR_MEDIA_SEEK_POSITION] = position await hass.services.async_call(DOMAIN, SERVICE_MEDIA_SEEK, d...
[ "async", "def", "async_media_seek", "(", "hass", ",", "position", ",", "entity_id", "=", "ENTITY_MATCH_ALL", ")", ":", "data", "=", "{", "ATTR_ENTITY_ID", ":", "entity_id", "}", "if", "entity_id", "else", "{", "}", "data", "[", "ATTR_MEDIA_SEEK_POSITION", "]",...
[ 209, 0 ]
[ 213, 83 ]
python
en
['en', 'en', 'en']
True
media_seek
(hass, position, entity_id=ENTITY_MATCH_ALL)
Send the media player the command to seek in current playing media.
Send the media player the command to seek in current playing media.
def media_seek(hass, position, entity_id=ENTITY_MATCH_ALL): """Send the media player the command to seek in current playing media.""" hass.add_job(async_media_seek, hass, position, entity_id)
[ "def", "media_seek", "(", "hass", ",", "position", ",", "entity_id", "=", "ENTITY_MATCH_ALL", ")", ":", "hass", ".", "add_job", "(", "async_media_seek", ",", "hass", ",", "position", ",", "entity_id", ")" ]
[ 217, 0 ]
[ 219, 61 ]
python
en
['en', 'en', 'en']
True
async_play_media
( hass, media_type, media_id, entity_id=ENTITY_MATCH_ALL, enqueue=None )
Send the media player the command for playing media.
Send the media player the command for playing media.
async def async_play_media( hass, media_type, media_id, entity_id=ENTITY_MATCH_ALL, enqueue=None ): """Send the media player the command for playing media.""" data = {ATTR_MEDIA_CONTENT_TYPE: media_type, ATTR_MEDIA_CONTENT_ID: media_id} if entity_id: data[ATTR_ENTITY_ID] = entity_id if enq...
[ "async", "def", "async_play_media", "(", "hass", ",", "media_type", ",", "media_id", ",", "entity_id", "=", "ENTITY_MATCH_ALL", ",", "enqueue", "=", "None", ")", ":", "data", "=", "{", "ATTR_MEDIA_CONTENT_TYPE", ":", "media_type", ",", "ATTR_MEDIA_CONTENT_ID", "...
[ 222, 0 ]
[ 234, 83 ]
python
en
['en', 'en', 'en']
True
play_media
(hass, media_type, media_id, entity_id=ENTITY_MATCH_ALL, enqueue=None)
Send the media player the command for playing media.
Send the media player the command for playing media.
def play_media(hass, media_type, media_id, entity_id=ENTITY_MATCH_ALL, enqueue=None): """Send the media player the command for playing media.""" hass.add_job(async_play_media, hass, media_type, media_id, entity_id, enqueue)
[ "def", "play_media", "(", "hass", ",", "media_type", ",", "media_id", ",", "entity_id", "=", "ENTITY_MATCH_ALL", ",", "enqueue", "=", "None", ")", ":", "hass", ".", "add_job", "(", "async_play_media", ",", "hass", ",", "media_type", ",", "media_id", ",", "...
[ 238, 0 ]
[ 240, 82 ]
python
en
['en', 'en', 'en']
True
async_select_source
(hass, source, entity_id=ENTITY_MATCH_ALL)
Send the media player the command to select input source.
Send the media player the command to select input source.
async def async_select_source(hass, source, entity_id=ENTITY_MATCH_ALL): """Send the media player the command to select input source.""" data = {ATTR_INPUT_SOURCE: source} if entity_id: data[ATTR_ENTITY_ID] = entity_id await hass.services.async_call(DOMAIN, SERVICE_SELECT_SOURCE, data, blockin...
[ "async", "def", "async_select_source", "(", "hass", ",", "source", ",", "entity_id", "=", "ENTITY_MATCH_ALL", ")", ":", "data", "=", "{", "ATTR_INPUT_SOURCE", ":", "source", "}", "if", "entity_id", ":", "data", "[", "ATTR_ENTITY_ID", "]", "=", "entity_id", "...
[ 243, 0 ]
[ 250, 86 ]
python
en
['en', 'en', 'en']
True
select_source
(hass, source, entity_id=ENTITY_MATCH_ALL)
Send the media player the command to select input source.
Send the media player the command to select input source.
def select_source(hass, source, entity_id=ENTITY_MATCH_ALL): """Send the media player the command to select input source.""" hass.add_job(async_select_source, hass, source, entity_id)
[ "def", "select_source", "(", "hass", ",", "source", ",", "entity_id", "=", "ENTITY_MATCH_ALL", ")", ":", "hass", ".", "add_job", "(", "async_select_source", ",", "hass", ",", "source", ",", "entity_id", ")" ]
[ 254, 0 ]
[ 256, 62 ]
python
en
['en', 'en', 'en']
True
async_clear_playlist
(hass, entity_id=ENTITY_MATCH_ALL)
Send the media player the command for clear playlist.
Send the media player the command for clear playlist.
async def async_clear_playlist(hass, entity_id=ENTITY_MATCH_ALL): """Send the media player the command for clear playlist.""" data = {ATTR_ENTITY_ID: entity_id} if entity_id else {} await hass.services.async_call(DOMAIN, SERVICE_CLEAR_PLAYLIST, data, blocking=True)
[ "async", "def", "async_clear_playlist", "(", "hass", ",", "entity_id", "=", "ENTITY_MATCH_ALL", ")", ":", "data", "=", "{", "ATTR_ENTITY_ID", ":", "entity_id", "}", "if", "entity_id", "else", "{", "}", "await", "hass", ".", "services", ".", "async_call", "("...
[ 259, 0 ]
[ 262, 87 ]
python
en
['en', 'en', 'en']
True
clear_playlist
(hass, entity_id=ENTITY_MATCH_ALL)
Send the media player the command for clear playlist.
Send the media player the command for clear playlist.
def clear_playlist(hass, entity_id=ENTITY_MATCH_ALL): """Send the media player the command for clear playlist.""" hass.add_job(async_clear_playlist, hass, entity_id)
[ "def", "clear_playlist", "(", "hass", ",", "entity_id", "=", "ENTITY_MATCH_ALL", ")", ":", "hass", ".", "add_job", "(", "async_clear_playlist", ",", "hass", ",", "entity_id", ")" ]
[ 266, 0 ]
[ 268, 55 ]
python
en
['en', 'en', 'en']
True
async_setup
(hass, config)
Set up Advantage Air integration.
Set up Advantage Air integration.
async def async_setup(hass, config): """Set up Advantage Air integration.""" hass.data[DOMAIN] = {} return True
[ "async", "def", "async_setup", "(", "hass", ",", "config", ")", ":", "hass", ".", "data", "[", "DOMAIN", "]", "=", "{", "}", "return", "True" ]
[ 21, 0 ]
[ 24, 15 ]
python
en
['en', 'fr', 'en']
True
async_setup_entry
(hass, entry)
Set up Advantage Air config.
Set up Advantage Air config.
async def async_setup_entry(hass, entry): """Set up Advantage Air config.""" ip_address = entry.data[CONF_IP_ADDRESS] port = entry.data[CONF_PORT] api = advantage_air( ip_address, port=port, session=async_get_clientsession(hass), retry=ADVANTAGE_AIR_RETRY, ) asyn...
[ "async", "def", "async_setup_entry", "(", "hass", ",", "entry", ")", ":", "ip_address", "=", "entry", ".", "data", "[", "CONF_IP_ADDRESS", "]", "port", "=", "entry", ".", "data", "[", "CONF_PORT", "]", "api", "=", "advantage_air", "(", "ip_address", ",", ...
[ 27, 0 ]
[ 74, 15 ]
python
en
['en', 'ca', 'en']
True
async_unload_entry
(hass, entry)
Unload Advantage Air Config.
Unload Advantage Air Config.
async def async_unload_entry(hass, entry): """Unload Advantage Air Config.""" unload_ok = all( await asyncio.gather( *[ hass.config_entries.async_forward_entry_unload(entry, component) for component in ADVANTAGE_AIR_PLATFORMS ] ) ) ...
[ "async", "def", "async_unload_entry", "(", "hass", ",", "entry", ")", ":", "unload_ok", "=", "all", "(", "await", "asyncio", ".", "gather", "(", "*", "[", "hass", ".", "config_entries", ".", "async_forward_entry_unload", "(", "entry", ",", "component", ")", ...
[ 77, 0 ]
[ 91, 20 ]
python
ca
['en', 'ca', 'it']
False
setup_platform
(hass, config, add_entities, discovery_info=None)
Set up the Brottsplatskartan platform.
Set up the Brottsplatskartan platform.
def setup_platform(hass, config, add_entities, discovery_info=None): """Set up the Brottsplatskartan platform.""" area = config.get(CONF_AREA) latitude = config.get(CONF_LATITUDE, hass.config.latitude) longitude = config.get(CONF_LONGITUDE, hass.config.longitude) name = config[CONF_NAME] # Eve...
[ "def", "setup_platform", "(", "hass", ",", "config", ",", "add_entities", ",", "discovery_info", "=", "None", ")", ":", "area", "=", "config", ".", "get", "(", "CONF_AREA", ")", "latitude", "=", "config", ".", "get", "(", "CONF_LATITUDE", ",", "hass", "....
[ 61, 0 ]
[ 77, 60 ]
python
en
['en', 'lv', 'nl']
False
BrottsplatskartanSensor.__init__
(self, bpk, name)
Initialize the Brottsplatskartan sensor.
Initialize the Brottsplatskartan sensor.
def __init__(self, bpk, name): """Initialize the Brottsplatskartan sensor.""" self._attributes = {} self._brottsplatskartan = bpk self._name = name self._state = None
[ "def", "__init__", "(", "self", ",", "bpk", ",", "name", ")", ":", "self", ".", "_attributes", "=", "{", "}", "self", ".", "_brottsplatskartan", "=", "bpk", "self", ".", "_name", "=", "name", "self", ".", "_state", "=", "None" ]
[ 83, 4 ]
[ 88, 26 ]
python
bs
['en', 'bs', 'nl']
False
BrottsplatskartanSensor.name
(self)
Return the name of the sensor.
Return the name of the sensor.
def name(self): """Return the name of the sensor.""" return self._name
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "_name" ]
[ 91, 4 ]
[ 93, 25 ]
python
en
['en', 'mi', 'en']
True
BrottsplatskartanSensor.state
(self)
Return the state of the sensor.
Return the state of the sensor.
def state(self): """Return the state of the sensor.""" return self._state
[ "def", "state", "(", "self", ")", ":", "return", "self", ".", "_state" ]
[ 96, 4 ]
[ 98, 26 ]
python
en
['en', 'en', 'en']
True
BrottsplatskartanSensor.device_state_attributes
(self)
Return the state attributes.
Return the state attributes.
def device_state_attributes(self): """Return the state attributes.""" return self._attributes
[ "def", "device_state_attributes", "(", "self", ")", ":", "return", "self", ".", "_attributes" ]
[ 101, 4 ]
[ 103, 31 ]
python
en
['en', 'en', 'en']
True
BrottsplatskartanSensor.update
(self)
Update device state.
Update device state.
def update(self): """Update device state.""" incident_counts = defaultdict(int) incidents = self._brottsplatskartan.get_incidents() if incidents is False: _LOGGER.debug("Problems fetching incidents") return for incident in incidents: inciden...
[ "def", "update", "(", "self", ")", ":", "incident_counts", "=", "defaultdict", "(", "int", ")", "incidents", "=", "self", ".", "_brottsplatskartan", ".", "get_incidents", "(", ")", "if", "incidents", "is", "False", ":", "_LOGGER", ".", "debug", "(", "\"Pro...
[ 105, 4 ]
[ 121, 36 ]
python
en
['fr', 'en', 'en']
True
async_setup_platform
( hass, hass_config, async_add_entities, discovery_info=None )
Set up the LCN binary sensor platform.
Set up the LCN binary sensor platform.
async def async_setup_platform( hass, hass_config, async_add_entities, discovery_info=None ): """Set up the LCN binary sensor platform.""" if discovery_info is None: return devices = [] for config in discovery_info: address, connection_id = config[CONF_ADDRESS] addr = pypck....
[ "async", "def", "async_setup_platform", "(", "hass", ",", "hass_config", ",", "async_add_entities", ",", "discovery_info", "=", "None", ")", ":", "if", "discovery_info", "is", "None", ":", "return", "devices", "=", "[", "]", "for", "config", "in", "discovery_i...
[ 11, 0 ]
[ 35, 31 ]
python
en
['en', 'da', 'en']
True
LcnRegulatorLockSensor.__init__
(self, config, address_connection)
Initialize the LCN binary sensor.
Initialize the LCN binary sensor.
def __init__(self, config, address_connection): """Initialize the LCN binary sensor.""" super().__init__(config, address_connection) self.setpoint_variable = pypck.lcn_defs.Var[config[CONF_SOURCE]] self._value = None
[ "def", "__init__", "(", "self", ",", "config", ",", "address_connection", ")", ":", "super", "(", ")", ".", "__init__", "(", "config", ",", "address_connection", ")", "self", ".", "setpoint_variable", "=", "pypck", ".", "lcn_defs", ".", "Var", "[", "config...
[ 41, 4 ]
[ 47, 26 ]
python
en
['en', 'zh-Latn', 'en']
True
LcnRegulatorLockSensor.async_added_to_hass
(self)
Run when entity about to be added to hass.
Run when entity about to be added to hass.
async def async_added_to_hass(self): """Run when entity about to be added to hass.""" await super().async_added_to_hass() await self.address_connection.activate_status_request_handler( self.setpoint_variable )
[ "async", "def", "async_added_to_hass", "(", "self", ")", ":", "await", "super", "(", ")", ".", "async_added_to_hass", "(", ")", "await", "self", ".", "address_connection", ".", "activate_status_request_handler", "(", "self", ".", "setpoint_variable", ")" ]
[ 49, 4 ]
[ 54, 9 ]
python
en
['en', 'en', 'en']
True
LcnRegulatorLockSensor.is_on
(self)
Return true if the binary sensor is on.
Return true if the binary sensor is on.
def is_on(self): """Return true if the binary sensor is on.""" return self._value
[ "def", "is_on", "(", "self", ")", ":", "return", "self", ".", "_value" ]
[ 57, 4 ]
[ 59, 26 ]
python
en
['en', 'fy', 'en']
True