/usr/lib/python2.6/site-packages/boto/s3
NameSizeModeActions
acl.py57270644editdlrm
acl.pyc60930644editdlrm
acl.pyo60930644editdlrm
bucket.py793690644editdlrm
bucket.pyc707340644editdlrm
bucket.pyo706880644editdlrm
bucketlistresultset.py67960644editdlrm
bucketlistresultset.pyc57470644editdlrm
bucketlistresultset.pyo57470644editdlrm
bucketlogging.py31830644editdlrm
bucketlogging.pyc29060644editdlrm
bucketlogging.pyo29060644editdlrm
connection.py261920644editdlrm
connection.pyc237440644editdlrm
connection.pyo236070644editdlrm
cors.py89410644editdlrm
cors.pyc80180644editdlrm
cors.pyo80180644editdlrm
deletemarker.py20870644editdlrm
deletemarker.pyc15010644editdlrm
deletemarker.pyo15010644editdlrm
key.py823190644editdlrm
key.pyc660280644editdlrm
key.pyo660280644editdlrm
keyfile.py44270644editdlrm
keyfile.pyc50100644editdlrm
keyfile.pyo50100644editdlrm
lifecycle.py82540644editdlrm
lifecycle.pyc92330644editdlrm
lifecycle.pyo92330644editdlrm
multidelete.py47570644editdlrm
multidelete.pyc49800644editdlrm
multidelete.pyo49800644editdlrm
multipart.py120490644editdlrm
multipart.pyc119560644editdlrm
multipart.pyo119560644editdlrm
prefix.py16610644editdlrm
prefix.pyc12430644editdlrm
prefix.pyo12430644editdlrm
resumable_download_handler.py155950644editdlrm
resumable_download_handler.pyc103360644editdlrm
resumable_download_handler.pyo103360644editdlrm
tagging.py17320644editdlrm
tagging.pyc36880644editdlrm
tagging.pyo36880644editdlrm
user.py19680644editdlrm
user.pyc15140644editdlrm
user.pyo15140644editdlrm
website.py106070644editdlrm
website.pyc123110644editdlrm
website.pyo123110644editdlrm
__init__.py23450644editdlrm
__init__.pyc18070644editdlrm
__init__.pyo18070644editdlrm
Edit: /usr/lib/python2.6/site-packages/boto/s3/keyfile.py (4427B)
# Copyright 2013 Google Inc. # Copyright 2011, Nexenta Systems Inc. # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, dis- # tribute, sublicense, and/or sell copies of the Software, and to permit # persons to whom the Software is furnished to do so, subject to the fol- # lowing conditions: # # The above copyright notice and this permission notice shall be included # in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL- # ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT # SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS # IN THE SOFTWARE. """ Wrapper class to expose a Key being read via a partial implementaiton of the Python file interface. The only functions supported are those needed for seeking in a Key open for reading. """ import os from boto.exception import StorageResponseError class KeyFile(): def __init__(self, key): self.key = key self.key.open_read() self.location = 0 self.closed = False self.softspace = -1 # Not implemented. self.mode = 'r' self.encoding = 'Undefined in KeyFile' self.errors = 'Undefined in KeyFile' self.newlines = 'Undefined in KeyFile' self.name = key.name def tell(self): if self.location is None: raise ValueError("I/O operation on closed file") return self.location def seek(self, pos, whence=os.SEEK_SET): self.key.close(fast=True) if whence == os.SEEK_END: # We need special handling for this case because sending an HTTP range GET # with EOF for the range start would cause an invalid range error. Instead # we position to one before EOF (plus pos) and then read one byte to # position at EOF. if self.key.size == 0: # Don't try to seek with an empty key. return pos = self.key.size + pos - 1 if pos < 0: raise IOError("Invalid argument") self.key.open_read(headers={"Range": "bytes=%d-" % pos}) self.key.read(1) self.location = pos + 1 return if whence == os.SEEK_SET: if pos < 0: raise IOError("Invalid argument") elif whence == os.SEEK_CUR: pos += self.location else: raise IOError('Invalid whence param (%d) passed to seek' % whence) try: self.key.open_read(headers={"Range": "bytes=%d-" % pos}) except StorageResponseError as e: # 416 Invalid Range means that the given starting byte was past the end # of file. We catch this because the Python file interface allows silently # seeking past the end of the file. if e.status != 416: raise self.location = pos def read(self, size): self.location += size return self.key.read(size) def close(self): self.key.close() self.location = None self.closed = True def isatty(self): return False # Non-file interface, useful for code that wants to dig into underlying Key # state. def getkey(self): return self.key # Unimplemented interfaces below here. def write(self, buf): raise NotImplementedError('write not implemented in KeyFile') def fileno(self): raise NotImplementedError('fileno not implemented in KeyFile') def flush(self): raise NotImplementedError('flush not implemented in KeyFile') def next(self): raise NotImplementedError('next not implemented in KeyFile') def readinto(self): raise NotImplementedError('readinto not implemented in KeyFile') def readline(self): raise NotImplementedError('readline not implemented in KeyFile') def readlines(self): raise NotImplementedError('readlines not implemented in KeyFile') def truncate(self): raise NotImplementedError('truncate not implemented in KeyFile') def writelines(self): raise NotImplementedError('writelines not implemented in KeyFile') def xreadlines(self): raise NotImplementedError('xreadlines not implemented in KeyFile')