MCPcopy
hub / github.com/XPixelGroup/DiffBIR / _map_path

Method _map_path

diffbir/dataset/file_backend.py:65–76  ·  view source on GitHub ↗

Map ``filepath`` to a string path whose prefix will be replaced by :attr:`self.path_mapping`. Args: filepath (str): Path to be mapped.

(self, filepath: Union[str, Path])

Source from the content-addressed store, hash-verified

63 self.path_mapping = path_mapping
64
65 def _map_path(self, filepath: Union[str, Path]) -> str:
66 """Map ``filepath`` to a string path whose prefix will be replaced by
67 :attr:`self.path_mapping`.
68
69 Args:
70 filepath (str): Path to be mapped.
71 """
72 filepath = str(filepath)
73 if self.path_mapping is not None:
74 for k, v in self.path_mapping.items():
75 filepath = filepath.replace(k, v, 1)
76 return filepath
77
78 def _format_path(self, filepath: str) -> str:
79 """Convert a ``filepath`` to standard format of petrel oss.

Callers 1

getMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected