B
    ÔùÓ`é  ã            *   @   s  d Z ddlmZ ddlmZ ddlmZ ddlmZ y
ej	 W n, e
k
rj Z zed	ƒe‚W ddZ[X Y nX d
ddgZdddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6g*Zee Zd7d8„ Zd9d:„ Zd;d<„ ZG d=d>„ d>ejƒZdS )?aG  YAML backend by ruamel.yaml:

- Format to support: YAML, http://yaml.org
- Requirement: ruamel.yaml, https://bitbucket.org/ruamel/yaml
- Development Status :: 4 - Beta
- Limitations:

  - Multi-documents YAML stream load and dump are not supported.

- Special options:

  - All keyword options of yaml.safe_load, yaml.load, yaml.safe_dump and
    yaml.dump should work.

  - Use 'ac_safe' boolean keyword option if you prefer to call yaml.safe_load
    and yaml.safe_dump instead of yaml.load and yaml.dump. Please note that
    this option conflicts with 'ac_dict' option and these options cannot be
    used at the same time.

  - Also, you can give keyword options for ruamel.yaml.YAML.__init__ such like
    typ and pure, and can give some members of ruamel.yaml.YAML instance to
    control the behaviors such like default_flow_style and allow_duplicate_keys
    as keyword options to load and dump functions.

  - See also: https://yaml.readthedocs.io

Changelog:

.. versionchanged:: 0.9.8

   - Split from the common yaml backend and start to support ruamel.yaml
     specific features.
é    Né   )Úfilter_optionsé   )Úbaseé   )Úcommonz"ruamel.yaml may be too old to use!ÚtypZpureZplug_insZallow_duplicate_keysZallow_unicodeZblock_seq_indentÚ	canonicalZcomposerÚconstructorZdefault_flow_styleZdefault_styleÚdumpZdump_allZemitterÚencodingZexplicit_endZexplicit_startZget_constructor_parserZ"get_serializer_representer_emitterÚindentZ
line_breakÚloadZload_allÚmapZ
map_indentZofficial_plug_insZ
old_indentÚparserZprefix_colonZpreserve_quotesÚreaderZregister_classZrepresenterÚresolverÚscannerÚseqZsequence_dash_offsetZsequence_indentÚ
serializerÚstreamÚtagsZ0top_level_block_style_scalar_no_indent_error_1_1Ztop_level_colon_alignÚversionÚwidthc             O   sl   t  d|¡}d|krd|d< tt|ƒ}tt|ƒ}tjf |Ž}x | ¡ D ]\}}t|||ƒ qFW t	|| ƒ|Ž S )a  
    :param fname:
        "load" or "dump", not checked but it should be OK.
        see also :func:`yml_load` and :func:`yml_dump`
    :param args: [stream] for load or [cnf, stream] for dump
    :param options: keyword args may contain "ac_safe" to load/dump safely
    Zac_dictZac_safeÚsafer   )
r   Zfilter_from_optionsr   Ú_YAML_INIT_KWARGSÚ_YAML_INSTANCE_MEMBERSÚryamlÚYAMLÚitemsÚsetattrÚgetattr)ÚfnameÚargsÚoptionsZioptsZooptsZymlÚattrÚval© r'   úF/tmp/pip-unpacked-wheel-bpftjxoo/anyconfig/backend/yaml/ruamel_yaml.pyÚyml_fncF   s    

r)   c             K   s    t d| f|Ž}|dkr|ƒ S |S )z@.. seealso:: :func:`anyconfig.backend.yaml.pyyaml.yml_load`
    r   N)r)   )r   Ú	containerr$   Úretr'   r'   r(   Úyml_load]   s    r,   c             K   s   t d| |f|ŽS )z@.. seealso:: :func:`anyconfig.backend.yaml.pyyaml.yml_dump`
    r   )r)   )Údatar   r$   r'   r'   r(   Úyml_dumpg   s    
r.   c               @   s0   e Zd ZdZdZeZeZe 	e
¡Ze 	e¡ZdS )ÚParserzParser for YAML files.
    zruamel.yamlN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Z_cidÚ
_YAML_OPTSZ
_load_optsZ
_dump_optsr   Z	to_methodr,   Zload_from_streamr.   Zdump_to_streamr'   r'   r'   r(   r/   t   s   
r/   )r3   Zruamel.yamlZyamlr   Úutilsr   Ú r   r   r   ÚAttributeErrorÚexcÚImportErrorr   r   r4   r)   r,   r.   r/   r'   r'   r'   r(   Ú<module>%   s:   



