Skip to content

feat: Convert types.is_* into TypeIs guards#215

Merged
zen-xu merged 2 commits into
zen-xu:mainfrom
dangotbanned:types-type-is
Apr 15, 2025
Merged

feat: Convert types.is_* into TypeIs guards#215
zen-xu merged 2 commits into
zen-xu:mainfrom
dangotbanned:types-type-is

Conversation

@dangotbanned
Copy link
Copy Markdown
Contributor

I've been using this for a little while in narwhals, but makes more sense to live in the stubs

https://github.com/narwhals-dev/narwhals/blob/16427440e6d74939c403083b52ce3fb0af7d63c7/narwhals/_arrow/utils.py#L44-L67

@dangotbanned dangotbanned changed the title feat: Convert types._is_* into TypeIs guards feat: Convert types.is_* into TypeIs guards Apr 14, 2025
@zen-xu zen-xu merged commit f39e9fd into zen-xu:main Apr 15, 2025
2 checks passed
@dangotbanned dangotbanned deleted the types-type-is branch April 15, 2025 08:04
dangotbanned added a commit to narwhals-dev/narwhals that referenced this pull request Apr 30, 2025
We need **exactly one** type, but the new typing I added narrows it to **4** types
zen-xu/pyarrow-stubs#215

```
error: Value of type variable "_R" of function cannot be "Scalar[Int8Type | Int16Type | Int32Type | Int64Type] | Array[Any] | ChunkedArray[Any] | Scalar[Any]"  [type-var]
```
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