mò õÔ5;c@sÍdZdkZdkZdkZdklZdfd„ƒYZdfd„ƒYZdeefd„ƒYZ ee ƒd fd „ƒYZ e ƒZ d fd „ƒYZ d e efd„ƒYZ ee ƒdS(s Namespace objects. Copyright (c) 1998-2000, Marc-Andre Lemburg; mailto:mal@lemburg.com Copyright (c) 2000-2001, eGenix.com Software GmbH; mailto:info@egenix.com See the documentation for further information on copyrights, or contact the author. All Rights Reserved. N(sfreezet NamespacecBs:tZdZd„Zfded„Zeied„Z fei ei ei ei feied„Zd„Zd„Zd„Zed „Zed „Zd „Zd „Zd „Zd„Zd„Zd„ZeZed„ZeZfed„Z ddd„Z!eZ"e#Z$e%i&e'd„Z(e%i&e'd„Z)RS(s= Base class for Namespaces. Instances of this namespace can store arbitrary attributes, which are stored in the instances dictionary. They are then available via attribute lookup, e.g. ns.attr, and index lookup, e.g. ns['attr']. The Namespaces support acquisition. To link the object to another object, set self.baseobj to the other object. Attributes not found in the Namespace instance are then looked up in the other object as well. NOTE: All methods and internal attributes must start with an underscore. Namespace attributes must *not* start with an underscore to prevent naming collisions with internal variables and methods. Note that names with leading underscore cannot be acquired. cKs|o|ii|ƒndS(sV Initializes the namespace with the attributes given as keywords. N(tkwstselft__dict__tupdate(RR((t</data/zmath/lib/python2.4/site-packages/mx/Misc/Namespace.pyt__init__"sicCsh}x!|D]}|||ƒ||||ƒ|jo|ii|ƒn|ii|iƒdS(sÔ Updates the namespace dictionary with the new entries taken from the object other_namespace. other_namespace can either be a dictionary or another Namespace object. N(ttypetother_namespacetDictTypeRRR(RRRR((Rt_updateJs c Csª||ƒ|jo|iƒ}n |iƒ}|i}|i}xV|D]N\} } || ƒo5| |jp|| ƒ|joqHn| || t,( RRR-tsortt __class__t __module__t__name__tjointid(RRDRER-((Rt__repr__0s cCsç|iiƒ}|iƒd|ii|ii||ƒfg}x“|D]‹\}}yt |ƒ}Wn"t ttfj o d}n1Xt|ƒdjo|d dt|ƒ}n|id|d|fƒqHWti|dƒS(Ns%s.%s at 0x%x:s*** repr(value) failed ***iÈs!... (truncated, full length = %i)s %-10s %st:s (RRR R@RARBRCREtlRRtreprtst ValueErrort TypeErrorR#R*tappendtstringRD(RRDRER RHRJRR((Rt__str__<s (  (*RCRBt__doc__RR RttypesRRRtBuiltinMethodTypet ClassTypet MethodTypet FunctionTypeRRRR!R&R'R)R+R,RR.R0R2t_hasattrRR5t_getattrR6R9R>tbaseobjtacquiret __getattr__RNRDRERFRO(((RR s2   0#        ! t DefaultMixincBstZdZdZd„ZRS(sR Mixin that provides default attribute values. The namespace returns _default for all undefined attributes (except the ones that start with an underscore, see __getattr__). The _default is defined as '' for this class. The acquisition feature is *not* available for instances of this class. tcCs%|ddjo t|‚n|iS(s† Return self._default for all undefined attributes that don't start with an underscore. For attributes that start with an underscore, raise an AttributeError. This is especially important if the objects are to be pickled, since the pickle mechanism queries a few methods on the objects, which it then calls. it_N(R"R#Rt_default(RR"((RRZ`s  (RCRBRPR^RZ(((RR[Rs tNamespaceWithDefaultcBstZdZRS(s[ Namespace class with an infinite number of attributes. The namespace returns _default for all undefined attributes (except the ones that start with an underscore, see __getattr__). The _default is defined as '' for this class. The acquisition feature is *not* available for instances of this class. (RCRBRP(((RR_qs t _NotFoundcBstZRS(N(RCRB(((RR`‚stFormatNamespaceMixincBstZdZed„ZRS(se This mixin makes a Namespace class conform to the Python format string mechanism. The following format specifiers are supported: %(attribute)s - gives the string representation of .attribute %()s - evaluates the in the Namespace dictionary and returns the string representation All standard Python string formatting output types are supported, provided that the attribute or evaluation result can be converted to these types. cCs7t|||ƒ}||j o|Snt||iƒS(N(R RtitemR`R tevalR(RRbR`R ((RR&™s (RCRBRPR`R&(((RRa†s tFormatNamespacecBstZdZRS(sØ Namespace class which supports the Python format string lookup mechanism. These Namespaces can be used in 'format string' % namespace formatting. The following format specifiers are supported: %(attribute)s - gives the string representation of .attribute %()s - evaluates the in the Namespace dictionary and returns the string representation All standard Python string formatting output types are supported, provided that the attribute or evaluation result can be converted to these types. (RCRBRP(((RRd¤s ( RPRNRQtmx.Tools.NewBuiltinstmxtmx.ToolstfreezeRR[R_R`RaRd( R[R`R_RNRaRRhRfRQRd((Rt?s  ÿG