Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DS][14/n] Remove unused methods and properties #21535

Merged
merged 1 commit into from
May 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -309,36 +309,10 @@ def __or__(self, other: "AssetCondition") -> "AssetCondition":
def __invert__(self) -> "AssetCondition":
return NotAssetCondition(operand=self)

@property
def is_legacy(self) -> bool:
"""Returns if this condition is in the legacy format. This is used to determine if we can
do certain types of backwards-compatible operations on it.
"""
return (
isinstance(self, AndAssetCondition)
and len(self.children) in {2, 3}
and isinstance(self.children[0], OrAssetCondition)
and isinstance(self.children[1], NotAssetCondition)
# the third child is the discard condition, which is optional
and (len(self.children) == 2 or isinstance(self.children[2], NotAssetCondition))
)

@property
def children(self) -> Sequence["AssetCondition"]:
return []

@property
def not_skip_condition(self) -> Optional["AssetCondition"]:
if not self.is_legacy:
return None
return self.children[1]

@property
def not_discard_condition(self) -> Optional["AssetCondition"]:
if not self.is_legacy or not len(self.children) == 3:
return None
return self.children[-1]

def get_snapshot(self, unique_id: str) -> AssetConditionSnapshot:
"""Returns a snapshot of this condition that can be used for serialization."""
return AssetConditionSnapshot(
Expand Down