L iu ddlmZddlZddlZddlmZGddej ZGddeZGdd eZ d d Z y) ) annotationsN)make_path_posixcFeZdZdZej ddZddZddZy) AbstractCacheMapperzUAbstract super-class for mappers from remote URLs to local cached basenames. cyNselfpaths i/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/fsspec/implementations/cache_mapper.py__call__zAbstractCacheMapper.__call__s*-c,t|t|Sr) isinstancetype)r others r __eq__zAbstractCacheMapper.__eq__s%d,,rc*tt|Sr)hashr)r s r __hash__zAbstractCacheMapper.__hash__sDJrNr strreturnrrobjectrboolrint) __name__ __module__ __qualname____doc__abcabstractmethodrrrr rr rr s' ---  rrcBeZdZdZdddZddZd fd Zd fd ZxZS) BasenameCacheMapperzCache mapper that uses the basename of the remote URL and a fixed number of directory levels above this. The default is zero directory levels, meaning different paths with the same basename will have the same cached basename. c@|dkr td||_d|_y)Nrz>BasenameCacheMapper requires zero or positive directory_levelsz_@_) ValueErrordirectory_levels _separator)r r*s r __init__zBasenameCacheMapper.__init__$s- a P !1 rct|}|jd|jdz^}}|r|jj |S|S)N/)rrsplitr*r+join)r r prefixbitss r rzBasenameCacheMapper.__call__.sHt$ C)>)>)BC  ??''- -MrcXt||xr|j|jk(Sr)superrr*)r r __class__s r rzBasenameCacheMapper.__eq__6s(w~e$X)>)>%BXBX)XXrcLt|t|jz Sr)r5rrr*)r r6s r rzBasenameCacheMapper.__hash__9s!w!D)>)>$???r)r)r*rrrr) r r!r"r#r,rrr __classcell__)r6s@r r'r's$ Y@@rr'ceZdZdZddZy)HashCacheMapperz0Cache mapper that uses a hash of the remote URL.cdtj|jjSr)hashlibsha256encode hexdigestr s r rzHashCacheMapper.__call__@s ~~dkkm,6688rNr)r r!r"r#rr rr r:r:=s :9rr:c.|r tStS)zFactory method to create cache mapper for backward compatibility with ``CachingFileSystem`` constructor using ``same_names`` kwarg. )r'r:) same_namess r create_cache_mapperrBDs"$$  r)rArrr) __future__rr$r<fsspec.implementations.localrABCrr'r:rBr rr rFsC" 8 #'' &@-@B9)9!r