mirror of
https://github.com/simon987/nyaa.git
synced 2025-12-14 07:39:03 +00:00
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:
@@ -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):
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user