Skip to content

Commit bee4400

Browse files
address review comments
1 parent 5adc0d9 commit bee4400

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

src/_incydr_sdk/core/models.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,6 @@ def parse_json_lines(cls, file):
9393
f"Unable to parse line {num}. Expecting JSONLines format: https://jsonlines.org"
9494
)
9595

96-
# TODO[pydantic]: The following keys were removed: `json_encoders`.
97-
# Check https://docs.pydantic.dev/dev-v2/migration/#changes-to-config for more information.
9896
model_config = ConfigDict(
9997
populate_by_name=True,
10098
use_enum_values=True,

src/_incydr_sdk/utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ class Parent(BaseModel):
182182
model = type(model)
183183
for name, field in model.model_fields.items():
184184
model_field_type = _get_model_type(field.annotation)
185-
if _is_singleton(field.annotation) and issubclass(model_field_type, BaseModel):
185+
if _is_single(field.annotation) and issubclass(model_field_type, BaseModel):
186186
for child_name in flatten_fields(model_field_type):
187187
yield f"{name}.{child_name}"
188188
else:
@@ -228,12 +228,12 @@ def get_fields(
228228
)
229229

230230

231-
def _is_singleton(type) -> bool:
231+
def _is_single(type) -> bool:
232232
"""Returns `true` if the given type is a single object (for example, Union[int, str]);
233233
returns false if it is a list (e.g. Union[List[int], List[str]])"""
234234
origin = get_origin(type) if get_origin(type) else type
235235
if origin == Union:
236-
return all([_is_singleton(item) for item in get_args(type)])
236+
return all([_is_single(item) for item in get_args(type)])
237237
if origin in (list, tuple, set):
238238
return False
239239
return True

0 commit comments

Comments
 (0)