Skip to content

Commit

Permalink
rename to time partition key partitions subset
Browse files Browse the repository at this point in the history
  • Loading branch information
clairelin135 committed Nov 7, 2023
1 parent eaf34b9 commit a1344c0
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,7 @@ def less_than(self, partition_key1: str, partition_key2: str) -> bool:

@property
def partitions_subset_class(self) -> Type["PartitionsSubset"]:
return UnresolvedTimeWindowPartitionsSubset
return TimePartitionKeyPartitionsSubset

def empty_subset(self) -> "PartitionsSubset":
return self.partitions_subset_class.empty_subset(self)
Expand Down Expand Up @@ -1647,7 +1647,7 @@ def __eq__(self, other):
)


class UnresolvedTimeWindowPartitionsSubset(BaseTimeWindowPartitionsSubset):
class TimePartitionKeyPartitionsSubset(BaseTimeWindowPartitionsSubset):
def __init__(
self,
partitions_def: TimeWindowPartitionsDefinition,
Expand All @@ -1664,7 +1664,7 @@ def with_partition_keys(
self, partition_keys: Iterable[str]
) -> "BaseTimeWindowPartitionsSubset":
new_partitions = {*(self._included_partition_keys or []), *partition_keys}
return UnresolvedTimeWindowPartitionsSubset(
return TimePartitionKeyPartitionsSubset(
self._partitions_def,
included_partition_keys=new_partitions,
)
Expand Down Expand Up @@ -1744,10 +1744,10 @@ def __contains__(self, partition_key: str) -> bool:

def __eq__(self, other):
return (
isinstance(other, UnresolvedTimeWindowPartitionsSubset)
isinstance(other, TimePartitionKeyPartitionsSubset)
and self.partitions_def == other.partitions_def
and self._included_partition_keys == other._included_partition_keys
) or super(UnresolvedTimeWindowPartitionsSubset, self).__eq__(other)
) or super(TimePartitionKeyPartitionsSubset, self).__eq__(other)

@classmethod
def empty_subset(cls, partitions_def: PartitionsDefinition) -> "PartitionsSubset":
Expand All @@ -1764,7 +1764,7 @@ def with_partitions_def(
"num_partitions would become inaccurate if the partitions_defs had different cron"
" schedules",
)
return UnresolvedTimeWindowPartitionsSubset(
return TimePartitionKeyPartitionsSubset(
partitions_def=partitions_def,
included_partition_keys=self._included_partition_keys,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
from dagster._core.definitions.multi_dimensional_partitions import MultiPartitionsSubset
from dagster._core.definitions.partition import DefaultPartitionsSubset
from dagster._core.definitions.time_window_partitions import (
TimePartitionKeyPartitionsSubset,
TimeWindowPartitionsSubset,
UnresolvedTimeWindowPartitionsSubset,
)
from dagster._core.errors import DagsterInvalidDeserializationVersionError

Expand Down Expand Up @@ -78,4 +78,4 @@ def test_get_subset_type():
def test_empty_subsets():
assert type(composite.empty_subset()) is MultiPartitionsSubset
assert type(static_partitions.empty_subset()) is DefaultPartitionsSubset
assert type(time_window_partitions.empty_subset()) is UnresolvedTimeWindowPartitionsSubset
assert type(time_window_partitions.empty_subset()) is TimePartitionKeyPartitionsSubset
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
from dagster._core.definitions.time_window_partitions import (
BaseTimeWindowPartitionsSubset,
ScheduleType,
TimePartitionKeyPartitionsSubset,
TimeWindow,
TimeWindowPartitionsSubset,
UnresolvedTimeWindowPartitionsSubset,
)
from dagster._seven.compat.pendulum import create_pendulum_time
from dagster._utils.partitions import DEFAULT_HOURLY_FORMAT_WITHOUT_TIMEZONE
Expand Down Expand Up @@ -745,7 +745,7 @@ def test_start_not_aligned():

@pytest.mark.parametrize(
"partitions_subset_class",
[UnresolvedTimeWindowPartitionsSubset, TimeWindowPartitionsSubset],
[TimePartitionKeyPartitionsSubset, TimeWindowPartitionsSubset],
)
@pytest.mark.parametrize(
"case_str",
Expand Down Expand Up @@ -822,7 +822,7 @@ def test_time_partitions_subset_identical_serialization():

@pytest.mark.parametrize(
"partitions_subset_class",
[UnresolvedTimeWindowPartitionsSubset, TimeWindowPartitionsSubset],
[TimePartitionKeyPartitionsSubset, TimeWindowPartitionsSubset],
)
@pytest.mark.parametrize(
"initial, added",
Expand Down

0 comments on commit a1344c0

Please sign in to comment.