Skip to content

Commit cf29d21

Browse files
committed
Fixup clang-tidy
1 parent 89aff91 commit cf29d21

56 files changed

Lines changed: 148 additions & 227 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

hal/src/main/python/hal/simulation/sim_cb.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11

22
#pragma once
33

4+
#include <cstdint>
5+
#include <functional>
6+
47
class SimCB {
58
public:
69
SimCB(std::function<void(void)> fn, std::function<void(int32_t)> cancel)

ntcore/src/main/python/ntcore/src/nt_type_caster.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44

55
#include <vector>
66

7-
namespace pybind11 {
8-
namespace detail {
7+
namespace pybind11::detail {
98

109
// ntcore uses std::vector<uint8_t> anytime there is a raw value, so
1110
// add this specialization to convert to/from bytes directly
@@ -39,5 +38,4 @@ struct type_caster<std::vector<uint8_t>> {
3938
}
4039
};
4140

42-
} // namespace detail
43-
} // namespace pybind11
41+
} // namespace pybind11::detail

ntcore/src/main/python/ntcore/src/pyentry.cpp

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@ py::object GetBooleanEntry(const wpi::nt::NetworkTableEntry& entry,
1818
py::gil_scoped_release release;
1919
value = wpi::nt::GetEntryValue(entry.GetHandle());
2020
}
21-
if (!value || value.type() != NT_BOOLEAN)
21+
if (!value || value.type() != NT_BOOLEAN) {
2222
return defaultValue;
23+
}
2324
return py::cast(value.GetBoolean());
2425
}
2526

@@ -30,8 +31,9 @@ py::object GetDoubleEntry(const wpi::nt::NetworkTableEntry& entry,
3031
py::gil_scoped_release release;
3132
value = wpi::nt::GetEntryValue(entry.GetHandle());
3233
}
33-
if (!value || value.type() != NT_DOUBLE)
34+
if (!value || value.type() != NT_DOUBLE) {
3435
return defaultValue;
36+
}
3537
return py::cast(value.GetDouble());
3638
}
3739

@@ -42,8 +44,9 @@ py::object GetFloatEntry(const wpi::nt::NetworkTableEntry& entry,
4244
py::gil_scoped_release release;
4345
value = wpi::nt::GetEntryValue(entry.GetHandle());
4446
}
45-
if (!value || value.type() != NT_FLOAT)
47+
if (!value || value.type() != NT_FLOAT) {
4648
return defaultValue;
49+
}
4750
return py::cast(value.GetFloat());
4851
}
4952

@@ -54,8 +57,9 @@ py::object GetIntegerEntry(const wpi::nt::NetworkTableEntry& entry,
5457
py::gil_scoped_release release;
5558
value = wpi::nt::GetEntryValue(entry.GetHandle());
5659
}
57-
if (!value || value.type() != NT_INTEGER)
60+
if (!value || value.type() != NT_INTEGER) {
5861
return defaultValue;
62+
}
5963
return py::cast(value.GetInteger());
6064
}
6165

@@ -66,8 +70,9 @@ py::object GetStringEntry(const wpi::nt::NetworkTableEntry& entry,
6670
py::gil_scoped_release release;
6771
value = wpi::nt::GetEntryValue(entry.GetHandle());
6872
}
69-
if (!value || value.type() != NT_STRING)
73+
if (!value || value.type() != NT_STRING) {
7074
return defaultValue;
75+
}
7176
auto s = value.GetString();
7277
return py::str(s.data(), s.size());
7378
}
@@ -79,8 +84,9 @@ py::object GetRawEntry(const wpi::nt::NetworkTableEntry& entry,
7984
py::gil_scoped_release release;
8085
value = wpi::nt::GetEntryValue(entry.GetHandle());
8186
}
82-
if (!value || value.type() != NT_RAW)
87+
if (!value || value.type() != NT_RAW) {
8388
return defaultValue;
89+
}
8490
return py::cast(value.GetRaw());
8591
}
8692

