Skip to content

Commit 480258f

Browse files
sryzadanielgafni
authored andcommitted
support AbstractSet in dagster_model (dagster-io#22557)
## Summary & Motivation ## How I Tested These Changes
1 parent f9de8c1 commit 480258f

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

python_modules/dagster/dagster/_check/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2031,6 +2031,8 @@ def build_check_call_str(
20312031
return f'check.iterable_param({name}, "{name}", {_name(single)})'
20322032
elif origin is collections.abc.Mapping:
20332033
return f'check.mapping_param({name}, "{name}", {_name(pair_left)}, {_name(pair_right)})'
2034+
elif origin is collections.abc.Set:
2035+
return f'check.set_param({name}, "{name}", {_name(single)})'
20342036
elif origin in (UnionType, Union):
20352037
# optional
20362038
if pair_right is type(None):

python_modules/dagster/dagster_tests/general_tests/check_tests/test_check.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import sys
44
from collections import defaultdict
55
from contextlib import contextmanager
6-
from typing import Any, Dict, Iterable, List, Mapping, Optional, Sequence, Set, Union
6+
from typing import AbstractSet, Any, Dict, Iterable, List, Mapping, Optional, Sequence, Set, Union
77

88
import dagster._check as check
99
import pytest
@@ -1584,6 +1584,7 @@ class Bar: ...
15841584
(Sequence[str], ["a", "b"], [1, 2]),
15851585
(Iterable[str], ["a", "b"], [1, 2]),
15861586
(Set[str], {"a", "b"}, {1, 2}),
1587+
(AbstractSet[str], {"a", "b"}, {1, 2}),
15871588
(Dict[str, int], {"a": 1}, {1: "a"}),
15881589
(Mapping[str, int], {"a": 1}, {1: "a"}),
15891590
(Optional[int], None, "4"),

0 commit comments

Comments
 (0)