Tryag File Manager
Home
-
Turbo Force
Current Path :
/
usr
/
lib
/
python2.4
/
site-packages
/
iniparse
/
Upload File :
New :
File
Dir
//usr/lib/python2.4/site-packages/iniparse/config.pyo
mò ©«Fc @ sL d Z d e f d „ ƒ YZ d e f d „ ƒ YZ d e f d „ ƒ YZ d S( s/ Implements basic mechanisms for managing configuration information * A NAMESPACE is a collection of values and other namepsaces * A VALUE is a basic value, like 3.1415, or 'Hello World!' * A NAME identifies a value or namespace within a namespace The ConfigNamespace class is an abstract class that defines the basic interface implemented by all config namespace objects. Two concrete implementations are included: BasicConfig and INIConfig. Each is described in detail elsewhere. However, here's an example of the capabilities available: Create config namespace and populate it: >>> n = BasicConfig() >>> n.playlist.expand_playlist = True >>> n.ui.display_clock = True >>> n.ui.display_qlength = True >>> n.ui.width = 150 Examine data: >>> print n.playlist.expand_playlist True >>> print n['ui']['width'] 150 >>> print n playlist.expand_playlist = True ui.display_clock = True ui.display_qlength = True ui.width = 150 Delete items: >>> del n.playlist >>> print n ui.display_clock = True ui.display_qlength = True ui.width = 150 Convert it to ini format: >>> from iniparse import ini >>> i = ini.INIConfig() >>> i.import_config(n) >>> print i [ui] display_clock = True display_qlength = True width = 150 t ConfigNamespacec B sY t Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z RS( Nc C s t | ƒ S( N( t NotImplementedErrort key( t selfR ( ( t3 /usr/lib/python2.4/site-packages/iniparse/config.pyt __getitem__@ s c C s t | | ƒ ‚ d S( N( R R t value( R R R ( ( R t __setitem__C s c C s t | ƒ ‚ d S( N( R R ( R R ( ( R t __delitem__F s c C s t ƒ S( N( R ( R ( ( R t __iter__I s c C s t | ƒ ‚ d S( N( R t name( R R ( ( R t new_namespaceL s c C s8 y | i | ƒ SWn t j o t | | ƒ Sn Xd S( N( R R R t KeyErrort Undefined( R R ( ( R t __getattr__O s c C sU y+ t i | | ƒ t i | | | ƒ d SWn# t j o | i | | ƒ n Xd S( N( t objectt __getattribute__R R t __setattr__R t AttributeErrorR ( R R R ( ( R R U s c C sK y$ t i | | ƒ t i | | ƒ Wn t j o | i | ƒ n Xd S( N( R R R R t __delattr__R R ( R R ( ( R R ] s c C s x– | D]Ž } | | } t | t ƒ od y. | | } t | t ƒ p t d ƒ ‚ n Wn"