Skip to content

Commit b04ca1e

Browse files
authored
Fix pyrefly check bad-specialization (#39419)
1 parent a15b880 commit b04ca1e

3 files changed

Lines changed: 5 additions & 4 deletions

File tree

sdks/python/apache_beam/ml/inference/base.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -361,8 +361,7 @@ def with_postprocess_fn(
361361

362362
def with_no_batching(
363363
self
364-
) -> """ModelHandler[Union[
365-
ExampleT, Iterable[ExampleT]], PostProcessT, ModelT, PostProcessT]""":
364+
) -> 'ModelHandler[Union[ExampleT, Iterable[ExampleT]], PredictionT, ModelT]':
366365
"""Returns a new ModelHandler which does not require batching
367366
of inputs so that RunInference will skip this step. RunInference will
368367
expect the input to be pre-batched and passed in as an Iterable of records.

sdks/python/apache_beam/runners/portability/prism_runner.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,10 @@ def _download_to_local_path(
291291
except ValueError:
292292
url_read = urlopen(url)
293293
with open(cached_file + '.tmp', 'wb') as zip_write:
294-
shutil.copyfileobj(url_read, zip_write, length=1 << 20)
294+
shutil.copyfileobj(
295+
typing.cast(typing.BinaryIO, url_read),
296+
zip_write,
297+
length=1 << 20)
295298

296299
_rename_if_different(cached_file + '.tmp', cached_file)
297300
except URLError as e:

sdks/python/pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,6 @@ invalid-argument = "ignore"
212212
invalid-inheritance = "ignore"
213213
not-iterable = "ignore"
214214
unexpected-keyword = "ignore"
215-
bad-specialization = "ignore"
216215
invalid-yield = "ignore"
217216
bad-argument-count = "ignore"
218217
bad-typed-dict-key = "ignore"

0 commit comments

Comments
 (0)