Skip to content

Commit 1d79a49

Browse files
committed
Use [flake8](https://flake8.pycqa.org/) to lint code.
1 parent 8d8c456 commit 1d79a49

File tree

24 files changed

+79
-116
lines changed

24 files changed

+79
-116
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
### 1.1.2
2+
- Use [flake8](https://flake8.pycqa.org/) to lint code.
3+
14
### 1.1.1
25
- [Black](https://github.com/psf/black) code style.
36
- Support [MergeTree settings](https://clickhouse.com/docs/en/engines/table-engines/mergetree-family/mergetree#settings) in creating table.

clickhouse_backend/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
VERSION = (1, 1, 1)
1+
VERSION = (1, 1, 2)
22

33
__version__ = ".".join(map(str, VERSION))

clickhouse_backend/backend/creation.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import sys
22

33
from clickhouse_driver.errors import ErrorCodes
4-
from django.conf import settings
54
from django.db.backends.base.creation import BaseDatabaseCreation
65
from django.db.backends.utils import strip_quotes
76

clickhouse_backend/backend/operations.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -141,17 +141,17 @@ def unification_cast_sql(self, output_field):
141141
def date_extract_sql(self, lookup_type, sql, *args):
142142
# https://clickhouse.com/docs/en/sql-reference/functions/date-time-functions/
143143
if lookup_type == "iso_year":
144-
sql = f"toISOYear(%s)" % sql
144+
sql = "toISOYear(%s)" % sql
145145
elif lookup_type == "day":
146-
sql = f"toDayOfMonth(%s)" % sql
146+
sql = "toDayOfMonth(%s)" % sql
147147
elif lookup_type == "week":
148-
sql = f"toISOWeek(%s)" % sql
148+
sql = "toISOWeek(%s)" % sql
149149
elif lookup_type == "week_day":
150-
sql = f"modulo(toDayOfWeek(%s), 7) + 1" % sql
150+
sql = "modulo(toDayOfWeek(%s), 7) + 1" % sql
151151
elif lookup_type == "iso_week_day":
152-
sql = f"toDayOfWeek(%s)" % sql
152+
sql = "toDayOfWeek(%s)" % sql
153153
else:
154-
sql = f"to%s(%s)" % (lookup_type.capitalize(), sql)
154+
sql = "to%s(%s)" % (lookup_type.capitalize(), sql)
155155
if compat.dj_ge41:
156156
return sql, args[0]
157157
else:

clickhouse_backend/models/__init__.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
from clickhouse_backend.patch import patch_all
22

33
from .base import ClickhouseModel
4-
from .engines import *
5-
from .engines import __all__ as engines_all # NOQA
6-
from .fields import *
7-
from .fields import __all__ as fields_all # NOQA
8-
from .functions import *
9-
from .functions import __all__ as fucntions_all # NOQA
10-
from .indexes import *
11-
from .indexes import __all__ as indexes_all # NOQA
4+
from .engines import * # noqa: F401,F403
5+
from .engines import __all__ as engines_all
6+
from .fields import * # noqa: F401,F403
7+
from .fields import __all__ as fields_all
8+
from .functions import * # noqa: F401,F403
9+
from .functions import __all__ as fucntions_all
10+
from .indexes import * # noqa: F401,F403
11+
from .indexes import __all__ as indexes_all
1212

1313
__all__ = [
1414
"ClickhouseModel",

clickhouse_backend/models/fields/__init__.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@
99

1010
from clickhouse_backend.validators import MaxBytesValidator
1111

12-
from .array import *
12+
from .array import * # noqa: F403
1313
from .base import FieldMixin
14-
from .integer import *
15-
from .json import *
16-
from .map import *
17-
from .tuple import *
14+
from .integer import * # noqa: F403
15+
from .json import * # noqa: F403
16+
from .map import * # noqa: F403
17+
from .tuple import * # noqa: F403
1818

19-
__all__ = [
19+
__all__ = [ # noqa: F405
2020
"Int8Field",
2121
"UInt8Field",
2222
"Int16Field",
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
from .fields import *
1+
from .fields import * # noqa: F403
22
from .fields import __all__ as fields_all
3-
from .functions import *
3+
from .functions import * # noqa: F403
44
from .functions import __all__ as functions_all
5-
from .migrations import *
5+
from .migrations import * # noqa: F403
66
from .migrations import __all__ as migrations_all
77

88
__all__ = [
@@ -14,6 +14,6 @@
1414

1515

1616
def patch_all():
17-
patch_functions()
18-
patch_fields()
19-
patch_migrations()
17+
patch_functions() # noqa: F405
18+
patch_fields() # noqa: F405
19+
patch_migrations() # noqa: F405

docs/Fields.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,11 @@ Passing `null=True` will make a field [Nullable](https://clickhouse.com/docs/en/
5252

5353
Passing `low_cardinality=True` will make a field [LowCardinality](https://clickhouse.com/docs/en/sql-reference/data-types/lowcardinality).
5454

55-
Name of field class is always concat clickhouse date type name to `Field`.
55+
Name of field class is always concat clickhouse data type name to `Field`.
5656
For example, [DateTime64](https://clickhouse.com/docs/en/sql-reference/data-types/datetime64) field is named as `DateTime64Field`.
5757
All clickhouse fields are imported from `clickhouse_backend.models`
5858

59-
Supported date types are:
59+
Supported data types are:
6060

6161
- Float32/Float64
6262
- Int8/Int16/Int32/Int64/Int128/Int256
@@ -82,12 +82,12 @@ Fields importing path: `clickhouse_backend.models.[U]Int(8|16|32|64|128|256)Fiel
8282

8383
For example, UInt8 type is imported from `clickhouse_backend.models.UInt8Field`
8484

85-
Both Nullable and LowCardinality are supported for all int types.
85+
Both Nullable and LowCardinality are supported for all integer types.
8686

8787
All UInt types will have correct range validators.
8888

8989
For example, `clickhouse_backend.models.UInt16Field` have a range from 0 to 65535.
90-
As a contrast, `django.db.models.SmallIntegerField` have a range from 0 to 32767, causing half range waisted.
90+
As a contrast, `django.db.models.PositiveSmallIntegerField` have a range from 0 to 32767, causing half range waisted.
9191

9292

9393
### Float(32|64)

example/testapp/admin.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +0,0 @@
1-
from django.contrib import admin
2-
3-
# Register your models here.

example/testapp/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from django.db.models import CheckConstraint, Func, IntegerChoices, Q
1+
from django.db.models import CheckConstraint, IntegerChoices, Q
22
from django.utils import timezone
33

44
from clickhouse_backend import models

0 commit comments

Comments
 (0)