Open dkfellows opened 4 months ago
I've been investigating a bug, when handling the EAR end step workflow callback (i.e., not in the main script itself), parameters would not have their value class set when processing the results. I'm not at all sure why this would be so (as the schema had been parsed and the parameter class modules loaded) but it was resulting in the reading out of values from an HDF5 file not working. I've resolved it by doing the forcing at that point (because the alternative is a definite failure! New method Parameter._force_value_class()
) but it's really odd because I can't see why the parameters are wrong in the first place.
Do #699 first; it will be easier that way round.
This looks pretty good to me now. I'd love the documentation of the typed dictionaries to be better... but I'm not fixing Python itself so it will just have to be what it is.
These are bizarre failures, FWIW. I can only reproduce them locally by not having Python on the path.
[EDIT] And they seem to be transient. Probably container-related. Oh well.
This is an adoption of #694 as a project-internal internal PR.
Tricky points:
typing_extensions
to work in 3.8; by 3.12 they're in Python itself.from __future__ import annotations
as the first line, which causes all annotations to be left as uninterpreted strings. (Without that, the syntax for unions would need to be much more wordy and things are bad enough as it is...)Foo: TypeAlias = "Bar | Grill"
so that they get handled right.type
declaration syntax of 3.12 isn't supported at all.cast
orisinstance
; the type isn't auto-stringified there.ClassVar
@hydrate
the class before it is processed by@dataclass
to make class variables be handled right.TypedDict
s, but that job isn't complete and I've no idea how much effort should be put into it; this has been one of the slowest parts: identifying where types could be narrowed.dict[str, Any]
than straightDict
; JSON doesn't allow non-string keys.typing.TYPE_CHECKING
have no constraints based on name resolution order... but can only be used in uninterpreted types (as the code isn't actually executed by Python).