Browse Source

Merge pull request #102 from night199uk/functools

Allow functools partials to be used with the InlineTransformer
tags/gm/2021-09-23T00Z/github.com--lark-parser-lark/0.5.6
Erez Shinan 6 years ago
committed by GitHub
parent
commit
52d4ce2990
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
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