diff --git a/sdks/python/apache_beam/ml/inference/base.py b/sdks/python/apache_beam/ml/inference/base.py index f81382bbeecf..62c4047a961f 100644 --- a/sdks/python/apache_beam/ml/inference/base.py +++ b/sdks/python/apache_beam/ml/inference/base.py @@ -361,8 +361,7 @@ def with_postprocess_fn( def with_no_batching( self - ) -> """ModelHandler[Union[ - ExampleT, Iterable[ExampleT]], PostProcessT, ModelT, PostProcessT]""": + ) -> 'ModelHandler[Union[ExampleT, Iterable[ExampleT]], PredictionT, ModelT]': """Returns a new ModelHandler which does not require batching of inputs so that RunInference will skip this step. RunInference will expect the input to be pre-batched and passed in as an Iterable of records. diff --git a/sdks/python/apache_beam/runners/portability/prism_runner.py b/sdks/python/apache_beam/runners/portability/prism_runner.py index 105c27fcb8c9..3ebe94ef1605 100644 --- a/sdks/python/apache_beam/runners/portability/prism_runner.py +++ b/sdks/python/apache_beam/runners/portability/prism_runner.py @@ -291,7 +291,10 @@ def _download_to_local_path( except ValueError: url_read = urlopen(url) with open(cached_file + '.tmp', 'wb') as zip_write: - shutil.copyfileobj(url_read, zip_write, length=1 << 20) + shutil.copyfileobj( + typing.cast(typing.BinaryIO, url_read), + zip_write, + length=1 << 20) _rename_if_different(cached_file + '.tmp', cached_file) except URLError as e: diff --git a/sdks/python/pyproject.toml b/sdks/python/pyproject.toml index 5d78db863366..d5a2b2c2f284 100644 --- a/sdks/python/pyproject.toml +++ b/sdks/python/pyproject.toml @@ -212,7 +212,6 @@ invalid-argument = "ignore" invalid-inheritance = "ignore" not-iterable = "ignore" unexpected-keyword = "ignore" -bad-specialization = "ignore" invalid-yield = "ignore" bad-argument-count = "ignore" bad-typed-dict-key = "ignore"