jina.jaml.helper module

    Bases:

    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)

      Build the mapping from node.

      • Parameters

        • node – the node to traverse

        • deep – required param from YAML constructor

        Returns

        Mapped data

    class jina.jaml.helper.JinaResolver[source]

    Bases: yaml.resolver.Resolver

    Remove on|On|ON as bool resolver.

    Bases: yaml.reader.Reader, yaml.scanner.Scanner, yaml.parser.Parser, yaml.composer.Composer, , jina.jaml.helper.JinaResolver

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

    • Parameters

      stream – the stream to load.

    Initialize the scanner.

    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, extra_search_paths=None, \args, **kwargs*)

    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 () – flag

      • allow_raw_yaml_content (bool) – flag

      • allow_class_type (bool) – flag

      • allow_dict (bool) – flag

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

      • args – unused

      • kwargs – unused

      Tuple[TextIO, Optional[]]

      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)[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

      Return type

      str

      Returns

      Completed file path.

    jina.jaml.helper.load_py_modules(d, extra_search_paths=None)

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

    • Parameters

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

      Return type