KGRKJGETMRETU895U-589TY5MIGM5JGB5SDFESFREWTGR54TY
Server : Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8e-fips-rhel5 DAV/2 PHP/5.2.17
System : Linux localhost 2.6.18-419.el5 #1 SMP Fri Feb 24 22:47:42 UTC 2017 x86_64
User : nobody ( 99)
PHP Version : 5.2.17
Disable Function : NONE
Directory :  /usr/lib64/python2.4/site-packages/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //usr/lib64/python2.4/site-packages/Alchemist.pyc
m
Ec@sdkTdkZdkZdkZdZdfdYZdefdYZdefdYZd	efd
YZdefdYZ	d
efdYZ
defdYZdefdYZdfdYZ
dfdYZdZdZdfdYZdkZdklZlZhde<ZdZdZdZd Zd!Zd"Zd#fd$YZdS(%(t*NcCs|djodSnt|}|tijot|Sn|tijot|Sn|ti	jot
|Sn|tijot|Sn|ti
jot|Sn|tijot|Sn|tijot|SndS(N(t_dattNonetdata_getTypettypetDatat
ADM_TYPE_LISTtListDatat
ADM_TYPE_COPYtCopyDatatADM_TYPE_INTtIntDatatADM_TYPE_FLOATt	FloatDatat
ADM_TYPE_BOOLtBoolDatatADM_TYPE_STRINGt
StringDatatADM_TYPE_BASE64t
Base64Data(RR((t//usr/lib64/python2.4/site-packages/Alchemist.pyt_mkDatas$
RcBstZdZdZdZdZdZdZdZdZ	d	Z
d
ZdZdZ
d
ZdZdZdZdZdZdZdZdZdZRS(NiiiiiiiicCs
||_dS(N(tthingtselfR(RR((Rt__init__9scCstt|iS(N(Rtdata_getContainerRR(R((RtgetContainer<scCstdt|iS(Ntctx(tContexttdata_getContextRR(R((Rt
getContext?scCs
t|iS(N(RRR(R((RtgetTypeBscCs
t|iS(N(tdata_isAliveRR(R((RtisAliveEscCst|idS(N(tdata_unlinkRR(R((RtunlinkHscCs
t|iS(N(tdata_getNameRR(R((RtgetNameKscCst|i|dS(N(tdata_setNameRRtname(RR'((RtsetNameNscCs
t|iS(N(tdata_getSourceRR(R((Rt	getSourceQscCst|i|dS(N(tdata_setSourceRRtsrc(RR,((Rt	setSourceTscCs
t|iS(N(tdata_isProtectedRR(R((RtisProtectedWscCst|i|dS(N(tdata_setProtectedRRtprot(RR1((RtsetProtectedZscCs
t|iS(N(tdata_getPosRR(R((RtgetPos]scCst|i|iS(N(tdata_isIdenticalRRtother(RR6((RtisIdentical`s(t__name__t
__module__tADM_TYPE_UNKNOWNRRR
RRRRRRRRR!R#R%R(R*R-R/R2R4R7(((RR.s,													RcBs}tZdZdZdZdZdZdZdZdZ	d	Z
d
ZdZdZ
d
ZRS(NcCs
t|iS(N(tlist_isAnonymousRR(R((RtisAnonymousdscCst|i|dS(N(tlist_setAnonymousRRtanon(RR>((RtsetAnonymousgscCs
t|iS(N(t
list_isAtomicRR(R((RtisAtomicjscCst|i|dS(N(tlist_setAtomicRRtatomic(RRC((Rt	setAtomicmscCs
t|iS(N(tlist_isPrependRR(R((Rt	isPrependpscCst|i|dS(N(tlist_setPrependRRtprep(RRH((Rt
setPrependsscCs
t|iS(N(tlist_getNumChildrenRR(R((RtgetNumChildrenvscCstt|i|S(N(Rtlist_getChildByIndexRRtindex(RRM((RtgetChildByIndexyscCstt|i|S(N(Rtlist_getChildByNameRRR'(RR'((RtgetChildByName}scCst|i|S(N(tlist_hasChildNamedRRR'(RR'((Rt
hasChildNamedscCstt|i||S(N(Rt
list_addChildRRRR'(RRR'((RtaddChildscCst|i|i|dS(N(tlist_moveChildRRtdatumRM(RRVRM((Rt	moveChildscCstt|i|iS(N(Rt
list_copyDataRRRV(RRV((RtcopyDatas(R8R9R<R?RARDRFRIRKRNRPRRRTRWRY(((RRcs												R	cBstZdZdZRS(NcCs
t|iS(N(t
copy_getValueRR(R((RtgetValuescCst|i|dS(N(t
copy_setValueRRtv(RR]((RtsetValues(R8R9R[R^(((RR	s	RcBstZdZdZRS(NcCs
t|iS(N(tint_getValueRR(R((RR[scCst|i|dS(N(tint_setValueRRR](RR]((RR^s(R8R9R[R^(((RRs	R
cBstZdZdZRS(NcCs
t|iS(N(tfloat_getValueRR(R((RR[scCst|i|dS(N(tfloat_setValueRRR](RR]((RR^s(R8R9R[R^(((RR
s	RcBstZdZdZRS(NcCs
t|iS(N(t
bool_getValueRR(R((RR[scCst|i|dS(N(t
bool_setValueRRR](RR]((RR^s(R8R9R[R^(((RRs	RcBstZdZdZRS(NcCs
t|iS(N(tstring_getValueRR(R((RR[scCst|i|dS(N(tstring_setValueRRR](RR]((RR^s(R8R9R[R^(((RRs	RcBstZdZdZRS(NcCs
t|iS(N(tbase64_getValueRR(R((RR[scCst|i|dS(N(tbase64_setValueRRR](RR]((RR^s(R8R9R[R^(((RRs	tIdentitycBsYtZdZdZdZdZdZdZdZdZ	d	Z
RS(
NcCs
||_dS(N(tidRt_id(RRj((RRscCs.t|i}|djodSnt|S(N(tidentity_getParentARRktA_idRRi(RRm((Rt
getParentAs
cCs.t|i}|djodSnt|S(N(tidentity_getParentBRRktB_idRRi(RRp((Rt
getParentBs
cCs
t|iS(N(tidentity_getNameRRk(R((RR%scCst|i|dS(N(tidentity_setNameRRkR'(RR'((RR(scCs
t|iS(N(tidentity_getSerialRRk(R((Rt	getSerialscCst|i|dS(N(tidentity_setSerialRRktserial(RRw((Rt	setSerialscCs
t|iS(N(tidentity_isAliveRRk(R((RR!scCst|i|iS(N(tidentity_isIdenticalRRkR6(RR6((RR7s(R8R9RRnRqR%R(RuRxR!R7(((RRis								RcBstZdddddZdZdZdZdZdZdZ	dZ
d	Zd
ZdZ
dZd
ZRS(NcCs|djo||_dSn|djot||_dSn|djo'|djot|||_dSnt	ddS(NsIllegal constructor parameters(
RRRt_ctxtxmltcontext_fromXMLR'Rwtcontext_createtContextError(RR'RwRR|((RRs
	
cCstdt|iS(NR(Rtcontext_copyRR{(R((RtcopyscCst|idS(N(tcontext_flattenRR{(R((RtflattenscCs
t|iS(N(t
context_toXMLRR{(R((RttoXMLscCst|i|S(N(tcontext_getDeleteRR{RM(RRM((Rt	getDeletescCst|i|dS(N(tcontext_setDeleteRR{tpath(RR((Rt	setDeletescCst|i|dS(N(tcontext_clearDeleteByIndexRR{RM(RRM((RtclearDeleteByIndexscCst|i|dS(N(tcontext_clearDeleteByStringRR{R(RR((RtclearDeleteByStringscCs
t|iS(N(tcontext_getNumDeletesRR{(R((Rt
getNumDeletesscCstt|iS(N(Ritcontext_getIdentityRootRR{(R((RtgetIdentityRootscCstt|iS(N(Rtcontext_getDataRootRR{(R((RtgetDataRootscCstt|i|S(N(Rtcontext_getDataByPathRR{R(RR((Rt
getDataByPath	scCst|i|iS(N(tcontext_isIdenticalRR{R6(RR6((RR7s(R8R9RRRRRRRRRRRRRR7(((RRs											cCs"tdt|||i|iS(NR(Rt
context_mergeR'RwtctxAR{tctxB(R'RwRR((RtmergescCs|djo
tdn|itjo
tdn|ip
tdn|io
tdny|id}Wnt	j
o}tdnX|itjo
tdndS(	s
	validataBoxCfg: throws exceptions on invalid box_cfgs
	@box_cfg: A box_cfg @AdmList, to be checked for conformance.

	This function validates a box_cfg element, and throws a @BlackBoxError
	if it is an invalid element.

	box_cfg elements are defined as:
	Living, non-anonymous AdmList elements, containing a AdmString child
	named 'box_type', which specifies which type of BlackBox this box_cfg
	configures.

	Why, you may ask, do box_cfg elements not just have a cache optional
	child, that is itself a box_cfg element? Because then caches could
	have caches, and that way lies madness.

	throws: @ValueError if anything is wrong with the box_cfg
	s'None' passed as box_cfgs!box_cfg is not an AdmList elementsDead node passed as box_cfgs(box_cfg is an annonymous AdmList elementtbox_types$box_cfg contains no 'box_type' childs4box_cfg's box_type child is not an AdmString elementN(tbox_cfgRt
ValueErrort	__class__RR!R<RPRtKeyErrorteR(RRR((RtvalidateBoxCfgs






tBlackBoxcBshtZdZdZdZdZdZdZdZdZ	dZ
d	Zd
ZRS(sn
	The BlackBox base class provides a generic class for Alchemist Data
	Library BlackBox modules to inherit. 
	cCsJ|ii|_d|_d|_d|_d|_d|_	t
|dS(s
		__init__: Initialize a BlackBox
		@self: the class instance
		@box_cfg: a box_cfg conformant AdmList element

		This function is the initializer for BlackBoxes, it, and
		functions which overload it, must not keep references to,
		or modify in any way, the box_cfg it is passed.

		It is also a good idea if modules call validateBoxCfg on their
		box_cfgs before touching them, so that we get uniform error
		raising on broken data.
		iN(RRR9tmetstatust_errNoRt_errStrtreadabletwritableRR(RR((RR;s
					cCs|iS(s[
		getStatus: returns a BlackBox dependent status value.
		@self: this BlackBox instance
		N(RR(R((Rt	getStatusRscCs|iS(sW
		errNo: returns a BlackBox dependent error number.
		@self: this BlackBox instance
		N(RR(R((RterrNoYscCs
t|iS(sZ
		strError: returns a BlackBox dependent error string.
		@self: this BlackBox instance
		N(tstrRR(R((RtstrError`scCs|iS(sa
		isReadable: if a read were attempted now, would it succede?
		@self: this BlackBox instance
		N(RR(R((Rt
isReadablegscCs|iS(sb
		isWritable: if a write were attempted now, would it succede?
		@self: this BlackBox instance
		N(RR(R((Rt
isWritablenscCsdS(sd
		read: read the contents of the BlackBox
		@self: this BlackBox instance

		This function must be callable multiple times, and if it cannot
		succede on a given call, it should return None. It should not
		cache returns information in the normal sense, unless the data
		is not dynamic. And it must not keep a reference to the
		AdmContext it returns.
		N(R(R((Rtreadus
cCsdS(sZ
		version: returns the version of the context held in a black box.
		@self: this BlackBox instance

		This function should be overridden by all subclassess so that it
		returns a version number that is identical to the serial number
		of the context that /would/ have been returned had a read() call
		benn made instead of the version() call.
		iN((R((Rtversions	cCsdS(s
		readVersion: reads a specific version of a BlackBox
		@self: this BlackBox instance

		This is a per-BlackBox function, and implementors should not
		provide it unless they can guarantee that the version read will
		be a perfect copy of the last context returned by 'read' for the
		version called, or None.

		A context's version is the serial number of the root node of
		it's identity tree.
		N(R(RR((RtreadVersionscCsdS(s
		write: write the contents of the BlackBox
		@self: this BlackBox instance

		This function must be callable multiple times. It writes a
		Context out to where ever the box does it, if it does anything.
		It must return 0 on failure, and a non-zero, positive integer
		on success.
		iN((Rtcontext((Rtwrites	(
R8R9t__doc__RRRRRRRRRR(((RR6s							
		(sReadContextFromFilesWriteContextToFiletFileBlackBoxcCst||idi}ti|ot|i|Snyti	|}WndSnX|ddjotyUti||d|d|d}|ddjo|din|t|<WndSnX|i|SndS(s
	getBox: automagically finds and loads an arbitrary BlackBox
	@box_cfg: a box_cfg conformant AdmList element

	This function takes a box_cfg conformant AdmList element, extracts
	its box_type child, reads the box type specified in it, and loads
	and configures the appropriate box, if the neccesary module can be
	found.

	Modules providing BlackBoxes must define a function getBox() which
	takes a box_cfg and returns None, or a configured BlackBox.

	returns: a configured BlackBox, or None, if no BlackBox can be found
	RiiiN(RRRPR[Rt
ImportedBoxesthas_keytgetBoxtimptfind_moduletbox_mod_infoRtload_moduletbox_modtclose(RRRR((RRs*
	
cCs|djo
tdn|itjo
tdn|ip
tdn|io
tdny|id}t	|Wnt
j
o}tdnXy|id}t	|Wnt
j
o	}nXdS(	s
	validateBoxEntry: throws exceptions on invalid box_entrys
	@box_entry: A box_entry conformant @AdmList element, to be checked

	box_entry elements are defined as:
	Living, non-anonymous AdmList elements, containing a box_cfg child
	named 'box', and an optional box_cfg child named 'cache'. If cache
	exists, it must be a box_cfg element

	throws: @BlackBoxError if anything is wrong with the box_cfg
	s'None' passed as box_entrys#box_entry is not an AdmList elementsDead node passed as box_entrys*box_entry is an annonymous AdmList elementtboxs!box_entry contains no 'box' childtcacheN(
t	box_entryRRRRR!R<RPRRRRR(RRRR((RtvalidateBoxEntrys(






cCs|d
jo
tdn|itjo
tdn|ip
tdn|io
tdny|id}|i	}|djo
tdnx_t|D]Q}|i
|}t|y|idWqtj
o}td	qXqWWntj
o}td
nXyc|id}|i	}|djo
tdnx't|D]}t|i
|qlWWntj
o	}nXyt|idWntj
o	}nXd
S(s
	validateNamespaceCfg: throws exceptions on invalid namespace_cfgs
	@namespace_cfg: a namespace_cfg conformant @AdmList, to be checked.

	namespace_cfg elements are defined as:
	Living, non-anonymous AdmList elements, containing a non-anonymous
	AdmList child named "input_set", an optional non-anonymous AdmList
	child named "output_set", and an optional box_cfg child named "cache"

	"input_set" (and "output_set", if it exists), must be non-anonymous
	AdmList elements containing only box_entrys, and must be non-empty.

	Note that this is not an exclusive set, and config tools are free to
	add whatever additional children they want. However, the child
	"_namespace_config_" is reserved for future expansion.
	s'None' passed as namespace_cfgs'namespace_cfg is not an AdmList elements!Dead node passed as namespace_cfgs-namespace_cfg is an anonymous AdmList elementt	input_setis$namespace_cfg has an empty input_setRs-input set box_entry contains no 'cache' childs#namespace_cfg contains no input_sett
output_sets%namespace_cfg has an empty output_setN(t
namespace_cfgRRRRR!R<RPRRKtktxrangetiRNRRRRRR(RRRRRRR((RtvalidateNamespaceCfgsN













cCs|djo
tdn|itjo
tdn|i}xJt|iD]6}|i
|}|idjot
|qVqVWdS(sV
	validateMetaCtx: throws exceptions on invalid meta_contexts
	@meta_context: a meta_context conformant @AdmContext, to be checked.

	meta_context elements are defined as:
	AdmContexts, whose data tree root contains only valid namespace_cfg
	elements, or the reserved child "_switchboard_config_", which needs
	not be a valid namespace_cfg.
	s'None' passed as meta_contexts)meta_context is not an AdmContext elementt_switchbord_config_N(tmeta_contextRRRRRtrootRRKRRNtchildR%R(RRRR((RtvalidateMetaCtxEs	


cCst|t|id}|djodSn|i}yt|id}Wnt	j
o}d}nX|djo.|djo|i|q|i}n|S(s
	readBox: reads an arbitrary @BlackBox, with caching
	@box_entry: a box_entry conformant @AdmList element

	This function takes a box_entry element, and attempts to @getBox() it.
	If the @getBox() fails, it returns None. This allows configurations to
	fail silently over non-existant components, and is a general win. If
	it succedes, it attempts to read the box. If the read succedes, it writes
	to the cache box, if it is defined and @getBox() can find it. If the read
	fails, it reads from the cache box, if it is defined and @getBox can find
	it. Returns whatever Context was read, or None, on failure.

	returns: a Context, or None on failure
	RRN(RRRRPRRRRRRRR(RRRRR((RtreadBox[s



cCsAt|t|id}|djodSn|i|S(s|
	writeBox: writes to an arbitrary @BlackBox
	@box_entry: a box_entry conformant @AdmList element
	@context: an @AdmContext

	This function takes a box_entry element, and attempts to @getBox() it.
	If the @getBox() fails, it returns 0. This allows configurations to
	fail silently over non-existant components, and is a general win. If
	it succedes, it attempts to write the box, and returns the result of
	the write. The write will always return 0 on failure, or a positive
	non-zero integer on success.

	Specifics of which integer, and what it means, are box dependent.

	returns: 0 on failure, positive non-zero integer on success
	RiN(RRRRPRRRR(RRR((RtwriteBoxs

tSwitchboardcBsntZdZeedZedZedZeedZedZeedZ	eedZ
RS(ss
	The Switchboard class provides a convienient collection of merge
	and cache logic, which interoperating with BlackBox modules and
	Alchemist Data Model elements forms the Alchemist Data Library.

	Switchboard instances are stateless, and can be reconfigured on
	the fly by altering their meta_context. However, since this is
	not the normal behaviour, and validation is very expensive, we
	only call validateMetaCtx() at init time. Modules altering the
	meta context outside that wish to validate more often can set
	validate = 1 on any method to force a validateMetaCtx call.

	The Switchboard deals with data in terms of Namespaces, which in this
	application are defined a ordered set of BlackBox supplied AdmContexts,
	their optional caches, the optional cache for the product of a cascade
	merge of the set, and an optional output set of consumers, specified as
	BlackBoxes.
	cCsi|djo||_t|idSn|djo$t||_t|idSntddS(sN
		__init__: Initialize a Switchboard
		@self: this Switchboard instance
		@meta_context = None: a meta_context conforming AdmContext
		@file_path = None: a file path to load a meta_context from

		We used named parameters to specify which construction method
		we want. If they pass us a meta_context, we validate it and
		wire it up. If they pass us a file_path, we call the
		ReadContextFromFile function that the FileBlackBox module
		provided, validate the result, and wire it up. If we get
		nothing, we throw a ValueError exception.

		meta_context and file_path default to 'None'
		sIllegal Constructor parametersN(RRRRt	file_pathtReadContextFromFileR(RRR((RRs
	


cCs|ot|ing}|ii}xMt|iD]9}|i
|i}|djo|i
|q@q@W|S(s
		listNamespaces: list all Namespaces defined in the meta_context
		@self: this Switchboard instance
		@validate = None: a flag that can be set to force validation.

		returns: a list of all namespaces defined in the meta_context
		t_switchboard_config_N(tvalidateRRRtlistRRRRKRRNR%t	data_nametappend(RRRRRR((RtlistNamespacess
cCsj|ot|in|djodSny|iid|SWntj
o}tdnXdS(s
		readNamespaceCfg: examine a namespace_cfg defined in the meta_context
		@self: this Switchboard instance
		@name: the name of the namespace you are requesting
		@validate = None: a flag that can be set to force validation.

		Gets the namespace_cfg from the meta_context, if it exists. Programs
		should always use this function, as it masks the reserved name,
		"_switchboard_config_", and will always work accross future changes
		in the meta_context format.
		Rt/sNo such namespaceN(	RRRRR'RRRR(RR'RR((RtreadNamespaceCfgs
c
Cs
|ot|in|i|}|id}|i	}	|djot
||	}	nd}xut|	D]g}|djot|i|}qut|i|}|djotdd||}ququW|djotdddd}n|S(s1
		cascadeNamespace: cascade a namespace
		@self: this Switchboard instance
		@name: the name of a namespace to cascade
		@depth = None: an optional depth
		@validate = None: a flag that can be set to force validation.

		This function cascade merges a namespace's input set, and returns
		the result of the cascade. If a depth is specified, it cascades
		only to that depth, or the full set, which ever is least.

		To get the contexts to merge in the cascade, it performs a
		pullBox() call on each box_entry in the input_set, which may
		provide a cached copy, or may provide none at all. It cascades
		silently past empty pulls, and if it has nothing at the end, it
		builds a blank context, and gives you that.

		depth counting starts at 1, and goes up, in the same way that
		number of children starts at 1.
		Rt
cascade_mergeiR'RwN(RRRRRR'RRPRRKRtdepthRtmint	context_ARRRRNt	context_BRR(
RR'RRRRRRRR((RtcascadeNamespaces&




cCs|ot|in|i|}	|	id}xt	|i
D]}|i|}t|id}|djoqIn|i}|djoqInt|id}|djo
tdn|i}
|
djodSn||
jodSqIqIWdS(s=
		isNamespaceDirty: checks to see if a namespace is dirty
		RRRs'cache' entry unavailableiiN(RRRRRR'RRPRRRKRRNRRRRRtbversionRRtcversion(RR'RRRRRRRRR((RtisNamespaceDirty+s.





cCs|ot|in|i|}d}|djoRy6t
|id}|djo|i
}nWqtj
o	}qXn|djo.|i|}|djo|iqn|S(s
		readNamespace: read a namespace
		@self: this Switchboard instance
		@name: the name of the namespace
		@force = None: an optional tag to force a fresh read
		@validate = None: a flag that can be set to force validation.

		This function reads a namespace from a full cascade of it's input set,
		or from its cache, if one is available. It does not write the cache.
		The force flag, if true, causes readNamespace to ignore its cache.

		returns: a flattend AdmContext.

		RN(RRRRRR'RRRtforceRRPt	cache_boxRRRRR(RR'RRRRRR((Rt
readNamespaceQs"

	

cCsh|ot|in|i|}d}	d}yt
|id}Wnt
j
o}
d}nX|p,|o!|i}|o
d}	qqn|djo|i|}|in|	o7|o0|iitti|i|nyF|id}x0t|iD]}t|i||q+WWnt
j
o	}
nX|S(s
		writeNamespace: write a namespace to its consumers
		@self: this Switchboard instance
		@name: the name of the namespace to write.
		@force = None: an optional flag to force a cache flush
		@validate = None: a flag that can be set to force validation.

		This function pulls a namespaces cache, or a full cascade of the
		input set if the cache is empty, does not exist, or the force
		flag is set. It then writes out the cache (if it exists, and
		wasn't just read), and then writes to every box in the
		output set (if it exists).
		RiRN(RRRRRR'RRt
cache_readRRRPRRRRRRRRRxtintttimeRRRRKRRRN(RR'RRRRRRRRR((RtwriteNamespacews:

(R8R9RRRRRRRRR(((RRs4&&(t
_alchemistt
exceptionsRRRRRR	RR
RRRRiRRRRRRtWriteContextToFileRRRRRRRR(RRR	RRRRRRRRRRRiRRRRR
RRRRRRRRR((Rt?s6				5,"4		"w		4	!	?		(	

Anon7 - 2021