Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix open photogrammetry example not working on Windows #3705

Merged
merged 5 commits into from
Oct 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
9 changes: 7 additions & 2 deletions examples/python/open_photogrammetry_format/main.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
"""
Load an Open Photogrammetry Format (OFP) project and display the cameras and point cloud.
Load an Open Photogrammetry Format (OPF) project and display the cameras and point cloud.

OPF specification: https://pix4d.github.io/opf-spec/index.html
Dataset source: https://support.pix4d.com/hc/en-us/articles/360000235126-Example-projects-real-photogrammetry-data#OPF1
Expand Down Expand Up @@ -77,8 +77,13 @@ def __init__(self, path: Path, log_as_frames: bool = True) -> None:
log_as_frames : bool, optional
Whether to log the cameras as individual frames, by default True
"""
import os

self.path = path
self.project = resolve(load(str(path)))
# TODO(Pix4D/pyopf#6): https://github.com/Pix4D/pyopf/issues/6
# pyopf doesn't seem to work with regular windows paths, but a "UNC dos path" works
Wumpf marked this conversation as resolved.
Show resolved Hide resolved
path_as_str = "\\\\.\\" + str(path.absolute()) if os.name == "nt" else str(path)
self.project = resolve(load(path_as_str))
self.log_as_frames = log_as_frames

@classmethod
Expand Down
3 changes: 2 additions & 1 deletion scripts/lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

any_todo_pattern = re.compile(r"TODO\(.*\)")
legal_todo_inner_pattern = re.compile(
r"TODO\(((?:[a-zA-Z\-_/]+)?#\d+|[a-zA-Z]+)(?:,\s*((?:[a-zA-Z\-_/]+)?#\d+|[a-zA-Z]+))*\)"
r"TODO\(((?:[a-zA-Z\-_/]+[a-zA-Z\-_/\d]+)?#\d+|[a-zA-Z]+)(?:,\s*((?:[a-zA-Z\-_/]+)?#\d+|[a-zA-Z]+))*\)"
Copy link
Member

@emilk emilk Oct 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is over-complicated. so much unnecessary stuff in there

TODO\([\w/-]*(#\d+)?\)

should suffice

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... I gonna ignore this for now and merge ahead. Users deserve this sample working on windows, independent of this regex 😄

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll fix it then

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be fixed in Pix4D/pyopf#9 ;) thanks

)

anyhow_result = re.compile(r"Result<.*, anyhow::Error>")
Expand Down Expand Up @@ -132,6 +132,7 @@ def test_lint_line() -> None:
"TODO(#42):",
"TODO(#42,#43):",
"TODO(#42, #43):",
"TODO(n4m3/w1th-numb3r5#42)",
"TODO(rust-lang/rust#42):",
"TODO(rust-lang/rust#42,rust-lang/rust#43):",
"TODO(rust-lang/rust#42, rust-lang/rust#43):",
Expand Down
Loading