Edit File by line
/home/barbar84/www/wp-conte.../plugins/sujqvwi/AnonR/anonr.TX.../lib/python2..../site-pac.../pip/utils
File: deprecation.py
"""
[0] Fix | Delete
A module that implements tooling to enable easy warnings about deprecations.
[1] Fix | Delete
"""
[2] Fix | Delete
from __future__ import absolute_import
[3] Fix | Delete
[4] Fix | Delete
import logging
[5] Fix | Delete
import warnings
[6] Fix | Delete
[7] Fix | Delete
[8] Fix | Delete
class PipDeprecationWarning(Warning):
[9] Fix | Delete
pass
[10] Fix | Delete
[11] Fix | Delete
[12] Fix | Delete
class Pending(object):
[13] Fix | Delete
pass
[14] Fix | Delete
[15] Fix | Delete
[16] Fix | Delete
class RemovedInPip10Warning(PipDeprecationWarning):
[17] Fix | Delete
pass
[18] Fix | Delete
[19] Fix | Delete
[20] Fix | Delete
class RemovedInPip11Warning(PipDeprecationWarning, Pending):
[21] Fix | Delete
pass
[22] Fix | Delete
[23] Fix | Delete
[24] Fix | Delete
class Python26DeprecationWarning(PipDeprecationWarning):
[25] Fix | Delete
pass
[26] Fix | Delete
[27] Fix | Delete
[28] Fix | Delete
# Warnings <-> Logging Integration
[29] Fix | Delete
[30] Fix | Delete
[31] Fix | Delete
_warnings_showwarning = None
[32] Fix | Delete
[33] Fix | Delete
[34] Fix | Delete
def _showwarning(message, category, filename, lineno, file=None, line=None):
[35] Fix | Delete
if file is not None:
[36] Fix | Delete
if _warnings_showwarning is not None:
[37] Fix | Delete
_warnings_showwarning(
[38] Fix | Delete
message, category, filename, lineno, file, line,
[39] Fix | Delete
)
[40] Fix | Delete
else:
[41] Fix | Delete
if issubclass(category, PipDeprecationWarning):
[42] Fix | Delete
# We use a specially named logger which will handle all of the
[43] Fix | Delete
# deprecation messages for pip.
[44] Fix | Delete
logger = logging.getLogger("pip.deprecations")
[45] Fix | Delete
[46] Fix | Delete
# This is purposely using the % formatter here instead of letting
[47] Fix | Delete
# the logging module handle the interpolation. This is because we
[48] Fix | Delete
# want it to appear as if someone typed this entire message out.
[49] Fix | Delete
log_message = "DEPRECATION: %s" % message
[50] Fix | Delete
[51] Fix | Delete
# PipDeprecationWarnings that are Pending still have at least 2
[52] Fix | Delete
# versions to go until they are removed so they can just be
[53] Fix | Delete
# warnings. Otherwise, they will be removed in the very next
[54] Fix | Delete
# version of pip. We want these to be more obvious so we use the
[55] Fix | Delete
# ERROR logging level.
[56] Fix | Delete
if issubclass(category, Pending):
[57] Fix | Delete
logger.warning(log_message)
[58] Fix | Delete
else:
[59] Fix | Delete
logger.error(log_message)
[60] Fix | Delete
else:
[61] Fix | Delete
_warnings_showwarning(
[62] Fix | Delete
message, category, filename, lineno, file, line,
[63] Fix | Delete
)
[64] Fix | Delete
[65] Fix | Delete
[66] Fix | Delete
def install_warning_logger():
[67] Fix | Delete
# Enable our Deprecation Warnings
[68] Fix | Delete
warnings.simplefilter("default", PipDeprecationWarning, append=True)
[69] Fix | Delete
[70] Fix | Delete
global _warnings_showwarning
[71] Fix | Delete
[72] Fix | Delete
if _warnings_showwarning is None:
[73] Fix | Delete
_warnings_showwarning = warnings.showwarning
[74] Fix | Delete
warnings.showwarning = _showwarning
[75] Fix | Delete
[76] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function