a
    Sic`  ã                   @   sl   d Z ddlmZ ddlmZ ddlmZ ddlmZ ddl	m
Z
 ddd	„Zdd
d„Zddd„ZeeeƒZdS )zN
Provide urlresolver functions that return fully qualified URLs or view names
é    )ÚNoReverseMatch)Úreverse)Úlazy)Úapi_settings)Úreplace_query_paramNc                 C   sF   |du r| S t jg}|D ](}|r||jv r|j| }t| ||ƒ} q| S )z
    Given an incoming request, and an outgoing URL representation,
    append the value of any built-in query parameters.
    N)r   ÚURL_FORMAT_OVERRIDEÚGETr   )ÚurlÚrequestÚ	overridesÚparamÚvalue© r   úR/var/www/html/django/DPS/env/lib/python3.9/site-packages/rest_framework/reverse.pyÚpreserve_builtin_query_params   s    ÿ
r   c              	   K   s‚   t |ddƒ}|dur`z|j| ||||fi |¤Ž}W qx ty\   t| ||||fi |¤Ž}Y qx0 nt| ||||fi |¤Ž}t||ƒS )z®
    If versioning is being used then we pass any `reverse` calls through
    to the versioning scheme instance, so that the resulting URL
    can be modified if needed.
    Úversioning_schemeN)Úgetattrr   r   Ú_reverser   )ÚviewnameÚargsÚkwargsr
   ÚformatÚextraÚschemer	   r   r   r   r       s     r   c                 K   s@   |dur|pi }||d< t | f||dœ|¤Ž}|r<| |¡S |S )z•
    Same as `django.urls.reverse`, but optionally takes a request
    and returns a fully qualified URL, using the request to get the base URL.
    Nr   )r   r   )Údjango_reverseÚbuild_absolute_uri)r   r   r   r
   r   r   r	   r   r   r   r   4   s    
r   )N)NNNN)NNNN)Ú__doc__Údjango.urlsr   r   r   Údjango.utils.functionalr   Úrest_framework.settingsr   Zrest_framework.utils.urlsr   r   r   ÚstrÚreverse_lazyr   r   r   r   Ú<module>   s   


