Skip to content

Commit c36be9e

Browse files
authored
Merge branch 'main' into TYP_io
2 parents d816772 + 0453fdf commit c36be9e

Some content is hidden

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

50 files changed

+71
-77
lines changed

doc/make.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def __init__(
4545
single_doc=None,
4646
verbosity=0,
4747
warnings_are_errors=False,
48-
):
48+
) -> None:
4949
self.num_jobs = num_jobs
5050
self.include_api = include_api
5151
self.whatsnew = whatsnew

pandas/_config/config.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ def get_default_val(pat: str):
204204
class DictWrapper:
205205
"""provide attribute-style access to a nested dict"""
206206

207-
def __init__(self, d: dict[str, Any], prefix: str = ""):
207+
def __init__(self, d: dict[str, Any], prefix: str = "") -> None:
208208
object.__setattr__(self, "d", d)
209209
object.__setattr__(self, "prefix", prefix)
210210

@@ -248,7 +248,7 @@ def __dir__(self) -> Iterable[str]:
248248

249249

250250
class CallableDynamicDoc:
251-
def __init__(self, func, doc_tmpl):
251+
def __init__(self, func, doc_tmpl) -> None:
252252
self.__doc_tmpl__ = doc_tmpl
253253
self.__func__ = func
254254

@@ -422,7 +422,7 @@ class option_context(ContextDecorator):
422422
... pass
423423
"""
424424

425-
def __init__(self, *args):
425+
def __init__(self, *args) -> None:
426426
if len(args) % 2 != 0 or len(args) < 2:
427427
raise ValueError(
428428
"Need to invoke as option_context(pat, val, [(pat, val), ...])."

pandas/_testing/contexts.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ class RNGContext:
228228
np.random.randn()
229229
"""
230230

231-
def __init__(self, seed):
231+
def __init__(self, seed) -> None:
232232
self.seed = seed
233233

234234
def __enter__(self):

pandas/compat/numpy/function.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def __init__(
4040
fname=None,
4141
method: str | None = None,
4242
max_fname_arg_count=None,
43-
):
43+
) -> None:
4444
self.fname = fname
4545
self.method = method
4646
self.defaults = defaults

pandas/conftest.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ def dict_subclass():
447447
"""
448448

449449
class TestSubDict(dict):
450-
def __init__(self, *args, **kwargs):
450+
def __init__(self, *args, **kwargs) -> None:
451451
dict.__init__(self, *args, **kwargs)
452452

453453
return TestSubDict
@@ -460,7 +460,7 @@ def non_dict_mapping_subclass():
460460
"""
461461

462462
class TestNonDictMapping(abc.Mapping):
463-
def __init__(self, underlying_dict):
463+
def __init__(self, underlying_dict) -> None:
464464
self._data = underlying_dict
465465

466466
def __getitem__(self, key):
@@ -1709,7 +1709,7 @@ class TestMemoryFS(MemoryFileSystem):
17091709
protocol = "testmem"
17101710
test = [None]
17111711

1712-
def __init__(self, **kwargs):
1712+
def __init__(self, **kwargs) -> None:
17131713
self.test[0] = kwargs.pop("test", None)
17141714
super().__init__(**kwargs)
17151715

pandas/core/generic.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2956,7 +2956,7 @@ def to_sql(
29562956
)
29572957
def to_pickle(
29582958
self,
2959-
path,
2959+
path: FilePath | WriteBuffer[bytes],
29602960
compression: CompressionOptions = "infer",
29612961
protocol: int = pickle.HIGHEST_PROTOCOL,
29622962
storage_options: StorageOptions = None,
@@ -2966,8 +2966,10 @@ def to_pickle(
29662966
29672967
Parameters
29682968
----------
2969-
path : str
2970-
File path where the pickled object will be stored.
2969+
path : str, path object, or file-like object
2970+
String, path object (implementing ``os.PathLike[str]``), or file-like
2971+
object implementing a binary ``write()`` function. File path where
2972+
the pickled object will be stored.
29712973
{compression_options}
29722974
protocol : int
29732975
Int which indicates which protocol should be used by the pickler,

pandas/core/indexes/multi.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1088,9 +1088,7 @@ def _engine(self):
10881088
# equivalent to sorting lexicographically the codes themselves. Notice
10891089
# that each level needs to be shifted by the number of bits needed to
10901090
# represent the _previous_ ones:
1091-
offsets = np.concatenate([lev_bits[1:], [0]]).astype( # type: ignore[arg-type]
1092-
"uint64"
1093-
)
1091+
offsets = np.concatenate([lev_bits[1:], [0]]).astype("uint64")
10941092

10951093
# Check the total number of bits needed for our representation:
10961094
if lev_bits[0] > 64:

pandas/errors/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ class AbstractMethodError(NotImplementedError):
186186
while keeping compatibility with Python 2 and Python 3.
187187
"""
188188

189-
def __init__(self, class_instance, methodtype="method"):
189+
def __init__(self, class_instance, methodtype="method") -> None:
190190
types = {"method", "classmethod", "staticmethod", "property"}
191191
if methodtype not in types:
192192
raise ValueError(

pandas/tests/base/test_constructors.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def bar(self, *args, **kwargs):
5151
pass
5252

5353
class Delegate(PandasDelegate, PandasObject):
54-
def __init__(self, obj):
54+
def __init__(self, obj) -> None:
5555
self.obj = obj
5656

5757
def test_invalid_delegation(self):

pandas/tests/dtypes/test_inference.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ class MockNumpyLikeArray:
9191
a scalar (`is_scalar(np.array(1)) == False`), but it is not list-like either.
9292
"""
9393

94-
def __init__(self, values):
94+
def __init__(self, values) -> None:
9595
self._values = values
9696

9797
def __iter__(self):
@@ -323,7 +323,7 @@ def test_is_dict_like_fails(ll):
323323
@pytest.mark.parametrize("has_contains", [True, False])
324324
def test_is_dict_like_duck_type(has_keys, has_getitem, has_contains):
325325
class DictLike:
326-
def __init__(self, d):
326+
def __init__(self, d) -> None:
327327
self.d = d
328328

329329
if has_keys:
@@ -1937,7 +1937,7 @@ def test_is_scalar_number(self):
19371937
# subclasses are.
19381938

19391939
class Numeric(Number):
1940-
def __init__(self, value):
1940+
def __init__(self, value) -> None:
19411941
self.value = value
19421942

19431943
def __int__(self):

0 commit comments

Comments
 (0)