• File: config_parser.cpython-37.pyc
  • Full Path: /home3/farmfre2/public_html/ALFA_DATA/alfasymlink/root/opt/alt/python37/lib/python3.7/site-packages/lvemanager/__pycache__/config_parser.cpython-37.pyc
  • Date Modified: 06/05/2023 11:46 AM
  • File size: 2.61 KB
  • MIME-type: text/x-bytecode.python
  • Charset: 8 bit
B

Ud@s^ddlmZddlmZddlmZddlmZddlmZddl	m
Z
GdddejZd	S)
)print_function)division)absolute_import)configparser)StringIO)
basestringc@s@eZdZdZddZddZddZdd	Zd
dZdd
Z	dS)SectionlessConfigParserz
    Extends ConfigParser to allow files without sections.

    This is done by wrapping read files and prepending them with a placeholder
    section, which defaults to '__config__'
    cOs8|dd}tjj|f||d|_||p0ddS)Ndefault_section
__config__)popConfigParserRawConfigParser__init___default_sectionset_default_section)selfargskwargsr	rI/opt/alt/python37/lib/python3.7/site-packages/lvemanager/config_parser.pyrsz SectionlessConfigParser.__init__cCs|jS)N)r)rrrrget_default_sectionsz+SectionlessConfigParser.get_default_sectioncCsh||y||j}||jWntjk
r<Yn"Xx|D]\}}||||qDW||_dS)N)add_sectionitemsrremove_sectionrNoSectionErrorset)rsectiondefault_section_itemskeyvaluerrrr"s
z+SectionlessConfigParser.set_default_sectionc
Csjt|tr|g}g}xP|D]H}y"t|}||WdQRXWntk
rVwYqX||qW|S)N)
isinstanceropenreadfpIOErrorappend)r	filenamesread_okfilenamefprrrread1s


zSectionlessConfigParser.readcOslt}y|j|_Wntk
r&YnX|d|jd|||ddtjj	||f||S)N[z]
r)
rnameAttributeErrorwriterr)seekrr
r")rr(rrstreamrrrr"AszSectionlessConfigParser.readfpcCsyJ||j}||jx"|D]\}}|d||q W|dWntjk
r`YnXtj||||jx |D]\}}|	|j||qWdS)Nz{0}={1}

)
rrrr-formatrrr
rr)rr(rrrrrrr-PszSectionlessConfigParser.writeN)
__name__
__module____qualname____doc__rrrr)r"r-rrrrrsrN)
__future__rrrfuture.movesrriorZ
past.builtinsrr
rrrrr<module>	s