Trailing whitespace removal

This commit is contained in:
sneakypete81 2013-05-15 18:53:34 +01:00
parent ba681cea89
commit b2e7aa1f27
3 changed files with 26 additions and 26 deletions

View file

@ -46,7 +46,7 @@ class ApiAlbum:
return album return album
def view(self, album, **kwds): def view(self, album, **kwds):
""" """
View an album's contents. View an album's contents.
Returns the requested album object. Returns the requested album object.
""" """

View file

@ -60,7 +60,7 @@ class ApiPhoto:
raise NotImplementedError() raise NotImplementedError()
def update(self, photo, **kwds): def update(self, photo, **kwds):
""" """
Update a photo with the specified parameters. Update a photo with the specified parameters.
Returns the updated photo object Returns the updated photo object
""" """
@ -70,8 +70,8 @@ class ApiPhoto:
return photo return photo
def view(self, photo, **kwds): def view(self, photo, **kwds):
""" """
Used to view the photo at a particular size. Used to view the photo at a particular size.
Returns the requested photo object Returns the requested photo object
""" """
if not isinstance(photo, Photo): if not isinstance(photo, Photo):
@ -90,7 +90,7 @@ class ApiPhoto:
""" Base64-encodes and uploads the specified file """ """ Base64-encodes and uploads the specified file """
with open(photo_file, "rb") as f: with open(photo_file, "rb") as f:
encoded_photo = base64.b64encode(f.read()) encoded_photo = base64.b64encode(f.read())
result = self._client.post("/photo/upload.json", photo=encoded_photo, result = self._client.post("/photo/upload.json", photo=encoded_photo,
**kwds)["result"] **kwds)["result"]
return Photo(self._client, result) return Photo(self._client, result)
@ -98,9 +98,9 @@ class ApiPhoto:
raise NotImplementedError() raise NotImplementedError()
def next_previous(self, photo, **kwds): def next_previous(self, photo, **kwds):
""" """
Returns a dict containing the next and previous photo lists Returns a dict containing the next and previous photo lists
(there may be more than one next/previous photo returned). (there may be more than one next/previous photo returned).
""" """
if not isinstance(photo, Photo): if not isinstance(photo, Photo):
photo = Photo(self._client, {"id": photo}) photo = Photo(self._client, {"id": photo})
@ -108,7 +108,7 @@ class ApiPhoto:
def transform(self, photo, **kwds): def transform(self, photo, **kwds):
""" """
Performs transformation specified in **kwds Performs transformation specified in **kwds
Example: transform(photo, rotate=90) Example: transform(photo, rotate=90)
""" """
if not isinstance(photo, Photo): if not isinstance(photo, Photo):

View file

@ -17,10 +17,10 @@ class OpenPhotoObject:
if key.startswith("_"): if key.startswith("_"):
raise ValueError("Illegal attribute: %s" % key) raise ValueError("Illegal attribute: %s" % key)
setattr(self, key, value) setattr(self, key, value)
def _replace_fields(self, json_dict): def _replace_fields(self, json_dict):
""" """
Delete this object's attributes, and replace with Delete this object's attributes, and replace with
those in json_dict. those in json_dict.
""" """
for key in self._json_dict.keys(): for key in self._json_dict.keys():
@ -54,7 +54,7 @@ class Photo(OpenPhotoObject):
def edit(self, **kwds): def edit(self, **kwds):
""" Returns an HTML form to edit the photo """ """ Returns an HTML form to edit the photo """
result = self._openphoto.get("/photo/%s/edit.json" % self.id, result = self._openphoto.get("/photo/%s/edit.json" % self.id,
**kwds)["result"] **kwds)["result"]
return result["markup"] return result["markup"]
@ -66,16 +66,16 @@ class Photo(OpenPhotoObject):
def update(self, **kwds): def update(self, **kwds):
""" Update this photo with the specified parameters """ """ Update this photo with the specified parameters """
new_dict = self._openphoto.post("/photo/%s/update.json" % self.id, new_dict = self._openphoto.post("/photo/%s/update.json" % self.id,
**kwds)["result"] **kwds)["result"]
self._replace_fields(new_dict) self._replace_fields(new_dict)
def view(self, **kwds): def view(self, **kwds):
""" """
Used to view the photo at a particular size. Used to view the photo at a particular size.
Updates the photo's fields with the response. Updates the photo's fields with the response.
""" """
new_dict = self._openphoto.get("/photo/%s/view.json" % self.id, new_dict = self._openphoto.get("/photo/%s/view.json" % self.id,
**kwds)["result"] **kwds)["result"]
self._replace_fields(new_dict) self._replace_fields(new_dict)
@ -83,11 +83,11 @@ class Photo(OpenPhotoObject):
raise NotImplementedError() raise NotImplementedError()
def next_previous(self, **kwds): def next_previous(self, **kwds):
"""
Returns a dict containing the next and previous photo lists
(there may be more than one next/previous photo returned).
""" """
result = self._openphoto.get("/photo/%s/nextprevious.json" % self.id, Returns a dict containing the next and previous photo lists
(there may be more than one next/previous photo returned).
"""
result = self._openphoto.get("/photo/%s/nextprevious.json" % self.id,
**kwds)["result"] **kwds)["result"]
value = {} value = {}
if "next" in result: if "next" in result:
@ -137,7 +137,7 @@ class Tag(OpenPhotoObject):
def update(self, **kwds): def update(self, **kwds):
""" Update this tag with the specified parameters """ """ Update this tag with the specified parameters """
new_dict = self._openphoto.post("/tag/%s/update.json" % quote(self.id), new_dict = self._openphoto.post("/tag/%s/update.json" % quote(self.id),
**kwds)["result"] **kwds)["result"]
self._replace_fields(new_dict) self._replace_fields(new_dict)
@ -173,13 +173,13 @@ class Album(OpenPhotoObject):
def add_photos(self, **kwds): def add_photos(self, **kwds):
raise NotImplementedError() raise NotImplementedError()
def remove_photos(self, **kwds): def remove_photos(self, **kwds):
raise NotImplementedError() raise NotImplementedError()
def update(self, **kwds): def update(self, **kwds):
""" Update this album with the specified parameters """ """ Update this album with the specified parameters """
new_dict = self._openphoto.post("/album/%s/update.json" % self.id, new_dict = self._openphoto.post("/album/%s/update.json" % self.id,
**kwds)["result"] **kwds)["result"]
# APIv1 doesn't return the updated album (frontend issue #937) # APIv1 doesn't return the updated album (frontend issue #937)
@ -188,13 +188,13 @@ class Album(OpenPhotoObject):
self._replace_fields(new_dict) self._replace_fields(new_dict)
self._update_fields_with_objects() self._update_fields_with_objects()
def view(self, **kwds): def view(self, **kwds):
""" """
Requests the full contents of the album. Requests the full contents of the album.
Updates the album's fields with the response. Updates the album's fields with the response.
""" """
result = self._openphoto.get("/album/%s/view.json" % self.id, result = self._openphoto.get("/album/%s/view.json" % self.id,
**kwds)["result"] **kwds)["result"]
self._replace_fields(result) self._replace_fields(result)
self._update_fields_with_objects() self._update_fields_with_objects()