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 / dist-packages / dmapi / api / openstack / common.pyc
Size: Mime:
ó
Éec@sJddlZddlZddlZddlZddlmZddlmZddl	Z	ddl
jjj
ZddlZddlmZddlmZddlZddlmZddlmZddlmZejjZejeƒZd	„Zd
„Zd„Z de!fd
„ƒYZ"dd„Z$d„Z%dd„Z&dS(iÿÿÿÿN(tlog(tstrutils(texc(tapi_version_request(t	exception(t_(tutilscCs!tjd|ƒjjdƒdS(s³Return the id or uuid portion of a url.

    Given: 'http://www.foo.com/bar/123?q=4'
    Returns: '123'

    Given: 'http://www.foo.com/bar/abc123?q=4'
    Returns: 'abc123'

    s%st/iÿÿÿÿ(turlparseturlsplittpathtsplit(thref((s>/usr/lib/python2.7/dist-packages/dmapi/api/openstack/common.pytget_id_from_hrefs
cCs tj|ƒ}|jjddƒ}tjdƒ}|j|jƒƒsqtj	d|ƒt
tdƒ|ƒ‚nt|Œ}t
|ƒ}||d<tj|ƒS(sÔRemoves the api version from the href.

    Given: 'http://www.dmapi.com/compute/v1.1'
    Returns: 'http://www.dmapi.com/compute'

    Given: 'http://www.dmapi.com/v1.1'
    Returns: 'http://www.dmapi.com'

    Ris ^v([0-9]+|[0-9]+\.[0-9]+)(/.*|$)s href %s does not contain versioni(RR	R
trsplittretcompiletmatchtpoptLOGtdebugt
ValueErrorRturl_jointlistt
urlunsplit(Rt
parsed_urlt	url_partst
expressiontnew_path((s>/usr/lib/python2.7/dist-packages/dmapi/api/openstack/common.pyt!remove_trailing_version_from_href(s

cGs^|pdg}g|D]}|r|jdƒ^q}|dsQ|jdƒndj|ƒS(sConvenience method for joining parts of a URL

    Any leading and trailing '/' characters are removed, and the parts joined
    together with '/' as a separator. If last element of 'parts' is an empty
    string, the returned URL will have a trailing slash.
    tRiÿÿÿÿ(tstriptappendtjoin(tpartstparttclean_parts((s>/usr/lib/python2.7/dist-packages/dmapi/api/openstack/common.pyRAs
(
tViewBuildercBsYeZdZd„Zd„Zd„Zd„Zd„Zdd„Zd„Z	d	„Z
RS(
s$Model API responses as dictionaries.cCs-|jdj}|r)||jkr)|SdS(sUGet project id from request url if present or empty string
        otherwise
        s
dmapi.contextR(tenviront
project_idturl(tselftrequestR'((s>/usr/lib/python2.7/dist-packages/dmapi/api/openstack/common.pyt_get_project_idSscCsDidd6|j|||ƒd6idd6|j|||ƒd6gS(NR)trelRtbookmark(t_get_href_linkt_get_bookmark_link(R)R*t
identifiertcollection_name((s>/usr/lib/python2.7/dist-packages/dmapi/api/openstack/common.pyt
_get_links\s	cCsltjt|jjƒƒƒ}||d<|j|jƒ}t||j|ƒ|ƒ}d|t	j
|ƒfS(s7Return href string with proper limit and marker params.tmarkers%s?%s(tcollectionstOrderedDicttsortedtparamstitemst_update_dmapi_link_prefixtapplication_urlRR+Rt	urlencode(R)R*R0R1R7tprefixR(((s>/usr/lib/python2.7/dist-packages/dmapi/api/openstack/common.pyt_get_next_linkhs
	cCs4|j|jƒ}t||j|ƒ|t|ƒƒS(s.Return an href string pointing to this object.(R9R:RR+tstr(R)R*R0R1R<((s>/usr/lib/python2.7/dist-packages/dmapi/api/openstack/common.pyR.rs
cCs@t|jƒ}|j|ƒ}t||j|ƒ|t|ƒƒS(s0Create a URL that refers to a specific resource.(RR:R9RR+R>(R)R*R0R1tbase_url((s>/usr/lib/python2.7/dist-packages/dmapi/api/openstack/common.pyR/zstuuidc	CsÅg}tt|jjdtjjƒƒtjjƒ}|rÁ|t|ƒkrÁ|d}||krq||}n#d|krŠ|d}n
|d}|jidd6|j	|||ƒd6ƒn|S(srRetrieve 'next' link, if applicable. This is included if:
        1) 'limit' param is specified and equals the number of items.
        2) 'limit' param is specified but it exceeds CONF.api.max_limit,
        in this case the number of items is CONF.api.max_limit.
        3) 'limit' param is NOT specified but the number of items is
        CONF.api.max_limit.
        tlimitiÿÿÿÿtidtflavoridtnextR,R(
tmintintR7tgettCONFtapit	max_limittlenR R=(	R)R*R8R1tid_keytlinkst	max_itemst	last_itemtlast_item_id((s>/usr/lib/python2.7/dist-packages/dmapi/api/openstack/common.pyt_get_collection_linksƒs"



		cCst|s
|Sttj|ƒƒ}ttj|ƒƒ}|dd!|dd+|d|d|d<tj|ƒjdƒS(NiiR(RRR	Rtrstrip(R)torig_urlR<Rtprefix_parts((s>/usr/lib/python2.7/dist-packages/dmapi/api/openstack/common.pyt_update_link_prefix£scCs|j|tjjƒS(N(RURHRItdmapi_link_prefix(R)RS((s>/usr/lib/python2.7/dist-packages/dmapi/api/openstack/common.pyR9¬s(t__name__t
__module__t__doc__R+R2R=R.R/RQRUR9(((s>/usr/lib/python2.7/dist-packages/dmapi/api/openstack/common.pyR%Ps				
		
		cCsOy|j||d|ƒSWn.tjk
rJ}tjd|jƒƒ‚nXdS(s@Fetch an instance from the compute API, handling error checking.texpected_attrstexplanationN(RGRtInstanceNotFoundRtHTTPNotFoundtformat_message(tcompute_apitcontexttinstance_idRZte((s>/usr/lib/python2.7/dist-packages/dmapi/api/openstack/common.pytget_instance°s
cCs
|jƒS(N(R(tname((s>/usr/lib/python2.7/dist-packages/dmapi/api/openstack/common.pytnormalize_name¹scCs4|dkrtdƒ}ntjjd|ƒ‚dS(Ns-The requested functionality is not supported.R[(tNoneRtwebobRtHTTPNotImplemented(tmsg((s>/usr/lib/python2.7/dist-packages/dmapi/api/openstack/common.pytraise_feature_not_supportedÄs('R4t	functoolst	itertoolsRtoslo_logRtloggingt
oslo_utilsRtsixtsix.moves.urllib.parsetmovesturllibtparseRRgRtdmapi.api.openstackRt
dmapi.conftdmapiRt
dmapi.i18nRRtconfRHt	getLoggerRWRR
RRtobjectR%RfRcReRj(((s>/usr/lib/python2.7/dist-packages/dmapi/api/openstack/common.pyt<module>s.	
		`