appyter.ext package

Subpackages

Submodules

appyter.ext.aiohttp module

appyter.ext.aiohttp.run_app(app, host='127.0.0.1', port=5000, path=None)[source]
appyter.ext.aiohttp.with_app_running(app, host='127.0.0.1', port=5000, path=None, ssl_context=None)[source]

appyter.ext.contextlib module

class appyter.ext.contextlib.ContextManagerAsHandle(inner)[source]

Bases: object

close()[source]
open()[source]
appyter.ext.contextlib.ensure_context(obj)[source]
appyter.ext.contextlib.with_many(**withables)[source]

appyter.ext.cryptography module

appyter.ext.cryptography.adhoc_ssl_context(cn: Optional[str, None] = None, protocol: Optional[int, None] = None)[source]

From https://github.com/pallets/werkzeug/blob/main/src/werkzeug/serving.py Produces an adhoc SSL cert and returns an SSL context for https in development.

appyter.ext.dict module

appyter.ext.dict.dict_collision_free_update(d, **kwargs)[source]
appyter.ext.dict.dict_filter_none(d)[source]
appyter.ext.dict.dict_flatten(d)[source]
appyter.ext.dict.dict_merge(d, **kwargs)[source]
appyter.ext.dict.dict_typed_flatten(d)[source]

dict_flatten but preserves lists & ordering

appyter.ext.dict.dict_typed_unflatten(f)[source]

opposite of dict_typed_unflatten

appyter.ext.dict.dict_unflatten(f)[source]
appyter.ext.dict.expand_dotmap(dotmap)[source]

Convert dot-notation into deep dict

appyter.ext.drs module

appyter.ext.drs.ensure_drs(url)[source]

Ensures a url is accessible via DRS

appyter.ext.emitter module

appyter.ext.emitter.json_emitter_factory(output)[source]
appyter.ext.emitter.url_to_emitter(url)[source]

appyter.ext.exceptions module

appyter.ext.exceptions.exception_as_dict(exc)[source]

appyter.ext.flask module

appyter.ext.flask.decorator_in_production(production_decorator)[source]
appyter.ext.flask.is_remote(url)[source]
appyter.ext.flask.join_routes(*routes)[source]

Utility function for joining routes while striping extraneous slashes

appyter.ext.flask.request_get(request, key, default=None)[source]
appyter.ext.flask.route_join_with_or_without_slash(blueprint, *routes, **kwargs)[source]

Like @app.route but doesn’t care about trailing slash or not

appyter.ext.flask.secure_filepath(filepath)[source]

Ensures this will be a sanitized relative path

appyter.ext.flask.secure_url(url)[source]

appyter.ext.functools module

appyter.ext.functools.ensure_callable(var)[source]
appyter.ext.functools.memcached(func)[source]

Cache all calls to this function in memory permanently

appyter.ext.hashlib module

appyter.ext.hashlib.hashsum_dict(algo, obj)[source]
appyter.ext.hashlib.hashsum_io(algo, io, chunk_size=65536)[source]
appyter.ext.hashlib.hashsum_str(algo, obj)[source]
appyter.ext.hashlib.sha1sum_dict(obj)
appyter.ext.hashlib.sha1sum_io(io, chunk_size=65536)
appyter.ext.hashlib.sha1sum_str(obj)

appyter.ext.importlib module

appyter.ext.importlib.importdir(_dirname_, _package_, _globals_)[source]
appyter.ext.importlib.importdir_deep(_dirname_, _package_, _globals_, filter_mod=<function <lambda>>)[source]

appyter.ext.io module

async appyter.ext.io.async_copyfileobj(fsrc, fdst, length=0)[source]

Async version of shutil.copyfileobj

appyter.ext.itertools module

async appyter.ext.itertools.alist(agen)[source]

Resolve all values from an asynchronous generator like it was an iterator

appyter.ext.itertools.collapse(L)[source]
appyter.ext.itertools.ensure_list(L)[source]
appyter.ext.itertools.one_and_only(it)[source]

appyter.ext.json module

appyter.ext.json.try_json_dumps(v)[source]
appyter.ext.json.try_json_loads(v)[source]

appyter.ext.multiprocessing module

appyter.ext.pytest module

appyter.ext.pytest.assert_eq(a, b)[source]
appyter.ext.pytest.assert_exc(ExpectedException)[source]
appyter.ext.pytest.http_serve_ctx(directory, port=8888)[source]

Context for _http_serve, ensuring server is ready before proceeding

appyter.ext.re module

appyter.ext.re.re_full(expr)[source]
appyter.ext.re.slugify(s)[source]

appyter.ext.subprocess module

appyter.ext.subprocess.interrupt(proc: multiprocessing.context.Process)[source]

appyter.ext.tempfile module

appyter.ext.tempfile.mktemp(suffix='', prefix='appyter-tmp', dir=None)[source]

Same as tempfile.mktemp but with appyter prefix

appyter.ext.tempfile.tempdir(path=None)[source]

A context for a temporary directory that may exist, if it doesn’t we’ll use mkdtemp. Also has a safety mechanism when dealing with mounts – it will not rmtree if the directory is a mounted directory (since this might remove files unintentially).

appyter.ext.urllib module

class appyter.ext.urllib.URI(url=None, scheme=None, username=None, password=None, hostname=None, port=None, path=None, query_string=None, fragment=None)[source]

Bases: object

Not unlike yarl’s URL class but

  • support for :: notation as used in fsspec URIs

  • posix_path path operation

  • fragment parsing

  • dotmap support (query_ex)

property auth
property authority
fragment: Optional[str, None]
fragment_join(*parts)[source]
property fragment_name
property fragment_parent
property fragment_path
property fragment_posix_path
property fragment_query
property fragment_query_ex
property fragment_query_string
hostname: Optional[str, None]
join(*parts)[source]
property name
property netloc
property parent
password: Optional[str, None]
path: str
port: Optional[int, None]
property posix_path
property query
property query_ex
query_string: Optional[str, None]
scheme: Optional[str, None]
update_fragment_query(fragment_query)[source]
update_query(query)[source]
username: Optional[str, None]
with_fragment(fragment)[source]
with_fragment_path(fragment_path)[source]
with_fragment_query(fragment_query)[source]
with_fragment_query_string(fragment_query_string)[source]
with_hostname(hostname)[source]
with_password(password)[source]
with_path(path)[source]
with_port(port)[source]
with_query(query)[source]
with_query_string(query_string)[source]
with_scheme(scheme)[source]
with_username(username)[source]
appyter.ext.urllib.join_slash(*parts)[source]
appyter.ext.urllib.join_url(root, *parts)[source]
appyter.ext.urllib.parent_url(url)[source]
appyter.ext.urllib.parse_qs_values(query_map)[source]
appyter.ext.urllib.url_filename(url)[source]

appyter.ext.uuid module

appyter.ext.uuid.generate_uuid()[source]
appyter.ext.uuid.sanitize_sha1sum(val)[source]
appyter.ext.uuid.sanitize_uuid(val)[source]

Module contents