From ec668b3d997c9023485627417755d405fcb36bbd Mon Sep 17 00:00:00 2001 From: Maciej Urbanski Date: Mon, 13 Nov 2023 20:52:54 +0100 Subject: [PATCH] refactor base DownloadCommand --- b2/console_tool.py | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/b2/console_tool.py b/b2/console_tool.py index 3f254e080..fa5103cc8 100644 --- a/b2/console_tool.py +++ b/b2/console_tool.py @@ -1417,16 +1417,6 @@ def _represent_legal_hold(cls, legal_hold: LegalHold): def _print_file_attribute(self, label, value): self._print((label + ':').ljust(20) + ' ' + value) - -class DownloadFileMixin( - ThreadsMixin, - ProgressMixin, - SourceSseMixin, - WriteBufferSizeMixin, - SkipHashVerificationMixin, - MaxDownloadStreamsMixin, - DownloadCommand, -): def get_local_output_filename(self, filename: str) -> str: if filename == '-': return STDOUT_FILE_PATH @@ -1435,7 +1425,13 @@ def get_local_output_filename(self, filename: str) -> str: @B2.register_subcommand class DownloadFileById( - DownloadFileMixin, + ThreadsMixin, + ProgressMixin, + SourceSseMixin, + WriteBufferSizeMixin, + SkipHashVerificationMixin, + MaxDownloadStreamsMixin, + DownloadCommand, ): """ Downloads the given file, and stores it in the given local file. @@ -1477,7 +1473,13 @@ def run(self, args): @B2.register_subcommand class DownloadFileByName( - DownloadFileMixin, + ThreadsMixin, + ProgressMixin, + SourceSseMixin, + WriteBufferSizeMixin, + SkipHashVerificationMixin, + MaxDownloadStreamsMixin, + DownloadCommand, ): """ Downloads the given file, and stores it in the given local file. @@ -1521,7 +1523,11 @@ def run(self, args): @B2.register_subcommand class Cat( - DownloadFileMixin, + ProgressMixin, + SourceSseMixin, + WriteBufferSizeMixin, + SkipHashVerificationMixin, + DownloadCommand, ): """ Download content of a file identified by B2 URI directly to stdout.