OUL$dZddlZddlZddlZddlmZmZddlmZddl m Z m Z m Z m Z mZmZmZmZmZmZddlmZmZmZer ddlmZddlmZd ed efd ZGd d ZejdkrGddZdSdS)zJ Faked ``os.path`` module replacement. See ``fake_filesystem`` for usage. N)S_IFDIRS_IFMT) ModuleType) ListOptionalUnionAnyDictTupleAnyStroverloadClassVar TYPE_CHECKING)make_string_path to_stringmatching_string)FakeFilesystem) FakeOsModuleoldreturnctj|jd}t |j}||tj|j<|S)z)Recompiles and creates new module object.N)sysmodulespop__name__ __import__)rsavednews /srv/buildsys-work-dir/castor/build_node/builder-2/WGSG1/unpkd_srcs/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/pyfakefs/fake_path.py _copy_moduler 1sA KOOCL$ / /E S\ " "C $) CL! Jc eZdZUdZeejZee d<dZ e e e d<dZ e e e d<dZe ee e d<dZe e e d<dZe e e d <ed ee fd Zd9dZed:dZded efdZded efdZdefdZded efdZded efdZded efdZded efdZ e!j"dkrded efdZ#defdZ$ded e%fdZ&ded e%fdZ'ded e%fdZ(ded efd Z)d!ed efd"Z*ded e+eeffd#Z,ded e+eeffd$Z-ded efd%Z.ded efd&Z/d;ded'eed efd(Z0d;d)ed*eed efd+Z1d,ed-ed efd.Z2e3de d/e d0e4e ee fd e+e effd1Z5e3de6d/e6d0e4e6ee6fd e+e6effd2Z5ded/ed0e4eeefd e+eeffd3Z5ded efd4Z7ded efd5Z8ded efd6Z9d7e d efd8Z:dS)<FakePathModulezFaked os.path module replacement. FakePathModule should *only* be instantiated by FakeOsModule. See the FakeOsModule docstring for details. _OS_PATH_COPYdevnullsepNaltseplineseppathseprc<gd}tjdkr|ddgz }|S)zqReturn the list of patched function names. Used for patching functions imported from the module. )abspathdirnameexists expandusergetatimegetctimegetmtimegetsizeisabsisdirisfileislinkismountjoinlexistsnormcasenormpathrealpathrelpathsplit splitdrivesamefile isjunction splitrootr version_info)dir_lists rdirzFakePathModule.dirIs7    0  w & & {3 3Hr! filesystemr os_modulerc|||_|j|_|x|j_|_||dS)zlInit. Args: filesystem: FakeFilesystem used to provide file system information N)rKr$_os_pathosreset)selfrKrLs r__init__zFakePathModule.__init__js> %* %.. 47 :r!c|j|_|j|_||_|jrdnd|_|jrdnd|_dS)Nnulz /dev/null;:) path_separatorr'alternative_path_separatorr(line_separatorr) is_windows_fsr&r*)clsrKs rrPzFakePathModule.resetusS+:  //11 )7Hee[ '5>cc3 r!pathc6|j|S)zDetermine whether the file object exists within the fake filesystem. Args: path: The path to the file object. Returns: (bool) `True` if the file exists. rKr.rQr\s rr.zFakePathModule.exists}s%%d+++r!c:|j|dS)zTest whether a path exists. Returns True for broken symbolic links. Args: path: path to the symlink object. Returns: bool (if file exists). T) check_linkr^r_s rr:zFakePathModule.lexistss%%dt%<<.getcwd s;$&& (w(((w~~'''r!N)rr4r9rKrZrostarts_with_drive_letterr<)rQr\rcwds`` rr,zFakePathModule.abspath s ( ( ( ( ( ( %%zz$ 099VVXXt,,DD _ * 0t/N/Nt/T/T 0&((C77<< 0yyRaR$//}}T"""r!pc |jj|S)z8Return the completed path with a separator of the parts.)rK joinpaths)rQrs rr9zFakePathModule.joins(t(!,,r!c6|j|S)z?Split the path into the directory and the filename of the path.)rK splitpathr_s rr?zFakePathModule.split"s((...r!c6|j|S)zRSplit the path into the drive part and the rest of the path, if supported.)rKr@r_s rr@zFakePathModule.splitdrive&s))$///r!c6|j|S)z0Normalize path, eliminating double slashes, etc.)rKr<r_s rr<zFakePathModule.normpath+s''---r!cz|j|}|jjr|}|S)zPConvert to lower case under windows, replaces additional path separator.)rKr;rZlowerr_s rr;zFakePathModule.normcase/s8''-- ? ( ::<)rQr\rr' system_sepr(s rr>zFakePathModule.relpath7s9 2011 1%%33D99dDO$BCC  $U++EE#D$/*=>>E44U;;$T4=+<== ? 5 A$T4?+UVVF<< 33DMM&*55E||C,, c:..}$$T511||J,,,r!filenamestrictcN|tjdkrtd|r|j||jjr||St|}||dd|i\}}||}|S)z}Return the canonical path of the specified filename, eliminating any symbolic links encountered in the path. N)rC z6realpath() got an unexpected keyword argument 'strict'r) rrH TypeErrorrKrcrZr,r_join_real_path)rQrrr\oks rr=zFakePathModule.realpathNs  #"2W"<"<WXX X  . O # #H - - - ? ( *<<)) )#H--''! hCCb||D!! r!path1path2c|j|}|j|}|j|jko|j|jkS)aMReturn whether path1 and path2 point to the same file. Args: path1: first file path or path object (Python >=3.6) path2: second file path or path object (Python >=3.6) Raises: OSError: if one of the paths does not point to an existing file system object. )rKstatst_inost_dev)rQrrstat1stat2s rrAzFakePathModule.samefile^sK$$U++$$U++|u|+L  0LLr!restseencdSNrQr\rrs rrzFakePathModule._join_real_pathm  r!cdSrrrs rrzFakePathModule._join_real_pathsrr!c Dt|d}t|d}|j|}||r |dd}|}|r?||\}}}|r||kr%||krE|r@|j|\}}||kr|j|||}n|}p|j||} |j| s| }| |vr*|| } | | }|j| |dfSd|| <||t||j | |\}} | s|j||dfS||| <|?|dfS)zJoin two paths, normalizing and eliminating any symbolic links encountered in the second path. Taken from Python source and adapted. .z..rnNFT) rrKget_path_separatorr4 partitionrrr7rreadlink) rQr\rrcurdirpardirr'name_newpath seen_pathrs rrzFakePathModule._join_real_pathys!s++ t,,o0066 ::d   8DD% ! NN3//MD!T 46>>v~~"!%!:!:4!@!@JD$v~~#88vvNN!Do//d;;G?))'22 $ M ($D00$??FF DM++do&>&>w&G&GHHHD"  D00t<r=rAr r rrr-r/r8rrr!rr#r#:s &bg..M3...GXc]C#&*FHXc] #***GXc]GXc]c\@    ???[? ,6 ,d , , , , =F =t = = = = F    $5&5T5555+&+T++++,6,d,,,, ,6 ,d , , , , 7"" 46 4d 4 4 4 4 3& 3 3 3 3 EVEEEEE&!V!!!!!,!V!!!!!&#F#v####(-v-&----/&/U66>%:////0v0%*?0000 .V.....V--F-8F+;-v----.$6 Mf MV M M M M M  " *.sHSM/A*B sDy    X   !& .25(5/3I.J ud{    X 55"(504VXf=M5M0N5 vt| 5555n#F#v#### v &    Ft@,,,,,,,,r!r#win32ceZdZdZedZddZejdkr!de de fd Z de de fd Z de de fd Z de de fd Znde de fd ZdedefdZdS) FakeNtModulezUnder windows, a few function of `os.path` are taken from the `nt` module for performance reasons. These are patched here. c0tjdkrgdSdgS)NrB) _path_exists _path_isfile _path_isdir _path_islink_isdirrGrr!rrJzFakeNtModule.dirs$7**VVVV z!r!rKrc*ddl}||_||_dS)zxInit. Args: filesystem: FakeFilesystem used to provide file system information rN)ntrK nt_module)rQrKrs rrRzFakeNtModule.__init__s III(DO"$DNNNr!rBr\rc6|j|Srrqr_s rrzFakeNtModule._path_isdir,,T222r!c6|j|Srrsr_s rrzFakeNtModule._path_isfile--d333r!c6|j|Srrur_s rrzFakeNtModule._path_islinkrr!c6|j|Srr^r_s rrzFakeNtModule._path_existsrr!c6|j|Srrqr_s rrzFakeNtModule._isdir rr!rc,t|j|S)z3Forwards any non-faked calls to the real nt module.)rrrs rrzFakeNtModule.__getattr__s4>400 0r!N)rKr)rrrrrrJrRrrHr rrrrrrrr rrr!rrrs.    " "  " % % % %  w & & 3 34 3 3 3 3 4 4D 4 4 4 4 4 4D 4 4 4 4 4 4D 4 4 4 4 4  36 3d 3 3 3 3 1C 1C 1 1 1 1 1 1r!r) rrfrOrrrrtypesrtypingrrrr r r r r rrpyfakefs.helpersrrrpyfakefs.fake_filesystemrpyfakefs.fake_osrr r#platformrrr!rrs                          .777777------jZf,f,f,f,f,f,f,f,R <7,1,1,1,1,1,1,1,1,1,1r!