jina.jaml.helper module#

class jina.jaml.helper.JinaConstructor[source]#

Bases: FullConstructor

Convert List into tuple when doing hashing.

get_hashable_key(key)[source]#

Get the hash value of key.

Parameters:

key – key value to be hashed.

Returns:

Hash value of key.

construct_mapping(node, deep=True)[source]#

Build the mapping from node.

Parameters:
  • node – the node to traverse

  • deep – required param from YAML constructor

Returns:

Mapped data

classmethod add_constructor(tag, constructor)#
classmethod add_multi_constructor(tag_prefix, multi_constructor)#
bool_values = {'false': False, 'no': False, 'off': False, 'on': True, 'true': True, 'yes': True}#
check_data()#
check_state_key(key)#

Block special attributes/methods from being set in a newly created object, to prevent user-controlled methods from being called during deserialization

construct_document(node)#
construct_object(node, deep=False)#
construct_pairs(node, deep=False)#
construct_python_bytes(node)#
construct_python_complex(node)#
construct_python_long(node)#
construct_python_module(suffix, node)#
construct_python_name(suffix, node)#
construct_python_object(suffix, node)#
construct_python_object_apply(suffix, node, newobj=False)#
construct_python_object_new(suffix, node)#
construct_python_str(node)#
construct_python_tuple(node)#
construct_python_unicode(node)#
construct_scalar(node)#
construct_sequence(node, deep=False)#
construct_undefined(node)#
construct_yaml_binary(node)#
construct_yaml_bool(node)#
construct_yaml_float(node)#
construct_yaml_int(node)#
construct_yaml_map(node)#
construct_yaml_null(node)#
construct_yaml_object(node, cls)#
construct_yaml_omap(node)#
construct_yaml_pairs(node)#
construct_yaml_seq(node)#
construct_yaml_set(node)#
construct_yaml_str(node)#
construct_yaml_timestamp(node)#
find_python_module(name, mark, unsafe=False)#
find_python_name(name, mark, unsafe=False)#
flatten_mapping(node)#
get_data()#
get_single_data()#
get_state_keys_blacklist()#
get_state_keys_blacklist_regexp()#
inf_value = inf#
make_python_instance(suffix, node, args=None, kwds=None, newobj=False, unsafe=False)#
nan_value = nan#
set_python_instance_state(instance, state, unsafe=False)#
timestamp_regexp = re.compile('^(?P<year>[0-9][0-9][0-9][0-9])\n                -(?P<month>[0-9][0-9]?)\n                -(?P<day>[0-9][0-9]?)\n                (?:(?:[Tt]|[ \\t]+)\n                (?P<hour>[0-9][0-9]?)\n          , re.VERBOSE)#
yaml_constructors = {'tag:yaml.org,2002:null': <function SafeConstructor.construct_yaml_null>, 'tag:yaml.org,2002:bool': <function SafeConstructor.construct_yaml_bool>, 'tag:yaml.org,2002:int': <function SafeConstructor.construct_yaml_int>, 'tag:yaml.org,2002:float': <function SafeConstructor.construct_yaml_float>, 'tag:yaml.org,2002:binary': <function SafeConstructor.construct_yaml_binary>, 'tag:yaml.org,2002:timestamp': <function SafeConstructor.construct_yaml_timestamp>, 'tag:yaml.org,2002:omap': <function SafeConstructor.construct_yaml_omap>, 'tag:yaml.org,2002:pairs': <function SafeConstructor.construct_yaml_pairs>, 'tag:yaml.org,2002:set': <function SafeConstructor.construct_yaml_set>, 'tag:yaml.org,2002:str': <function SafeConstructor.construct_yaml_str>, 'tag:yaml.org,2002:seq': <function SafeConstructor.construct_yaml_seq>, 'tag:yaml.org,2002:map': <function SafeConstructor.construct_yaml_map>, None: <function SafeConstructor.construct_undefined>, 'tag:yaml.org,2002:python/none': <function SafeConstructor.construct_yaml_null>, 'tag:yaml.org,2002:python/bool': <function SafeConstructor.construct_yaml_bool>, 'tag:yaml.org,2002:python/str': <function FullConstructor.construct_python_str>, 'tag:yaml.org,2002:python/unicode': <function FullConstructor.construct_python_unicode>, 'tag:yaml.org,2002:python/bytes': <function FullConstructor.construct_python_bytes>, 'tag:yaml.org,2002:python/int': <function SafeConstructor.construct_yaml_int>, 'tag:yaml.org,2002:python/long': <function FullConstructor.construct_python_long>, 'tag:yaml.org,2002:python/float': <function SafeConstructor.construct_yaml_float>, 'tag:yaml.org,2002:python/complex': <function FullConstructor.construct_python_complex>, 'tag:yaml.org,2002:python/list': <function SafeConstructor.construct_yaml_seq>, 'tag:yaml.org,2002:python/tuple': <function FullConstructor.construct_python_tuple>, 'tag:yaml.org,2002:python/dict': <function SafeConstructor.construct_yaml_map>}#
yaml_multi_constructors = {'tag:yaml.org,2002:python/name:': <function FullConstructor.construct_python_name>}#
class jina.jaml.helper.JinaResolver[source]#

Bases: Resolver

Remove on|On|ON as bool resolver.

DEFAULT_MAPPING_TAG = 'tag:yaml.org,2002:map'#
DEFAULT_SCALAR_TAG = 'tag:yaml.org,2002:str'#
DEFAULT_SEQUENCE_TAG = 'tag:yaml.org,2002:seq'#
classmethod add_implicit_resolver(tag, regexp, first)#
classmethod add_path_resolver(tag, path, kind=None)#
ascend_resolver()#
check_resolver_prefix(depth, path, kind, current_node, current_index)#
descend_resolver(current_node, current_index)#
resolve(kind, value, implicit)#
yaml_implicit_resolvers = {'': [('tag:yaml.org,2002:null', re.compile('^(?: ~\n                    |null|Null|NULL\n                    | )$', re.VERBOSE))], '!': [('tag:yaml.org,2002:yaml', re.compile('^(?:!|&|\\*)$'))], '&': [('tag:yaml.org,2002:yaml', re.compile('^(?:!|&|\\*)$'))], '*': [('tag:yaml.org,2002:yaml', re.compile('^(?:!|&|\\*)$'))], '+': [('tag:yaml.org,2002:float', re.compile('^(?:[-+]?(?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-+][0-9]+)?\n                    |\\.[0-9][0-9_]*(?:[eE][-+][0-9]+)?\n                    |[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*\n                   , re.VERBOSE)), ('tag:yaml.org,2002:int', re.compile('^(?:[-+]?0b[0-1_]+\n                    |[-+]?0[0-7_]+\n                    |[-+]?(?:0|[1-9][0-9_]*)\n                    |[-+]?0x[0-9a-fA-F_]+\n                    |[-+]?[1-9][0-9_]*(?::[0-5]?[0-9]), re.VERBOSE))], '-': [('tag:yaml.org,2002:float', re.compile('^(?:[-+]?(?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-+][0-9]+)?\n                    |\\.[0-9][0-9_]*(?:[eE][-+][0-9]+)?\n                    |[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*\n                   , re.VERBOSE)), ('tag:yaml.org,2002:int', re.compile('^(?:[-+]?0b[0-1_]+\n                    |[-+]?0[0-7_]+\n                    |[-+]?(?:0|[1-9][0-9_]*)\n                    |[-+]?0x[0-9a-fA-F_]+\n                    |[-+]?[1-9][0-9_]*(?::[0-5]?[0-9]), re.VERBOSE))], '.': [('tag:yaml.org,2002:float', re.compile('^(?:[-+]?(?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-+][0-9]+)?\n                    |\\.[0-9][0-9_]*(?:[eE][-+][0-9]+)?\n                    |[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*\n                   , re.VERBOSE))], '0': [('tag:yaml.org,2002:float', re.compile('^(?:[-+]?(?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-+][0-9]+)?\n                    |\\.[0-9][0-9_]*(?:[eE][-+][0-9]+)?\n                    |[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*\n                   , re.VERBOSE)), ('tag:yaml.org,2002:int', re.compile('^(?:[-+]?0b[0-1_]+\n                    |[-+]?0[0-7_]+\n                    |[-+]?(?:0|[1-9][0-9_]*)\n                    |[-+]?0x[0-9a-fA-F_]+\n                    |[-+]?[1-9][0-9_]*(?::[0-5]?[0-9]), re.VERBOSE)), ('tag:yaml.org,2002:timestamp', re.compile('^(?:[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]\n                    |[0-9][0-9][0-9][0-9] -[0-9][0-9]? -[0-9][0-9]?\n                     (?:[Tt]|[ \\t]+)[0-9][0-9]?\n                     :[0-9][0-9], re.VERBOSE))], '1': [('tag:yaml.org,2002:float', re.compile('^(?:[-+]?(?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-+][0-9]+)?\n                    |\\.[0-9][0-9_]*(?:[eE][-+][0-9]+)?\n                    |[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*\n                   , re.VERBOSE)), ('tag:yaml.org,2002:int', re.compile('^(?:[-+]?0b[0-1_]+\n                    |[-+]?0[0-7_]+\n                    |[-+]?(?:0|[1-9][0-9_]*)\n                    |[-+]?0x[0-9a-fA-F_]+\n                    |[-+]?[1-9][0-9_]*(?::[0-5]?[0-9]), re.VERBOSE)), ('tag:yaml.org,2002:timestamp', re.compile('^(?:[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]\n                    |[0-9][0-9][0-9][0-9] -[0-9][0-9]? -[0-9][0-9]?\n                     (?:[Tt]|[ \\t]+)[0-9][0-9]?\n                     :[0-9][0-9], re.VERBOSE))], '2': [('tag:yaml.org,2002:float', re.compile('^(?:[-+]?(?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-+][0-9]+)?\n                    |\\.[0-9][0-9_]*(?:[eE][-+][0-9]+)?\n                    |[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*\n                   , re.VERBOSE)), ('tag:yaml.org,2002:int', re.compile('^(?:[-+]?0b[0-1_]+\n                    |[-+]?0[0-7_]+\n                    |[-+]?(?:0|[1-9][0-9_]*)\n                    |[-+]?0x[0-9a-fA-F_]+\n                    |[-+]?[1-9][0-9_]*(?::[0-5]?[0-9]), re.VERBOSE)), ('tag:yaml.org,2002:timestamp', re.compile('^(?:[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]\n                    |[0-9][0-9][0-9][0-9] -[0-9][0-9]? -[0-9][0-9]?\n                     (?:[Tt]|[ \\t]+)[0-9][0-9]?\n                     :[0-9][0-9], re.VERBOSE))], '3': [('tag:yaml.org,2002:float', re.compile('^(?:[-+]?(?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-+][0-9]+)?\n                    |\\.[0-9][0-9_]*(?:[eE][-+][0-9]+)?\n                    |[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*\n                   , re.VERBOSE)), ('tag:yaml.org,2002:int', re.compile('^(?:[-+]?0b[0-1_]+\n                    |[-+]?0[0-7_]+\n                    |[-+]?(?:0|[1-9][0-9_]*)\n                    |[-+]?0x[0-9a-fA-F_]+\n                    |[-+]?[1-9][0-9_]*(?::[0-5]?[0-9]), re.VERBOSE)), ('tag:yaml.org,2002:timestamp', re.compile('^(?:[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]\n                    |[0-9][0-9][0-9][0-9] -[0-9][0-9]? -[0-9][0-9]?\n                     (?:[Tt]|[ \\t]+)[0-9][0-9]?\n                     :[0-9][0-9], re.VERBOSE))], '4': [('tag:yaml.org,2002:float', re.compile('^(?:[-+]?(?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-+][0-9]+)?\n                    |\\.[0-9][0-9_]*(?:[eE][-+][0-9]+)?\n                    |[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*\n                   , re.VERBOSE)), ('tag:yaml.org,2002:int', re.compile('^(?:[-+]?0b[0-1_]+\n                    |[-+]?0[0-7_]+\n                    |[-+]?(?:0|[1-9][0-9_]*)\n                    |[-+]?0x[0-9a-fA-F_]+\n                    |[-+]?[1-9][0-9_]*(?::[0-5]?[0-9]), re.VERBOSE)), ('tag:yaml.org,2002:timestamp', re.compile('^(?:[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]\n                    |[0-9][0-9][0-9][0-9] -[0-9][0-9]? -[0-9][0-9]?\n                     (?:[Tt]|[ \\t]+)[0-9][0-9]?\n                     :[0-9][0-9], re.VERBOSE))], '5': [('tag:yaml.org,2002:float', re.compile('^(?:[-+]?(?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-+][0-9]+)?\n                    |\\.[0-9][0-9_]*(?:[eE][-+][0-9]+)?\n                    |[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*\n                   , re.VERBOSE)), ('tag:yaml.org,2002:int', re.compile('^(?:[-+]?0b[0-1_]+\n                    |[-+]?0[0-7_]+\n                    |[-+]?(?:0|[1-9][0-9_]*)\n                    |[-+]?0x[0-9a-fA-F_]+\n                    |[-+]?[1-9][0-9_]*(?::[0-5]?[0-9]), re.VERBOSE)), ('tag:yaml.org,2002:timestamp', re.compile('^(?:[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]\n                    |[0-9][0-9][0-9][0-9] -[0-9][0-9]? -[0-9][0-9]?\n                     (?:[Tt]|[ \\t]+)[0-9][0-9]?\n                     :[0-9][0-9], re.VERBOSE))], '6': [('tag:yaml.org,2002:float', re.compile('^(?:[-+]?(?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-+][0-9]+)?\n                    |\\.[0-9][0-9_]*(?:[eE][-+][0-9]+)?\n                    |[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*\n                   , re.VERBOSE)), ('tag:yaml.org,2002:int', re.compile('^(?:[-+]?0b[0-1_]+\n                    |[-+]?0[0-7_]+\n                    |[-+]?(?:0|[1-9][0-9_]*)\n                    |[-+]?0x[0-9a-fA-F_]+\n                    |[-+]?[1-9][0-9_]*(?::[0-5]?[0-9]), re.VERBOSE)), ('tag:yaml.org,2002:timestamp', re.compile('^(?:[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]\n                    |[0-9][0-9][0-9][0-9] -[0-9][0-9]? -[0-9][0-9]?\n                     (?:[Tt]|[ \\t]+)[0-9][0-9]?\n                     :[0-9][0-9], re.VERBOSE))], '7': [('tag:yaml.org,2002:float', re.compile('^(?:[-+]?(?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-+][0-9]+)?\n                    |\\.[0-9][0-9_]*(?:[eE][-+][0-9]+)?\n                    |[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*\n                   , re.VERBOSE)), ('tag:yaml.org,2002:int', re.compile('^(?:[-+]?0b[0-1_]+\n                    |[-+]?0[0-7_]+\n                    |[-+]?(?:0|[1-9][0-9_]*)\n                    |[-+]?0x[0-9a-fA-F_]+\n                    |[-+]?[1-9][0-9_]*(?::[0-5]?[0-9]), re.VERBOSE)), ('tag:yaml.org,2002:timestamp', re.compile('^(?:[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]\n                    |[0-9][0-9][0-9][0-9] -[0-9][0-9]? -[0-9][0-9]?\n                     (?:[Tt]|[ \\t]+)[0-9][0-9]?\n                     :[0-9][0-9], re.VERBOSE))], '8': [('tag:yaml.org,2002:float', re.compile('^(?:[-+]?(?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-+][0-9]+)?\n                    |\\.[0-9][0-9_]*(?:[eE][-+][0-9]+)?\n                    |[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*\n                   , re.VERBOSE)), ('tag:yaml.org,2002:int', re.compile('^(?:[-+]?0b[0-1_]+\n                    |[-+]?0[0-7_]+\n                    |[-+]?(?:0|[1-9][0-9_]*)\n                    |[-+]?0x[0-9a-fA-F_]+\n                    |[-+]?[1-9][0-9_]*(?::[0-5]?[0-9]), re.VERBOSE)), ('tag:yaml.org,2002:timestamp', re.compile('^(?:[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]\n                    |[0-9][0-9][0-9][0-9] -[0-9][0-9]? -[0-9][0-9]?\n                     (?:[Tt]|[ \\t]+)[0-9][0-9]?\n                     :[0-9][0-9], re.VERBOSE))], '9': [('tag:yaml.org,2002:float', re.compile('^(?:[-+]?(?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-+][0-9]+)?\n                    |\\.[0-9][0-9_]*(?:[eE][-+][0-9]+)?\n                    |[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*\n                   , re.VERBOSE)), ('tag:yaml.org,2002:int', re.compile('^(?:[-+]?0b[0-1_]+\n                    |[-+]?0[0-7_]+\n                    |[-+]?(?:0|[1-9][0-9_]*)\n                    |[-+]?0x[0-9a-fA-F_]+\n                    |[-+]?[1-9][0-9_]*(?::[0-5]?[0-9]), re.VERBOSE)), ('tag:yaml.org,2002:timestamp', re.compile('^(?:[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]\n                    |[0-9][0-9][0-9][0-9] -[0-9][0-9]? -[0-9][0-9]?\n                     (?:[Tt]|[ \\t]+)[0-9][0-9]?\n                     :[0-9][0-9], re.VERBOSE))], '<': [('tag:yaml.org,2002:merge', re.compile('^(?:<<)$'))], '=': [('tag:yaml.org,2002:value', re.compile('^(?:=)$'))], 'F': [('tag:yaml.org,2002:bool', re.compile('^(?:yes|Yes|YES|no|No|NO\n                    |true|True|TRUE|false|False|FALSE\n                    |on|On|ON|off|Off|OFF)$', re.VERBOSE))], 'N': [('tag:yaml.org,2002:bool', re.compile('^(?:yes|Yes|YES|no|No|NO\n                    |true|True|TRUE|false|False|FALSE\n                    |on|On|ON|off|Off|OFF)$', re.VERBOSE)), ('tag:yaml.org,2002:null', re.compile('^(?: ~\n                    |null|Null|NULL\n                    | )$', re.VERBOSE))], 'T': [('tag:yaml.org,2002:bool', re.compile('^(?:yes|Yes|YES|no|No|NO\n                    |true|True|TRUE|false|False|FALSE\n                    |on|On|ON|off|Off|OFF)$', re.VERBOSE))], 'Y': [('tag:yaml.org,2002:bool', re.compile('^(?:yes|Yes|YES|no|No|NO\n                    |true|True|TRUE|false|False|FALSE\n                    |on|On|ON|off|Off|OFF)$', re.VERBOSE))], 'f': [('tag:yaml.org,2002:bool', re.compile('^(?:yes|Yes|YES|no|No|NO\n                    |true|True|TRUE|false|False|FALSE\n                    |on|On|ON|off|Off|OFF)$', re.VERBOSE))], 'n': [('tag:yaml.org,2002:bool', re.compile('^(?:yes|Yes|YES|no|No|NO\n                    |true|True|TRUE|false|False|FALSE\n                    |on|On|ON|off|Off|OFF)$', re.VERBOSE)), ('tag:yaml.org,2002:null', re.compile('^(?: ~\n                    |null|Null|NULL\n                    | )$', re.VERBOSE))], 't': [('tag:yaml.org,2002:bool', re.compile('^(?:yes|Yes|YES|no|No|NO\n                    |true|True|TRUE|false|False|FALSE\n                    |on|On|ON|off|Off|OFF)$', re.VERBOSE))], 'y': [('tag:yaml.org,2002:bool', re.compile('^(?:yes|Yes|YES|no|No|NO\n                    |true|True|TRUE|false|False|FALSE\n                    |on|On|ON|off|Off|OFF)$', re.VERBOSE))], '~': [('tag:yaml.org,2002:null', re.compile('^(?: ~\n                    |null|Null|NULL\n                    | )$', re.VERBOSE))]}#
yaml_path_resolvers = {}#
class jina.jaml.helper.JinaLoader(stream, runtime_args=None)[source]#

Bases: Reader, Scanner, Parser, Composer, JinaConstructor, JinaResolver

The Jina loader which should be able to load YAML safely.

Parameters:

stream – the stream to load.

Initialize the scanner.

DEFAULT_MAPPING_TAG = 'tag:yaml.org,2002:map'#
DEFAULT_SCALAR_TAG = 'tag:yaml.org,2002:str'#
DEFAULT_SEQUENCE_TAG = 'tag:yaml.org,2002:seq'#
DEFAULT_TAGS = {'!': '!', '!!': 'tag:yaml.org,2002:'}#
ESCAPE_CODES = {'U': 8, 'u': 4, 'x': 2}#
ESCAPE_REPLACEMENTS = {'\t': '\t', ' ': ' ', '"': '"', '/': '/', '0': '\x00', 'L': '\u2028', 'N': '\x85', 'P': '\u2029', '\\': '\\', '_': '\xa0', 'a': '\x07', 'b': '\x08', 'e': '\x1b', 'f': '\x0c', 'n': '\n', 'r': '\r', 't': '\t', 'v': '\x0b'}#
NON_PRINTABLE = re.compile('[^\t\n\r -~\x85\xa0-\ud7ff\ue000-�𐀀-\U0010ffff]')#
classmethod add_constructor(tag, constructor)#
classmethod add_implicit_resolver(tag, regexp, first)#
add_indent(column)#
classmethod add_multi_constructor(tag_prefix, multi_constructor)#
classmethod add_path_resolver(tag, path, kind=None)#
ascend_resolver()#
bool_values = {'false': False, 'no': False, 'off': False, 'on': True, 'true': True, 'yes': True}#
check_block_entry()#
check_data()#
check_directive()#
check_document_end()#
check_document_start()#
check_event(*choices)#
check_key()#
check_node()#
check_plain()#
check_printable(data)#
check_resolver_prefix(depth, path, kind, current_node, current_index)#
check_state_key(key)#

Block special attributes/methods from being set in a newly created object, to prevent user-controlled methods from being called during deserialization

check_token(*choices)#
check_value()#
compose_document()#
compose_mapping_node(anchor)#
compose_node(parent, index)#
compose_scalar_node(anchor)#
compose_sequence_node(anchor)#
construct_document(node)#
construct_mapping(node, deep=True)#

Build the mapping from node.

Parameters:
  • node – the node to traverse

  • deep – required param from YAML constructor

Returns:

Mapped data

construct_object(node, deep=False)#
construct_pairs(node, deep=False)#
construct_python_bytes(node)#
construct_python_complex(node)#
construct_python_long(node)#
construct_python_module(suffix, node)#
construct_python_name(suffix, node)#
construct_python_object(suffix, node)#
construct_python_object_apply(suffix, node, newobj=False)#
construct_python_object_new(suffix, node)#
construct_python_str(node)#
construct_python_tuple(node)#
construct_python_unicode(node)#
construct_scalar(node)#
construct_sequence(node, deep=False)#
construct_undefined(node)#
construct_yaml_binary(node)#
construct_yaml_bool(node)#
construct_yaml_float(node)#
construct_yaml_int(node)#
construct_yaml_map(node)#
construct_yaml_null(node)#
construct_yaml_object(node, cls)#
construct_yaml_omap(node)#
construct_yaml_pairs(node)#
construct_yaml_seq(node)#
construct_yaml_set(node)#
construct_yaml_str(node)#
construct_yaml_timestamp(node)#
descend_resolver(current_node, current_index)#
determine_encoding()#
dispose()#
fetch_alias()#
fetch_anchor()#
fetch_block_entry()#
fetch_block_scalar(style)#
fetch_directive()#
fetch_document_end()#
fetch_document_indicator(TokenClass)#
fetch_document_start()#
fetch_double()#
fetch_flow_collection_end(TokenClass)#
fetch_flow_collection_start(TokenClass)#
fetch_flow_entry()#
fetch_flow_mapping_end()#
fetch_flow_mapping_start()#
fetch_flow_scalar(style)#
fetch_flow_sequence_end()#
fetch_flow_sequence_start()#
fetch_folded()#
fetch_key()#
fetch_literal()#
fetch_more_tokens()#
fetch_plain()#
fetch_single()#
fetch_stream_end()#
fetch_stream_start()#
fetch_tag()#
fetch_value()#
find_python_module(name, mark, unsafe=False)#
find_python_name(name, mark, unsafe=False)#
flatten_mapping(node)#
forward(length=1)#
get_data()#
get_event()#
get_hashable_key(key)#

Get the hash value of key.

Parameters:

key – key value to be hashed.

Returns:

Hash value of key.

get_mark()#
get_node()#
get_single_data()#
get_single_node()#
get_state_keys_blacklist()#
get_state_keys_blacklist_regexp()#
get_token()#
inf_value = inf#
make_python_instance(suffix, node, args=None, kwds=None, newobj=False, unsafe=False)#
nan_value = nan#
need_more_tokens()#
next_possible_simple_key()#
parse_block_mapping_first_key()#
parse_block_mapping_key()#
parse_block_mapping_value()#
parse_block_node()#
parse_block_node_or_indentless_sequence()#
parse_block_sequence_entry()#
parse_block_sequence_first_entry()#
parse_document_content()#
parse_document_end()#
parse_document_start()#
parse_flow_mapping_empty_value()#
parse_flow_mapping_first_key()#
parse_flow_mapping_key(first=False)#
parse_flow_mapping_value()#
parse_flow_node()#
parse_flow_sequence_entry(first=False)#
parse_flow_sequence_entry_mapping_end()#
parse_flow_sequence_entry_mapping_key()#
parse_flow_sequence_entry_mapping_value()#
parse_flow_sequence_first_entry()#
parse_implicit_document_start()#
parse_indentless_sequence_entry()#
parse_node(block=False, indentless_sequence=False)#
parse_stream_start()#
peek(index=0)#
peek_event()#
peek_token()#
prefix(length=1)#
process_directives()#
process_empty_scalar(mark)#
remove_possible_simple_key()#
resolve(kind, value, implicit)#
save_possible_simple_key()#
scan_anchor(TokenClass)#
scan_block_scalar(style)#
scan_block_scalar_breaks(indent)#
scan_block_scalar_ignored_line(start_mark)#
scan_block_scalar_indentation()#
scan_block_scalar_indicators(start_mark)#
scan_directive()#
scan_directive_ignored_line(start_mark)#
scan_directive_name(start_mark)#
scan_flow_scalar(style)#
scan_flow_scalar_breaks(double, start_mark)#
scan_flow_scalar_non_spaces(double, start_mark)#
scan_flow_scalar_spaces(double, start_mark)#
scan_line_break()#
scan_plain()#
scan_plain_spaces(indent, start_mark)#
scan_tag()#
scan_tag_directive_handle(start_mark)#
scan_tag_directive_prefix(start_mark)#
scan_tag_directive_value(start_mark)#
scan_tag_handle(name, start_mark)#
scan_tag_uri(name, start_mark)#
scan_to_next_token()#
scan_uri_escapes(name, start_mark)#
scan_yaml_directive_number(start_mark)#
scan_yaml_directive_value(start_mark)#
set_python_instance_state(instance, state, unsafe=False)#
stale_possible_simple_keys()#
timestamp_regexp = re.compile('^(?P<year>[0-9][0-9][0-9][0-9])\n                -(?P<month>[0-9][0-9]?)\n                -(?P<day>[0-9][0-9]?)\n                (?:(?:[Tt]|[ \\t]+)\n                (?P<hour>[0-9][0-9]?)\n          , re.VERBOSE)#
unwind_indent(column)#
update(length)#
update_raw(size=4096)#
yaml_constructors = {'tag:yaml.org,2002:null': <function SafeConstructor.construct_yaml_null>, 'tag:yaml.org,2002:bool': <function SafeConstructor.construct_yaml_bool>, 'tag:yaml.org,2002:int': <function SafeConstructor.construct_yaml_int>, 'tag:yaml.org,2002:float': <function SafeConstructor.construct_yaml_float>, 'tag:yaml.org,2002:binary': <function SafeConstructor.construct_yaml_binary>, 'tag:yaml.org,2002:timestamp': <function SafeConstructor.construct_yaml_timestamp>, 'tag:yaml.org,2002:omap': <function SafeConstructor.construct_yaml_omap>, 'tag:yaml.org,2002:pairs': <function SafeConstructor.construct_yaml_pairs>, 'tag:yaml.org,2002:set': <function SafeConstructor.construct_yaml_set>, 'tag:yaml.org,2002:str': <function SafeConstructor.construct_yaml_str>, 'tag:yaml.org,2002:seq': <function SafeConstructor.construct_yaml_seq>, 'tag:yaml.org,2002:map': <function SafeConstructor.construct_yaml_map>, None: <function SafeConstructor.construct_undefined>, 'tag:yaml.org,2002:python/none': <function SafeConstructor.construct_yaml_null>, 'tag:yaml.org,2002:python/bool': <function SafeConstructor.construct_yaml_bool>, 'tag:yaml.org,2002:python/str': <function FullConstructor.construct_python_str>, 'tag:yaml.org,2002:python/unicode': <function FullConstructor.construct_python_unicode>, 'tag:yaml.org,2002:python/bytes': <function FullConstructor.construct_python_bytes>, 'tag:yaml.org,2002:python/int': <function SafeConstructor.construct_yaml_int>, 'tag:yaml.org,2002:python/long': <function FullConstructor.construct_python_long>, 'tag:yaml.org,2002:python/float': <function SafeConstructor.construct_yaml_float>, 'tag:yaml.org,2002:python/complex': <function FullConstructor.construct_python_complex>, 'tag:yaml.org,2002:python/list': <function SafeConstructor.construct_yaml_seq>, 'tag:yaml.org,2002:python/tuple': <function FullConstructor.construct_python_tuple>, 'tag:yaml.org,2002:python/dict': <function SafeConstructor.construct_yaml_map>, '!JAMLCompatible': <bound method JAMLCompatible._from_yaml of <class 'jina.jaml.JAMLCompatible'>>, '!BetterEnum': <bound method BetterEnum._from_yaml of <enum 'BetterEnum'>>, '!PollingType': <bound method BetterEnum._from_yaml of <enum 'PollingType'>>, '!LogVerbosity': <bound method BetterEnum._from_yaml of <enum 'LogVerbosity'>>, '!FlowBuildLevel': <bound method BetterEnum._from_yaml of <enum 'FlowBuildLevel'>>, '!GatewayProtocolType': <bound method BetterEnum._from_yaml of <enum 'GatewayProtocolType'>>, '!PodRoleType': <bound method BetterEnum._from_yaml of <enum 'PodRoleType'>>, '!DeploymentRoleType': <bound method BetterEnum._from_yaml of <enum 'DeploymentRoleType'>>, '!FlowInspectType': <bound method BetterEnum._from_yaml of <enum 'FlowInspectType'>>, '!DataInputType': <bound method BetterEnum._from_yaml of <enum 'DataInputType'>>, '!StandaloneExecutorType': <bound method BetterEnum._from_yaml of <enum 'StandaloneExecutorType'>>, '!BaseExecutor': <bound method JAMLCompatible._from_yaml of <class 'jina.serve.executors.BaseExecutor'>>, '!BaseGateway': <bound method JAMLCompatible._from_yaml of <class 'jina.serve.gateway.BaseGateway'>>, '!CompositeGateway': <bound method JAMLCompatible._from_yaml of <class 'jina.serve.runtimes.gateway.composite.gateway.CompositeGateway'>>, '!GRPCGateway': <bound method JAMLCompatible._from_yaml of <class 'jina.serve.runtimes.gateway.grpc.gateway.GRPCGateway'>>, '!HTTPGateway': <bound method JAMLCompatible._from_yaml of <class 'jina.serve.runtimes.gateway.http.gateway.HTTPGateway'>>, '!WebSocketGateway': <bound method JAMLCompatible._from_yaml of <class 'jina.serve.runtimes.gateway.websocket.gateway.WebSocketGateway'>>, '!Flow': <bound method JAMLCompatible._from_yaml of <class 'jina.orchestrate.flow.base.Flow'>>, '!AsyncFlow': <bound method JAMLCompatible._from_yaml of <class 'jina.orchestrate.flow.asyncio.AsyncFlow'>>}#
yaml_implicit_resolvers = {'': [('tag:yaml.org,2002:null', re.compile('^(?: ~\n                    |null|Null|NULL\n                    | )$', re.VERBOSE))], '!': [('tag:yaml.org,2002:yaml', re.compile('^(?:!|&|\\*)$'))], '&': [('tag:yaml.org,2002:yaml', re.compile('^(?:!|&|\\*)$'))], '*': [('tag:yaml.org,2002:yaml', re.compile('^(?:!|&|\\*)$'))], '+': [('tag:yaml.org,2002:float', re.compile('^(?:[-+]?(?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-+][0-9]+)?\n                    |\\.[0-9][0-9_]*(?:[eE][-+][0-9]+)?\n                    |[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*\n                   , re.VERBOSE)), ('tag:yaml.org,2002:int', re.compile('^(?:[-+]?0b[0-1_]+\n                    |[-+]?0[0-7_]+\n                    |[-+]?(?:0|[1-9][0-9_]*)\n                    |[-+]?0x[0-9a-fA-F_]+\n                    |[-+]?[1-9][0-9_]*(?::[0-5]?[0-9]), re.VERBOSE))], '-': [('tag:yaml.org,2002:float', re.compile('^(?:[-+]?(?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-+][0-9]+)?\n                    |\\.[0-9][0-9_]*(?:[eE][-+][0-9]+)?\n                    |[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*\n                   , re.VERBOSE)), ('tag:yaml.org,2002:int', re.compile('^(?:[-+]?0b[0-1_]+\n                    |[-+]?0[0-7_]+\n                    |[-+]?(?:0|[1-9][0-9_]*)\n                    |[-+]?0x[0-9a-fA-F_]+\n                    |[-+]?[1-9][0-9_]*(?::[0-5]?[0-9]), re.VERBOSE))], '.': [('tag:yaml.org,2002:float', re.compile('^(?:[-+]?(?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-+][0-9]+)?\n                    |\\.[0-9][0-9_]*(?:[eE][-+][0-9]+)?\n                    |[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*\n                   , re.VERBOSE))], '0': [('tag:yaml.org,2002:float', re.compile('^(?:[-+]?(?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-+][0-9]+)?\n                    |\\.[0-9][0-9_]*(?:[eE][-+][0-9]+)?\n                    |[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*\n                   , re.VERBOSE)), ('tag:yaml.org,2002:int', re.compile('^(?:[-+]?0b[0-1_]+\n                    |[-+]?0[0-7_]+\n                    |[-+]?(?:0|[1-9][0-9_]*)\n                    |[-+]?0x[0-9a-fA-F_]+\n                    |[-+]?[1-9][0-9_]*(?::[0-5]?[0-9]), re.VERBOSE)), ('tag:yaml.org,2002:timestamp', re.compile('^(?:[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]\n                    |[0-9][0-9][0-9][0-9] -[0-9][0-9]? -[0-9][0-9]?\n                     (?:[Tt]|[ \\t]+)[0-9][0-9]?\n                     :[0-9][0-9], re.VERBOSE))], '1': [('tag:yaml.org,2002:float', re.compile('^(?:[-+]?(?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-+][0-9]+)?\n                    |\\.[0-9][0-9_]*(?:[eE][-+][0-9]+)?\n                    |[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*\n                   , re.VERBOSE)), ('tag:yaml.org,2002:int', re.compile('^(?:[-+]?0b[0-1_]+\n                    |[-+]?0[0-7_]+\n                    |[-+]?(?:0|[1-9][0-9_]*)\n                    |[-+]?0x[0-9a-fA-F_]+\n                    |[-+]?[1-9][0-9_]*(?::[0-5]?[0-9]), re.VERBOSE)), ('tag:yaml.org,2002:timestamp', re.compile('^(?:[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]\n                    |[0-9][0-9][0-9][0-9] -[0-9][0-9]? -[0-9][0-9]?\n                     (?:[Tt]|[ \\t]+)[0-9][0-9]?\n                     :[0-9][0-9], re.VERBOSE))], '2': [('tag:yaml.org,2002:float', re.compile('^(?:[-+]?(?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-+][0-9]+)?\n                    |\\.[0-9][0-9_]*(?:[eE][-+][0-9]+)?\n                    |[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*\n                   , re.VERBOSE)), ('tag:yaml.org,2002:int', re.compile('^(?:[-+]?0b[0-1_]+\n                    |[-+]?0[0-7_]+\n                    |[-+]?(?:0|[1-9][0-9_]*)\n                    |[-+]?0x[0-9a-fA-F_]+\n                    |[-+]?[1-9][0-9_]*(?::[0-5]?[0-9]), re.VERBOSE)), ('tag:yaml.org,2002:timestamp', re.compile('^(?:[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]\n                    |[0-9][0-9][0-9][0-9] -[0-9][0-9]? -[0-9][0-9]?\n                     (?:[Tt]|[ \\t]+)[0-9][0-9]?\n                     :[0-9][0-9], re.VERBOSE))], '3': [('tag:yaml.org,2002:float', re.compile('^(?:[-+]?(?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-+][0-9]+)?\n                    |\\.[0-9][0-9_]*(?:[eE][-+][0-9]+)?\n                    |[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*\n                   , re.VERBOSE)), ('tag:yaml.org,2002:int', re.compile('^(?:[-+]?0b[0-1_]+\n                    |[-+]?0[0-7_]+\n                    |[-+]?(?:0|[1-9][0-9_]*)\n                    |[-+]?0x[0-9a-fA-F_]+\n                    |[-+]?[1-9][0-9_]*(?::[0-5]?[0-9]), re.VERBOSE)), ('tag:yaml.org,2002:timestamp', re.compile('^(?:[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]\n                    |[0-9][0-9][0-9][0-9] -[0-9][0-9]? -[0-9][0-9]?\n                     (?:[Tt]|[ \\t]+)[0-9][0-9]?\n                     :[0-9][0-9], re.VERBOSE))], '4': [('tag:yaml.org,2002:float', re.compile('^(?:[-+]?(?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-+][0-9]+)?\n                    |\\.[0-9][0-9_]*(?:[eE][-+][0-9]+)?\n                    |[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*\n                   , re.VERBOSE)), ('tag:yaml.org,2002:int', re.compile('^(?:[-+]?0b[0-1_]+\n                    |[-+]?0[0-7_]+\n                    |[-+]?(?:0|[1-9][0-9_]*)\n                    |[-+]?0x[0-9a-fA-F_]+\n                    |[-+]?[1-9][0-9_]*(?::[0-5]?[0-9]), re.VERBOSE)), ('tag:yaml.org,2002:timestamp', re.compile('^(?:[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]\n                    |[0-9][0-9][0-9][0-9] -[0-9][0-9]? -[0-9][0-9]?\n                     (?:[Tt]|[ \\t]+)[0-9][0-9]?\n                     :[0-9][0-9], re.VERBOSE))], '5': [('tag:yaml.org,2002:float', re.compile('^(?:[-+]?(?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-+][0-9]+)?\n                    |\\.[0-9][0-9_]*(?:[eE][-+][0-9]+)?\n                    |[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*\n                   , re.VERBOSE)), ('tag:yaml.org,2002:int', re.compile('^(?:[-+]?0b[0-1_]+\n                    |[-+]?0[0-7_]+\n                    |[-+]?(?:0|[1-9][0-9_]*)\n                    |[-+]?0x[0-9a-fA-F_]+\n                    |[-+]?[1-9][0-9_]*(?::[0-5]?[0-9]), re.VERBOSE)), ('tag:yaml.org,2002:timestamp', re.compile('^(?:[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]\n                    |[0-9][0-9][0-9][0-9] -[0-9][0-9]? -[0-9][0-9]?\n                     (?:[Tt]|[ \\t]+)[0-9][0-9]?\n                     :[0-9][0-9], re.VERBOSE))], '6': [('tag:yaml.org,2002:float', re.compile('^(?:[-+]?(?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-+][0-9]+)?\n                    |\\.[0-9][0-9_]*(?:[eE][-+][0-9]+)?\n                    |[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*\n                   , re.VERBOSE)), ('tag:yaml.org,2002:int', re.compile('^(?:[-+]?0b[0-1_]+\n                    |[-+]?0[0-7_]+\n                    |[-+]?(?:0|[1-9][0-9_]*)\n                    |[-+]?0x[0-9a-fA-F_]+\n                    |[-+]?[1-9][0-9_]*(?::[0-5]?[0-9]), re.VERBOSE)), ('tag:yaml.org,2002:timestamp', re.compile('^(?:[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]\n                    |[0-9][0-9][0-9][0-9] -[0-9][0-9]? -[0-9][0-9]?\n                     (?:[Tt]|[ \\t]+)[0-9][0-9]?\n                     :[0-9][0-9], re.VERBOSE))], '7': [('tag:yaml.org,2002:float', re.compile('^(?:[-+]?(?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-+][0-9]+)?\n                    |\\.[0-9][0-9_]*(?:[eE][-+][0-9]+)?\n                    |[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*\n                   , re.VERBOSE)), ('tag:yaml.org,2002:int', re.compile('^(?:[-+]?0b[0-1_]+\n                    |[-+]?0[0-7_]+\n                    |[-+]?(?:0|[1-9][0-9_]*)\n                    |[-+]?0x[0-9a-fA-F_]+\n                    |[-+]?[1-9][0-9_]*(?::[0-5]?[0-9]), re.VERBOSE)), ('tag:yaml.org,2002:timestamp', re.compile('^(?:[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]\n                    |[0-9][0-9][0-9][0-9] -[0-9][0-9]? -[0-9][0-9]?\n                     (?:[Tt]|[ \\t]+)[0-9][0-9]?\n                     :[0-9][0-9], re.VERBOSE))], '8': [('tag:yaml.org,2002:float', re.compile('^(?:[-+]?(?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-+][0-9]+)?\n                    |\\.[0-9][0-9_]*(?:[eE][-+][0-9]+)?\n                    |[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*\n                   , re.VERBOSE)), ('tag:yaml.org,2002:int', re.compile('^(?:[-+]?0b[0-1_]+\n                    |[-+]?0[0-7_]+\n                    |[-+]?(?:0|[1-9][0-9_]*)\n                    |[-+]?0x[0-9a-fA-F_]+\n                    |[-+]?[1-9][0-9_]*(?::[0-5]?[0-9]), re.VERBOSE)), ('tag:yaml.org,2002:timestamp', re.compile('^(?:[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]\n                    |[0-9][0-9][0-9][0-9] -[0-9][0-9]? -[0-9][0-9]?\n                     (?:[Tt]|[ \\t]+)[0-9][0-9]?\n                     :[0-9][0-9], re.VERBOSE))], '9': [('tag:yaml.org,2002:float', re.compile('^(?:[-+]?(?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-+][0-9]+)?\n                    |\\.[0-9][0-9_]*(?:[eE][-+][0-9]+)?\n                    |[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*\n                   , re.VERBOSE)), ('tag:yaml.org,2002:int', re.compile('^(?:[-+]?0b[0-1_]+\n                    |[-+]?0[0-7_]+\n                    |[-+]?(?:0|[1-9][0-9_]*)\n                    |[-+]?0x[0-9a-fA-F_]+\n                    |[-+]?[1-9][0-9_]*(?::[0-5]?[0-9]), re.VERBOSE)), ('tag:yaml.org,2002:timestamp', re.compile('^(?:[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]\n                    |[0-9][0-9][0-9][0-9] -[0-9][0-9]? -[0-9][0-9]?\n                     (?:[Tt]|[ \\t]+)[0-9][0-9]?\n                     :[0-9][0-9], re.VERBOSE))], '<': [('tag:yaml.org,2002:merge', re.compile('^(?:<<)$'))], '=': [('tag:yaml.org,2002:value', re.compile('^(?:=)$'))], 'F': [('tag:yaml.org,2002:bool', re.compile('^(?:yes|Yes|YES|no|No|NO\n                    |true|True|TRUE|false|False|FALSE\n                    |on|On|ON|off|Off|OFF)$', re.VERBOSE))], 'N': [('tag:yaml.org,2002:bool', re.compile('^(?:yes|Yes|YES|no|No|NO\n                    |true|True|TRUE|false|False|FALSE\n                    |on|On|ON|off|Off|OFF)$', re.VERBOSE)), ('tag:yaml.org,2002:null', re.compile('^(?: ~\n                    |null|Null|NULL\n                    | )$', re.VERBOSE))], 'T': [('tag:yaml.org,2002:bool', re.compile('^(?:yes|Yes|YES|no|No|NO\n                    |true|True|TRUE|false|False|FALSE\n                    |on|On|ON|off|Off|OFF)$', re.VERBOSE))], 'Y': [('tag:yaml.org,2002:bool', re.compile('^(?:yes|Yes|YES|no|No|NO\n                    |true|True|TRUE|false|False|FALSE\n                    |on|On|ON|off|Off|OFF)$', re.VERBOSE))], 'f': [('tag:yaml.org,2002:bool', re.compile('^(?:yes|Yes|YES|no|No|NO\n                    |true|True|TRUE|false|False|FALSE\n                    |on|On|ON|off|Off|OFF)$', re.VERBOSE))], 'n': [('tag:yaml.org,2002:bool', re.compile('^(?:yes|Yes|YES|no|No|NO\n                    |true|True|TRUE|false|False|FALSE\n                    |on|On|ON|off|Off|OFF)$', re.VERBOSE)), ('tag:yaml.org,2002:null', re.compile('^(?: ~\n                    |null|Null|NULL\n                    | )$', re.VERBOSE))], 't': [('tag:yaml.org,2002:bool', re.compile('^(?:yes|Yes|YES|no|No|NO\n                    |true|True|TRUE|false|False|FALSE\n                    |on|On|ON|off|Off|OFF)$', re.VERBOSE))], 'y': [('tag:yaml.org,2002:bool', re.compile('^(?:yes|Yes|YES|no|No|NO\n                    |true|True|TRUE|false|False|FALSE\n                    |on|On|ON|off|Off|OFF)$', re.VERBOSE))], '~': [('tag:yaml.org,2002:null', re.compile('^(?: ~\n                    |null|Null|NULL\n                    | )$', re.VERBOSE))]}#
yaml_multi_constructors = {'tag:yaml.org,2002:python/name:': <function FullConstructor.construct_python_name>}#
yaml_path_resolvers = {}#
jina.jaml.helper.get_jina_loader_with_runtime(runtime_args=None)[source]#

Create a JinaLoader init function which already stored the runtime_args in the init function, usefully for yaml.load(stream,loader=JinaLoader) which needs a class with a init function with only one parameter

Parameters:

runtime_args (Optional[Dict[str, Any]]) – Optional runtime_args to be directly passed without being parsed into a yaml config

Returns:

A function that initialize a JinaLoader with the runtime_args stored within the function

jina.jaml.helper.parse_config_source(path, allow_stream=True, allow_yaml_file=True, allow_raw_yaml_content=True, allow_class_type=True, allow_dict=True, allow_json=True, allow_url=True, allow_py_module_class_type=True, extra_search_paths=None, *args, **kwargs)[source]#

Check if the text or text stream is valid.

Parameters:
  • path (Union[str, TextIO, Dict]) – the multi-kind source of the configs.

  • allow_stream (bool) – flag

  • allow_yaml_file (bool) – flag

  • allow_raw_yaml_content (bool) – flag

  • allow_class_type (bool) – flag

  • allow_py_module_class_type (bool) – flag

  • allow_dict (bool) – flag

  • allow_json (bool) – flag

  • allow_url (bool) – flag

  • extra_search_paths (Optional[List[str]]) – extra paths to search for

  • args – unused

  • kwargs – unused

Return type:

Tuple[TextIO, Optional[str]]

Returns:

a tuple, the first element is the text stream, the second element is the file path associate to it if available.

jina.jaml.helper.complete_path(path, extra_search_paths=None, raise_nonexist=True)[source]#

Complete the path of file via searching in abs and relative paths.

Parameters:
  • path (str) – path of file.

  • extra_search_paths (Optional[List[str]]) – extra paths to conduct search

  • raise_nonexist (bool) – raise exception if the file does not exist

Return type:

str

Returns:

Completed file path.

jina.jaml.helper.load_py_modules(d, extra_search_paths=None)[source]#

Find ‘py_modules’ in the dict recursively and then load them.

Parameters:
  • d (Dict) – the dictionary to traverse

  • extra_search_paths (Optional[List[str]]) – any extra paths to search

Return type:

None