ݿl dZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddlm Z ddl mZmZmZddlmZddlmZddlmZddlmZdd lmZdd lmZmZdd lm Z dd l!m"Z"m#Z#m$Z$hd de%ddDzde%ddDzZ&dZ'dZ(dZ)dZ* ej+Z,n #e-$re.Z,YnwxYwGdde,Z/e/Z0e j1dkr2ej2Z3Gdde3Z4Gdde4Z5Gdde4Z6n|Gdd e Z7Gd!d"e Z8d#ed$e$d%efd&Z9e j:D]FZ;ee8e;e9e=e$j?e>e7e;e9e=e$j@GGd'd(ejAZBd)ZCGd*d+ZDGd,d-ZEGd.d/ejAZFe j1d0krOd#ed%efd1ZGejHeFejID]0\Z;Z=e;Jd2se>eFe;eGe=1Gd3d4ZKGd5d6ZLdS)7aA fake implementation for pathlib working with FakeFilesystem. New in pyfakefs 3.0. Usage: If using `fake_filesystem_unittest.TestCase`, pytest fs fixture, or directly `Patcher`, pathlib gets replaced by fake_pathlib together with other file system related modules. Note: as the implementation is based on FakeFilesystem, all faked classes (including PurePosixPath, PosixPath, PureWindowsPath and WindowsPath) get the properties of the underlying fake filesystem. N)PurePath)CallableListOptional)mock)quote_from_bytes) fake_scandir)FakeFilesystem) fake_open) FakeOsModuleuse_original_os)FakePathModule)IS_PYPYis_called_from_skipped_moduleFSType>AUXCONNULPRNch|]}d|zS)zCOM%d.0is g/builddir/build/BUILD/cloudlinux-venv-1.0.10/venv/lib/python3.11/site-packages/pyfakefs/fake_pathlib.py r5)))qw{))) ch|]}d|zS)zLPT%drrs rrr6rrc|t_tjdkrt |t j_t|t j _t|}d|_ d|_ |t j _t |}d|_ d|_ |t j _dSt|}|jrt!|||_t|}|jst%|||_tjdkrdnd}t't j ||jt't j ||jdS)z6Initializes the fake module with the fake file system. /N\r$ _flavourparser)FakePath filesystemsys version_info_FakeWindowsFlavourFakePathlibModule WindowsPathr*_FakePosixFlavour PosixPathsepaltsep PurePosixPathPureWindowsPathr is_windows_fsFakePosixPathModulepathFakeWindowsPathModulesetattr)r-fake_pure_posix_flavourfake_pure_nt_flavour fake_os_posixfake_os_windows parser_names r init_modulerC:sN%H '!!1DZ1P1P%./@/L/L#,#4J"?"?&)#)-&3J'0 3:>>#' &)#5I)222%Z00  # P!4Z!O!OM &z22' V#8_#U#UO $'$4w$>$>jjH  !/m>PQQQ !1;@TUUUUUrcdtjfd}t|S)Nc|j}|jr9t|jj|jrt |g|Ri|S|t |g|Ri|SN) skip_namescase_sensitiver-patcherrrGis_case_sensitivestr)pathobjargskwargsfsfake_fct original_fcts r_wrappedz_wrap_strfunc.._wrappedas$/ : C,:0!3 C$|CLLB4BBB6BBBxCLL:4:::6:::r functoolswraps staticmethodrQrRrSs`` r _wrap_strfuncrY`sG_X;;;;;;  ! !!rcdtjfd}t|S)Nc|j}|jrDt|jj|jr$t |t |g|RS|t |t |g|RSrFrIpathobj1pathobj2rNrPrQrRs rrSz&_wrap_binary_strfunc.._wrappedp%0 : I,:0!3 I$|CMM3x==H4HHHHxCMM3x==@4@@@@rrTrXs`` r_wrap_binary_strfuncr`oM_XAAAAAA  ! !!rcdtjfd}t|S)Nc|j}|jrDt|jj|jr$t |t |g|RS|t |t |g|RSrFrIr\s rrSz._wrap_binary_strfunc_reverse.._wrappedr_rrTrXs`` r_wrap_binary_strfunc_reverserd~rarceZdZdZeejejZedejZeej ej Z ee j ej Z e edredej Z ndZ dZeejejZeejejZeejejZeejejZedejZedejZd ejkred ejZejd kred ejZd ZeejejZeejejZdS) _FakeAccessorzQAccessor which forwards some of the functions to FakeFilesystem methods. c0tj||dSNF)follow_symlinks)r stat)rPr;s rz_FakeAccessor.s,RuMMMrlchmodc2tj|||dSrh)r chmod)rPr;modes rrkz_FakeAccessor.s!>#7D$$$$rc td)z+Raises not implemented for Windows systems.z%lchmod() not available on this systemNotImplementedErrorselfrMrNrOs rrlz_FakeAccessor.lchmods%&MNN Nrcd|vrUtjdkrtd|ds.tjtjvst rtd|jjt|g|Ri|S)Nrir$r zs!~'< ($( ( ( rc2tj|||dS)NF)create_missing_dirs)r create_symlink)rPfpathtarget target_is_dirs rrkz_FakeAccessor.s!1N v52 2 2 r)r$c.tj|||SNr linkrP file_path link_targets rrkz_FakeAccessor.~/BI{00rrvc.tj|||Srrrs rrkz_FakeAccessor.rrc(tjSr)rxgetcwdrts rrz_FakeAccessor.getcwds9;; rN) __name__ __module__ __qualname____doc__rYr rjrxlstatlistdirr scandirhasattrrlrnmakedirmkdirremoveunlinkrmdirr`r|replacerdsymlinkr.r/rlink_torreadlinkutimerrrrfrfs =,bg 6 6D MMMrx  EmN2BJ??GmL0"*==Gwr8 O   I    O O O G G G M.0"( ; ;E ]>0") < sGGGAQGGGrazrc,h|]}t|Srrrs rrz_FakeFlavour.s1K K K CFFK K K rAZcV||_tdSr)r-super__init__)rtr- __class__s rrz_FakeFlavour.__init__s&(DO GG       rcd}||rC|dd}|dd}|dr||ddz }d|ddz}||fS)NzUNC\r$r') startswith)r; ext_prefixprefixs r_split_extended_pathz!_FakeFlavour._split_extended_pathsvFz** +bqbABBx??7+++d2A2h&F$qrr(?D4< rc|dd}|dd}||kr3||kr-||\}}|dd}|dd}nd}|dd}||kr||kr||kr||d}|dkrl|||dz}||dzkrJ|dkrt|}|r||d|z|||dzdfS|d||||dzdfSdx} } |dkr||jvr|dd} |dd}|}||kr|} ||}|| z| |fS)Nrrrr$:)rfindlen drive_letterslstrip) rtr;r5firstsecondrthirdindexindex2drvroots r_splitroot_with_drivez"_FakeFlavour._splitroot_with_drive s1IE!A#YF}}# $88>> QqS ac1IE}}#%3,,  #q))B;;!YYsEAI66F**!R<<%(YYF!T#)D6N#:CfqjllAS#SS#GVG}c4 3EEEOC$}}$*>J{!>>>/8CC(C =11$<<<((s33 3rcF|jjr|S|S)zz/_FakeFlavour.casefold_parts..Ps 111a 111r)r-r9rtpartss rcasefold_partsz_FakeFlavour.casefold_partsMs(, 21151111Lrcjifd|rdn jj}|t |pS)Nc| rd}| D]}|r|dkr |dkr| \}}}+| z|z}|vr|}|Btd|z j|}d|<||}||<#t $r$}|jtjkr r|}Yd}~d}~wwxYw|S)Nr.z..zSymlink loop from %r) rsplit rpartition RuntimeErrorr-rOSErrorerrnoEINVAL) r;restname_newpathre_resolveseenrtr5stricts rrz-_FakeFlavour._resolve_posix.._resolveWs;??3''D JJsOO--D!43;; t||%)__S%9%9 a "Sj4/G$#G}+$++AG+KLLL -!%!9!9'!B!B)-W 'xf55(,W #'''7el22v2! ' ' sB44 C">CC"r)r5 is_absoluter-cwdrL)rtr;rbaserrr5s` ` @@@r_resolve_posixz_FakeFlavour._resolve_posixSs(CD$ $ $ $ $ $ $ $ $ P))++D221DD8D#d)),,3 3rct|}|stjSd}|rY|j|s%|jt j||j|S |j|}||S|j |tj |S#t$r%|}|j |d}YnwxYw)NTr)rLrxrr-existsraise_os_errorrENOENT resolve_path joinpathsr;basenamer splitpath)rtr;r previous_ss r_resolve_windowsz_FakeFlavour._resolve_windowsst99D #y{{"J --d33GO225<FFF33D999  #;;DAA &-#'K#88 "'"2"2:">">   #BBB%) #88>>qAB sC,D D cr|jjr|||S|||S)z/Make the path absolute, resolving any symlinks.)r-r9rr)rtr;rs rresolvez_FakeFlavour.resolves;, ;,,T6:::&&tV44 4rc(|sR tjdS#t$r2ddl}|tjjcYSwxYwddl} ||jS#t$rtd|zwxYw).Return the home directory of the current user.HOMErN%Can't determine home directory for %r rxenvironKeyErrorpwdgetpwuidgetuidpw_dirgetpwnamrrtusernamers r gethomedirz_FakeFlavour.gethomedir <:f--<<<JJJ<< 44;;;;<  <<1188&?(J9AAA44Br)rrrrr-ext_namespace_prefixrangeordrrrWrrrrrrrrrr  __classcell__rs@rrrsGG (GGss3xxSA)F)FGGGK K !E##c((CCHHqL99K K K        2F     $ ,$ ,$ ,L  $ $  $ 4 4 4 4        - 4- 4- 4^   . 5 5 5        rrc:eZdZdZdZdZdZeZdZ dZ dZ dZ d S) r0zFlavour used by PureWindowsPath with some Windows specific implementations independent of FakeFilesystem properties. r'r&Tc|sdS|jjr|ddrdS|dddt vS)z?Return `True` if the path is considered reserved under Windows.Fr\\rr)r-r9r partitionupper_WIN_RESERVED_NAMESrs r is_reservedz_FakeWindowsFlavour.is_reservedsk u, q1D1DV1L1L u9&&s++A.4466:MM Mrc|j}t|dkrq|ddkre|ddd}d|t |dSdt |dzS) z$Return a file URI for the given pathrrrNr&z file:///{}/{}zutf-8zfile:)driveras_posixrformaturlquote_from_bytesencode)rtr;rrs rmake_uriz_FakeWindowsFlavour.make_uris JE5zzQ58s??}}qrr*11#66&--' G(<(<== !4T]]__5K5KG5T5T!U!UUUrcdtjvrtjd}nzdtjvrtjd}nYdtjvr< tjd}n#t$rd}YnwxYw|tjdz}ntd|rtjd|kr||f\}}}|dtjdkrtd |z||d<|s|r$||z||d d z}n||}|S) rr USERPROFILEHOMEPATH HOMEDRIVErzCan't determine home directoryUSERNAMErrrN)rxrrr parse_partsjoin)rtr userhomerrrs rr z_FakeWindowsFlavour.gethomedirs\##:f-"*,,:m4rz))*[1CCCCCJ!77"#CDDD 4 :j)X55'+'7'7 'D'D$CuRyBJz$:::*ChN!)E"I4d4#&: %)0D0D#D#'99U#3#3OsA%% A43A4cntjtj|tjjSr)recompilefnmatch translate IGNORECASE fullmatchrtpatterns rcompile_patternz#_FakeWindowsFlavour.compile_patterns$:g/88"-HHR RrN) rrrrr5r6has_drvntpathpathmodrr!r r3rrrr0r0s|   N N N V V V"! ! ! F S S S S Srr0cReZdZUdZdZdZeeed<dZ e Z dZ dZ dZd ZdS) r3zFlavour used by PurePosixPath with some Unix specific implementations independent of FakeFilesystem properties. r&Nr6FcdSNFrrs rrz_FakePosixFlavour.is_reserved s5rcDt|}dt|zS)Nzfile://)bytesr)rtr;bpaths rr!z_FakePosixFlavour.make_uris#$KKE25999 9rc(|sR tjdS#t$r2ddl}|tjjcYSwxYwddl} ||jS#t$rtd|zwxYw)Nrrrrr s rr z_FakePosixFlavour.gethomedirr rcXtjtj|jSr)r+r,r-r.r0r1s rr3z!_FakePosixFlavour.compile_pattern's :g/8899C Cr)rrrrr5r6rrL__annotations__r4 posixpathr6rr!r r3rrrr3r3s   $ $$$    : : :    & D D D D Drr3c eZdZdfd ZxZS)r:r-r os_moduler ct|||jtj5||jddddS#1swxYwYdSr)rrr- use_fs_typerPOSIXresetrtr-rBrs rrzFakePosixPathModule.__init__-s GG  Z 3 3 3,,V\:: , , 4?+++ , , , , , , , , , , , , , , , , , ,A00A47A4r-r rBr rrrrrrs@rr:r:,= , , , , , , , , , ,rr:c eZdZdfd ZxZS)r<r-r rBr ct|||jtj5||jddddS#1swxYwYdSr)rrr-rDrWINDOWSrFrGs rrzFakeWindowsPathModule.__init__3s GG  Z 3 3 3,,V^<< , , 4?+++ , , , , , , , , , , , , , , , , , ,rHrIrJrs@rr<r<2rKrr<ffs_typereturncJtjfd}|S)z`Decorator used for fake_path methods to ensure that the correct filesystem type is used.c|j5|g|Ri|cdddS#1swxYwYdSr)r-rD)rtrNrOrOrPs rwrappedzwith_fs_type..wrapped<s,,W55 0 0q////// 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0s 599rUrV)rOrPrTs`` r with_fs_typerV8s@    0 0 0 0 0   0rcfeZdZUdZdZgZeeed<dZ e j dddkre dZ e dZe j d krd d Zd Ze d Ze j d krd dZd!dZdZd"dZdZd#dZe dZdZdZdZd$dZe j dkr d%fd ZxZSxZS)&r,zReplacement for pathlib.Path. Reimplement some methods to use fake filesystem. The rest of the methods work as they are, as they will use the fake accessor. New in pyfakefs 3.0. NrGc|tjur$|jjr tjn tj}t jdkr||St |S))Creates the correct subclass based on OS.r#) r1Pathr-r9r2r4r.r/ _from_partsobject__new__clsrNrOs rr]zFakePath.__new__Ush #( ( (>/1!--&0   g % %??4(( (>>#&& &rrrvct|}|||\}}}||_||_||_|Sr)r\r]_init _parse_args_drv_root_parts)r_rNrtrrrs rr[zFakePath._from_partsesT>>#&&D JJLLL#//55 CuDIDJDKKrct|}||_||_||_||Sr)r\r]rcrdrera)r_rrrrts r_from_parsed_partszFakePath._from_parsed_partsos:>>#&&DDIDJDK JJLLLKrr$ c,t|_d|_dS)z#Initializer called from base class.FN)_fake_accessor _accessor_closed)rttemplates rrazFakePath._initzs,DN DLLLrc t|S)zSReturns the underlying path string as used by the fake filesystem. )rLrs r_pathzFakePath._paths4yyrc,||jjS)zjReturn a new path pointing to the current working directory (as returned by os.getcwd()). )r-r)r_s rrz FakePath.cwds s3>%&&&rr#c*|d}||j||}|5|t |}|j|}t|S)aMake the path absolute, resolving all symlinks on the way and also normalizing it (for example turning slashes into backslashes under Windows). Args: strict: If `False` (default) no exception is raised if the path does not exist. Raises: OSError: if the path doesn't exist (strict=True) NF)r) _raise_on_closedr*rrjrLabsoluter- absnormpathr,)rtrr;s rrzFakePath.resolves~  ! ! # # #=((V)D| 4==??++?..t44DD>> !rrrc |t|j|j||||||S)zOpen the file pointed by this path and return a fake file object. Raises: OSError: if the target object is a directory, the path is invalid or permission is denied. )rsr r-rGrp)rtro bufferingencodingerrorsnewlines ropenz FakePath.opensL  O O JJLL        rct|j|j|d5}|cdddS#1swxYwYdS)zOpen the fake file in bytes mode, read it, and close the file. Raises: OSError: if the target object is a directory, the path is invalid or permission is denied. rbroNr r-rGrpread)rtrOs r read_byteszFakePath.read_bytess O O JJLL      6688                   sAAAct|j|j|d||5}|cdddS#1swxYwYdS)zO Open the fake file in text mode, read it, and close the file. rv)roryrzNr)rtryrzrOs r read_textzFakePath.read_texts O O JJLL     6688                  sAAAct|}t|j|j|d5}||cdddS#1swxYwYdS)a Open the fake file in bytes mode, write to it, and close the file. Args: data: the bytes to be written Raises: OSError: if the target object is a directory, the path is invalid or permission is denied. wbrN) memoryviewr r-rGrpwrite)rtdataviewrOs r write_byteszFakePath.write_bytess$  O O JJLL     ! 774==  ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !sA!!A%(A%c ht|tstd|jjz|t jdkrtdt|j|j | d|||5}| |cdddS#1swxYwYdS)atOpen the fake file in text mode, write to it, and close the file. Args: data: the string to be written encoding: the encoding used for the string; if not given, the default locale encoding is used errors: (str) Defines how encoding errors are handled. newline: Controls universal newlines, passed to stream object. New in Python 3.10. Raises: TypeError: if data is not of type 'str'. OSError: if the target object is a directory, the path is invalid or permission is denied. zdata must be str, not %sNrvz9write_text() got an unexpected keyword argument 'newline'w)roryrzr{) rrLrwrrr.r/r r-rGrpr)rtrryrzr{rOs r write_textzFakePath.write_texts $$$ R69PPQQ Q  3#3g#=#=WXX X  O O JJLL   !774== ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !sB''B+.B+c0tjd}|jjtjdkkrtj|d}|jjr"tjdd|}n tjd|}|j|s|j ||| tj |jj S)zrReturn a new path pointing to the user's home directory (as returned by os.path.expanduser('~')). ~ntrzC:Usershome) rxr; expanduserr-r9rrr(r create_dirrr5r)r_rr s rrz FakePath.home s w!!#&& > 'BGtO < <w}}T**1-H~+ 6w||D'8<<w||FH55>((.. 0))$///s4<<(EFFGGGrc|} |}n*#t$r|j|}YnwxYw|j|jko|j|jkS)a/Return whether other_path is the same or not as this file (as returned by os.path.samefile()). Args: other_path: A path object or string of the file object to be compared with Raises: OSError: if the filesystem object doesn't exist. )rjAttributeErrorr-st_inost_dev)rt other_pathstother_sts rsamefilezFakePath.samefilesxYY[[ 8!((HH 8 8 8++J77HHH 8yHO+L X_0LLs+$AActtj|tjj|jjS)zkReturn a new path with expanded ~ and ~user constructs (as returned by os.path.expanduser) ) r,rxr;rrprr5r-rrs rrzFakePath.expanduser+sO G  tzz|| , , 4 4 T_;     rcdtjdkr|jr|dSdSdS)N)r$ )r.r/rm _raise_closedrs rrszFakePath._raise_on_closed5s=  f $ $ $     % $ $ $rTc||rk|r0|j|ddS|jt j|dS|dd}| | |dS)aCreate a fake file for the path with the given access mode, if it doesn't exist. Args: mode: the file mode for the file if it does not exist exist_ok: if the file already exists and this is `True`, nothing happens, otherwise `FileExistError` is raised Raises: FileExistsError: if the file exists and ``exits_ok`` is `False`. N)timesrutf8)ry) rsrr-rrprrEEXISTr|closern)rtroexist_ok fake_files rtouchzFakePath.touch9s  ;;==  K%%djjll$%?????..u|TZZ\\JJJJJ # 77I OO    JJt     rr$FctjdkrHt|dr|||St ||St jj}|j }d|_ |j }d|_ |j }d|_ |j }d|_ t ||||_ ||_ ||_ ||_ S#||_ ||_ ||_ ||_ wxYw)Nwin32_copy_from_file_fallback) r.platformrrr_copy_from_filepathlibpathlib_module_os _fcopyfile_copy_file_range_ficlone _sendfile) rtsourcepreserve_metadata pathlib_os old_fcopyfileold_copy_file_range old_ficlone old_sendfilers rrzFakePath._copy_from_fileRs|w&&4!;<<N88ARSSS 77226;LMMM%37 * 5 (, %&0&A#.2 +(1 &* #)3 '+ $8 77226;LMM,9J)2EJ/*5J'+7J((-:J)2EJ/*5J'+7J(7777s $!C""Dr)rvrNNN)NN)NNN)rTF)rrrrr-rGrrLr?r]r.r/ classmethodr[rgrarprrr|rrrrrrrrsrrrrs@rr,r,JsJJS  ' ' ' w&&           '!! ! ! ! ! ''['  '!! " " " "0    &       !!!$!!!!> H H[ HMMM$   !!!. 7"" 8 8 8 8 8 8 8 8 8 8#"""rr,c^tjdkrtjdtdSdS)Nr(zpathlib.PurePath.is_reserved() is deprecated and scheduled for removal in Python 3.15. Use os.path.isreserved() to detect reserved paths on Windows.)r.r/warningswarnDeprecationWarningrrr_warn_is_reserved_deprecatedrns@ 7""  )       #"rceZdZdZddZdZdZGddeZGdd eZ Gd d e e Z Gd d e eZ e Z dZdS)r1zUses FakeFilesystem to provide a fake pathlib module replacement. Automatically created if using `fake_filesystem_unittest.TestCase`, the `fs` fixture, the `patchfs` decorator, or directly the `Patcher`. Fct|t|_d|_d|_|s|dSdS)a Initializes the module with the given filesystem. Args: filesystem: FakeFilesystem used to provide file system information from_patcher: If `False` (the default), `pathlib.os` will be manually patched using `FakeOsModule`. This allows to instantiate the class manually for a test. Will be set to `True` if instantiated from `Patcher`. N)rCrrr _os_patcherpatch_os_modulertr- from_patchers rrzFakePathlibModule.__init__sS J% #  " " " " " # #rcFtjdkrtttsvt t j|_tjdddkrdnd}tj ||j|_ |j dSdSdS)Nrhrr(zpathlib._local.osz pathlib.os) r.r/rrxr r,r-rrpatchrstart)rtrs rrz!FakePathlibModule.patch_os_modules  w & &z"l/K/K &#H$788DH'*'7';w'F'F##L  $z*dh??D    " " $ $ $ $ $ ' & & &rcJ|j|jdSdSr)rstoprs r__del__zFakePathlibModule.__del__s.   '   ! ! # # # # # ( 'rcPeZdZdZdZejdkrdZdZfdZ xZ SxZ S)FakePathlibModule.PurePosixPathzKA subclass of PurePath that represents non-Windows filesystem pathsrr#c"tdSr9)rrs rrz+FakePathlibModule.PurePosixPath.is_reserveds,...urctjjtj5tj|cdddS#1swxYwYdSr)rxr;r-rDrrEisabsrs rrz+FakePathlibModule.PurePosixPath.is_absolutesW'33FLAA//7==..//////////////////sAA"Actjjtj5t j|cdddS#1swxYwYdSr)rxr;r-rDrrErjoinpath)rt pathsegmentsrs rrz(FakePathlibModule.PurePosixPath.joinpathsW'33FLAA;;+577+\:;;;;;;;;;;;;;;;;;;sAAA) rrrr __slots__r.r/rrrrrs@rr7rs    w & &    / / / ; ; ; ; ; ; ; ; ; ' & & &rr7c>eZdZdZdZejdkr dZdZdSdS)!FakePathlibModule.PureWindowsPathz?A subclass of PurePath that represents Windows filesystem pathsrr#c8ttjdkr|jr |jddrdS|jdddddd}|tvStj j tj5tj |cdddS#1swxYwYdS) Nr(rrFrrr )rr.r/_tailrrrstriprrrxr;r-rDrrN isreservedrtrs rrz-FakePathlibModule.PureWindowsPath.is_reserveds1,...#g--:%A)A)A&)I)I%$u 20055a8BB3GGJQQRUVV ::<<+>>>W'33FNCC447--d33444444444444444444s#DDDctjjtj5t |jo|jcdddS#1swxYwYdSr) rxr;r-rDrrNboolrrrs rrz-FakePathlibModule.PureWindowsPath.is_absolutesW'33FNCC:: 8ty99::::::::::::::::::sAAAN) rrrrrr.r/rrrrrr8rsXMM  w & &  4 4 4 : : : : :% ' &rr8c(eZdZdZdZdZdZdZdS)FakePathlibModule.WindowsPathzjA subclass of Path and PureWindowsPath that represents concrete Windows filesystem paths. rc td)Nz*Path.owner() is unsupported on this systemrqrs rownerz#FakePathlibModule.WindowsPath.owner%&RSS Src td)Nz*Path.group() is unsupported on this systemrqrs rgroupz#FakePathlibModule.WindowsPath.grouprrc td)Nz-Path.is_mount() is unsupported on this systemrqrs ris_mountz&FakePathlibModule.WindowsPath.is_mounts%&UVV VrN)rrrrrrrrrrrr2rs]    T T T T T T W W W W Wrr2cXeZdZdZdZdZdZejdkr dddfd Z xZ SxZ S) FakePathlibModule.PosixPathzlA subclass of Path and PurePosixPath that represents concrete non-Windows filesystem paths. rclddl}||jjS)zReturn the username of the file owner. It is assumed that `st_uid` is related to a real user, otherwise `KeyError` is raised. rN)rrrjst_uidpw_name)rtrs rrz!FakePathlibModule.PosixPath.owner- JJJ<< 233; ;rclddl}||jjS)zReturn the group name of the file group. It is assumed that `st_gid` is related to a real group, otherwise `KeyError` is raised. rN)grpgetgrgidrjst_gidgr_name)rtrs rrz!FakePathlibModule.PosixPath.grouprrrNFrHrecurse_symlinkscT|d}t|||S)NTr)rglob)rtr2rHrrs rrz FakePathlibModule.PosixPath.globs6!)%)Nww||#1%5$r) rrrrrrrr.r/rrrs@rr4rs    < < < < < <  w & &7;U            ' & & &rr4c,t|j|Sz:Forwards any unfaked calls to the standard pathlib module.)getattrrrs r __getattr__zFakePathlibModule.__getattr__st*D111rNr)rrrrrrrrr7r8r,r2r4rZrrrrr1r1xs ####$%%%$$$;;;;;;;;&:::::(:::6WWWWWhWWW $$$$$Hm$$$L D22222rr1cveZdZdZdZd dZedZejdZdZ dZ e d Z dS) FakePathlibPathModulezAPatches `pathlib.Path` by passing all calls to FakePathlibModule.NFcL|jt|||j_dSdSr) fake_pathlibr1rrs rrzFakePathlibPathModule.__init__s-   $*;J *U*UDN ' ' ' % $rcgSrrrs rrGz FakePathlibPathModule.skip_namess rc(||jj_dSr)rrZrG)rtvalues rrGz FakePathlibPathModule.skip_namess-2)))rc&|jj|i|Sr)rrZrtrNrOs r__call__zFakePathlibPathModule.__call__s%t %t6v666rc6t|jj|Sr)rrrZrs rrz!FakePathlibPathModule.__getattr__t(-t444rc,t|tSrrrr_instances r__instancecheck__z'FakePathlibPathModule.__instancecheck__!s(H---rr9) rrrrrrpropertyrGsetterr rrrrrrrr sKKLVVVVX222777555..[...rrceZdZdZejdkr*ejdkrej nej Z n*ejdkrejdkre ne Z nejdkre ne ZdZdS)RealPathzReplacement for `pathlib.Path` if it shall not be faked. Needed because `Path` in `pathlib` is always faked, even if `pathlib` itself is not. r#rr(c|tjur(tjdkr tjn tj}t jdkr||St |S)rYrr#) RealPathlibModulerZrxrr2r4r.r/r[r\r]r^s rr]zRealPath.__new__8sh #( ( (7d??"--&0   g % %??4(( (>>#&& &rN)rrrrr.r/rxrr_WindowsFlavour _PosixFlavourr*r5r@r+r]rrrrr's  '!!w$ $G # % % %&&((  G # #W__66)7d??  ' ' ' ' 'rrrvcFtjfd}|S)zuDecorator used for real pathlib Path methods to ensure that real os functions instead of faked ones are used.cdt5|i|cdddS#1swxYwYdSr)r )rNrOrOs rrTz!with_original_os..wrappedLs "" * *q$)&)) * * * * * * * * * * * * * * * * * *s %))rU)rOrTs` rwith_original_osrHs:    * * * *   *r__c>eZdZdZdZedZdZdZdZ dS)RealPathlibPathModulezAPatches `pathlib.Path` by passing all calls to RealPathlibModule.Nc,t|tSrrrs rrz'RealPathlibPathModule.__instancecheck__]s(H---rcH|jt|j_dSdSr) real_pathlibrrrs rrzRealPathlibPathModule.__init__cs)   $*;*=*=DN ' ' ' % $rct|i|Sr)rr s rr zRealPathlibPathModule.__call__gs((((rc6t|jj|Sr)rr#rZrs rrz!RealPathlibPathModule.__getattr__jr r) rrrrr#rrrr rrrrr r XseKKL..[. >>>)))55555rr ceZdZdZdZGddeZGddeZej dkrGdd e eZ nGd d e eZ e Z d Zd S)rzUsed to replace `pathlib` for skipped modules. As the original `pathlib` is always patched to use the fake path, we need to provide a version which does not do this. ct|_dSr)r_pathlib_modulers rrzRealPathlibModule.__init__ts&rceZdZdZdZdS)RealPathlibModule.PurePosixPathz>A subclass of PurePath, that represents Posix filesystem pathsrNrrrrrrrrr7r*wsLL rr7ceZdZdZdZdS)!RealPathlibModule.PureWindowsPathz@A subclass of PurePath, that represents Windows filesystem pathsrNr+rrrr8r-|sNN rr8rceZdZdZdZdS)RealPathlibModule.WindowsPathzrA subclass of Path and PureWindowsPath that represents concrete Windows filesystem paths. rNr+rrrr2r/  IIIrr2ceZdZdZdZdS)RealPathlibModule.PosixPathztA subclass of Path and PurePosixPath that represents concrete non-Windows filesystem paths. rNr+rrrr4r2r0rr4c,t|j|Sr)rr(rs rrzRealPathlibModule.__getattr__st+T222rN)rrrrrrr7r8r.rrr2r4rZrrrrrrns ''' (  |w     (O         -    D33333rr)Mrrr-rUinspectr5rxrr@r+r.rrtypingrrrunittestr urllib.parserrpyfakefsr pyfakefs.fake_filesystemr pyfakefs.fake_openr pyfakefs.fake_osr r pyfakefs.fake_pathrpyfakefs.helpersrrrrrrCrYr`rd _Accessoraccessorrr\rfrkr/_Flavourflavourrr0r3r:r<rVdirfct_namerfnr=rNrErZr,rr1rrr getmembers isfunctionrr rrrrrGs     ++++++++++@@@@@@!!!!!!333333((((((::::::::------KKKKKKKKKK!  ))EE!RLL)))*))EE!RLL)))*#V#V#VL " " " " " " " " " HHHHHV:V:V:V:V:HV:V:V:rgGwBMSMSMSMSMSlMSMSMS^'D'D'D'D'DL'D'D'D'DV,,,,,n,,, ,,,,,,,,  6 h    'N&((OO W^X . .%xb&.1Q1QRRR#X||B /M/MNNNNa8a8a8a8a8w|a8a8a8H    N2N2N2N2N2N2N2N2b........<'''''w|'''>g H     +*8W5GHH>> """4(( > GHh(8(8(<(< = = =55555555,)3)3)3)3)3)3)3)3)3)3s4B<<CC