From 61b8b5bd249908feb13f105e6c598c604d695034 Mon Sep 17 00:00:00 2001 From: Danil Iashchenko Date: Tue, 8 Mar 2022 21:59:44 +0000 Subject: [PATCH] TYP: annotation of __init__ return type (PEP 484) (pandas/utils) --- pandas/core/indexes/multi.py | 4 +--- pandas/util/_decorators.py | 4 ++-- pandas/util/_doctools.py | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/pandas/core/indexes/multi.py b/pandas/core/indexes/multi.py index f40857059a794..cdde510927081 100644 --- a/pandas/core/indexes/multi.py +++ b/pandas/core/indexes/multi.py @@ -1088,9 +1088,7 @@ def _engine(self): # equivalent to sorting lexicographically the codes themselves. Notice # that each level needs to be shifted by the number of bits needed to # represent the _previous_ ones: - offsets = np.concatenate([lev_bits[1:], [0]]).astype( # type: ignore[arg-type] - "uint64" - ) + offsets = np.concatenate([lev_bits[1:], [0]]).astype("uint64") # Check the total number of bits needed for our representation: if lev_bits[0] > 64: diff --git a/pandas/util/_decorators.py b/pandas/util/_decorators.py index 39a729bc51f35..2b160d2946b2b 100644 --- a/pandas/util/_decorators.py +++ b/pandas/util/_decorators.py @@ -435,7 +435,7 @@ def some_function(x): "%s %s wrote the Raven" """ - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: if args and kwargs: raise AssertionError("Only positional or keyword args are allowed") @@ -475,7 +475,7 @@ def my_dog(has='fleas'): addendum: str | None - def __init__(self, addendum: str | None, join: str = "", indents: int = 0): + def __init__(self, addendum: str | None, join: str = "", indents: int = 0) -> None: if indents > 0: self.addendum = indent(addendum, indents=indents) else: diff --git a/pandas/util/_doctools.py b/pandas/util/_doctools.py index 0d90d9b2871d9..18fb9a7e055b5 100644 --- a/pandas/util/_doctools.py +++ b/pandas/util/_doctools.py @@ -16,7 +16,7 @@ def __init__( cell_width: float = 0.37, cell_height: float = 0.25, font_size: float = 7.5, - ): + ) -> None: self.cell_width = cell_width self.cell_height = cell_height self.font_size = font_size