@Commands.command(
        'download',
        aliases=('down',),
        help='Download bundle from a CodaLab instance.',
        arguments=(
            Commands.Argument('target_spec', help=TARGET_SPEC_FORMAT, completer=BundlesCompleter),
            Commands.Argument('-o', '--output-path', help='Path to download bundle to.  By default, the bundle or subpath name in the current directory is used.'),
            Commands.Argument('-w', '--worksheet-spec', help='Operate on this worksheet (%s).' % WORKSHEET_SPEC_FORMAT, completer=WorksheetsCompleter),
        ),
    )
    def do_download_command(self, args):
        self._fail_if_headless('download')

        client, worksheet_uuid = self.parse_client_worksheet_uuid(args.worksheet_spec)
        target = self.parse_target(client, worksheet_uuid, args.target_spec)
        bundle_uuid, subpath = target

        # Figure out where to download.
        info = client.get_bundle_info(bundle_uuid)
        if args.output_path:
            local_path = args.output_path
        else:
            local_path = info['metadata'].get('name', 'untitled') if subpath == '' else os.path.basename(subpath)
        final_path = os.path.join(os.getcwd(), local_path)
        if os.path.exists(final_path):
            print >>self.stdout, 'Local file/directory \'%s\' already exists.' % local_path
            return

        # Do the download.
        target_info = client.get_target_info(target, 0)
        if target_info is None:
            raise UsageError('Target doesn\'t exist.')
        if target_info['type'] == 'directory':
            client.download_directory(target, final_path)
        elif target_info['type'] == 'file':
            client.download_file(target, final_path)
        elif target_info['type'] == 'link':
            raise UsageError('Downloading symlinks is not allowed.')

        print >>self.stdout, (self.simple_bundle_str(info), subpath, final_path) % 'Downloaded %s/%s => %s'
dataset/ETHPy150Open codalab/codalab-cli/codalab/lib/bundle_cli.py/BundleCLI.do_download_command/swapped operands of `%`