Skip to content

Commit a0c3eef

Browse files
authored
STYLE pre-commit autoupdate (#49943)
pre-commit autoupdate Co-authored-by: MarcoGorelli <>
1 parent 14dc069 commit a0c3eef

File tree

8 files changed

+21
-30
lines changed

8 files changed

+21
-30
lines changed

.pre-commit-config.yaml

+7-7
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ repos:
2828
types_or: [python, rst, markdown]
2929
additional_dependencies: [tomli]
3030
- repo: https://github.com/MarcoGorelli/cython-lint
31-
rev: v0.2.1
31+
rev: v0.9.1
3232
hooks:
3333
- id: cython-lint
3434
- repo: https://github.com/pre-commit/pre-commit-hooks
35-
rev: v4.3.0
35+
rev: v4.4.0
3636
hooks:
3737
- id: debug-statements
3838
- id: end-of-file-fixer
@@ -51,22 +51,22 @@ repos:
5151
exclude: ^pandas/_libs/src/(klib|headers)/
5252
args: [--quiet, '--extensions=c,h', '--headers=h', --recursive, '--filter=-readability/casting,-runtime/int,-build/include_subdir']
5353
- repo: https://github.com/PyCQA/flake8
54-
rev: 5.0.4
54+
rev: 6.0.0
5555
hooks:
5656
- id: flake8
5757
# Need to patch os.remove rule in pandas-dev-flaker
5858
exclude: ^ci/fix_wheels.py
5959
additional_dependencies: &flake8_dependencies
60-
- flake8==5.0.4
60+
- flake8==6.0.0
6161
- flake8-bugbear==22.7.1
6262
- pandas-dev-flaker==0.5.0
6363
- repo: https://github.com/pycqa/pylint
64-
rev: v2.15.5
64+
rev: v2.15.6
6565
hooks:
6666
- id: pylint
6767
stages: [manual]
6868
- repo: https://github.com/pycqa/pylint
69-
rev: v2.15.5
69+
rev: v2.15.6
7070
hooks:
7171
- id: pylint
7272
alias: redefined-outer-name
@@ -89,7 +89,7 @@ repos:
8989
hooks:
9090
- id: isort
9191
- repo: https://github.com/asottile/pyupgrade
92-
rev: v3.2.0
92+
rev: v3.2.2
9393
hooks:
9494
- id: pyupgrade
9595
args: [--py38-plus]

environment.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ dependencies:
8787
# code checks
8888
- black=22.3.0
8989
- cpplint
90-
- flake8=5.0.4
90+
- flake8=6.0.0
9191
- flake8-bugbear=22.7.1 # used by flake8, find likely bugs
9292
- isort>=5.2.1 # check that imports are in the right order
9393
- mypy=0.990

pandas/_libs/parsers.pyx

+6-15
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
# Copyright (c) 2012, Lambda Foundry, Inc.
22
# See LICENSE for the license
3-
from base64 import decode
43
from collections import defaultdict
54
from csv import (
65
QUOTE_MINIMAL,
76
QUOTE_NONE,
87
QUOTE_NONNUMERIC,
98
)
10-
from errno import ENOENT
11-
import inspect
129
import sys
1310
import time
1411
import warnings
@@ -24,10 +21,7 @@ from pandas.core.arrays import (
2421
)
2522

2623
cimport cython
27-
from cpython.bytes cimport (
28-
PyBytes_AsString,
29-
PyBytes_FromString,
30-
)
24+
from cpython.bytes cimport PyBytes_AsString
3125
from cpython.exc cimport (
3226
PyErr_Fetch,
3327
PyErr_Occurred,
@@ -631,7 +625,7 @@ cdef class TextReader:
631625
cdef:
632626
Py_ssize_t i, start, field_count, passed_count, unnamed_count, level
633627
char *word
634-
str name, old_name
628+
str name
635629
uint64_t hr, data_line = 0
636630
list header = []
637631
set unnamed_cols = set()
@@ -939,7 +933,7 @@ cdef class TextReader:
939933
object name, na_flist, col_dtype = None
940934
bint na_filter = 0
941935
int64_t num_cols
942-
dict result
936+
dict results
943937
bint use_nullable_dtypes
944938

945939
start = self.parser_start
@@ -1461,7 +1455,7 @@ cdef _string_box_utf8(parser_t *parser, int64_t col,
14611455
bint na_filter, kh_str_starts_t *na_hashset,
14621456
const char *encoding_errors):
14631457
cdef:
1464-
int error, na_count = 0
1458+
int na_count = 0
14651459
Py_ssize_t i, lines
14661460
coliter_t it
14671461
const char *word = NULL
@@ -1517,16 +1511,14 @@ cdef _categorical_convert(parser_t *parser, int64_t col,
15171511
"Convert column data into codes, categories"
15181512
cdef:
15191513
int na_count = 0
1520-
Py_ssize_t i, size, lines
1514+
Py_ssize_t i, lines
15211515
coliter_t it
15221516
const char *word = NULL
15231517

15241518
int64_t NA = -1
15251519
int64_t[::1] codes
15261520
int64_t current_category = 0
15271521

1528-
char *errors = "strict"
1529-
15301522
int ret = 0
15311523
kh_str_t *table
15321524
khiter_t k
@@ -1972,7 +1964,6 @@ cdef kh_str_starts_t* kset_from_list(list values) except NULL:
19721964
cdef kh_float64_t* kset_float64_from_list(values) except NULL:
19731965
# caller takes responsibility for freeing the hash table
19741966
cdef:
1975-
khiter_t k
19761967
kh_float64_t *table
19771968
int ret = 0
19781969
float64_t val
@@ -1983,7 +1974,7 @@ cdef kh_float64_t* kset_float64_from_list(values) except NULL:
19831974
for value in values:
19841975
val = float(value)
19851976

1986-
k = kh_put_float64(table, val, &ret)
1977+
kh_put_float64(table, val, &ret)
19871978

19881979
if table.n_buckets <= 128:
19891980
# See reasoning in kset_from_list

pandas/_libs/tslibs/timestamps.pyx

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ from cpython.datetime cimport ( # alias bc `tzinfo` is a kwarg below
2828
PyTZInfo_Check,
2929
datetime,
3030
import_datetime,
31-
time,
31+
time as dt_time,
3232
tzinfo as tzinfo_type,
3333
)
3434
from cpython.object cimport (
@@ -120,7 +120,7 @@ from pandas._libs.tslibs.tzconversion cimport (
120120

121121
# ----------------------------------------------------------------------
122122
# Constants
123-
_zero_time = time(0, 0)
123+
_zero_time = dt_time(0, 0)
124124
_no_input = object()
125125

126126
# ----------------------------------------------------------------------

pandas/tests/frame/indexing/test_getitem.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,8 @@ def test_getitem_dupe_cols(self):
115115
iter,
116116
Index,
117117
set,
118-
lambda l: dict(zip(l, range(len(l)))),
119-
lambda l: dict(zip(l, range(len(l)))).keys(),
118+
lambda keys: dict(zip(keys, range(len(keys)))),
119+
lambda keys: dict(zip(keys, range(len(keys)))).keys(),
120120
],
121121
ids=["list", "iter", "Index", "set", "dict", "dict_keys"],
122122
)

pandas/tests/io/json/test_readlines.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ def test_readjson_chunks_multiple_empty_lines(chunksize):
207207

208208
def test_readjson_unicode(monkeypatch):
209209
with tm.ensure_clean("test.json") as path:
210-
monkeypatch.setattr("locale.getpreferredencoding", lambda l: "cp949")
210+
monkeypatch.setattr("locale.getpreferredencoding", lambda do_setlocale: "cp949")
211211
with open(path, "w", encoding="utf-8") as f:
212212
f.write('{"£©µÀÆÖÞßéöÿ":["АБВГДабвгд가"]}')
213213

pandas/tests/io/pytables/test_round_trip.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ def test_index_types(setup_path):
302302
with catch_warnings(record=True):
303303
values = np.random.randn(2)
304304

305-
func = lambda l, r: tm.assert_series_equal(l, r, check_index_type=True)
305+
func = lambda lhs, rhs: tm.assert_series_equal(lhs, rhs, check_index_type=True)
306306

307307
with catch_warnings(record=True):
308308
ser = Series(values, [0, "y"])

requirements-dev.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ flask
6464
asv
6565
black==22.3.0
6666
cpplint
67-
flake8==5.0.4
67+
flake8==6.0.0
6868
flake8-bugbear==22.7.1
6969
isort>=5.2.1
7070
mypy==0.990

0 commit comments

Comments
 (0)