JFIFxxC      C  " }!1AQa"q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz w!1AQaq"2B #3Rbr lze_)dZddlmZddlZddlZddlmZddlmZddl m Z ddl m Z ejd k(rdd Zndd lmZGd d e ZddZddZd gZy)zUnix.) annotationsN) ConfigParser)Path)Iterator)PlatformDirsABCwin32cd}t|)Nzshould only be used on Unix) RuntimeError)msgs 3/usr/lib/python3/dist-packages/platformdirs/unix.pygetuidrs+3)rceZdZdZeddZeddZeddZeddZeddZ eddZ eddZ edd Z edd Z edd Zedd Zedd ZeddZeddZeddZeddZeddZeddZeddZeddZeddZddZddZddZy) Unixa On Unix/Linux, we follow the `XDG Basedir Spec `_. The spec allows overriding directories with environment variables. The examples show are the default values, alongside the name of the environment variable that overrides them. Makes use of the `appname `, `version `, `multipath `, `opinion `, `ensure_exists `. ctjjdd}|jstjj d}|j |S)z :return: data directory tied to the user, e.g. ``~/.local/share/$appname/$version`` or ``$XDG_DATA_HOME/$appname/$version`` XDG_DATA_HOMEz~/.local/shareosenvirongetstrippath expanduser_append_app_name_and_versionselfrs r user_data_dirzUnix.user_data_dir$sG zz~~or2zz|77%%&67D0066rc tjjdd}|jsdtjd}|j tjDcgc]}|j |c}Scc}w)N XDG_DATA_DIRSrz/usr/local/sharez /usr/share)rrrrpathsepsplitrrrps r _site_data_dirszUnix._site_data_dirs/s]zz~~or2zz|%bjj\Bjj>TU11!4UUUs&Bcz|j}|js|dStjj |S)aZ :return: data directories shared by users (if `multipath ` is enabled and ``XDG_DATA_DIRS`` is set and a multi path the response is also a multi path separated by the OS path separator), e.g. ``/usr/local/share/$appname/$version`` or ``/usr/share/$appname/$version`` r)r& multipathrr"joinrdirss r site_data_dirzUnix.site_data_dir6s2##~~7Nzzt$$rctjjdd}|jstjj d}|j |S)z :return: config directory tied to the user, e.g. ``~/.config/$appname/$version`` or ``$XDG_CONFIG_HOME/$appname/$version`` XDG_CONFIG_HOMErz ~/.configrrs r user_config_dirzUnix.user_config_dirCsG zz~~/4zz|77%%k2D0066rctjjdd}|jsd}|j tj Dcgc]}|j |c}Scc}w)NXDG_CONFIG_DIRSrz/etc/xdg)rrrrr#r"rr$s r _site_config_dirszUnix._site_config_dirsNsQzz~~/4zz|D>Bjj>TU11!4UUUsA/cz|j}|js|dStjj |S)a2 :return: config directories shared by users (if `multipath ` is enabled and ``XDG_CONFIG_DIRS`` is set and a multi path the response is also a multi path separated by the OS path separator), e.g. ``/etc/xdg/$appname/$version`` r)r2r(rr"r)r*s r site_config_dirzUnix.site_config_dirUs2%%~~7Nzzt$$rctjjdd}|jstjj d}|j |S)z :return: cache directory tied to the user, e.g. ``~/.cache/$appname/$version`` or ``~/$XDG_CACHE_HOME/$appname/$version`` XDG_CACHE_HOMErz~/.cacherrs r user_cache_dirzUnix.user_cache_dirbsG zz~~.3zz|77%%j1D0066rc$|jdS)zO:return: cache directory shared by users, e.g. ``/var/cache/$appname/$version``z /var/cache)rrs r site_cache_dirzUnix.site_cache_dirms00>>rctjjdd}|jstjj d}|j |S)z :return: state directory tied to the user, e.g. ``~/.local/state/$appname/$version`` or ``$XDG_STATE_HOME/$appname/$version`` XDG_STATE_HOMErz~/.local/staterrs r user_state_dirzUnix.user_state_dirrsH zz~~.3zz|77%%&67D0066rc|j}|jr1tjj |d}|j ||S)zg:return: log directory tied to the user, same as `user_state_dir` if not opinionated else ``log`` in itlog)r=opinionrrr)_optionally_create_directoryrs r user_log_dirzUnix.user_log_dir}s="" <<77<<e,D  - -d 3 rctddS)zC:return: documents directory tied to the user, e.g. ``~/Documents``XDG_DOCUMENTS_DIRz ~/Documents_get_user_media_dirr9s r user_documents_dirzUnix.user_documents_dirs##6 FFrctddS)zC:return: downloads directory tied to the user, e.g. ``~/Downloads``XDG_DOWNLOAD_DIRz ~/DownloadsrEr9s r user_downloads_dirzUnix.user_downloads_dirs##5}EErctddS)zA:return: pictures directory tied to the user, e.g. ``~/Pictures``XDG_PICTURES_DIRz ~/PicturesrEr9s r user_pictures_dirzUnix.user_pictures_dirs##5|DDrctddS)z=:return: videos directory tied to the user, e.g. ``~/Videos``XDG_VIDEOS_DIRz~/VideosrEr9s r user_videos_dirzUnix.user_videos_dirs##3Z@@rctddS)z;:return: music directory tied to the user, e.g. ``~/Music`` XDG_MUSIC_DIRz~/MusicrEr9s r user_music_dirzUnix.user_music_dirs#?I>>rctddS)z?:return: desktop directory tied to the user, e.g. ``~/Desktop``XDG_DESKTOP_DIRz ~/DesktoprEr9s r user_desktop_dirzUnix.user_desktop_dirs##4kBBrcDtjjdd}|js`tj j dr4dt}t|jsdt}n dt}|j|S)az :return: runtime directory tied to the user, e.g. ``/run/user/$(id -u)/$appname/$version`` or ``$XDG_RUNTIME_DIR/$appname/$version``. For FreeBSD/OpenBSD/NetBSD, it would return ``/var/run/user/$(id -u)/$appname/$version`` if exists, otherwise ``/tmp/runtime-$(id -u)/$appname/$version``, if``$XDG_RUNTIME_DIR`` is not set. XDG_RUNTIME_DIRrfreebsdopenbsdnetbsdz/var/run/user/z /tmp/runtime-z /run/user/) rrrrsysplatform startswithrrexistsrrs r user_runtime_dirzUnix.user_runtime_dirszz~~/4zz|||&&'GH'z2Dz((**68*5D#FH:.0066rctjjdd}|js$tj j drd}nd}|j|S)am :return: runtime directory shared by users, e.g. ``/run/$appname/$version`` or ``$XDG_RUNTIME_DIR/$appname/$version``. Note that this behaves almost exactly like `user_runtime_dir` if ``$XDG_RUNTIME_DIR`` is set, but will fall back to paths associated to the root user instead of a regular logged-in user if it's not set. If you wish to ensure that a logged-in root user path is returned e.g. ``/run/user/0``, use `user_runtime_dir` instead. For FreeBSD/OpenBSD/NetBSD, it would return ``/var/run/$appname/$version`` if ``$XDG_RUNTIME_DIR`` is not set. rXrrYz/var/runz/run)rrrrr]r^r_rrs r site_runtime_dirzUnix.site_runtime_dirsPzz~~/4zz|||&&'GH!0066rc8|j|jS)zd:return: data path shared by users. Only return first item, even if ``multipath`` is set to ``True``) _first_item_as_path_if_multipathr,r9s r site_data_pathzUnix.site_data_paths44T5G5GHHrc8|j|jS)zj:return: config path shared by the users. Only return first item, even if ``multipath`` is set to ``True``)rer4r9s r site_config_pathzUnix.site_config_paths44T5I5IJJrc8|j|jS)ze:return: cache path shared by users. Only return first item, even if ``multipath`` is set to ``True``)rer:r9s r site_cache_pathzUnix.site_cache_paths44T5H5HIIrct|jr"|jtjd}t |S)Nr)r(r#rr"r)r directorys r rez%Unix._first_item_as_path_if_multipaths* >>! 3A6IIrc#TK|j|jEd{y7w)z4:yield: all user and site configuration directories.N)r/r2r9s r iter_config_dirszUnix.iter_config_dirss!""")))) (&(c#TK|j|jEd{y7w)z+:yield: all user and site data directories.N)rr&r9s r iter_data_dirszUnix.iter_data_dirss!   ''''roN)returnstr)rrz list[str])rrr)rlrsrrr)rrz Iterator[str])__name__ __module__ __qualname____doc__propertyrr&r,r/r2r4r7r:r=rBrGrJrMrPrSrVrarcrfrhrjrernrqrr rrs 77VV  % %77VV  % %77??77GGFFEEAA??CC77&77*IIKKJJ * (rrct|}|Otjj|dj }|stj j |}|S)Nr)_get_user_dirs_folderrrrrrr)env_varfallback_tilde_path media_dirs r rFrFsM%g.IJJNN7B/557 **+>?I rcttjdz }|jrt }|j 5}|j d|jddd||dvry|d|jd}|jdtjjdSy#1swYXxYw)zkReturn directory from user-dirs.dirs config file. See https://freedesktop.org/wiki/Software/xdg-user-dirs/.zuser-dirs.dirsz[top] Ntop"z$HOME~) rrr/r`ropen read_stringreadrreplacerrr)keyuser_dirs_config_pathparserstreamrs r r{r{s !7!78;KK##% " ' ' ) :V   8 9 : fUm #e}S!'',||GRWW%7%7%<==  : :s #CC)rrint)r|rsr}rsrrrs)rrsrrz str | None)rw __future__rrr] configparserrpathlibrtypingrapirr^rrrFr{__all__ryrr rsX " % <<7 T(?T(n*  r