Fix lint check + update lint script (#224)

* Fix PEP8 E301 on nyaa/models.py

* Add utils/ to lint checker

* Run of lint.sh + manual fixes

As suggested https://github.com/nyaadevs/nyaa/pull/157#issuecomment-305051428

* Fix backwards tick in README

* Updated script

* Update Travis config
This commit is contained in:
Kfir Hadas
2017-06-01 14:40:33 +03:00
committed by Alex Ingram
parent 3e2437bba1
commit 3165389d52
6 changed files with 115 additions and 52 deletions

View File

@@ -67,12 +67,14 @@ class DeclarativeHelperBase(object):
class FlagProperty(object):
''' This class will act as a wrapper between the given flag and the class's
flag collection. '''
def __init__(self, flag, flags_attr='flags'):
self._flag = flag
self._flags_attr_name = flags_attr
def _get_flags(self, instance):
return getattr(instance, self._flags_attr_name)
def _set_flags(self, instance, value):
return setattr(instance, self._flags_attr_name, value)
@@ -140,13 +142,13 @@ class TorrentBase(DeclarativeHelperBase):
@declarative.declared_attr
def __table_args__(cls):
return (
Index(cls._table_prefix('uploader_flag_idx'), 'uploader_id', 'flags'),
ForeignKeyConstraint(
['main_category_id', 'sub_category_id'],
[cls._table_prefix('sub_categories.main_category_id'),
cls._table_prefix('sub_categories.id')]
), {}
)
Index(cls._table_prefix('uploader_flag_idx'), 'uploader_id', 'flags'),
ForeignKeyConstraint(
['main_category_id', 'sub_category_id'],
[cls._table_prefix('sub_categories.main_category_id'),
cls._table_prefix('sub_categories.id')]
), {}
)
@declarative.declared_attr
def user(cls):
@@ -419,7 +421,7 @@ class CommentBase(DeclarativeHelperBase):
@declarative.declared_attr
def torrent_id(cls):
return db.Column(db.Integer, db.ForeignKey(
cls._table_prefix('torrents.id'), ondelete='CASCADE'), nullable=False)
cls._table_prefix('torrents.id'), ondelete='CASCADE'), nullable=False)
@declarative.declared_attr
def user_id(cls):

View File

@@ -186,6 +186,7 @@ def search_elastic(term='', user=None, sort='id', order='desc',
class QueryPairCaller(object):
''' Simple stupid class to filter one or more queries with the same args '''
def __init__(self, *items):
self.items = list(items)