o
    |!g#                  	   @   s   d dl Z d dlmZmZmZmZ dedefddZdd
edede	defddZ
dedefddZdedeeeeef f fddZdS )    N)	Docstringparse_googleparse_numpyparse_sphinxvalreturnc                 C   s2   |   } | dv r
dS | dv rdS d|  }t|)z
    Convert a string representation of truth to True or False.

    True values are 'y', 'yes', 't', 'true', 'on', and '1'; false values
    are 'n', 'no', 'f', 'false', 'off', and '0'.  Raises ValueError if
    'val' is anything else.
    )yyesttrueon1T)nnoffalseoff0Fzinvalid truth value )lower
ValueError)r   msg r   M/mnt/skqttb/ctump_chatbot/chatbot/lib/python3.10/site-packages/banks/utils.py	strtobool   s   
r   BANKS[]   prefixsuffixtoken_lengthc                 C   s   |  t |d  | S )N   )secrets	token_hex)r   r   r   r   r   r   generate_canary_word   s   r#   python_typec                 C   sZ   | t u rdS | tu rdS | tu rdS | tu rdS | tu rdS | tu r$dS d|  }t|)zAGiven a Python type, returns the jsonschema string describing it.stringintegernumberbooleanarrayobjectzUnsupported type: )strintfloatboollistdictr   )r$   r   r   r   r   python_type_to_jsonschema   s   
r1   	docstringc           	      C   sr   g }t | }tttfD ]}||}|D ]}|jdkr|j} nq|r$ nqi }|D ]}| }|||d< q)|S )N
parametersname)r   r   r   r   kindvalueas_dictpop)	r2   
param_docsdsparsersectionssectionretdd_dictr   r   r   parse_params_from_docstring0   s"   
rA   )r   r   r   )r!   griffer   r   r   r   r+   r.   r   r,   r#   typer1   r0   rA   r   r   r   r   <module>   s    &