chore(deps): update pre-commit hooks (#4605)

* chore(deps): update pre-commit hooks

updates:
- [github.com/psf/black: 23.1.0 → 23.3.0](https://github.com/psf/black/compare/23.1.0...23.3.0)
- [github.com/Lucas-C/pre-commit-hooks: v1.4.2 → v1.5.1](https://github.com/Lucas-C/pre-commit-hooks/compare/v1.4.2...v1.5.1)
- [github.com/charliermarsh/ruff-pre-commit: v0.0.254 → v0.0.260](https://github.com/charliermarsh/ruff-pre-commit/compare/v0.0.254...v0.0.260)
- [github.com/PyCQA/pylint: v2.16.4 → v3.0.0a6](https://github.com/PyCQA/pylint/compare/v2.16.4...v3.0.0a6)
- [github.com/pre-commit/mirrors-mypy: v1.0.1 → v1.1.1](https://github.com/pre-commit/mirrors-mypy/compare/v1.0.1...v1.1.1)
- [github.com/codespell-project/codespell: v2.2.2 → v2.2.4](https://github.com/codespell-project/codespell/compare/v2.2.2...v2.2.4)
- [github.com/pre-commit/mirrors-clang-format: v15.0.7 → v16.0.0](https://github.com/pre-commit/mirrors-clang-format/compare/v15.0.7...v16.0.0)

* style: pre-commit fixes

* style: fix issues

* Update tests/test_call_policies.py

* Update tests/test_call_policies.py

* fix: ignore code in file

* style: pre-commit fixes

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
This commit is contained in:
pre-commit-ci[bot] 2023-04-28 14:32:32 -04:00 committed by GitHub
parent 3f366ff888
commit 5e946c2fa5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 43 additions and 42 deletions

View File

@ -41,7 +41,7 @@ repos:
# Black, the code formatter, natively supports pre-commit
- repo: https://github.com/psf/black
rev: "23.1.0" # Keep in sync with blacken-docs
rev: "23.3.0" # Keep in sync with blacken-docs
hooks:
- id: black
@ -51,11 +51,11 @@ repos:
hooks:
- id: blacken-docs
additional_dependencies:
- black==23.1.0 # keep in sync with black hook
- black==23.3.0 # keep in sync with black hook
# Changes tabs to spaces
- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: "v1.4.2"
rev: "v1.5.1"
hooks:
- id: remove-tabs
@ -68,7 +68,7 @@ repos:
# Ruff, the Python auto-correcting linter written in Rust
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.254
rev: v0.0.263
hooks:
- id: ruff
args: ["--fix", "--show-fixes"]
@ -84,7 +84,7 @@ repos:
# PyLint has native support - not always usable, but works for us
- repo: https://github.com/PyCQA/pylint
rev: "v2.16.4"
rev: "v3.0.0a6"
hooks:
- id: pylint
files: ^pybind11
@ -100,7 +100,7 @@ repos:
# Check static types with mypy
- repo: https://github.com/pre-commit/mirrors-mypy
rev: "v1.0.1"
rev: "v1.1.1"
hooks:
- id: mypy
args: []
@ -120,11 +120,11 @@ repos:
# Use tools/codespell_ignore_lines_from_errors.py
# to rebuild .codespell-ignore-lines
- repo: https://github.com/codespell-project/codespell
rev: "v2.2.2"
rev: "v2.2.4"
hooks:
- id: codespell
exclude: ".supp$"
args: ["-x", ".codespell-ignore-lines"]
args: ["-x.codespell-ignore-lines", "-Lccompiler"]
# Check for common shell mistakes
- repo: https://github.com/shellcheck-py/shellcheck-py
@ -143,7 +143,7 @@ repos:
# Clang format the codebase automatically
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: "v15.0.7"
rev: "v16.0.0"
hooks:
- id: clang-format
types_or: [c++, c, cuda]

View File

@ -258,9 +258,9 @@ struct value_and_holder {
// Main constructor for a found value/holder:
value_and_holder(instance *i, const detail::type_info *type, size_t vpos, size_t index)
: inst{i}, index{index}, type{type}, vh{inst->simple_layout
? inst->simple_value_holder
: &inst->nonsimple.values_and_holders[vpos]} {}
: inst{i}, index{index}, type{type},
vh{inst->simple_layout ? inst->simple_value_holder
: &inst->nonsimple.values_and_holders[vpos]} {}
// Default constructor (used to signal a value-and-holder not found by get_value_and_holder())
value_and_holder() = default;

View File

@ -93,3 +93,4 @@ isort.known-first-party = ["env", "pybind11_cross_module_tests", "pybind11_tests
[tool.ruff.per-file-ignores]
"tests/**" = ["EM", "N"]
"tests/test_call_policies.py" = ["PLC1901"]

View File

@ -9,16 +9,16 @@ def test_captured(capsys):
m.captured_output(msg)
stdout, stderr = capsys.readouterr()
assert stdout == msg
assert stderr == ""
assert not stderr
m.captured_output_default(msg)
stdout, stderr = capsys.readouterr()
assert stdout == msg
assert stderr == ""
assert not stderr
m.captured_err(msg)
stdout, stderr = capsys.readouterr()
assert stdout == ""
assert not stdout
assert stderr == msg
@ -30,7 +30,7 @@ def test_captured_large_string(capsys):
m.captured_output_default(msg)
stdout, stderr = capsys.readouterr()
assert stdout == msg
assert stderr == ""
assert not stderr
def test_captured_utf8_2byte_offset0(capsys):
@ -40,7 +40,7 @@ def test_captured_utf8_2byte_offset0(capsys):
m.captured_output_default(msg)
stdout, stderr = capsys.readouterr()
assert stdout == msg
assert stderr == ""
assert not stderr
def test_captured_utf8_2byte_offset1(capsys):
@ -50,7 +50,7 @@ def test_captured_utf8_2byte_offset1(capsys):
m.captured_output_default(msg)
stdout, stderr = capsys.readouterr()
assert stdout == msg
assert stderr == ""
assert not stderr
def test_captured_utf8_3byte_offset0(capsys):
@ -60,7 +60,7 @@ def test_captured_utf8_3byte_offset0(capsys):
m.captured_output_default(msg)
stdout, stderr = capsys.readouterr()
assert stdout == msg
assert stderr == ""
assert not stderr
def test_captured_utf8_3byte_offset1(capsys):
@ -70,7 +70,7 @@ def test_captured_utf8_3byte_offset1(capsys):
m.captured_output_default(msg)
stdout, stderr = capsys.readouterr()
assert stdout == msg
assert stderr == ""
assert not stderr
def test_captured_utf8_3byte_offset2(capsys):
@ -80,7 +80,7 @@ def test_captured_utf8_3byte_offset2(capsys):
m.captured_output_default(msg)
stdout, stderr = capsys.readouterr()
assert stdout == msg
assert stderr == ""
assert not stderr
def test_captured_utf8_4byte_offset0(capsys):
@ -90,7 +90,7 @@ def test_captured_utf8_4byte_offset0(capsys):
m.captured_output_default(msg)
stdout, stderr = capsys.readouterr()
assert stdout == msg
assert stderr == ""
assert not stderr
def test_captured_utf8_4byte_offset1(capsys):
@ -100,7 +100,7 @@ def test_captured_utf8_4byte_offset1(capsys):
m.captured_output_default(msg)
stdout, stderr = capsys.readouterr()
assert stdout == msg
assert stderr == ""
assert not stderr
def test_captured_utf8_4byte_offset2(capsys):
@ -110,7 +110,7 @@ def test_captured_utf8_4byte_offset2(capsys):
m.captured_output_default(msg)
stdout, stderr = capsys.readouterr()
assert stdout == msg
assert stderr == ""
assert not stderr
def test_captured_utf8_4byte_offset3(capsys):
@ -120,7 +120,7 @@ def test_captured_utf8_4byte_offset3(capsys):
m.captured_output_default(msg)
stdout, stderr = capsys.readouterr()
assert stdout == msg
assert stderr == ""
assert not stderr
def test_guard_capture(capsys):
@ -128,7 +128,7 @@ def test_guard_capture(capsys):
m.guard_output(msg)
stdout, stderr = capsys.readouterr()
assert stdout == msg
assert stderr == ""
assert not stderr
def test_series_captured(capture):
@ -145,7 +145,7 @@ def test_flush(capfd):
with m.ostream_redirect():
m.noisy_function(msg, flush=False)
stdout, stderr = capfd.readouterr()
assert stdout == ""
assert not stdout
m.noisy_function(msg2, flush=True)
stdout, stderr = capfd.readouterr()
@ -164,15 +164,15 @@ def test_not_captured(capfd):
m.raw_output(msg)
stdout, stderr = capfd.readouterr()
assert stdout == msg
assert stderr == ""
assert stream.getvalue() == ""
assert not stderr
assert not stream.getvalue()
stream = StringIO()
with redirect_stdout(stream):
m.captured_output(msg)
stdout, stderr = capfd.readouterr()
assert stdout == ""
assert stderr == ""
assert not stdout
assert not stderr
assert stream.getvalue() == msg
@ -182,16 +182,16 @@ def test_err(capfd):
with redirect_stderr(stream):
m.raw_err(msg)
stdout, stderr = capfd.readouterr()
assert stdout == ""
assert not stdout
assert stderr == msg
assert stream.getvalue() == ""
assert not stream.getvalue()
stream = StringIO()
with redirect_stderr(stream):
m.captured_err(msg)
stdout, stderr = capfd.readouterr()
assert stdout == ""
assert stderr == ""
assert not stdout
assert not stderr
assert stream.getvalue() == msg
@ -221,13 +221,13 @@ def test_redirect(capfd):
m.raw_output(msg)
stdout, stderr = capfd.readouterr()
assert stdout == msg
assert stream.getvalue() == ""
assert not stream.getvalue()
stream = StringIO()
with redirect_stdout(stream), m.ostream_redirect():
m.raw_output(msg)
stdout, stderr = capfd.readouterr()
assert stdout == ""
assert not stdout
assert stream.getvalue() == msg
stream = StringIO()
@ -235,7 +235,7 @@ def test_redirect(capfd):
m.raw_output(msg)
stdout, stderr = capfd.readouterr()
assert stdout == msg
assert stream.getvalue() == ""
assert not stream.getvalue()
def test_redirect_err(capfd):
@ -248,7 +248,7 @@ def test_redirect_err(capfd):
m.raw_err(msg2)
stdout, stderr = capfd.readouterr()
assert stdout == msg
assert stderr == ""
assert not stderr
assert stream.getvalue() == msg2
@ -262,8 +262,8 @@ def test_redirect_both(capfd):
m.raw_output(msg)
m.raw_err(msg2)
stdout, stderr = capfd.readouterr()
assert stdout == ""
assert stderr == ""
assert not stdout
assert not stderr
assert stream.getvalue() == msg
assert stream2.getvalue() == msg2

View File

@ -367,7 +367,7 @@ def test_issue_1561():
"""check fix for issue #1561"""
bar = m.Issue1561Outer()
bar.list = [m.Issue1561Inner("bar")]
bar.list
assert bar.list
assert bar.list[0].data == "bar"