@@ -91,8 +97,9 @@ py::object GetBooleanArrayEntry(const wpi::nt::NetworkTableEntry& entry,
9197
py::gil_scoped_release release;
9298
value = wpi::nt::GetEntryValue(entry.GetHandle());
9399
}
94-
if (!value || value.type() != NT_BOOLEAN_ARRAY)
100+
if (!value || value.type() != NT_BOOLEAN_ARRAY) {
95101
return defaultValue;
102+
}
96103
// ntcore will return bit vector by default. Convert to List[bool]
97104
auto v = value.value();
98105
py::list l(v.data.arr_boolean.size);
@@ -110,8 +117,9 @@ py::object GetDoubleArrayEntry(const wpi::nt::NetworkTableEntry& entry,
110117
py::gil_scoped_release release;
111118
value = wpi::nt::GetEntryValue(entry.GetHandle());
112119
}
113-
if (!value || value.type() != NT_DOUBLE_ARRAY)
120+
if (!value || value.type() != NT_DOUBLE_ARRAY) {
114121
return defaultValue;
122+
}
115123
return py::cast(value.GetDoubleArray());
116124
}
117125

@@ -122,8 +130,9 @@ py::object GetFloatArrayEntry(const wpi::nt::NetworkTableEntry& entry,
122130
py::gil_scoped_release release;
123131
value = wpi::nt::GetEntryValue(entry.GetHandle());
124132
}
125-
if (!value || value.type() != NT_FLOAT_ARRAY)
133+
if (!value || value.type() != NT_FLOAT_ARRAY) {
126134
return defaultValue;
135+
}
127136
return py::cast(value.GetFloatArray());
128137
}
129138

@@ -134,8 +143,9 @@ py::object GetIntegerArrayEntry(const wpi::nt::NetworkTableEntry& entry,
134143
py::gil_scoped_release release;
135144
value = wpi::nt::GetEntryValue(entry.GetHandle());
136145
}
137-
if (!value || value.type() != NT_INTEGER_ARRAY)
146+
if (!value || value.type() != NT_INTEGER_ARRAY) {
138147
return defaultValue;
148+
}
139149
return py::cast(value.GetIntegerArray());
140150
}
141151

@@ -146,8 +156,9 @@ py::object GetStringArrayEntry(const wpi::nt::NetworkTableEntry& entry,
146156
py::gil_scoped_release release;
147157
value = wpi::nt::GetEntryValue(entry.GetHandle());
148158
}
149-
if (!value || value.type() != NT_STRING_ARRAY)
159+
if (!value || value.type() != NT_STRING_ARRAY) {
150160
return defaultValue;
161+
}
151162
std::span<const std::string> rval = value.GetStringArray();
152163
return py::cast(rval);
153164
}
@@ -159,8 +170,9 @@ py::object GetValueEntry(const wpi::nt::NetworkTableEntry& entry,
159170
py::gil_scoped_release release;
160171
value = wpi::nt::GetEntryValue(entry.GetHandle());
161172
}
162-
if (!value)
173+
if (!value) {
163174
return defaultValue;
175+
}
164176
return ntvalue2py(value);
165177
}
166178

