
    @|ht                    V    d Z ddlmZ ddlZddlZddlmZmZ d	d
dZddZ	h dZ
ddZy)zYAML utilities    )annotationsN)dedenttrim_docstringc                ^    |xs i }|j                  dd       t        j                  | fi |S )z Serializes a dictionary to YAML.	sort_keysF)
setdefaultyamldump)dicyaml_dump_kwargss     Q/var/www/html/test/engine/venv/lib/python3.12/site-packages/apispec/yaml_utils.pydict_to_yamlr      s4    '-2 U399S-,--    c                   t        |       j                  d      }t        |      D ]*  \  }}|j                         }|j	                  d      s(|} n i S dj                  ||d       }t        |      }t        j                  |      xs i S )zLoads YAML from docstring.
z---N)	r   split	enumeratestrip
startswithjoinr   r	   	safe_load)	docstringsplit_linesindexlinecut_fromyaml_strings         r   load_yaml_from_docstringr      s     +11$7K !- tzz|??5!H	 	))K	23K%K>>+&,",r   >   getputheadpostpatchdeleteoptionsc                    t        |       }|j                         D ci c]!  \  }}|t        v s|j                  d      r||# c}}S c c}}w )zMReturn a dictionary of OpenAPI operations parsed from a
    a docstring.
    zx-)r   items	PATH_KEYSr   )r   doc_datakeyvals       r   load_operations_from_docstringr,   *   sR     (	2H !(C)s~~d3 	S  s   &A	)N)r   dictr   ztyping.Any | Nonereturnstr)r   r/   r.   r-   )__doc__
__future__r   typingr	   apispec.utilsr   r   r   r   r(   r,    r   r   <module>r5      s+     "   0.-$ I		r   