
    Pg8f              	          d Z 	 dZ ed ej                  d      D              ZddlZddlZeZej                  j                  d      rFddl	Z	 e	j                         d   d   Zej                  d      rd	Zn#ej                  d
      rdZndZnej                  Zd*dZd*dZd*dZd*dZd+dZd*dZd+dZ G d de      Zd Zd Zd Zd Zed	k(  r	 ddlZeZe#dk(  rdZ$dZ%dZ& e'd e d!        e'd"        ee$e%d#$      Z(e&D ]  Z) e'e) d% e*e(e)                e'd&        ee$e%      Z(e&D ]  Z) e'e) d% e*e(e)                e'd'        ee$      Z(e&D ]  Z) e'e) d% e*e(e)                e'd(        ee$d)      Z(e&D ]  Z) e'e) d% e*e(e)               yy# e$ r- 	 ddlm Z  eZn # e$ r 	 ddl!Z"eZn# e$ r eZY nw xY wY nw xY wY w xY w),a  
This file is directly from
https://github.com/ActiveState/appdirs/blob/3fe6a83776843a46f20c2e5587afcffe05e03b39/appdirs.py

The license of https://github.com/ActiveState/appdirs copied below:


# This is the MIT license

Copyright (c) 2010 ActiveState Software Inc.

Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
z1.4.4c              #   2   K   | ]  }t        |        y wN)int).0segments     U/var/www/html/suriana-translation/venv/lib/python3.12/site-packages/torch/_appdirs.py	<genexpr>r   2   s     L'WLs   .    Njava   Windowswin32Macdarwinlinux2Fc                    t         dk(  r|| }|xr dxs d}t        j                  j                  t	        |            }| r|dur"t        j                  j                  |||       }nt        j                  j                  ||       }nt         dk(  rBt        j                  j                  d      }| rvt        j                  j                  ||       }nUt        j                  dt        j                  j                  d            }| r t        j                  j                  ||       }| r"|r t        j                  j                  ||      }|S )	aJ  Return 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 "<major>.<minor>".
            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
            <http://technet.microsoft.com/en-us/library/cc766489(WS.10).aspx>
            for a discussion of issues.

    Typical user data directories are:
        Mac OS X:               ~/Library/Application Support/<AppName>
        Unix:                   ~/.local/share/<AppName>    # or in $XDG_DATA_HOME, if defined
        Win XP (not roaming):   C:\Documents and Settings\<username>\Application Data\<AppAuthor>\<AppName>
        Win XP (roaming):       C:\Documents and Settings\<username>\Local Settings\Application Data\<AppAuthor>\<AppName>
        Win 7  (not roaming):   C:\Users\<username>\AppData\Local\<AppAuthor>\<AppName>
        Win 7  (roaming):       C:\Users\<username>\AppData\Roaming\<AppAuthor>\<AppName>

    For Unix, we follow the XDG spec and support $XDG_DATA_HOME.
    That means, by default "~/.local/share/<AppName>".
    r   CSIDL_APPDATACSIDL_LOCAL_APPDATAFr   z~/Library/Application Support/XDG_DATA_HOMEz~/.local/sharesystemospathnormpath_get_win_folderjoin
expandusergetenv)appname	appauthorversionroamingconstr   s         r   user_data_dirr$   L   s    @ I+OD/Dww 67%ww||D)W=ww||D'2	8	ww!!"BC77<<g.Dyy"''*<*<=M*NO77<<g.D7ww||D'*K    c                 ,   t         dk(  rx|| }t        j                  j                  t	        d            }| r|dur#t        j                  j                  |||       }nt        j                  j                  ||       }ndt         dk(  rDt        j                  j                  d      }| r9t        j                  j                  ||       }nt        j                  dt        j                  j                  ddg            }|j                  t        j                        D cg c]>  }t        j                  j                  |j                  t        j                              @ }}| rP|r t        j                  j                  | |      } |D cg c]#  }t        j                  j                  || g      % }}|r!t        j                  j                  |      }|S |d	   }|S | r"|r t        j                  j                  ||      }|S c c}w c c}w )
ai  Return 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 "<major>.<minor>".
            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/<AppName>',
            if XDG_DATA_DIRS is not set

    Typical site data directories are:
        Mac OS X:   /Library/Application Support/<AppName>
        Unix:       /usr/local/share/<AppName> or /usr/share/<AppName>
        Win XP:     C:\Documents and Settings\All Users\Application Data\<AppAuthor>\<AppName>
        Vista:      (Fail! "C:\ProgramData" is a hidden *system* directory on Vista.)
        Win 7:      C:\ProgramData\<AppAuthor>\<AppName>   # 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.
    r   CSIDL_COMMON_APPDATAFr   z/Library/Application SupportXDG_DATA_DIRSz/usr/local/sharez
