Add "DEPRECATION" to start of message when composing it

This commit is contained in:
Pradyun Gedam 2018-07-06 04:41:19 +05:30
parent a1912454b8
commit 4c2b268d52
No known key found for this signature in database
GPG Key ID: DA17C4B29CB32E4B
1 changed files with 3 additions and 6 deletions

View File

@ -35,11 +35,6 @@ def _showwarning(message, category, filename, lineno, file=None, line=None):
# deprecation messages for pip.
logger = logging.getLogger("pip._internal.deprecations")
# This is purposely using the % formatter here instead of letting
# the logging module handle the interpolation. This is because we
# want it to appear as if someone typed this entire message out.
log_message = "DEPRECATION: %s" % message
# PipPendingDeprecationWarnings still have at least 2
# versions to go until they are removed so they can just be
# warnings. Otherwise, they will be removed in the very next
@ -74,7 +69,9 @@ def deprecated(reason, replacement, issue=None, imminent=False):
category = PipPendingDeprecationWarning
# Construct a nice message.
message = reason
# This is purposely eagerly formatted as we want it to appear as if someone
# typed this entire message out.
message = "DEPRECATION: " + reason
if replacement is not None:
message += " An alternative is to {}.".format(replacement)
if issue is not None: