Skip to content

Commit 37bfa34

Browse files
fix syntax for 3.8
1 parent 0a9c099 commit 37bfa34

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

mindee/parsing/v2/field/object_field.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import TYPE_CHECKING, cast
1+
from typing import TYPE_CHECKING, Dict, cast
22
from mindee.parsing.common.string_dict import StringDict
33
from mindee.parsing.v2.field.base_field import BaseField
44
from mindee.parsing.v2.field.dynamic_field import FieldType
@@ -43,12 +43,11 @@ def multi_str(self) -> str:
4343
return out_str
4444

4545
@property
46-
def simple_fields(self) -> dict[str, "SimpleField"]:
46+
def simple_fields(self) -> Dict[str, "SimpleField"]:
4747
"""
4848
Extract and return all SimpleField fields from the `fields` attribute.
4949
5050
:return: A dictionary containing all fields that have a type of `FieldType.SIMPLE`.
51-
:rtype: dict[str, SimpleField]
5251
"""
5352
simple_fields = {}
5453
for field_key, field_value in self.fields.items():
@@ -57,14 +56,13 @@ def simple_fields(self) -> dict[str, "SimpleField"]:
5756
return simple_fields
5857

5958
@property
60-
def list_fields(self) -> dict[str, "ListField"]:
59+
def list_fields(self) -> Dict[str, "ListField"]:
6160
"""
6261
Retrieves all ListField fields from the `fields` attribute.
6362
6463
:return: A dictionary containing all fields of type `LIST`, with keys
6564
representing field keys and values being the corresponding field
6665
objects.
67-
:rtype: dict[str, ListField]
6866
"""
6967
list_fields = {}
7068
for field_key, field_value in self.fields.items():
@@ -73,13 +71,12 @@ def list_fields(self) -> dict[str, "ListField"]:
7371
return list_fields
7472

7573
@property
76-
def object_fields(self) -> dict[str, "ObjectField"]:
74+
def object_fields(self) -> Dict[str, "ObjectField"]:
7775
"""
7876
Retrieves all ObjectField fields from the `fields` attribute of the instance.
7977
8078
:returns: A dictionary containing fields of type `FieldType.OBJECT`. The keys represent
8179
the field names, and the values are corresponding ObjectField objects.
82-
:rtype: dict[str, ObjectField]
8380
"""
8481
object_fields = {}
8582
for field_key, field_value in self.fields.items():
@@ -94,7 +91,6 @@ def get_simple_field(self, field_name: str) -> "SimpleField":
9491
:param field_name: The name of the field to retrieve.
9592
:type field_name: str
9693
:return: The SimpleField object corresponding to the given field name.
97-
:rtype: SimpleField
9894
:raises ValueError: If the specified field is not of type SimpleField.
9995
"""
10096
if self.fields[field_name].field_type != FieldType.SIMPLE:
@@ -108,7 +104,6 @@ def get_list_field(self, field_name: str) -> "ListField":
108104
:param field_name: The name of the field to retrieve.
109105
:type field_name: str
110106
:return: The corresponding ``ListField`` for the given field name.
111-
:rtype: ListField
112107
:raises ValueError: If the field is not of type ``ListField``.
113108
"""
114109
if self.fields[field_name].field_type != FieldType.LIST:
@@ -122,7 +117,6 @@ def get_object_field(self, field_name: str) -> "ObjectField":
122117
:param field_name: The name of the field to retrieve.
123118
:type field_name: str
124119
:return: The `ObjectField` associated with the given field name.
125-
:rtype: ObjectField
126120
:raises ValueError: If the field specified by `field_name` is not an `ObjectField`.
127121
"""
128122
if self.fields[field_name].field_type != FieldType.OBJECT:

0 commit comments

Comments
 (0)