diff --git a/doc/make.py b/doc/make.py index 5d2476fcdca8d..c758c7fc84bbb 100755 --- a/doc/make.py +++ b/doc/make.py @@ -45,7 +45,7 @@ def __init__( single_doc=None, verbosity=0, warnings_are_errors=False, - ): + ) -> None: self.num_jobs = num_jobs self.include_api = include_api self.whatsnew = whatsnew diff --git a/pandas/_config/config.py b/pandas/_config/config.py index 8815bb46318c4..58c9eae5fe7f3 100644 --- a/pandas/_config/config.py +++ b/pandas/_config/config.py @@ -204,7 +204,7 @@ def get_default_val(pat: str): class DictWrapper: """provide attribute-style access to a nested dict""" - def __init__(self, d: dict[str, Any], prefix: str = ""): + def __init__(self, d: dict[str, Any], prefix: str = "") -> None: object.__setattr__(self, "d", d) object.__setattr__(self, "prefix", prefix) @@ -248,7 +248,7 @@ def __dir__(self) -> Iterable[str]: class CallableDynamicDoc: - def __init__(self, func, doc_tmpl): + def __init__(self, func, doc_tmpl) -> None: self.__doc_tmpl__ = doc_tmpl self.__func__ = func @@ -422,7 +422,7 @@ class option_context(ContextDecorator): ... pass """ - def __init__(self, *args): + def __init__(self, *args) -> None: if len(args) % 2 != 0 or len(args) < 2: raise ValueError( "Need to invoke as option_context(pat, val, [(pat, val), ...])." diff --git a/pandas/_testing/contexts.py b/pandas/_testing/contexts.py index 547ec9db20994..7df9afd68b432 100644 --- a/pandas/_testing/contexts.py +++ b/pandas/_testing/contexts.py @@ -228,7 +228,7 @@ class RNGContext: np.random.randn() """ - def __init__(self, seed): + def __init__(self, seed) -> None: self.seed = seed def __enter__(self): diff --git a/pandas/compat/numpy/function.py b/pandas/compat/numpy/function.py index cea1b80d340c8..e3aa5bb52f2ba 100644 --- a/pandas/compat/numpy/function.py +++ b/pandas/compat/numpy/function.py @@ -40,7 +40,7 @@ def __init__( fname=None, method: str | None = None, max_fname_arg_count=None, - ): + ) -> None: self.fname = fname self.method = method self.defaults = defaults diff --git a/pandas/conftest.py b/pandas/conftest.py index 8d5913ce0a9ae..a01dcd3269eb6 100644 --- a/pandas/conftest.py +++ b/pandas/conftest.py @@ -447,7 +447,7 @@ def dict_subclass(): """ class TestSubDict(dict): - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: dict.__init__(self, *args, **kwargs) return TestSubDict @@ -460,7 +460,7 @@ def non_dict_mapping_subclass(): """ class TestNonDictMapping(abc.Mapping): - def __init__(self, underlying_dict): + def __init__(self, underlying_dict) -> None: self._data = underlying_dict def __getitem__(self, key): @@ -1709,7 +1709,7 @@ class TestMemoryFS(MemoryFileSystem): protocol = "testmem" test = [None] - def __init__(self, **kwargs): + def __init__(self, **kwargs) -> None: self.test[0] = kwargs.pop("test", None) super().__init__(**kwargs) diff --git a/pandas/errors/__init__.py b/pandas/errors/__init__.py index cbe94673a8122..44f999cb1296a 100644 --- a/pandas/errors/__init__.py +++ b/pandas/errors/__init__.py @@ -186,7 +186,7 @@ class AbstractMethodError(NotImplementedError): while keeping compatibility with Python 2 and Python 3. """ - def __init__(self, class_instance, methodtype="method"): + def __init__(self, class_instance, methodtype="method") -> None: types = {"method", "classmethod", "staticmethod", "property"} if methodtype not in types: raise ValueError( diff --git a/pandas/tseries/frequencies.py b/pandas/tseries/frequencies.py index 1088b3b1a79ea..9ce70ec38870c 100644 --- a/pandas/tseries/frequencies.py +++ b/pandas/tseries/frequencies.py @@ -209,7 +209,7 @@ class _FrequencyInferer: Not sure if I can avoid the state machine here """ - def __init__(self, index, warn: bool = True): + def __init__(self, index, warn: bool = True) -> None: self.index = index self.i8values = index.asi8 diff --git a/pandas/tseries/holiday.py b/pandas/tseries/holiday.py index 365406617ab46..6fd49e2340e30 100644 --- a/pandas/tseries/holiday.py +++ b/pandas/tseries/holiday.py @@ -160,7 +160,7 @@ def __init__( start_date=None, end_date=None, days_of_week=None, - ): + ) -> None: """ Parameters ---------- @@ -393,7 +393,7 @@ class AbstractHolidayCalendar(metaclass=HolidayCalendarMetaClass): end_date = Timestamp(datetime(2200, 12, 31)) _cache = None - def __init__(self, name=None, rules=None): + def __init__(self, name=None, rules=None) -> None: """ Initializes holiday object with a given set a rules. Normally classes just have the rules defined within them. diff --git a/scripts/validate_docstrings.py b/scripts/validate_docstrings.py index df1971b998bab..3a0c437c918fb 100755 --- a/scripts/validate_docstrings.py +++ b/scripts/validate_docstrings.py @@ -136,7 +136,7 @@ def get_api_items(api_doc_fd): class PandasDocstring(Validator): - def __init__(self, func_name: str, doc_obj=None): + def __init__(self, func_name: str, doc_obj=None) -> None: self.func_name = func_name if doc_obj is None: doc_obj = get_doc_object(Validator._load_obj(func_name))