Skip to content

Commit 6c297e4

Browse files
author
Augusto F. Hack
committed
mypy: made type checking opt-out
1 parent 49627ba commit 6c297e4

File tree

3 files changed

+167
-20
lines changed

3 files changed

+167
-20
lines changed

karapace/compatibility/jsonschema/checks.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,11 @@
129129
)
130130

131131

132-
def type_mismatch(reader_type, writer_type, location: List[str]) -> SchemaCompatibilityResult:
132+
def type_mismatch(
133+
reader_type: JSONSCHEMA_TYPES,
134+
writer_type: JSONSCHEMA_TYPES,
135+
location: List[str],
136+
) -> SchemaCompatibilityResult:
133137
return SchemaCompatibilityResult.incompatible(
134138
incompat_type=Incompatibility.type_changed,
135139
message=f"type {reader_type} is not compatible with type {writer_type}",
@@ -189,7 +193,11 @@ def compatibility(reader: Draft7Validator, writer: Draft7Validator) -> SchemaCom
189193

190194

191195
def check_simple_subschema(
192-
simplified_reader_schema, simplified_writer_schema, original_reader_type, original_writer_type, location
196+
simplified_reader_schema: Any,
197+
simplified_writer_schema: Any,
198+
original_reader_type: JSONSCHEMA_TYPES,
199+
original_writer_type: JSONSCHEMA_TYPES,
200+
location: List[str],
193201
) -> SchemaCompatibilityResult:
194202
rec_result = compatibility_rec(simplified_reader_schema, simplified_writer_schema, location)
195203
if is_compatible(rec_result):
@@ -307,7 +315,7 @@ def check_assertion_compatibility(
307315
)
308316

309317
# The type error below is due to a mypy bug for version 0.820 (issue #10131)
310-
if assertion_check.comparison(reader_value, writer_value): # type: ignore
318+
if assertion_check.comparison(reader_value, writer_value): # type: ignore[call-arg]
311319
result.add_incompatibility(
312320
incompat_type=assertion_check.error_when_restricting,
313321
message=assertion_check.error_msg_when_restricting.format(
@@ -816,7 +824,7 @@ def compatibility_subschemas(reader_schema, writer_schema, location: List[str])
816824
qty_of_required_compatible_subschemas = len_writer_subschemas
817825

818826
compatible_schemas_count = count_uniquely_compatible_schemas(
819-
reader_type,
827+
reader_type, # type: ignore
820828
reader_subschemas,
821829
writer_subschemas,
822830
subschema_location,

karapace/compatibility/jsonschema/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def normalize_schema(validator: Draft7Validator) -> Any:
1414
return normalize_schema_rec(validator, original_schema)
1515

1616

17-
def normalize_schema_rec(validator, original_schema) -> Any:
17+
def normalize_schema_rec(validator: Draft7Validator, original_schema: Any) -> Any:
1818
if isinstance(original_schema, (bool, str, float, int)) or original_schema is None:
1919
return original_schema
2020

mypy.ini

Lines changed: 154 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
[mypy]
22
python_version = 3.7
33
warn_redundant_casts = True
4-
5-
[mypy-karapace.*]
6-
ignore_errors = True
7-
8-
[mypy-karapace.avro_compatibility]
94
ignore_errors = False
105
disallow_untyped_defs = True
116
disallow_incomplete_defs = True
@@ -16,13 +11,157 @@ warn_no_return = True
1611
warn_unreachable = True
1712
strict_equality = True
1813

19-
[mypy-karapace.compatibility]
20-
ignore_errors = False
21-
disallow_untyped_defs = True
22-
disallow_incomplete_defs = True
23-
check_untyped_defs = True
24-
no_implicit_optional = True
25-
warn_unused_ignores = True
26-
warn_no_return = True
27-
warn_unreachable = True
28-
strict_equality = True
14+
[mypy-karapace.schema_registry_apis]
15+
ignore_errors = True
16+
17+
[mypy-karapace.karapace]
18+
ignore_errors = True
19+
20+
[mypy-karapace]
21+
ignore_errors = True
22+
23+
[mypy-karapace.version]
24+
ignore_errors = True
25+
26+
[mypy-karapace.compatibility.jsonschema.checks]
27+
disallow_untyped_defs = False
28+
disallow_incomplete_defs = False
29+
warn_unused_ignores = False
30+
31+
[mypy-karapace.constants]
32+
ignore_errors = True
33+
34+
[mypy-karapace.karapace_all]
35+
ignore_errors = True
36+
37+
[mypy-karapace.protobuf.one_of_element]
38+
ignore_errors = True
39+
40+
[mypy-karapace.protobuf.syntax]
41+
ignore_errors = True
42+
43+
[mypy-karapace.protobuf.field]
44+
ignore_errors = True
45+
46+
[mypy-karapace.protobuf.kotlin_wrapper]
47+
ignore_errors = True
48+
49+
[mypy-karapace.protobuf.io]
50+
ignore_errors = True
51+
52+
[mypy-karapace.protobuf.field_element]
53+
ignore_errors = True
54+
55+
[mypy-karapace.protobuf.proto_file_element]
56+
ignore_errors = True
57+
58+
[mypy-karapace.protobuf.compare_type_storage]
59+
ignore_errors = True
60+
61+
[mypy-karapace.protobuf.type_element]
62+
ignore_errors = True
63+
64+
[mypy-karapace.protobuf.enum_element]
65+
ignore_errors = True
66+
67+
[mypy-karapace.protobuf.encoding_variants]
68+
ignore_errors = True
69+
70+
[mypy-karapace.protobuf]
71+
ignore_errors = True
72+
73+
[mypy-karapace.protobuf.schema]
74+
ignore_errors = True
75+
76+
[mypy-karapace.protobuf.extensions_element]
77+
ignore_errors = True
78+
79+
[mypy-karapace.protobuf.protobuf_to_dict]
80+
ignore_errors = True
81+
82+
[mypy-karapace.protobuf.exception]
83+
ignore_errors = True
84+
85+
[mypy-karapace.protobuf.rpc_element]
86+
ignore_errors = True
87+
88+
[mypy-karapace.protobuf.option_reader]
89+
ignore_errors = True
90+
91+
[mypy-karapace.protobuf.option_element]
92+
ignore_errors = True
93+
94+
[mypy-karapace.protobuf.enum_constant_element]
95+
ignore_errors = True
96+
97+
[mypy-karapace.protobuf.compare_result]
98+
ignore_errors = True
99+
100+
[mypy-karapace.protobuf.location]
101+
ignore_errors = True
102+
103+
[mypy-karapace.protobuf.message_element]
104+
ignore_errors = True
105+
106+
[mypy-karapace.protobuf.syntax_reader]
107+
ignore_errors = True
108+
109+
[mypy-karapace.protobuf.utils]
110+
ignore_errors = True
111+
112+
[mypy-karapace.protobuf.extend_element]
113+
ignore_errors = True
114+
115+
[mypy-karapace.protobuf.reserved_element]
116+
ignore_errors = True
117+
118+
[mypy-karapace.protobuf.proto_type]
119+
ignore_errors = True
120+
121+
[mypy-karapace.protobuf.group_element]
122+
ignore_errors = True
123+
124+
[mypy-karapace.protobuf.service_element]
125+
ignore_errors = True
126+
127+
[mypy-karapace.protobuf.proto_parser]
128+
ignore_errors = True
129+
130+
[mypy-karapace.config]
131+
ignore_errors = True
132+
133+
[mypy-karapace.schema_reader]
134+
ignore_errors = True
135+
136+
[mypy-karapace.statsd]
137+
ignore_errors = True
138+
139+
[mypy-karapace.utils]
140+
ignore_errors = True
141+
142+
[mypy-karapace.rapu]
143+
ignore_errors = True
144+
145+
[mypy-karapace.serialization]
146+
ignore_errors = True
147+
148+
[mypy-karapace.master_coordinator]
149+
ignore_errors = True
150+
151+
[mypy-karapace.kafka_rest_apis.__main__]
152+
ignore_errors = True
153+
154+
[mypy-karapace.kafka_rest_apis.consumer_manager]
155+
ignore_errors = True
156+
157+
[mypy-karapace.kafka_rest_apis]
158+
ignore_errors = True
159+
160+
[mypy-karapace.kafka_rest_apis.admin]
161+
ignore_errors = True
162+
163+
[mypy-karapace.kafka_rest_apis.error_codes]
164+
ignore_errors = True
165+
166+
[mypy-karapace.schema_backup]
167+
ignore_errors = True

0 commit comments

Comments
 (0)