Current File : //lib/python2.7/site-packages/iniparse/ini.pyc |
�
�/�Sc @ s@ d Z d d l Z d d l m Z m Z m Z d d l Z d e f d � � YZ d e f d � � YZ d e f d � � YZ
d
e d � Z d e f d
� � YZ
d e f d � � YZ d e f d � � YZ d e f d � � YZ d d � Z d e j f d � � YZ d � Z d � Z d � Z d e j f d � � YZ d S( s� Access and/or modify INI files
* Compatiable with ConfigParser
* Preserves order of sections & options
* Preserves comments/blank lines/etc
* More conveninet access to data
Example:
>>> from StringIO import StringIO
>>> sio = StringIO('''# configure foo-application
... [foo]
... bar1 = qualia
... bar2 = 1977
... [foo-ext]
... special = 1''')
>>> cfg = INIConfig(sio)
>>> print cfg.foo.bar1
qualia
>>> print cfg['foo-ext'].special
1
>>> cfg.foo.newopt = 'hi!'
>>> cfg.baz.enabled = 0
>>> print cfg
# configure foo-application
[foo]
bar1 = qualia
bar2 = 1977
newopt = hi!
[foo-ext]
special = 1
<BLANKLINE>
[baz]
enabled = 0
i����N( t DEFAULTSECTt ParsingErrort MissingSectionHeaderErrort LineTypec B s5 e Z d Z d d � Z d � Z d � Z d � Z RS( c C s% | d k r! | j d � | _ n d S( Ns
( t Nonet stript line( t selfR ( ( s0 /usr/lib/python2.7/site-packages/iniparse/ini.pyt __init__4 s c C s$ | j d k r | j S| j � Sd S( N( R R t to_string( R ( ( s0 /usr/lib/python2.7/site-packages/iniparse/ini.pyt __str__: s c C s0 t | | � r d | j d <n | | j | <d S( NR ( t hasattrR t __dict__( R t namet value( ( s0 /usr/lib/python2.7/site-packages/iniparse/ini.pyt __setattr__B s c C s t d � � d S( Ns1 This method must be overridden in derived classes( t Exception( R ( ( s0 /usr/lib/python2.7/site-packages/iniparse/ini.pyR G s N( t __name__t
__module__R R R R
R R ( ( ( s0 /usr/lib/python2.7/site-packages/iniparse/ini.pyR 1 s
t SectionLinec B sJ e Z e j d � Z d d d d d � Z d � Z d � Z e e � Z RS( s7 ^\[(?P<name>[^]]+)\]\s*((?P<csep>;|#)(?P<comment>.*))?$i����c C s>