� L�g; � ��dZddlmZddlmZddlZddlmZmZddl m Z Gd�d ��Z e d d d d �d e d e de de fd���ZdS)zDomain.�)�environ)�PathN)�Optional�Set�)� validatorc�t�eZdZUdZdZeeeed<hd�Z e d���Z e defd���Z dS)�_IanaTLDz*Read IANA TLDs, and optionally cache them.N� _full_cache> �BR�DE�FR�IT�JP�RU�UK�COM�NET�ORGc#�K�tt��j�d�����5}t |��}|D]}|���V�� ddd��dS#1swxYwYdS)Nz_tld.txt)r�__file__�parent�joinpath�open�next�strip)�cls�tld_f�_�lines �a/home/asafur/pinokio/api/open-webui.git/app/env/lib/python3.11/site-packages/validators/domain.py� _retrievez_IanaTLD._retrieves����� �(�^�^� "� +� +�J� 7� 7� <� <� >� >� #�%��U� � �A�� #� #���j�j�l�l�"�"�"�"� #� #� #� #� #� #� #� #� #� #� #� #� #���� #� #� #� #� #� #s�+A:�:A>�A>�tldc���||jvrdS|j�Utjd��dkr't |�����|_n||���vS||jvS)NT�PYVLD_CACHE_TLD�True)�_popular_cacher r�get�setr")rr#s r!�checkz_IanaTLD.checksl�� �#�$� $� $��4� �?� "��{�,�-�-��7�7�"%�c�m�m�o�o�"6�"6�����c�m�m�o�o�-�-��c�o�%�%�) �__name__� __module__� __qualname__�__doc__r rr�str�__annotations__r'� classmethodr"r*�r+r!r r s��������4�4�&*�K��#�c�(�#�*�*�*�T�T�T�N��#�#��[�#� �&��&�&�&��[�&�&�&r+r F)� consider_tld�rfc_1034�rfc_2782�valuer4r5r6c��|sdS|r[t�|�d���dd��d�����sdS |rdnd}|rdnd}t jd |�� o`t jd |�d �d |�d �zd|�d�zdzd|��z|�d��� d��t j ��S#t$r}td|����|�d}~wwxYw)a&Return whether or not given value is a valid domain. Examples: >>> domain('example.com') # Output: True >>> domain('example.com/') # Output: ValidationError(func=domain, ...) >>> # Supports IDN domains as well:: >>> domain('xn----gtbspbbmkef.xn--p1ai') # Output: True Args: value: Domain string to validate. consider_tld: Restrict domain to TLDs allowed by IANA. rfc_1034: Allows optional trailing dot in the domain name. Ref: [RFC 1034](https://www.rfc-editor.org/rfc/rfc1034). rfc_2782: Domain name is of type service record. Allows optional underscores in the domain name. Ref: [RFC 2782](https://www.rfc-editor.org/rfc/rfc2782). Returns: (Literal[True]): If `value` is a valid domain name. (ValidationError): If `value` is an invalid domain name. Raises: (UnicodeError): If `value` cannot be encoded into `idna` or decoded into `utf-8`. F�.r�����r�z\.?$�$z\s|__+z ^(?:[a-z0-9�]z (?:[a-z0-9-z]{0,61}z[a-z0-9z])?\.)z+[a-z0-9][a-z0-9-_]{0,61}z[a-z]�idnazutf-8zUnable to encode/decode N) r r*�rstrip�rsplit�upper�re�search�match�encode�decode� IGNORECASE� UnicodeError)r7r4r5r6�service_record� trailing_dot�errs r!�domainrL's_��H ���u���H�N�N�5�<�<��+<�+<�+C�+C�C��+K�+K�B�+O�+U�+U�+W�+W�X�X���u�H�!)�1���r��"*�4�w�w�� ��9�Y��.�.�.�  �2�8� ,�>� ,� ,� ,�6�^�6�6�6� 7�0��/�/�/�  0� +�  +�&�|�%�%� &� �L�L�� � � '� '�� 0� 0� �M� 4 � 4 � �� �H�H�H��=�e�=�=�>�>�C�G�����H���s�#BC&�& D�0D�D)r/�osr�pathlibrrB�typingrr�utilsrr r0�boolrLr3r+r!�<module>rRs��� � ������������� � � � � � � � � � � � �������&�&�&�&�&�&�&�&�4 �+0�5�[`�=H�=H�=H� �=H�$(�=H�<@�=H�TX�=H�=H�=H� ��=H�=H�=Hr+
Memory