Skip to content

Commit c4dd0bd

Browse files
TYP: annotation of __init__ return type (PEP 484) (misc modules) (#46280)
1 parent 1c8199f commit c4dd0bd

File tree

9 files changed

+14
-14
lines changed

9 files changed

+14
-14
lines changed

doc/make.py

+1-1
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

+3-3
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

+1-1
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

+1-1
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

+3-3
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/errors/__init__.py

+1-1
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/tseries/frequencies.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ class _FrequencyInferer:
209209
Not sure if I can avoid the state machine here
210210
"""
211211

212-
def __init__(self, index, warn: bool = True):
212+
def __init__(self, index, warn: bool = True) -> None:
213213
self.index = index
214214
self.i8values = index.asi8
215215

pandas/tseries/holiday.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ def __init__(
160160
start_date=None,
161161
end_date=None,
162162
days_of_week=None,
163-
):
163+
) -> None:
164164
"""
165165
Parameters
166166
----------
@@ -393,7 +393,7 @@ class AbstractHolidayCalendar(metaclass=HolidayCalendarMetaClass):
393393
end_date = Timestamp(datetime(2200, 12, 31))
394394
_cache = None
395395

396-
def __init__(self, name=None, rules=None):
396+
def __init__(self, name=None, rules=None) -> None:
397397
"""
398398
Initializes holiday object with a given set a rules. Normally
399399
classes just have the rules defined within them.

scripts/validate_docstrings.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ def get_api_items(api_doc_fd):
136136

137137

138138
class PandasDocstring(Validator):
139-
def __init__(self, func_name: str, doc_obj=None):
139+
def __init__(self, func_name: str, doc_obj=None) -> None:
140140
self.func_name = func_name
141141
if doc_obj is None:
142142
doc_obj = get_doc_object(Validator._load_obj(func_name))

0 commit comments

Comments
 (0)