h@"ddlZddlZddlZddlZddlZddlZddlZddlZddlZddl m Z ej ddZ dZ dZdZdd d d Zd Zej ddZdd d ddZGddeZGddeZdZdZdS)N)unlinkTc#K|rMtj5tjddtdVddddS#1swxYwYdSdVdS)zContext manager to suppress package and module deprecation warnings when importing them. If ignore is False, this context manager has no effect. ignorez.+ (module|package)N)warningscatch_warningsfilterwarningsDeprecationWarning)rs 1/usr/lib/python3.11/test/support/import_helper.py_ignore_deprecated_importsr s  $ & &    #H.C$6 8 8 8 EEE                   s AA  A cD tj|=dS#t$rYdSwxYwN)sysmodulesKeyError)names r unloadrs9 K         s  ct|tjD]j}tj||dz}t |dzdD]0}t t j||1kdS)z'Forget' a module was ever imported. This removes the module from sys.modules and deletes any PEP 3147/488 or legacy .pyc files. z.pyc)r) optimizationN) rrpathosjoinr importlibutilcache_from_source)modnamedirnamesourceopts r forgetr#%s  7OOO8OOgw77 v| O OC 9>33F3MM N N N N O OOc,tj|}tjtj|}tj||dz}tj |||S)aMove a PEP 3147/488 pyc file to its legacy pyc location. :param source: The file system path to the source file. The source file does not need to exist, however the PEP 3147/488 pyc file must exist. :return: The file system path to the legacy pyc file. r) rrrrrr abspathrshutilmove)r!pyc_fileup_one legacy_pycs r make_legacy_pycr,5sk~//77H W__RW__V44 5 5Fffsl33J K*%%% r$F) required_onc>t|5 tj|cdddS#t$rS}tjt|rtj t|d}~wwxYw#1swxYwYdS)acImport and return the module to be tested, raising SkipTest if it is not available. If deprecated is True, any module or package deprecation messages will be suppressed. If a module is required on a platform but optional for others, set required_on to an iterable of platform prefixes which will be compared against sys.platform. N) r r import_module ImportErrorrplatform startswithtupleunittestSkipTeststr)r deprecatedr.msgs r r0r0Cs $J / /.. .*400........ . . .|&&u['9'9:: #CHH-- - ...........s,B2 BAB  BBBBci}td|D}ttjD]=}||vs||r"tj|||<>|S)Nc3 K|] }|dzV dS).Nr-).0rs r z+_save_and_remove_modules..Ws&22DTCZ222222r$)r4listrrr3pop)names orig_modulesprefixesrs r _save_and_remove_modulesrDUsyL22E22222H $$== e  w11(;; $'KOOG$<$z#modules_cleanup..s@000DAqLL..0!Q000r$)rritemsclearrN) oldmodules encodingss r modules_cleanupr}su00CK$5$5$7$7000IKKy!!!Kz"""""r$)T)F)r-r-) contextlibrGrimportlib.utilrr'rr5r os_helperrcontextmanagerr rr#r,r0rDrJrQobjectrSrjrsr}r-r$r rs           O O O   ......$  3 3 3 37-#("'7-7-7-7-7-t#3#3#3#3#3&#3#3#3L*****F***2#####r$