Permalink
Browse files

PEP8 and pyflakes cleanup.

  • Loading branch information...
garnaat committed Mar 27, 2012
1 parent 9fb28d9 commit bc6b6105dbed87b33aaa20688bb44ca541ff0688
Showing with 151 additions and 93 deletions.
  1. +6 −5 boto/resultset.py
  2. +17 −16 boto/storage_uri.py
  3. +128 −72 boto/utils.py
View
@@ -19,14 +19,15 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
+
class ResultSet(list):
"""
The ResultSet is used to pass results back from the Amazon services
to the client. It is light wrapper around Python's :py:class:`list` class,
- with some additional methods for parsing XML results from AWS.
- Because I don't really want any dependencies on external libraries,
- I'm using the standard SAX parser that comes with Python. The good news is
- that it's quite fast and efficient but it makes some things rather
+ with some additional methods for parsing XML results from AWS.
+ Because I don't really want any dependencies on external libraries,
+ I'm using the standard SAX parser that comes with Python. The good news is
+ that it's quite fast and efficient but it makes some things rather
difficult.
You can pass in, as the marker_elem parameter, a list of tuples.
@@ -114,6 +115,7 @@ def endElement(self, name, value, connection):
else:
setattr(self, name, value)
+
class BooleanResult(object):
def __init__(self, marker_elem=None):
@@ -154,4 +156,3 @@ def endElement(self, name, value, connection):
self.request_id = value
else:
setattr(self, name, value)
-
View
@@ -20,7 +20,6 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
-import boto
import os
from boto.exception import BotoClientError
from boto.exception import InvalidUriError
@@ -64,12 +63,12 @@ def equals(self, uri):
def check_response(self, resp, level, uri):
if resp is None:
- raise InvalidUriError('Attempt to get %s for "%s" failed.\nThis '
- 'can happen if the URI refers to a non-'
- 'existent object or if you meant to\noperate '
- 'on a directory (e.g., leaving off -R option '
- 'on gsutil cp, mv, or ls of a\nbucket)' %
- (level, uri))
+ raise InvalidUriError('Attempt to get %s for "%s" failed.\n'
+ 'This can happen if the URI refers to'
+ 'a non-existent object or if you meant to\n'
+ 'operate on a directory (e.g., leaving off'
+ '-R option on gsutil cp, mv, or ls of a\n'
+ 'bucket)' % (level, uri))
def connect(self, access_key_id=None, secret_access_key=None, **kwargs):
"""
@@ -239,8 +238,9 @@ def clone_replace_name(self, new_name):
@param new_name: new object name
"""
if not self.bucket_name:
- raise InvalidUriError('clone_replace_name() on bucket-less URI %s' %
- self.uri)
+ msg = 'clone_replace_name() on bucket-less URI %s' % self.uri
+ raise InvalidUriError(msg)
+
return BucketStorageUri(
self.scheme, bucket_name=self.bucket_name, object_name=new_name,
debug=self.debug,
@@ -303,12 +303,12 @@ def get_subresource(self, subresource, validate=True, headers=None,
def add_group_email_grant(self, permission, email_address, recursive=False,
validate=True, headers=None):
if self.scheme != 'gs':
- raise ValueError('add_group_email_grant() not supported for %s '
- 'URIs.' % self.scheme)
+ raise ValueError('add_group_email_grant() not supported for %s '
+ 'URIs.' % self.scheme)
if self.object_name:
if recursive:
- raise ValueError('add_group_email_grant() on key-ful URI cannot '
- 'specify recursive=True')
+ raise ValueError('add_group_email_grant() on key-ful URI '
+ 'cannot specify recursive=True')
key = self.get_key(validate, headers)
self.check_response(key, 'key', self.uri)
key.add_group_email_grant(permission, email_address, headers)
@@ -452,8 +452,10 @@ def set_canned_acl(self, acl_str, validate=True, headers=None,
def set_def_canned_acl(self, acl_str, validate=True, headers=None,
version_id=None):
- """sets or updates a bucket's default object acl to a predefined
- (canned) value"""
+ """
+ Sets or updates a bucket's default object acl to a predefined
+ (canned) value.
+ """
if not self.object_name:
raise InvalidUriError('set_canned_acl on object-less URI (%s)' %
self.uri)
@@ -493,7 +495,6 @@ def disable_logging(self, validate=True, headers=None, version_id=None):
bucket.disable_logging(headers=headers)
-
class FileStorageUri(StorageUri):
"""
StorageUri subclass that handles files in the local file system.
Oops, something went wrong.

0 comments on commit bc6b610

Please sign in to comment.