-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #154 from eyecan-ai/develop
Develop
- Loading branch information
Showing
46 changed files
with
779 additions
and
34 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
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 |
---|---|---|
|
@@ -2,4 +2,4 @@ | |
|
||
__author__ = "Eyecan.ai" | ||
__email__ = "[email protected]" | ||
__version__ = "1.9.0" | ||
__version__ = "1.9.1" |
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
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
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
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
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
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 |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import functools | ||
import inspect | ||
import warnings | ||
|
||
|
||
def deprecated(reason): # pragma: no cover | ||
"""Decorator to mark classes and functions as deprecated. | ||
A warning will be emitted when the function is used or the class is created. | ||
""" | ||
|
||
def _helper(wrapped, extra): | ||
msg = ( | ||
"Call to deprecated " | ||
f"{'class' if inspect.isclass(wrapped) else 'function'} " | ||
f"{wrapped.__name__}{extra}" | ||
) | ||
|
||
def show_warning(): | ||
warnings.simplefilter("always", DeprecationWarning) | ||
warnings.warn( | ||
msg, | ||
category=DeprecationWarning, | ||
stacklevel=3, | ||
) | ||
warnings.simplefilter("default", DeprecationWarning) | ||
|
||
if inspect.isclass(wrapped): | ||
old_new1 = wrapped.__new__ | ||
|
||
def wrapped_new(cls, *args, **kwargs): | ||
show_warning() | ||
if old_new1 is object.__new__: | ||
return old_new1(cls) # type: ignore | ||
return old_new1(cls, *args, **kwargs) | ||
|
||
wrapped.__new__ = staticmethod(functools.wraps(old_new1)(wrapped_new)) # type: ignore | ||
|
||
return wrapped | ||
else: | ||
|
||
@functools.wraps(wrapped) | ||
def wrapper(*args, **kwargs): | ||
show_warning() | ||
return wrapped(*args, **kwargs) | ||
|
||
return wrapper | ||
|
||
if isinstance(reason, (str, bytes)): | ||
return functools.partial(_helper, extra=f" ({reason})") | ||
else: | ||
return _helper(reason, "") |
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
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
Oops, something went wrong.