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])
| 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. |