Skip to content

Style Update #53

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 5 commits into from
Jun 30, 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
23 changes: 11 additions & 12 deletions pandas-stubs/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import pandas.testing as testing

from ._config import (
describe_option as describe_option,
get_option as get_option,
Expand All @@ -7,6 +9,7 @@ from ._config import (
set_option as set_option,
)
from .core.api import (
NA as NA,
BooleanDtype as BooleanDtype,
Categorical as Categorical,
CategoricalDtype as CategoricalDtype,
Expand All @@ -19,18 +22,17 @@ from .core.api import (
Grouper as Grouper,
Index as Index,
IndexSlice as IndexSlice,
Int8Dtype as Int8Dtype,
Int16Dtype as Int16Dtype,
Int32Dtype as Int32Dtype,
Int64Dtype as Int64Dtype,
Int64Index as Int64Index,
Int8Dtype as Int8Dtype,
Interval as Interval,
IntervalDtype as IntervalDtype,
IntervalIndex as IntervalIndex,
MultiIndex as MultiIndex,
NA as NA,
NaT as NaT,
NamedAgg as NamedAgg,
NaT as NaT,
Period as Period,
PeriodDtype as PeriodDtype,
PeriodIndex as PeriodIndex,
Expand All @@ -40,11 +42,11 @@ from .core.api import (
Timedelta as Timedelta,
TimedeltaIndex as TimedeltaIndex,
Timestamp as Timestamp,
UInt8Dtype as UInt8Dtype,
UInt16Dtype as UInt16Dtype,
UInt32Dtype as UInt32Dtype,
UInt64Dtype as UInt64Dtype,
UInt64Index as UInt64Index,
UInt8Dtype as UInt8Dtype,
array as array,
bdate_range as bdate_range,
date_range as date_range,
Expand All @@ -61,10 +63,7 @@ from .core.api import (
unique as unique,
value_counts as value_counts,
)
from .core.tools import to_datetime as to_datetime, to_timedelta as to_timedelta
from .core.arrays.sparse import SparseDtype as SparseDtype
from .tseries import offsets as offsets
from .tseries.api import infer_freq as infer_freq
from .core.computation.api import eval as eval
from .core.reshape.api import (
concat as concat,
Expand All @@ -81,8 +80,7 @@ from .core.reshape.api import (
qcut as qcut,
wide_to_long as wide_to_long,
)
from .util._print_versions import show_versions as show_versions
from .io.json import json_normalize as json_normalize
from .core.tools import to_datetime as to_datetime, to_timedelta as to_timedelta
from .io.api import (
ExcelFile as ExcelFile,
ExcelWriter as ExcelWriter,
Expand All @@ -108,9 +106,10 @@ from .io.api import (
read_table as read_table,
to_pickle as to_pickle,
)

from .io.json import json_normalize as json_normalize
from .tseries import offsets as offsets
from .tseries.api import infer_freq as infer_freq
from .util._print_versions import show_versions as show_versions
from .util._tester import test as test

import pandas.testing as testing

__version__: str
4 changes: 2 additions & 2 deletions pandas-stubs/_config/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ from .config import (
option_context as option_context,
options as options,
reset_option as reset_option,
set_option as set_option)

set_option as set_option,
)
7 changes: 6 additions & 1 deletion pandas-stubs/_config/config.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
from contextlib import ContextDecorator
from typing import Any, Union, overload, Literal
from typing import (
Any,
Literal,
Union,
overload,
)

def get_option(pat: str) -> Any: ...
def set_option(pat: str, val: object) -> None: ...
Expand Down
2 changes: 1 addition & 1 deletion pandas-stubs/_libs/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from .interval import Interval as Interval
from .tslibs import (
NaT as NaT,
NaTType as NaTType,
Expand All @@ -7,4 +8,3 @@ from .tslibs import (
Timestamp as Timestamp,
iNaT as iNaT,
)
from .interval import Interval as Interval
3 changes: 1 addition & 2 deletions pandas-stubs/_libs/interval.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@ from typing import (

import numpy as np

from pandas._typing import npt

from pandas._typing import (
IntervalClosedType,
Timedelta,
Timestamp,
npt,
)

VALID_CLOSED: frozenset[str]
Expand Down
1 change: 1 addition & 0 deletions pandas-stubs/_libs/missing.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from __future__ import annotations

from typing import Union

class NAType:
Expand Down
14 changes: 9 additions & 5 deletions pandas-stubs/_libs/tslibs/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,18 @@ __all__ = [
"OutOfBoundsDatetime",
]

from .period import Period
from .timestamps import Timestamp
from .timedeltas import Timedelta
from np_datetime import OutOfBoundsDatetime as OutOfBoundsDatetime

from .nattype import (
NaT,
NaTType,
iNaT,
nat_strings,
)
from .offsets import BaseOffset, Tick
from np_datetime import OutOfBoundsDatetime as OutOfBoundsDatetime
from .offsets import (
BaseOffset,
Tick,
)
from .period import Period
from .timedeltas import Timedelta
from .timestamps import Timestamp
1 change: 1 addition & 0 deletions pandas-stubs/_libs/tslibs/offsets.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ from typing import (
)

import numpy as np

from pandas._typing import npt

from .timedeltas import Timedelta
Expand Down
1 change: 1 addition & 0 deletions pandas-stubs/_libs/tslibs/period.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from __future__ import annotations

from datetime import datetime
from typing import Any

Expand Down
9 changes: 8 additions & 1 deletion pandas-stubs/_testing/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
from typing import (
Any,
List,
Optional,
Union,
)

from pandas.core.frame import DataFrame
from pandas.core.indexes.base import Index
from pandas.core.series import Series

from pandas._typing import (
FilePathOrBuffer as FilePathOrBuffer,
FrameOrSeriesUnion as FrameOrSeriesUnion,
)
from typing import Any, List, Optional, Union

lzma = ...
N: int = ...
Expand Down
27 changes: 19 additions & 8 deletions pandas-stubs/_typing.pyi
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
import datetime
from io import BufferedIOBase, RawIOBase, TextIOBase, TextIOWrapper
from io import (
BufferedIOBase,
RawIOBase,
TextIOBase,
TextIOWrapper,
)
from mmap import mmap
import numpy as np
from numpy import typing as npt
import sys
from os import PathLike
from pathlib import Path
import sys
from typing import (
IO,
Any,
AnyStr,
Callable,
Collection,
Dict,
Hashable,
IO,
List,
Mapping,
NewType,
Expand All @@ -26,12 +29,20 @@ from typing import (
Union,
)

from pandas.core.generic import NDFrame
from pandas._libs.tslibs import Period, Timedelta as Timedelta, Timestamp as Timestamp
import numpy as np
from numpy import typing as npt
from pandas.core.arrays import ExtensionArray as ExtensionArray
from pandas.core.series import Series as Series
from pandas.core.frame import DataFrame as DataFrame
from pandas.core.generic import NDFrame
from pandas.core.indexes.base import Index as Index
from pandas.core.series import Series as Series

from pandas._libs.tslibs import (
Period,
Timedelta as Timedelta,
Timestamp as Timestamp,
)

from pandas.core.dtypes.dtypes import ExtensionDtype

if sys.version_info >= (3, 8):
Expand Down
3 changes: 2 additions & 1 deletion pandas-stubs/api/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from . import (
extensions as extensions,
indexers as indexers,
types as types)
types as types,
)
18 changes: 14 additions & 4 deletions pandas-stubs/api/extensions/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
from pandas._libs.lib import no_default as no_default
from pandas.core.accessor import register_dataframe_accessor as register_dataframe_accessor, register_index_accessor as register_index_accessor, register_series_accessor as register_series_accessor
from pandas.core.accessor import (
register_dataframe_accessor as register_dataframe_accessor,
register_index_accessor as register_index_accessor,
register_series_accessor as register_series_accessor,
)
from pandas.core.algorithms import take as take
from pandas.core.arrays import ExtensionArray as ExtensionArray, ExtensionScalarOpsMixin as ExtensionScalarOpsMixin
from pandas.core.dtypes.dtypes import ExtensionDtype as ExtensionDtype, register_extension_dtype as register_extension_dtype
from pandas.core.arrays import (
ExtensionArray as ExtensionArray,
ExtensionScalarOpsMixin as ExtensionScalarOpsMixin,
)

from pandas._libs.lib import no_default as no_default

from pandas.core.dtypes.dtypes import (
ExtensionDtype as ExtensionDtype,
register_extension_dtype as register_extension_dtype,
)
5 changes: 2 additions & 3 deletions pandas-stubs/api/indexers/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@ from pandas.core.indexers import check_array_indexer as check_array_indexer
from pandas.core.window.indexers import (
BaseIndexer as BaseIndexer,
FixedForwardWindowIndexer as FixedForwardWindowIndexer,
VariableOffsetWindowIndexer as VariableOffsetWindowIndexer)


VariableOffsetWindowIndexer as VariableOffsetWindowIndexer,
)
11 changes: 8 additions & 3 deletions pandas-stubs/api/types/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
from pandas.core.dtypes.api import *
from pandas._libs.lib import infer_dtype as infer_dtype
from pandas.core.dtypes.concat import union_categoricals as union_categoricals
from pandas.core.dtypes.dtypes import CategoricalDtype as CategoricalDtype, DatetimeTZDtype as DatetimeTZDtype, IntervalDtype as IntervalDtype, PeriodDtype as PeriodDtype

from pandas.core.dtypes.api import *
from pandas.core.dtypes.concat import union_categoricals as union_categoricals
from pandas.core.dtypes.dtypes import (
CategoricalDtype as CategoricalDtype,
DatetimeTZDtype as DatetimeTZDtype,
IntervalDtype as IntervalDtype,
PeriodDtype as PeriodDtype,
)
4 changes: 3 additions & 1 deletion pandas-stubs/compat/_optional.pyi
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
VERSIONS = ...

def import_optional_dependency(name: str, extra: str=..., raise_on_missing: bool=..., on_version: str=...): ...
def import_optional_dependency(
name: str, extra: str = ..., raise_on_missing: bool = ..., on_version: str = ...
): ...
7 changes: 6 additions & 1 deletion pandas-stubs/compat/pickle_compat.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import pickle as pkl
from pandas import DataFrame as DataFrame, Index as Index, Series as Series
from typing import Optional

from pandas import (
DataFrame as DataFrame,
Index as Index,
Series as Series,
)

def load_reduce(self) -> None: ...
def load_newobj(self) -> None: ...
def load_newobj_ex(self) -> None: ...
Expand Down
11 changes: 9 additions & 2 deletions pandas-stubs/core/algorithms.pyi
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
from __future__ import annotations

from typing import (
Any,
Tuple,
Union,
)

import numpy as np
from pandas.core.dtypes.generic import ABCIndex as ABCIndex
from pandas.core.indexes.base import Index
from typing import Any, Tuple, Union

from pandas.core.dtypes.generic import ABCIndex as ABCIndex

def unique(values): ...

Expand Down
Loading