-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Promote `gare` from `experimental` The `auth_requirements_error` module is moved to `globus_sdk.gare` and docs and importts are updated. Included in this change, `GlobusAuthRequirementsError` has been renamed to `GARE`, as the `Error` suffix to a name typically indicates that a class is an exception class. Aliasing has been put in place from `experimental` to the new code location. As a minor, related fix `_serializable.Serializable` now uses a `Self` type annotation, rather than a type var. This improves the doc rendering of the `from_dict` and `to_dict` methods, as they show the self-type rather than an unbound type variable T. * Require typing_extensions on Python<3.11 In order to use `typing.Self`, we must install `typing_extensions` on Python 3.10. * Rename the various GARE functions And include testing of the rename aliases. * Apply suggestions from code review Co-authored-by: Ada <107940310+ada-globus@users.noreply.github.com> * y mypy y --------- Co-authored-by: Ada <107940310+ada-globus@users.noreply.github.com>
- Loading branch information
1 parent
1d5cb80
commit 99d3bcd
Showing
22 changed files
with
233 additions
and
166 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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Changed | ||
~~~~~~~ | ||
|
||
- Globus Auth Requirements errors are no longer ``experimental``. They have | ||
been moved to the ``globus_sdk.gare`` module and the primary document type | ||
has been renamed from ``GlobusAuthRequirementsError`` to ``GARE``. (:pr:`NUMBER`) | ||
|
||
- The functions provided by this interface have also been renamed to use | ||
``gare`` in their naming: ``to_gare``, ``is_gare``, ``has_gares``, and | ||
``to_gares`` are now all available. The older names are available as | ||
aliases from the ``experimental`` namespace. |
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 @@ | ||
from __future__ import annotations | ||
|
||
import sys | ||
import typing as t | ||
|
||
__all__ = ( | ||
"GlobusAuthRequirementsError", | ||
"GlobusAuthorizationParameters", | ||
"to_auth_requirements_error", | ||
"to_auth_requirements_errors", | ||
"is_auth_requirements_error", | ||
"has_auth_requirements_errors", | ||
) | ||
|
||
# legacy aliases | ||
# (when accessed, these will emit deprecation warnings) | ||
if t.TYPE_CHECKING: | ||
from globus_sdk.gare import GARE as GlobusAuthRequirementsError | ||
from globus_sdk.gare import GlobusAuthorizationParameters | ||
from globus_sdk.gare import has_gares as has_auth_requirements_errors | ||
from globus_sdk.gare import is_gare as is_auth_requirements_error | ||
from globus_sdk.gare import to_gare as to_auth_requirements_error | ||
from globus_sdk.gare import to_gares as to_auth_requirements_errors | ||
else: | ||
|
||
_RENAMES = { | ||
"GlobusAuthRequirementsError": "GARE", | ||
"to_auth_requirements_error": "to_gare", | ||
"to_auth_requirements_errors": "to_gares", | ||
"is_auth_requirements_error": "is_gare", | ||
"has_auth_requirements_errors": "has_gares", | ||
} | ||
|
||
def __getattr__(name: str) -> t.Any: | ||
import globus_sdk.gare as gare_module | ||
from globus_sdk.exc import warn_deprecated | ||
|
||
new_name = _RENAMES.get(name, name) | ||
|
||
warn_deprecated( | ||
"'globus_sdk.experimental.auth_requirements_error' has been renamed to " | ||
"'globus_sdk.gare'. " | ||
f"Importing '{name}' from `globus_sdk.experimental` is deprecated. " | ||
f"Use `globus_sdk.gare.{new_name}` instead." | ||
) | ||
|
||
value = getattr(gare_module, new_name, None) | ||
if value is None: | ||
raise AttributeError(f"module {__name__} has no attribute {name}") | ||
setattr(sys.modules[__name__], name, value) | ||
return value |
19 changes: 0 additions & 19 deletions
19
src/globus_sdk/experimental/auth_requirements_error/__init__.py
This file was deleted.
Oops, something went wrong.
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,11 @@ | ||
from ._auth_requirements_error import GARE, GlobusAuthorizationParameters | ||
from ._functional_api import has_gares, is_gare, to_gare, to_gares | ||
|
||
__all__ = ( | ||
"GARE", | ||
"GlobusAuthorizationParameters", | ||
"to_gare", | ||
"to_gares", | ||
"is_gare", | ||
"has_gares", | ||
) |
Oops, something went wrong.