| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 05de5c0 commit 04eb09c
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -55,7 +55,6 @@ | |||
| 55 | 55 | TYPE_CHECKING, | |
| 56 | 56 | TextIO, | |
| 57 | 57 | Tuple, | |
| 58 | - Type, | ||
| 59 | 58 | Union, | |
| 60 | 59 | cast, | |
| 61 | 60 | overload, | |
@@ -336,15 +335,15 @@ class _GitMeta(type): | |||
| 336 | 335 | This helps issue :class:`DeprecationWarning` if :attr:`Git.USE_SHELL` is used. | |
| 337 | 336 | """ | |
| 338 | 337 | ||
| 339 | - @property | ||
| 340 | - def USE_SHELL(cls: Type[Git]) -> bool: | ||
| 341 | - _warn_use_shell(False) | ||
| 342 | - return cls._USE_SHELL | ||
| 338 | + def __getattribute__(cls, name: str) -> Any: | ||
| 339 | + if name == "USE_SHELL": | ||
| 340 | + _warn_use_shell(False) | ||
| 341 | + return super().__getattribute__(name) | ||
| 343 | 342 | ||
| 344 | - @USE_SHELL.setter | ||
| 345 | - def USE_SHELL(cls: Type[Git], value: bool) -> None: | ||
| 346 | - _warn_use_shell(value) | ||
| 347 | - cls._USE_SHELL = value | ||
| 343 | + def __setattr__(cls, name: str, value: Any) -> Any: | ||
| 344 | + if name == "USE_SHELL": | ||
| 345 | + _warn_use_shell(value) | ||
| 346 | + super().__setattr__(name, value) | ||
| 348 | 347 | ||
| 349 | 348 | ||
| 350 | 349 | class Git(metaclass=_GitMeta): | |
@@ -397,9 +396,7 @@ def __setstate__(self, d: Dict[str, Any]) -> None: | |||
| 397 | 396 | GIT_PYTHON_TRACE = os.environ.get("GIT_PYTHON_TRACE", False) | |
| 398 | 397 | """Enables debugging of GitPython's git commands.""" | |
| 399 | 398 | ||
| 400 | - _USE_SHELL: bool = False | ||
| 401 | - | ||
| 402 | - USE_SHELL: bool | ||
| 399 | + USE_SHELL: bool = False | ||
| 403 | 400 | """Deprecated. If set to ``True``, a shell will be used to execute git commands. | |
| 404 | 401 | ||
| 405 | 402 | Prior to GitPython 2.0.8, this had a narrow purpose in suppressing console windows | |
@@ -909,6 +906,11 @@ def __init__(self, working_dir: Union[None, PathLike] = None) -> None: | |||
| 909 | 906 | self.cat_file_header: Union[None, TBD] = None | |
| 910 | 907 | self.cat_file_all: Union[None, TBD] = None | |
| 911 | 908 | ||
| 909 | + def __getattribute__(self, name: str) -> Any: | ||
| 910 | + if name == "USE_SHELL": | ||
| 911 | + _warn_use_shell(False) | ||
| 912 | + return super().__getattribute__(name) | ||
| 913 | + | ||
| 912 | 914 | def __getattr__(self, name: str) -> Any: | |
| 913 | 915 | """A convenience method as it allows to call the command as if it was an object. | |
| 914 | 916 | ||
@@ -918,11 +920,6 @@ def __getattr__(self, name: str) -> Any: | |||
| 918 | 920 | """ | |
| 919 | 921 | if name.startswith("_"): | |
| 920 | 922 | return super().__getattribute__(name) | |
| 921 | - | ||
| 922 | - if name == "USE_SHELL": | ||
| 923 | - _warn_use_shell(False) | ||
| 924 | - return self._USE_SHELL | ||
| 925 | - | ||
| 926 | 923 | return lambda *args, **kwargs: self._call_process(name, *args, **kwargs) | |
| 927 | 924 | ||
| 928 | 925 | def set_persistent_git_options(self, **kwargs: Any) -> None: | |
@@ -1184,7 +1181,7 @@ def execute( | |||
| 1184 | 1181 | ||
| 1185 | 1182 | stdout_sink = PIPE if with_stdout else getattr(subprocess, "DEVNULL", None) or open(os.devnull, "wb") | |
| 1186 | 1183 | if shell is None: | |
| 1187 | - shell = self._USE_SHELL | ||
| 1184 | + shell = self.USE_SHELL | ||
| 1188 | 1185 | _logger.debug( | |
| 1189 | 1186 | "Popen(%s, cwd=%s, stdin=%s, shell=%s, universal_newlines=%s)", | |
| 1190 | 1187 | redacted_command, | |
| Back | FazBrowse Home | New Git URL |
0 commit comments