Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jul 1, 2024
1 parent 0c7597e commit 8859043
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 19 deletions.
1 change: 0 additions & 1 deletion jsonmodels/builders.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Builders to generate in memory representation of model and fields tree."""


from collections import defaultdict

from . import errors
Expand Down
1 change: 0 additions & 1 deletion jsonmodels/collections.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
class ModelCollection(list):

"""`ModelCollection` is list which validates stored values.
Validation is made with use of field passed to `__init__` at each point,
Expand Down
11 changes: 0 additions & 11 deletions jsonmodels/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@


class BaseField:

"""Base class for all fields."""

types = None
Expand Down Expand Up @@ -142,14 +141,12 @@ def structue_name(self, default):


class StringField(BaseField):

"""String field."""

types = (str,)


class IntField(BaseField):

"""Integer field."""

types = (int,)
Expand All @@ -163,14 +160,12 @@ def parse_value(self, value):


class FloatField(BaseField):

"""Float field."""

types = (float, int)


class BoolField(BaseField):

"""Bool field."""

types = (bool,)
Expand All @@ -182,14 +177,12 @@ def parse_value(self, value):


class DictField(BaseField):

"""Dict field."""

types = (dict,)


class ListField(BaseField):

"""List field."""

types = (list,)
Expand Down Expand Up @@ -300,7 +293,6 @@ def to_struct(self, values):


class EmbeddedField(BaseField):

"""Field for embedded models."""

def __init__(self, model_types, *args, **kwargs):
Expand Down Expand Up @@ -403,7 +395,6 @@ def _import(module_name, type_name):


class TimeField(StringField):

"""Time field."""

types = (datetime.time,)
Expand Down Expand Up @@ -434,7 +425,6 @@ def parse_value(self, value):


class DateField(StringField):

"""Date field."""

types = (datetime.date,)
Expand Down Expand Up @@ -466,7 +456,6 @@ def parse_value(self, value):


class DateTimeField(StringField):

"""Datetime field."""

types = (datetime.datetime,)
Expand Down
1 change: 0 additions & 1 deletion jsonmodels/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ def validate_fields(attributes):


class Base(metaclass=JsonmodelMeta):

"""Base class for all models."""

def __init__(self, **kwargs):
Expand Down
1 change: 1 addition & 0 deletions jsonmodels/parsers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Parsers to change model structure into different ones."""

import inspect

from . import builders, errors, fields
Expand Down
6 changes: 1 addition & 5 deletions jsonmodels/validators.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Predefined validators."""

import re
from functools import reduce

Expand All @@ -7,7 +8,6 @@


class Min:

"""Validator for minimum value."""

def __init__(self, minimum_value, exclusive=False):
Expand Down Expand Up @@ -41,7 +41,6 @@ def modify_schema(self, field_schema):


class Max:

"""Validator for maximum value."""

def __init__(self, maximum_value, exclusive=False):
Expand Down Expand Up @@ -75,7 +74,6 @@ def modify_schema(self, field_schema):


class Regex:

"""Validator for regular expressions."""

FLAGS = {
Expand Down Expand Up @@ -134,7 +132,6 @@ def modify_schema(self, field_schema):


class Length:

"""Validator for length."""

def __init__(self, minimum_value=None, maximum_value=None):
Expand Down Expand Up @@ -186,7 +183,6 @@ def modify_schema(self, field_schema):


class Enum:

"""Validator for enums."""

def __init__(self, *choices):
Expand Down

0 comments on commit 8859043

Please sign in to comment.