Skip to content

Commit 5b80c97

Browse files
committed
Linting exemptions
1 parent 35b5a6a commit 5b80c97

9 files changed

+11
-5
lines changed

schemey/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
CONFIG_MODULE_PREFIX = "schemey_config_"
1414

1515

16+
# pylint: disable=W0603
1617
def get_default_schema_context() -> SchemaContext:
1718
global _default_context
1819
if not _default_context:

schemey/factory/array_schema_factory.py

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ def from_type(
1818
ref_schemas: Dict[Type, Schema],
1919
) -> Optional[Schema]:
2020
array_type = self.get_array_type(type_)
21+
# pylint: disable=W0125
2122
if array_type:
2223
schema = {"type": "array"}
2324
args = typing_inspect.get_args(type_)

schemey/factory/dataclass_schema_factory.py

+1
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ def from_type(
6161
schema = Schema(schema, type_)
6262
return schema
6363

64+
# pylint: disable=R0914
6465
def from_json(
6566
self,
6667
item: ExternalItemType,

schemey/factory/enum_schema_factory.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def from_type(
2323
) -> Optional[Schema]:
2424
if isclass(type_) and issubclass(type_, Enum):
2525
# noinspection PyTypeChecker
26-
schema = dict(name=type_.__name__, enum=[e.name for e in type_])
26+
schema = {"name": type_.__name__, "enum": [e.name for e in type_]}
2727
return Schema(schema, type_)
2828

2929
def from_json(

schemey/factory/external_type_factory.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def from_type(
2020
) -> Optional[Schema]:
2121
if type_ == ExternalItemType:
2222
return Schema({"type": "object", "additionalProperties": True}, type_)
23-
elif type_ == ExternalType:
23+
if type_ == ExternalType:
2424
return Schema({}, type_)
2525

2626
def from_json(

schemey/json_schema/ranges.py

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ def ranges(validator, aP, instance, schema):
3333
continue
3434
if allow_equal and min_value == max_value:
3535
continue
36+
# pylint: disable=R0801
3637
yield ValidationError(
3738
f"Value not in future: {instance}",
3839
validator=validator,

schemey/json_schema/timestamp.py

+1
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ def timestamp(validator, aP, instance, schema):
6363
)
6464
else:
6565
if value < (now - grace_period_seconds):
66+
# pylint: disable=R0801
6667
yield ValidationError(
6768
f"Value not in future: {instance}",
6869
validator=validator,

schemey/schema.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -106,12 +106,12 @@ def datetime_schema():
106106

107107
def optional_schema(schema: Schema):
108108
"""Wrap a simple schema in an optional schema. Does NOT work for schemas which contain refs."""
109-
json_schema = dict(
110-
anyOf=[
109+
json_schema = {
110+
"anyOf": [
111111
{"type": "null"},
112112
schema.schema,
113113
]
114-
)
114+
}
115115
return Schema(json_schema, Optional[schema.python_type])
116116

117117

schemey/validated.py

+1
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ def validated(cls: Type[T], schema_context: Optional[SchemaContext] = None):
5959
schema_context = get_default_schema_context()
6060

6161
def wrap(cls_):
62+
# pylint: disable=C0415,R0401
6263
from schemey.validator import Validator
6364

6465
if not dataclasses.is_dataclass(cls_):

0 commit comments

Comments
 (0)