Skip to content

Conversation

@dangotbanned
Copy link
Contributor

Fixes the blanket mypy ignore and 12x pyright warnings

There were two distinct problems

  1. NullableIterable[T] overlapped in every case, since Iterable[None] matched all cases
  2. date | datetime and int | bool | float each needed to share an overload
    i. See special cases if this was surprising - the others are simply nominal subtypes

Fixes the blanket `mypy` ignore and 12x `pyright` warnings
@dangotbanned
Copy link
Contributor Author

I believe pa.array has the same issue

_T = TypeVar("_T")
NullableIterable: TypeAlias = Iterable[_T | None]
@overload # type: ignore[overload-overlap]
def array(
values: NullableIterable[bool],

That leads to this kind of mismatch with int -> bool

image

@zen-xu zen-xu merged commit ef3896f into zen-xu:main Mar 2, 2025
2 checks passed
@dangotbanned dangotbanned deleted the chunked_array-factory branch March 2, 2025 00:47
dangotbanned added a commit to dangotbanned/pyarrow-stubs that referenced this pull request Apr 12, 2025
- Avoid 18 warnings from `pyright`
- very similar to zen-xu#183
- `MonthDayNano` was a bit tricky, but is based on https://github.com/python/typeshed/blob/a045be8ed62492952595661118af22554c7cbca4/stdlib/_typeshed/__init__.pyi#L316-L333
  - Had to rewrite manually to avoid overload overlaps on `CollectionValue`
  - Has all the properties/members returns by `inspect.getmembers`
  - Signature via `inspect.signature`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants