mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-26 23:22:01 +00:00
Merge branch 'pybind:master' into master
This commit is contained in:
commit
06345fd3bd
24
.codespell-ignore-lines
Normal file
24
.codespell-ignore-lines
Normal file
@ -0,0 +1,24 @@
|
||||
template <op_id id, op_type ot, typename L = undefined_t, typename R = undefined_t>
|
||||
template <typename ThisT>
|
||||
auto &this_ = static_cast<ThisT &>(*this);
|
||||
if (load_impl<ThisT>(temp, false)) {
|
||||
ssize_t nd = 0;
|
||||
auto trivial = broadcast(buffers, nd, shape);
|
||||
auto ndim = (size_t) nd;
|
||||
int nd;
|
||||
ssize_t ndim() const { return detail::array_proxy(m_ptr)->nd; }
|
||||
using op = op_impl<id, ot, Base, L_type, R_type>;
|
||||
template <op_id id, op_type ot, typename L, typename R>
|
||||
template <detail::op_id id, detail::op_type ot, typename L, typename R, typename... Extra>
|
||||
class_ &def(const detail::op_<id, ot, L, R> &op, const Extra &...extra) {
|
||||
class_ &def_cast(const detail::op_<id, ot, L, R> &op, const Extra &...extra) {
|
||||
@pytest.mark.parametrize("access", ["ro", "rw", "static_ro", "static_rw"])
|
||||
struct IntStruct {
|
||||
explicit IntStruct(int v) : value(v){};
|
||||
~IntStruct() { value = -value; }
|
||||
IntStruct(const IntStruct &) = default;
|
||||
IntStruct &operator=(const IntStruct &) = default;
|
||||
py::class_<IntStruct>(m, "IntStruct").def(py::init([](const int i) { return IntStruct(i); }));
|
||||
py::implicitly_convertible<int, IntStruct>();
|
||||
m.def("test", [](int expected, const IntStruct &in) {
|
||||
[](int expected, const IntStruct &in) {
|
4
.github/workflows/ci.yml
vendored
4
.github/workflows/ci.yml
vendored
@ -754,7 +754,7 @@ jobs:
|
||||
uses: jwlawson/actions-setup-cmake@v1.12
|
||||
|
||||
- name: Prepare MSVC
|
||||
uses: ilammy/msvc-dev-cmd@v1.10.0
|
||||
uses: ilammy/msvc-dev-cmd@v1.11.0
|
||||
with:
|
||||
arch: x86
|
||||
|
||||
@ -807,7 +807,7 @@ jobs:
|
||||
uses: jwlawson/actions-setup-cmake@v1.12
|
||||
|
||||
- name: Prepare MSVC
|
||||
uses: ilammy/msvc-dev-cmd@v1.10.0
|
||||
uses: ilammy/msvc-dev-cmd@v1.11.0
|
||||
with:
|
||||
arch: x86
|
||||
|
||||
|
@ -62,12 +62,12 @@ repos:
|
||||
|
||||
# Changes tabs to spaces
|
||||
- repo: https://github.com/Lucas-C/pre-commit-hooks
|
||||
rev: "v1.3.0"
|
||||
rev: "v1.3.1"
|
||||
hooks:
|
||||
- id: remove-tabs
|
||||
|
||||
- repo: https://github.com/sirosen/texthooks
|
||||
rev: "0.3.1"
|
||||
rev: "0.4.0"
|
||||
hooks:
|
||||
- id: fix-ligatures
|
||||
- id: fix-smartquotes
|
||||
@ -110,7 +110,7 @@ repos:
|
||||
|
||||
# PyLint has native support - not always usable, but works for us
|
||||
- repo: https://github.com/PyCQA/pylint
|
||||
rev: "v2.14.5"
|
||||
rev: "v2.15.0"
|
||||
hooks:
|
||||
- id: pylint
|
||||
files: ^pybind11
|
||||
@ -143,12 +143,14 @@ repos:
|
||||
additional_dependencies: [cmake, ninja]
|
||||
|
||||
# Check for spelling
|
||||
# Use tools/codespell_ignore_lines_from_errors.py
|
||||
# to rebuild .codespell-ignore-lines
|
||||
- repo: https://github.com/codespell-project/codespell
|
||||
rev: "v2.1.0"
|
||||
rev: "v2.2.1"
|
||||
hooks:
|
||||
- id: codespell
|
||||
exclude: ".supp$"
|
||||
args: ["-L", "nd,ot,thist"]
|
||||
args: ["-x", ".codespell-ignore-lines"]
|
||||
|
||||
# Check for common shell mistakes
|
||||
- repo: https://github.com/shellcheck-py/shellcheck-py
|
||||
|
@ -115,7 +115,7 @@ public:
|
||||
#if defined(PYPY_VERSION)
|
||||
PyObject *globals = PyEval_GetGlobals();
|
||||
PyObject *result = PyRun_String("import gc\n"
|
||||
"for i in range(2):"
|
||||
"for i in range(2):\n"
|
||||
" gc.collect()\n",
|
||||
Py_file_input,
|
||||
globals,
|
||||
|
35
tools/codespell_ignore_lines_from_errors.py
Normal file
35
tools/codespell_ignore_lines_from_errors.py
Normal file
@ -0,0 +1,35 @@
|
||||
"""Simple script for rebuilding .codespell-ignore-lines
|
||||
|
||||
Usage:
|
||||
|
||||
cat < /dev/null > .codespell-ignore-lines
|
||||
pre-commit run --all-files codespell >& /tmp/codespell_errors.txt
|
||||
python3 tools/codespell_ignore_lines_from_errors.py /tmp/codespell_errors.txt > .codespell-ignore-lines
|
||||
|
||||
git diff to review changes, then commit, push.
|
||||
"""
|
||||
|
||||
import sys
|
||||
from typing import List
|
||||
|
||||
|
||||
def run(args: List[str]) -> None:
|
||||
assert len(args) == 1, "codespell_errors.txt"
|
||||
cache = {}
|
||||
done = set()
|
||||
for line in sorted(open(args[0]).read().splitlines()):
|
||||
i = line.find(" ==> ")
|
||||
if i > 0:
|
||||
flds = line[:i].split(":")
|
||||
if len(flds) >= 2:
|
||||
filename, line_num = flds[:2]
|
||||
if filename not in cache:
|
||||
cache[filename] = open(filename).read().splitlines()
|
||||
supp = cache[filename][int(line_num) - 1]
|
||||
if supp not in done:
|
||||
print(supp)
|
||||
done.add(supp)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
run(args=sys.argv[1:])
|
Loading…
Reference in New Issue
Block a user