Пример #1
0
    CustomInstance,
    CustomClass,
    translate_call,
    _FuncArgsError,
    get_iter_type,
    Subtype,
    InstanceArg,
    Var,
    FixedArg,
    ANY,
    BOT,
)

from icbd.type_analyzer.builtins import (BUILTINS, KNOWN_MODULES, make_class)

sqlalchemy = Module("sqlalchemy", "__builtin__")
schema = Module("schema", "__builtin__")
sqlalchemy.setattr("schema", Union(schema))

MetaData = UserClassType("MetaData", (ObjectClass, ))


class TableClassType(CustomClass):
    def __init__(self):
        super(TableClassType, self).__init__("Table")

    def call(self, args, keywords, starargs, context, dryrun, orig_args):
        assert isinstance(orig_args[0], _ast.Str)
        assert args[0] == Union(STR)
        if args[1] == Union.EMPTY:
            context.log_error("no metadata specified")
Пример #2
0
    CustomInstance,
    UserClassType,
    translate_call,
    _FuncArgsError,
    get_iter_type,
    Subtype,
    InstanceArg,
    Var,
    FixedArg,
    ANY,
    BOT,
)

from icbd.type_analyzer.builtins import (BUILTINS, KNOWN_MODULES, make_class)

pylons = Module("pylons", "__builtin__")
controllers = Module("controllers", "__builtin__")
pylons.setattr("controllers", Union(controllers))
WSGIController = UserClassType("WSGIController", (ObjectClass, ))
controllers.setattr("WSGIController", Union(WSGIController))

StackedObjectProxy = UserClassType("StackedObjectProxy", (ObjectClass, ))


class StackedObjectProxyType(CustomInstance):
    def __init__(self):
        super(StackedObjectProxyType, self).__init__(StackedObjectProxy, [])

    def getattr(self, attr, context):
        u = super(StackedObjectProxyType, self).get_name(attr, context)
        if u: