Skip to content

Commit b26ddaf

Browse files
committed
Apply ruff changes
1 parent b26f4ff commit b26ddaf

File tree

4 files changed

+11
-17
lines changed

4 files changed

+11
-17
lines changed

pandas/_typing.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ def mode(self) -> str:
273273
# for _get_filepath_or_buffer
274274
...
275275

276-
def seek(self, __offset: int, __whence: int = ...) -> int:
276+
def seek(self, offset: int, whence: int = ..., /) -> int:
277277
# with one argument: gzip.GzipFile, bz2.BZ2File
278278
# with two arguments: zip.ZipFile, read_sas
279279
...
@@ -288,13 +288,13 @@ def tell(self) -> int:
288288

289289

290290
class ReadBuffer(BaseBuffer, Protocol[AnyStr_co]):
291-
def read(self, __n: int = ...) -> AnyStr_co:
291+
def read(self, n: int = ..., /) -> AnyStr_co:
292292
# for BytesIOWrapper, gzip.GzipFile, bz2.BZ2File
293293
...
294294

295295

296296
class WriteBuffer(BaseBuffer, Protocol[AnyStr_contra]):
297-
def write(self, __b: AnyStr_contra) -> Any:
297+
def write(self, b: AnyStr_contra, /) -> Any:
298298
# for gzip.GzipFile, bz2.BZ2File
299299
...
300300

pandas/api/typing/__init__.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,18 +42,16 @@
4242
"ExponentialMovingWindowGroupby",
4343
"FrozenList",
4444
"JsonReader",
45-
"NaTType",
4645
"NAType",
46+
"NaTType",
4747
"PeriodIndexResamplerGroupby",
4848
"Resampler",
4949
"Rolling",
5050
"RollingGroupby",
51+
"SASReader",
5152
"SeriesGroupBy",
5253
"StataReader",
53-
"SASReader",
54-
# See TODO above
55-
# "Styler",
56-
"TimedeltaIndexResamplerGroupby",
5754
"TimeGrouper",
55+
"TimedeltaIndexResamplerGroupby",
5856
"Window",
5957
]

pandas/io/stata.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2206,15 +2206,15 @@ def _convert_datetime_to_stata_type(fmt: str) -> np.dtype:
22062206

22072207
def _maybe_convert_to_int_keys(convert_dates: dict, varlist: list[Hashable]) -> dict:
22082208
new_dict = {}
2209-
for key in convert_dates:
2210-
if not convert_dates[key].startswith("%"): # make sure proper fmts
2211-
convert_dates[key] = "%" + convert_dates[key]
2209+
for key, value in convert_dates.items():
2210+
if not value.startswith("%"): # make sure proper fmts
2211+
convert_dates[key] = "%" + value
22122212
if key in varlist:
2213-
new_dict.update({varlist.index(key): convert_dates[key]})
2213+
new_dict[varlist.index(key)] = value
22142214
else:
22152215
if not isinstance(key, int):
22162216
raise ValueError("convert_dates key must be a column or an integer")
2217-
new_dict.update({key: convert_dates[key]})
2217+
new_dict[key] = value
22182218
return new_dict
22192219

22202220

pyproject.toml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -304,10 +304,6 @@ ignore = [
304304
"PERF102",
305305
# try-except-in-loop, becomes useless in Python 3.11
306306
"PERF203",
307-
# pytest-missing-fixture-name-underscore
308-
"PT004",
309-
# pytest-incorrect-fixture-name-underscore
310-
"PT005",
311307
# pytest-parametrize-names-wrong-type
312308
"PT006",
313309
# pytest-parametrize-values-wrong-type

0 commit comments

Comments
 (0)