Skip to content

Commit

Permalink
explain why re-declaring the value field is necessary
Browse files Browse the repository at this point in the history
  • Loading branch information
cosmicexplorer committed Oct 12, 2020
1 parent 6071fc4 commit 44fc0c4
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/python/pants/engine/target.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,9 @@ def sanitize_raw_value(cls, raw_value: Optional[int], *, address: Address) -> Op
)
return value_or_default
"""
# NB: @dataclass requires redeclaring all fields in order for them to be considered in its
# generated __hash__() implementation.
value: _DefaultBase

@final
def __init__(self, raw_value: Optional[Any], *, address: Address) -> None:
Expand Down Expand Up @@ -217,6 +220,9 @@ def rules():
"""

address: Address
# NB: @dataclass requires redeclaring all fields in order for them to be considered in its
# generated __hash__() implementation.
value: _DefaultBase

@final
def __init__(self, raw_value: Optional[Any], *, address: Address) -> None:
Expand Down

0 comments on commit 44fc0c4

Please sign in to comment.