.9h;\dZddlZddlZddlZddlZddlmZddlmZGddZ dS)aA fake shutil module implementation that uses fake_filesystem for unit tests. Note that only `shutildisk_usage()` is faked, the rest of the functions shall work fine with the fake file system if `os`/`os.path` are patched. :Includes: FakeShutil: Uses a FakeFilesystem to provide a fake replacement for the shutil module. :Usage: The fake implementation is automatically involved if using `fake_filesystem_unittest.TestCase`, pytest fs fixture, or directly `Patcher`. N)RLock)CallableceZdZdZeZeedoejZ eedoej Z eedoej Z ejZgdZejdks ejdkregded Zd Zd Zd Zd edefdZdZejdkr)ejdkrdddZddejddfdZejfdZdZ dS)FakeShutilModulezUses a FakeFilesystem to provide a fake replacement for shutil module. Automatically created if using `fake_filesystem_unittest.TestCase`, the `fs` fixture, the `patchfs` decorator, or directly the `Patcher`. _USE_CP_COPY_FILE_RANGE_HAS_FCOPYFILE_USE_CP_SENDFILE)copycopyfilermtree) win32)copy2copytreemovecdS)zqReturn the list of patched function names. Used for patching functions imported from the module. ) disk_usagerq/builddir/build/BUILD/cloudlinux-venv-1.0.10/venv/lib/python3.11/site-packages/pyfakefs/fake_filesystem_shutil.pydirzFakeShutilModule.dir;s rc:||_t|_d|_dS)zConstruct fake shutil module using the fake filesystem. Args: filesystem: FakeFilesystem used to provide file system information rN) filesystemshutil shutil_module _patch_level)selfrs r__init__zFakeShutilModule.__init__Bs! %#rc,|xjdz c_|jdkrdS|jr d|j_|jr d|j_|jr d|j_|jr6tj dkr|jj |j_ dSd|j_ dSdS)NFr )rhas_fcopy_filerruse_copy_file_ranger use_sendfiler use_fd_functionssys version_info_rmtree_unsafe _rmtree_impl_use_fd_functionsrs r_start_patching_global_varsz,FakeShutilModule._start_patching_global_varsLs Q  q F   605D  -  # ?9>D  6   827D  /   =7**&5"///8="444  = =rc,|xjdzc_|jdkrdS|jr d|j_|jr d|j_|jr d|j_|jr6tj dkr|jj |j_ dSd|j_ dSdS)Nr!rTr")rr$rrr%rr&r r'r(r)_rmtree_safe_fdr+r,r-s r_stop_patching_global_varsz+FakeShutilModule._stop_patching_global_vars^s Q  q F   504D  -  # >9=D  6   726D  /   <7**&6"///8<"444  < .wrappedus! 6 60022261d-f--33555  6 6 6 6 6 6 6 6 335555  6 6 6 6 6 6 6 6 6 6s'A AA AA  A$'A$) functoolswraps)rr2r9s`` rwith_patched_globalsz%FakeShutilModule.with_patched_globalsps@    6 6 6 6 6   6rc6|j|S)zReturn the total, used and free disk space in bytes as named tuple or placeholder holder values simulating unlimited space if not set. Args: path: defines the filesystem device which is queried )rget_disk_usage)rpaths rrzFakeShutilModule.disk_usages--d333rTfollow_symlinksc |j|r8|j|tj|}|||||||||S)zSince Python 3.12, there is an optimization fow Windows, using the Windows API. We just remove this and fall back to the previous implementation. r@)risdir joinpathsosr?basenamer copystat)rsrcdstrAs rrzFakeShutilModule.copy2sy $$S)) Lo//RW5E5Ec5J5JKK MM#sOM D D D MM#sOM D D DJrFNc p|tjkr|j}|j|||||||Sz*Make sure the default argument is patched.)rrrr)rrHrIsymlinksignore copy_functionignore_dangling_symlinks dirs_exist_oks rrzFakeShutilModule.copytreesH ,, $ %..( rch|tjkr|j}|j|||SrK)rrrr)rrHrIrNs rrzFakeShutilModule.moves1 ,, $ %**3]CC Crc||jvr(|t|j|St|j|S)z;Forwards any non-faked calls to the standard shutil module.)functions_to_patchr<getattrr)rnames r __getattr__zFakeShutilModule.__getattr__sD 4* * *,,WT5G-N-NOO Ot)4000r)!__name__ __module__ __qualname____doc__rr6hasattrrrr%rr$r r&r,r'rSr(r)platformextend staticmethodrrr.r1rr<rrrrrVrrrrr's%''K 122Uv7UWV%566P6;PN76#566R6;RL/777 '!!S\W%<%<!!"?"?"?@@@\ ===$<<<$h8 444 7""s|w'>'>59       ,%*    .06| D D D D 11111rr) rZr:rErr( threadingrtypingrrrrrras  Q1Q1Q1Q1Q1Q1Q1Q1Q1Q1r