From 8befdef110d81673c05248f56b3420e9831ab285 Mon Sep 17 00:00:00 2001 From: Vladimir Viazovetskov Date: Sun, 26 Feb 2023 11:26:22 +0300 Subject: [PATCH] Fix formatting; publish. --- .pre-commit-config.yaml | 4 ++-- pydjantic/__init__.py | 2 +- pydjantic/pydjantic.py | 8 +++++++- pyproject.toml | 2 +- tests/test_db_config.py | 6 +++--- 5 files changed, 14 insertions(+), 8 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 998ea34..10ec3ee 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/psf/black - rev: 22.12.0 + rev: 23.1.0 hooks: - id: black args: [--line-length=110, --skip-string-normalization] @@ -25,6 +25,6 @@ repos: - id: debug-statements - repo: https://github.com/pre-commit/mirrors-mypy - rev: v0.991 + rev: v1.0.1 hooks: - id: mypy diff --git a/pydjantic/__init__.py b/pydjantic/__init__.py index 3a650e3..60c3e9e 100644 --- a/pydjantic/__init__.py +++ b/pydjantic/__init__.py @@ -1,5 +1,5 @@ from pydjantic.pydjantic import BaseDBConfig, to_django -__version__ = "0.10.0" +__version__ = "0.11.0" __all__ = ("BaseDBConfig", "to_django") diff --git a/pydjantic/pydjantic.py b/pydjantic/pydjantic.py index e2b9e0d..c0a9de1 100644 --- a/pydjantic/pydjantic.py +++ b/pydjantic/pydjantic.py @@ -18,7 +18,13 @@ def format_config_from_dsn(cls, value: Optional[str], field: ModelField): kwargs = {} # dj_database_url.parse does not accept **kwargs, so we can't blindly feed it with everything # https://github.com/jazzband/dj-database-url/blob/master/dj_database_url.py#L79 - known_dj_database_url_kwargs = ['engine', 'conn_max_age', 'conn_health_checks', 'ssl_require', 'test_options'] + known_dj_database_url_kwargs = [ + 'engine', + 'conn_max_age', + 'conn_health_checks', + 'ssl_require', + 'test_options', + ] for kwarg in known_dj_database_url_kwargs: field_extra = field.field_info.extra.get(kwarg) if field_extra is not None: diff --git a/pyproject.toml b/pyproject.toml index 2c0eefb..ea6fa3d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "pydjantic" -version = "0.10.0" +version = "0.11.0" description = "Pydantic Settings for Django" authors = ["Vladimir Vyazovetskov "] license = "MIT" diff --git a/tests/test_db_config.py b/tests/test_db_config.py index ec07c7b..6896323 100644 --- a/tests/test_db_config.py +++ b/tests/test_db_config.py @@ -54,7 +54,7 @@ class DatabaseConfig(BaseDBConfig): 'PASSWORD': 'password', 'PORT': 5432, 'USER': 'user', - 'TEST': {'NAME': 'mytestdb'} + 'TEST': {'NAME': 'mytestdb'}, } @@ -85,7 +85,7 @@ class DatabaseConfig(BaseSettings): 'PORT': 5432, 'OPTIONS': {}, 'CONN_MAX_AGE': 0, - 'CONN_HEALTH_CHECKS': False + 'CONN_HEALTH_CHECKS': False, } } @@ -143,6 +143,6 @@ class DatabaseConfig(BaseSettings): 'PORT': 5432, 'OPTIONS': {'sslmode': 'require'}, 'CONN_MAX_AGE': 60, - 'CONN_HEALTH_CHECKS': False + 'CONN_HEALTH_CHECKS': False, }, }