-
-
Notifications
You must be signed in to change notification settings - Fork 652
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
Remove PrimitiveField
and align AsyncField
with Field
#11231
Conversation
# Rust tests and lints will be skipped. Delete if not intended. [ci skip-rust] # Building wheels and fs_util will be skipped. Delete if not intended. [ci skip-build-wheels]
# Rust tests and lints will be skipped. Delete if not intended. [ci skip-rust] # Building wheels and fs_util will be skipped. Delete if not intended. [ci skip-build-wheels]
[ci skip-rust] [ci skip-build-wheels]
Remove an unnecessary test that set up an async field rule. It's redundandant to do that - async fields are very well used now, and there's really nothing special about them _except_ for adding an `Address` field + conventions. You could set up a rule for a non-async field too. Also test that __eq__ and __hash__ still work properly. [ci skip-rust] [ci skip-build-wheels]
I was really excited by an idea to make But I couldn't get the multiple inheritance, dataclasses, and |
Honestly, we should probably just not use dataclasses for |
Huzzah! Removing dataclasses fixes it. |
By doing this, it's now possible to combine any arbitrary field template with being an async field. Previously, we duplicated the templates, like `AsyncStringSequenceField`. This also builds off of #11231 to make async fields far less magical - literally, all they do is add an `address: Address` field. To land this, we remove both `@dataclass` and `ABC` from `Field`, which were causing unnecessary confusion and messing up inheritance. The dataclass was only generating a custom `__eq__` and `__hash__`, which is easy to set explicitly. We also remove both things from `Target` for simplicity. [ci skip-rust] [ci skip-build-wheels]
Broken out of #10932.
The difference between
AsyncField
andPrimitiveField
is fairly artificial and it creates more complexity than we need. Really, the only difference is a) storing theAddress
and b) an expression of intent.This makes
Field
act likePrimitiveField
, which is now deleted.AsyncField
now uses the same naming asPrimitiveField
used to, i.e.value
instead ofsanitized_raw_value
andcompute_value()
instead ofsanitize_raw_value()
.This also cleans up some of the relevant
target_test.py
. We were testing something that's no longer worth it, as it's outside the scope of the code and we have multiple places we test this pattern. We add a new test that__eq__
and__hash__
are correct.[ci skip-rust]
[ci skip-build-wheels]