Skip to content

Commit b4db0a6

Browse files
Style Update (#53)
* Style: Add procedures to format code * Style: Add local tests to format code * Style: Add local tests to format code * Style: Apply black and isort style * Style: new isort and black config to match pandas
1 parent 2445c33 commit b4db0a6

File tree

122 files changed

+1280
-583
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

122 files changed

+1280
-583
lines changed

pandas-stubs/__init__.pyi

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import pandas.testing as testing
2+
13
from ._config import (
24
describe_option as describe_option,
35
get_option as get_option,
@@ -7,6 +9,7 @@ from ._config import (
79
set_option as set_option,
810
)
911
from .core.api import (
12+
NA as NA,
1013
BooleanDtype as BooleanDtype,
1114
Categorical as Categorical,
1215
CategoricalDtype as CategoricalDtype,
@@ -19,18 +22,17 @@ from .core.api import (
1922
Grouper as Grouper,
2023
Index as Index,
2124
IndexSlice as IndexSlice,
25+
Int8Dtype as Int8Dtype,
2226
Int16Dtype as Int16Dtype,
2327
Int32Dtype as Int32Dtype,
2428
Int64Dtype as Int64Dtype,
2529
Int64Index as Int64Index,
26-
Int8Dtype as Int8Dtype,
2730
Interval as Interval,
2831
IntervalDtype as IntervalDtype,
2932
IntervalIndex as IntervalIndex,
3033
MultiIndex as MultiIndex,
31-
NA as NA,
32-
NaT as NaT,
3334
NamedAgg as NamedAgg,
35+
NaT as NaT,
3436
Period as Period,
3537
PeriodDtype as PeriodDtype,
3638
PeriodIndex as PeriodIndex,
@@ -40,11 +42,11 @@ from .core.api import (
4042
Timedelta as Timedelta,
4143
TimedeltaIndex as TimedeltaIndex,
4244
Timestamp as Timestamp,
45+
UInt8Dtype as UInt8Dtype,
4346
UInt16Dtype as UInt16Dtype,
4447
UInt32Dtype as UInt32Dtype,
4548
UInt64Dtype as UInt64Dtype,
4649
UInt64Index as UInt64Index,
47-
UInt8Dtype as UInt8Dtype,
4850
array as array,
4951
bdate_range as bdate_range,
5052
date_range as date_range,
@@ -61,10 +63,7 @@ from .core.api import (
6163
unique as unique,
6264
value_counts as value_counts,
6365
)
64-
from .core.tools import to_datetime as to_datetime, to_timedelta as to_timedelta
6566
from .core.arrays.sparse import SparseDtype as SparseDtype
66-
from .tseries import offsets as offsets
67-
from .tseries.api import infer_freq as infer_freq
6867
from .core.computation.api import eval as eval
6968
from .core.reshape.api import (
7069
concat as concat,
@@ -81,8 +80,7 @@ from .core.reshape.api import (
8180
qcut as qcut,
8281
wide_to_long as wide_to_long,
8382
)
84-
from .util._print_versions import show_versions as show_versions
85-
from .io.json import json_normalize as json_normalize
83+
from .core.tools import to_datetime as to_datetime, to_timedelta as to_timedelta
8684
from .io.api import (
8785
ExcelFile as ExcelFile,
8886
ExcelWriter as ExcelWriter,
@@ -108,9 +106,10 @@ from .io.api import (
108106
read_table as read_table,
109107
to_pickle as to_pickle,
110108
)
111-
109+
from .io.json import json_normalize as json_normalize
110+
from .tseries import offsets as offsets
111+
from .tseries.api import infer_freq as infer_freq
112+
from .util._print_versions import show_versions as show_versions
112113
from .util._tester import test as test
113114

114-
import pandas.testing as testing
115-
116115
__version__: str

pandas-stubs/_config/__init__.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ from .config import (
44
option_context as option_context,
55
options as options,
66
reset_option as reset_option,
7-
set_option as set_option)
8-
7+
set_option as set_option,
8+
)

pandas-stubs/_config/config.pyi

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
from contextlib import ContextDecorator
2-
from typing import Any, Union, overload, Literal
2+
from typing import (
3+
Any,
4+
Literal,
5+
Union,
6+
overload,
7+
)
38

49
def get_option(pat: str) -> Any: ...
510
def set_option(pat: str, val: object) -> None: ...

pandas-stubs/_libs/__init__.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from .interval import Interval as Interval
12
from .tslibs import (
23
NaT as NaT,
34
NaTType as NaTType,
@@ -7,4 +8,3 @@ from .tslibs import (
78
Timestamp as Timestamp,
89
iNaT as iNaT,
910
)
10-
from .interval import Interval as Interval

pandas-stubs/_libs/interval.pyi

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,11 @@ from typing import (
1010

1111
import numpy as np
1212

13-
from pandas._typing import npt
14-
1513
from pandas._typing import (
1614
IntervalClosedType,
1715
Timedelta,
1816
Timestamp,
17+
npt,
1918
)
2019

2120
VALID_CLOSED: frozenset[str]

pandas-stubs/_libs/missing.pyi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from __future__ import annotations
2+
23
from typing import Union
34

45
class NAType:

pandas-stubs/_libs/tslibs/__init__.pyi

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,18 @@ __all__ = [
1111
"OutOfBoundsDatetime",
1212
]
1313

14-
from .period import Period
15-
from .timestamps import Timestamp
16-
from .timedeltas import Timedelta
14+
from np_datetime import OutOfBoundsDatetime as OutOfBoundsDatetime
15+
1716
from .nattype import (
1817
NaT,
1918
NaTType,
2019
iNaT,
2120
nat_strings,
2221
)
23-
from .offsets import BaseOffset, Tick
24-
from np_datetime import OutOfBoundsDatetime as OutOfBoundsDatetime
22+
from .offsets import (
23+
BaseOffset,
24+
Tick,
25+
)
26+
from .period import Period
27+
from .timedeltas import Timedelta
28+
from .timestamps import Timestamp

pandas-stubs/_libs/tslibs/offsets.pyi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ from typing import (
1616
)
1717

1818
import numpy as np
19+
1920
from pandas._typing import npt
2021

2122
from .timedeltas import Timedelta

pandas-stubs/_libs/tslibs/period.pyi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from __future__ import annotations
2+
23
from datetime import datetime
34
from typing import Any
45

pandas-stubs/_testing/__init__.pyi

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
1+
from typing import (
2+
Any,
3+
List,
4+
Optional,
5+
Union,
6+
)
7+
18
from pandas.core.frame import DataFrame
29
from pandas.core.indexes.base import Index
310
from pandas.core.series import Series
11+
412
from pandas._typing import (
513
FilePathOrBuffer as FilePathOrBuffer,
614
FrameOrSeriesUnion as FrameOrSeriesUnion,
715
)
8-
from typing import Any, List, Optional, Union
916

1017
lzma = ...
1118
N: int = ...

pandas-stubs/_typing.pyi

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
11
import datetime
2-
from io import BufferedIOBase, RawIOBase, TextIOBase, TextIOWrapper
2+
from io import (
3+
BufferedIOBase,
4+
RawIOBase,
5+
TextIOBase,
6+
TextIOWrapper,
7+
)
38
from mmap import mmap
4-
import numpy as np
5-
from numpy import typing as npt
6-
import sys
79
from os import PathLike
810
from pathlib import Path
11+
import sys
912
from typing import (
13+
IO,
1014
Any,
1115
AnyStr,
1216
Callable,
1317
Collection,
1418
Dict,
1519
Hashable,
16-
IO,
1720
List,
1821
Mapping,
1922
NewType,
@@ -26,12 +29,20 @@ from typing import (
2629
Union,
2730
)
2831

29-
from pandas.core.generic import NDFrame
30-
from pandas._libs.tslibs import Period, Timedelta as Timedelta, Timestamp as Timestamp
32+
import numpy as np
33+
from numpy import typing as npt
3134
from pandas.core.arrays import ExtensionArray as ExtensionArray
32-
from pandas.core.series import Series as Series
3335
from pandas.core.frame import DataFrame as DataFrame
36+
from pandas.core.generic import NDFrame
3437
from pandas.core.indexes.base import Index as Index
38+
from pandas.core.series import Series as Series
39+
40+
from pandas._libs.tslibs import (
41+
Period,
42+
Timedelta as Timedelta,
43+
Timestamp as Timestamp,
44+
)
45+
3546
from pandas.core.dtypes.dtypes import ExtensionDtype
3647

3748
if sys.version_info >= (3, 8):

pandas-stubs/api/__init__.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from . import (
22
extensions as extensions,
33
indexers as indexers,
4-
types as types)
4+
types as types,
5+
)
Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
1-
from pandas._libs.lib import no_default as no_default
2-
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
1+
from pandas.core.accessor import (
2+
register_dataframe_accessor as register_dataframe_accessor,
3+
register_index_accessor as register_index_accessor,
4+
register_series_accessor as register_series_accessor,
5+
)
36
from pandas.core.algorithms import take as take
4-
from pandas.core.arrays import ExtensionArray as ExtensionArray, ExtensionScalarOpsMixin as ExtensionScalarOpsMixin
5-
from pandas.core.dtypes.dtypes import ExtensionDtype as ExtensionDtype, register_extension_dtype as register_extension_dtype
7+
from pandas.core.arrays import (
8+
ExtensionArray as ExtensionArray,
9+
ExtensionScalarOpsMixin as ExtensionScalarOpsMixin,
10+
)
611

12+
from pandas._libs.lib import no_default as no_default
713

14+
from pandas.core.dtypes.dtypes import (
15+
ExtensionDtype as ExtensionDtype,
16+
register_extension_dtype as register_extension_dtype,
17+
)

pandas-stubs/api/indexers/__init__.pyi

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,5 @@ from pandas.core.indexers import check_array_indexer as check_array_indexer
22
from pandas.core.window.indexers import (
33
BaseIndexer as BaseIndexer,
44
FixedForwardWindowIndexer as FixedForwardWindowIndexer,
5-
VariableOffsetWindowIndexer as VariableOffsetWindowIndexer)
6-
7-
5+
VariableOffsetWindowIndexer as VariableOffsetWindowIndexer,
6+
)

pandas-stubs/api/types/__init__.pyi

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1-
from pandas.core.dtypes.api import *
21
from pandas._libs.lib import infer_dtype as infer_dtype
3-
from pandas.core.dtypes.concat import union_categoricals as union_categoricals
4-
from pandas.core.dtypes.dtypes import CategoricalDtype as CategoricalDtype, DatetimeTZDtype as DatetimeTZDtype, IntervalDtype as IntervalDtype, PeriodDtype as PeriodDtype
52

3+
from pandas.core.dtypes.api import *
4+
from pandas.core.dtypes.concat import union_categoricals as union_categoricals
5+
from pandas.core.dtypes.dtypes import (
6+
CategoricalDtype as CategoricalDtype,
7+
DatetimeTZDtype as DatetimeTZDtype,
8+
IntervalDtype as IntervalDtype,
9+
PeriodDtype as PeriodDtype,
10+
)

pandas-stubs/compat/_optional.pyi

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
VERSIONS = ...
22

3-
def import_optional_dependency(name: str, extra: str=..., raise_on_missing: bool=..., on_version: str=...): ...
3+
def import_optional_dependency(
4+
name: str, extra: str = ..., raise_on_missing: bool = ..., on_version: str = ...
5+
): ...

pandas-stubs/compat/pickle_compat.pyi

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
import pickle as pkl
2-
from pandas import DataFrame as DataFrame, Index as Index, Series as Series
32
from typing import Optional
43

4+
from pandas import (
5+
DataFrame as DataFrame,
6+
Index as Index,
7+
Series as Series,
8+
)
9+
510
def load_reduce(self) -> None: ...
611
def load_newobj(self) -> None: ...
712
def load_newobj_ex(self) -> None: ...

pandas-stubs/core/algorithms.pyi

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
11
from __future__ import annotations
2+
3+
from typing import (
4+
Any,
5+
Tuple,
6+
Union,
7+
)
8+
29
import numpy as np
3-
from pandas.core.dtypes.generic import ABCIndex as ABCIndex
410
from pandas.core.indexes.base import Index
5-
from typing import Any, Tuple, Union
11+
12+
from pandas.core.dtypes.generic import ABCIndex as ABCIndex
613

714
def unique(values): ...
815

0 commit comments

Comments
 (0)