Skip to content

Commit f1839a5

Browse files
committed
Consolidate package config to pyproject.toml
1 parent 5300abd commit f1839a5

File tree

108 files changed

+591
-581
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

108 files changed

+591
-581
lines changed

.github/workflows/build.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,6 @@ jobs:
2525
container:
2626
- image: python:latest
2727
toxenv: lint
28-
- image: python:3.6
29-
toxenv: py36-sqla12
30-
- image: python:3.6
31-
toxenv: py36-sqla13
32-
- image: python:3.6
33-
toxenv: py36-sqla14
3428
- image: python:3.7
3529
toxenv: py37-sqla12
3630
- image: python:3.7

.pre-commit-config.yaml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
11
---
22
repos:
33

4-
- repo: https://github.com/miki725/importanize
5-
rev: '0.7'
6-
hooks:
7-
- id: importanize
8-
language_version: python3
9-
104
- repo: https://github.com/psf/black
115
rev: 22.6.0
126
hooks:
137
- id: black
148
language_version: python3
159

10+
11+
- repo: https://github.com/pycqa/isort
12+
rev: 5.10.1
13+
hooks:
14+
- id: isort
15+
name: isort (python)
16+
1617
- repo: https://github.com/asottile/pyupgrade
1718
rev: v2.37.3
1819
hooks:
1920
- id: pyupgrade
2021
args: [--py3-plus]
2122

2223
- repo: https://github.com/myint/docformatter
23-
rev: v1.4
24+
rev: v1.5.0-rc1
2425
hooks:
2526
- id: docformatter
2627

27-
- repo: https://github.com/PyCQA/flake8
28-
rev: 5.0.2
28+
- repo: https://github.com/flakeheaven/flakeheaven
29+
rev: 3.0.0
2930
hooks:
30-
- id: flake8
31-
exclude: deployment/roles
31+
- id: flakeheaven
3232
additional_dependencies:
3333
- flake8-bugbear
3434
- flake8-comprehensions

Dockerfile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,11 @@ USER sorcerer
1818
ENV PATH=/opt/pyenv/bin:/home/sorcerer/.pyenv/shims:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
1919
WORKDIR /code
2020

21-
RUN pyenv install 3.6:latest
2221
RUN pyenv install 3.7:latest
2322
RUN pyenv install 3.8:latest
2423
RUN pyenv install 3.9:latest
2524
RUN pyenv install 3.10:latest
2625

27-
RUN pyenv install pypy3.6:latest
2826
RUN pyenv install pypy3.7:latest
2927
RUN pyenv install pypy3.8:latest
3028

MANIFEST.in

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ include *.txt
77
include *.yaml *.yml
88
include LICENSE
99
include Makefile
10-
include pytest.ini
1110
include tox.ini
1211
include Dockerfile
1312
exclude .*

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ next: # print next version
8080
@echo $(NEXT)
8181

8282
bump: history
83-
@sed -i 's/$(VERSION)/$(NEXT)/g' $(PACKAGE)/__version__.py
83+
@sed -i 's/$(VERSION)/$(NEXT)/g' $(PACKAGE)/__init__.py
8484
@sed -i 's/Next version (unreleased yet)/$(NEXT) ($(shell date +"%Y-%m-%d"))/g' HISTORY.rst
8585
@git add .
8686
@git commit -am "Bump version: $(VERSION)$(NEXT)"

django_sorcery/__init__.py

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,3 @@
1-
from .__version__ import (
2-
__author__,
3-
__author_email__,
4-
__description__,
5-
__version__,
6-
)
1+
__version__ = "0.12.0"
72

8-
9-
__all__ = [
10-
"__author__",
11-
"__author_email__",
12-
"__description__",
13-
"__version__",
14-
]
3+
VERSION = tuple(__version__.split("."))

django_sorcery/__version__.py

Lines changed: 0 additions & 4 deletions
This file was deleted.

django_sorcery/db/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,5 +141,4 @@
141141
from .sqlalchemy import SQLAlchemy # noqa
142142
from .utils import dbdict
143143

144-
145144
databases = dbdict()

django_sorcery/db/fields.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
from .url import DIALECT_MAP_TO_DJANGO
1212

13-
1413
__all__ = [
1514
"BigIntegerField",
1615
"BinaryField",
@@ -46,11 +45,8 @@ class Field(sa.Column):
4645
def __init__(self, *args, **kwargs):
4746
self.db = kwargs.pop("db", None)
4847

49-
name = None
5048
args = list(args)
51-
if args and isinstance(args[0], str):
52-
name = args.pop(0)
53-
49+
name = args.pop(0) if args and isinstance(args[0], str) else None
5450
column_type = kwargs.pop("type_", None)
5551
if args and hasattr(args[0], "_sqla_type"):
5652
column_type = args.pop(0)
@@ -267,7 +263,7 @@ def get_django_dialect_ranges(self):
267263
ops = operations.BaseDatabaseOperations
268264
with suppress(ImportError):
269265
ops = (
270-
import_string(DIALECT_MAP_TO_DJANGO.get(self.db.url.get_dialect().name) + ".base.DatabaseOperations")
266+
import_string(f"{DIALECT_MAP_TO_DJANGO.get(self.db.url.get_dialect().name)}.base.DatabaseOperations")
271267
if self.db
272268
else operations.BaseDatabaseOperations
273269
)

django_sorcery/db/meta/column.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
import enum
55
from contextlib import suppress
66

7-
import sqlalchemy as sa
87
from dateutil.parser import parse
8+
import sqlalchemy as sa
99
from django import forms as djangoforms
1010
from django.conf import settings
1111
from django.core import validators as djangovalidators
@@ -166,7 +166,7 @@ def clean(self, value, instance):
166166

167167
def validate(self, value, instance):
168168
"""Validate value and raise ValidationError if necessary."""
169-
getattr(instance, "clean_" + self.name, bool)()
169+
getattr(instance, f"clean_{self.name}", bool)()
170170

171171
def run_validators(self, value):
172172
"""Run field's validators and raise ValidationError if necessary."""
@@ -194,9 +194,7 @@ def __init__(self, column, prop=None, parent=None, name=None):
194194
self.field_kwargs["max_length"] = self.column.type.length
195195

196196
def to_python(self, value):
197-
if value is None:
198-
return value
199-
return str(value).strip()
197+
return value if value is None else str(value).strip()
200198

201199

202200
class text_column_info(string_column_info):
@@ -324,9 +322,7 @@ def to_python(self, value):
324322
return bool(value)
325323
if value in ("t", "T"):
326324
return True
327-
if value in ("f", "F"):
328-
return False
329-
return self.coercer.to_python(value)
325+
return False if value in ("f", "F") else self.coercer.to_python(value)
330326

331327

332328
class date_column_info(column_info):

0 commit comments

Comments
 (0)