Skip to content

Commit

Permalink
switch to clang-format 19.1.0 and use pip
Browse files Browse the repository at this point in the history
  • Loading branch information
B1ueber2y committed Nov 26, 2024
1 parent 6e14755 commit 215aa50
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 13 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/format-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ jobs:
exit 0
fi
set +x -euo pipefail
sudo apt-get update && sudo apt-get install -y clang-format-14
python -m pip install ruff==0.6.7
python -m pip install ruff==0.6.7 clang-format==19.1.0
./scripts/format/clang_format.sh
./scripts/format/python.sh
git diff --name-only
Expand Down
13 changes: 9 additions & 4 deletions limap/base/bindings.cc
Original file line number Diff line number Diff line change
Expand Up @@ -734,8 +734,9 @@ void bind_camera(py::module &m) {
.def(py::init<const std::string &, int, std::pair<int, int>>(),
py::arg("model_name"), py::arg("cam_id") = -1,
py::arg("hw") = std::make_pair<int, int>(-1, -1)) // empty camera
.def("__copy__", [](const Camera& self) { return Camera(self); })
.def("__deepcopy__", [](const Camera& self, const py::dict&) { return Camera(self); })
.def("__copy__", [](const Camera &self) { return Camera(self); })
.def("__deepcopy__",
[](const Camera &self, const py::dict &) { return Camera(self); })
.def(py::pickle(
[](const Camera &input) { // dump
return input.as_dict();
Expand Down Expand Up @@ -1055,8 +1056,12 @@ void bind_camera(py::module &m) {
.def(py::init<const std::vector<CameraView> &>(), py::arg("camviews"))
.def(py::init<py::dict>(), py::arg("dict"))
.def(py::init<const ImageCollection &>(), py::arg("imagecols"))
.def("__copy__", [](const ImageCollection& self) { return ImageCollection(self); })
.def("__deepcopy__", [](const ImageCollection& self, const py::dict&) { return ImageCollection(self); })
.def("__copy__",
[](const ImageCollection &self) { return ImageCollection(self); })
.def("__deepcopy__",
[](const ImageCollection &self, const py::dict &) {
return ImageCollection(self);
})
.def(py::pickle(
[](const ImageCollection &input) { // dump
return input.as_dict();
Expand Down
4 changes: 2 additions & 2 deletions limap/base/camera.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ bool Camera::IsInitialized() const {
return true;
}

Camera::Camera(const colmap::Camera& cam) {
Camera::Camera(const colmap::Camera &cam) {
camera_id = cam.camera_id;
model_id = cam.model_id;
params = cam.params;
Expand Down Expand Up @@ -185,7 +185,7 @@ Camera::Camera(const Camera &cam) {
initialized = cam.initialized;
}

Camera& Camera::operator=(const Camera& cam) {
Camera &Camera::operator=(const Camera &cam) {
if (this != &cam) {
camera_id = cam.camera_id;
model_id = cam.model_id;
Expand Down
4 changes: 2 additions & 2 deletions limap/base/camera.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ class Camera : public colmap::Camera {
Camera(const std::string &model_name, M3D K, int cam_id = -1,
std::pair<int, int> hw = std::make_pair<int, int>(-1, -1));
Camera(py::dict dict);
Camera(const Camera& cam);
Camera& operator=(const Camera& cam);
Camera(const Camera &cam);
Camera &operator=(const Camera &cam);
Camera(int model, int cam_id = -1,
std::pair<int, int> hw = std::make_pair<int, int>(-1,
-1)); // empty camera
Expand Down
2 changes: 1 addition & 1 deletion limap/base/infinite_line.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class MinimalInfiniteLine3d {
public:
MinimalInfiniteLine3d() {}
MinimalInfiniteLine3d(const Line3d &line)
: MinimalInfiniteLine3d(InfiniteLine3d(line)){};
: MinimalInfiniteLine3d(InfiniteLine3d(line)) {};
MinimalInfiniteLine3d(const InfiniteLine3d &inf_line);
MinimalInfiniteLine3d(const std::vector<double> &values);
InfiniteLine3d GetInfiniteLine() const;
Expand Down
2 changes: 1 addition & 1 deletion limap/evaluation/refline_evaluator.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class RefLineEvaluator {
public:
RefLineEvaluator() {}
RefLineEvaluator(const std::vector<Line3d> &ref_lines)
: ref_lines_(ref_lines){};
: ref_lines_(ref_lines) {};

double SumLength() const;
double ComputeRecallRef(const std::vector<Line3d> &lines,
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ ninja
yacs
python-json-logger
ruff==0.6.7
clang-format==19.1.0

./third-party/pytlsd
./third-party/hawp
Expand Down
2 changes: 1 addition & 1 deletion scripts/format/clang_format.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ echo "Found clang-format: $(which ${clang_format})"

# Check version
version_string=$($clang_format --version | sed -E 's/^.*(\d+\.\d+\.\d+-.*).*$/\1/')
expected_version_string='14.0.0'
expected_version_string='19.1.0'
if [[ "$version_string" =~ "$expected_version_string" ]]; then
echo "clang-format version '$version_string' matches '$expected_version_string'"
else
Expand Down

0 comments on commit 215aa50

Please sign in to comment.