From 347b7c80a8b1f42c2c668f2bded409aff58f0a90 Mon Sep 17 00:00:00 2001 From: Peter Corke Date: Sat, 31 Oct 2026 11:49:34 +1000 Subject: [PATCH] chore: housekeeping leftovers from the Codacy cleanup - Delete posegraph.py, a 2020 prototype in the repository root that nothing uses: it imports the deprecated UVertex, has a stub method and debug prints, and needs itertools.pairwise (Python 3.10) in a package that supports 3.9. The Robotics Toolbox has the real PoseGraph. - examples/create_json.py: pop('dgoal', None) instead of a bare except. - Pin the two remaining third-party GitHub Actions to commit SHAs with the version in a comment, as RTB did in petercorke/robotics-toolbox-python#892: codecov/codecov-action v7.1.1 and dependabot/fetch-metadata v3.1.0. They are the commits that @v7 and @v3 point to today, so what runs is unchanged. GitHub's own actions/* stay on tags, and Dependabot updates a pinned SHA with its comment. - Ignore build/ as well as docs/build and dist/. Part of #23. Co-Authored-By: Claude Sonnet 5.5 --- .github/workflows/ci.yml | 2 +- .github/workflows/dependabot-auto-merge.yml | 2 +- .gitignore | 1 + examples/create_json.py | 5 +- posegraph.py | 105 -------------------- 5 files changed, 4 insertions(+), 111 deletions(-) delete mode 100644 posegraph.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8af21b81..b71893d0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -76,7 +76,7 @@ jobs: pytest --cov=pgraph --cov-report=xml:coverage.xml coverage report - name: Upload coverage to Codecov - uses: codecov/codecov-action@v7 + uses: codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 # v7.1.1 with: files: ./coverage.xml verbose: true diff --git a/.github/workflows/dependabot-auto-merge.yml b/.github/workflows/dependabot-auto-merge.yml index 8de7f45f..24f8d0d5 100644 --- a/.github/workflows/dependabot-auto-merge.yml +++ b/.github/workflows/dependabot-auto-merge.yml @@ -13,7 +13,7 @@ jobs: steps: - name: Dependabot metadata id: metadata - uses: dependabot/fetch-metadata@v3 + uses: dependabot/fetch-metadata@25dd0e34f4fe68f24cc83900b1fe3fe149efef98 # v3.1.0 with: github-token: "${{ secrets.GITHUB_TOKEN }}" diff --git a/.gitignore b/.gitignore index 16f919da..ddf82baf 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +build/ docs/build dist/ *.code-workspace diff --git a/examples/create_json.py b/examples/create_json.py index 88e4bef9..d2b0a404 100644 --- a/examples/create_json.py +++ b/examples/create_json.py @@ -15,10 +15,7 @@ del info['y'] del info['dbne'] del info['utmzone'] - try: - del info['dgoal'] - except: - pass + info.pop('dgoal', None) # not every place has one info['utm'] = [info['utm'][0] / 1000, info['utm'][1] / 1000] routes = [] diff --git a/posegraph.py b/posegraph.py deleted file mode 100644 index db908dee..00000000 --- a/posegraph.py +++ /dev/null @@ -1,105 +0,0 @@ -from pgraph import UGraph, UVertex, Edge -import itertools - - -class Frame(UVertex): - def __str__(self): - return f"Frame: {self.name}" - - def __repr__(self): - return self.__str__() - - def neighbours(self): - """ - Neighbours of a vertex - - ``v.neighbours()`` is a list of neighbours of this vertex. - - .. note:: For a directed graph the neighbours are those on edges leaving this vertex - """ - return [e.next(self) for e in self._edgelist] - - -class Transform(Edge): - - def __str__(self): - return f"Transform: {self.v1.name}:{self.v2.name} # [{self.data.strline()}]" - - def set(self, x): - self.data = x - - -class PoseGraph(UGraph): - - def __init__(self): - super().__init__() - self.frames = {} - self.transforms = {} - self.cache = {} - self.dirty = False - - def add_frame(self, name): - f = Frame(name=name) - self.frames[name] = f - self.add_vertex(f) - return f - - def set_transform(self, x, f1, f2): - if isinstance(f1, str): - f1 = self.frames[f1] - if isinstance(f2, str): - f2 = self.frames[f2] - - T = Transform(f1, f2, cost=1, data=x) - f1.connect(f2, edge=T) - return T - - def transform(self, start, end): - # key = (frm, to) - # if key not in self.cache: - # self.cache[key] = self.compute_transform(frm, to) - # return self.cache[key] - vertices, len = self.path_BFS(start, end) - edges = [] - for first, next in itertools.pairwise(vertices): - e = first.edgeto(next) - if e.v1 == next: - edges.append((e, False)) - elif e.v2 == next: - edges.append((e, True)) - - print(vertices) - print(edges) - - def map(self, frm, to): - pass - - -if __name__ == "__main__": - - from spatialmath import SE3 - - pg = PoseGraph() - f1 = pg.add_frame("frame1") - f2 = pg.add_frame("frame2") - f3 = pg.add_frame("frame3") - f4 = pg.add_frame("frame4") - - print(pg) - - x = SE3() - print(x) - - t12 = pg.set_transform(x, f1, f2) - t13 = pg.set_transform(x, "frame1", "frame3") - - print(pg) - - print(f1) - print(t12) - - t12.set(SE3.Trans(1, 2, 3)) - - x = pg.transform(start=f2, end=f3) # keeps a cache of paths - print(x) - # P3 = g.map(p1, from=f1, to=f