code stringlengths 66 870k | docstring stringlengths 19 26.7k | func_name stringlengths 1 138 | language stringclasses 1
value | repo stringlengths 7 68 | path stringlengths 5 324 | url stringlengths 46 389 | license stringclasses 7
values |
|---|---|---|---|---|---|---|---|
def test_superuser_service_account_login(
docker_backend: ClusterBackend,
artifact_path: Path,
request: SubRequest,
log_dir: Path,
rsa_keypair: Tuple[str, str],
jwt_token: Callable[[str, str, int], str]
) -> None:
"""
Tests for successful superuser service account login which asserts
... |
Tests for successful superuser service account login which asserts
that the default user has been created during cluster start.
| test_superuser_service_account_login | python | dcos/dcos | test-e2e/test_service_account.py | https://github.com/dcos/dcos/blob/master/test-e2e/test_service_account.py | Apache-2.0 |
def zk_client(static_three_master_cluster: Cluster) -> KazooClient:
"""
ZooKeeper client connected to a given DC/OS cluster.
"""
zk_hostports = ','.join(['{}:2181'.format(m.public_ip_address)
for m in static_three_master_cluster.masters])
retry_policy = KazooRetry(
... |
ZooKeeper client connected to a given DC/OS cluster.
| zk_client | python | dcos/dcos | test-e2e/test_zookeeper_backup.py | https://github.com/dcos/dcos/blob/master/test-e2e/test_zookeeper_backup.py | Apache-2.0 |
def _zk_set_flag(zk: KazooClient, ephemeral: bool = False) -> str:
"""
Store the `FLAG` value in ZooKeeper in a random Znode.
"""
znode = '/{}'.format(uuid.uuid4())
zk.retry(zk.create, znode, makepath=True, ephemeral=ephemeral)
zk.retry(zk.set, znode, FLAG)
return znode |
Store the `FLAG` value in ZooKeeper in a random Znode.
| _zk_set_flag | python | dcos/dcos | test-e2e/test_zookeeper_backup.py | https://github.com/dcos/dcos/blob/master/test-e2e/test_zookeeper_backup.py | Apache-2.0 |
def _zk_flag_exists(zk: KazooClient, znode: str) -> bool:
"""
The `FLAG` value exists in ZooKeeper at `znode` path.
"""
try:
value = zk.retry(zk.get, znode)
except NoNodeError:
return False
return bool(value[0] == FLAG) |
The `FLAG` value exists in ZooKeeper at `znode` path.
| _zk_flag_exists | python | dcos/dcos | test-e2e/test_zookeeper_backup.py | https://github.com/dcos/dcos/blob/master/test-e2e/test_zookeeper_backup.py | Apache-2.0 |
def test_transaction_log_backup_and_restore(
self,
static_three_master_cluster: Cluster,
zk_client: KazooClient,
tmp_path: Path,
request: SubRequest,
log_dir: Path,
) -> None:
"""
In a 3-master cluster, backing up the transaction log of ZooKeeper on
... |
In a 3-master cluster, backing up the transaction log of ZooKeeper on
one node and restoring from the backup on all master results in a
functioning DC/OS cluster with previously backed up Znodes restored.
| test_transaction_log_backup_and_restore | python | dcos/dcos | test-e2e/test_zookeeper_backup.py | https://github.com/dcos/dcos/blob/master/test-e2e/test_zookeeper_backup.py | Apache-2.0 |
def test_snapshot_backup_and_restore(
self,
static_three_master_cluster: Cluster,
zk_client: KazooClient,
tmp_path: Path,
request: SubRequest,
log_dir: Path,
) -> None:
"""
In a 3-master cluster, backing up a snapshot of ZooKeeper on
one node a... |
In a 3-master cluster, backing up a snapshot of ZooKeeper on
one node and restoring from the backup on all master results in a
functioning DC/OS cluster with previously backed up Znodes restored.
| test_snapshot_backup_and_restore | python | dcos/dcos | test-e2e/test_zookeeper_backup.py | https://github.com/dcos/dcos/blob/master/test-e2e/test_zookeeper_backup.py | Apache-2.0 |
def _do_backup(master: Node, backup_local_path: Path) -> None:
"""
Automated ZooKeeper backup procedure.
Intended to be consistent with the documentation.
https://jira.mesosphere.com/browse/DCOS-51647
"""
master.run(args=['systemctl', 'stop', 'dcos-exhibitor'])
backup_name = backup_local_pa... |
Automated ZooKeeper backup procedure.
Intended to be consistent with the documentation.
https://jira.mesosphere.com/browse/DCOS-51647
| _do_backup | python | dcos/dcos | test-e2e/test_zookeeper_backup.py | https://github.com/dcos/dcos/blob/master/test-e2e/test_zookeeper_backup.py | Apache-2.0 |
def _do_restore(all_masters: Set[Node], backup_local_path: Path) -> None:
"""
Automated ZooKeeper restore from backup procedure.
Intended to be consistent with the documentation.
https://jira.mesosphere.com/browse/DCOS-51647
"""
backup_name = backup_local_path.name
backup_remote_path = Path(... |
Automated ZooKeeper restore from backup procedure.
Intended to be consistent with the documentation.
https://jira.mesosphere.com/browse/DCOS-51647
| _do_restore | python | dcos/dcos | test-e2e/test_zookeeper_backup.py | https://github.com/dcos/dcos/blob/master/test-e2e/test_zookeeper_backup.py | Apache-2.0 |
def wait_for_zookeeper_serving(master: Node, count: int) -> None:
"""
Check that ZooKeeper has `count` serving nodes.
"""
nodes = get_exhibitor_status(master.public_ip_address)
print(nodes)
assert len([node for node in nodes if node['description'] == 'serving']) == count |
Check that ZooKeeper has `count` serving nodes.
| wait_for_zookeeper_serving | python | dcos/dcos | test-e2e/test_zookeeper_quorum.py | https://github.com/dcos/dcos/blob/master/test-e2e/test_zookeeper_quorum.py | Apache-2.0 |
def test_zookeeper_quorum_static(
self,
static_three_master_cluster: Cluster,
tmp_path: Path,
request: SubRequest,
log_dir: Path,
) -> None:
"""
Bootstrap on a static master cluster can complete when ZooKeeper
has an available quorum.
"""
... |
Bootstrap on a static master cluster can complete when ZooKeeper
has an available quorum.
| test_zookeeper_quorum_static | python | dcos/dcos | test-e2e/test_zookeeper_quorum.py | https://github.com/dcos/dcos/blob/master/test-e2e/test_zookeeper_quorum.py | Apache-2.0 |
def test_zookeeper_quorum_dynamic(
self,
dynamic_three_master_cluster: Cluster,
tmp_path: Path,
request: SubRequest,
log_dir: Path,
) -> None:
"""
Bootstrap on a dynamic master cluster can complete when ZooKeeper
has an available quorum.
"""
... |
Bootstrap on a dynamic master cluster can complete when ZooKeeper
has an available quorum.
| test_zookeeper_quorum_dynamic | python | dcos/dcos | test-e2e/test_zookeeper_quorum.py | https://github.com/dcos/dcos/blob/master/test-e2e/test_zookeeper_quorum.py | Apache-2.0 |
def __init__(self, servers=None, asset=None, location=None, debug=False):
"""
Loads a set of server urls while applying the Asset() module to each
if specified.
If no asset is provided, then the default asset is used.
Optionally specify a global ContentLocation for a more stric... |
Loads a set of server urls while applying the Asset() module to each
if specified.
If no asset is provided, then the default asset is used.
Optionally specify a global ContentLocation for a more strict means
of handling Attachments.
| __init__ | python | caronc/apprise | apprise/apprise.py | https://github.com/caronc/apprise/blob/master/apprise/apprise.py | BSD-2-Clause |
def instantiate(url, asset=None, tag=None, suppress_exceptions=True):
"""
Returns the instance of a instantiated plugin based on the provided
Server URL. If the url fails to be parsed, then None is returned.
The specified url can be either a string (the URL itself) or a
diction... |
Returns the instance of a instantiated plugin based on the provided
Server URL. If the url fails to be parsed, then None is returned.
The specified url can be either a string (the URL itself) or a
dictionary containing all of the components needed to istantiate
the notificatio... | instantiate | python | caronc/apprise | apprise/apprise.py | https://github.com/caronc/apprise/blob/master/apprise/apprise.py | BSD-2-Clause |
def add(self, servers, asset=None, tag=None):
"""
Adds one or more server URLs into our list.
You can override the global asset if you wish by including it with the
server(s) that you add.
The tag allows you to associate 1 or more tag values to the server(s)
being added... |
Adds one or more server URLs into our list.
You can override the global asset if you wish by including it with the
server(s) that you add.
The tag allows you to associate 1 or more tag values to the server(s)
being added. tagging a service allows you to exclusively access them... | add | python | caronc/apprise | apprise/apprise.py | https://github.com/caronc/apprise/blob/master/apprise/apprise.py | BSD-2-Clause |
def find(self, tag=common.MATCH_ALL_TAG, match_always=True):
"""
Returns a list of all servers matching against the tag specified.
"""
# Build our tag setup
# - top level entries are treated as an 'or'
# - second level (or more) entries are treated as 'and'
... |
Returns a list of all servers matching against the tag specified.
| find | python | caronc/apprise | apprise/apprise.py | https://github.com/caronc/apprise/blob/master/apprise/apprise.py | BSD-2-Clause |
def notify(self, body, title='', notify_type=common.NotifyType.INFO,
body_format=None, tag=common.MATCH_ALL_TAG, match_always=True,
attach=None, interpret_escapes=None):
"""
Send a notification to all the plugins previously loaded.
If the body_format specified is N... |
Send a notification to all the plugins previously loaded.
If the body_format specified is NotifyFormat.MARKDOWN, it will
be converted to HTML if the Notification type expects this.
if the tag is specified (either a string or a set/list/tuple
of strings), then only the notifica... | notify | python | caronc/apprise | apprise/apprise.py | https://github.com/caronc/apprise/blob/master/apprise/apprise.py | BSD-2-Clause |
async def async_notify(self, *args, **kwargs):
"""
Send a notification to all the plugins previously loaded, for
asynchronous callers.
The arguments are identical to those of Apprise.notify().
"""
try:
# Process arguments and build synchronous and asynchrono... |
Send a notification to all the plugins previously loaded, for
asynchronous callers.
The arguments are identical to those of Apprise.notify().
| async_notify | python | caronc/apprise | apprise/apprise.py | https://github.com/caronc/apprise/blob/master/apprise/apprise.py | BSD-2-Clause |
def _create_notify_calls(self, *args, **kwargs):
"""
Creates notifications for all the plugins loaded.
Returns a list of (server, notify() kwargs) tuples for plugins with
parallelism disabled and another list for plugins with parallelism
enabled.
"""
all_calls =... |
Creates notifications for all the plugins loaded.
Returns a list of (server, notify() kwargs) tuples for plugins with
parallelism disabled and another list for plugins with parallelism
enabled.
| _create_notify_calls | python | caronc/apprise | apprise/apprise.py | https://github.com/caronc/apprise/blob/master/apprise/apprise.py | BSD-2-Clause |
def _notify_sequential(*servers_kwargs):
"""
Process a list of notify() calls sequentially and synchronously.
"""
success = True
for (server, kwargs) in servers_kwargs:
try:
# Send notification
result = server.notify(**kwargs)
... |
Process a list of notify() calls sequentially and synchronously.
| _notify_sequential | python | caronc/apprise | apprise/apprise.py | https://github.com/caronc/apprise/blob/master/apprise/apprise.py | BSD-2-Clause |
def _notify_parallel_threadpool(*servers_kwargs):
"""
Process a list of notify() calls in parallel and synchronously.
"""
n_calls = len(servers_kwargs)
# 0-length case
if n_calls == 0:
return True
# There's no need to use a thread pool for just a si... |
Process a list of notify() calls in parallel and synchronously.
| _notify_parallel_threadpool | python | caronc/apprise | apprise/apprise.py | https://github.com/caronc/apprise/blob/master/apprise/apprise.py | BSD-2-Clause |
async def _notify_parallel_asyncio(*servers_kwargs):
"""
Process a list of async_notify() calls in parallel and asynchronously.
"""
n_calls = len(servers_kwargs)
# 0-length case
if n_calls == 0:
return True
# (Unlike with the thread pool, we don't o... |
Process a list of async_notify() calls in parallel and asynchronously.
| _notify_parallel_asyncio | python | caronc/apprise | apprise/apprise.py | https://github.com/caronc/apprise/blob/master/apprise/apprise.py | BSD-2-Clause |
def details(self, lang=None, show_requirements=False, show_disabled=False):
"""
Returns the details associated with the Apprise object
"""
# general object returned
response = {
# Defines the current version of Apprise
'version': __version__,
... |
Returns the details associated with the Apprise object
| details | python | caronc/apprise | apprise/apprise.py | https://github.com/caronc/apprise/blob/master/apprise/apprise.py | BSD-2-Clause |
def urls(self, privacy=False):
"""
Returns all of the loaded URLs defined in this apprise object.
"""
urls = []
for s in self.servers:
if isinstance(s, (ConfigBase, AppriseConfig)):
for _s in s.servers():
urls.append(_s.url(privacy=... |
Returns all of the loaded URLs defined in this apprise object.
| urls | python | caronc/apprise | apprise/apprise.py | https://github.com/caronc/apprise/blob/master/apprise/apprise.py | BSD-2-Clause |
def pop(self, index):
"""
Removes an indexed Notification Service from the stack and returns it.
The thing is we can never pop AppriseConfig() entries, only what was
loaded within them. So pop needs to carefully iterate over our list
and only track actual entries.
"""
... |
Removes an indexed Notification Service from the stack and returns it.
The thing is we can never pop AppriseConfig() entries, only what was
loaded within them. So pop needs to carefully iterate over our list
and only track actual entries.
| pop | python | caronc/apprise | apprise/apprise.py | https://github.com/caronc/apprise/blob/master/apprise/apprise.py | BSD-2-Clause |
def __getitem__(self, index):
"""
Returns the indexed server entry of a loaded notification server
"""
# Tracking variables
prev_offset = -1
offset = prev_offset
for idx, s in enumerate(self.servers):
if isinstance(s, (ConfigBase, AppriseConfig)):
... |
Returns the indexed server entry of a loaded notification server
| __getitem__ | python | caronc/apprise | apprise/apprise.py | https://github.com/caronc/apprise/blob/master/apprise/apprise.py | BSD-2-Clause |
def __iter__(self):
"""
Returns an iterator to each of our servers loaded. This includes those
found inside configuration.
"""
return chain(*[[s] if not isinstance(s, (ConfigBase, AppriseConfig))
else iter(s.servers()) for s in self.servers]) |
Returns an iterator to each of our servers loaded. This includes those
found inside configuration.
| __iter__ | python | caronc/apprise | apprise/apprise.py | https://github.com/caronc/apprise/blob/master/apprise/apprise.py | BSD-2-Clause |
def __len__(self):
"""
Returns the number of servers loaded; this includes those found within
loaded configuration. This funtion nnever actually counts the
Config entry themselves (if they exist), only what they contain.
"""
return sum([1 if not isinstance(s, (ConfigBase,... |
Returns the number of servers loaded; this includes those found within
loaded configuration. This funtion nnever actually counts the
Config entry themselves (if they exist), only what they contain.
| __len__ | python | caronc/apprise | apprise/apprise.py | https://github.com/caronc/apprise/blob/master/apprise/apprise.py | BSD-2-Clause |
def __init__(self, paths=None, asset=None, cache=True, location=None,
**kwargs):
"""
Loads all of the paths/urls specified (if any).
The path can either be a single string identifying one explicit
location, otherwise you can pass in a series of locations to scan
... |
Loads all of the paths/urls specified (if any).
The path can either be a single string identifying one explicit
location, otherwise you can pass in a series of locations to scan
via a list.
By default we cache our responses so that subsiquent calls does not
cause the c... | __init__ | python | caronc/apprise | apprise/apprise_attachment.py | https://github.com/caronc/apprise/blob/master/apprise/apprise_attachment.py | BSD-2-Clause |
def add(self, attachments, asset=None, cache=None):
"""
Adds one or more attachments into our list.
By default we cache our responses so that subsiquent calls does not
cause the content to be retrieved again. For local file references
this makes no difference at all. But for r... |
Adds one or more attachments into our list.
By default we cache our responses so that subsiquent calls does not
cause the content to be retrieved again. For local file references
this makes no difference at all. But for remote content, this does
mean more then one call can be... | add | python | caronc/apprise | apprise/apprise_attachment.py | https://github.com/caronc/apprise/blob/master/apprise/apprise_attachment.py | BSD-2-Clause |
def instantiate(url, asset=None, cache=None, suppress_exceptions=True):
"""
Returns the instance of a instantiated attachment plugin based on
the provided Attachment URL. If the url fails to be parsed, then None
is returned.
A specified cache value will over-ride anything set
... |
Returns the instance of a instantiated attachment plugin based on
the provided Attachment URL. If the url fails to be parsed, then None
is returned.
A specified cache value will over-ride anything set
| instantiate | python | caronc/apprise | apprise/apprise_attachment.py | https://github.com/caronc/apprise/blob/master/apprise/apprise_attachment.py | BSD-2-Clause |
def add(self, configs, asset=None, tag=None, cache=True, recursion=None,
insecure_includes=None):
"""
Adds one or more config URLs into our list.
You can override the global asset if you wish by including it with the
config(s) that you add.
By default we cache our r... |
Adds one or more config URLs into our list.
You can override the global asset if you wish by including it with the
config(s) that you add.
By default we cache our responses so that subsiquent calls does not
cause the content to be retrieved again. Setting this to False does
... | add | python | caronc/apprise | apprise/apprise_config.py | https://github.com/caronc/apprise/blob/master/apprise/apprise_config.py | BSD-2-Clause |
def add_config(self, content, asset=None, tag=None, format=None,
recursion=None, insecure_includes=None):
"""
Adds one configuration file in it's raw format. Content gets loaded as
a memory based object and only exists for the life of this
AppriseConfig object it was l... |
Adds one configuration file in it's raw format. Content gets loaded as
a memory based object and only exists for the life of this
AppriseConfig object it was loaded into.
If you know the format ('yaml' or 'text') you can specify
it for slightly less overhead during this call. ... | add_config | python | caronc/apprise | apprise/apprise_config.py | https://github.com/caronc/apprise/blob/master/apprise/apprise_config.py | BSD-2-Clause |
def servers(self, tag=common.MATCH_ALL_TAG, match_always=True, *args,
**kwargs):
"""
Returns all of our servers dynamically build based on parsed
configuration.
If a tag is specified, it applies to the configuration sources
themselves and not the notification ser... |
Returns all of our servers dynamically build based on parsed
configuration.
If a tag is specified, it applies to the configuration sources
themselves and not the notification services inside them.
This is for filtering the configuration files polled for
results.
... | servers | python | caronc/apprise | apprise/apprise_config.py | https://github.com/caronc/apprise/blob/master/apprise/apprise_config.py | BSD-2-Clause |
def instantiate(url, asset=None, tag=None, cache=None,
recursion=0, insecure_includes=False,
suppress_exceptions=True):
"""
Returns the instance of a instantiated configuration plugin based on
the provided Config URL. If the url fails to be parsed, then N... |
Returns the instance of a instantiated configuration plugin based on
the provided Config URL. If the url fails to be parsed, then None
is returned.
| instantiate | python | caronc/apprise | apprise/apprise_config.py | https://github.com/caronc/apprise/blob/master/apprise/apprise_config.py | BSD-2-Clause |
def server_pop(self, index):
"""
Removes an indexed Apprise Notification from the servers
"""
# Tracking variables
prev_offset = -1
offset = prev_offset
for entry in self.configs:
servers = entry.servers(cache=True)
if len(servers) > 0:
... |
Removes an indexed Apprise Notification from the servers
| server_pop | python | caronc/apprise | apprise/apprise_config.py | https://github.com/caronc/apprise/blob/master/apprise/apprise_config.py | BSD-2-Clause |
def color(self, notify_type, color_type=None):
"""
Returns an HTML mapped color based on passed in notify type
if color_type is:
None then a standard hex string is returned as
a string format ('#000000').
int then the integer representation is re... |
Returns an HTML mapped color based on passed in notify type
if color_type is:
None then a standard hex string is returned as
a string format ('#000000').
int then the integer representation is returned
tuple then the the red, green, blue is... | color | python | caronc/apprise | apprise/asset.py | https://github.com/caronc/apprise/blob/master/apprise/asset.py | BSD-2-Clause |
def ascii(self, notify_type):
"""
Returns an ascii representation based on passed in notify type
"""
# look our response up
return self.ascii_notify_map.get(notify_type, self.default_ascii_chars) |
Returns an ascii representation based on passed in notify type
| ascii | python | caronc/apprise | apprise/asset.py | https://github.com/caronc/apprise/blob/master/apprise/asset.py | BSD-2-Clause |
def image_url(self, notify_type, image_size, logo=False, extension=None):
"""
Apply our mask to our image URL
if logo is set to True, then the logo_url is used instead
"""
url_mask = self.image_url_logo if logo else self.image_url_mask
if not url_mask:
# No... |
Apply our mask to our image URL
if logo is set to True, then the logo_url is used instead
| image_url | python | caronc/apprise | apprise/asset.py | https://github.com/caronc/apprise/blob/master/apprise/asset.py | BSD-2-Clause |
def image_path(self, notify_type, image_size, must_exist=True,
extension=None):
"""
Apply our mask to our image file path
"""
if not self.image_path_mask:
# No image to return
return None
if extension is None:
extension = ... |
Apply our mask to our image file path
| image_path | python | caronc/apprise | apprise/asset.py | https://github.com/caronc/apprise/blob/master/apprise/asset.py | BSD-2-Clause |
def image_raw(self, notify_type, image_size, extension=None):
"""
Returns the raw image if it can (otherwise the function returns None)
"""
path = self.image_path(
notify_type=notify_type,
image_size=image_size,
extension=extension,
)
... |
Returns the raw image if it can (otherwise the function returns None)
| image_raw | python | caronc/apprise | apprise/asset.py | https://github.com/caronc/apprise/blob/master/apprise/asset.py | BSD-2-Clause |
def details(self):
"""
Returns the details associated with the AppriseAsset object
"""
return {
'app_id': self.app_id,
'app_desc': self.app_desc,
'default_extension': self.default_extension,
'theme': self.theme,
'image_path_mas... |
Returns the details associated with the AppriseAsset object
| details | python | caronc/apprise | apprise/asset.py | https://github.com/caronc/apprise/blob/master/apprise/asset.py | BSD-2-Clause |
def hex_to_rgb(value):
"""
Takes a hex string (such as #00ff00) and returns a tuple in the form
of (red, green, blue)
eg: #00ff00 becomes : (0, 65535, 0)
"""
value = value.lstrip('#')
lv = len(value)
return tuple(int(value[i:i + lv // 3], 16)
... |
Takes a hex string (such as #00ff00) and returns a tuple in the form
of (red, green, blue)
eg: #00ff00 becomes : (0, 65535, 0)
| hex_to_rgb | python | caronc/apprise | apprise/asset.py | https://github.com/caronc/apprise/blob/master/apprise/asset.py | BSD-2-Clause |
def print_version_msg():
"""
Prints version message when -V or --version is specified.
"""
result = list()
result.append('{} v{}'.format(__title__, __version__))
result.append(__copywrite__)
result.append(
'This code is licensed under the {} License.'.format(__license__))
click.... |
Prints version message when -V or --version is specified.
| print_version_msg | python | caronc/apprise | apprise/cli.py | https://github.com/caronc/apprise/blob/master/apprise/cli.py | BSD-2-Clause |
def main(ctx, body, title, config, attach, urls, notification_type, theme, tag,
input_format, dry_run, recursion_depth, verbose, disable_async,
details, interpret_escapes, interpret_emojis, plugin_path,
storage_path, storage_mode, storage_prune_days, storage_uid_length,
debug, versio... |
Send a notification to all of the specified servers identified by their
URLs the content provided within the title, body and notification-type.
For a list of all of the supported services and information on how to
use them, check out at https://github.com/caronc/apprise
| main | python | caronc/apprise | apprise/cli.py | https://github.com/caronc/apprise/blob/master/apprise/cli.py | BSD-2-Clause |
def convert_between(from_format, to_format, content):
"""
Converts between different suported formats. If no conversion exists,
or the selected one fails, the original text will be returned.
This function returns the content translated (if required)
"""
converters = {
(NotifyFormat.MAR... |
Converts between different suported formats. If no conversion exists,
or the selected one fails, the original text will be returned.
This function returns the content translated (if required)
| convert_between | python | caronc/apprise | apprise/conversion.py | https://github.com/caronc/apprise/blob/master/apprise/conversion.py | BSD-2-Clause |
def text_to_html(content):
"""
Converts specified content from plain text to HTML.
"""
# First eliminate any carriage returns
return URLBase.escape_html(content, convert_new_lines=True) |
Converts specified content from plain text to HTML.
| text_to_html | python | caronc/apprise | apprise/conversion.py | https://github.com/caronc/apprise/blob/master/apprise/conversion.py | BSD-2-Clause |
def html_to_text(content):
"""
Converts a content from HTML to plain text.
"""
parser = HTMLConverter()
parser.feed(content)
parser.close()
return parser.converted |
Converts a content from HTML to plain text.
| html_to_text | python | caronc/apprise | apprise/conversion.py | https://github.com/caronc/apprise/blob/master/apprise/conversion.py | BSD-2-Clause |
def _finalize(self, result):
"""
Combines and strips consecutive strings, then converts consecutive
block ends into singleton newlines.
[ {be} " Hello " {be} {be} " World!" ] -> "\nHello\nWorld!"
"""
# None means the last visited item was a block end.
accum = No... |
Combines and strips consecutive strings, then converts consecutive
block ends into singleton newlines.
[ {be} " Hello " {be} {be} " World!" ] -> "
Hello
World!"
| _finalize | python | caronc/apprise | apprise/conversion.py | https://github.com/caronc/apprise/blob/master/apprise/conversion.py | BSD-2-Clause |
def handle_data(self, data, *args, **kwargs):
"""
Store our data if it is not on the ignore list
"""
# initialize our previous flag
if self._do_store:
# Tidy our whitespace
content = self.WS_TRIM.sub(' ', data)
self._result.append(content) |
Store our data if it is not on the ignore list
| handle_data | python | caronc/apprise | apprise/conversion.py | https://github.com/caronc/apprise/blob/master/apprise/conversion.py | BSD-2-Clause |
def handle_endtag(self, tag):
"""
Edge case handling of open/close tags
"""
self._do_store = True
if tag in self.BLOCK_TAGS:
self._result.append(self.BLOCK_END) |
Edge case handling of open/close tags
| handle_endtag | python | caronc/apprise | apprise/conversion.py | https://github.com/caronc/apprise/blob/master/apprise/conversion.py | BSD-2-Clause |
def apply_emojis(content):
"""
Takes the content and swaps any matched emoji's found with their
utf-8 encoded mapping
"""
global EMOJI_COMPILED_MAP
if EMOJI_COMPILED_MAP is None:
t_start = time.time()
# Perform our compilation
EMOJI_COMPILED_MAP = re.compile(
... |
Takes the content and swaps any matched emoji's found with their
utf-8 encoded mapping
| apply_emojis | python | caronc/apprise | apprise/emojis.py | https://github.com/caronc/apprise/blob/master/apprise/emojis.py | BSD-2-Clause |
def __init__(self, language=None):
"""
Initializes our object, if a language is specified, then we
initialize ourselves to that, otherwise we use whatever we detect
from the local operating system. If all else fails, we resort to the
defined default_language.
"""
... |
Initializes our object, if a language is specified, then we
initialize ourselves to that, otherwise we use whatever we detect
from the local operating system. If all else fails, we resort to the
defined default_language.
| __init__ | python | caronc/apprise | apprise/locale.py | https://github.com/caronc/apprise/blob/master/apprise/locale.py | BSD-2-Clause |
def lang_at(self, lang, mapto=_fn):
"""
The syntax works as:
with at.lang_at('fr'):
# apprise works as though the french language has been
# defined. afterwards, the language falls back to whatever
# it was.
"""
if GETTEXT_LOAD... |
The syntax works as:
with at.lang_at('fr'):
# apprise works as though the french language has been
# defined. afterwards, the language falls back to whatever
# it was.
| lang_at | python | caronc/apprise | apprise/locale.py | https://github.com/caronc/apprise/blob/master/apprise/locale.py | BSD-2-Clause |
def detect_language(lang=None, detect_fallback=True):
"""
Returns the language (if it's retrievable)
"""
# We want to only use the 2 character version of this language
# hence en_CA becomes en, en_US becomes en.
if not isinstance(lang, str):
if detect_fallback... |
Returns the language (if it's retrievable)
| detect_language | python | caronc/apprise | apprise/locale.py | https://github.com/caronc/apprise/blob/master/apprise/locale.py | BSD-2-Clause |
def __init__(self, path=None, level=None, name=LOGGER_NAME, delete=True,
fmt='%(asctime)s - %(levelname)s - %(message)s'):
"""
Instantiate a temporary log capture object
If a path is specified, then log content is sent to that file instead
of a StringIO object.
... |
Instantiate a temporary log capture object
If a path is specified, then log content is sent to that file instead
of a StringIO object.
You can optionally specify a logging level such as logging.INFO if you
wish, otherwise by default the script uses whatever logging has been
... | __init__ | python | caronc/apprise | apprise/logger.py | https://github.com/caronc/apprise/blob/master/apprise/logger.py | BSD-2-Clause |
def __enter__(self):
"""
Allows logger manipulation within a 'with' block
"""
if self.__level is not None:
# Temporary adjust our log level if required
self.__restore_level = self.__logger.getEffectiveLevel()
if self.__restore_level > self.__level:
... |
Allows logger manipulation within a 'with' block
| __enter__ | python | caronc/apprise | apprise/logger.py | https://github.com/caronc/apprise/blob/master/apprise/logger.py | BSD-2-Clause |
def __exit__(self, exc_type, exc_value, tb):
"""
removes the handler gracefully when the with block has completed
"""
# Flush our content
self.__handler.flush()
self.__buffer_ptr.flush()
# Drop our handler
self.__logger.removeHandler(self.__handler)
... |
removes the handler gracefully when the with block has completed
| __exit__ | python | caronc/apprise | apprise/logger.py | https://github.com/caronc/apprise/blob/master/apprise/logger.py | BSD-2-Clause |
def __init__(self, *args, **kwargs):
"""
Over-ride our class instantiation to provide a singleton
"""
self._module_map = None
self._schema_map = None
# This contains a mapping of all plugins dynamicaly loaded at runtime
# from external modules such as the @notif... |
Over-ride our class instantiation to provide a singleton
| __init__ | python | caronc/apprise | apprise/manager.py | https://github.com/caronc/apprise/blob/master/apprise/manager.py | BSD-2-Clause |
def unload_modules(self, disable_native=False):
"""
Reset our object and unload all modules
"""
with self._lock:
if self._custom_module_map:
# Handle Custom Module Assignments
for meta in self._custom_module_map.values():
i... |
Reset our object and unload all modules
| unload_modules | python | caronc/apprise | apprise/manager.py | https://github.com/caronc/apprise/blob/master/apprise/manager.py | BSD-2-Clause |
def module_detection(self, paths, cache=True):
"""
Leverage the @notify decorator and load all objects found matching
this.
"""
# A simple restriction that we don't allow periods in the filename at
# all so it can't be hidden (Linux OS's) and it won't conflict with
... |
Leverage the @notify decorator and load all objects found matching
this.
| module_detection | python | caronc/apprise | apprise/manager.py | https://github.com/caronc/apprise/blob/master/apprise/manager.py | BSD-2-Clause |
def add(self, plugin, schemas=None, url=None, send_func=None):
"""
Ability to manually add Notification services to our stack
"""
if not self:
# Lazy load
self.load_modules()
# Acquire a list of schemas
p_schemas = parse_list(plugin.secure_protoc... |
Ability to manually add Notification services to our stack
| add | python | caronc/apprise | apprise/manager.py | https://github.com/caronc/apprise/blob/master/apprise/manager.py | BSD-2-Clause |
def plugins(self, include_disabled=True):
"""
Return all of our loaded plugins
"""
if not self:
# Lazy load
self.load_modules()
for module in self._module_map.values():
for plugin in module['plugin']:
if not include_disabled an... |
Return all of our loaded plugins
| plugins | python | caronc/apprise | apprise/manager.py | https://github.com/caronc/apprise/blob/master/apprise/manager.py | BSD-2-Clause |
def schemas(self, include_disabled=True):
"""
Return all of our loaded schemas
if include_disabled == True, then even disabled notifications are
returned
"""
if not self:
# Lazy load
self.load_modules()
# Return our list
return li... |
Return all of our loaded schemas
if include_disabled == True, then even disabled notifications are
returned
| schemas | python | caronc/apprise | apprise/manager.py | https://github.com/caronc/apprise/blob/master/apprise/manager.py | BSD-2-Clause |
def disable(self, *schemas):
"""
Disables the modules associated with the specified schemas
"""
if not self:
# Lazy load
self.load_modules()
for schema in schemas:
if schema not in self._schema_map:
continue
if not... |
Disables the modules associated with the specified schemas
| disable | python | caronc/apprise | apprise/manager.py | https://github.com/caronc/apprise/blob/master/apprise/manager.py | BSD-2-Clause |
def __setitem__(self, schema, plugin):
"""
Support fast assigning of Plugin/Notification Objects
"""
if not self:
# Lazy load
self.load_modules()
# Set default values if not otherwise set
if not plugin.service_name:
# Assign service na... |
Support fast assigning of Plugin/Notification Objects
| __setitem__ | python | caronc/apprise | apprise/manager.py | https://github.com/caronc/apprise/blob/master/apprise/manager.py | BSD-2-Clause |
def __getitem__(self, schema):
"""
Returns the indexed plugin identified by the schema specified
"""
if not self:
# Lazy load
self.load_modules()
return self._schema_map[schema] |
Returns the indexed plugin identified by the schema specified
| __getitem__ | python | caronc/apprise | apprise/manager.py | https://github.com/caronc/apprise/blob/master/apprise/manager.py | BSD-2-Clause |
def __iter__(self):
"""
Returns an iterator so we can iterate over our loaded modules
"""
if not self:
# Lazy load
self.load_modules()
return iter(self._module_map.values()) |
Returns an iterator so we can iterate over our loaded modules
| __iter__ | python | caronc/apprise | apprise/manager.py | https://github.com/caronc/apprise/blob/master/apprise/manager.py | BSD-2-Clause |
def __len__(self):
"""
Returns the number of modules/plugins loaded
"""
if not self:
# Lazy load
self.load_modules()
return len(self._module_map) |
Returns the number of modules/plugins loaded
| __len__ | python | caronc/apprise | apprise/manager.py | https://github.com/caronc/apprise/blob/master/apprise/manager.py | BSD-2-Clause |
def set(self, value, expires=None, persistent=None):
"""
Sets fields on demand, if set to none, then they are left as is
The intent of set is that it allows you to set a new a value
and optionally alter meta information against it.
If expires or persistent isn't specified then ... |
Sets fields on demand, if set to none, then they are left as is
The intent of set is that it allows you to set a new a value
and optionally alter meta information against it.
If expires or persistent isn't specified then their previous values
are used.
| set | python | caronc/apprise | apprise/persistent_store.py | https://github.com/caronc/apprise/blob/master/apprise/persistent_store.py | BSD-2-Clause |
def hash(self):
"""
Our checksum to track the validity of our data
"""
try:
return self.hash_engine(
str(self).encode('utf-8'), usedforsecurity=False).hexdigest()
except TypeError:
# Python <= v3.8 - usedforsecurity flag does not work
... |
Our checksum to track the validity of our data
| hash | python | caronc/apprise | apprise/persistent_store.py | https://github.com/caronc/apprise/blob/master/apprise/persistent_store.py | BSD-2-Clause |
def instantiate(content, persistent=True, verify=True):
"""
Loads back data read in and returns a CacheObject or None if it could
not be loaded. You can pass in the contents of CacheObject.json() and
you'll receive a copy assuming the hash checks okay
"""
try:
... |
Loads back data read in and returns a CacheObject or None if it could
not be loaded. You can pass in the contents of CacheObject.json() and
you'll receive a copy assuming the hash checks okay
| instantiate | python | caronc/apprise | apprise/persistent_store.py | https://github.com/caronc/apprise/blob/master/apprise/persistent_store.py | BSD-2-Clause |
def expires_sec(self):
"""
Returns the number of seconds from now the object will expire
"""
return None if self.__expires is None else max(
0.0, (self.__expires - datetime.now(tz=timezone.utc))
.total_seconds()) |
Returns the number of seconds from now the object will expire
| expires_sec | python | caronc/apprise | apprise/persistent_store.py | https://github.com/caronc/apprise/blob/master/apprise/persistent_store.py | BSD-2-Clause |
def __bool__(self):
"""
Returns True it the object hasn't expired, and False if it has
"""
if self.__expires is None:
# No Expiry
return True
# Calculate if we've expired or not
return self.__expires > datetime.now(tz=timezone.utc) |
Returns True it the object hasn't expired, and False if it has
| __bool__ | python | caronc/apprise | apprise/persistent_store.py | https://github.com/caronc/apprise/blob/master/apprise/persistent_store.py | BSD-2-Clause |
def __init__(self, path=None, namespace='default', mode=None):
"""
Provide the namespace to work within. namespaces can only contain
alpha-numeric characters with the exception of '-' (dash), '_'
(underscore), and '.' (period). The namespace must be be relative
to the current URL... |
Provide the namespace to work within. namespaces can only contain
alpha-numeric characters with the exception of '-' (dash), '_'
(underscore), and '.' (period). The namespace must be be relative
to the current URL being controlled.
| __init__ | python | caronc/apprise | apprise/persistent_store.py | https://github.com/caronc/apprise/blob/master/apprise/persistent_store.py | BSD-2-Clause |
def read(self, key=None, compress=True, expires=False):
"""
Returns the content of the persistent store object
if refresh is set to True, then the file's modify time is updated
preventing it from getting caught in prune calls. It's a means
of allowing it to persist and not get ... |
Returns the content of the persistent store object
if refresh is set to True, then the file's modify time is updated
preventing it from getting caught in prune calls. It's a means
of allowing it to persist and not get cleaned up in later prune
calls.
Content is always... | read | python | caronc/apprise | apprise/persistent_store.py | https://github.com/caronc/apprise/blob/master/apprise/persistent_store.py | BSD-2-Clause |
def __move(self, src, dst):
"""
Moves the new file in place and handles the old if it exists already
If the transaction fails in any way, the old file is swapped back.
Function returns True if successful and False if not.
"""
# A temporary backup of the file we want to ... |
Moves the new file in place and handles the old if it exists already
If the transaction fails in any way, the old file is swapped back.
Function returns True if successful and False if not.
| __move | python | caronc/apprise | apprise/persistent_store.py | https://github.com/caronc/apprise/blob/master/apprise/persistent_store.py | BSD-2-Clause |
def open(self, key=None, mode='r', buffering=-1, encoding=None,
errors=None, newline=None, closefd=True, opener=None,
compress=False, compresslevel=9):
"""
Returns an iterator to our our file within our namespace identified
by the key provided.
If no key is pro... |
Returns an iterator to our our file within our namespace identified
by the key provided.
If no key is provided, then the default is used
| open | python | caronc/apprise | apprise/persistent_store.py | https://github.com/caronc/apprise/blob/master/apprise/persistent_store.py | BSD-2-Clause |
def clear(self, *args):
"""
Remove one or more cache entry by it's key
e.g: clear('key')
clear('key1', 'key2', key-12')
Or clear everything:
clear()
"""
if self._cache is None and not self.__load_cache():
return False
... |
Remove one or more cache entry by it's key
e.g: clear('key')
clear('key1', 'key2', key-12')
Or clear everything:
clear()
| clear | python | caronc/apprise | apprise/persistent_store.py | https://github.com/caronc/apprise/blob/master/apprise/persistent_store.py | BSD-2-Clause |
def __load_cache(self, _recovery=False):
"""
Loads our cache
_recovery is reserved for internal usage and should not be changed
"""
# Prepare our dirty flag
self.__dirty = False
if self.__mode == PersistentStoreMode.MEMORY:
# Nothing further to do
... |
Loads our cache
_recovery is reserved for internal usage and should not be changed
| __load_cache | python | caronc/apprise | apprise/persistent_store.py | https://github.com/caronc/apprise/blob/master/apprise/persistent_store.py | BSD-2-Clause |
def disk_scan(path, namespace=None, closest=True):
"""
Scansk a path provided and returns namespaces detected
"""
logger.trace('Persistent path can of: %s', path)
def is_namespace(x):
"""
Validate what was detected is a valid namespace
"""
... |
Scansk a path provided and returns namespaces detected
| disk_scan | python | caronc/apprise | apprise/persistent_store.py | https://github.com/caronc/apprise/blob/master/apprise/persistent_store.py | BSD-2-Clause |
def disk_prune(path, namespace=None, expires=None, action=False):
"""
Prune persistent disk storage entries that are old and/or unreferenced
you must specify a path to perform the prune within
if one or more namespaces are provided, then pruning focuses ONLY on
those entries (i... |
Prune persistent disk storage entries that are old and/or unreferenced
you must specify a path to perform the prune within
if one or more namespaces are provided, then pruning focuses ONLY on
those entries (if matched).
if action is not set to False, directories to be removed... | disk_prune | python | caronc/apprise | apprise/persistent_store.py | https://github.com/caronc/apprise/blob/master/apprise/persistent_store.py | BSD-2-Clause |
def size(self, exclude=True, lazy=True):
"""
Returns the total size of the persistent storage in bytes
"""
if lazy and self.__cache_size is not None:
# Take an early exit
return self.__cache_size
elif self.__mode == PersistentStoreMode.MEMORY:
... |
Returns the total size of the persistent storage in bytes
| size | python | caronc/apprise | apprise/persistent_store.py | https://github.com/caronc/apprise/blob/master/apprise/persistent_store.py | BSD-2-Clause |
def __delitem__(self, key):
"""
Remove a cache entry by it's key
"""
if self._cache is None and not self.__load_cache():
raise KeyError("Could not initialize cache")
try:
if self._cache[key].persistent:
# Set our dirty flag in advance
... |
Remove a cache entry by it's key
| __delitem__ | python | caronc/apprise | apprise/persistent_store.py | https://github.com/caronc/apprise/blob/master/apprise/persistent_store.py | BSD-2-Clause |
def __contains__(self, key):
"""
Verify if our storage contains the key specified or not.
In additiont to this, if the content is expired, it is considered
to be not contained in the storage.
"""
if self._cache is None and not self.__load_cache():
return False... |
Verify if our storage contains the key specified or not.
In additiont to this, if the content is expired, it is considered
to be not contained in the storage.
| __contains__ | python | caronc/apprise | apprise/persistent_store.py | https://github.com/caronc/apprise/blob/master/apprise/persistent_store.py | BSD-2-Clause |
def __setitem__(self, key, value):
"""
Sets a cache value without disrupting existing settings in place
"""
if self._cache is None and not self.__load_cache():
raise KeyError("Could not initialize cache")
if key not in self._cache and not self.set(key, value):
... |
Sets a cache value without disrupting existing settings in place
| __setitem__ | python | caronc/apprise | apprise/persistent_store.py | https://github.com/caronc/apprise/blob/master/apprise/persistent_store.py | BSD-2-Clause |
def delete(self, *args, all=None, temp=None, cache=None, validate=True):
"""
Manages our file space and tidys it up
delete('key', 'key2')
delete(all=True)
delete(temp=True, cache=True)
"""
# Our failure flag
has_error = False
valid_key_re = re.c... |
Manages our file space and tidys it up
delete('key', 'key2')
delete(all=True)
delete(temp=True, cache=True)
| delete | python | caronc/apprise | apprise/persistent_store.py | https://github.com/caronc/apprise/blob/master/apprise/persistent_store.py | BSD-2-Clause |
def cache_file(self):
"""
Returns the full path to the namespace directory
"""
return os.path.join(
self.__base_path,
f'{self.__cache_key}{self.__extension}',
) |
Returns the full path to the namespace directory
| cache_file | python | caronc/apprise | apprise/persistent_store.py | https://github.com/caronc/apprise/blob/master/apprise/persistent_store.py | BSD-2-Clause |
def __init__(self, asset=None, **kwargs):
"""
Initialize some general logging and common server arguments that will
keep things consistent when working with the children that
inherit this class.
"""
# Prepare our Asset Object
self.asset = \
asset if i... |
Initialize some general logging and common server arguments that will
keep things consistent when working with the children that
inherit this class.
| __init__ | python | caronc/apprise | apprise/url.py | https://github.com/caronc/apprise/blob/master/apprise/url.py | BSD-2-Clause |
def throttle(self, last_io=None, wait=None):
"""
A common throttle control
if a wait is specified, then it will force a sleep of the
specified time if it is larger then the calculated throttle
time.
"""
if last_io is not None:
# Assume specified last... |
A common throttle control
if a wait is specified, then it will force a sleep of the
specified time if it is larger then the calculated throttle
time.
| throttle | python | caronc/apprise | apprise/url.py | https://github.com/caronc/apprise/blob/master/apprise/url.py | BSD-2-Clause |
def url(self, privacy=False, *args, **kwargs):
"""
Assembles the URL associated with the notification based on the
arguments provied.
"""
# Our default parameters
params = self.url_parameters(privacy=privacy, *args, **kwargs)
# Determine Authentication
... |
Assembles the URL associated with the notification based on the
arguments provied.
| url | python | caronc/apprise | apprise/url.py | https://github.com/caronc/apprise/blob/master/apprise/url.py | BSD-2-Clause |
def url_id(self, lazy=True, hash_engine=hashlib.sha256):
"""
Returns a unique URL identifier that representing the Apprise URL
itself. The url_id is always a hash string or None if it can't
be generated.
The idea is to only build the ID based on the credentials or specific
... |
Returns a unique URL identifier that representing the Apprise URL
itself. The url_id is always a hash string or None if it can't
be generated.
The idea is to only build the ID based on the credentials or specific
elements relative to the URL itself. The URL ID should never fact... | url_id | python | caronc/apprise | apprise/url.py | https://github.com/caronc/apprise/blob/master/apprise/url.py | BSD-2-Clause |
def __contains__(self, tags):
"""
Returns true if the tag specified is associated with this notification.
tag can also be a tuple, set, and/or list
"""
if isinstance(tags, (tuple, set, list)):
return bool(set(tags) & self.tags)
# return any match
re... |
Returns true if the tag specified is associated with this notification.
tag can also be a tuple, set, and/or list
| __contains__ | python | caronc/apprise | apprise/url.py | https://github.com/caronc/apprise/blob/master/apprise/url.py | BSD-2-Clause |
def escape_html(html, convert_new_lines=False, whitespace=True):
"""
Takes html text as input and escapes it so that it won't
conflict with any xml/html wrapping characters.
Args:
html (str): The HTML code to escape
convert_new_lines (:obj:`bool`, optional): esca... |
Takes html text as input and escapes it so that it won't
conflict with any xml/html wrapping characters.
Args:
html (str): The HTML code to escape
convert_new_lines (:obj:`bool`, optional): escape new lines (
)
whitespace (:obj:`bool`, optional): escape whit... | escape_html | python | caronc/apprise | apprise/url.py | https://github.com/caronc/apprise/blob/master/apprise/url.py | BSD-2-Clause |
def unquote(content, encoding='utf-8', errors='replace'):
"""
Replace %xx escapes by their single-character equivalent. The optional
encoding and errors parameters specify how to decode percent-encoded
sequences.
Wrapper to Python's `unquote` while remaining compatible with both... |
Replace %xx escapes by their single-character equivalent. The optional
encoding and errors parameters specify how to decode percent-encoded
sequences.
Wrapper to Python's `unquote` while remaining compatible with both
Python 2 & 3 since the reference to this function changed be... | unquote | python | caronc/apprise | apprise/url.py | https://github.com/caronc/apprise/blob/master/apprise/url.py | BSD-2-Clause |
def quote(content, safe='/', encoding=None, errors=None):
""" Replaces single character non-ascii characters and URI specific
ones by their %xx code.
Wrapper to Python's `quote` while remaining compatible with both
Python 2 & 3 since the reference to this function changed between
... | Replaces single character non-ascii characters and URI specific
ones by their %xx code.
Wrapper to Python's `quote` while remaining compatible with both
Python 2 & 3 since the reference to this function changed between
versions.
Args:
content (str): The URI string ... | quote | python | caronc/apprise | apprise/url.py | https://github.com/caronc/apprise/blob/master/apprise/url.py | BSD-2-Clause |
def pprint(content, privacy=True, mode=PrivacyMode.Outer,
# privacy print; quoting is ignored when privacy is set to True
quote=True, safe='/', encoding=None, errors=None):
"""
Privacy Print is used to mainpulate the string before passing it into
part of the URL. I... |
Privacy Print is used to mainpulate the string before passing it into
part of the URL. It is used to mask/hide private details such as
tokens, passwords, apikeys, etc from on-lookers. If the privacy=False
is set, then the quote variable is the next flag checked.
Quoting is ne... | pprint | python | caronc/apprise | apprise/url.py | https://github.com/caronc/apprise/blob/master/apprise/url.py | BSD-2-Clause |
def urlencode(query, doseq=False, safe='', encoding=None, errors=None):
"""Convert a mapping object or a sequence of two-element tuples
Wrapper to Python's `urlencode` while remaining compatible with both
Python 2 & 3 since the reference to this function changed between
versions.
... | Convert a mapping object or a sequence of two-element tuples
Wrapper to Python's `urlencode` while remaining compatible with both
Python 2 & 3 since the reference to this function changed between
versions.
The resulting string is a series of key=value pairs separated by '&'
cha... | urlencode | python | caronc/apprise | apprise/url.py | https://github.com/caronc/apprise/blob/master/apprise/url.py | BSD-2-Clause |
def split_path(path, unquote=True):
"""Splits a URL up into a list object.
Parses a specified URL and breaks it into a list.
Args:
path (str): The path to split up into a list.
unquote (:obj:`bool`, optional): call unquote on each element
added to the r... | Splits a URL up into a list object.
Parses a specified URL and breaks it into a list.
Args:
path (str): The path to split up into a list.
unquote (:obj:`bool`, optional): call unquote on each element
added to the returned list.
Returns:
lis... | split_path | python | caronc/apprise | apprise/url.py | https://github.com/caronc/apprise/blob/master/apprise/url.py | BSD-2-Clause |
def parse_phone_no(content, unquote=True, prefix=False):
"""A wrapper to utils.parse_phone_no() with unquoting support
Parses a specified set of data and breaks it into a list.
Args:
content (str): The path to split up into a list. If a list is
provided, then it's ... | A wrapper to utils.parse_phone_no() with unquoting support
Parses a specified set of data and breaks it into a list.
Args:
content (str): The path to split up into a list. If a list is
provided, then it's individual entries are processed.
unquote (:obj:`bool`,... | parse_phone_no | python | caronc/apprise | apprise/url.py | https://github.com/caronc/apprise/blob/master/apprise/url.py | BSD-2-Clause |
def request_url(self):
"""
Assemble a simple URL that can be used by the requests library
"""
# Acquire our schema
schema = 'https' if self.secure else 'http'
# Prepare our URL
url = '%s://%s' % (schema, self.host)
# Apply Port information if present
... |
Assemble a simple URL that can be used by the requests library
| request_url | python | caronc/apprise | apprise/url.py | https://github.com/caronc/apprise/blob/master/apprise/url.py | BSD-2-Clause |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.