Submit
Path:
~
/
/
proc
/
thread-self
/
root
/
usr
/
lib
/
python2.7
/
site-packages
/
boto
/
gs
/
File Content:
key.pyo
� ~�QXc @ s� d d l Z d d l Z d d l Z d d l Z d d l m Z d d l m Z d d l m Z d d l m Z d d l m Z d d l m Z d e f d � � YZ d S( i����N( t StringIO( t BotoClientError( t Key( t KeyFile( t compute_hash( t get_utf8_valueR c B s� e Z d Z d d d d � Z d � Z d � Z e d � Z d � Z d � Z d d d d d � Z d d d e d d d d d � Z d d d e d d d d d � Z d d � Z d d d d e d d d � Z d d � Z d � Z d � Z d d � Z d � Z d e d d d d d d e d d � Z d e d d d d d d d d � Z d e d d d d d d � Z d � Z d d d d d � Z d d d � Z d d d � Z d d d d d � Z d d d d d � Z d d d � Z RS( s� Represents a key (object) in a GS bucket. :ivar bucket: The parent :class:`boto.gs.bucket.Bucket`. :ivar name: The name of this Key object. :ivar metadata: A dictionary containing user metadata that you wish to store with the object or that has been retrieved from an existing object. :ivar cache_control: The value of the `Cache-Control` HTTP header. :ivar content_type: The value of the `Content-Type` HTTP header. :ivar content_encoding: The value of the `Content-Encoding` HTTP header. :ivar content_disposition: The value of the `Content-Disposition` HTTP header. :ivar content_language: The value of the `Content-Language` HTTP header. :ivar etag: The `etag` associated with this object. :ivar last_modified: The string timestamp representing the last time this object was modified in GS. :ivar owner: The ID of the owner of this object. :ivar storage_class: The storage class of the object. Currently, one of: STANDARD | DURABLE_REDUCED_AVAILABILITY. :ivar md5: The MD5 hash of the contents of the object. :ivar size: The size, in bytes, of the object. :ivar generation: The generation number of the object. :ivar metageneration: The generation number of the object metadata. :ivar encrypted: Whether the object is encrypted while at rest on the server. :ivar cloud_hashes: Dictionary of checksums as supplied by the storage provider. c C sG t t | � j d | d | � | | _ d | _ i | _ d | _ d S( Nt buckett name( t superR t __init__t generationt Nonet meta_generationt cloud_hashest component_count( t selfR R R ( ( s/ /usr/lib/python2.7/site-packages/boto/gs/key.pyR A s c C si | j r+ | j r+ d | j | j f } n d } | j rT d | j j | j | f Sd | j | f Sd S( Ns #%s.%st s <Key: %s,%s%s>s <Key: None,%s%s>( R t metagenerationR R ( R t ver_str( ( s/ /usr/lib/python2.7/site-packages/boto/gs/key.pyt __repr__H s c C s | d k r | | _ n� | d k r0 | | _ n� | d k r` | d k rT t | _ qt | _ n� | d k rx | | _ n� | d k r� t | � | _ n | d k r� | | _ ng | d k r� nX | d k r� | | _ n@ | d k r� | | _ n( | d k r| | _ n t | | | � d S( NR t ETagt IsLatestt truet LastModifiedt Sizet StorageClasst Ownert VersionIdt Generationt MetaGeneration( R t etagt Truet is_latestt Falset last_modifiedt intt sizet storage_classt version_idR R t setattr( R R t valuet connection( ( s/ /usr/lib/python2.7/site-packages/boto/gs/key.pyt endElementR s. c C s. | j d d � | _ | j d d � | _ d S( Ns x-goog-metagenerations x-goog-generation( t getheaderR R R ( R t respt force( ( s/ /usr/lib/python2.7/site-packages/boto/gs/key.pyt handle_version_headersm s c C s d S( N( ( R t response( ( s/ /usr/lib/python2.7/site-packages/boto/gs/key.pyt handle_restore_headersq s c C s� x� | D]� \ } } | d k rp x� | j d � D]: } | j � j d d � \ } } t j | � | j | <q/ Wq | d k r� t | � | _ q | d k r� | | _ q | d k r� | | _ q | d k r� t | � | _ q | d k r | | _ q q Wd S( Ns x-goog-hasht ,t =i s x-goog-component-counts x-goog-generations x-goog-stored-content-encodings x-goog-stored-content-lengths x-goog-storage-class( t splitt stript binasciit a2b_base64R R# R R t content_encodingR$ R% ( R t headerst keyR( t hash_pairt algt b64_digest( ( s/ /usr/lib/python2.7/site-packages/boto/gs/key.pyt handle_addl_headerst s R c C s_ | j r0 | r | d 7} n | d | j 7} n t t | � j d | d | d | d | � d S( s� Open this key for reading :type headers: dict :param headers: Headers to pass in the web request :type query_args: string :param query_args: Arguments to pass in the query string (ie, 'torrent') :type override_num_retries: int :param override_num_retries: If not None will override configured num_retries parameter for underlying GET. :type response_headers: dict :param response_headers: A dictionary containing HTTP headers/values that will override any headers associated with the stored object in the response. See http://goo.gl/EWOPb for details. t &s generation=%sR8 t query_argst override_num_retriest response_headersN( R R R t open_read( R R8 R? R@ RA ( ( s/ /usr/lib/python2.7/site-packages/boto/gs/key.pyRB � s i c C s] d } | j r"