/usr/sharer
   )r   r   r   r   r   r   r   r   pathsepsplitrstripsepr   r    r!   	multipathr   xpathlists          r   site_data_dirr1      s   > Iww0F GH%ww||D)W=ww||D'2	8	ww!!"@A77<<g.D yyRZZ__.@,-OP
 ;?**RZZ:P
56BGGqxx/0
 
 '',,w8;CDaQL1DHD::??8,D  A;D7ww||D'*K!
 Es   %AH(Hc                    t         dk(  rt        | |d|      }nt         dk(  rBt        j                  j	                  d      }| rvt        j                  j                  ||       }nUt        j                  dt        j                  j	                  d            }| r t        j                  j                  ||       }| r"|r t        j                  j                  ||      }|S )a  Return full path to the user-specific config 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 "<major>.<minor>".
            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
            <http://technet.microsoft.com/en-us/library/cc766489(WS.10).aspx>
            for a discussion of issues.

    Typical user config directories are:
        Mac OS X:               ~/Library/Preferences/<AppName>
        Unix:                   ~/.config/<AppName>     # 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/<AppName>".
    r   Nr   z~/Library/Preferences/XDG_CONFIG_HOMEz	~/.config)r   r$   r   r   r   r   r   r   r    r!   r"   r   s        r   user_config_dirr5      s    : Wiw?	8	ww!!":;77<<g.Dyy*BGG,>,>{,KL77<<g.D7ww||D'*Kr%   c                    t         dk(  r2t        | |      }| r"|r t        j                  j	                  ||      }|S t         dk(  rCt        j                  j                  d      }| r t        j                  j	                  ||       }|S t        j                  dd      }|j                  t        j                        D cg c]>  }t        j                  j                  |j                  t        j                              @ }}| rP|r t        j                  j	                  | |      } |D cg c]#  }t        j                  j	                  || g      % }}|r!t        j                  j	                  |      }|S |d   }|S c c}w c c}w )a  Return 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 "<major>.<minor>".
            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/<AppName>', if XDG_CONFIG_DIRS is not set

    Typical site config directories are:
        Mac OS X:   same as site_data_dir
        Unix:       /etc/xdg/<AppName> or $XDG_CONFIG_DIRS[i]/<AppName> 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   r   z/Library/PreferencesXDG_CONFIG_DIRSz/etc/xdgr
   )r   r1   r   r   r   r   r   r*   r)   r+   r,   r-   s          r   site_config_dirr8      sB   < Wi0w77<<g.D* K) 
