def get_loader(*args, **kwargs) -> YAML: yaml = YAML() yaml.version = (1, 2) # type: ignore yaml.Parser = Parser yaml._constructor = CustomConstructor(yaml, *args, **kwargs) # type: ignore return yaml
def get_loader(macros_root: str = None, context: ContextType = {}) -> YAML: yaml = YAML() yaml.version = (1, 2) # type: ignore yaml.Parser = Parser yaml._constructor = CustomConstructor( # type: ignore yaml, # macros_root=macros_root, macro_provider=MacroProvider(macros_root).get_macro, context=context ) return yaml
def get_constructor(): yaml = YAML() yaml._constructor = CustomConstructor(loader=yaml) yaml.version = (1, 2) return yaml.constructor