mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-28 16:11:59 +00:00
Applied pre-commit formatting.
This commit is contained in:
parent
7e7f9ce67b
commit
e8aa81bd9a
@ -115,14 +115,12 @@ struct is_descr<const descr<N, Ts...>> : std::true_type {};
|
||||
/// this is useful for having a different python type hint for args vs return value,
|
||||
/// e.g., `std::filesystem::path` -> Arg: `Union[os.PathLike, str, bytes]`, return: `Path`.
|
||||
template <typename T, typename Enable = void>
|
||||
struct as_return_type
|
||||
{
|
||||
struct as_return_type {
|
||||
static constexpr auto name = T::name;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct as_return_type<T, typename std::enable_if_t<is_descr<decltype(T::return_name)>::value>>
|
||||
{
|
||||
struct as_return_type<T, typename std::enable_if_t<is_descr<decltype(T::return_name)>::value>> {
|
||||
static constexpr auto name = T::return_name;
|
||||
};
|
||||
|
||||
@ -344,9 +342,8 @@ protected:
|
||||
|
||||
/* Generate a readable signature describing the function's arguments and return
|
||||
value types */
|
||||
static constexpr auto signature
|
||||
= const_name("(") + cast_in::arg_names + const_name(") -> ")
|
||||
+ as_return_type<cast_out>::name;
|
||||
static constexpr auto signature = const_name("(") + cast_in::arg_names
|
||||
+ const_name(") -> ") + as_return_type<cast_out>::name;
|
||||
PYBIND11_DESCR_CONSTEXPR auto types = decltype(signature)::types();
|
||||
|
||||
/* Register the function with Python from generic (non-templated) code */
|
||||
|
@ -261,7 +261,10 @@ def test_fs_path(doc):
|
||||
assert m.parent_path(b"foo/bar") == Path("foo")
|
||||
assert m.parent_path(PseudoStrPath()) == Path("foo")
|
||||
assert m.parent_path(PseudoBytesPath()) == Path("foo")
|
||||
assert doc(m.parent_path) == "parent_path(arg0: Union[os.PathLike, str, bytes]) -> Path"
|
||||
assert (
|
||||
doc(m.parent_path)
|
||||
== "parent_path(arg0: Union[os.PathLike, str, bytes]) -> Path"
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.skipif(not hasattr(m, "load_variant"), reason="no <variant>")
|
||||
|
Loading…
Reference in New Issue
Block a user