Repository URL to install this package:
Version:
3.4.36 ▾
|
contego
/
home
/
tvault
/
.virtenv
/
lib
/
python2.7
/
site-packages
/
glanceclient
/
v2
/
schemas.pyc
|
---|
ó ·EYc @ s§ d d l Z d d l Z d d l Z d d l Z d d l j Z d e j f d YZ d e f d YZ d Z d e f d YZ d e f d YZ d S( iÿÿÿÿNt SchemaBasedModelc B s/ e Z d Z d Z e j j j d Z RS( sP Glance specific subclass of the warlock Model. This implementation alters the function of the patch property to take into account the schema's core properties. With this version undefined properties which are core will generated 'replace' operations rather than 'add' since this is what the Glance API expects. c C s | j d s g } n' i d d 6| j d d 6d d 6g } t j | | j } t j | } | sy t j | St j | | Sd S( Nt tagss /tagst patht valuet replacet op( t gett jsonpatcht make_patcht to_stringt jsont loadst dumps( t selft newt originalt tags_patcht patch_stringt patch( ( sL /home/tvault/.virtenv/lib/python2.7/site-packages/glanceclient/v2/schemas.pyt _make_custom_patch! s c C s° t j | j d } t | } | j r x^ t j | j d D]C \ } } | | k rB | | k rB | j d t rB d | | <qB qB Wn d | d <d | d <| j | | S( s1 Return a jsonpatch object representing the delta.t __original__t propertiest is_baseR N( t copyt deepcopyt __dict__t dictt schemat sixt iteritemsR t Truet NoneR ( R R R t namet prop( ( sL /home/tvault/.virtenv/lib/python2.7/site-packages/glanceclient/v2/schemas.pyR 0 s # ( t __name__t __module__t __doc__R t warlockt ModelR t getter( ( ( sL /home/tvault/.virtenv/lib/python2.7/site-packages/glanceclient/v2/schemas.pyR s t SchemaPropertyc B s e Z d Z RS( c K s4 | | _ | j d | _ | j d t | _ d S( Nt descriptionR ( R R R) R R ( R R t kwargs( ( sL /home/tvault/.virtenv/lib/python2.7/site-packages/glanceclient/v2/schemas.pyt __init__A s ( R" R# R+ ( ( ( sL /home/tvault/.virtenv/lib/python2.7/site-packages/glanceclient/v2/schemas.pyR( @ s c C s= g } x0 | j D]" \ } } | j t | | q W| S( sh Parse the properties dictionary of a schema document. :returns: list of SchemaProperty objects ( t itemst appendR( ( t schema_propertiesR R R! ( ( sL /home/tvault/.virtenv/lib/python2.7/site-packages/glanceclient/v2/schemas.pyt translate_schema_propertiesG s t Schemac B s5 e Z d Z d Z d Z d Z d Z RS( c C s3 | | _ | d | _ | d } t | | _ d S( NR R ( t _raw_schemaR R/ R ( R t raw_schemat raw_properties( ( sL /home/tvault/.virtenv/lib/python2.7/site-packages/glanceclient/v2/schemas.pyR+ S s c C s | j | t S( s, Check if a property with a given name is known to the schema. Determines if it is either a base property or a custom one registered in schema-image.json file :param property_name: name of the property :returns: True if the property is known, False otherwise ( t _check_propertyR ( R t property_name( ( sL /home/tvault/.virtenv/lib/python2.7/site-packages/glanceclient/v2/schemas.pyt is_core_propertyY s c C s | j | t S( s· Checks if a property with a given name is a base property. :param property_name: name of the property :returns: True if the property is base, False otherwise ( R4 t False( R R5 ( ( sL /home/tvault/.virtenv/lib/python2.7/site-packages/glanceclient/v2/schemas.pyt is_base_propertyd s c C s4 x- | j D]" } | | j k r | j p+ | Sq Wt S( N( R R R R7 ( R R5 t allow_non_baseR! ( ( sL /home/tvault/.virtenv/lib/python2.7/site-packages/glanceclient/v2/schemas.pyR4 l s c C s t j | j S( N( R R R1 ( R ( ( sL /home/tvault/.virtenv/lib/python2.7/site-packages/glanceclient/v2/schemas.pyt rawr s ( R" R# R+ R6 R8 R4 R: ( ( ( sL /home/tvault/.virtenv/lib/python2.7/site-packages/glanceclient/v2/schemas.pyR0 R s t Controllerc B s e Z d Z d Z RS( c C s | | _ d S( N( t http_client( R R<