Skip to content

Commit

Permalink
Remove unused fields
Browse files Browse the repository at this point in the history
  • Loading branch information
OwenKephart committed May 2, 2024
1 parent 497e409 commit c165544
Showing 1 changed file with 0 additions and 26 deletions.
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

0 comments on commit c165544

Please sign in to comment.