php IHDR w Q )Ba pHYs sRGB gAMA a IDATxMk\U s&uo,mD )Xw+e?tw.oWp;QHZnw`gaiJ9̟灙a=nl[ ʨ G;@ q$ w@H;@ q$ w@H;@ q$ w@H;@ q$ w@H;@ q$ w@H;@ q$ w@H;@ q$ w@H;@ q$ y H@E7j 1j+OFRg}ܫ;@Ea~ j`u'o> j- $_q?qS XzG'ay
files >> /usr/lib/python2.6/site-packages/iniparse/ |
files >> //usr/lib/python2.6/site-packages/iniparse/config.pyc |
0Ic @ sO d e f d YZ d e f d YZ d e f d YZ d Z d S( t ConfigNamespacec B sh e Z d Z d Z d Z d Z d Z d Z d Z d Z d Z d Z d Z RS( s Abstract class representing the interface of Config objects. A ConfigNamespace is a collection of names mapped to values, where the values may be nested namespaces. Values can be accessed via container notation - obj[key] - or via dotted notation - obj.key. Both these access methods are equivalent. To minimize name conflicts between namespace keys and class members, the number of class members should be minimized, and the names of all class members should start with an underscore. Subclasses must implement the methods for container-like access, and this class will automatically provide dotted access. c C s t | S( N( t NotImplementedError( t selft key( ( s3 /usr/lib/python2.6/site-packages/iniparse/config.pyt __getitem__ s c C s t | | d S( N( R ( R R t value( ( s3 /usr/lib/python2.6/site-packages/iniparse/config.pyt __setitem__ s c C s t | d S( N( R ( R R ( ( s3 /usr/lib/python2.6/site-packages/iniparse/config.pyt __delitem__ s c C s t S( N( R ( R ( ( s3 /usr/lib/python2.6/site-packages/iniparse/config.pyt __iter__ s c C s t | d S( N( R ( R t name( ( s3 /usr/lib/python2.6/site-packages/iniparse/config.pyt _new_namespace s c C s5 y | i | SWn t j o t | | SXd S( N( R t KeyErrort Undefined( R R ( ( s3 /usr/lib/python2.6/site-packages/iniparse/config.pyt __getattr__. s c C sQ y' t i | | t i | | | Wn# t j o | i | | n Xd S( N( t objectt __getattribute__t __setattr__t AttributeErrorR ( R R R ( ( s3 /usr/lib/python2.6/site-packages/iniparse/config.pyR 4 s c C sK y$ t i | | t i | | Wn t j o | i | n Xd S( N( R R t __delattr__R R ( R R ( ( s3 /usr/lib/python2.6/site-packages/iniparse/config.pyR ; s c C s | i S( N( t __dict__( R ( ( s3 /usr/lib/python2.6/site-packages/iniparse/config.pyt __getstate__B s c C s | i i | d S( N( R t update( R t state( ( s3 /usr/lib/python2.6/site-packages/iniparse/config.pyt __setstate__E s ( t __name__t __module__t __doc__R R R R R R R R R R ( ( ( s3 /usr/lib/python2.6/site-packages/iniparse/config.pyR s R c B s e Z d Z d Z d Z RS( s Helper class used to hold undefined names until assignment. This class helps create any undefined subsections when an assignment is made to a nested value. For example, if the statement is "cfg.a.b.c = 42", but "cfg.a.b" does not exist yet. c C s* t i | d | t i | d | d S( NR t namespace( R R ( R R R ( ( s3 /usr/lib/python2.6/site-packages/iniparse/config.pyt __init__P s c C s# | i i | i } | | | <d S( N( R R R ( R R R t obj( ( s3 /usr/lib/python2.6/site-packages/iniparse/config.pyR T s ( R R R R R ( ( ( s3 /usr/lib/python2.6/site-packages/iniparse/config.pyR H s t BasicConfigc B s_ e Z d Z d Z d Z d Z d Z d Z d Z d d Z d Z d Z RS( s Represents a hierarchical collection of named values. Values are added using dotted notation: >>> n = BasicConfig() >>> n.x = 7 >>> n.name.first = 'paramjit' >>> n.name.last = 'oberoi' ...and accessed the same way, or with [...]: >>> n.x 7 >>> n.name.first 'paramjit' >>> n.name.last 'oberoi' >>> n['x'] 7 >>> n['name']['first'] 'paramjit' Iterating over the namespace object returns the keys: >>> l = list(n) >>> l.sort() >>> l ['name', 'x'] Values can be deleted using 'del' and printed using 'print'. >>> n.aaa = 42 >>> del n.x >>> print n aaa = 42 name.first = paramjit name.last = oberoi Nested namepsaces are also namespaces: >>> isinstance(n.name, ConfigNamespace) True >>> print n.name first = paramjit last = oberoi >>> sorted(list(n.name)) ['first', 'last'] Finally, values can be read from a file as follows: >>> from StringIO import StringIO >>> sio = StringIO(''' ... # comment ... ui.height = 100 ... ui.width = 150 ... complexity = medium ... have_python ... data.secret.password = goodness=gracious me ... ''') >>> n = BasicConfig() >>> n._readfp(sio) >>> print n complexity = medium data.secret.password = goodness=gracious me have_python ui.height = 100 ui.width = 150 c C s h | _ d S( N( t _data( R ( ( s3 /usr/lib/python2.6/site-packages/iniparse/config.pyR s c C s | i | S( N( R ( R R ( ( s3 /usr/lib/python2.6/site-packages/iniparse/config.pyR s c C s | | i | <d S( N( R ( R R R ( ( s3 /usr/lib/python2.6/site-packages/iniparse/config.pyR s c C s | i | =d S( N( R ( R R ( ( s3 /usr/lib/python2.6/site-packages/iniparse/config.pyR s c C s t | i S( N( t iterR ( R ( ( s3 /usr/lib/python2.6/site-packages/iniparse/config.pyR s t c C s g } | i i } | i x | D] } | i | } t | t o' | i | i d d | | f q&