Skip to content

Commit 10cd14f

Browse files
authored
refactor: Drop dependency on decorator package (cont) (ietf-tools#7219)
1 parent 902ff53 commit 10cd14f

2 files changed

Lines changed: 11 additions & 13 deletions

File tree

debug.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def fix(s,n=64):
5555
if len(s) > n+3:
5656
s = s[:n]+"..."
5757
return s
58-
def wrap(fn, *params,**kwargs):
58+
def wrap(*params,**kwargs):
5959
call = wrap.callcount = wrap.callcount + 1
6060

6161
indent = ' ' * _report_indent[0]
@@ -81,8 +81,8 @@ def wrap(fn, *params,**kwargs):
8181
return ret
8282
wrap.callcount = 0
8383
if debug:
84-
from decorator import decorator
85-
return decorator(wrap, fn)
84+
from functools import update_wrapper
85+
return update_wrapper(wrap, fn)
8686
else:
8787
return fn
8888

@@ -119,7 +119,7 @@ def clock(s):
119119
def time(fn):
120120
"""Decorator to print timing information about a function call.
121121
"""
122-
def wrap(fn, *params,**kwargs):
122+
def wrap(*params,**kwargs):
123123

124124
indent = ' ' * _report_indent[0]
125125
fc = "%s.%s()" % (fn.__module__, fn.__name__,)
@@ -132,8 +132,8 @@ def wrap(fn, *params,**kwargs):
132132
return ret
133133
wrap.callcount = 0
134134
if debug:
135-
from decorator import decorator
136-
return decorator(wrap, fn)
135+
from functools import update_wrapper
136+
return update_wrapper(wrap, fn)
137137
else:
138138
return fn
139139

@@ -190,7 +190,7 @@ def type(name):
190190
value = eval(name, frame.f_globals, frame.f_locals)
191191
indent = ' ' * (_report_indent[0])
192192
sys.stderr.write("%s%s: %s\n" % (indent, name, value))
193-
193+
194194
def say(s):
195195
if debug:
196196
indent = ' ' * (_report_indent[0])
@@ -205,11 +205,11 @@ def wrapper(*args, **kwargs):
205205
prof.dump_stats(datafn)
206206
return retval
207207
if debug:
208-
from decorator import decorator
209-
return decorator(wrapper, fn)
208+
from functools import update_wrapper
209+
return update_wrapper(wrapper, fn)
210210
else:
211211
return fn
212-
212+
213213
def traceback(levels=None):
214214
if debug:
215215
indent = ' ' * (_report_indent[0])

requirements.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ bleach>=6
88
types-bleach>=6
99
celery>=5.2.6
1010
coverage>=4.5.4,<5.0 # Coverage 5.x moves from a json database to SQLite. Moving to 5.x will require substantial rewrites in ietf.utils.test_runner and ietf.release.views
11-
decorator>=5.1.1
12-
types-decorator>=5.1.1
1311
defusedxml>=0.7.1 # for TastyPie when using xml; not a declared dependency
1412
Django>4.2,<5
1513
django-analytical>=3.1.0
@@ -56,7 +54,7 @@ pyquery>=1.4.3
5654
python-dateutil>=2.8.2
5755
types-python-dateutil>=2.8.2
5856
python-magic==0.4.18 # Versions beyond the yanked .19 and .20 introduce form failures
59-
pymemcache>=4.0.0 # for django.core.cache.backends.memcached.PyMemcacheCache
57+
pymemcache>=4.0.0 # for django.core.cache.backends.memcached.PyMemcacheCache
6058
python-mimeparse>=1.6 # from TastyPie
6159
pytz==2022.2.1 # Pinned as changes need to be vetted for their effect on Meeting fields
6260
requests>=2.31.0

0 commit comments

Comments
 (0)