Skip to content

Commit

Permalink
chore(deps): update pre-commit hooks (#4605)
Browse files Browse the repository at this point in the history
* chore(deps): update pre-commit hooks

updates:
- [github.com/psf/black: 23.1.0 → 23.3.0](psf/black@23.1.0...23.3.0)
- [github.com/Lucas-C/pre-commit-hooks: v1.4.2 → v1.5.1](Lucas-C/pre-commit-hooks@v1.4.2...v1.5.1)
- [github.com/charliermarsh/ruff-pre-commit: v0.0.254 → v0.0.260](astral-sh/ruff-pre-commit@v0.0.254...v0.0.260)
- [github.com/PyCQA/pylint: v2.16.4 → v3.0.0a6](pylint-dev/pylint@v2.16.4...v3.0.0a6)
- [github.com/pre-commit/mirrors-mypy: v1.0.1 → v1.1.1](pre-commit/mirrors-mypy@v1.0.1...v1.1.1)
- [github.com/codespell-project/codespell: v2.2.2 → v2.2.4](codespell-project/codespell@v2.2.2...v2.2.4)
- [github.com/pre-commit/mirrors-clang-format: v15.0.7 → v16.0.0](pre-commit/mirrors-clang-format@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>
  • Loading branch information
pre-commit-ci[bot] and henryiii committed Apr 28, 2023
1 parent 3f366ff commit 5e946c2
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 42 deletions.
18 changes: 9 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand All @@ -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"]
Expand All @@ -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
Expand All @@ -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: []
Expand All @@ -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
Expand All @@ -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]
6 changes: 3 additions & 3 deletions include/pybind11/detail/type_caster_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
58 changes: 29 additions & 29 deletions tests/test_iostream.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand All @@ -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):
Expand All @@ -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):
Expand All @@ -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):
Expand All @@ -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):
Expand All @@ -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):
Expand All @@ -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):
Expand All @@ -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):
Expand All @@ -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):
Expand All @@ -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):
Expand All @@ -120,15 +120,15 @@ 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):
msg = "I've been redirected to Python, I hope!"
m.guard_output(msg)
stdout, stderr = capsys.readouterr()
assert stdout == msg
assert stderr == ""
assert not stderr


def test_series_captured(capture):
Expand All @@ -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()
Expand All @@ -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


Expand All @@ -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


Expand Down Expand Up @@ -221,21 +221,21 @@ 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()
with redirect_stdout(stream):
m.raw_output(msg)
stdout, stderr = capfd.readouterr()
assert stdout == msg
assert stream.getvalue() == ""
assert not stream.getvalue()


def test_redirect_err(capfd):
Expand All @@ -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


Expand All @@ -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

Expand Down
2 changes: 1 addition & 1 deletion tests/test_stl.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"


Expand Down

0 comments on commit 5e946c2

Please sign in to comment.