Make Asty use static rather than instance methods
This ensures `asty.Pass is asty.Pass`.
This commit is contained in:
parent
d3bd7c1017
commit
844256b99b
@ -111,13 +111,13 @@ def builds_model(*model_types):
|
||||
# ast.Foo(..., lineno=x.lineno, col_offset=x.col_offset)
|
||||
class Asty(object):
|
||||
def __getattr__(self, name):
|
||||
setattr(Asty, name, lambda self, x, **kwargs: getattr(ast, name)(
|
||||
setattr(Asty, name, staticmethod(lambda x, **kwargs: getattr(ast, name)(
|
||||
lineno=getattr(
|
||||
x, 'start_line', getattr(x, 'lineno', None)),
|
||||
col_offset=getattr(
|
||||
x, 'start_column', getattr(x, 'col_offset', None)),
|
||||
**kwargs))
|
||||
return getattr(self, name)
|
||||
**kwargs)))
|
||||
return getattr(Asty, name)
|
||||
asty = Asty()
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user