Skip to content

CLN: update flake8-pyi #169

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 26, 2022
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ repos:
- id: flake8
name: flake8 (pyi)
additional_dependencies:
- flake8-pyi==22.5.1
- flake8-pyi==22.7.0
types: [pyi]
args: [
--ignore=E301 E302 E305 E402 E501 E701 E704 F401 F811 W503 Y019 Y026 Y027 Y034 Y037,
Expand Down
2 changes: 0 additions & 2 deletions pandas-stubs/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import annotations

import pandas.testing as testing

from . import (
Expand Down
2 changes: 0 additions & 2 deletions pandas-stubs/_config/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import annotations

from .config import (
describe_option as describe_option,
get_option as get_option,
Expand Down
2 changes: 0 additions & 2 deletions pandas-stubs/_config/config.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import annotations

from contextlib import ContextDecorator
from typing import (
Any,
Expand Down
2 changes: 0 additions & 2 deletions pandas-stubs/_libs/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import annotations

from .interval import Interval as Interval
from .tslibs import (
NaT as NaT,
Expand Down
2 changes: 0 additions & 2 deletions pandas-stubs/_libs/indexing.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import annotations

class _NDFrameIndexerBase:
def __init__(self, name: str, obj: object) -> None: ...
@property
Expand Down
20 changes: 9 additions & 11 deletions pandas-stubs/_libs/interval.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import annotations

from typing import (
Any,
Generic,
Expand Down Expand Up @@ -78,7 +76,7 @@ class Interval(IntervalMixin, Generic[_OrderableT]):
@overload
def __contains__(self: Interval[_OrderableTimesT], _OrderableTimesT) -> bool: ...
@overload
def __contains__(self: Interval[_OrderableScalarT], key: int | float) -> bool: ...
def __contains__(self: Interval[_OrderableScalarT], key: float) -> bool: ...
@overload
def __add__(
self: Interval[_OrderableTimesT], y: Timedelta
Expand All @@ -88,7 +86,7 @@ class Interval(IntervalMixin, Generic[_OrderableT]):
self: Interval[int], y: _OrderableScalarT
) -> Interval[_OrderableScalarT]: ...
@overload
def __add__(self: Interval[float], y: int | float) -> Interval[float]: ...
def __add__(self: Interval[float], y: float) -> Interval[float]: ...
@overload
def __radd__(
self: Interval[_OrderableTimesT], y: Timedelta
Expand All @@ -98,7 +96,7 @@ class Interval(IntervalMixin, Generic[_OrderableT]):
self: Interval[int], y: _OrderableScalarT
) -> Interval[_OrderableScalarT]: ...
@overload
def __radd__(self: Interval[float], y: int | float) -> Interval[float]: ...
def __radd__(self: Interval[float], y: float) -> Interval[float]: ...
@overload
def __sub__(
self: Interval[_OrderableTimesT], y: Timedelta
Expand All @@ -108,7 +106,7 @@ class Interval(IntervalMixin, Generic[_OrderableT]):
self: Interval[int], y: _OrderableScalarT
) -> Interval[_OrderableScalarT]: ...
@overload
def __sub__(self: Interval[float], y: int | float) -> Interval[float]: ...
def __sub__(self: Interval[float], y: float) -> Interval[float]: ...
@overload
def __rsub__(
self: Interval[_OrderableTimesT], y: Timedelta
Expand All @@ -118,31 +116,31 @@ class Interval(IntervalMixin, Generic[_OrderableT]):
self: Interval[int], y: _OrderableScalarT
) -> Interval[_OrderableScalarT]: ...
@overload
def __rsub__(self: Interval[float], y: int | float) -> Interval[float]: ...
def __rsub__(self: Interval[float], y: float) -> Interval[float]: ...
@overload
def __mul__(
self: Interval[int], y: _OrderableScalarT
) -> Interval[_OrderableScalarT]: ...
@overload
def __mul__(self: Interval[float], y: int | float) -> Interval[float]: ...
def __mul__(self: Interval[float], y: float) -> Interval[float]: ...
@overload
def __rmul__(
self: Interval[int], y: _OrderableScalarT
) -> Interval[_OrderableScalarT]: ...
@overload
def __rmul__(self: Interval[float], y: int | float) -> Interval[float]: ...
def __rmul__(self: Interval[float], y: float) -> Interval[float]: ...
@overload
def __truediv__(
self: Interval[int], y: _OrderableScalarT
) -> Interval[_OrderableScalarT]: ...
@overload
def __truediv__(self: Interval[float], y: int | float) -> Interval[float]: ...
def __truediv__(self: Interval[float], y: float) -> Interval[float]: ...
@overload
def __floordiv__(
self: Interval[int], y: _OrderableScalarT
) -> Interval[_OrderableScalarT]: ...
@overload
def __floordiv__(self: Interval[float], y: int | float) -> Interval[float]: ...
def __floordiv__(self: Interval[float], y: float) -> Interval[float]: ...
def overlaps(self: Interval[_OrderableT], other: Interval[_OrderableT]) -> bool: ...

def intervals_to_interval_bounds(
Expand Down
2 changes: 0 additions & 2 deletions pandas-stubs/_libs/json.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import annotations

def decode(*args, **kwargs): ...
def dumps(*args, **kwargs): ...
def encode(*args, **kwargs): ...
Expand Down
2 changes: 0 additions & 2 deletions pandas-stubs/_libs/lib.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import annotations

no_default = None

def infer_dtype(value: object, skipna: bool = ...) -> str: ...
2 changes: 0 additions & 2 deletions pandas-stubs/_libs/missing.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import annotations

class NAType:
def __new__(cls, *args, **kwargs) -> NAType: ...
def __format__(self, format_spec: str) -> str: ...
Expand Down
2 changes: 0 additions & 2 deletions pandas-stubs/_libs/ops_dispatch.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import annotations

DISPATCHED_UFUNCS = ...
REVERSED_NAMES = ...
UFUNC_ALIASES = ...
Expand Down
2 changes: 0 additions & 2 deletions pandas-stubs/_libs/properties.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import annotations

from typing import Callable

class CachedProperty:
Expand Down
2 changes: 0 additions & 2 deletions pandas-stubs/_libs/sparse.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import annotations

class SparseIndex: ...
class BlockIndex(SparseIndex): ...
class IntIndex(SparseIndex): ...
2 changes: 0 additions & 2 deletions pandas-stubs/_libs/tslibs/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import annotations

__all__ = [
"Period",
"Timestamp",
Expand Down
2 changes: 0 additions & 2 deletions pandas-stubs/_libs/tslibs/base.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import annotations

from datetime import datetime

class ABCTimestamp(datetime): ...
2 changes: 0 additions & 2 deletions pandas-stubs/_libs/tslibs/ccalendar.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import annotations

from typing import Sequence

def dayofweek(y: int, m: int, d: int) -> int: ...
Expand Down
2 changes: 0 additions & 2 deletions pandas-stubs/_libs/tslibs/conversion.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import annotations

from datetime import datetime

def localize_pydatetime(dt: datetime, tz: object) -> datetime: ...
Expand Down
2 changes: 0 additions & 2 deletions pandas-stubs/_libs/tslibs/dtypes.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import annotations

from enum import Enum

from .offsets import BaseOffset
Expand Down
2 changes: 0 additions & 2 deletions pandas-stubs/_libs/tslibs/nattype.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import annotations

from datetime import (
datetime,
timedelta,
Expand Down
2 changes: 0 additions & 2 deletions pandas-stubs/_libs/tslibs/np_datetime.pyi
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
from __future__ import annotations

class OutOfBoundsDatetime(ValueError): ...
2 changes: 0 additions & 2 deletions pandas-stubs/_libs/tslibs/offsets.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import annotations

from datetime import (
datetime,
timedelta,
Expand Down
2 changes: 0 additions & 2 deletions pandas-stubs/_libs/tslibs/parsing.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import annotations

from typing import Any

def parse_time_string(*args, **kwargs) -> Any: ...
Expand Down
2 changes: 0 additions & 2 deletions pandas-stubs/_libs/tslibs/period.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import annotations

from datetime import datetime
from typing import Any

Expand Down
2 changes: 0 additions & 2 deletions pandas-stubs/_libs/tslibs/strptime.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import annotations

from typing import Any

def array_strptime(*args, **kwargs) -> Any: ...
6 changes: 2 additions & 4 deletions pandas-stubs/_libs/tslibs/timedeltas.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import annotations

from datetime import timedelta
from typing import (
ClassVar,
Expand Down Expand Up @@ -84,7 +82,7 @@ class Timedelta(timedelta):
cls: type[_S],
value=...,
unit: str = ...,
**kwargs: int | float | np.integer | np.floating,
**kwargs: float | np.integer | np.floating,
) -> _S: ...
# GH 46171
# While Timedelta can return pd.NaT, having the constructor return
Expand Down Expand Up @@ -119,7 +117,7 @@ class Timedelta(timedelta):
@overload # type: ignore[override]
def __floordiv__(self, other: timedelta) -> int: ...
@overload
def __floordiv__(self, other: int | float) -> Timedelta: ...
def __floordiv__(self, other: float) -> Timedelta: ...
@overload
def __floordiv__(
self, other: npt.NDArray[np.timedelta64]
Expand Down
10 changes: 1 addition & 9 deletions pandas-stubs/_libs/tslibs/timestamps.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import annotations

from datetime import (
date as _date,
datetime,
Expand Down Expand Up @@ -35,13 +33,7 @@ class Timestamp(datetime):
value: int # np.int64
def __new__(
cls: type[_DatetimeT],
ts_input: int
| np.integer
| float
| str
| _date
| datetime
| np.datetime64 = ...,
ts_input: np.integer | float | str | _date | datetime | np.datetime64 = ...,
freq: int | str | BaseOffset | None = ...,
tz: str | _tzinfo | int | None = ...,
unit: str | int | None = ...,
Expand Down
2 changes: 0 additions & 2 deletions pandas-stubs/_libs/tslibs/tzconversion.pyi
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
from __future__ import annotations

def tz_convert_from_utc_single(val: int, tz: str) -> int: ...
2 changes: 0 additions & 2 deletions pandas-stubs/_libs/tslibs/vectorized.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import annotations

from typing import Sequence

import numpy as np
Expand Down
2 changes: 0 additions & 2 deletions pandas-stubs/_testing/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import annotations

from typing import Literal

from pandas.core.frame import DataFrame
Expand Down
12 changes: 3 additions & 9 deletions pandas-stubs/_typing.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import annotations

from builtins import type as type_t
import datetime
from io import (
Expand Down Expand Up @@ -43,16 +41,14 @@ from pandas.core.dtypes.dtypes import ExtensionDtype

ArrayLike = Union[ExtensionArray, np.ndarray]
AnyArrayLike = Union[Index, Series, np.ndarray]
PythonScalar = Union[str, int, float, bool, complex]
PythonScalar = Union[str, bool, complex]
Copy link
Member Author

Choose a reason for hiding this comment

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

PR to make these changes in pandas pandas-dev/pandas#47850

DatetimeLikeScalar = TypeVar("DatetimeLikeScalar", Period, Timestamp, Timedelta)
PandasScalar = Union[bytes, datetime.date, datetime.datetime, datetime.timedelta]
# Scalar = Union[PythonScalar, PandasScalar]
IntStrT = TypeVar("IntStrT", int, str)

# dtypes
NpDtype = Union[
str, np.dtype[np.generic], type[Union[str, float, int, complex, bool, object]]
]
NpDtype = Union[str, np.dtype[np.generic], type[Union[str, complex, bool, object]]]
Dtype = Union[ExtensionDtype, NpDtype]
AstypeArg = Union[ExtensionDtype, npt.DTypeLike]
# DtypeArg specifies all allowable dtypes in a functions its dtype argument
Expand Down Expand Up @@ -97,7 +93,7 @@ AggFuncType = Union[
AggFuncTypeDict,
]

num = Union[int, float, complex]
num = complex
SeriesAxisType = Literal["index", 0] # Restricted subset of _AxisType for series
AxisType = Literal["columns", "index", 0, 1]
DtypeNp = TypeVar("DtypeNp", bound=np.dtype[np.generic])
Expand All @@ -111,8 +107,6 @@ Scalar = Union[
datetime.datetime,
datetime.timedelta,
bool,
int,
float,
complex,
Timestamp,
Timedelta,
Expand Down
2 changes: 0 additions & 2 deletions pandas-stubs/_version.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import annotations

from typing import Literal

version_json: str = ...
Expand Down
2 changes: 0 additions & 2 deletions pandas-stubs/api/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import annotations

from . import (
extensions as extensions,
indexers as indexers,
Expand Down
2 changes: 0 additions & 2 deletions pandas-stubs/api/extensions/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import annotations

from pandas.core.accessor import (
register_dataframe_accessor as register_dataframe_accessor,
register_index_accessor as register_index_accessor,
Expand Down
2 changes: 0 additions & 2 deletions pandas-stubs/api/indexers/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import annotations

from pandas.core.indexers import check_array_indexer as check_array_indexer
from pandas.core.window.indexers import (
BaseIndexer as BaseIndexer,
Expand Down
2 changes: 0 additions & 2 deletions pandas-stubs/api/types/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import annotations

from pandas._libs.lib import infer_dtype as infer_dtype

from pandas.core.dtypes.api import (
Expand Down
2 changes: 0 additions & 2 deletions pandas-stubs/arrays/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import annotations

from pandas.core.arrays import (
BooleanArray as BooleanArray,
Categorical as Categorical,
Expand Down
2 changes: 0 additions & 2 deletions pandas-stubs/compat/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import annotations

PY37 = ...
PY38 = ...
PYPY = ...
Expand Down
2 changes: 0 additions & 2 deletions pandas-stubs/compat/_optional.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import annotations

VERSIONS = ...

def import_optional_dependency(
Expand Down
2 changes: 0 additions & 2 deletions pandas-stubs/compat/numpy/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import annotations

import numpy as np

_np_version: str = ...
Expand Down
2 changes: 0 additions & 2 deletions pandas-stubs/compat/pickle_compat.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import annotations

import pickle as pkl

def load_reduce(self) -> None: ...
Expand Down
2 changes: 0 additions & 2 deletions pandas-stubs/core/accessor.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import annotations

from typing import Any

class DirNamesMixin:
Expand Down
2 changes: 0 additions & 2 deletions pandas-stubs/core/algorithms.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import annotations

from typing import Any

import numpy as np
Expand Down
2 changes: 0 additions & 2 deletions pandas-stubs/core/api.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import annotations

from pandas.core.algorithms import (
factorize as factorize,
unique as unique,
Expand Down
Loading