Пример #1
0
def test_parse(in_str: str, exp_str: Any) -> None:
    relations = make_relations(ALL_TOKENS, VARIABLES, CONSTANTS, PREFIX,
                               PRECEDENCE)
    tokens = in_str.split()
    result = parse(tokens, ALL_TOKENS, relations)
    if exp_str is None:
        assert not result.is_valid
    else:
        assert result.value == exp_str
Пример #2
0
def main(args: List[str]) -> None:
    relations = make_relations(ALL_TOKENS, VARIABLES, CONSTANTS, PREFIX,
                               PRECEDENCE)
    tokens = args[0].strip().split()
    result = parse(tokens, ALL_TOKENS, relations)
    if result.is_valid:
        print(result.value)
    else:
        print('invalid')
Пример #3
0
    def make_mappers( me, **kargs):
        me.mappers = me.DICT()
        iterklasi = [ mklas for mklas in me.iterklasi()
                        if getattr( mklas, 'DBCOOK_hidden', None) != True
                    ]
        me.klas_only_selectables = me.DICT( (klas, me.make_klas_selectable( klas))
                                            for klas in iterklasi)

        try:
            for klas in iterklasi:
                me._make_mapper_polymorphic( klas, **kargs)

            for klas in iterklasi:    #table=me.tables[ klas],
                make_mapper_props( klas, me.mapcontext, me.mappers[ klas], me.tables )

            relation.make_relations( me, sa_relation, sa_backref, FKeyExtractor)
            sqlalchemy.orm.compile_mappers()
        finally:
            if me.generator:
                me.generator.pmapi( m.polymorphic_all for m in me.mappers.itervalues() )
                me.generator.pmapi( m.plain for m in me.mappers.itervalues()
                                            if m.plain is not m.polymorphic_all)
                me.generator.psubs( (m.polymorphic_sub_only, m.polymorphic_all) for m in me.mappers.itervalues()
                                            if m.polymorphic_sub_only)
Пример #4
0
from relation import make_relations
from parse import parse
from data import all_tokens, variables, constants, precedence, prefix

if __name__ == "__main__":
    relations = make_relations(all_tokens, variables, constants, prefix,
                               precedence)
    tokens = input('Input sequence separate by space: ').strip().split()
    print(parse(tokens, all_tokens, relations))
Пример #5
0
 def setUp(self):
     self.relations = make_relations(all_tokens, variables, constants, prefix, precedence)