Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
dmapi / usr / lib / python2.7 / site-packages / dmapi / objects / base.pyo
Size: Mime:
ó
[dc@s¬dZddlZddlZddlZddlZddlZddlZddlm	Z	ddl
mZddl
m
ZddlZddlm
Z
ddlmZddlmZddlmZd	ejfd
„ƒYZdefd„ƒYZd
ejfd„ƒYZejZejZejZejZ dejfd„ƒYZ d„Z!dej"fd„ƒYZ#dej$fd„ƒYZ$d„Z%d„Z&dd„Z(dS(s$Contego common internal object modeliÿÿÿÿN(tversionutils(tbase(t	exception(tobjects(tfields(tutilstContegoObjectRegistrycBs5eZgZd„Zed„ƒZed„ƒZRS(cCsŠtj|jƒ}tt|jƒƒs@tt|jƒ|ƒnFtjtt|jƒƒjƒ}||kr†tt|jƒ|ƒndS(N(Rtconvert_version_to_tupletVERSIONthasattrRtobj_nametsetattrtgetattr(tselftclstindextversiontcur_version((s6/usr/lib/python2.7/site-packages/dmapi/objects/base.pytregistration_hookscCs'|jtƒ|ƒ|jj|ƒ|S(sµRegister a class as notification.
        Use only to register concrete notification or payload classes,
        do not register base classes intended for inheritance only.
        (tregister_iftFalsetnotification_classestappend(Rtnotification_cls((s6/usr/lib/python2.7/site-packages/dmapi/objects/base.pytregister_notification'scCs%x|jD]}|j|ƒq
WdS(s²Register previously decorated notification as normal ovos.
        This is not intended for production use but only for testing and
        document generation purposes.
        N(Rtregister(RR((s6/usr/lib/python2.7/site-packages/dmapi/objects/base.pytregister_notification_objects1s(t__name__t
__module__RRtclassmethodRR(((s6/usr/lib/python2.7/site-packages/dmapi/objects/base.pyRs	

tContegoPersistentObjectcBs`eZdZiejdeƒd6ejdeƒd6ejdeƒd6ejdeƒd6ZRS(suMixin class for Persistent objects.

    This adds the fields that we use in common for most persistent objects.
    tnullablet
created_att
updated_att
deleted_attdefaulttdeleted(	RRt__doc__t
obj_fieldst
DateTimeFieldtTruetBooleanFieldRR(((s6/usr/lib/python2.7/site-packages/dmapi/objects/base.pyR:st
ContegoObjectcBsMeZdZdZdZed„ƒZejd„ƒZ	ejd„ƒZ
RS(s\Base class and object factory.

    This forms the base of all objects that can be remoted or instantiated
    via RPC. Simply defining a class that inherits from this base class
    will make it remotely instantiatable. Objects should implement the
    necessary "get" classmethod routines as well as "save" object methods
    as appropriate.
    tdmapi_objecttdmapicCs
tƒ‚dS(sÊA check that can be used to inhibit online migration behavior

        This is usually used to check if all services that will be accessing
        the db directly are ready for the new format.
        N(tNotImplementedError(((s6/usr/lib/python2.7/site-packages/dmapi/objects/base.pytshould_migrate_dataSsccs,|j}||_z	dVWd||_XdS(N(t_context(R
tcontexttoriginal_context((s6/usr/lib/python2.7/site-packages/dmapi/objects/base.pytobj_alternate_context\s
			ccse|jdkr0tjddd|jƒƒ‚n|j}|jjƒ|_z	dVWd||_XdS(sContext manager to make an object call as an admin.

        This temporarily modifies the context embedded in an object to
        be elevated() and restores it after the call completes. Example
        usage:

           with obj.obj_as_admin():
               obj.save()

        tmethodtobj_as_admintobjtypeN(R/tNoneRtOrphanedObjectErrorR
televated(R
R1((s6/usr/lib/python2.7/site-packages/dmapi/objects/base.pyR4fs		(RRR%tOBJ_SERIAL_NAMESPACEtOBJ_PROJECT_NAMESPACEtstaticmethodR.t
contextlibtcontextmanagerR2R4(((s6/usr/lib/python2.7/site-packages/dmapi/objects/base.pyR*Fs	
tContegoObjectDictCompatcBseZd„Zd„ZRS(ccs>x7|jD],}|j|ƒs.||jkr
|Vq
q
WdS(N(R&tobj_attr_is_settobj_extra_fields(R
tname((s6/usr/lib/python2.7/site-packages/dmapi/objects/base.pyt__iter__‚scCs
t|ƒS(N(tlist(R
((s6/usr/lib/python2.7/site-packages/dmapi/objects/base.pytkeysˆs(RRRBRD(((s6/usr/lib/python2.7/site-packages/dmapi/objects/base.pyR>s	cCsd|S(s>Return the mangled name of the attribute's underlying storage.t_obj_((RA((s6/usr/lib/python2.7/site-packages/dmapi/objects/base.pytget_attrname‹stContegoObjectSerializercBs2eZdZd„Zd„Zd„Zd„ZRS(sDA ContegoObject-aware Serializer.

    This implements the Oslo Serializer interface and provides the
    ability to serialize and deserialize ContegoObject entities. Any service
    that needs to accept or return ContegoObjects as arguments or result values
    should pass this to its RPCClient and RPCServer objects.
    cCsÆytj|d|ƒ}Wn¦tjk
rÁ|d}|jdƒdkr{dj|jdƒd ƒ|d<|j||ƒS|d}tj	|ƒ}||kr»|j
j|||ƒ}q‚nX|S(NR0snova_object.versiont.isnova_object.name(R*tobj_from_primitivetovoo_exctIncompatibleObjectVersiontcounttjointsplitt_process_objectt	ovoo_basetobj_tree_get_versionst	conductortobject_backport_versions(R
R0tobjprimtobjinsttobjvertobjnametversion_manifest((s6/usr/lib/python2.7/site-packages/dmapi/objects/base.pyROœs
 
	cs€|j}t|tƒrA|‡‡fd†t|jƒƒDƒS|tkrVt}n|g|D]}ˆˆ|ƒ^q`ƒSdS(soProcess an iterable, taking an action on each value.
        :param:context: Request context
        :param:action_fn: Action to take on each item in values
        :param:values: Iterable container of things to take action on
        :returns: A new container of the same type (except set) with
                  items from values having had action applied.
        cs(i|]\}}ˆˆ|ƒ|“qS(((t.0tktv(t	action_fnR0(s6/usr/lib/python2.7/site-packages/dmapi/objects/base.pys
<dictcomp>ºs	N(t	__class__t
issubclasstdictRCtitemstset(R
R0R\tvaluestiterabletvalue((R\R0s6/usr/lib/python2.7/site-packages/dmapi/objects/base.pyt_process_iterable°s		cCsgt|ttttfƒr6|j||j|ƒ}n-t|dƒrct|j	ƒrc|j	ƒ}n|S(Ntobj_to_primitive(
t
isinstancettupleRCRaR_Retserialize_entityR	tcallableRf(R
R0tentity((s6/usr/lib/python2.7/site-packages/dmapi/objects/base.pyRiÆscCsjt|tƒr0d|kr0|j||ƒ}n6t|ttttfƒrf|j||j|ƒ}n|S(Nsnova_object.name(RgR_RORhRCRaRetdeserialize_entity(R
R0Rk((s6/usr/lib/python2.7/site-packages/dmapi/objects/base.pyRlÏs(RRR%ROReRiRl(((s6/usr/lib/python2.7/site-packages/dmapi/objects/base.pyRG“s
				tObjectListBasecBs,eZed„ƒZeejd„ƒZRS(cCsd|S(Nsnova_object.%s((Rtfield((s6/usr/lib/python2.7/site-packages/dmapi/objects/base.pyt_obj_primitive_keyØscCs:|j|ƒ}|tjkr&||S|j||ƒSdS(N(RoR&tUnspecifiedDefaulttget(Rt	primitiveRnR#tkey((s6/usr/lib/python2.7/site-packages/dmapi/objects/base.pyt_obj_primitive_fieldÜs(RRRRoR&RpRt(((s6/usr/lib/python2.7/site-packages/dmapi/objects/base.pyRm×scCs“i}xZ|D]R}t||ƒ}||krK|ƒ||<g||_n||jj|ƒq
Wx)|D]!}|||_||jƒqjW|S(s Construct a dictionary of object lists, keyed by item_key.

    :param:context: Request context
    :param:list_cls: The ObjectListBase class
    :param:obj_list: The list of objects to place in the dictionary
    :param:item_key: The object attribute name to use as a dictionary key
    (RRRR/tobj_reset_changes(R0tlist_clstobj_listtitem_keyt	obj_liststobjRs((s6/usr/lib/python2.7/site-packages/dmapi/objects/base.pytobj_make_dict_of_listsås	



csY‡fd†}tˆdtƒ|_ˆ|_tˆdƒrOtjˆƒ|ƒSt|ƒS(sCDecorator that will do the arguments serialization before remoting.cs)g|D]-}t|tjƒr.tj|ƒn|^q}x´t|jƒƒD] \}}|dkr|rtj|ƒ||<qM|dkrÅ|rÅt|tjƒrÅdj	t
j|ƒƒ||<qMt|tjƒrMtj|ƒ||<qMqMWtˆdƒrˆ|||ŽSˆj
d|ƒ||ŽS(Ntexc_valtexc_tbtt__call__(RgtdatetimeRtstrtimeRCR`tsixt	text_typetstring_typesRMt	tracebackt	format_tbR	t__get__R6(RztargstkwargstargRZR[(tfn(s6/usr/lib/python2.7/site-packages/dmapi/objects/base.pytwrapperýs7%t	remotableR(RRRtoriginal_fnR	t	functoolstwrapsR(R‹RŒ((R‹s6/usr/lib/python2.7/site-packages/dmapi/objects/base.pytserialize_argsûs
	"csh‡fd†‰|dk	r+dg|}n	dg}ˆ|jƒ|ƒ}ˆ|jƒ|ƒ}||kS(sDCompare two primitives for equivalence ignoring some keys.

    This operation tests the primitives of two objects for equivalence.
    Object primitives may contain a list identifying fields that have been
    changed - this is ignored in the comparison. The ignore parameter lists
    any other keys to be ignored.

    :param:obj1: The first object in the comparison
    :param:obj2: The second object in the comparison
    :param:ignore: A list of fields to ignore
    :returns: True if the primitives are equal ignoring changes
    and specified fields, otherwise False.
    cs‘t|tƒr]x|D]}|j|dƒqWx*t|jƒƒD]}ˆ||ƒqCWnt|tƒrx|D]}ˆ||ƒqsWn|S(N(RgR_tpopR6RCRb(tprimRDRZR[(t_strip(s6/usr/lib/python2.7/site-packages/dmapi/objects/base.pyR”"s

snova_object.changesN(R6Rf(tobj_1tobj_2tignoreRDtprim_1tprim_2((R”s6/usr/lib/python2.7/site-packages/dmapi/objects/base.pytobj_equal_primss	()R%R<R€RR…tnetaddrtoslo_messagingt	messagingt
oslo_utilsRtoslo_versionedobjectsRRPRRJR‚R,Rt
dmapi.objectsRR&RtVersionedObjectRegistryRtobjectRtVersionedObjectR*tremotable_classmethodRt
obj_make_listtVersionedObjectDictCompatR>RFtNoOpSerializerRGRmR{R‘R6Rš(((s6/usr/lib/python2.7/site-packages/dmapi/objects/base.pyt<module>s8#7				
	D