a
    Sic	#                     @   s6  d Z dZedd edD ZddlZddlZeZej	
dr~ddl	Z	e	 d d Ze
d	rhd
Zqe
drxdZqdZnej	ZdddZdd Zdd Zdd Zdd Zed
kr2zddlZeZW nh ey0   zddlmZ eZW n> ey*   zddlZeZW n ey$   eZY n0 Y n0 Y n0 dS )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                 c   s   | ]}t |V  qd S )N)int).0segment r   T/var/www/html/django/DPS/env/lib/python3.9/site-packages/seaborn/external/appdirs.py	<genexpr>1       r   .    Njava   Windowswin32ZMacdarwinlinux2Tc                 C   s   t dkrd|du r| }tjtd}| r|durBtj||| }ntj|| }|rtj|d}nNt dkrtjd}| rtj|| }n&tdtjd	}| rtj|| }| r|rt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   NCSIDL_LOCAL_APPDATAFCacher   z~/Library/CachesXDG_CACHE_HOMEz~/.cache)systemospathnormpath_get_win_folderjoin
expandusergetenv)appname	appauthorversionopinionr   r   r   r   user_cache_dirI   s(    !r   c                 C   s:   ddl }dddd|  }||jd}|||\}}|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CSIDL_APPDATACSIDL_COMMON_APPDATAr   z@Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders)winregOpenKeyHKEY_CURRENT_USERQueryValueEx)
csidl_name_winregshell_folder_namekeydirtyper   r   r   _get_win_folder_from_registry   s    r.   c                 C   s   ddl m}m} |dt|| dd}z\t|}d}|D ]}t|dkr8d} qRq8|rzdd l}||}W n t	y~   Y n0 W n t
y   Y n0 |S )Nr	   )shellconshellF   T)win32com.shellr/   r0   SHGetFolderPathgetattrunicodeordwin32apiGetShortPathNameImportErrorUnicodeError)r(   r/   r0   r,   has_high_charcr7   r   r   r   _get_win_folder_with_pywin32   s$    
r=   c                 C   s   dd l }dddd|  }|d}|jjd |d d| d}|D ]}t|dkr@d	} qZq@|r|d}|jj|j|dr|}|jS )
Nr	      #      r!   i   Fr1   T)	ctypescreate_unicode_bufferwindllshell32SHGetFolderPathWr6   kernel32GetShortPathNameWvalue)r(   rA   csidl_constbufr;   r<   buf2r   r   r   _get_win_folder_with_ctypes   s&    

rL   c                 C   s   dd l }ddlm} ddlm} |jjd }|d|}|jj	}|
d t|j| d |jj| |j| d}d}|D ]}	t|	dkr|d	} qq||r|d|}|jj	}
|
|||r|j| d}|S )
Nr	   )jna)r      r<    Fr1   T)arraycom.sunrM   com.sun.jna.platformr   WinDefMAX_PATHzerosShell32INSTANCEr3   r4   ShlObjSHGFP_TYPE_CURRENTNativetoStringtostringrstripr6   Kernel32r8   )r(   rP   rM   r   buf_sizerJ   r0   r,   r;   r<   kernelr   r   r   _get_win_folder_with_jna   s&    ra   )rC   )NNNT)__doc____version__tuplesplit__version_info__sysr   strr5   platform
startswithjava_veros_namer   r   r.   r=   rL   ra   r2   Zwin32comr   r9   rA   rC   Zcom.sun.jnacomr   r   r   r   <module>   sB   )


;
