wL iU UddlmZddlZddlZddlZddlZddl Z ddl Z ddl m Z ddl mZddlmZmZmZmZddlZddlmZmZmZmZddlmZd d lmZej:eZe ej@dd Z!ed e"fe#d<ejH ddee"dee"deeee"fdeeddffdZ%dZ&ejHdddee"efdee'deeddffdZ(y#e$r ddlmZn#e$r ddlmZYnwxYwYwxYw))JSONDecodeErrorN)partial)Path)Callable GeneratorOptionalUnion) BaseFileLockFileLock SoftFileLockTimeout) constants)loggingT)stream allow_unicode. yaml_dumpsuffixprefixdirreturnc+Ktjd|||d|}t|jj  t j |j |jy#t$r9 t j |jtn#t$rYnwxYwYSwxYw#t$rYywxYww)a Context manager to create a temporary directory and safely delete it. If tmp directory cannot be deleted normally, we set the WRITE permission and retry. If cleanup still fails, we give up but don't raise an exception. This is equivalent to `tempfile.TemporaryDirectory(..., ignore_cleanup_errors=True)` introduced in Python 3.10. See https://www.scivision.dev/python-tempfile-permission-error-windows/. )rrr)onerrorN) tempfileTemporaryDirectoryrnameresolveshutilrmtree Exception_set_write_permission_and_retrycleanup)rrrkwargstmpdirs b/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/huggingface_hub/utils/_fixes.pySoftTemporaryDirectoryr(+s" ( ( Yv3 YRX YF v{{  # # %% fkk"    MM&++/N O        sk?CA3"B82C3 B5=%B#"B5# B/,B5.B//B52C4B55C8 CCCCc\tj|tj||y)N)oschmodstatS_IWRITE)funcpathexcinfos r'r#r#QsHHT4==!Jtimeout lock_filer3c#nKtj}t||}tj} tj|z }|||k\rt t | |j |rt|||z n| | |jy#t$r5tjd|dtj|z ddYnJt$r?}dt |vr(tjd|t||}Yd}~Yd}~nd}~wwxYw#t$r/ t|j!n#t$rYnwxYwYyYywxYw# |jw#t$r- t|j!Yw#t$rYYwwxYwwxYwxYww) aA filelock with some custom logic. This filelock is weaker than the default filelock in that: 1. It won't raise an exception if release fails. 2. It will default to a SoftFileLock if the filesystem does not support flock. An INFO log message is emitted every 10 seconds if the lock is not acquired immediately. If a timeout is provided, a `filelock.Timeout` exception is raised if the lock is not acquired within the timeout. r2Nz!Still waiting to acquire lock on z (elapsed: z.1fz seconds)zuse SoftFileLock insteadzPFileSystem does not appear to support flock. Falling back to SoftFileLock for %s)rFILELOCK_LOG_EVERY_SECONDSr timer stracquireminloggerinfoNotImplementedErrorwarningr releaseOSErrorrunlink)r4r3 log_intervallock start_time elapsed_timees r' WeakFileLockrGVs77L I| 4DJ yy{Z/  <7#:#i.) )  LLg\7\3I!J[gL h     LLN%  KK3I;k$))+XbJbcfIggpq # )SV3fhq$I|D 4  4  Y&&(  )   LLN  Y&&(   sA%F5(#B# F5 E&D+"F5#;D'F5 D'(0D" F5"D''F5+ E#5EE# EE#EE#F5"E##F5&F2(E98F29 F/FF2 F+ 'F/(F2*F+ +F//F22F5)NNN))requestsr ImportError simplejsonjson contextlibr*r r,rr7 functoolsrpathlibrtypingrrrr yamlfilelockr r r r rr get_logger__name__r;dumprr8__annotations__contextmanagerr(r#floatrGrr1r'rYs[)(   77 BB   H %!( $d S 8CH S   &*" SM" SM"  %c " #" tT4 " " J  ?C.S$Y.-5e_.|T4'(..c)). )())s5C&&D,C32D3 D>DDDD