U 巀g{ @sUdZddlZddlZddlmZmZmZmZmZddl m Z ddl m Z dZGdddeZdaeed <deeefeeeeeeeedd d d Zdd ddZdddeeeeeeeeeddddZdS)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 M/opt/hc_python/lib/python3.8/site-packages/pip/_internal/utils/deprecation.pyr sr _original_showwarning)messagecategoryfilenamelinenofilelinereturncCsZ|dk r$tdk rVt||||||n2t|trDtd}||nt||||||dS)Nzpip._internal.deprecations)r issubclassr logging getLoggerwarning)rrrrrrloggerr r r _showwarnings   r)rcCs(tjdtddtdkr$tjatt_dS)NdefaultT)append)warnings simplefilterr r showwarningrr r r rinstall_warning_logger,sr") feature_flagissue)reason replacementgone_inr#r$rcCs|dk ottt|k}|tdf||s.dndf|df||sBdndf|dfg}dd d |D}|rpt|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,|]$\}}|dk r|dk r||VqdS)N)format).0value format_strr r r rszdeprecated..)r stacklevel)rcurrent_versionDEPRECATION_MSG_PREFIXjoinr rwarn)r%r&r'r#r$is_gone message_partsrr r r deprecated7s2    r6)NN)__doc__rrtypingrrrrrpip._vendor.packaging.versionrpiprr0r1Warningr r__annotations__strintrr"r6r r r rs<