diff --git a/trovebox/.pylint-ignores.patch b/trovebox/.pylint-ignores.patch new file mode 100644 index 0000000..26a95cb --- /dev/null +++ b/trovebox/.pylint-ignores.patch @@ -0,0 +1,224 @@ +diff --unified --recursive '--exclude=.pylint-ignores.patch' ./api_album.py /tmp/pylint_iHIz1e/api_album.py +--- ./api_album.py 2013-07-28 18:32:55.587158750 +0100 ++++ /tmp/pylint_iHIz1e/api_album.py 2013-07-28 18:32:52.783144848 +0100 +@@ -1,6 +1,6 @@ + from .objects import Album + +-class ApiAlbums(object): ++class ApiAlbums(object): # pylint: disable=R0903,C0111 + def __init__(self, client): + self._client = client + +@@ -9,7 +9,7 @@ + results = self._client.get("/albums/list.json", **kwds)["result"] + return [Album(self._client, album) for album in results] + +-class ApiAlbum(object): ++class ApiAlbum(object): # pylint: disable=C0111 + def __init__(self, client): + self._client = client + +diff --unified --recursive '--exclude=.pylint-ignores.patch' ./api_photo.py /tmp/pylint_iHIz1e/api_photo.py +--- ./api_photo.py 2013-07-28 18:32:55.587158750 +0100 ++++ /tmp/pylint_iHIz1e/api_photo.py 2013-07-28 18:32:52.787144864 +0100 +@@ -17,7 +17,7 @@ + ids.append(photo) + return ids + +-class ApiPhotos(object): ++class ApiPhotos(object): # pylint: disable=C0111 + def __init__(self, client): + self._client = client + +@@ -51,7 +51,7 @@ + raise TroveboxError("Delete response returned False") + return True + +-class ApiPhoto(object): ++class ApiPhoto(object): # pylint: disable=C0111 + def __init__(self, client): + self._client = client + +diff --unified --recursive '--exclude=.pylint-ignores.patch' ./api_tag.py /tmp/pylint_iHIz1e/api_tag.py +--- ./api_tag.py 2013-07-28 18:32:55.587158750 +0100 ++++ /tmp/pylint_iHIz1e/api_tag.py 2013-07-28 18:32:52.787144864 +0100 +@@ -1,6 +1,6 @@ + from .objects import Tag + +-class ApiTags(object): ++class ApiTags(object): # pylint: disable=R0903,C0111 + def __init__(self, client): + self._client = client + +@@ -9,7 +9,7 @@ + results = self._client.get("/tags/list.json", **kwds)["result"] + return [Tag(self._client, tag) for tag in results] + +-class ApiTag(object): ++class ApiTag(object): # pylint: disable=C0111 + def __init__(self, client): + self._client = client + +diff --unified --recursive '--exclude=.pylint-ignores.patch' ./config.py /tmp/pylint_iHIz1e/config.py +--- ./config.py 2013-07-28 18:32:55.587158750 +0100 ++++ /tmp/pylint_iHIz1e/config.py 2013-07-28 18:32:52.787144864 +0100 +@@ -1,7 +1,7 @@ + from __future__ import unicode_literals + import os + try: +- from configparser import ConfigParser # Python3 ++ from configparser import ConfigParser # Python3 # pylint: disable=F0401 + except ImportError: + from ConfigParser import SafeConfigParser as ConfigParser # Python2 + try: +@@ -9,8 +9,8 @@ + except ImportError: + import StringIO as io # Python2 + +-class Config(object): +- def __init__(self, config_file, host, ++class Config(object): # pylint: disable=R0903,C0111 ++ def __init__(self, config_file, host, # pylint: disable=R0913 + consumer_key, consumer_secret, + token, token_secret): + if host is None: +@@ -65,7 +65,7 @@ + parser = ConfigParser() + parser.optionxform = str # Case-sensitive options + try: +- parser.read_file(buf) # Python3 ++ parser.read_file(buf) # Python3 # pylint: disable=E1103 + except AttributeError: + parser.readfp(buf) # Python2 + +diff --unified --recursive '--exclude=.pylint-ignores.patch' ./http.py /tmp/pylint_iHIz1e/http.py +--- ./http.py 2013-07-28 18:32:55.591158774 +0100 ++++ /tmp/pylint_iHIz1e/http.py 2013-07-28 18:32:52.787144864 +0100 +@@ -4,18 +4,18 @@ + import requests_oauthlib + import logging + try: +- from urllib.parse import urlunparse # Python3 ++ from urllib.parse import urlunparse # Python3 # pylint: disable=F0401,E0611 + except ImportError: + from urlparse import urlunparse # Python2 + + from .objects import TroveboxObject +-from .errors import * ++from .errors import * # pylint: disable=W0401 + from .config import Config + + if sys.version < '3': +- TEXT_TYPE = unicode ++ TEXT_TYPE = unicode # pylint: disable=C0103 + else: +- TEXT_TYPE = str ++ TEXT_TYPE = str # pylint: disable=C0103 + + DUPLICATE_RESPONSE = {"code": 409, + "message": "This photo already exists"} +@@ -32,7 +32,7 @@ + This should be used to ensure that your application will continue to work + even if the Trovebox API is updated to a new revision. + """ +- def __init__(self, config_file=None, host=None, ++ def __init__(self, config_file=None, host=None, # pylint: disable=R0913 + consumer_key='', consumer_secret='', + token='', token_secret='', api_version=None): + self._api_version = api_version +diff --unified --recursive '--exclude=.pylint-ignores.patch' ./__init__.py /tmp/pylint_iHIz1e/__init__.py +--- ./__init__.py 2013-07-28 18:32:55.591158774 +0100 ++++ /tmp/pylint_iHIz1e/__init__.py 2013-07-28 18:33:03.527198125 +0100 +@@ -1,5 +1,5 @@ + from .http import Http +-from .errors import * ++from .errors import * # pylint: disable=W0401 + from ._version import __version__ + from . import api_photo + from . import api_tag +@@ -19,7 +19,7 @@ + This should be used to ensure that your application will continue to work + even if the Trovebox API is updated to a new revision. + """ +- def __init__(self, config_file=None, host=None, ++ def __init__(self, config_file=None, host=None, # pylint: disable=R0913 + consumer_key='', consumer_secret='', + token='', token_secret='', + api_version=None): +diff --unified --recursive '--exclude=.pylint-ignores.patch' ./main.py /tmp/pylint_iHIz1e/main.py +--- ./main.py 2013-07-28 18:32:55.591158774 +0100 ++++ /tmp/pylint_iHIz1e/main.py 2013-07-28 18:32:52.787144864 +0100 +@@ -23,7 +23,7 @@ + + ################################################################# + +-def main(args=sys.argv[1:]): ++def main(args=sys.argv[1:]): # pylint: disable=R0912,C0111 + usage = "%prog --help" + parser = OptionParser(usage, add_help_option=False) + parser.add_option('-c', '--config', help="Configuration file to use", +@@ -81,13 +81,13 @@ + sys.exit(1) + + if options.method == "GET": +- result = client.get(options.endpoint, process_response=False, ++ result = client.get(options.endpoint, process_response=False, # pylint: disable=W0142 + **params) + else: + params, files = extract_files(params) +- result = client.post(options.endpoint, process_response=False, ++ result = client.post(options.endpoint, process_response=False, # pylint: disable=W0142 + files=files, **params) +- for f in files: ++ for f in files: # pylint: disable=C0103 + files[f].close() + + if options.verbose: +diff --unified --recursive '--exclude=.pylint-ignores.patch' ./objects.py /tmp/pylint_iHIz1e/objects.py +--- ./objects.py 2013-07-28 18:32:55.591158774 +0100 ++++ /tmp/pylint_iHIz1e/objects.py 2013-07-28 18:32:52.787144864 +0100 +@@ -1,14 +1,14 @@ + try: +- from urllib.parse import quote # Python3 ++ from urllib.parse import quote # Python3 # pylint: disable=F0401,E0611 + except ImportError: + from urllib import quote # Python2 + + from .errors import TroveboxError + +-class TroveboxObject(object): ++class TroveboxObject(object): # pylint: disable=R0903 + """ Base object supporting the storage of custom fields as attributes """ + def __init__(self, trovebox, json_dict): +- self.id = None ++ self.id = None # pylint: disable=C0103 + self.name = None + self._trovebox = trovebox + self._json_dict = json_dict +@@ -54,7 +54,7 @@ + return self._json_dict + + +-class Photo(TroveboxObject): ++class Photo(TroveboxObject): # pylint: disable=C0111 + def delete(self, **kwds): + """ + Delete this photo. +@@ -144,7 +144,7 @@ + + self._replace_fields(new_dict) + +-class Tag(TroveboxObject): ++class Tag(TroveboxObject): # pylint: disable=C0111 + def delete(self, **kwds): + """ + Delete this tag. +@@ -165,7 +165,7 @@ + self._replace_fields(new_dict) + + +-class Album(TroveboxObject): ++class Album(TroveboxObject): # pylint: disable=C0111 + def __init__(self, trovebox, json_dict): + self.photos = None + self.cover = None diff --git a/trovebox/api_album.py b/trovebox/api_album.py index 9c212c0..79dfe29 100644 --- a/trovebox/api_album.py +++ b/trovebox/api_album.py @@ -1,6 +1,6 @@ from .objects import Album -class ApiAlbums: +class ApiAlbums(object): def __init__(self, client): self._client = client @@ -9,7 +9,7 @@ class ApiAlbums: results = self._client.get("/albums/list.json", **kwds)["result"] return [Album(self._client, album) for album in results] -class ApiAlbum: +class ApiAlbum(object): def __init__(self, client): self._client = client @@ -30,12 +30,15 @@ class ApiAlbum: return album.delete(**kwds) def form(self, album, **kwds): + """ Not yet implemented """ raise NotImplementedError() def add_photos(self, album, photos, **kwds): + """ Not yet implemented """ raise NotImplementedError() def remove_photos(self, album, photos, **kwds): + """ Not yet implemented """ raise NotImplementedError() def update(self, album, **kwds): diff --git a/trovebox/api_photo.py b/trovebox/api_photo.py index 6c1eacf..75783df 100644 --- a/trovebox/api_photo.py +++ b/trovebox/api_photo.py @@ -17,7 +17,7 @@ def extract_ids(photos): ids.append(photo) return ids -class ApiPhotos: +class ApiPhotos(object): def __init__(self, client): self._client = client @@ -51,7 +51,7 @@ class ApiPhotos: raise TroveboxError("Delete response returned False") return True -class ApiPhoto: +class ApiPhoto(object): def __init__(self, client): self._client = client @@ -72,9 +72,11 @@ class ApiPhoto: return photo.edit(**kwds) def replace(self, photo, photo_file, **kwds): + """ Not yet implemented """ raise NotImplementedError() def replace_encoded(self, photo, photo_file, **kwds): + """ Not yet implemented """ raise NotImplementedError() def update(self, photo, **kwds): @@ -114,6 +116,7 @@ class ApiPhoto: return Photo(self._client, result) def dynamic_url(self, photo, **kwds): + """ Not yet implemented """ raise NotImplementedError() def next_previous(self, photo, **kwds): diff --git a/trovebox/api_tag.py b/trovebox/api_tag.py index 4221c9a..d80a9d1 100644 --- a/trovebox/api_tag.py +++ b/trovebox/api_tag.py @@ -1,6 +1,6 @@ from .objects import Tag -class ApiTags: +class ApiTags(object): def __init__(self, client): self._client = client @@ -9,7 +9,7 @@ class ApiTags: results = self._client.get("/tags/list.json", **kwds)["result"] return [Tag(self._client, tag) for tag in results] -class ApiTag: +class ApiTag(object): def __init__(self, client): self._client = client diff --git a/trovebox/config.py b/trovebox/config.py index bacef2b..e18f30b 100644 --- a/trovebox/config.py +++ b/trovebox/config.py @@ -9,7 +9,7 @@ try: except ImportError: import StringIO as io # Python2 -class Config: +class Config(object): def __init__(self, config_file, host, consumer_key, consumer_secret, token, token_secret): @@ -46,7 +46,8 @@ def get_config_path(config_file): def read_config(config_path): """ Loads config data from the specified file path. - If config_file doesn't exist, returns an empty authentication config for localhost. + If config_file doesn't exist, returns an empty authentication config + for localhost. """ section = "DUMMY" defaults = {'host': 'localhost', diff --git a/trovebox/http.py b/trovebox/http.py index fef1fdc..6d45d31 100644 --- a/trovebox/http.py +++ b/trovebox/http.py @@ -20,7 +20,7 @@ else: DUPLICATE_RESPONSE = {"code": 409, "message": "This photo already exists"} -class Http: +class Http(object): """ Base class to handle HTTP requests to an Trovebox server. If no parameters are specified, config is loaded from the default diff --git a/trovebox/main.py b/trovebox/main.py index dfe2573..7472bc6 100644 --- a/trovebox/main.py +++ b/trovebox/main.py @@ -44,7 +44,7 @@ def main(args=sys.argv[1:]): action="store_true", dest="pretty", default=False) parser.add_option('-v', help="Verbose output", action="store_true", dest="verbose", default=False) - parser.add_option('--version', help="Display the current version information", + parser.add_option('--version', help="Display the current version", action="store_true") parser.add_option('--help', help='show this help message', action="store_true") @@ -107,7 +107,8 @@ def main(args=sys.argv[1:]): def extract_files(params): """ - Extract filenames from the "photo" parameter, so they can be uploaded, returning (updated_params, files). + Extract filenames from the "photo" parameter so they can be uploaded, + returning (updated_params, files). Uses the same technique as the Trovebox PHP commandline tool: * Filename can only be in the "photo" parameter * Filename must be prefixed with "@" diff --git a/trovebox/objects.py b/trovebox/objects.py index ffced54..805983f 100644 --- a/trovebox/objects.py +++ b/trovebox/objects.py @@ -5,7 +5,7 @@ except ImportError: from .errors import TroveboxError -class TroveboxObject: +class TroveboxObject(object): """ Base object supporting the storage of custom fields as attributes """ def __init__(self, trovebox, json_dict): self.id = None @@ -75,9 +75,11 @@ class Photo(TroveboxObject): return result["markup"] def replace(self, photo_file, **kwds): + """ Not implemented yet """ raise NotImplementedError() def replace_encoded(self, photo_file, **kwds): + """ Not implemented yet """ raise NotImplementedError() def update(self, **kwds): @@ -96,6 +98,7 @@ class Photo(TroveboxObject): self._replace_fields(new_dict) def dynamic_url(self, **kwds): + """ Not implemented yet """ raise NotImplementedError() def next_previous(self, **kwds): @@ -194,12 +197,15 @@ class Album(TroveboxObject): return result def form(self, **kwds): + """ Not implemented yet """ raise NotImplementedError() def add_photos(self, photos, **kwds): + """ Not implemented yet """ raise NotImplementedError() def remove_photos(self, photos, **kwds): + """ Not implemented yet """ raise NotImplementedError() def update(self, **kwds):