Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
37 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
1.28.5 | ||
1.28.6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,21 @@ | ||
# -*- coding: UTF-8 -*- | ||
"""Module for enhancing functools preimport. | ||
Source: https://stackoverflow.com/questions/43506378/how-to-get-source-code-of-function-that-is-wrapped-by-a-decorator | ||
""" | ||
import functools | ||
import sys | ||
|
||
|
||
if sys.version_info < (3,): | ||
def add_wrapped_dunder(uw): | ||
""" This adds the __wrapped__ dunder to a wrapped function. This is implemented from Python 3.2 and is thus | ||
added for compatibility with Python 2. """ | ||
@functools.wraps(uw) | ||
def update_wrapper(wrapper, wrapped, assigned=functools.WRAPPER_ASSIGNMENTS, updated=functools.WRAPPER_UPDATES): | ||
wrapper = uw(wrapper, wrapped, assigned, updated) | ||
wrapper.__wrapped__ = wrapped | ||
return wrapper | ||
return update_wrapper | ||
functools.update_wrapper = add_wrapped_dunder(functools.update_wrapper) | ||
|
||
# -*- coding: UTF-8 -*- | ||
"""Module for enhancing functools preimport. | ||
""" | ||
import functools | ||
|
||
|
||
# source: https://stackoverflow.com/questions/6394511/python-functools-wraps-equivalent-for-classes | ||
def wraps_cls(cls): | ||
class _Wrapper(cls): | ||
def __init__(self, wrapped, assignents=functools.WRAPPER_ASSIGNMENTS): | ||
self.__wrapped__ = wrapped | ||
for attr in assignents: | ||
setattr(self, attr, getattr(wrapped, attr)) | ||
super().__init__() | ||
|
||
def __repr__(self): | ||
return repr(self.__wrapped__) | ||
return _Wrapper | ||
functools.wraps_cls = wraps_cls | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters