# AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/registry.ipynb.

# %% auto 0
__all__ = ['Config', 'AttrDict', 'registry', 'tryeval', 'parse', 'parse_and_resolve', 'parse_string']

# %% ../nbs/registry.ipynb 2
from .markup import Config, AttrDict, L
from .thinc_parser.parser import registry

# %% ../nbs/registry.ipynb 3
Config = Config
AttrDict = AttrDict
registry = registry


def tryeval(i):
    try:
        return eval(i)
    except:
        return i


def parse(file, lazyeval=False):
    o = AttrDict(Config().from_disk(file))
    if not lazyeval:
        o.map(tryeval)
    return o


def parse_and_resolve(file):
    o = AttrDict(registry.resolve(Config().from_disk(file)))
    o.map(tryeval)
    return o


def parse_string(string):
    o = AttrDict(Config().from_str(string))
    o.map(tryeval)
    return o
