aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2018-04-16 16:59:22 -0700
committerBryan Newbold <bnewbold@robocracy.org>2018-04-16 16:59:22 -0700
commitdb3bdc61285afa612ea826a8b987f6f986eb498b (patch)
treeb246ec73dde575cffd60ae77f141e238b131012a
parent270b7cebf25ee253ad893ce561a41887fccf67fe (diff)
downloadfatcat-db3bdc61285afa612ea826a8b987f6f986eb498b.tar.gz
fatcat-db3bdc61285afa612ea826a8b987f6f986eb498b.zip
start fixing pylint
-rw-r--r--.pylintrc2
-rw-r--r--fatcat/api.py19
-rw-r--r--fatcat/models.py4
-rw-r--r--fatcat/sql.py1
4 files changed, 13 insertions, 13 deletions
diff --git a/.pylintrc b/.pylintrc
index b4dfd4f4..350400b8 100644
--- a/.pylintrc
+++ b/.pylintrc
@@ -1,5 +1,5 @@
[MESSAGES CONTROL]
-disable=C0323,W0142,C0301,C0103,C0111,E0213,C0302,C0203,W0703,R0201,W0223,bad-continuation,arguments-differ,unidiomatic-typecheck,unused-wildcard-import,no-member,cyclic-import
+disable=C0323,W0142,C0301,C0103,C0111,E0213,C0302,C0203,W0703,R0201,W0223,bad-continuation,arguments-differ,unidiomatic-typecheck,unused-wildcard-import,no-member,cyclic-import,too-few-public-methods,wildcard-import,too-many-locals,too-many-ancestors
[REPORTS]
output-format=colorized
diff --git a/fatcat/api.py b/fatcat/api.py
index 2f691f57..6e2c75a4 100644
--- a/fatcat/api.py
+++ b/fatcat/api.py
@@ -12,14 +12,14 @@ def get_or_create_edit_group():
editor = Editor.query.filter(Editor.id==1).first()
if editor.active_edit_group:
return editor.active_edit_group
- else:
- edit_group = EditGroup(editor=editor)
- db.session.add(edit_group)
- db.session.commit()
- editor.active_edit_group = edit_group
- db.session.add(editor)
- db.session.commit()
- return edit_group
+
+ edit_group = EditGroup(editor=editor)
+ db.session.add(edit_group)
+ db.session.commit()
+ editor.active_edit_group = edit_group
+ db.session.add(editor)
+ db.session.commit()
+ return edit_group
### Views ###################################################################
@@ -156,7 +156,7 @@ def api_file_create():
@app.route('/v0/editgroup/<int:ident>', methods=['GET'])
def api_edit_group_get(ident):
- entity = EditGroupIdent.query.filter(EditGroupIdent.id==ident).first_or_404()
+ entity = EditGroup.query.filter(EditGroup.id==ident).first_or_404()
return edit_group_schema.jsonify(entity)
@app.route('/v0/editgroup', methods=['POST'])
@@ -172,4 +172,3 @@ def api_edit_group_create():
db.session.add(eg)
db.session.commit()
return edit_group_schema.jsonify(eg)
-
diff --git a/fatcat/models.py b/fatcat/models.py
index 6c413dc7..81b35dd8 100644
--- a/fatcat/models.py
+++ b/fatcat/models.py
@@ -12,6 +12,8 @@ possible refactors:
- use mixins for entities
"""
+import json
+import hashlib
from marshmallow import post_dump
from fatcat import db, ma
@@ -271,7 +273,7 @@ class ExtraJsonSchema(ma.ModelSchema):
@post_dump(pass_many=False)
def unflatten(self, data):
- assert(hashlib.sha1sum(data['json']).hexdigest() == data['sha1'])
+ assert hashlib.sha1sum(data['json']).hexdigest() == data['sha1']
data.pop('sha1')
raw = data.pop('json')
data.update(json.loads(raw))
diff --git a/fatcat/sql.py b/fatcat/sql.py
index fb713269..cad4b763 100644
--- a/fatcat/sql.py
+++ b/fatcat/sql.py
@@ -77,4 +77,3 @@ def add_crossref_via_model(meta):
db.session.add_all(author_revs)
db.session.add_all(author_ids)
db.session.commit()
-