8	ww!!"8977<<g.D" K yy*J7:>**RZZ:P
56BGGqxx/0
 
 '',,w8;CDaQL1DHD::??8,D K A;DK
 Es   ?AF ,(Fc                    t         dk(  r|| }t        j                  j                  t	        d            }| r	|dur"t        j                  j                  |||       }n t        j                  j                  ||       }|rt        j                  j                  |d      }nt         dk(  rBt        j                  j                  d      }| rvt        j                  j                  ||       }nUt        j                  dt        j                  j                  d            }| r t        j                  j                  ||       }| r"|r t        j                  j                  ||      }|S )	a  Return 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 "<major>.<minor>".
            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/<AppName>
        Unix:       ~/.cache/<AppName> (XDG default)
        Win XP:     C:\Documents and Settings\<username>\Local Settings\Application Data\<AppAuthor>\<AppName>\Cache
        Vista:      C:\Users\<username>\AppData\Local\<AppAuthor>\<AppName>\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\<ProfileName>\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.
    r   r   FCacher   z~/Library/CachesXDG_CACHE_HOMEz~/.cacher   r   r    r!   opinionr   s        r   user_cache_dirr>   -  s   B Iww0E FG%ww||D)W=ww||D'2ww||D'2	8	ww!!"4577<<g.Dyy)277+=+=j+IJ77<<g.D7ww||D'*Kr%   c                 &   t         dv rt        | |d|      }nUt        j                  dt        j                  j                  d            }| r t        j                  j                  ||       }| r"|r t        j                  j                  ||      }|S )a  Return 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 "<major>.<minor>".
            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
            <http://technet.microsoft.com/en-us/library/cc766489(WS.10).aspx>
            for a discussion of issues.

    Typical user state directories are:
        Mac OS X:  same as user_data_dir
        Unix:      ~/.local/state/<AppName>   # or in $XDG_STATE_HOME, if defined
        Win *:     same as user_data_dir

    For Unix, we follow this Debian proposal <https://wiki.debian.org/XDGBaseDirectorySpecification#state>
    to extend the XDG spec and support $XDG_STATE_HOME.

    That means, by default "~/.local/state/<AppName>".
    )r   r   NXDG_STATE_HOMEz~/.local/state)r   r$   r   r   r   r   r   r4   s        r   user_state_dirrA   f  ss    > $$Wiw?yy)277+=+=>N+OP77<<g.D7ww||D'*Kr%   c                    t         dk(  r>t        j                  j                  t        j                  j	                  d      |       }nlt         dk(  r2t        | ||      }d}|rRt        j                  j                  |d      }n1t        | ||      }d}|r t        j                  j                  |d      }| r"|r t        j                  j                  ||      }|S )a  Return 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 "<major>.<minor>".
            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/<AppName>
        Unix:       ~/.cache/<AppName>/log  # or under $XDG_CACHE_HOME if defined
        Win XP:     C:\Documents and Settings\<username>\Local Settings\Application Data\<AppAuthor>\<AppName>\Logs
        Vista:      C:\Users\<username>\AppData\Local\<AppAuthor>\<AppName>\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.
    r   z~/Library/Logsr   FLogslog)r   r   r   r   r   r$   r>   r<   s        r   user_log_dirrE     s    @ ww||BGG../?@'J	7	Wi977<<f-Dgy':77<<e,D7ww||D'*Kr%   c                       e Zd ZdZ	 ddZed        Zed        Zed        Zed        Z	ed        Z
ed	        Zed
        Zy)AppDirsz1Convenience wrapper for getting application dirs.Nc                 J    || _         || _        || _        || _        || _        y r   )r   r    r!   r"   r.   )selfr   r    r!   r"   r.   s         r   __init__zAppDirs.__init__  s'     ""r%   c                 p    t        | j                  | j                  | j                  | j                        S N)r!   r"   )r$   r   r    r!   r"   rI   s    r   r$   zAppDirs.user_data_dir  s(    LL$..$,,
 	
r%   c                 p    t        | j                  | j                  | j                  | j                        S N)r!   r.   )r1   r   r    r!   r.   rM   s    r   r1   zAppDirs.site_data_dir  s(    LL$..$,,$..
 	
r%   c                 p    t        | j                  | j                  | j                  | j                        S rL   )r5   r   r    r!   r"   rM   s    r   r5   zAppDirs.user_config_dir  s(    LL$..$,,
 	
r%   c                 p    t        | j                  | j                  | j                  | j                        S rO   )r8   r   r    r!   r.   rM   s    r   r8   zAppDirs.site_config_dir  s(    LL$..$,,$..
 	
r%   c                 Z    t        | j                  | j                  | j                        S Nr!   )r>   r   r    r!   rM   s    r   r>   zAppDirs.user_cache_dir      dllDNNDLLQQr%   c                 Z    t        | j                  | j                  | j                        S rS   )rA   r   r    r!   rM   s    r   rA   zAppDirs.user_state_dir  rU   r%   c                 Z    t        | j                  | j                  | j                        S rS   )rE   r   r    r!   rM   s    r   rE   zAppDirs.user_log_dir  s    DLL$..$,,OOr%   )NNNFF)__name__
__module____qualname____doc__rJ   propertyr$   r1   r5   r8   r>   rA   rE    r%   r   rG   rG     s    ; TY# 
 

 
 

 
 

 
 

 R R R R P Pr%   rG   c                     ddl }dddd|    }|j                  |j                  d      }|j                  ||      \  }}|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
   NAppDatazCommon AppDatazLocal AppDatar   r'   r   z@Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders)winregOpenKeyHKEY_CURRENT_USERQueryValueEx)
