Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
pybind11
Commits
3efe9d4c
Unverified
Commit
3efe9d4c
authored
Feb 01, 2023
by
Henry Schreiner
Committed by
GitHub
Feb 01, 2023
Browse files
chore: update to black 23 (#4482)
Signed-off-by:
Henry Schreiner
<
henryschreineriii@gmail.com
>
parent
44e93682
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
13 additions
and
30 deletions
+13
-30
.pre-commit-config.yaml
.pre-commit-config.yaml
+9
-9
docs/conf.py
docs/conf.py
+0
-1
pybind11/__main__.py
pybind11/__main__.py
+0
-1
pybind11/setup_helpers.py
pybind11/setup_helpers.py
+0
-3
tests/extra_python_package/test_files.py
tests/extra_python_package/test_files.py
+0
-2
tests/test_chrono.py
tests/test_chrono.py
+0
-4
tests/test_class.py
tests/test_class.py
+0
-1
tests/test_custom_type_casters.py
tests/test_custom_type_casters.py
+2
-1
tests/test_eigen_tensor.py
tests/test_eigen_tensor.py
+0
-6
tests/test_local_bindings.py
tests/test_local_bindings.py
+2
-1
tests/test_operator_overloading.py
tests/test_operator_overloading.py
+0
-1
No files found.
.pre-commit-config.yaml
View file @
3efe9d4c
...
...
@@ -54,40 +54,40 @@ repos:
# Black, the code formatter, natively supports pre-commit
-
repo
:
https://github.com/psf/black
rev
:
"
2
2
.1
2
.0"
# Keep in sync with blacken-docs
rev
:
"
2
3
.1.0"
# Keep in sync with blacken-docs
hooks
:
-
id
:
black
# Also code format the docs
-
repo
:
https://github.com/asottile/blacken-docs
rev
:
"
v
1.1
2.1
"
rev
:
"
1.1
3.0
"
hooks
:
-
id
:
blacken-docs
additional_dependencies
:
-
black==2
2
.1
0
.0
# keep in sync with black hook
-
black==2
3
.1.0
# keep in sync with black hook
# Changes tabs to spaces
-
repo
:
https://github.com/Lucas-C/pre-commit-hooks
rev
:
"
v1.
3.1
"
rev
:
"
v1.
4.2
"
hooks
:
-
id
:
remove-tabs
-
repo
:
https://github.com/sirosen/texthooks
rev
:
"
0.
4
.0"
rev
:
"
0.
5
.0"
hooks
:
-
id
:
fix-ligatures
-
id
:
fix-smartquotes
# Autoremoves unused imports
-
repo
:
https://github.com/hadialqattan/pycln
rev
:
"
v2.1.
2
"
rev
:
"
v2.1.
3
"
hooks
:
-
id
:
pycln
stages
:
[
manual
]
# Checking for common mistakes
-
repo
:
https://github.com/pre-commit/pygrep-hooks
rev
:
"
v1.
9
.0"
rev
:
"
v1.
10
.0"
hooks
:
-
id
:
python-check-blanket-noqa
-
id
:
python-check-blanket-type-ignore
...
...
@@ -116,7 +116,7 @@ repos:
# PyLint has native support - not always usable, but works for us
-
repo
:
https://github.com/PyCQA/pylint
rev
:
"
v2.1
5.9
"
rev
:
"
v2.1
6.0
"
hooks
:
-
id
:
pylint
files
:
^pybind11
...
...
@@ -175,7 +175,7 @@ repos:
# Clang format the codebase automatically
-
repo
:
https://github.com/pre-commit/mirrors-clang-format
rev
:
"
v15.0.
6
"
rev
:
"
v15.0.
7
"
hooks
:
-
id
:
clang-format
types_or
:
[
c++
,
c
,
cuda
]
docs/conf.py
View file @
3efe9d4c
...
...
@@ -358,7 +358,6 @@ def clean_up(app, exception):
def
setup
(
app
):
# Add hook for building doxygen xml when needed
app
.
connect
(
"builder-inited"
,
generate_doxygen_xml
)
...
...
pybind11/__main__.py
View file @
3efe9d4c
...
...
@@ -24,7 +24,6 @@ def print_includes() -> None:
def
main
()
->
None
:
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
"--includes"
,
...
...
pybind11/setup_helpers.py
View file @
3efe9d4c
...
...
@@ -118,7 +118,6 @@ class Pybind11Extension(_Extension): # type: ignore[misc]
self
.
extra_link_args
[:
0
]
=
flags
def
__init__
(
self
,
*
args
:
Any
,
**
kwargs
:
Any
)
->
None
:
self
.
_cxx_level
=
0
cxx_std
=
kwargs
.
pop
(
"cxx_std"
,
0
)
...
...
@@ -174,7 +173,6 @@ class Pybind11Extension(_Extension): # type: ignore[misc]
@
cxx_std
.
setter
def
cxx_std
(
self
,
level
:
int
)
->
None
:
if
self
.
_cxx_level
:
warnings
.
warn
(
"You cannot safely change the cxx_level after setting it!"
)
...
...
@@ -439,7 +437,6 @@ class ParallelCompile:
extra_postargs
:
Optional
[
List
[
str
]]
=
None
,
depends
:
Optional
[
List
[
str
]]
=
None
,
)
->
Any
:
# These lines are directly from distutils.ccompiler.CCompiler
macros
,
objects
,
extra_postargs
,
pp_opts
,
build
=
compiler
.
_setup_compile
(
# type: ignore[attr-defined]
output_dir
,
macros
,
include_dirs
,
sources
,
depends
,
extra_postargs
...
...
tests/extra_python_package/test_files.py
View file @
3efe9d4c
...
...
@@ -135,7 +135,6 @@ def normalize_line_endings(value: bytes) -> bytes:
def
test_build_sdist
(
monkeypatch
,
tmpdir
):
monkeypatch
.
chdir
(
MAIN_DIR
)
subprocess
.
run
(
...
...
@@ -186,7 +185,6 @@ def test_build_sdist(monkeypatch, tmpdir):
def
test_build_global_dist
(
monkeypatch
,
tmpdir
):
monkeypatch
.
chdir
(
MAIN_DIR
)
monkeypatch
.
setenv
(
"PYBIND11_GLOBAL_SDIST"
,
"1"
)
subprocess
.
run
(
...
...
tests/test_chrono.py
View file @
3efe9d4c
...
...
@@ -7,7 +7,6 @@ from pybind11_tests import chrono as m
def
test_chrono_system_clock
():
# Get the time from both c++ and datetime
date0
=
datetime
.
datetime
.
today
()
date1
=
m
.
test_chrono1
()
...
...
@@ -122,7 +121,6 @@ def test_chrono_system_clock_roundtrip_time(time1, tz, monkeypatch):
def
test_chrono_duration_roundtrip
():
# Get the difference between two times (a timedelta)
date1
=
datetime
.
datetime
.
today
()
date2
=
datetime
.
datetime
.
today
()
...
...
@@ -143,7 +141,6 @@ def test_chrono_duration_roundtrip():
def
test_chrono_duration_subtraction_equivalence
():
date1
=
datetime
.
datetime
.
today
()
date2
=
datetime
.
datetime
.
today
()
...
...
@@ -154,7 +151,6 @@ def test_chrono_duration_subtraction_equivalence():
def
test_chrono_duration_subtraction_equivalence_date
():
date1
=
datetime
.
date
.
today
()
date2
=
datetime
.
date
.
today
()
...
...
tests/test_class.py
View file @
3efe9d4c
...
...
@@ -185,7 +185,6 @@ def test_inheritance(msg):
def
test_inheritance_init
(
msg
):
# Single base
class
Python
(
m
.
Pet
):
def
__init__
(
self
):
...
...
tests/test_custom_type_casters.py
View file @
3efe9d4c
...
...
@@ -94,7 +94,8 @@ def test_noconvert_args(msg):
def
test_custom_caster_destruction
():
"""Tests that returning a pointer to a type that gets converted with a custom type caster gets
destroyed when the function has py::return_value_policy::take_ownership policy applied."""
destroyed when the function has py::return_value_policy::take_ownership policy applied.
"""
cstats
=
m
.
destruction_tester_cstats
()
# This one *doesn't* have take_ownership: the pointer should be used but not destroyed:
...
...
tests/test_eigen_tensor.py
View file @
3efe9d4c
...
...
@@ -59,7 +59,6 @@ def assert_equal_tensor_ref(mat, writeable=True, modified=None):
@
pytest
.
mark
.
parametrize
(
"m"
,
submodules
)
@
pytest
.
mark
.
parametrize
(
"member_name"
,
[
"member"
,
"member_view"
])
def
test_reference_internal
(
m
,
member_name
):
if
not
hasattr
(
sys
,
"getrefcount"
):
pytest
.
skip
(
"No reference counting"
)
foo
=
m
.
CustomExample
()
...
...
@@ -108,7 +107,6 @@ def test_convert_tensor_to_py(m, func_name):
@
pytest
.
mark
.
parametrize
(
"m"
,
submodules
)
def
test_bad_cpp_to_python_casts
(
m
):
with
pytest
.
raises
(
RuntimeError
,
match
=
"Cannot use reference internal when there is no parent"
):
...
...
@@ -131,7 +129,6 @@ def test_bad_cpp_to_python_casts(m):
@
pytest
.
mark
.
parametrize
(
"m"
,
submodules
)
def
test_bad_python_to_cpp_casts
(
m
):
with
pytest
.
raises
(
TypeError
,
match
=
r
"^round_trip_tensor\(\): incompatible function arguments"
):
...
...
@@ -194,7 +191,6 @@ def test_bad_python_to_cpp_casts(m):
@
pytest
.
mark
.
parametrize
(
"m"
,
submodules
)
def
test_references_actually_refer
(
m
):
a
=
m
.
reference_tensor
()
temp
=
a
[
indices
]
a
[
indices
]
=
100
...
...
@@ -211,7 +207,6 @@ def test_references_actually_refer(m):
@
pytest
.
mark
.
parametrize
(
"m"
,
submodules
)
def
test_round_trip
(
m
):
assert_equal_tensor_ref
(
m
.
round_trip_tensor
(
tensor_ref
))
with
pytest
.
raises
(
TypeError
,
match
=
"^Cannot cast array data from"
):
...
...
@@ -260,7 +255,6 @@ def test_round_trip(m):
@
pytest
.
mark
.
parametrize
(
"m"
,
submodules
)
def
test_round_trip_references_actually_refer
(
m
):
# Need to create a copy that matches the type on the C side
copy
=
np
.
array
(
tensor_ref
,
dtype
=
np
.
float64
,
order
=
m
.
needed_options
)
a
=
m
.
round_trip_view_tensor
(
copy
)
...
...
tests/test_local_bindings.py
View file @
3efe9d4c
...
...
@@ -130,7 +130,8 @@ def test_stl_bind_global():
def
test_mixed_local_global
():
"""Local types take precedence over globally registered types: a module with a `module_local`
type can be registered even if the type is already registered globally. With the module,
casting will go to the local type; outside the module casting goes to the global type."""
casting will go to the local type; outside the module casting goes to the global type.
"""
import
pybind11_cross_module_tests
as
cm
m
.
register_mixed_global
()
...
...
tests/test_operator_overloading.py
View file @
3efe9d4c
...
...
@@ -130,7 +130,6 @@ def test_nested():
def
test_overriding_eq_reset_hash
():
assert
m
.
Comparable
(
15
)
is
not
m
.
Comparable
(
15
)
assert
m
.
Comparable
(
15
)
==
m
.
Comparable
(
15
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment