mirror of https://github.com/pypa/pip
Rename variable for clarity
It doesn't represent warnings.showwarning's current state so, the name shouldn't suggest that.
This commit is contained in:
parent
a8eaf1e0ff
commit
a1912454b8
|
@ -20,14 +20,14 @@ class PipPendingDeprecationWarning(PipDeprecationWarning):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
_warnings_showwarning = None # type: Any
|
_original_showwarning = None # type: Any
|
||||||
|
|
||||||
|
|
||||||
# Warnings <-> Logging Integration
|
# Warnings <-> Logging Integration
|
||||||
def _showwarning(message, category, filename, lineno, file=None, line=None):
|
def _showwarning(message, category, filename, lineno, file=None, line=None):
|
||||||
if file is not None:
|
if file is not None:
|
||||||
if _warnings_showwarning is not None:
|
if _original_showwarning is not None:
|
||||||
_warnings_showwarning(
|
_original_showwarning(
|
||||||
message, category, filename, lineno, file, line,
|
message, category, filename, lineno, file, line,
|
||||||
)
|
)
|
||||||
elif issubclass(category, PipDeprecationWarning):
|
elif issubclass(category, PipDeprecationWarning):
|
||||||
|
@ -50,7 +50,7 @@ def _showwarning(message, category, filename, lineno, file=None, line=None):
|
||||||
else:
|
else:
|
||||||
logger.error(log_message)
|
logger.error(log_message)
|
||||||
else:
|
else:
|
||||||
_warnings_showwarning(
|
_original_showwarning(
|
||||||
message, category, filename, lineno, file, line,
|
message, category, filename, lineno, file, line,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -59,10 +59,10 @@ def install_warning_logger():
|
||||||
# Enable our Deprecation Warnings
|
# Enable our Deprecation Warnings
|
||||||
warnings.simplefilter("default", PipDeprecationWarning, append=True)
|
warnings.simplefilter("default", PipDeprecationWarning, append=True)
|
||||||
|
|
||||||
global _warnings_showwarning
|
global _original_showwarning
|
||||||
|
|
||||||
if _warnings_showwarning is None:
|
if _original_showwarning is None:
|
||||||
_warnings_showwarning = warnings.showwarning
|
_original_showwarning = warnings.showwarning
|
||||||
warnings.showwarning = _showwarning
|
warnings.showwarning = _showwarning
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue