def assign(self, args, meta): assert_isa(args, List[str]) # TODO let if args[0] == '__slots__' or args[0].startswith('__serialize_'): return '' if getattr(meta, 'in_class', False): var, value = args return f"get {var}() {{ return {value}; }}" let = 'let ' if getattr(meta, 'new_var', False) else '' return let + ' = '.join(args)
def arguments(self, args): assert_isa(args, List[Optional[str]]) return ', '.join(p for p in args if p)
def parameters(self, params): assert_isa(params, List[Optional[str]]) if params and params[0] == 'self': params = params[1:] return '(%s)' % ', '.join(p for p in params if p)
def file_input(self, nodes): assert_isa(nodes, List[str]) return '\n'.join(nodes)
def suite(self, stmts): assert_isa(stmts, List[str]) return '\n'.join(stmts)
def and_expr(self, args): assert_isa(args, List[str]) return '(%s)' % ' & '.join(args)
def or_test(self, args): assert_isa(args, List[str]) return '(%s)' % ' || '.join(args)