o
    PDi                     @   sf   d dl mZ zd dlZW n ey   dZY nw d dlmZmZ d dlmZ dZ	dd Z
d
dd	ZdS )    )	urlencodeN)ContextTemplate)
is_str_typa<  from django.test import Client
c = Client()
response = c.{{ lower_case_method }}(path='{{ path }}'{% if data or content_type %},{% else %}){% endif %}{% if data %}
data={{ data }}{% endif %}{% if data and content_type %},{% elif data %}){% endif %}{% if content_type %}
content_type='{{ content_type }}'){% endif %}
c                 C   s,   z	t | } W d|  S  ty   Y d|  S w )N?)r   	TypeError)query_params r	   `/var/www/Datamplify/venv/lib/python3.10/site-packages/silk/code_generation/django_test_client.py_encode_query_params   s   
r   c                 C   s   |  }tt}| ||d}|dkr||d< n|r!t|}| |7 } t|r)d| }||d< ||d< |t|dd}trHtj|t	dd	gd
}|S )N)pathlower_case_methodcontent_typegetdataz'%s'r   F)
autoescapez--aggressive )options)
lowerr   templater   r   renderr   autopep8fix_code
parse_args)r   methodr   r   r   tcontextcoder	   r	   r
   gen   s,   
r   )NNNN)urllib.parser   r   ImportErrordjango.templater   r   silk.profiling.dynamicr   r   r   r   r	   r	   r	   r
   <module>   s    	