From f8cddf3b11690179bd3bc9e2b9dee8fd6bb6431d Mon Sep 17 00:00:00 2001 From: konstantin Date: Sun, 9 Oct 2022 21:22:07 +0200 Subject: [PATCH 1/2] =?UTF-8?q?Apply=20`=C3=ACsort`=20to=20entire=20code?= =?UTF-8?q?=20base?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- example/example.py | 1 + marshmallow_jsonschema/base.py | 6 ++---- marshmallow_jsonschema/extensions/__init__.py | 1 - setup.py | 3 +-- tests/test_additional_properties.py | 5 +++-- tests/test_dump.py | 1 + tests/test_imports.py | 1 + tests/test_validation.py | 1 + 8 files changed, 10 insertions(+), 9 deletions(-) diff --git a/example/example.py b/example/example.py index 741648c..3f42d6d 100644 --- a/example/example.py +++ b/example/example.py @@ -1,5 +1,6 @@ from flask import Flask, jsonify from marshmallow import Schema, fields + from marshmallow_jsonschema import JSONSchema app = Flask(__name__) diff --git a/marshmallow_jsonschema/base.py b/marshmallow_jsonschema/base.py index 700cae4..f4d1276 100644 --- a/marshmallow_jsonschema/base.py +++ b/marshmallow_jsonschema/base.py @@ -1,17 +1,15 @@ import datetime import decimal +import typing import uuid from enum import Enum from inspect import isclass -import typing -from marshmallow import fields, missing, Schema, validate +from marshmallow import EXCLUDE, INCLUDE, RAISE, Schema, fields, missing, validate from marshmallow.class_registry import get_class from marshmallow.decorators import post_dump from marshmallow.utils import _Missing -from marshmallow import INCLUDE, EXCLUDE, RAISE - try: from marshmallow_union import Union diff --git a/marshmallow_jsonschema/extensions/__init__.py b/marshmallow_jsonschema/extensions/__init__.py index f909f3e..6a67016 100644 --- a/marshmallow_jsonschema/extensions/__init__.py +++ b/marshmallow_jsonschema/extensions/__init__.py @@ -1,4 +1,3 @@ from .react_jsonschema_form import ReactJsonSchemaFormJSONSchema - __all__ = ("ReactJsonSchemaFormJSONSchema",) diff --git a/setup.py b/setup.py index 4974e20..f1d555c 100644 --- a/setup.py +++ b/setup.py @@ -1,8 +1,7 @@ import io import os -from setuptools import setup, find_packages - +from setuptools import find_packages, setup PROJECT_DIR = os.path.dirname(os.path.abspath(__file__)) diff --git a/tests/test_additional_properties.py b/tests/test_additional_properties.py index c88c450..702bc3b 100644 --- a/tests/test_additional_properties.py +++ b/tests/test_additional_properties.py @@ -1,7 +1,8 @@ import pytest -from marshmallow import Schema, fields, RAISE, INCLUDE, EXCLUDE +from marshmallow import EXCLUDE, INCLUDE, RAISE, Schema, fields + +from marshmallow_jsonschema import JSONSchema, UnsupportedValueError -from marshmallow_jsonschema import UnsupportedValueError, JSONSchema from . import validate_and_dump diff --git a/tests/test_dump.py b/tests/test_dump.py index b1d53d5..fe0b21a 100644 --- a/tests/test_dump.py +++ b/tests/test_dump.py @@ -7,6 +7,7 @@ from marshmallow_union import Union from marshmallow_jsonschema import JSONSchema, UnsupportedValueError + from . import UserSchema, validate_and_dump diff --git a/tests/test_imports.py b/tests/test_imports.py index 17494d8..fdee771 100644 --- a/tests/test_imports.py +++ b/tests/test_imports.py @@ -1,4 +1,5 @@ import importlib + import marshmallow_jsonschema diff --git a/tests/test_validation.py b/tests/test_validation.py index c8222bd..6fd891c 100644 --- a/tests/test_validation.py +++ b/tests/test_validation.py @@ -7,6 +7,7 @@ from marshmallow_union import Union from marshmallow_jsonschema import JSONSchema, UnsupportedValueError + from . import UserSchema, validate_and_dump From a69de273718cf73b6a5dc985c9d6f6cd683b5ac7 Mon Sep 17 00:00:00 2001 From: konstantin Date: Sun, 9 Oct 2022 21:22:28 +0200 Subject: [PATCH 2/2] Add isort as test-requirement and harmonize isort with black --- pyproject.toml | 3 +++ requirements-test.txt | 1 + 2 files changed, 4 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 36619cc..c40f43f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,2 +1,5 @@ [tool.black] target-version = ['py36', 'py37', 'py38'] + +[tool.isort] +profile = "black" diff --git a/requirements-test.txt b/requirements-test.txt index 60896eb..b67d436 100644 --- a/requirements-test.txt +++ b/requirements-test.txt @@ -8,3 +8,4 @@ marshmallow-union mypy>=0.910 pre-commit~=2.15 +isort