def inner(state: GeneratorAcc, path: Path) -> str: return scripter.index_access( state.import_ident(path, Exported(Path("typing"), "Mapping")), "str", scalar_typing_expr(state, path), )
def inner(state: GeneratorAcc, path: Path) -> str: return scripter.invocation( scripter.prop_access( state.import_ident( path, self.idol_py.idol_py_file.primitive), "of"), prim_expr(state, path), )
def inner(state: GeneratorAcc, path: Path) -> str: return scripter.invocation( scripter.prop_access( state.import_ident(path, self.idol_py.idol_py_file.literal), "of"), scripter.literal(value), )
def expr(state: GeneratorAcc, path: Path) -> str: args, kwds = self.resolve_args_and_kwds(state, path) return scripter.invocation( state.import_ident(path, idol_mar.idol_mar_file.wrap_field), self.constructor_ident(state, path), scripter.literal(name), *list(scripter.thunk(arg) for arg in args), **kwds, )
def expr(state: GeneratorAcc, path: Path) -> str: kwds = {} if default: kwds["default"] = default(state, path) if default_factory: kwds["default_factory"] = default_factory(state, path) return scripter.invocation( state.import_ident(path, Exported(Path("dataclasses"), "field")), **kwds)
def __init__( self, config: GeneratorConfig, scaffold_impl: "Callable[[IdolPy, Type, Path], IdolPyScaffoldFile]" = None, codegen_impl: "Callable[[IdolPy, Type, Path], IdolPyCodegenFile]" = None, ): super(IdolPy, self).__init__(GeneratorAcc(), config) self.scaffolds = {} self.codegens = {} self.scaffold_impl = scaffold_impl or IdolPyScaffoldFile self.codegen_impl = codegen_impl or IdolPyCodegenFile
def lazy_import(state: GeneratorAcc, path: Path) -> str: import_module = state.import_ident( path, Exported(Path("importlib"), "import_module")) return scripter.prop_access( scripter.invocation( import_module, scripter.literal( ImportPath.as_python_module_path( path.import_path_to( scaffold_declared_schema.path). rel_path)), "__package__", ), scaffold_declared_schema.ident, )
def __init__(self, config: GeneratorConfig): super(IdolMarshmallow, self).__init__(GeneratorAcc(), config) self.scaffolds = {} self.codegens = {}
def __init__(self, config: GeneratorConfig): super(IdolDataclass, self).__init__(GeneratorAcc(), config) self.scaffolds = {} self.codegens = {}
def inner(state: GeneratorAcc, path: Path) -> str: return scripter.index_access( state.import_ident(path, Exported(Path("typing"), "Optional")), inner_expr(state, path), )
def inner(state: GeneratorAcc, path: Path) -> str: return scripter.thunk( scripter.invocation( "next", scripter.invocation( "iter", state.import_ident(path, declared_enum))))
def any_expr(state: GeneratorAcc, path: Path) -> str: return state.import_ident(path, Exported(Path("typing"), "Any"))