You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There's a couple of issues I'm running into with this
First, the pyright-strict job marks this as partially unknown:
/home/runner/work/pandas-stubs/pandas-stubs/tests/test_series.py:1039:5 - error: Type of "compare" is partially unknown
Type of "compare" is "Overload[(other: Series[Unknown], align_axis: Literal['index', 0], keep_shape: bool = ..., keep_equal: bool = ...) -> Series[Unknown], (other: Series[Unknown], align_axis: Literal['columns', 1] = ..., keep_shape: bool = ..., keep_equal: bool = ...) -> DataFrame]" (reportUnknownMemberType)
Second, when using pyright with --verifytypes to look for uncovered parts of the public API, this is flagged as "unknown type":
{
"category": "function",
"name": "pandas.testing.assert_series_equal",
"referenceCount": 1,
"isExported": true,
"isTypeKnown": false,
"isTypeAmbiguous": false,
"diagnostics": [
{
"file": "/home/marcogorelli/type_coverage_py/.pyright_env_pandas/lib/python3.12/site-packages/pandas/_testing/__init__.pyi",
"severity": "error",
"message": "Type of parameter \"left\" is partially unknown\n Parameter type is \"Series[Unknown]\"\n Type argument 1 for class \"Series\" has unknown type",
"range": {
"start": {
"line": 4,
"character": 27
},
"end": {
"line": 4,
"character": 46
}
}
},
Would it be OK to use Series[Any] instead of just Series in such cases? Or, as some libraries do, to introduce a type alias Incomplete: TypeAlias = Any to mean "we should be able to narrow down the type but for now we're not doing so" and use that in some cases
The latter use-case (--verifytypes) can, I think, really help to prioritise which stubs to add
The text was updated successfully, but these errors were encountered:
Currently,
Series
is used in several places where the inner type of the Series isn't known, e.g.:pandas-stubs/pandas-stubs/core/series.pyi
Lines 864 to 871 in 25fe8aa
There's a couple of issues I'm running into with this
First, the pyright-strict job marks this as partially unknown:
Second, when using
pyright
with--verifytypes
to look for uncovered parts of the public API, this is flagged as "unknown type":Would it be OK to use
Series[Any]
instead of justSeries
in such cases? Or, as some libraries do, to introduce a type aliasIncomplete: TypeAlias = Any
to mean "we should be able to narrow down the type but for now we're not doing so" and use that in some casesThe latter use-case (
--verifytypes
) can, I think, really help to prioritise which stubs to addThe text was updated successfully, but these errors were encountered: