From 48e9e941c9098446ca41458c8b40be4fb89e5043 Mon Sep 17 00:00:00 2001 From: Jover Date: Fri, 12 May 2023 18:19:53 -0700 Subject: [PATCH] Fix Pyright errors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix Pyright errors that have been raised in our scheduled CI runs since the release of Pyright 1.1.306.¹ I have not dug into the Pyright changelog to determine the exact change that leads to this new error. ¹ https://github.com/nextstrain/cli/actions/runs/4874920417 --- nextstrain/cli/runner/aws_batch/s3.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/nextstrain/cli/runner/aws_batch/s3.py b/nextstrain/cli/runner/aws_batch/s3.py index f97ac52e..1ab472dc 100644 --- a/nextstrain/cli/runner/aws_batch/s3.py +++ b/nextstrain/cli/runner/aws_batch/s3.py @@ -11,7 +11,7 @@ from os import utime from pathlib import Path from time import struct_time -from typing import Callable, Generator, Iterable, List, Optional +from typing import Callable, Generator, Iterable, List, Optional, Any from urllib.parse import urlparse from zipfile import ZipFile, ZipInfo from ...types import S3Bucket, S3Object @@ -65,6 +65,7 @@ def upload_workdir(workdir: Path, bucket: S3Bucket, run_id: str) -> S3Object: ]) # Stream writes directly to the remote ZIP file + remote_file: Any with fsspec.open(object_url(remote_workdir), "wb", auto_mkdir = False) as remote_file: with ZipFile(remote_file, "w") as zipfile: for path in walk(workdir, excluded): @@ -108,6 +109,7 @@ def download_workdir(remote_workdir: S3Object, workdir: Path, patterns: List[str selected = lambda path: True # Open a seekable handle to the remote ZIP file… + remote_file: Any with fsspec.open(object_url(remote_workdir)) as remote_file: # …and extract its contents to the workdir.