Skip to content

Commit

Permalink
Fix up pylint problems for the latest version of pylint.
Browse files Browse the repository at this point in the history
  • Loading branch information
KayEss committed Oct 21, 2014
1 parent c68cbd4 commit 6f31335
Show file tree
Hide file tree
Showing 14 changed files with 23 additions and 30 deletions.
5 changes: 1 addition & 4 deletions pylintrc
Expand Up @@ -33,7 +33,7 @@ load-plugins=
# R0903 Too few public methods
# W0142 Used * or ** magic
# W0212 Access to protected member
disable=I0011, R0903, W0142, W0212
disable=I0011, R0903, W0142, W0212, bad-continuation, cyclic-import


[REPORTS]
Expand All @@ -42,9 +42,6 @@ disable=I0011, R0903, W0142, W0212
# (visual studio) and html
output-format=colorized

# Include message's id in output
include-ids=yes

# Put messages in a separate file for each module / package specified on the
# command line instead of printing them on stdout. Reports (if any) will be
# written in a file name "pylint_global.[txt|html]".
Expand Down
10 changes: 5 additions & 5 deletions slumber/configuration.py
Expand Up @@ -11,11 +11,11 @@


def configure(arg,
properties_ro = None,
to_json = None,
operations_extra = None,
instance_proxy = None,
model_proxy = None):
properties_ro=None,
to_json=None,
operations_extra=None,
instance_proxy=None,
model_proxy=None):
"""Configure Slumber for the provided model.
When configuring the server side the model is a model instance. When
Expand Down
4 changes: 2 additions & 2 deletions slumber/connector/api.py
Expand Up @@ -19,7 +19,7 @@ def _ensure_absolute(url):
assert urlparse(url)[0], "The URL <%s> must be absolute" % url


def get_instance(model, instance_url, display_name, fields = None):
def get_instance(model, instance_url, display_name, fields=None):
"""Return an instance of the specified model etc.
"""
if isinstance(model, basestring):
Expand Down Expand Up @@ -128,7 +128,7 @@ class _InstanceProxy(object):
by the application code and the underlying object. This allows us to
better handle the cache.
"""
def __init__(self, url, display, fields = None):
def __init__(self, url, display, fields=None):
super(_InstanceProxy, self).__init__()
self._url = url
self._display = display
Expand Down
2 changes: 1 addition & 1 deletion slumber/connector/ua.py
Expand Up @@ -281,7 +281,7 @@ def _post(url, data, codes):
headers.update(_sign_request('POST', urlparse(url).path, body))
headers['Content-Type'] = 'application/json'
response, content = _real().request(url, "POST", body=body,
headers = headers)
headers=headers)
assert response.status in (codes or [200]), \
(url, response, content)
try:
Expand Down
5 changes: 3 additions & 2 deletions slumber/operations/__init__.py
Expand Up @@ -22,7 +22,7 @@ class Operation(object):
"""
METHODS = ['GET', 'OPTIONS', 'POST', 'PUT', 'DELETE']

def __init__(self, model, name, uri = None):
def __init__(self, model, name, uri=None):
self.model = model
self.name = name
self.uri = uri
Expand Down Expand Up @@ -99,6 +99,7 @@ class InstanceOperation(ModelOperation):
"""Base class for operations on instances.
"""
model_operation = False
def __init__(self, model, name, uri = None):
def __init__(self, model, name, uri=None):
super(InstanceOperation, self).__init__(model, name, uri)
self.regex = '([^/]+)/'

6 changes: 3 additions & 3 deletions slumber/operations/authenticate.py
Expand Up @@ -19,8 +19,8 @@ def post(self, request, response, _appname, _modelname):
response['authenticated'] = bool(user)
if user:
response['user'] = dict(
pk = user.pk,
display_name = unicode(user),
url = self.model.operations['data'](user))
pk=user.pk,
display_name=unicode(user),
url=self.model.operations['data'](user))
else:
response['user'] = None
2 changes: 1 addition & 1 deletion slumber/operations/authorization.py
Expand Up @@ -48,7 +48,7 @@ class GetPermissions(InstanceOperation):
"""Exposes the get_group_permissions API on Users.
"""

def get(self, _request , response, _appname, _modelname, pk):
def get(self, _request, response, _appname, _modelname, pk):
"""Implements the API.
"""
user = self.model.model.objects.get(pk=pk)
Expand Down
2 changes: 1 addition & 1 deletion slumber/operations/instancedata.py
Expand Up @@ -49,7 +49,7 @@ class InstanceData(Operation):
model_operation = False

@require_user
def get(self, request, response, pk, dataset = None):
def get(self, request, response, pk, dataset=None):
"""Implement the fetching of attribute data for an instance.
"""
instance = self.model.model.objects.get(pk=pk)
Expand Down
2 changes: 1 addition & 1 deletion slumber/server/__init__.py
Expand Up @@ -88,7 +88,7 @@ def get_slumber_local_url_prefix():
'%s://%s/' % (parsed[0], parsed[1]))


def get_slumber_services(directory = None):
def get_slumber_services(directory=None):
"""Returns the slumber services from the directory (if specified)
"""
if not directory:
Expand Down
2 changes: 1 addition & 1 deletion slumber/server/http.py
Expand Up @@ -92,7 +92,7 @@ def wrapper(request, *args, **kwargs):
except NotAuthorised, _:
response = {
'_meta': dict(status=401, message='Unauthorized',
headers= {'WWW-Authenticate':'FOST Realm="Slumber"'}),
headers={'WWW-Authenticate':'FOST Realm="Slumber"'}),
'error': 'No user is logged in'}
except Forbidden, exception:
response = {'_meta': dict(status=403, message='Forbidden'),
Expand Down
2 changes: 1 addition & 1 deletion slumber/server/json.py
Expand Up @@ -29,7 +29,7 @@ def to_json_data(model, instance, fieldname, fieldmeta):
root = get_slumber_root()
return dict(type=root + rel_to.path,
display=unicode(value),
data = root + rel_to.path + 'data/%s/' % value.pk)
data=root + rel_to.path + 'data/%s/' % value.pk)
elif DATA_MAPPING.has_key(fieldmeta['type']):
func = DATA_MAPPING[fieldmeta['type']]
return func(model, instance, fieldmeta, value)
Expand Down
2 changes: 1 addition & 1 deletion slumber/server/model.py
Expand Up @@ -84,7 +84,7 @@ def fields(self):
fields[field] = dict(
name=field,
kind='object',
type= get_slumber_root() +
type=get_slumber_root() +
DJANGO_MODEL_TO_SLUMBER_MODEL[definition.rel.to].path,
verbose_name=definition.verbose_name)
else:
Expand Down
5 changes: 1 addition & 4 deletions slumber/test.py
Expand Up @@ -10,9 +10,6 @@
class _Operations(object):
"""Allows us to fetch URLs for operations in mocks reliably.
"""
# Badly implemented Container, implements __getitem__ but not
# __delitem__, __len__, __setitem__
# pylint: disable=R0924
def __init__(self, url):
self._url = 'http://' + url
self._suffix = '/'
Expand Down Expand Up @@ -160,7 +157,7 @@ def do_get(self, url, _ttl=0, _codes=None, _headers=None):
self.test.assertIsNone(edata)
return None, rdata

def do_post(self, url, data, _codes = None):
def do_post(self, url, data, _codes=None):
"""The patch for the user agent post.
"""
self.test.assertTrue(self.expectations,
Expand Down
4 changes: 1 addition & 3 deletions slumber/urls.py
Expand Up @@ -12,6 +12,4 @@

# The name urlpatterns is defined by Django and we can't change it
# pylint: disable=C0103
#urlpatterns = patterns('', *_urls.items())
urlpatterns = patterns('',
('.*', 'slumber.server.views.service_root'))
urlpatterns = patterns('', ('.*', 'slumber.server.views.service_root'))

0 comments on commit 6f31335

Please sign in to comment.