Skip to content

Commit b539c71

Browse files
committed
pyupgrade
1 parent 48b563a commit b539c71

File tree

21 files changed

+33
-39
lines changed

21 files changed

+33
-39
lines changed

pandas/_config/config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ def __dir__(self) -> list[str]:
411411

412412

413413
@contextmanager
414-
def option_context(*args) -> Generator[None, None, None]:
414+
def option_context(*args) -> Generator[None]:
415415
"""
416416
Context manager to temporarily set options in a ``with`` statement.
417417
@@ -718,7 +718,7 @@ def _build_option_description(k: str) -> str:
718718

719719

720720
@contextmanager
721-
def config_prefix(prefix: str) -> Generator[None, None, None]:
721+
def config_prefix(prefix: str) -> Generator[None]:
722722
"""
723723
contextmanager for multiple invocations of API with a common prefix
724724

pandas/_config/localization.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
@contextmanager
2626
def set_locale(
2727
new_locale: str | tuple[str, str], lc_var: int = locale.LC_ALL
28-
) -> Generator[str | tuple[str, str], None, None]:
28+
) -> Generator[str | tuple[str, str]]:
2929
"""
3030
Context manager for temporarily setting a locale.
3131

pandas/_testing/_warnings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def assert_produces_warning(
3535
raise_on_extra_warnings: bool = True,
3636
match: str | tuple[str | None, ...] | None = None,
3737
must_find_all_warnings: bool = True,
38-
) -> Generator[list[warnings.WarningMessage], None, None]:
38+
) -> Generator[list[warnings.WarningMessage]]:
3939
"""
4040
Context manager for running code expected to either raise a specific warning,
4141
multiple specific warnings, or not raise any warnings. Verifies that the code

pandas/_testing/contexts.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
@contextmanager
3030
def decompress_file(
3131
path: FilePath | BaseBuffer, compression: CompressionOptions
32-
) -> Generator[IO[bytes], None, None]:
32+
) -> Generator[IO[bytes]]:
3333
"""
3434
Open a compressed file and return a file object.
3535
@@ -50,7 +50,7 @@ def decompress_file(
5050

5151

5252
@contextmanager
53-
def set_timezone(tz: str) -> Generator[None, None, None]:
53+
def set_timezone(tz: str) -> Generator[None]:
5454
"""
5555
Context manager for temporarily setting a timezone.
5656
@@ -92,7 +92,7 @@ def setTZ(tz) -> None:
9292

9393

9494
@contextmanager
95-
def ensure_clean(filename=None) -> Generator[Any, None, None]:
95+
def ensure_clean(filename=None) -> Generator[Any]:
9696
"""
9797
Gets a temporary path and agrees to remove on close.
9898
@@ -124,7 +124,7 @@ def ensure_clean(filename=None) -> Generator[Any, None, None]:
124124

125125

126126
@contextmanager
127-
def with_csv_dialect(name: str, **kwargs) -> Generator[None, None, None]:
127+
def with_csv_dialect(name: str, **kwargs) -> Generator[None]:
128128
"""
129129
Context manager to temporarily register a CSV dialect for parsing CSV.
130130

pandas/compat/pickle_compat.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ def loads(
131131

132132

133133
@contextlib.contextmanager
134-
def patch_pickle() -> Generator[None, None, None]:
134+
def patch_pickle() -> Generator[None]:
135135
"""
136136
Temporarily patch pickle to use our unpickler.
137137
"""

pandas/core/apply.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -803,7 +803,7 @@ def result_columns(self) -> Index:
803803

804804
@property
805805
@abc.abstractmethod
806-
def series_generator(self) -> Generator[Series, None, None]:
806+
def series_generator(self) -> Generator[Series]:
807807
pass
808808

809809
@staticmethod
@@ -1128,7 +1128,7 @@ class FrameRowApply(FrameApply):
11281128
axis: AxisInt = 0
11291129

11301130
@property
1131-
def series_generator(self) -> Generator[Series, None, None]:
1131+
def series_generator(self) -> Generator[Series]:
11321132
return (self.obj._ixs(i, axis=1) for i in range(len(self.columns)))
11331133

11341134
@staticmethod
@@ -1235,7 +1235,7 @@ def apply_broadcast(self, target: DataFrame) -> DataFrame:
12351235
return result.T
12361236

12371237
@property
1238-
def series_generator(self) -> Generator[Series, None, None]:
1238+
def series_generator(self) -> Generator[Series]:
12391239
values = self.values
12401240
values = ensure_wrapped_if_datetimelike(values)
12411241
assert len(values) > 0

pandas/core/arrays/datetimes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2918,7 +2918,7 @@ def _generate_range(
29182918
offset: BaseOffset,
29192919
*,
29202920
unit: str,
2921-
) -> Generator[Timestamp, None, None]:
2921+
) -> Generator[Timestamp]:
29222922
"""
29232923
Generates a sequence of dates corresponding to the specified time
29242924
offset. Similar to dateutil.rrule except uses pandas DateOffset

pandas/core/common.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -560,9 +560,7 @@ def convert_to_list_like(
560560

561561

562562
@contextlib.contextmanager
563-
def temp_setattr(
564-
obj, attr: str, value, condition: bool = True
565-
) -> Generator[None, None, None]:
563+
def temp_setattr(obj, attr: str, value, condition: bool = True) -> Generator[None]:
566564
"""
567565
Temporarily set attribute on an object.
568566

pandas/core/groupby/ops.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -898,7 +898,7 @@ def _unob_index_and_ids(
898898
return unob_index, unob_ids
899899

900900
@final
901-
def get_group_levels(self) -> Generator[Index, None, None]:
901+
def get_group_levels(self) -> Generator[Index]:
902902
# Note: only called from _insert_inaxis_grouper, which
903903
# is only called for BaseGrouper, never for BinGrouper
904904
result_index = self.result_index

pandas/core/indexes/multi.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2664,7 +2664,7 @@ def _reorder_ilevels(self, order) -> MultiIndex:
26642664

26652665
def _recode_for_new_levels(
26662666
self, new_levels, copy: bool = True
2667-
) -> Generator[np.ndarray, None, None]:
2667+
) -> Generator[np.ndarray]:
26682668
if len(new_levels) > self.nlevels:
26692669
raise AssertionError(
26702670
f"Length of new_levels ({len(new_levels)}) "

0 commit comments

Comments
 (0)