8000 Python2 compatibility fix. Named args changed to kwargs with defaults · safufude/lib-python@60744c5 · GitHub
[go: up one dir, main page]

Skip to content

Commit 60744c5

Browse files
author
amorozenko
committed
Python2 compatibility fix. Named args changed to kwargs with defaults
1 parent 5408766 commit 60744c5

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

blynktimer.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,11 @@ def _get_func_name(self, obj):
5151
# simply returns 'timer' if on port without function attrs
5252
return getattr(obj, '__name__', 'timer')
5353

54-
def register(blynk, *args, interval=DEFAULT_INTERVAL, run_once=False, **kwargs):
54+
def register(blynk, *args, **kwargs):
55+
# kwargs with defaults are used cause PEP 3102 no supported by Python2
56+
interval = kwargs.pop('interval', DEFAULT_INTERVAL)
57+
run_once = kwargs.pop('run_once', False)
58+
5559
class Deco(object):
5660
def __init__(self, func):
5761
self.func = func

0 commit comments

Comments
 (0)
0