From 96e0bee87a7afee436672c9a52b3784988a75093 Mon Sep 17 00:00:00 2001 From: night199uk Date: Thu, 8 Mar 2018 21:34:14 +0100 Subject: [PATCH] Allow functools partials to be used with the InlineTransformer --- lark/utils.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lark/utils.py b/lark/utils.py index abe036f..f606704 100644 --- a/lark/utils.py +++ b/lark/utils.py @@ -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):