From 995cd4610dd5472bf6d9a5faf6559b7c8043783c Mon Sep 17 00:00:00 2001 From: rr- Date: Sat, 22 Oct 2016 14:43:52 +0200 Subject: [PATCH] server: drop old style class declarations --- server/szurubooru/func/cache.py | 4 ++-- server/szurubooru/func/images.py | 2 +- server/szurubooru/rest/context.py | 2 +- server/szurubooru/search/configs/base_search_config.py | 2 +- server/szurubooru/search/criteria.py | 2 +- server/szurubooru/search/executor.py | 2 +- server/szurubooru/search/parser.py | 4 ++-- server/szurubooru/search/tokens.py | 6 +++--- server/szurubooru/tests/conftest.py | 2 +- 9 files changed, 13 insertions(+), 13 deletions(-) diff --git a/server/szurubooru/func/cache.py b/server/szurubooru/func/cache.py index 148aa99..4b77554 100644 --- a/server/szurubooru/func/cache.py +++ b/server/szurubooru/func/cache.py @@ -1,14 +1,14 @@ from datetime import datetime -class LruCacheItem(object): +class LruCacheItem: def __init__(self, key, value): self.key = key self.value = value self.timestamp = datetime.utcnow() -class LruCache(object): +class LruCache: def __init__(self, length, delta=None): self.length = length self.delta = delta diff --git a/server/szurubooru/func/images.py b/server/szurubooru/func/images.py index f4040b2..c7dfb34 100644 --- a/server/szurubooru/func/images.py +++ b/server/szurubooru/func/images.py @@ -14,7 +14,7 @@ _SCALE_FIT_FMT = \ r'scale=iw*max({width}/iw\,{height}/ih):ih*max({width}/iw\,{height}/ih)' -class Image(object): +class Image: def __init__(self, content): self.content = content self._reload_info() diff --git a/server/szurubooru/rest/context.py b/server/szurubooru/rest/context.py index 3bc2705..6f74a4c 100644 --- a/server/szurubooru/rest/context.py +++ b/server/szurubooru/rest/context.py @@ -25,7 +25,7 @@ def _param_wrapper(func): return wrapper -class Context(): +class Context: def __init__(self, method, url, headers=None, params=None, files=None): self.method = method self.url = url diff --git a/server/szurubooru/search/configs/base_search_config.py b/server/szurubooru/search/configs/base_search_config.py index c6ccace..adc50d3 100644 --- a/server/szurubooru/search/configs/base_search_config.py +++ b/server/szurubooru/search/configs/base_search_config.py @@ -1,7 +1,7 @@ from szurubooru.search import tokens -class BaseSearchConfig(object): +class BaseSearchConfig: SORT_ASC = tokens.SortToken.SORT_ASC SORT_DESC = tokens.SortToken.SORT_DESC diff --git a/server/szurubooru/search/criteria.py b/server/szurubooru/search/criteria.py index 7db2fe8..9d4dc66 100644 --- a/server/szurubooru/search/criteria.py +++ b/server/szurubooru/search/criteria.py @@ -1,4 +1,4 @@ -class _BaseCriterion(object): +class _BaseCriterion: def __init__(self, original_text): self.original_text = original_text diff --git a/server/szurubooru/search/executor.py b/server/szurubooru/search/executor.py index 39b1d56..e1ee53a 100644 --- a/server/szurubooru/search/executor.py +++ b/server/szurubooru/search/executor.py @@ -20,7 +20,7 @@ def _get_order(order, default_order): return order -class Executor(object): +class Executor: ''' Class for search parsing and execution. Handles plaintext parsing and delegates sqlalchemy filter decoration to SearchConfig instances. diff --git a/server/szurubooru/search/parser.py b/server/szurubooru/search/parser.py index f610b3b..33b4117 100644 --- a/server/szurubooru/search/parser.py +++ b/server/szurubooru/search/parser.py @@ -67,7 +67,7 @@ def _parse_sort(value, negated): return tokens.SortToken(value, order) -class SearchQuery(): +class SearchQuery: def __init__(self): self.anonymous_tokens = [] self.named_tokens = [] @@ -82,7 +82,7 @@ class SearchQuery(): tuple(self.sort_tokens))) -class Parser(object): +class Parser: def parse(self, query_text): query = SearchQuery() for chunk in re.split(r'\s+', (query_text or '').lower()): diff --git a/server/szurubooru/search/tokens.py b/server/szurubooru/search/tokens.py index e723fe5..cff7dc5 100644 --- a/server/szurubooru/search/tokens.py +++ b/server/szurubooru/search/tokens.py @@ -1,4 +1,4 @@ -class AnonymousToken(object): +class AnonymousToken: def __init__(self, criterion, negated): self.criterion = criterion self.negated = negated @@ -16,7 +16,7 @@ class NamedToken(AnonymousToken): return hash((self.name, self.criterion, self.negated)) -class SortToken(object): +class SortToken: SORT_DESC = 'desc' SORT_ASC = 'asc' SORT_DEFAULT = 'default' @@ -30,7 +30,7 @@ class SortToken(object): return hash((self.name, self.order)) -class SpecialToken(object): +class SpecialToken: def __init__(self, value, negated): self.value = value self.negated = negated diff --git a/server/szurubooru/tests/conftest.py b/server/szurubooru/tests/conftest.py index 49f9a17..642ac6a 100644 --- a/server/szurubooru/tests/conftest.py +++ b/server/szurubooru/tests/conftest.py @@ -10,7 +10,7 @@ import sqlalchemy from szurubooru import config, db, rest -class QueryCounter(object): +class QueryCounter: def __init__(self): self._statements = []