Skip to content

Commit

Permalink
fix type issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
kaos committed May 23, 2024
1 parent 565748c commit d8af6ee
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/python/pants/engine/internals/native_engine.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ class FieldDefaultValue:

value: ImmutableValue

def __init__(self, value: ImmutableValue) -> None: ...
def __repr__(self) -> str: ...
def __str__(self) -> str: ...

Expand Down
7 changes: 3 additions & 4 deletions src/python/pants/engine/target_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -474,14 +474,13 @@ def test_target_residence_dir() -> None:

def test_field_dynamic_default() -> None:
class SomeField(Field):
alias: str = "some"
default: str = "some-default"
alias: ClassVar[str] = "some"
default: ClassVar[str] = "some-default"

@classmethod
def compute_value(cls, raw_value: Optional[str], address: Address) -> str:
value_or_default = super().compute_value(raw_value, address)
print(f"compute {raw_value=}, {value_or_default=}")
assert not isinstance(value_or_default, FieldDefaultValue)
assert isinstance(value_or_default, str)
return value_or_default

def check_field(fld: SomeField, value: str, default: str) -> None:
Expand Down

0 comments on commit d8af6ee

Please sign in to comment.