g` \dZdZededDZddlZddlZejddkZere Z ej drRddl Z e j ddZe drd Zn"e d rd Zn d Znej Zd*dZd*dZd*dZd*dZd+dZd*dZd+dZGddeZdZdZdZdZed kr= ddlZeZn5#e $r- ddl!m"Z"eZn #e $r ddl#Z$eZn #e $reZYnwxYwYnwxYwYnwxYwe%dkrdZ&dZ'd Z(e)d!eze)d"ee&e'd#$Z*e(D]Z+e)e+d%e,e*e+e)d&ee&e'Z*e(D]Z+e)e+d%e,e*e+e)d'ee&Z*e(D]Z+e)e+d%e,e*e+e)d(ee&d )Z*e(D]Z+e)e+d%e,e*e+dSdS),zyUtilities for determining application-specific dirs. See for details and usage. z1.4.4c#4K|]}t|VdSN)int).0segments W/home/jenkins/workspace/simtester-sanitize/venv/lib/python3.11/site-packages/appdirs.py rs(LL'WLLLLLL.NjavaWindowswin32Macdarwinlinux2Fctdkr||}|rdpd}tjt |}|rF|dur"tj|||}ntj||}ntdkrBtjd}|r tj||}nTtjdtjd }|r tj||}|r"|r tj||}|S) aJReturn full path to the user-specific data dir for this application. "appname" is the name of application. If None, just the system directory is returned. "appauthor" (only used on Windows) is the name of the appauthor or distributing body for this application. Typically it is the owning company name. This falls back to appname. You may pass False to disable it. "version" is an optional version path element to append to the path. You might want to use this if you want multiple versions of your app to be able to run independently. If used, this would typically be ".". Only applied when appname is present. "roaming" (boolean, default False) can be set True to use the Windows roaming appdata directory. That means that for users on a Windows network setup for roaming profiles, this user data will be sync'd on login. See for a discussion of issues. Typical user data directories are: Mac OS X: ~/Library/Application Support/ Unix: ~/.local/share/ # or in $XDG_DATA_HOME, if defined Win XP (not roaming): C:\Documents and Settings\\Application Data\\ Win XP (roaming): C:\Documents and Settings\\Local Settings\Application Data\\ Win 7 (not roaming): C:\Users\\AppData\Local\\ Win 7 (roaming): C:\Users\\AppData\Roaming\\ For Unix, we follow the XDG spec and support $XDG_DATA_HOME. That means, by default "~/.local/share/". rN CSIDL_APPDATACSIDL_LOCAL_APPDATAFrz~/Library/Application Support/ XDG_DATA_HOMEz~/.local/sharesystemospathnormpath_get_win_folderjoin expandusergetenv)appname appauthorversionroamingconstrs r user_data_dirr%-s1@  I+OD/Dw 6 677  3%%w||D)W==w||D'22 8  w!!"BCC  /7<<g..Dy"'*<*<=M*N*NOO  /7<<g..D+7+w||D'** Kr cltdkr{|}tjt d}rG|dur#tj||}n*tj|}ntdkrBtjd}r tj|}ntjdtjdd g}d | tjD}r0|r tj|fd |D}|r tj|}n|d }|Sr"|r tj||}|S) aiReturn full path to the user-shared data dir for this application. "appname" is the name of application. If None, just the system directory is returned. "appauthor" (only used on Windows) is the name of the appauthor or distributing body for this application. Typically it is the owning company name. This falls back to appname. You may pass False to disable it. "version" is an optional version path element to append to the path. You might want to use this if you want multiple versions of your app to be able to run independently. If used, this would typically be ".". Only applied when appname is present. "multipath" is an optional parameter only applicable to *nix which indicates that the entire list of data dirs should be returned. By default, the first item from XDG_DATA_DIRS is returned, or '/usr/local/share/', if XDG_DATA_DIRS is not set Typical site data directories are: Mac OS X: /Library/Application Support/ Unix: /usr/local/share/ or /usr/share/ Win XP: C:\Documents and Settings\All Users\Application Data\\ Vista: (Fail! "C:\ProgramData" is a hidden *system* directory on Vista.) Win 7: C:\ProgramData\\ # Hidden, but writeable on Win 7. For Unix, this is using the $XDG_DATA_DIRS[0] default. WARNING: Do not use this on Windows. See the Vista-Fail note above for why. rNCSIDL_COMMON_APPDATAFrz/Library/Application Support XDG_DATA_DIRSz/usr/local/sharez /usr/sharecg|]>}tj|tj?Srrrrstripseprxs r z!site_data_dir..6YYYQBG&&qxx'7'788YYYr cRg|]#}tj|g$Sr*rr-rrr/r s rr0z!site_data_dir..+DDDa QL11DDDr r ) rrrrrrrrpathsepsplitr r!r" multipathrpathlists` r site_data_dirr;ds>  Iw0F G GHH  3%%w||D)W==w||D'22 8  w!!"@AA  /7<<g..Dy*.". Only applied when appname is present. "roaming" (boolean, default False) can be set True to use the Windows roaming appdata directory. That means that for users on a Windows network setup for roaming profiles, this user data will be sync'd on login. See for a discussion of issues. Typical user config directories are: Mac OS X: same as user_data_dir Unix: ~/.config/ # or in $XDG_CONFIG_HOME, if defined Win *: same as user_data_dir For Unix, we follow the XDG spec and support $XDG_CONFIG_HOME. That means, by default "~/.config/". rrNXDG_CONFIG_HOMEz ~/.configrr%rrrrrr r!r"r#rs ruser_config_dirrAs:$$$Wiw??y*BG,>,>{,K,KLL  /7<<g..D+7+w||D'** Kr ctdvr5t|}r"|r tj||}ntjdd}d|tjD}r0|r tj|fd|D}|r tj|}n|d}|S)aReturn full path to the user-shared data dir for this application. "appname" is the name of application. If None, just the system directory is returned. "appauthor" (only used on Windows) is the name of the appauthor or distributing body for this application. Typically it is the owning company name. This falls back to appname. You may pass False to disable it. "version" is an optional version path element to append to the path. You might want to use this if you want multiple versions of your app to be able to run independently. If used, this would typically be ".". Only applied when appname is present. "multipath" is an optional parameter only applicable to *nix which indicates that the entire list of config dirs should be returned. By default, the first item from XDG_CONFIG_DIRS is returned, or '/etc/xdg/', if XDG_CONFIG_DIRS is not set Typical site config directories are: Mac OS X: same as site_data_dir Unix: /etc/xdg/ or $XDG_CONFIG_DIRS[i]/ for each value in $XDG_CONFIG_DIRS Win *: same as site_data_dir Vista: (Fail! "C:\ProgramData" is a hidden *system* directory on Vista.) For Unix, this is using the $XDG_CONFIG_DIRS[0] default, if multipath=False WARNING: Do not use this on Windows. See the Vista-Fail note above for why. r=XDG_CONFIG_DIRSz/etc/xdgcg|]>}tj|tj?Sr*r+r.s rr0z#site_config_dir..r1r cRg|]#}tj|g$Sr*r3r4s rr0z#site_config_dir..r5r r )rr;rrrrr7r6r8s` rsite_config_dirrFs<$$$Wi00  /w /7<<g..Dy*J77YY$**RZBXBXYYY  E 9',,w88DDDD8DDDH  :??8,,DDA;D Kr Tctdkr||}tjt d}|rh|dur"tj|||}n tj||}|r tj|d}ntdkrBtjd}|r tj||}nTtjdtjd }|r tj||}|r"|r tj||}|S) aReturn full path to the user-specific cache dir for this application. "appname" is the name of application. If None, just the system directory is returned. "appauthor" (only used on Windows) is the name of the appauthor or distributing body for this application. Typically it is the owning company name. This falls back to appname. You may pass False to disable it. "version" is an optional version path element to append to the path. You might want to use this if you want multiple versions of your app to be able to run independently. If used, this would typically be ".". Only applied when appname is present. "opinion" (boolean) can be False to disable the appending of "Cache" to the base app data dir for Windows. See discussion below. Typical user cache directories are: Mac OS X: ~/Library/Caches/ Unix: ~/.cache/ (XDG default) Win XP: C:\Documents and Settings\\Local Settings\Application Data\\\Cache Vista: C:\Users\\AppData\Local\\\Cache On Windows the only suggestion in the MSDN docs is that local settings go in the `CSIDL_LOCAL_APPDATA` directory. This is identical to the non-roaming app data dir (the default returned by `user_data_dir` above). Apps typically put cache data somewhere *under* the given dir here. Some examples: ...\Mozilla\Firefox\Profiles\\Cache ...\Acme\SuperApp\Cache\1.0 OPINION: This function appends "Cache" to the `CSIDL_LOCAL_APPDATA` value. This can be disabled with the `opinion=False` option. rNrFCacherz~/Library/CachesXDG_CACHE_HOMEz~/.cacherr r!r"opinionrs ruser_cache_dirrLs?B  Iw0E F FGG  3%%w||D)W==w||D'22 3w||D'22 8  w!!"455  /7<<g..Dy)27+=+=j+I+IJJ  /7<<g..D+7+w||D'** Kr c.tdvrt||d|}nTtjdtjd}|r tj||}|r"|r tj||}|S)aReturn full path to the user-specific state dir for this application. "appname" is the name of application. If None, just the system directory is returned. "appauthor" (only used on Windows) is the name of the appauthor or distributing body for this application. Typically it is the owning company name. This falls back to appname. You may pass False to disable it. "version" is an optional version path element to append to the path. You might want to use this if you want multiple versions of your app to be able to run independently. If used, this would typically be ".". Only applied when appname is present. "roaming" (boolean, default False) can be set True to use the Windows roaming appdata directory. That means that for users on a Windows network setup for roaming profiles, this user data will be sync'd on login. See for a discussion of issues. Typical user state directories are: Mac OS X: same as user_data_dir Unix: ~/.local/state/ # or in $XDG_STATE_HOME, if defined Win *: same as user_data_dir For Unix, we follow this Debian proposal to extend the XDG spec and support $XDG_STATE_HOME. That means, by default "~/.local/state/". r=NXDG_STATE_HOMEz~/.local/stater?r@s ruser_state_dirrO:s>$$$Wiw??y)27+=+=>N+O+OPP  /7<<g..D+7+w||D'** Kr ctdkr>tjtjd|}nvtdkr6t |||}d}|r tj|d}n5t |||}d}|r tj|d}|r"|r tj||}|S)aReturn full path to the user-specific log dir for this application. "appname" is the name of application. If None, just the system directory is returned. "appauthor" (only used on Windows) is the name of the appauthor or distributing body for this application. Typically it is the owning company name. This falls back to appname. You may pass False to disable it. "version" is an optional version path element to append to the path. You might want to use this if you want multiple versions of your app to be able to run independently. If used, this would typically be ".". Only applied when appname is present. "opinion" (boolean) can be False to disable the appending of "Logs" to the base app data dir for Windows, and "log" to the base cache dir for Unix. See discussion below. Typical user log directories are: Mac OS X: ~/Library/Logs/ Unix: ~/.cache//log # or under $XDG_CACHE_HOME if defined Win XP: C:\Documents and Settings\\Local Settings\Application Data\\\Logs Vista: C:\Users\\AppData\Local\\\Logs On Windows the only suggestion in the MSDN docs is that local settings go in the `CSIDL_LOCAL_APPDATA` directory. (Note: I'm interested in examples of what some windows apps use for a logs dir.) OPINION: This function appends "Logs" to the `CSIDL_LOCAL_APPDATA` value for Windows and appends "log" to the user cache dir for Unix. This can be disabled with the `opinion=False` option. rz~/Library/LogsrFLogslog)rrrrrr%rLrJs r user_log_dirrSds@w|| G  / 0 0  7  Wi99  .7<<f--Dgy'::  -7<<e,,D+7+w||D'** Kr ceZdZdZ d dZedZedZedZedZ ed Z ed Z ed Z dS) AppDirsz1Convenience wrapper for getting application dirs.NFcL||_||_||_||_||_dSr)r r!r"r#r9)selfr r!r"r#r9s r__init__zAppDirs.__init__s) "  "r cPt|j|j|j|jSN)r"r#)r%r r!r"r#rWs rr%zAppDirs.user_data_dirs.T\4>%)\4<III Ir cPt|j|j|j|jSN)r"r9)r;r r!r"r9r[s rr;zAppDirs.site_data_dirs.T\4>%)\T^MMM Mr cPt|j|j|j|jSrZ)rAr r!r"r#r[s rrAzAppDirs.user_config_dirs.t|T^'+|T\KKK Kr cPt|j|j|j|jSr])rFr r!r"r9r[s rrFzAppDirs.site_config_dirs.t|T^%)\T^MMM Mr cDt|j|j|jSNr")rLr r!r"r[s rrLzAppDirs.user_cache_dir&dlDN&*l444 4r cDt|j|j|jSra)rOr r!r"r[s rrOzAppDirs.user_state_dirrcr cDt|j|j|jSra)rSr r!r"r[s rrSzAppDirs.user_log_dirs&DL$.$(L222 2r )NNNFF) __name__ __module__ __qualname____doc__rXpropertyr%r;rArFrLrOrSr*r rrUrUs;;=A%*####IIXIMMXMKKXKMMXM44X444X422X222r rUctrddl}nddl}dddd|}||jd}|||\}}|S)zThis is a fallback technique at best. I'm not sure if using the registry for this guarantees us the correct answer for all CSIDL_* names. r NAppDatazCommon AppDataz Local AppDatarr'rz@Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders)PY3winreg_winregOpenKeyHKEY_CURRENT_USER QueryValueEx) csidl_namerpshell_folder_namekeydirtypes r_get_win_folder_from_registryrys  nnn# 0.  //!K  C$$S*;<rs|  5LL[5F5Fs5K5KLLLLL  qQG<6"" OOOh!!!$Q'G)$$   E " "  \F4444n????D%%%%P0000f6666r''''T0000f+2+2+2+2+2f+2+2+2`0644 W @6  @ @ @ @ % % % % % %9OO @ @ @ @""""": @ @ @"? @  @ @ zGI E E  +,,, E 1222 77Iu 5 5 5D66 $$$d 3 3 345555 E 6777 77I & &D66 $$$d 3 3 345555 E 8999 77  D66 $$$d 3 3 345555 E 5666 77e , , ,D66 $$$d 3 3 345555A>66sZ:DD3DD3D-DD-D'$D-&D''D-*D3,D--D32D3