-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CU-8695d4www pydantic 2 #476
base: master
Are you sure you want to change the base?
Changes from 21 commits
b0b3d43
cb0104f
e806d54
ea7e04a
3879fe5
960e405
10a7a58
080ae71
b86135a
0eb9f76
0e9fe91
0cb31ee
a7aab98
897df2d
1bbe88e
cc7c2ce
0ee1a8a
a89e680
825628e
927f807
fadc7d1
b1b11ce
e30ca16
0c5b7ca
6c76acc
a4b2ea0
414f70a
ecc54ab
b160295
6c6881a
b5ddf91
23d03c7
8777256
44e470a
9eab8f0
3d19cd3
ebe17e0
6746b34
b7f895e
3fe2c47
65d653f
11b1c7a
bc5458b
95d294e
4e716ae
2834c27
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,16 +7,21 @@ def _format_version(ver: Tuple[int, int, int]) -> str: | |
return ".".join(str(v) for v in ver) | ||
|
||
|
||
def deprecated(message: str, depr_version: Tuple[int, int, int], removal_version: Tuple[int, int, int]) -> Callable: | ||
def deprecated(message: str, depr_version: Tuple[int, int, int], | ||
removal_version: Tuple[int, int, int], | ||
allow_usage: bool = False) -> Callable: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe there is no need to add and expose this argument to the public API? It looks There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The method does indeed get monkey-patched during testing. I suppose we could add The main reason the method gets monkey-patched during testing is because we (generally) want to avoid using deprecated methods in our code. And if we had 100% test coverage (which we certainly don't - but that's besides the point), raising an exception during test time would guarantee that we're not. But if you've got some ideas on how to do this more elegantly, then don't hesitate to propose them! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Alright. In that case, I think there is no need to deprecate There will be warnings like |
||
"""Deprecate a method. | ||
|
||
NOTE: The `allow_usage` argument is only read and used during test time. | ||
|
||
Args: | ||
message (str): The deprecation message. | ||
depr_version (Tuple[int, int, int]): The first version of MedCAT where this was deprecated. | ||
removal_version (Tuple[int, int, int]): The first version of MedCAT where this will be removed. | ||
allow_usage (bool): Whether to allow usage during test time. | ||
|
||
Returns: | ||
Callable: _description_ | ||
Callable: The wrapped method. | ||
""" | ||
def decorator(func: Callable) -> Callable: | ||
@functools.wraps(func) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