now.utils module#

now.utils.download_file(path, r_raw)[source]#
now.utils.download(url, filename)[source]#
now.utils.my_handler(signum, frame, spinner)[source]#
class now.utils.BetterEnum[source]#

Bases: object

now.utils.to_camel_case(text)[source]#

Convert text to camel case in great coding style

class now.utils.EnvironmentVariables(envs)[source]#

Bases: object

now.utils.add_env_variables_to_flow(app_instance, env_dict)[source]#
now.utils.write_env_file(env_file, config)[source]#
now.utils.write_flow_file(flow_yaml_content, new_yaml_file_path)[source]#
now.utils.jina_auth_login()[source]#
now.utils.get_info_hubble(user_input)[source]#
now.utils.print_headline()[source]#
now.utils.maybe_prompt_user(questions, attribute, **kwargs)[source]#

Checks the kwargs for the attribute name. If present, the value is returned directly. If not, the user is prompted via the cmd-line using the questions argument.

Parameters
Returns

A single value of either from kwargs or the user cli input.

now.utils.prompt_value(name, prompt_message, prompt_type='input', choices=None, **kwargs)[source]#
now.utils.flatten_dict(d, parent_key='', sep='__')[source]#

This function converts a nested dictionary into a dictionary of attirbutes using ‘__’ as a separator. Example:

{‘a’: {‘b’: {‘c’: 1, ‘d’: 2}}} -> {‘a__b__c’: 1, ‘a__b__c’: 2}

now.utils.get_flow_id(host)[source]#
class now.utils.Dumper(stream, default_style=None, default_flow_style=False, canonical=None, indent=None, width=None, allow_unicode=None, line_break=None, encoding=None, explicit_start=None, explicit_end=None, version=None, tags=None, sort_keys=True)[source]#

Bases: Dumper

increase_indent(flow=False, *args, **kwargs)[source]#
now.utils.docarray_typing_to_modality_string(T)[source]#

E.g. docarray.typing.Image -> image

Return type

str

now.utils.modality_string_to_docarray_typing(s)[source]#

E.g. image -> docarray.typing.Image

Return type

TypeVar

exception now.utils.RetryException[source]#

Bases: Exception

exception now.utils.DemoAvailableException[source]#

Bases: Exception