Skip to content
Open
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion pandera/typing/common.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,21 @@
"""Common typing functionality."""

# pylint:disable=abstract-method,too-many-ancestors,invalid-name

import inspect
from typing import TYPE_CHECKING, Any, Generic, Optional, Type, TypeVar, Union
from typing import (
TYPE_CHECKING,
Any,
Generic,
Optional,
Type,
TypeVar,
Union,
List,
Dict,
Tuple,
NamedTuple,
)

import pandas as pd
import typing_inspect
Expand Down Expand Up @@ -59,6 +72,10 @@
int,
str,
float,
List[Any],
Dict[Any, Any],
Tuple[Any],
NamedTuple,
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAIK, I can't make the type parameters more precise?

Copy link
Author

@sam-goodwin sam-goodwin Apr 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cosmicBboy I think this change is ready to go, LMK if you see any issue with leaving these types wide.

Outstanding question is whether NamedTuple belongs there though.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did you spot-check this with mypy?

NamedTuple should be fine here

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Think I've patched the MyPy problems:

> pre-commit run mypy --all-files
mypy.....................................................................Passed
- hook id: mypy
- duration: 2.27s

Success: no issues found in 180 source files

pd.core.dtypes.base.ExtensionDtype,
Bool,
Date,
Expand Down Expand Up @@ -101,6 +118,10 @@
int,
str,
float,
List[Any],
Dict[Any, Any],
Tuple[Any],
NamedTuple,
pd.core.dtypes.base.ExtensionDtype,
Bool,
Date,
Expand Down