diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e3dd6b018b8aa..5bfceec6605c0 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -47,11 +47,11 @@ repos: types: [text] args: [--append-config=flake8/cython-template.cfg] - repo: https://github.com/PyCQA/isort - rev: 5.7.0 + rev: 5.8.0 hooks: - id: isort - repo: https://github.com/asottile/pyupgrade - rev: v2.10.0 + rev: v2.11.0 hooks: - id: pyupgrade args: [--py37-plus, --keep-runtime-typing] diff --git a/pandas/core/internals/blocks.py b/pandas/core/internals/blocks.py index 174ea8760b0db..800228156fcd6 100644 --- a/pandas/core/internals/blocks.py +++ b/pandas/core/internals/blocks.py @@ -827,7 +827,7 @@ def _replace_list( rb = [self if inplace else self.copy()] for i, (src, dest) in enumerate(pairs): - new_rb: List["Block"] = [] + new_rb: List[Block] = [] for blk in rb: m = masks[i] convert = i == src_len # only convert once at the end diff --git a/pandas/io/pytables.py b/pandas/io/pytables.py index 02a723902271e..99931123b0c81 100644 --- a/pandas/io/pytables.py +++ b/pandas/io/pytables.py @@ -4058,7 +4058,7 @@ def get_blk_items(mgr): tuple(b_items.tolist()): (b, b_items) for b, b_items in zip(blocks, blk_items) } - new_blocks: List["Block"] = [] + new_blocks: List[Block] = [] new_blk_items = [] for ea in values_axes: items = tuple(ea.values) diff --git a/pandas/tests/io/parser/common/test_file_buffer_url.py b/pandas/tests/io/parser/common/test_file_buffer_url.py index f09a1f7bcc492..2a3d7328aa662 100644 --- a/pandas/tests/io/parser/common/test_file_buffer_url.py +++ b/pandas/tests/io/parser/common/test_file_buffer_url.py @@ -400,7 +400,7 @@ def test_context_manageri_user_provided(all_parsers, datapath): # make sure that user-provided handles are not closed parser = all_parsers - with open(datapath("io", "data", "csv", "iris.csv"), mode="r") as path: + with open(datapath("io", "data", "csv", "iris.csv")) as path: reader = parser.read_csv(path, chunksize=1) assert not reader._engine.handles.handle.closed diff --git a/pandas/tests/io/parser/test_encoding.py b/pandas/tests/io/parser/test_encoding.py index ba6bfe9d88a03..89ece3b1a7300 100644 --- a/pandas/tests/io/parser/test_encoding.py +++ b/pandas/tests/io/parser/test_encoding.py @@ -153,7 +153,7 @@ def test_binary_mode_file_buffers( fpath = datapath(*file_path) expected = parser.read_csv(fpath, encoding=encoding) - with open(fpath, mode="r", encoding=encoding) as fa: + with open(fpath, encoding=encoding) as fa: result = parser.read_csv(fa) assert not fa.closed tm.assert_frame_equal(expected, result) diff --git a/pandas/tests/io/test_sql.py b/pandas/tests/io/test_sql.py index a22f0cd8dff83..c90f6ef956a65 100644 --- a/pandas/tests/io/test_sql.py +++ b/pandas/tests/io/test_sql.py @@ -302,7 +302,7 @@ def load_iris_data(self, datapath, request): self.drop_table("iris") self._get_exec().execute(SQL_STRINGS["create_iris"][self.flavor]) - with open(iris_csv_file, mode="r", newline=None) as iris_csv: + with open(iris_csv_file, newline=None) as iris_csv: r = csv.reader(iris_csv) next(r) # skip header row ins = SQL_STRINGS["insert_iris"][self.flavor]