U
    dD                     @   s   d dl Z d dlZd dlZd dlmZ zddlmZ W n ek
rL   dZY nX ddddddddde je jdZ	G dd	 d	e j
Zd
d ZdS )    N)Union   versionz0.0.0   )z--indentz-fz--from-filez-Lz--argz	--argjsonz--slurpfilez	--argfilez	--rawfilez--argsz
--jsonargsc                   @   s   e Zd Zdd ZdS )Parserc                 C   sp   t j|  }tdd| jg|dd   dg  tj	
  ztddg W n tk
rj   Y nX d S )N
z/usage: {} [options] <jq filter> [input file...]r    jqz--help)argparseArgumentParserformat_help
splitlinesprintjoinformatprogsysstdoutflush
subprocess
check_call	Exception)selfZyq_help r   h/mounts/lovelace/software/anaconda3/envs/qiime2-amplicon-2023.9/lib/python3.8/site-packages/yq/parser.py
print_help   s    *
zParser.print_helpN)__name__
__module____qualname__r   r   r   r   r   r      s   r   c              	   C   s  t jgd \}}}}}t jgd \}}t jgd \}	}
}}}t j}| dkrld}d}d}d}d}d	}d
}d}n<| dkrd}d}	d}
d}d}d}n| dkrd}d}ntd|d| d|}t| |t jd}tjdkr|jdd t	f |}|j
ddt jd |j
ddd d!d"d#|d$ |j
d%d&d'd!d"d(|d$ |j
d)d*d+d,gd+|d- |j
d.d/t|d0 |j
d1d2d3|d4 |j
d5d3|d4 |j
d6d3|d4 |j
d7d8d9t jd: |j
d;td<t jd= |j
d>d?d!d"d@|	d$ |j
dAtdB|
dCdD |j
dEd3|d4 |j
dF|dG |j
dHdI|dJdK |j
dLdMd!d"dN|d$ |j
dOdPd3dQd4 |j
dRdSdTjtdUdV tD ]$}t| }|j
|||dIt jdW qP|j
dXdYdZ |j
d[d\t  d]g d^ |S )_N   r   yqYAMLz3Transcode jq JSON output back into YAML and emit ita  Transcode jq JSON output back into YAML and emit it. Preserve YAML tags and styles by representing them as extra items in their enclosing mappings and sequences while in JSON. This option is incompatible with jq filters that do not expect these extra items.z3When using --yaml-output, specify string wrap widthzYWhen using --yaml-output, indent block style lists (sequences) with 0 spaces instead of 2zWhen using --yaml-output, specify output grammar (the default is 1.1 and will be changed to 1.2 in a future version). Setting this to 1.2 will cause strings like 'on' and 'no' to be emitted unquoted.zEWhen using --yaml-output, always emit explicit document start ("---")zCWhen using --yaml-output, always emit explicit document end ("...")xqZXMLz2Transcode jq JSON output back into XML and emit itzWSpecify depth of items to emit (default 0; use a positive integer to stream large docs)zKPreserve XML Document Type Definition (disables streaming of multiple docs)zNWhen transcoding back to XML, envelope the output in an element with this namezXEmit a list for elements with this name even if they occur only once (option can repeat)tomlqZTOMLz3Transcode jq JSON output back into TOML and emit itzUnknown program name)r   descriptionformatter_class)   r    F)allow_abbrevz--output-formatjson)defaulthelpz--yaml-outputz--yml-outputz-youtput_formatstore_constyaml)destactionconstr+   z--yaml-roundtripz--yml-roundtripz-Yannotated_yamlz--yaml-output-grammar-versionz--yml-out-verz1.1z1.2)choicesr*   r+   z--widthz-w)typer+   z--indentless-listsz--indentless
store_true)r0   r+   z--explicit-startz--explicit-endz--no-expand-aliasesstore_falseexpand_aliases)r0   r/   r+   z--max-expansion-factori   )r4   r*   r+   z--xml-outputz-xxmlz--xml-item-depthr   Z123)r4   r*   r+   metavarz	--xml-dtdz
--xml-root)r+   z--xml-force-listappendZELT)r0   r+   r9   z--toml-outputz-ttomlz
--in-placez-iz-Edit files in place (no backup - use caution)z	--versionr   z%(prog)s {version}r   )r0   r   )nargsr/   r0   r+   	jq_filter?)r<   input_streams*files)r<   r4   r9   r*   )r   SUPPRESSr   replacedictRawTextHelpFormatterr   version_infoupdater   add_argumentintr   __version__jq_arg_specFileType)program_namer%   Zyaml_output_helpZyaml_roundtrip_helpZ
width_helpZindentless_helpZgrammar_helpZexplicit_start_helpZexplicit_end_helpZxml_output_helpZxml_item_depth_helpZxml_dtd_helpZxml_root_helpZxml_force_list_helpZtoml_output_helpZcurrent_languageZparser_argsparserargr<   r   r   r   
get_parser&   s    

		              rP   )r   r   r   typingr   r   rJ   ImportError	REMAINDERrK   r   r   rP   r   r   r   r   <module>   s*   
