Skip to content

Commit dd75e66

Browse files
committed
Cleanups
1 parent 3646ea6 commit dd75e66

File tree

31 files changed

+118
-61
lines changed

31 files changed

+118
-61
lines changed

pandas/_config/config.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ class RegisteredOption(NamedTuple):
101101

102102

103103
class OptionError(AttributeError, KeyError):
104-
__module__ = "pandas.errors"
105104
"""
106105
Exception raised for pandas.options.
107106
@@ -118,6 +117,8 @@ class OptionError(AttributeError, KeyError):
118117
OptionError: No such option
119118
"""
120119

120+
__module__ = "pandas.errors"
121+
121122

122123
#
123124
# User API
@@ -413,6 +414,7 @@ def __init__(self, d: dict[str, Any], prefix: str = "") -> None:
413414

414415
def __setattr__(self, key: str, val: Any) -> None:
415416
if key == "__module__":
417+
# Need to be able to set __module__ to pandas for pandas.options
416418
super().__setattr__(key, val)
417419
return
418420
prefix = object.__getattribute__(self, "prefix")

pandas/_libs/tslibs/period.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1627,11 +1627,11 @@ DIFFERENT_FREQ = ("Input has different freq={other_freq} "
16271627

16281628

16291629
class IncompatibleFrequency(TypeError):
1630-
__module__ = "pandas.errors"
16311630
"""
16321631
Raised when trying to compare or operate between Periods with different
16331632
frequencies.
16341633
"""
1634+
__module__ = "pandas.errors"
16351635
pass
16361636

16371637

pandas/core/apply.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@
7676

7777

7878
class BaseExecutionEngine(abc.ABC):
79-
__module__ = "pandas.api.executors"
8079
"""
8180
Base class for execution engines for map and apply methods.
8281
@@ -89,6 +88,8 @@ class BaseExecutionEngine(abc.ABC):
8988
simply runs the code with the Python interpreter and pandas.
9089
"""
9190

91+
__module__ = "pandas.api.executors"
92+
9293
@staticmethod
9394
@abc.abstractmethod
9495
def map(

pandas/core/arrays/arrow/array.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,6 @@ class ArrowExtensionArray(
246246
ExtensionArraySupportsAnyAll,
247247
ArrowStringArrayMixin,
248248
):
249-
__module__ = "pandas.arrays"
250249
"""
251250
Pandas ExtensionArray backed by a PyArrow ChunkedArray.
252251
@@ -297,6 +296,8 @@ class ArrowExtensionArray(
297296
Length: 3, dtype: int64[pyarrow]
298297
""" # noqa: E501 (http link too long)
299298

299+
__module__ = "pandas.arrays"
300+
300301
_pa_array: pa.ChunkedArray
301302
_dtype: ArrowDtype
302303

pandas/core/arrays/base.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@
106106

107107

108108
class ExtensionArray:
109-
__module__ = "pandas.api.extensions"
110109
"""
111110
Abstract base class for custom 1-D array types.
112111
@@ -257,6 +256,8 @@ class ExtensionArray:
257256
https://github.com/pandas-dev/pandas/blob/main/pandas/tests/extension/list/array.py
258257
"""
259258

259+
__module__ = "pandas.api.extensions"
260+
260261
# '_typ' is for pandas.core.dtypes.generic.ABCExtensionArray.
261262
# Don't override this.
262263
_typ = "extension"
@@ -2788,7 +2789,6 @@ def _add_logical_ops(cls) -> None:
27882789

27892790

27902791
class ExtensionScalarOpsMixin(ExtensionOpsMixin):
2791-
__module__ = "pandas.api.extensions"
27922792
"""
27932793
A mixin for defining ops on an ExtensionArray.
27942794
@@ -2814,6 +2814,8 @@ class ExtensionScalarOpsMixin(ExtensionOpsMixin):
28142814
with NumPy arrays.
28152815
"""
28162816

2817+
__module__ = "pandas.api.extensions"
2818+
28172819
@classmethod
28182820
def _create_method(cls, op, coerce_to_dtype: bool = True, result_dtype=None):
28192821
"""

pandas/core/arrays/boolean.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,6 @@ def coerce_to_array(
246246

247247

248248
class BooleanArray(BaseMaskedArray):
249-
__module__ = "pandas.arrays"
250249
"""
251250
Array of boolean (True/False) data with missing values.
252251
@@ -305,6 +304,8 @@ class BooleanArray(BaseMaskedArray):
305304
Length: 3, dtype: boolean
306305
"""
307306

307+
__module__ = "pandas.arrays"
308+
308309
_TRUE_VALUES = {"True", "TRUE", "true", "1", "1.0"}
309310
_FALSE_VALUES = {"False", "FALSE", "false", "0", "0.0"}
310311

pandas/core/arrays/categorical.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,6 @@ def contains(cat, key, container) -> bool:
246246

247247

248248
class Categorical(NDArrayBackedExtensionArray, PandasObject, ObjectStringArrayMixin):
249-
__module__ = "pandas"
250249
"""
251250
Represent a categorical variable in classic R / S-plus fashion.
252251
@@ -362,6 +361,8 @@ class Categorical(NDArrayBackedExtensionArray, PandasObject, ObjectStringArrayMi
362361
'c'
363362
"""
364363

364+
__module__ = "pandas"
365+
365366
# For comparisons, so that numpy uses our implementation if the compare
366367
# ops, which raise
367368
__array_priority__ = 1000

pandas/core/arrays/datetimes.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,6 @@ def f(self):
172172

173173

174174
class DatetimeArray(dtl.TimelikeOps, dtl.DatelikeOps):
175-
__module__ = "pandas.arrays"
176175
"""
177176
Pandas ExtensionArray for tz-naive or tz-aware datetime data.
178177
@@ -224,6 +223,8 @@ class DatetimeArray(dtl.TimelikeOps, dtl.DatelikeOps):
224223
Length: 2, dtype: datetime64[s]
225224
"""
226225

226+
__module__ = "pandas.arrays"
227+
227228
_typ = "datetimearray"
228229
_internal_fill_value = np.datetime64("NaT", "ns")
229230
_recognized_scalars = (datetime, np.datetime64)

pandas/core/arrays/floating.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ def _safe_cast(cls, values: np.ndarray, dtype: np.dtype, copy: bool) -> np.ndarr
6464

6565

6666
class FloatingArray(NumericArray):
67-
__module__ = "pandas.arrays"
6867
"""
6968
Array of floating (optional missing) values.
7069
@@ -130,6 +129,8 @@ class FloatingArray(NumericArray):
130129
Length: 3, dtype: Float32
131130
"""
132131

132+
__module__ = "pandas.arrays"
133+
133134
_dtype_cls = FloatingDtype
134135

135136

pandas/core/arrays/integer.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ def _safe_cast(cls, values: np.ndarray, dtype: np.dtype, copy: bool) -> np.ndarr
7272

7373

7474
class IntegerArray(NumericArray):
75-
__module__ = "pandas.arrays"
7675
"""
7776
Array of integer (optional missing) values.
7877
@@ -143,6 +142,8 @@ class IntegerArray(NumericArray):
143142
Length: 3, dtype: UInt16
144143
"""
145144

145+
__module__ = "pandas.arrays"
146+
146147
_dtype_cls = IntegerDtype
147148

148149

0 commit comments

Comments
 (0)