OwlCyberSecurity - MANAGER
Edit File: windows.cpython-311.pyc
� ������h'����������������������������d�Z�ddlmZ�ddlZddlZddlZddlmZ�ddlm Z �ddl mZ�e rddlm Z ��G�d ��d e������������Zdd�Zdd�Zdd�Zdd�Zdd�Z��ed��������������e��������������������������Zd gZdS�)zWindows.�����)�annotationsN)� lru_cache)� TYPE_CHECKING����)�PlatformDirsABC)�Callablec�����������������������e�Zd�ZdZedd���������������Zdd�dd �Zedd���������������Zedd���������������Zedd ���������������Z edd���������������Z edd���������������Zedd���������������Zedd���������������Z edd���������������Zedd���������������Zedd���������������Zedd���������������Zedd���������������Zedd���������������Zedd���������������Zedd���������������ZdS�)�Windowsa�� `MSDN on where to store app data files <http://support.microsoft.com/default.aspx?scid=kb;en-us;310294#XSLTH3194121123120121120120>`_. Makes use of the `appname <platformdirs.api.PlatformDirsABC.appname>`, `appauthor <platformdirs.api.PlatformDirsABC.appauthor>`, `version <platformdirs.api.PlatformDirsABC.version>`, `roaming <platformdirs.api.PlatformDirsABC.roaming>`, `opinion <platformdirs.api.PlatformDirsABC.opinion>`, `ensure_exists <platformdirs.api.PlatformDirsABC.ensure_exists>`. �return�strc����������������������|�j���������rdnd}t����������j�����������������������������t ����������|������������������������}|����������������������|������������S�)z� :return: data directory tied to the user, e.g. ``%USERPROFILE%\AppData\Local\$appauthor\$appname`` (not roaming) or ``%USERPROFILE%\AppData\Roaming\$appauthor\$appname`` (roaming) � CSIDL_APPDATA�CSIDL_LOCAL_APPDATA)�roaming�os�path�normpath�get_win_folder� _append_parts)�self�constr���s��� �e/builddir/build/BUILD/cloudlinux-venv-1.0.8/venv/lib/python3.11/site-packages/platformdirs/windows.py� user_data_dirzWindows.user_data_dir���sF�������$(�<�J���5J���w����u� 5� 5�6�6���!�!�$�'�'�'�����N�� opinion_valuer���r���� str | Nonec����������������z����g�}|�j���������r�|�j��������dur#|�j��������p|�j���������}|���������������������|�������������|���������������������|�j����������������������|�|�j��������r|���������������������|�������������|�j��������r|���������������������|�j���������������������t����������j��������j��������|g|�R���}|����������������������|�������������|S�)NF) �appname� appauthor�append�opinion�versionr���r����join�_optionally_create_directory)r���r���r����params�authors��� r���r���zWindows._append_parts(���s����������<�� ,��~�U�*�*���7�4�<��� � �f�%�%�%��M�M�$�,�'�'�'��(�T�\�(�� � �m�,�,�,��|�� ,�� � �d�l�+�+�+��w�|�D�*�6�*�*�*���)�)�$�/�/�/��r���c����������������������t�����������j�����������������������������t����������d������������������������}|����������������������|������������S�)zT:return: data directory shared by users, e.g. ``C:\ProgramData\$appauthor\$appname``�CSIDL_COMMON_APPDATA�r���r���r���r���r����r���r���s��� r���� site_data_dirzWindows.site_data_dir7���s6��������w����/E� F� F�G�G���!�!�$�'�'�'r���c����������������������|�j���������S�)zC:return: config directory tied to the user, same as `user_data_dir`�r����r���s��� r����user_config_dirzWindows.user_config_dir=���� ��������!�!r���c����������������������|�j���������S�)zF:return: config directory shared by the users, same as `site_data_dir`)r,���r/���s��� r����site_config_dirzWindows.site_config_dirB���r1���r���c����������������������t�����������j�����������������������������t����������d������������������������}|����������������������|d�������������S�)z� :return: cache directory tied to the user (if opinionated with ``Cache`` folder within ``$appname``) e.g. ``%USERPROFILE%\AppData\Local\$appauthor\$appname\Cache\$version`` r����Cacher���r*���r+���s��� r����user_cache_dirzWindows.user_cache_dirG���s;��������w����/D� E� E�F�F���!�!�$�g�!�>�>�>r���c����������������������t�����������j�����������������������������t����������d������������������������}|����������������������|d�������������S�)zd:return: cache directory shared by users, e.g. ``C:\ProgramData\$appauthor\$appname\Cache\$version``r)���r5���r���r*���r+���s��� r����site_cache_dirzWindows.site_cache_dirP���s;��������w����/E� F� F�G�G���!�!�$�g�!�>�>�>r���c����������������������|�j���������S�)zB:return: state directory tied to the user, same as `user_data_dir`r.���r/���s��� r����user_state_dirzWindows.user_state_dirV���r1���r���c����������������������|�j���������}|�j��������r5t����������j�����������������������������|d������������}|����������������������|�������������|S�)zg:return: log directory tied to the user, same as `user_data_dir` if not opinionated else ``Logs`` in it�Logs)r���r"���r���r���r$���r%���r+���s��� r����user_log_dirzWindows.user_log_dir[���sD��������!���<�� 4��7�<�<��f�-�-�D��-�-�d�3�3�3��r���c�����������������Z�����t�����������j�����������������������������t����������d������������������������S�)zN:return: documents directory tied to the user e.g. ``%USERPROFILE%\Documents``�CSIDL_PERSONAL�r���r���r���r���r/���s��� r����user_documents_dirzWindows.user_documents_dird���s#��������w����/?� @� @�A�A�Ar���c�����������������Z�����t�����������j�����������������������������t����������d������������������������S�)zN:return: downloads directory tied to the user e.g. ``%USERPROFILE%\Downloads``�CSIDL_DOWNLOADSr@���r/���s��� r����user_downloads_dirzWindows.user_downloads_diri���s#��������w����/@� A� A�B�B�Br���c�����������������Z�����t�����������j�����������������������������t����������d������������������������S�)zL:return: pictures directory tied to the user e.g. ``%USERPROFILE%\Pictures``�CSIDL_MYPICTURESr@���r/���s��� r����user_pictures_dirzWindows.user_pictures_dirn���s#��������w����/A� B� B�C�C�Cr���c�����������������Z�����t�����������j�����������������������������t����������d������������������������S�)zH:return: videos directory tied to the user e.g. ``%USERPROFILE%\Videos``� CSIDL_MYVIDEOr@���r/���s��� r����user_videos_dirzWindows.user_videos_dirs����"��������w����� ?� ?�@�@�@r���c�����������������Z�����t�����������j�����������������������������t����������d������������������������S�)zF:return: music directory tied to the user e.g. ``%USERPROFILE%\Music``� CSIDL_MYMUSICr@���r/���s��� r����user_music_dirzWindows.user_music_dirx���rK���r���c�����������������Z�����t�����������j�����������������������������t����������d������������������������S�)zK:return: desktop directory tied to the user, e.g. ``%USERPROFILE%\Desktop``�CSIDL_DESKTOPDIRECTORYr@���r/���s��� r����user_desktop_dirzWindows.user_desktop_dir}���s#��������w����/G� H� H�I�I�Ir���c����������������������t�����������j�����������������������������t�����������j�����������������������������t ����������d������������d������������������������}|����������������������|������������S�)z� :return: runtime directory tied to the user, e.g. ``%USERPROFILE%\AppData\Local\Temp\$appauthor\$appname`` r����Temp)r���r���r���r$���r���r���r+���s��� r����user_runtime_dirzWindows.user_runtime_dir����sG��������w�������^�<Q�-R�-R�TZ� [� [�\�\���!�!�$�'�'�'r���c����������������������|�j���������S�)zF:return: runtime directory shared by users, same as `user_runtime_dir`)rT���r/���s��� r����site_runtime_dirzWindows.site_runtime_dir����s ��������$�$r���)r���r���)r���r���r���r���r���r���)�__name__� __module__�__qualname__�__doc__�propertyr���r���r,���r0���r3���r6���r8���r:���r=���rA���rD���rG���rJ���rN���rQ���rT���rV�����r���r���r ���r ������s[������������� �� ���(��(��(���X�(��GK�� �� �� �� �� �� ���(��(��(���X�(� ��"��"��"���X�"���"��"��"���X�"���?��?��?���X�?���?��?��?���X�?� ��"��"��"���X�"����������X����B��B��B���X�B���C��C��C���X�C���D��D��D���X�D���A��A��A���X�A���A��A��A���X�A���J��J��J���X�J���(��(��(���X�(���%��%��%���X�%��%��%r���r ���� csidl_namer���r���c�����������������������t����������|�������������}|�|S�dddd����������������������|�������������}|�d|����}t����������|�������������t����������j�����������������������������|������������}|�d|���}t����������|�������������|S�)z&Get folder from environment variables.N�APPDATA�ALLUSERSPROFILE�LOCALAPPDATA)r���r)���r����Unknown CSIDL name: zUnset environment variable: )�(get_win_folder_if_csidl_name_not_env_var�get� ValueErrorr����environ)r]����result�env_var_name�msgs��� r����get_win_folder_from_env_varsrj�������s������� 5�j� A� A�F� ��� ��#� 1�-����� �c�*�o�o� �� ���1�Z�1�1����o�o�� �Z�^�^�L� )� )�F� �~�;�\�;�;����o�o���Mr���r���c�����������������D����|�dk����rMt�����������j�����������������������������t�����������j�����������������������������t�����������j��������d���������������������d������������S�|�dk����rMt�����������j�����������������������������t�����������j�����������������������������t�����������j��������d���������������������d������������S�|�dk����rMt�����������j�����������������������������t�����������j�����������������������������t�����������j��������d���������������������d������������S�|�dk����rMt�����������j�����������������������������t�����������j�����������������������������t�����������j��������d���������������������d ������������S�|�d k����rMt�����������j�����������������������������t�����������j�����������������������������t�����������j��������d���������������������d������������S�dS�) zKGet folder for a CSIDL name that does not exist as an environment variable.r?����USERPROFILE� DocumentsrC���� DownloadsrF����PicturesrI����VideosrM����MusicN)r���r���r$���r���rf���)r]���s��� r���rc���rc�������s"������%�%�%��w�|�|�B�G�,�,�R�Z� �-F�G�G��U�U�U��&�&�&��w�|�|�B�G�,�,�R�Z� �-F�G�G��U�U�U��'�'�'��w�|�|�B�G�,�,�R�Z� �-F�G�G��T�T�T��_�$�$��w�|�|�B�G�,�,�R�Z� �-F�G�G��R�R�R��_�$�$��w�|�|�B�G�,�,�R�Z� �-F�G�G��Q�Q�Q��4r���c����������� ������&����ddddddddd �����������������������|�������������}|�d|����}t����������|�������������t����������j��������dk����rt�����������d d l}|���������������������|j��������d������������}|���������������������||������������\��}}t����������|������������S�)z� Get folder from the registry. This is a fallback technique at best. I'm not sure if using the registry for these guarantees us the correct answer for all CSIDL_* names. �AppDatazCommon AppDataz Local AppData�Personalz&{374DE290-123F-4565-9164-39C4925E467B}zMy PictureszMy VideozMy Music)r���r)���r���r?���rC���rF���rI���rM���Nrb����win32r���z@Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders) rd���re����sys�platform�NotImplementedError�winreg�OpenKey�HKEY_CURRENT_USER�QueryValueExr���)r]����shell_folder_nameri���ry����key� directory�_s��� r����get_win_folder_from_registryr��������s��������#� 0�.�$�C�)�#�#� �� �� �c�*�o�o����� �1�Z�1�1����o�o�� �|�w���!�!��M�M�M� �.�.��1�3v� w� w�C��&�&�s�,=�>�>�L�I�q��y�>�>�r���c����������� ����������ddddddddd d � ����������������������|�������������}|�d|����}t����������|�������������t����������j��������d ������������}t ����������t����������d������������}|j�����������������������������d|dd|�������������t����������d��|D���������������������������r7t����������j��������d ������������}|j��������� ��������������������|j ��������|d ������������r|}|�dk����r%t����������j��������� ��������������������|j ��������d������������S�|j ��������S�)zGet folder with ctypes.�����#������������'�������� ����(�������) r���r)���r���r?���rF���rI���rM���rC���rP���Nrb���i����windllr���c��������������3���<���K����|�]}t����������|������������d�k����V����dS�)����N)�ord)�.0�cs��� r���� <genexpr>z,get_win_folder_via_ctypes.<locals>.<genexpr>����s,���������� %� %�A�3�q�6�6�C�<� %� %� %� %� %� %r���rC���rn���)rd���re����ctypes�create_unicode_buffer�getattr�shell32�SHGetFolderPathW�any�kernel32�GetShortPathNameW�valuer���r���r$���)r]����csidl_constri����bufr�����buf2s��� r����get_win_folder_via_ctypesr��������s������� "�!������"$� �� �� �c�*�o�o������1�Z�1�1����o�o�� � &�t� ,� ,�C� �V�X� &� &�F� �N�#�#�D�+�t�Q��D�D�D��� %� %�� %� %� %�%�%����+�D�1�1���?�,�,�S�Y��d�C�C�� ��C��&�&�&��w�|�|�C�I�{�3�3�3��9�r����Callable[[str], str]c�����������������������t����������t����������d������������rt����������S� �dd�l}�t����������S�#�t ����������$�r �t����������cY�S�w�xY�w)Nr����r���)�hasattrr����r����ry���r�����ImportErrorrj���)ry���s��� r����_pick_get_win_folderr��������sY�������v�x� � ��)�(�(�,�� � � ��,�+�����,��,��,�+�+�+�+�,���s����)��=�=)�maxsize)r]���r���r���r���)r]���r���r���r���)r���r����)rZ���� __future__r���r����r���rv���� functoolsr����typingr����apir����collections.abcr���r ���rj���rc���r����r����r����r����__all__r\���r���r����<module>r�������sW��������"��"��"��"��"��"�� � � � �� � � � �� � � � �������������� �� �� �� �� �� �� �� �� �� �� �� ���)�(�(�(�(�(�(�~%��~%��~%��~%��~%�o��~%��~%��~%�B�������*�������&�������:"��"��"��"�J,��,��,��,��)���4�(�(�(�)=�)=�)?�)?�@�@�������r���