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

Windows fix for FormatCBFMini #742

Merged
merged 3 commits into from
Jul 23, 2024
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
2 changes: 2 additions & 0 deletions newsfragments/742.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
``FormatCBFMini``: when parsing header lines for a timestamp, avoid clashes with Windows paths.

12 changes: 10 additions & 2 deletions src/dxtbx/format/FormatCBFMini.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,11 @@ def _get_timestamp_from_raw_header(
header = header.splitlines()
timestamp = None
for record in header:
if len(record[1:].split()) <= 2 and record.count(":") == 2:
if (
len(record[1:].split()) <= 2
and record.count(":") == 2
and "Image_path" not in record
):
timestamp = datetime.datetime.fromisoformat(record[1:].strip())
break
return timestamp
Expand All @@ -100,7 +104,11 @@ def _start(self):
if record[:1] != "#":
continue

if len(record[1:].split()) <= 2 and record.count(":") == 2:
if (
len(record[1:].split()) <= 2
and record.count(":") == 2
and "Image_path" not in record
):
self._cif_header_dictionary["timestamp"] = record[1:].strip()
continue

Expand Down
Loading