ruff
8dad58de - [ty] Support dataclass-transform `field_specifiers` (#20888)

Commit
227 days ago
[ty] Support dataclass-transform `field_specifiers` (#20888) ## Summary Add support for the `field_specifiers` parameter on `dataclass_transform` decorator calls. closes https://github.com/astral-sh/ty/issues/1068 ## Conformance test results All true positives :heavy_check_mark: ## Ecosystem analysis * `trio`: this is the kind of change that I would expect from this PR. The code makes use of a dataclass `Outcome` with a `_unwrapped: bool = attr.ib(default=False, eq=False, init=False)` field that is excluded from the `__init__` signature, so we now see a bunch of constructor-call-related errors going away. * `home-assistant/core`: They have a `domain: str = attr.ib(init=False, repr=False)` field and then use ```py @domain.default def _domain_default(self) -> str: # … ``` This accesses the `default` attribute on `dataclasses.Field[…]` with a type of `default: _T | Literal[_MISSING_TYPE.MISSING]`, so we get those "Object of type `_MISSING_TYPE` is not callable" errors. I don't really understand how that is supposed to work. Even if `_MISSING_TYPE` would be absent from that union, what does this try to call? pyright also issues an error and it doesn't seem to work at runtime? So this looks like a true positive? * `attrs`: Similar here. There are some new diagnostics on code that tries to access `.validator` on a field. This *does* work at runtime, but I'm not sure how that is supposed to type-check (without a [custom plugin](https://github.com/python/mypy/blob/2c6c3959356674262d9b2c2dc43a33486e807a9c/mypy/plugins/attrs.py#L575-L602)). pyright errors on this as well. * A handful of new false positives because we don't support `alias` yet ## Test Plan Updated tests.
Author
Parents
Loading