Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/dist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ jobs:
./rdev.sh ci check-tag

- name: Install wpiformat
run: python -m pip install wpiformat==2026.64
run: python -m pip install wpiformat==2026.71

- name: Run wpiformat
run: wpiformat
Expand Down
10 changes: 10 additions & 0 deletions .wpiformat
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
cHeaderFileInclude {
_c\.h$
}

cppHeaderFileInclude {
(?<!_c)\.h$
\.inc$
\.inl$
}

generatedFileExclude {
.*/type_casters/
.*\.py$
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,15 @@ class PyTelemetryTable {
std::string_view name) const;
static void ValidateNoElementType(pybind11::handle elementType);
static void ValidateNoTypeString(std::string_view typeString);
static void ValidateNoExplicitTelemetryType(
pybind11::handle elementType, std::string_view typeString);
static void ValidateNoExplicitTelemetryType(pybind11::handle elementType,
std::string_view typeString);
static SequenceKind KindFromElementType(pybind11::handle elementType);
void LogObject(std::string_view name, pybind11::handle value,
pybind11::handle logTo) const;
void LogSequence(std::string_view name, const pybind11::sequence& value,
pybind11::handle valueType) const;
void LogStruct(std::string_view name, pybind11::handle value) const;
void LogStructSequence(std::string_view name,
const pybind11::sequence& value,
void LogStructSequence(std::string_view name, const pybind11::sequence& value,
const pybind11::type& type) const;
void LogStructSequenceImpl(
const wpi::telemetry::TelemetryTable::EntryHandle& entry,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,22 @@ void SetRaw(wpi::tunables::MockTunableBackend& self, std::string_view path,
void SetStruct(wpi::tunables::MockTunableBackend& self, std::string_view path,
pybind11::handle value);
void SetStructVector(wpi::tunables::MockTunableBackend& self,
std::string_view path,
const pybind11::sequence& value);
std::string_view path, const pybind11::sequence& value);
void SetBoolVector(wpi::tunables::MockTunableBackend& self,
std::string_view path,
const pybind11::sequence& value);
std::string_view path, const pybind11::sequence& value);
void SetInt32Vector(wpi::tunables::MockTunableBackend& self,
std::string_view path,
const pybind11::sequence& value);
std::string_view path, const pybind11::sequence& value);
void SetInt64Vector(wpi::tunables::MockTunableBackend& self,
std::string_view path,
const pybind11::sequence& value);
std::string_view path, const pybind11::sequence& value);
void SetFloatVector(wpi::tunables::MockTunableBackend& self,
std::string_view path,
const pybind11::sequence& value);
std::string_view path, const pybind11::sequence& value);
void SetDoubleVector(wpi::tunables::MockTunableBackend& self,
std::string_view path,
const pybind11::sequence& value);
std::string_view path, const pybind11::sequence& value);
void SetStringVector(wpi::tunables::MockTunableBackend& self,
std::string_view path,
const pybind11::sequence& value);
std::string_view path, const pybind11::sequence& value);
pybind11::object GetUid(const wpi::tunables::MockTunableBackend& self,
std::string_view path);
pybind11::object GetTunableValue(
const wpi::tunables::MockTunableBackend& self, std::string_view path);
pybind11::object GetTunableValue(const wpi::tunables::MockTunableBackend& self,
std::string_view path);

} // namespace wpi::tunables::python
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ class PyComplexTunableAdapter : public wpi::tunables::ComplexTunable {
std::string m_type;
mutable std::vector<std::pair<std::string, std::shared_ptr<PyTunable>>>
m_values;
std::vector<
std::pair<std::string, std::shared_ptr<PyComplexTunableAdapter>>>
std::vector<std::pair<std::string, std::shared_ptr<PyComplexTunableAdapter>>>
m_complex;
std::vector<std::pair<std::string, pybind11::object>> m_nativeComplex;
};
Expand Down
26 changes: 12 additions & 14 deletions subprojects/robotpy-tunables/tunables/src/rpy/PyTunable.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,13 @@ namespace wpi::tunables::python {

using TunableVariant =
std::variant<wpi::tunables::TunableBool, wpi::tunables::TunableInt64,
wpi::tunables::TunableDouble,
wpi::tunables::TunableString, wpi::tunables::TunableRaw,
wpi::tunables::TunableBoolVector,
wpi::tunables::TunableDouble, wpi::tunables::TunableString,
wpi::tunables::TunableRaw, wpi::tunables::TunableBoolVector,
wpi::tunables::TunableInt64Vector,
wpi::tunables::TunableDoubleVector,
wpi::tunables::TunableStringVector,
wpi::tunables::Tunable<WPyStruct, WPyStructInfo>,
wpi::tunables::Tunable<std::vector<WPyStruct>,
WPyStructInfo>>;
wpi::tunables::Tunable<std::vector<WPyStruct>, WPyStructInfo>>;

class PyTunable : public std::enable_shared_from_this<PyTunable> {
public:
Expand All @@ -52,8 +50,7 @@ class PyTunable : public std::enable_shared_from_this<PyTunable> {

template <typename T>
static constexpr bool IsStructCachedValue =
std::same_as<T, WPyStruct> ||
std::same_as<T, std::vector<WPyStruct>>;
std::same_as<T, WPyStruct> || std::same_as<T, std::vector<WPyStruct>>;

static std::vector<uint8_t> PackStructValue(const WPyStruct& value,
const WPyStructInfo& info);
Expand All @@ -71,14 +68,15 @@ class PyTunable : public std::enable_shared_from_this<PyTunable> {
void SetCached(pybind11::handle value);
void SetCachedIfChanged(pybind11::handle value);
std::optional<std::vector<uint8_t>> PackCachedStructData() const;
wpi::tunables::TunableConfig MakeConfig(
bool robust, bool isMutable, pybind11::handle properties,
std::string typeString, bool alwaysGet);
TunableVariant MakeValue(pybind11::handle value, bool robust,
bool isMutable, pybind11::object valueType,
wpi::tunables::TunableConfig MakeConfig(bool robust, bool isMutable,
pybind11::handle properties,
std::string typeString,
bool alwaysGet);
TunableVariant MakeValue(pybind11::handle value, bool robust, bool isMutable,
pybind11::object valueType,
pybind11::object elementType,
pybind11::object properties,
std::string typeString, bool alwaysGet);
pybind11::object properties, std::string typeString,
bool alwaysGet);

pybind11::object m_getter;
pybind11::object m_setter;
Expand Down
18 changes: 9 additions & 9 deletions subprojects/robotpy-tunables/tunables/src/rpy/PyTunableTable.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@ class PyTunableTable {
std::string GetPath() const;
PyTunableTable GetTable(std::string_view name);
bool Publish(std::string_view name, pybind11::object value);
std::shared_ptr<PyTunable> Add(
std::string_view name, pybind11::object value,
pybind11::object valueType, pybind11::object elementType, bool robust,
bool isMutable, pybind11::object onTune, pybind11::object properties,
std::string typeString);
std::shared_ptr<PyTunable> Add(std::string_view name, pybind11::object value,
pybind11::object valueType,
pybind11::object elementType, bool robust,
bool isMutable, pybind11::object onTune,
pybind11::object properties,
std::string typeString);
std::shared_ptr<PyTunable> PublishValue(
std::string_view name, pybind11::object getter,
pybind11::object setter, pybind11::object valueType,
pybind11::object elementType, bool robust, bool isMutable,
pybind11::object properties, std::string typeString);
std::string_view name, pybind11::object getter, pybind11::object setter,
pybind11::object valueType, pybind11::object elementType, bool robust,
bool isMutable, pybind11::object properties, std::string typeString);
void Remove(std::string_view name);

private:
Expand Down
Loading