Skip to content

Commit

Permalink
[style] Use is to compare types (#2317)
Browse files Browse the repository at this point in the history
  • Loading branch information
vil02 authored Feb 20, 2025
1 parent dbaa377 commit 431a490
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion fixcore/fixcore/model/typed_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def type_fqn(tpe: type) -> str:


def from_js(json: JsonElement, clazz: Type[AnyT]) -> AnyT:
return jsons.load(json, cls=clazz) if clazz != dict else json # type: ignore
return jsons.load(json, cls=clazz) if clazz is not dict else json # type: ignore


def to_js(node: Any, **kwargs: Any) -> Json:
Expand Down
4 changes: 2 additions & 2 deletions fixlib/test/core/model_export_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ def test_collection() -> None:
assert is_collection(list) is True
assert is_collection(dict) is False

assert type_arg(Optional[List[int]]) == int
assert type_arg(List[datetime]) == datetime
assert type_arg(Optional[List[int]]) is int
assert type_arg(List[datetime]) is datetime


def test_dictionary() -> None:
Expand Down
2 changes: 1 addition & 1 deletion plugins/azure/tools/azure_model_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ def fill_sequence(seq, index, value_index_type):
while len(seq) < index:
seq.append(None)

if value_index_type == int:
if value_index_type is int:
seq.append([])
elif value_index_type is None:
seq.append(None)
Expand Down

0 comments on commit 431a490

Please sign in to comment.