csidl_name_winregshell_folder_namekeydirtypes         r   _get_win_folder_from_registryrk     s^    
  # 0. 	 //!!KC $$S*;<ICJr%   c                    ddl m}m} |j                  dt	        ||       dd      }	 t        |      }d}|D ]  }t        |      dkD  sd} n |r	 dd l}|j                  |      }|S 	 |S # t        $ r Y |S w xY w# t        $ r Y |S w xY w)Nr
   )shellshellconF   T)win32com.shellrm   rn   SHGetFolderPathgetattrunicodeordwin32apiGetShortPathNameImportErrorUnicodeError)re   rm   rn   ri   has_high_charcru   s          r   _get_win_folder_with_pywin32r{   
  s    .


78Z#@!Q
GCcl  	A1v| $	 //4
 J  J	   J	 Js5    A; 	A; A+ +	A84A; 7A88A; ;	BBc                 j   dd l }dddd|    }|j                  d      }|j                  j                  j	                  d |d d|       d}|D ]  }t        |      dkD  sd	} n |rD|j                  d      }|j                  j                  j                  |j                  |d      r|}|j                  S )
Nr
      #      r`   i   Fro   T)	ctypescreate_unicode_bufferwindllshell32SHGetFolderPathWrt   kernel32GetShortPathNameWvalue)re   r   csidl_constbufry   rz   buf2s          r   _get_win_folder_with_ctypesr   '  s      "! 	K 
&
&t
,C
MM**4dAsK M q6C< M ++D1==!!33CIItTJC99r%   c                    dd l }ddlm} ddlm} |j
                  j                  dz  }|j                  d|      }|j                  j                  }|j                  d t        |j                  |       d |j                  j                  |       |j                  j                  |j!                               j#                  d      }d}|D ]  }	t%        |	      dkD  sd	} n |rs|j                  d|      }|j&                  j                  }
|
j)                  |||      r8|j                  j                  |j!                               j#                  d      }|S )
Nr
   )jna)r      rz    Fro   T)arraycom.sunr   com.sun.jna.platformr   WinDefMAX_PATHzerosShell32INSTANCErq   rr   ShlObjSHGFP_TYPE_CURRENTNativetoStringtostringr+   rt   Kernel32rv   )re   r   r   r   buf_sizer   rm   ri   ry   rz   kernels              r   _get_win_folder_with_jnar   B  s    *||$$q(H
++c8
$CMM""E	j)'' **

clln
-
4
4T
:C M q6C< M kk#x(((""3X6**%%clln5<<TBCJr%   )r   __main__MyApp	MyCompany)r$   r5   r>   rA   rE   r1   r8   z-- app dirs z --z%-- app dirs (with optional 'version')z1.0rT   z: z)
-- app dirs (without optional 'version')z+
-- app dirs (without optional 'appauthor')z(
-- app dirs (with disabled 'appauthor'))r    )NNNF)NNNT)+r[   __version__tupler*   __version_info__r   sysstrrs   platform
startswithjava_veros_namer   r$   r1   r5   r8   r>   rA   rE   objectrG   rk   r{   r   r   rp   win32comr   rw   r   r   com.sun.jnacomrX   r   r    propsprintdirsproprr   r]   r%   r   <module>r      s  > L[5F5Fs5KLL  
 
 <<6"h!!$Q'G)$			E	"
 \\F4nBJ)X6r6r'T.b.Pf .Ph*:6D 
W@6" zGIE 
LS
)*	
127Iu5D 0bt,-./0 

677I&D 0bt,-./0 

897D 0bt,-./0 

567e,D 0bt,-./0C !  @
	@%9O 	@@"": @"?@	@@sZ   F% %G+F43G4G:G GGG
GGGGGG