o g+@sUdZddlZddlZddlmZmZmZmZmZddl m Z ddl m Z dZGdddeZdaeed <  dd eeefd eed ed edeedeeddfddZdddZddddedeedeedeedeeddf ddZdS)zN A module that implements tooling to enable easy warnings about deprecations. N)AnyOptionalTextIOTypeUnion)parse) __version__z DEPRECATION: c@s eZdZdS)PipDeprecationWarningN)__name__ __module__ __qualname__r r A/usr/lib/python3/dist-packages/pip/_internal/utils/deprecation.pyr sr _original_showwarningmessagecategoryfilenamelinenofilelinereturncCsb|durtdurt||||||dSdSt|tr&td}||dSt||||||dS)Nzpip._internal.deprecations)r issubclassr logging getLoggerwarning)rrrrrrloggerr r r _showwarnings  rcCs,tjdtddtdurtjatt_dSdS)NdefaultT)append)warnings simplefilterr r showwarningrr r r rinstall_warning_logger,s  r") feature_flagissuereason replacementgone_inr#r$cCs|duo ttt|k}|tdf||sdndf|df||s!dndf|dfg}dd d |D}|r8t|tj|td d dS) aHelper to deprecate existing functionality. reason: Textual reason shown to the user about why this functionality has been deprecated. Should be a complete sentence. replacement: Textual suggestion shown to the user about what alternative functionality they can use. gone_in: The version of pip does this functionality should get removed in. Raises an error if pip's current version is greater than or equal to this. feature_flag: Command-line flag of the form --use-feature={feature_flag} for testing upcoming functionality. issue: Issue number on the tracker that would serve as a useful place for users to find related discussion and provide feedback. Nz{}z*pip {} will enforce this behaviour change.z*Since pip {}, this is no longer supported.zA possible replacement is {}.zEYou can use the flag --use-feature={} to test the upcoming behaviour.z@Discussion can be found at https://github.com/pypa/pip/issues/{} css.|]\}}|dur|dur||VqdS)N)format).0value format_strr r r nszdeprecated..)r stacklevel)rcurrent_versionDEPRECATION_MSG_PREFIXjoinr rwarn)r%r&r'r#r$is_gone message_partsrr r r deprecated7s2  r6)NN)rN)__doc__rrtypingrrrrrpip._vendor.packaging.versionrpiprr0r1Warningr r__annotations__strintrr"r6r r r rsT