f<UddlmZddlZddlZddlZddlZddlmZiZde d<ejjejjddZ ejjde Zejfd Zd Zd d Zeeeeey) ) annotationsN)Anyzdict[str, dict[str, Any]]conf~z.config/fsspecFSSPEC_CONFIG_DIRc ^g}|D]}|jdrt|dkDr|ddk7r|jddkDr|j|Q t j ||}t |trE|jdd\}}|j|jij|tjd|dt||jd stjd|d |D]L}|jdd \}}}|||j|ji|j<Ny#tjj $r&}tjd|d|Yd}~d}~wwxYw) aSet config values from environment variables Looks for variables of the form ``FSSPEC_`` and ``FSSPEC__``. For ``FSSPEC_`` the value is parsed as a json dictionary and used to ``update`` the config of the corresponding protocol. For ``FSSPEC__`` there is no attempt to convert the string value, but the kwarg keys will be lower-cased. The ``FSSPEC__`` variables are applied after the ``FSSPEC_`` ones. Parameters ---------- conf_dict : dict(str, dict) This dict will be mutated envdict : dict-like(str, str) Source for the values - usually the real environment FSSPEC__zIgnoring environment variable z due to not being a dict: z due to a parse failure: NFSSPECz! due to having an unexpected name) startswithlencountappendjsonloads isinstancedictsplit setdefaultlowerupdatewarningswarntypedecoderJSONDecodeError) conf_dictenvdict kwarg_keyskeyvaluer protoexkwargs V/var/lib/jenkins/workspace/mettalog/venv/lib/python3.12/site-packages/fsspec/config.py set_conf_envr)s&J >>) $SA#a&C-yy~!!!#&  73<0 eT*"yya0HAu((;BB5IMM8> K=*^^H % MM05VW +2))C+5%AH U[[]B/ >%<<//  4SE9RSURVW sE))F,F''F,ctjj|syttj|}|D]}|j dr}t j}|jtjj|||D]5}|dk(r |j|ijt||7|j dsttjj||5}tj|}dddD]/}|j|ijt||1!y#1swYAxYw)aSet config values from files Scans for INI and JSON files in the given dictionary, and uses their contents to set the config. In case of repeated values, later values win. In the case of INI files, all values are strings, and these will not be converted. Parameters ---------- cdir : str Directory to search conf_dict : dict(str, dict) This dict will be mutated Nz.iniDEFAULTz.json)ospathisdirsortedlistdirendswith configparser ConfigParserreadjoinrrropenrload)cdirr allfilesfninir#fjss r(set_conf_filesr>@s" 77== bjj&'H ;;v ++-C HHRWW\\$+ ,)#$$S"-44T#c(^D ;;w bggll4,- "YYq\ "$$S"-44T"S']C " "s E$$E- c|t}t|jttfr |jn |jg}i}|D]}||vs|j |||j di||}|S)aSupply default values for kwargs when instantiating class Augments the passed kwargs, by finding entries in the config dict which match the classes ``.protocol`` attribute (one or more str) Parameters ---------- cls : file system implementation kwargs : dict conf_dict : dict of dict Typically this is the global configuration Returns ------- dict : the modified set of kwargs )rrprotocoltuplelistr)clskwargsr protoskwr%s r( apply_configrHcsv" ' udmDS\\3<<.F B I  IIi& ' BII F M)N) __future__rr2rr,rtypingrr__annotations__r-r5 expanduserdefault_conf_direnvirongetconf_dirr)r>rHr@rIr(rRs" "$$77<< 2 23 79IJ ::>>-/? @%'JJ/Nd DF>x TrI