Skip to content

Commit

Permalink
pep8 fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolaiarocci committed Feb 13, 2015
1 parent f702eb5 commit 9a2f406
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 17 deletions.
4 changes: 2 additions & 2 deletions eve/flaskapp.py
Expand Up @@ -632,8 +632,8 @@ def _add_resource_url_rules(self, resource, settings):

pretty_url = settings['url']
if '<' in pretty_url:
pretty_url = pretty_url[:pretty_url.index('<')+1] + \
pretty_url[pretty_url.rindex(':')+1:]
pretty_url = pretty_url[:pretty_url.index('<') + 1] + \
pretty_url[pretty_url.rindex(':') + 1:]
self.config['URLS'][resource] = pretty_url

# resource endpoint
Expand Down
2 changes: 1 addition & 1 deletion eve/methods/common.py
Expand Up @@ -591,7 +591,7 @@ def resolve_embedded_documents(document, resource, embedded_fields):
"""
for field in embedded_fields:
data_relation = field_definition(resource, field)['data_relation']
getter = lambda ref: embedded_document(ref, data_relation, field) # noqa
getter = lambda ref: embedded_document(ref, data_relation, field)
fields_chain = field.split('.')
last_field = fields_chain[-1]
for subdocument in subdocuments(fields_chain[:-1], document):
Expand Down
8 changes: 4 additions & 4 deletions eve/tests/__init__.py
Expand Up @@ -419,7 +419,7 @@ def random_contacts(self, num, standard_date_fields=True):
for i in range(num):
dt = datetime.now()
contact = {
'ref': self.random_string(schema['ref']['maxlength']),
'ref': self.random_string(schema['ref']['maxlength']),
'prog': i,
'role': random.choice(schema['role']['allowed']),
'rows': self.random_rows(random.randint(0, 5)),
Expand Down Expand Up @@ -451,7 +451,7 @@ def random_payments(self, num):
for i in range(num):
dt = datetime.now()
payment = {
'a_string': self.random_string(10),
'a_string': self.random_string(10),
'a_number': i,
eve.LAST_UPDATED: dt,
eve.DATE_CREATED: dt,
Expand All @@ -464,7 +464,7 @@ def random_invoices(self, num):
for _ in range(num):
dt = datetime.now()
invoice = {
'inv_number': self.random_string(10),
'inv_number': self.random_string(10),
eve.LAST_UPDATED: dt,
eve.DATE_CREATED: dt,
}
Expand Down Expand Up @@ -498,7 +498,7 @@ def random_internal_transactions(self, num):
for i in range(num):
dt = datetime.now()
transaction = {
'internal_string': self.random_string(10),
'internal_string': self.random_string(10),
'internal_number': i,
eve.LAST_UPDATED: dt,
eve.DATE_CREATED: dt,
Expand Down
4 changes: 2 additions & 2 deletions eve/tests/auth.py
Expand Up @@ -88,7 +88,7 @@ def test_restricted_item_access(self):
self.assert401(r.status_code)

def test_authorized_home_access(self):
r = self.test_client.get('/', headers=self.valid_auth)
r = self.test_client.get('/', headers=self.valid_auth)
self.assert200(r.status_code)

def test_authorized_resource_access(self):
Expand All @@ -114,7 +114,7 @@ def test_authorized_item_access(self):
self.assert403(r.status_code)

def test_unauthorized_home_access(self):
r = self.test_client.get('/', headers=self.invalid_auth)
r = self.test_client.get('/', headers=self.invalid_auth)
self.assert401(r.status_code)

def test_unauthorized_resource_access(self):
Expand Down
2 changes: 1 addition & 1 deletion eve/tests/endpoints.py
Expand Up @@ -264,7 +264,7 @@ def on_generic_inserted(self, resource, docs):
if resource != 'internal_transactions':
dt = datetime.now()
transaction = {
'entities': [doc['_id'] for doc in docs],
'entities': [doc['_id'] for doc in docs],
'original_resource': resource,
config.LAST_UPDATED: dt,
config.DATE_CREATED: dt,
Expand Down
4 changes: 2 additions & 2 deletions eve/tests/methods/patch.py
Expand Up @@ -393,8 +393,8 @@ def test_patch_nested_document_not_overwritten(self):
"schema": {
"name": {"type": "string"},
"lon": {"type": "float"},
"lat": {"type": "float"},
"value": {"type": "float", "default": 10.3},
"lat": {"type": "float"},
"value": {"type": "float", "default": 10.3},
"dict": {
'type': 'dict',
'schema': {
Expand Down
3 changes: 2 additions & 1 deletion eve/tests/test_settings.py
@@ -1,4 +1,6 @@
# -*- coding: utf-8 -*-
import copy


MONGO_HOST = 'localhost'
MONGO_PORT = 27017
Expand Down Expand Up @@ -124,7 +126,6 @@
}
}

import copy
users = copy.deepcopy(contacts)
users['url'] = 'users'
users['datasource'] = {'source': 'contacts',
Expand Down
6 changes: 3 additions & 3 deletions eve/versioning.py
Expand Up @@ -9,7 +9,7 @@ def versioned_id_field():
.. versionadded: 0.4
"""
return app.config['ID_FIELD']+app.config['VERSION_ID_SUFFIX']
return app.config['ID_FIELD'] + app.config['VERSION_ID_SUFFIX']


def resolve_document_version(document, resource, method, latest_doc=None):
Expand Down Expand Up @@ -138,7 +138,7 @@ def insert_versioning_documents(resource, documents):
versioned_documents.append(ver_doc)

# bulk insert
app.data.insert(resource+app.config['VERSIONS'], versioned_documents)
app.data.insert(resource + app.config['VERSIONS'], versioned_documents)


def versioned_fields(resource_def):
Expand Down Expand Up @@ -259,7 +259,7 @@ def get_old_document(resource, req, lookup, document, version):
lookup[config.VERSION] = version

# synthesize old document from latest and delta
delta = app.data.find_one(resource+config.VERSIONS, req, **lookup)
delta = app.data.find_one(resource + config.VERSIONS, req, **lookup)
if not delta:
abort(404)
document = synthesize_versioned_document(
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Expand Up @@ -6,4 +6,4 @@ commands=python setup.py test {posargs}

[testenv:flake8]
deps=flake8
commands=flake8 eve
commands=flake8 --ignore=E731 eve {posargs}

0 comments on commit 9a2f406

Please sign in to comment.