wpilibc/src/main/python/wpilib/src/rpy/MotorControllerGroup.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class PyMotorControllerGroup
1919
public MotorController,
2020
public wpi::util::SendableHelper<PyMotorControllerGroup> {
2121
public:
22-
PyMotorControllerGroup(
22+
explicit PyMotorControllerGroup(
2323
std::vector<std::shared_ptr<wpi::MotorController>>&& args)
2424
: m_motorControllers(args) {}
2525
~PyMotorControllerGroup() override = default;

wpimath/src/main/python/wpimath/_impl/src/PyTrajectoryConstraint.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ struct PyTrajectoryConstraint : public TrajectoryConstraint {
2929

3030
}; // namespace wpi::math
3131

32-
namespace pybind11 {
33-
namespace detail {
32+
namespace pybind11::detail {
3433

3534
template <>
3635
struct type_caster<wpi::math::PyTrajectoryConstraint> {
@@ -59,5 +58,4 @@ struct type_caster<wpi::math::PyTrajectoryConstraint> {
5958
}
6059
};
6160

62-
} // namespace detail
63-
} // namespace pybind11
61+
} // namespace pybind11::detail

wpimath/src/main/python/wpimath/_impl/src/type_casters/_units_base_type_caster.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

33
#include <pybind11/pybind11.h>
44

5-
namespace pybind11 {
6-
namespace detail {
5+
namespace pybind11::detail {
76

87
/*
98
Units type caster assumptions
@@ -51,5 +50,4 @@ struct type_caster<wpi::units::unit_t<U, T, S>> {
5150
}
5251
};
5352

54-
} // namespace detail
55-
} // namespace pybind11
53+
} // namespace pybind11::detail

wpimath/src/main/python/wpimath/_impl/src/type_casters/units_acceleration_type_caster.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

33
#include "wpi/units/acceleration.hpp"
44

5-
namespace pybind11 {
6-
namespace detail {
5+
namespace pybind11::detail {
76
template <>
87
struct handle_type_name<wpi::units::meters_per_second_squared_t> {
98
static constexpr auto name = _("wpimath.units.meters_per_second_squared");
@@ -34,7 +33,6 @@ struct handle_type_name<wpi::units::standard_gravity> {
3433
static constexpr auto name = _("wpimath.units.standard_gravity");
3534
};
3635

37-
} // namespace detail
38-
} // namespace pybind11
36+
} // namespace pybind11::detail
3937

4038
#include "_units_base_type_caster.h"

wpimath/src/main/python/wpimath/_impl/src/type_casters/units_angle_type_caster.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

33
#include "wpi/units/angle.hpp"
44

5-
namespace pybind11 {
6-
namespace detail {
5+
namespace pybind11::detail {
76
template <>
87
struct handle_type_name<wpi::units::radian_t> {
98
static constexpr auto name = _("wpimath.units.radians");
@@ -114,7 +113,6 @@ struct handle_type_name<wpi::units::gradians> {
114113
static constexpr auto name = _("wpimath.units.gradians");
115114
};
116115

117-
} // namespace detail
118-
} // namespace pybind11
116+
} // namespace pybind11::detail
119117

120118
#include "_units_base_type_caster.h"

wpimath/src/main/python/wpimath/_impl/src/type_casters/units_angular_acceleration_type_caster.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

33
#include "wpi/units/angular_acceleration.hpp"
44

5-
namespace pybind11 {
6-
namespace detail {
5+
namespace pybind11::detail {
76
template <>
87
struct handle_type_name<wpi::units::radians_per_second_squared_t> {
98
static constexpr auto name = _("wpimath.units.radians_per_second_squared");
@@ -34,7 +33,6 @@ struct handle_type_name<wpi::units::turns_per_second_squared> {
3433
static constexpr auto name = _("wpimath.units.turns_per_second_squared");
3534
};
3635

37-
} // namespace detail
38-
} // namespace pybind11
36+
} // namespace pybind11::detail
3937

4038
#include "_units_base_type_caster.h"

wpimath/src/main/python/wpimath/_impl/src/type_casters/units_angular_velocity_type_caster.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

33
#include "wpi/units/angular_velocity.hpp"
44

5-
namespace pybind11 {
6-
namespace detail {
5+
namespace pybind11::detail {
76
template <>
87
struct handle_type_name<wpi::units::radians_per_second_t> {
98
static constexpr auto name = _("wpimath.units.radians_per_second");
@@ -54,7 +53,6 @@ struct handle_type_name<wpi::units::milliarcseconds_per_year> {
5453
static constexpr auto name = _("wpimath.units.milliarcseconds_per_year");
5554
};
5655

57-
} // namespace detail
58-
} // namespace pybind11
56+
} // namespace pybind11::detail
5957

6058
#include "_units_base_type_caster.h"

0 commit comments

Comments
 (0)