
    ^f                     P    d dl mZmZmZmZmZ d dlmZ d dlm	Z	 d Z
d	dZd
dZdS )    )URLResolverincludepathre_pathregister_converter)RoutePattern)api_settingsc                     |r:t          |          dk    r	|d         }ndd                    |          z  }d|z  nd G fdd          }d	}|r|d
d
                    |          z   z  }||fS )N   r   z(?:%s)|z\.%s/?z\.[a-z0-9]+/?c                        e Zd Z Zd Zd ZdS )9_get_format_path_converter.<locals>.FormatSuffixConverterc                 ,    |                     d          S )Nz./)stripselfvalues     L/var/www/html/env/lib/python3.11/site-packages/rest_framework/urlpatterns.py	to_pythonzC_get_format_path_converter.<locals>.FormatSuffixConverter.to_python   s    ;;t$$$    c                     d|z   dz   S )N./ r   s     r   to_urlz@_get_format_path_converter.<locals>.FormatSuffixConverter.to_url   s    ;$$r   N)__name__
__module____qualname__regexr   r   )suffix_patterns   r   FormatSuffixConverterr      s8        	% 	% 	%	% 	% 	% 	% 	%r   r!   drf_format_suffix_)lenjoin)suffix_kwargallowedallowed_patternr!   converter_namer    s        @r   _get_format_path_converterr*      s     *w<<1%ajOO&'):)::O"_4)% % % % % % % % % % )N 2# 1 111000r   Nc                    g }| D ]}t          |t                    r|j        j        j        }|j        }|j        }|j        }	t          |j        |||          }
t          |j        t                    r?t          J t          |j                  }t          |t          |
|f|          |	          }n!t          |t          |
|f|          |	          }|                    |           |j        j        j                            d                              d          |z   }|j        }|j        }	|j        }|s|                    |           t          |j        t                    r]t          J |J t          |j                                      d                              d          |z   }t          |||	|          }nt          |||	|          }|                    |           |S )N$r   )
isinstancer   patternr   	namespaceapp_namedefault_kwargsapply_suffix_patternsurl_patternsr   r   strr   r   appendrstripcallbackdefault_argsname)urlpatternsr    suffix_requiredsuffix_routeret
urlpatternr   r/   r0   kwargspatternsroutenew_patternviewr9   s                  r   r2   r2   !   s   
C! )$ )$
j+.. (	$&,4E",I!*H.F,Z-D-;-<-9; ;H *,l;; _'''J.//"5'8X2F	*R*RTZ[[%eWh5I9-U-UW]^^JJ{#### &,4;;C@@GGLL~]E&D,F?D" '

:&&& *,l;; A'''#///J.//66s;;BB3GG,V"5$==%eT64@@JJ{####Jr   Fc                     t           j        }|r>t          |          dk    r	|d         }ndd                    |          z  }d|d|d}nd|z  }t	          ||          \  }}t          ||           d	|d
|d}t          | |||          S )a  
    Supplement existing urlpatterns with corresponding patterns that also
    include a '.format' suffix.  Retains urlpattern ordering.

    urlpatterns:
        A list of URL patterns.

    suffix_required:
        If `True`, only suffixed URLs will be generated, and non-suffixed
        URLs will not be used.  Defaults to `False`.

    allowed:
        An optional tuple/list of allowed suffixes.  eg ['json', 'api']
        Defaults to `None`, which allows any suffix.
    r   r   z(%s)r   z\.(?P<>z)/?$z\.(?P<%s>[a-z0-9]+)/?$<:)r	   FORMAT_SUFFIX_KWARGr$   r%   r*   r   r2   )	r:   r;   r'   r&   r(   r    r)   suffix_converterr<   s	            r   format_suffix_patternsrJ   Q   s       3L Bw<<1%ajOO$sxx'8'88O/;||___M2\A'A,PW'X'X$N$'8888 .=L no|\\\r   )N)FN)django.urlsr   r   r   r   r   django.urls.resolversr   rest_framework.settingsr	   r*   r2   rJ   r   r   r   <module>rN      s    O O O O O O O O O O O O O O . . . . . . 0 0 0 0 0 01 1 14- - - -`] ] ] ] ] ]r   