Skip to content
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: 1 addition & 1 deletion src/murfey/client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ def run():

if args.remove_files:
remove_prompt = Confirm.ask(
f"Are you sure you want to remove files from {args.source or Path('.').resolve()}?"
f"Are you sure you want to remove files from {args.source or Path('.').absolute()}?"
)
if not remove_prompt:
exit("Exiting")
Expand Down
10 changes: 7 additions & 3 deletions src/murfey/client/analyser.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,10 @@
f"Metadata gathering failed with a key error for key: {e.args[0]}"
)
raise e
except ValueError as e:
logger.error(

Check warning on line 306 in src/murfey/client/analyser.py

View check run for this annotation

Codecov / codecov/patch

src/murfey/client/analyser.py#L305-L306

Added lines #L305 - L306 were not covered by tests
f"Metadata gathering failed with a value error: {e}"
)
if not dc_metadata or not self._force_mdoc_metadata:
self._unseen_xml.append(transferred_file)
else:
Expand Down Expand Up @@ -406,16 +410,16 @@
data_directories = self._murfey_config.get("data_directories", [])
for dd in data_directories:
if str(data_file).startswith(dd):
base_dir = Path(dd)
mid_dir = data_file.relative_to(dd).parent
base_dir = Path(dd).absolute()
mid_dir = data_file.relative_to(base_dir).parent

Check warning on line 414 in src/murfey/client/analyser.py

View check run for this annotation

Codecov / codecov/patch

src/murfey/client/analyser.py#L413-L414

Added lines #L413 - L414 were not covered by tests
break
else:
return data_file.with_suffix(".xml")
return base_dir / self._environment.visit / mid_dir / file_name

def enqueue(self, rsyncer: RSyncerUpdate):
if not self._stopping and rsyncer.outcome == TransferResult.SUCCESS:
absolute_path = (self._basepath / rsyncer.file_path).resolve()
absolute_path = (self._basepath / rsyncer.file_path).absolute()

Check warning on line 422 in src/murfey/client/analyser.py

View check run for this annotation

Codecov / codecov/patch

src/murfey/client/analyser.py#L422

Added line #L422 was not covered by tests
self.queue.put(absolute_path)

def start(self):
Expand Down
4 changes: 2 additions & 2 deletions src/murfey/client/contexts/spa.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@
) -> Path:
for dd in data_directories:
if str(f).startswith(str(dd)):
base_dir = dd
mid_dir = f.relative_to(dd).parent
base_dir = dd.absolute()
mid_dir = f.relative_to(base_dir).parent

Check warning on line 65 in src/murfey/client/contexts/spa.py

View check run for this annotation

Codecov / codecov/patch

src/murfey/client/contexts/spa.py#L64-L65

Added lines #L64 - L65 were not covered by tests
break
else:
raise ValueError(f"Could not determine grid square metadata path for {f}")
Expand Down
2 changes: 1 addition & 1 deletion src/murfey/client/rsync.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@

def enqueue(self, file_path: Path):
if not self._stopping:
absolute_path = (self._basepath / file_path).resolve()
absolute_path = self._basepath / file_path

Check warning on line 202 in src/murfey/client/rsync.py

View check run for this annotation

Codecov / codecov/patch

src/murfey/client/rsync.py#L202

Added line #L202 was not covered by tests
self.queue.put(absolute_path)

def _process(self):
Expand Down
28 changes: 15 additions & 13 deletions src/murfey/client/tui/screens.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,15 @@
_default = ""
if environment.processing_only_mode and environment.sources:
log.info(f"Processing only mode with sources {environment.sources}")
_default = str(environment.sources[0].resolve()) or str(Path.cwd())
_default = str(environment.sources[0].absolute()) or str(Path.cwd())

Check warning on line 91 in src/murfey/client/tui/screens.py

View check run for this annotation

Codecov / codecov/patch

src/murfey/client/tui/screens.py#L91

Added line #L91 was not covered by tests
elif machine_data.get("data_directories"):
for data_dir in machine_data["data_directories"]:
if source.resolve() == Path(data_dir):
if source.absolute() == Path(data_dir).absolute():
_default = f"{destination}/{visit}"
break
else:
try:
mid_path = source.resolve().relative_to(data_dir)
mid_path = source.absolute().relative_to(Path(data_dir).absolute())

Check warning on line 99 in src/murfey/client/tui/screens.py

View check run for this annotation

Codecov / codecov/patch

src/murfey/client/tui/screens.py#L99

Added line #L99 was not covered by tests
if use_suggested_path:
with global_env_lock:
source_name = (
Expand Down Expand Up @@ -221,7 +221,7 @@
self.valid_selection = True
return
for d in self._data_directories:
if Path(self._selected_path).resolve().is_relative_to(d):
if Path(self._selected_path).absolute().is_relative_to(d.absolute()):
self.valid_selection = True
break
else:
Expand Down Expand Up @@ -282,7 +282,9 @@
btn_disabled = True
for d in machine_data.get("data_directories", []):
if (
Path(self._dir_tree._selected_path).resolve().is_relative_to(d)
Path(self._dir_tree._selected_path)
.absolute()
.is_relative_to(Path(d).absolute())
or self.app._environment.processing_only_mode
):
btn_disabled = False
Expand All @@ -306,7 +308,7 @@
self._add_btn.disabled = True

def _add_directory(self, directory: str, add_destination: bool = True):
source = Path(self._dir_tree.path).resolve() / directory
source = Path(self._dir_tree.path).absolute() / directory

Check warning on line 311 in src/murfey/client/tui/screens.py

View check run for this annotation

Codecov / codecov/patch

src/murfey/client/tui/screens.py#L311

Added line #L311 was not covered by tests
if add_destination:
for s in self.app._environment.sources:
if source.is_relative_to(s):
Expand Down Expand Up @@ -705,9 +707,9 @@
self.app.install_screen(
DirectorySelection(
[
p
for p in machine_data.get("data_directories", [])
if Path(p).exists()
path
for path in machine_data.get("data_directories", [])
if Path(path).exists()
]
),
"directory-select",
Expand Down Expand Up @@ -771,9 +773,9 @@
self.app.install_screen(
DirectorySelection(
[
p
for p in machine_data.get("data_directories", [])
if Path(p).exists()
path
for path in machine_data.get("data_directories", [])
if Path(path).exists()
]
),
"directory-select",
Expand Down Expand Up @@ -941,7 +943,7 @@

def on_button_pressed(self, event: Button.Pressed):
self.app._multigrid = self._switch_status
visit_dir = Path(str(event.button.label)) / self.app._visit
visit_dir = Path(str(event.button.label)).absolute() / self.app._visit

Check warning on line 946 in src/murfey/client/tui/screens.py

View check run for this annotation

Codecov / codecov/patch

src/murfey/client/tui/screens.py#L946

Added line #L946 was not covered by tests
visit_dir.mkdir(exist_ok=True)
self.app._set_default_acquisition_directories(visit_dir)
machine_config = get_machine_config_client(
Expand Down