Utils

class AsyncFormatter[source]
coroutine format(**kwargs)[source]
coroutine get_field(field_name, args, kwargs)[source]
coroutine get_value(key, args, kwargs)[source]
coroutine vformat(format_string, args, kwargs)[source]
create_response(data=None, **kwargs)[source]
Return type

Response

error_response(exception, *, client_error=None, status_code=None)[source]
Return type

Response

add_http_scheme(link, base_url=None, *, _scheme='http')[source]
Return type

str

parse_js_json(text, *, variables=None)[source]
Return type

Any

external_url_for(endpoint, **kwargs)[source]
format_available(text, *args, **kwargs)[source]
Return type

str

do_later(target, log_level=30)[source]
Return type

None

fuzzy_bool(s, *, default=False)[source]
Return type

bool

aiter(iterable)[source]

Convert any kind of iterable to an async iterable

Return type

Asynciterator[~T]

as_completed(iterable)[source]
Return type

Asynciterator[~T]

coroutine anext(iterable, default=<object object>)[source]
Return type

~T

coroutine alist(iterable, constructor=<class 'list'>)[source]
Return type

Container[~T]

coroutine maybe_await(obj)[source]
Return type

~T

amap(func, iterable)[source]
Return type

Asynciterator[~R]

afilter(func, iterable)[source]
Return type

Asynciterator[~T]

coroutine get_first(coros, predicate=<class 'bool'>, *, reject_exceptions=True, cancel_running=True)[source]
Return type

Optional[~T]

normalise_text_score(query, score)[source]

Approximate a mongo text score to the range [0, 1].

Parameters
  • query (str) – Query which was used

  • score (float) – Text score

Return type

float

Returns

An approximation of the normalised text score which is guaranteed to be in the closed interval [0, 1].

full_normalise_text_score(query, result, score)[source]
Return type

float

mut_map_filter_items(callback, mapping)[source]
Return type

None

mut_map_filter_values(callback, mapping)[source]
Return type

None

get_certainty(a, b)[source]
Return type

float