示例#1
0
 def delete_file(self, path: PATH_TYPES, dry_run: bool = False) -> int:
     """Delete the provided path, recursively if necessary."""
     if not isinstance(path, pathlib.Path):
         path = pathlib.Path(path)
     log_prefix = "[DRY RUN] " if dry_run else ""
     logger.info(f"{log_prefix}Removing file: {path!s}")
     if not dry_run:
         path.unlink()
     return 0
示例#2
0
文件: s3.py 项目: pypa/bandersnatch
 def delete_file(self, path: PATH_TYPES, dry_run: bool = False) -> int:
     """Delete a file"""
     if not isinstance(path, self.PATH_BACKEND):
         path = self.PATH_BACKEND(path)
     log_prefix = "[DRY RUN] " if dry_run else ""
     logger.info(f"{log_prefix}Removing file: {path!s}")
     if not dry_run:
         path.unlink()
     return 0