�
�Mc� � �L � d Z ddlZdZdZdZd e� � z Zd e� � z ZdZd Z d
e� � z Z
d e� � z Zd e� � z Zd
e� � z Z
d e� � z ZdZd e� � z Zd e� � z Zd e� � z Zd e� � z Zd e� � z Zd e� � z Zd e� � z Zd e� � z Zd e� � z Zd e� � z Zd e� � z Zd e� � z Zd e� � z Zd e� � z ZdZd e� � z Zd e� � z Z d e� � z Z!d! e� � z Z"d" e� � z Z#d# e� � z Z$d$ e� � z Z%d% e� � z Z&d& e� � z Z'd'� Z(d(� Z)d)� Z*dS )*a
Regex for URIs
These regex are directly derived from the collected ABNF in RFC3986
(except for DIGIT, ALPHA and HEXDIG, defined by RFC2234).
They should be processed with re.VERBOSE.
Thanks Mark Nottingham for this code - https://gist.github.com/138549
� Nz[\x30-\x39]z[\x41-\x5A\x61-\x7A]z[\x30-\x39A-Fa-f]z %% %(HEXDIG)s %(HEXDIG)sz-(?: %(ALPHA)s | %(DIGIT)s | \- | \. | _ | ~ )z#(?: : | / | \? | \# | \[ | \] | @ )zI(?: ! | \$ | & | ' | \( | \) |
\* | \+ | , | ; | = )z?(?: %(unreserved)s | %(pct_encoded)s | %(sub_delims)s | : | @ )z%(?: %(gen_delims)s | %(sub_delims)s )z5%(ALPHA)s (?: %(ALPHA)s | %(DIGIT)s | \+ | \- | \. )*z�(?: %(DIGIT)s |
[\x31-\x39] %(DIGIT)s |
1 %(DIGIT)s{2} |
2 [\x30-\x34] %(DIGIT)s |
25 [\x30-\x35]
)
z@%(dec_octet)s \. %(dec_octet)s \. %(dec_octet)s \. %(dec_octet)sz#([A-Fa-f0-9:]+[:$])[A-Fa-f0-9]{1,4}z;v %(HEXDIG)s+ \. (?: %(unreserved)s | %(sub_delims)s | : )+z+\[ (?: %(IPv6address)s | %(IPvFuture)s ) \]z8(?: %(unreserved)s | %(pct_encoded)s | %(sub_delims)s )*z;(?: %(unreserved)s | %(pct_encoded)s | %(sub_delims)s | : )z5(?: %(IP_literal)s | %(IPv4address)s | %(reg_name)s )z(?: %(DIGIT)s )*z.(?: %(userinfo)s @)? %(host)s (?: : %(port)s)?z
%(pchar)s*z
%(pchar)s+z<(?: %(unreserved)s | %(pct_encoded)s | %(sub_delims)s | @ )+z(?: / %(segment)s )*z,/ (?: %(segment_nz)s (?: / %(segment)s )* )?z&%(segment_nz_nc)s (?: / %(segment)s )*z#%(segment_nz)s (?: / %(segment)s )*� z�(?: %(path_abempty)s |
%(path_absolute)s |
%(path_noscheme)s |
%(path_rootless)s |
%(path_empty)s
)
z(?: %(pchar)s | / | \? )*z�(?: (?: // %(authority)s %(path_abempty)s ) |
%(path_absolute)s |
%(path_rootless)s |
%(path_empty)s
)
z�(?: (?: // %(authority)s %(path_abempty)s ) |
%(path_absolute)s |
%(path_noscheme)s |
%(path_empty)s
)
z:%(relative_part)s (?: \? %(query)s)? (?: \# %(fragment)s)?zM^(?: %(scheme)s : %(hier_part)s (?: \? %(query)s )? (?: \# %(fragment)s )? )$z"^(?: %(URI)s | %(relative_ref)s )$z6^(?: %(scheme)s : %(hier_part)s (?: \? %(query)s )? )$c �L � t j t | t j � � S �N)�re�match�URI�VERBOSE��uris �7/usr/lib/python3/dist-packages/oauthlib/uri_validate.py�is_urir
� s � �
�8�C��b�j�)�)�)� c �L � t j t | t j � � S r )r r �
URI_referencer r
s r �is_uri_referencer � s � �
�8�M�3��
�3�3�3r c �L � t j t | t j � � S r )r r �absolute_URIr r
s r �is_absolute_urir � s � �
�8�L�#�r�z�2�2�2r )+�__doc__r �DIGIT�ALPHA�HEXDIG�locals�pct_encoded�
unreserved�
gen_delims�
sub_delims�pchar�reserved�scheme� dec_octet�IPv4address�IPv6address� IPvFuture�
IP_literal�reg_name�userinfo�host�port� authority�segment�
segment_nz�
segment_nz_nc�path_abempty�
path_absolute�
path_noscheme�
path_rootless�
path_empty�path�query�fragment� hier_part�
relative_part�relative_refr r r r
r r � r r �<module>r: s� �� � �
� � � � ���� �� +�V�V�X�X�5�� >�����
H�
� 4�
�.�
� K�V�V� N� N� �� 4�f�f�h�h�>��
B�F�F�H�H� L��
�
�f�h�h�
� � R�TZ�TZ� U� U� �� 5��
K�V�V�X�X�U� � <�f�f�h�h�
F�
� G�����Q�� J�F�F� M� M� �� @�&�&�(�(�J�� �V�V�X�X�%��
>�����H� �
�&�&�(�(�
"�� �V�V�X�X�
%�
� P�RX�RX�RZ�RZ�Z�
� '�����1�� @�&�&�(�(�J�
� :�F�F�H�H�D�
� 7�����A�
� �
��
�f�h�h�
�� %�v�v�x�x�/�� (�&�&�(�(�2��
�
�f�h�h�
� ��
�f�h�h��
� M�v�v� P� P� �� W�Y_�Y_� Z� Z� �� 6�����@�
� I�6�6� L� L� ��*� *� *�4� 4� 4�3� 3� 3� 3� 3r |