| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 28bd4a3 commit dffa930
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -93,6 +93,8 @@ | |||
| 93 | 93 | if TYPE_CHECKING: | |
| 94 | 94 | from types import ModuleType | |
| 95 | 95 | ||
| 96 | + import warnings | ||
| 97 | + | ||
| 96 | 98 | from gitdb.util import to_hex_sha | |
| 97 | 99 | ||
| 98 | 100 | from git.exc import ( | |
@@ -167,6 +169,7 @@ | |||
| 167 | 169 | IndexEntry, | |
| 168 | 170 | IndexFile, | |
| 169 | 171 | StageType, | |
| 172 | + util, | ||
| 170 | 173 | ) | |
| 171 | 174 | from git.util import ( # @NoMove | |
| 172 | 175 | Actor, | |
@@ -198,12 +201,11 @@ | |||
| 198 | 201 | # the intuitive but potentially incompatible binding occurs due to the usual rules for | |
| 199 | 202 | # Python submodule bindings. So for now we delete that and let __getattr__ handle it. | |
| 200 | 203 | # | |
| 201 | - del util # type: ignore[name-defined] # noqa: F821 | ||
| 204 | + del util | ||
| 202 | 205 | ||
| 203 | 206 | ||
| 204 | 207 | def _warned_import(message: str, fullname: str) -> "ModuleType": | |
| 205 | 208 | import importlib | |
| 206 | - import warnings | ||
| 207 | 209 | ||
| 208 | 210 | warnings.warn(message, DeprecationWarning, stacklevel=3) | |
| 209 | 211 | return importlib.import_module(fullname) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -13,6 +13,7 @@ | |||
| 13 | 13 | import locale | |
| 14 | 14 | import os | |
| 15 | 15 | import sys | |
| 16 | + import warnings | ||
| 16 | 17 | ||
| 17 | 18 | from gitdb.utils.encoding import force_bytes, force_text # noqa: F401 | |
| 18 | 19 | ||
@@ -48,8 +49,6 @@ def _getattr(name: str) -> Any: | |||
| 48 | 49 | except KeyError: | |
| 49 | 50 | raise AttributeError(f"module {__name__!r} has no attribute {name!r}") from None | |
| 50 | 51 | ||
| 51 | - import warnings | ||
| 52 | - | ||
| 53 | 52 | warnings.warn( | |
| 54 | 53 | f"{__name__}.{name} and other is_<platform> aliases are deprecated. " | |
| 55 | 54 | "Write the desired os.name or sys.platform check explicitly instead.", | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -17,6 +17,7 @@ | |||
| 17 | 17 | TypeVar, | |
| 18 | 18 | Union, | |
| 19 | 19 | ) | |
| 20 | + import warnings | ||
| 20 | 21 | ||
| 21 | 22 | if sys.version_info >= (3, 8): | |
| 22 | 23 | from typing import ( | |
@@ -150,9 +151,19 @@ | |||
| 150 | 151 | ||
| 151 | 152 | ||
| 152 | 153 | def _getattr(name: str) -> Any: | |
| 153 | - if name == "Lit_commit_ish": | ||
| 154 | - return Literal["commit", "tag"] | ||
| 155 | - raise AttributeError(f"module {__name__!r} has no attribute {name!r}") | ||
| 154 | + if name != "Lit_commit_ish": | ||
| 155 | + raise AttributeError(f"module {__name__!r} has no attribute {name!r}") | ||
| 156 | + | ||
| 157 | + warnings.warn( | ||
| 158 | + "Lit_commit_ish is deprecated. It is currently defined as " | ||
| 159 | + '`Literal["commit", "tag"]`, which should be used in its place if desired. It ' | ||
| 160 | + 'had previously been defined as `Literal["commit", "tag", "blob", "tree"]`, ' | ||
| 161 | + "covering all four git object type strings including those that are never " | ||
| 162 | + "commit-ish. For that, use the GitObjectTypeString type instead.", | ||
| 163 | + DeprecationWarning, | ||
| 164 | + stacklevel=2, | ||
| 165 | + ) | ||
| 166 | + return Literal["commit", "tag"] | ||
| 156 | 167 | ||
| 157 | 168 | ||
| 158 | 169 | if not TYPE_CHECKING: # Preserve static checking for undefined/misspelled attributes. | |
| Back | FazBrowse Home | New Git URL |
0 commit comments