Browse Source

Allow functools partials to be used with the InlineTransformer

tags/gm/2021-09-23T00Z/github.com--lark-parser-lark/0.5.6
night199uk 6 years ago
parent
commit
96e0bee87a
1 changed files with 6 additions and 0 deletions
  1. +6
    -0
      lark/utils.py

+ 6
- 0
lark/utils.py View File

@@ -71,6 +71,12 @@ def inline_args(f):
def _f(self, args):
return f.__func__(self, *args)
return _f
elif isinstance(f, functools.partial):
# wraps does not work for partials in 2.7: https://bugs.python.org/issue3445
# @functools.wraps(f)
def _f(self, args):
return f(*args)
return _f
else:
@functools.wraps(f.__call__.__func__)
def _f(self, args):


Loading…
Cancel
Save