Skip to content

fix Pydantic union types disable Pyrefly assignment checks #4131 - #4337

Open
asukaminato0721 wants to merge 1 commit into
facebook:mainfrom
asukaminato0721:4131
Open

fix Pydantic union types disable Pyrefly assignment checks #4131#4337
asukaminato0721 wants to merge 1 commit into
facebook:mainfrom
asukaminato0721:4131

Conversation

@asukaminato0721

Copy link
Copy Markdown
Collaborator

Summary

Fixes #4131

Custom class union members no longer degrade to Any.

Invalid Pydantic boolean literals are rejected according to Pydantic’s accepted values (https://docs.pydantic.dev/latest/api/standard_library_types/#booleans), while valid alternate union branches remain accepted.

Test Plan

add test, updated the lax-conversion documentation.

@meta-codesync

meta-codesync Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

This pull request has been imported. If you are a Meta employee, you can view this in D114011818. (Because this pull request was imported automatically, there will not be any future comments.)

@codspeed-hq

codspeed-hq Bot commented Jul 29, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

⚠️ Unknown Walltime execution environment detected

Using the Walltime instrument on standard Hosted Runners will lead to inconsistent data.

For the most accurate results, we recommend using CodSpeed Macro Runners: bare-metal machines fine-tuned for performance measurement consistency.

✅ 10 untouched benchmarks


Comparing asukaminato0721:4131 (4e6ecc2) with main (3ec9cdf)

Open in CodSpeed

@codspeed-hq

codspeed-hq Bot commented Jul 29, 2026

Copy link
Copy Markdown

Unable to generate the flame graphs

The performance report has correctly been generated, but there was an internal error while generating the flame graphs for this run. We're working on fixing the issue. Feel free to contact us on Discord or at support@codspeed.io if the issue persists.

@github-actions

Copy link
Copy Markdown

Diff from mypy_primer, showing the effect of this PR on open source code:

prefect (https://github.com/PrefectHQ/prefect)
+ ERROR src/integrations/prefect-aws/tests/observers/test_ecs_observer.py:1323:30-39: Argument `Literal['RUNNING']` is not assignable to parameter `type` with type `StateType` in function `prefect.client.schemas.objects.State.__init__` [bad-argument-type]
+ ERROR src/integrations/prefect-aws/tests/observers/test_ecs_observer.py:1356:30-39: Argument `Literal['RUNNING']` is not assignable to parameter `type` with type `StateType` in function `prefect.client.schemas.objects.State.__init__` [bad-argument-type]
+ ERROR src/integrations/prefect-aws/tests/observers/test_ecs_observer.py:1391:30-39: Argument `Literal['RUNNING']` is not assignable to parameter `type` with type `StateType` in function `prefect.client.schemas.objects.State.__init__` [bad-argument-type]
+ ERROR src/integrations/prefect-aws/tests/observers/test_ecs_observer.py:1427:30-39: Argument `Literal['RUNNING']` is not assignable to parameter `type` with type `StateType` in function `prefect.client.schemas.objects.State.__init__` [bad-argument-type]
+ ERROR src/integrations/prefect-aws/tests/observers/test_ecs_observer.py:1480:30-41: Argument `Literal['COMPLETED']` is not assignable to parameter `type` with type `StateType` in function `prefect.client.schemas.objects.State.__init__` [bad-argument-type]
+ ERROR src/integrations/prefect-aws/tests/observers/test_ecs_observer.py:1506:30-41: Argument `Literal['SCHEDULED']` is not assignable to parameter `type` with type `StateType` in function `prefect.client.schemas.objects.State.__init__` [bad-argument-type]
+ ERROR src/integrations/prefect-aws/tests/observers/test_ecs_observer.py:1531:30-38: Argument `Literal['PAUSED']` is not assignable to parameter `type` with type `StateType` in function `prefect.client.schemas.objects.State.__init__` [bad-argument-type]
+ ERROR src/integrations/prefect-aws/tests/observers/test_ecs_observer.py:1567:30-39: Argument `Literal['RUNNING']` is not assignable to parameter `type` with type `StateType` in function `prefect.client.schemas.objects.State.__init__` [bad-argument-type]
+ ERROR src/integrations/prefect-aws/tests/observers/test_ecs_observer.py:1600:30-39: Argument `Literal['RUNNING']` is not assignable to parameter `type` with type `StateType` in function `prefect.client.schemas.objects.State.__init__` [bad-argument-type]
+ ERROR src/integrations/prefect-aws/tests/observers/test_ecs_observer.py:1637:30-39: Argument `Literal['RUNNING']` is not assignable to parameter `type` with type `StateType` in function `prefect.client.schemas.objects.State.__init__` [bad-argument-type]
+ ERROR src/integrations/prefect-aws/tests/observers/test_ecs_observer.py:1676:30-39: Argument `Literal['RUNNING']` is not assignable to parameter `type` with type `StateType` in function `prefect.client.schemas.objects.State.__init__` [bad-argument-type]
+ ERROR src/integrations/prefect-aws/tests/observers/test_ecs_observer.py:1723:30-39: Argument `Literal['RUNNING']` is not assignable to parameter `type` with type `StateType` in function `prefect.client.schemas.objects.State.__init__` [bad-argument-type]
+ ERROR src/integrations/prefect-aws/tests/observers/test_ecs_observer.py:1765:30-39: Argument `Literal['RUNNING']` is not assignable to parameter `type` with type `StateType` in function `prefect.client.schemas.objects.State.__init__` [bad-argument-type]
+ ERROR src/integrations/prefect-aws/tests/observers/test_ecs_observer.py:1801:30-39: Argument `Literal['RUNNING']` is not assignable to parameter `type` with type `StateType` in function `prefect.client.schemas.objects.State.__init__` [bad-argument-type]
+ ERROR src/integrations/prefect-aws/tests/observers/test_ecs_observer.py:1938:30-40: Argument `str | Unknown` is not assignable to parameter `type` with type `StateType` in function `prefect.client.schemas.objects.State.__init__` [bad-argument-type]
+ ERROR src/integrations/prefect-aws/tests/observers/test_ecs_observer.py:2574:30-41: Argument `Literal['SCHEDULED']` is not assignable to parameter `type` with type `StateType` in function `prefect.client.schemas.objects.State.__init__` [bad-argument-type]
+ ERROR src/integrations/prefect-aws/tests/observers/test_ecs_observer.py:2654:30-39: Argument `Literal['RUNNING']` is not assignable to parameter `type` with type `StateType` in function `prefect.client.schemas.objects.State.__init__` [bad-argument-type]
+ ERROR src/integrations/prefect-aws/tests/observers/test_ecs_observer.py:2672:30-41: Argument `Literal['COMPLETED']` is not assignable to parameter `type` with type `StateType` in function `prefect.client.schemas.objects.State.__init__` [bad-argument-type]
+ ERROR src/integrations/prefect-aws/tests/observers/test_ecs_observer_crash.py:43:30-39: Argument `Literal['RUNNING']` is not assignable to parameter `type` with type `StateType` in function `prefect.client.schemas.objects.State.__init__` [bad-argument-type]
+ ERROR src/integrations/prefect-aws/tests/observers/test_ecs_observer_crash.py:176:30-41: Argument `Literal['COMPLETED']` is not assignable to parameter `type` with type `StateType` in function `prefect.client.schemas.objects.State.__init__` [bad-argument-type]
+ ERROR src/integrations/prefect-dask/tests/test_task_runners.py:193:22-41: Argument `Literal[prefect.server.schemas.states.StateType.COMPLETED]` is not assignable to parameter `type` with type `prefect.client.schemas.objects.StateType` in function `prefect.client.schemas.objects.State.__init__` [bad-argument-type]
+ ERROR src/integrations/prefect-kubernetes/tests/test_observer.py:442:30-39: Argument `Literal['PENDING']` is not assignable to parameter `type` with type `StateType` in function `prefect.client.schemas.objects.State.__init__` [bad-argument-type]
+ ERROR src/integrations/prefect-kubernetes/tests/test_observer.py:517:30-40: Argument `str` is not assignable to parameter `type` with type `StateType` in function `prefect.client.schemas.objects.State.__init__` [bad-argument-type]
+ ERROR src/integrations/prefect-kubernetes/tests/test_observer.py:986:30-39: Argument `Literal['PENDING']` is not assignable to parameter `type` with type `StateType` in function `prefect.client.schemas.objects.State.__init__` [bad-argument-type]
+ ERROR src/integrations/prefect-kubernetes/tests/test_observer.py:1025:30-39: Argument `Literal['PENDING']` is not assignable to parameter `type` with type `StateType` in function `prefect.client.schemas.objects.State.__init__` [bad-argument-type]
+ ERROR src/integrations/prefect-kubernetes/tests/test_observer.py:1091:30-39: Argument `Literal['PENDING']` is not assignable to parameter `type` with type `StateType` in function `prefect.client.schemas.objects.State.__init__` [bad-argument-type]
+ ERROR src/integrations/prefect-kubernetes/tests/test_observer.py:1327:30-38: Argument `Literal['PAUSED']` is not assignable to parameter `type` with type `StateType` in function `prefect.client.schemas.objects.State.__init__` [bad-argument-type]
+ ERROR src/integrations/prefect-kubernetes/tests/test_observer.py:1344:30-41: Argument `Literal['COMPLETED']` is not assignable to parameter `type` with type `StateType` in function `prefect.client.schemas.objects.State.__init__` [bad-argument-type]
+ ERROR src/integrations/prefect-kubernetes/tests/test_observer.py:1361:30-41: Argument `Literal['SCHEDULED']` is not assignable to parameter `type` with type `StateType` in function `prefect.client.schemas.objects.State.__init__` [bad-argument-type]
+ ERROR src/integrations/prefect-kubernetes/tests/test_observer.py:1385:30-39: Argument `Literal['RUNNING']` is not assignable to parameter `type` with type `StateType` in function `prefect.client.schemas.objects.State.__init__` [bad-argument-type]
+ ERROR src/integrations/prefect-kubernetes/tests/test_observer.py:2042:30-39: Argument `Literal['PENDING']` is not assignable to parameter `type` with type `StateType` in function `prefect.client.schemas.objects.State.__init__` [bad-argument-type]
+ ERROR src/integrations/prefect-kubernetes/tests/test_observer.py:2097:58-67: Argument `Literal['CRASHED']` is not assignable to parameter `type` with type `StateType` in function `prefect.client.schemas.objects.State.__init__` [bad-argument-type]
+ ERROR src/integrations/prefect-kubernetes/tests/test_observer.py:2131:30-39: Argument `Literal['RUNNING']` is not assignable to parameter `type` with type `StateType` in function `prefect.client.schemas.objects.State.__init__` [bad-argument-type]
+ ERROR src/integrations/prefect-kubernetes/tests/test_observer.py:2177:30-39: Argument `Literal['PENDING']` is not assignable to parameter `type` with type `StateType` in function `prefect.client.schemas.objects.State.__init__` [bad-argument-type]
+ ERROR src/integrations/prefect-kubernetes/tests/test_observer.py:2225:58-67: Argument `Literal['RUNNING']` is not assignable to parameter `type` with type `StateType` in function `prefect.client.schemas.objects.State.__init__` [bad-argument-type]
+ ERROR src/prefect/cli/cloud/ip_allowlist.py:113:45-48: Argument `str` is not assignable to parameter `parsed` with type `IPv4Network | IPv6Network` in function `IPNetworkArg.__init__` [bad-argument-type]
+ ERROR src/prefect/cli/deploy/_commands.py:403:36-72: Argument `str` is not assignable to parameter `collision_strategy` with type `ConcurrencyLimitStrategy` in function `prefect.client.schemas.objects.ConcurrencyLimitConfig.__init__` [bad-argument-type]
+ ERROR src/prefect/cli/deploy/_core.py:475:63-83: Argument `dict[str, list[str]]` is not assignable to parameter `status` with type `WorkerFilterStatus | None` in function `prefect.client.schemas.filters.WorkerFilter.__init__` [bad-argument-type]
+ ERROR src/prefect/cli/events.py:211:17-35: Argument `list[RelatedResource] | list[dict[Unknown, Unknown]] | list[Unknown]` is not assignable to parameter `related` with type `Iterable[RelatedResource]` in function `prefect.events.schemas.events.Event.__init__` [bad-argument-type]
+ ERROR src/prefect/cli/flow_run.py:244:41-60: Argument `dict[str, list[str]]` is not assignable to parameter `name` with type `FlowFilterName | None` in function `prefect.client.schemas.filters.FlowFilter.__init__` [bad-argument-type]
+ ERROR src/prefect/cli/flow_run.py:245:49-61: Argument `dict[str, dict[str, list[str]]]` is not assignable to parameter `state` with type `FlowRunFilterState | None` in function `prefect.client.schemas.filters.FlowRunFilter.__init__` [bad-argument-type]
+ ERROR src/prefect/cli/flow_run.py:252:43-87: Argument `dict[str, list[UUID]]` is not assignable to parameter `id` with type `FlowFilterId | None` in function `prefect.client.schemas.filters.FlowFilter.__init__` [bad-argument-type]
+ ERROR src/prefect/cli/flow_run.py:579:40-54: Argument `dict[str, list[UUID]]` is not assignable to parameter `flow_run_id` with type `LogFilterFlowRunId | None` in function `prefect.client.schemas.filters.LogFilter.__init__` [bad-argument-type]
+ ERROR src/prefect/flow_engine.py:715:30-87: Argument `Coroutine[Any, Any, ResultStore] | ResultStore` is not assignable to parameter `result_store` with type `ResultStore` in function `prefect.context.EngineContext.__init__` [bad-argument-type]
+ ERROR src/prefect/flow_engine.py:948:36-66: Argument `dict[str, list[UUID]]` is not assignable to parameter `parent_task_run_id` with type `FlowRunFilterParentTaskRunId | None` in function `prefect.client.schemas.filters.FlowRunFilter.__init__` [bad-argument-type]
+ ERROR src/prefect/flow_engine.py:1089:34-46: Argument `Coroutine[Any, Any, ResultStore] | ResultStore` is not assignable to parameter `result_store` with type `ResultStore` in function `prefect.context.EngineContext.__init__` [bad-argument-type]
+ ERROR src/prefect/flow_engine.py:1416:30-87: Argument `Coroutine[Any, Any, ResultStore] | ResultStore` is not assignable to parameter `result_store` with type `ResultStore` in function `prefect.context.EngineContext.__init__` [bad-argument-type]
+ ERROR src/prefect/flow_engine.py:1644:36-66: Argument `dict[str, list[UUID]]` is not assignable to parameter `parent_task_run_id` with type `FlowRunFilterParentTaskRunId | None` in function `prefect.client.schemas.filters.FlowRunFilter.__init__` [bad-argument-type]
+ ERROR src/prefect/flow_engine.py:1783:34-46: Argument `Coroutine[Any, Any, ResultStore] | ResultStore` is not assignable to parameter `result_store` with type `ResultStore` in function `prefect.context.EngineContext.__init__` [bad-argument-type]
+ ERROR src/prefect/server/api/block_types.py:174:31-57: Argument `dict[str, list[UUID]]` is not assignable to parameter `block_type_id` with type `BlockDocumentFilterBlockTypeId | None` in function `prefect.server.schemas.filters.BlockDocumentFilter.__init__` [bad-argument-type]
- ERROR src/prefect/server/api/deployments.py:463:1-2: Unused `# type: ignore` comment [unused-type-ignore]
+ ERROR src/prefect/server/api/events.py:217:23-67: Argument `str | None` is not assignable to parameter `next_page` with type `AnyHttpUrl | None` in function `prefect.server.events.schemas.events.EventPage.__init__` [bad-argument-type]
+ ERROR src/prefect/server/api/events.py:244:23-67: Argument `str | None` is not assignable to parameter `next_page` with type `AnyHttpUrl | None` in function `prefect.server.events.schemas.events.EventPage.__init__` [bad-argument-type]
+ ERROR src/prefect/server/api/flow_runs.py:1099:37-60: Argument `dict[str, list[UUID]]` is not assignable to parameter `flow_run_id` with type `LogFilterFlowRunId | None` in function `prefect.server.schemas.filters.LogFilter.__init__` [bad-argument-type]
+ ERROR src/prefect/server/api/flows.py:255:17-24: Argument `Sequence[prefect.server.database.orm_models.Flow]` is not assignable to parameter `results` with type `Iterable[prefect.server.schemas.core.Flow]` in function `prefect.server.schemas.responses.FlowPaginationResponse.__init__` [bad-argument-type]
+ ERROR src/prefect/server/api/ui/flow_runs.py:87:24-36: Argument `StateType | None` is not assignable to parameter `state_type` with type `StateType` in function `SimpleFlowRun.__init__` [bad-argument-type]
+ ERROR src/prefect/server/api/workers.py:426:21-445:14: Argument `dict[str, Literal['work_pool_worker_channel.v1'] | UUID | WorkPoolSnapshotPayload | int | list[WorkerChannelCapability] | list[str] | list[dict[str, UUID | str]] | None]` is not assignable to parameter `payload` with type `WorkerReadyPayload` in function `prefect.client.schemas.worker_channel.WorkerReadyFrame.__init__` [bad-argument-type]
+ ERROR src/prefect/server/events/schemas/automations.py:143:17-150:24: Argument `list[RelatedResource] | list[dict[str, str]]` is not assignable to parameter `related` with type `Iterable[RelatedResource]` in function `prefect.server.events.schemas.events.ReceivedEvent.__init__` [bad-argument-type]
+ ERROR src/prefect/server/events/schemas/lifecycle.py:56:17-30: Argument `list[RelatedResource] | list[dict[str, str]]` is not assignable to parameter `related` with type `Iterable[RelatedResource]` in function `prefect.server.events.schemas.events.Event.__init__` [bad-argument-type]
+ ERROR src/prefect/server/events/triggers.py:346:25-32: Argument `CompositeTrigger` is not assignable to parameter `trigger` with type `CompoundTrigger | EventTrigger | SequenceTrigger` in function `prefect.server.events.schemas.automations.Firing.__init__` [bad-argument-type]
+ ERROR src/prefect/server/events/triggers.py:421:25-32: Argument `CompositeTrigger` is not assignable to parameter `trigger` with type `CompoundTrigger | EventTrigger | SequenceTrigger` in function `prefect.server.events.schemas.automations.Firing.__init__` [bad-argument-type]
+ ERROR src/prefect/server/models/block_documents.py:180:16-46: Argument `dict[str, list[UUID]]` is not assignable to parameter `id` with type `BlockDocumentFilterId | None` in function `prefect.server.schemas.filters.BlockDocumentFilter.__init__` [bad-argument-type]
+ ERROR src/prefect/server/models/block_documents.py:303:18-35: Argument `dict[str, list[str]]` is not assignable to parameter `name` with type `BlockDocumentFilterName | None` in function `prefect.server.schemas.filters.BlockDocumentFilter.__init__` [bad-argument-type]
+ ERROR src/prefect/server/models/block_documents.py:308:18-46: Argument `dict[str, list[str]]` is not assignable to parameter `slug` with type `BlockTypeFilterSlug | None` in function `prefect.server.schemas.filters.BlockTypeFilter.__init__` [bad-argument-type]
+ ERROR src/prefect/server/models/block_documents.py:474:50-77: Argument `dict[str, list[UUID]]` is not assignable to parameter `id` with type `BlockSchemaFilterId | None` in function `prefect.server.schemas.filters.BlockSchemaFilter.__init__` [bad-argument-type]
+ ERROR src/prefect/server/models/events.py:63:17-65:26: `Unknown | None` is not assignable to dict value type `str` [bad-assignment]
+ ERROR src/prefect/server/models/events.py:69:17-71:10: Argument `list[dict[str, str]]` is not assignable to parameter `related` with type `Iterable[RelatedResource]` in function `prefect.server.events.schemas.events.Event.__init__` [bad-argument-type]
+ ERROR src/prefect/server/models/events.py:397:17-73: Argument `list[dict[str, str]]` is not assignable to parameter `related` with type `Iterable[RelatedResource]` in function `prefect.server.events.schemas.events.Event.__init__` [bad-argument-type]
+ ERROR src/prefect/server/models/events.py:415:17-73: Argument `list[dict[str, str]]` is not assignable to parameter `related` with type `Iterable[RelatedResource]` in function `prefect.server.events.schemas.events.Event.__init__` [bad-argument-type]
+ ERROR src/prefect/server/models/events.py:434:17-73: Argument `list[dict[str, str]]` is not assignable to parameter `related` with type `Iterable[RelatedResource]` in function `prefect.server.events.schemas.events.Event.__init__` [bad-argument-type]
+ ERROR src/prefect/server/models/events.py:456:17-73: Argument `list[dict[str, str]]` is not assignable to parameter `related` with type `Iterable[RelatedResource]` in function `prefect.server.events.schemas.events.Event.__init__` [bad-argument-type]
+ ERROR src/prefect/server/models/events.py:492:17-39: Argument `list[dict[str, Any]]` is not assignable to parameter `related` with type `Iterable[RelatedResource]` in function `prefect.server.events.schemas.events.Event.__init__` [bad-argument-type]
+ ERROR src/prefect/server/models/events.py:576:17-39: Argument `list[dict[str, Any]]` is not assignable to parameter `related` with type `Iterable[RelatedResource]` in function `prefect.server.events.schemas.events.Event.__init__` [bad-argument-type]
+ ERROR src/prefect/server/models/events.py:635:17-56: Argument `list[dict[str, str]]` is not assignable to parameter `related` with type `Iterable[RelatedResource]` in function `prefect.server.events.schemas.events.Event.__init__` [bad-argument-type]
+ ERROR src/prefect/server/models/events.py:649:17-56: Argument `list[dict[str, str]]` is not assignable to parameter `related` with type `Iterable[RelatedResource]` in function `prefect.server.events.schemas.events.Event.__init__` [bad-argument-type]
+ ERROR src/prefect/server/models/events.py:690:17-73: Argument `list[dict[str, Any]]` is not assignable to parameter `related` with type `Iterable[RelatedResource]` in function `prefect.server.events.schemas.events.Event.__init__` [bad-argument-type]
+ ERROR src/prefect/server/models/events.py:709:17-73: Argument `list[dict[str, Any]]` is not assignable to parameter `related` with type `Iterable[RelatedResource]` in function `prefect.server.events.schemas.events.Event.__init__` [bad-argument-type]
+ ERROR src/prefect/server/models/flow_runs.py:419:39-45: Argument `list[Constant | FlowRunResult | Parameter | TaskRunResult]` is not assignable to parameter `upstream_dependencies` with type `Iterable[TaskRunResult]` in function `DependencyResult.__init__` [bad-argument-type]
+ ERROR src/prefect/server/models/flow_runs.py:420:23-37: Argument `TaskRunState | None` is not assignable to parameter `state` with type `State | None` in function `DependencyResult.__init__` [bad-argument-type]
+ ERROR src/prefect/server/models/work_queues.py:583:17-34: Argument `dict[str, list[str] | None]` is not assignable to parameter `tags` with type `FlowRunFilterTags | None` in function `prefect.server.schemas.filters.FlowRunFilter.__init__` [bad-argument-type]
+ ERROR src/prefect/server/models/work_queues.py:583:17-34: Argument `dict[str, bool | list[UUID] | None]` is not assignable to parameter `deployment_id` with type `FlowRunFilterDeploymentId | None` in function `prefect.server.schemas.filters.FlowRunFilter.__init__` [bad-argument-type]
+ ERROR src/prefect/server/models/work_queues.py:584:23-83: Argument `dict[str, dict[str, list[StateType]]]` is not assignable to parameter `state` with type `FlowRunFilterState | None` in function `prefect.server.schemas.filters.FlowRunFilter.__init__` [bad-argument-type]
+ ERROR src/prefect/server/models/work_queues.py:601:13-30: Argument `dict[str, list[str] | None]` is not assignable to parameter `tags` with type `FlowRunFilterTags | None` in function `prefect.server.schemas.filters.FlowRunFilter.__init__` [bad-argument-type]
+ ERROR src/prefect/server/models/work_queues.py:601:13-30: Argument `dict[str, bool | list[UUID] | None]` is not assignable to parameter `deployment_id` with type `FlowRunFilterDeploymentId | None` in function `prefect.server.schemas.filters.FlowRunFilter.__init__` [bad-argument-type]
+ ERROR src/prefect/server/models/work_queues.py:602:19-62: Argument `dict[str, dict[str, list[StateType]]]` is not assignable to parameter `state` with type `FlowRunFilterState | None` in function `prefect.server.schemas.filters.FlowRunFilter.__init__` [bad-argument-type]
+ ERROR src/prefect/server/models/work_queues.py:603:39-69: Argument `dict[str, datetime | None]` is not assignable to parameter `next_scheduled_start_time` with type `FlowRunFilterNextScheduledStartTime | None` in function `prefect.server.schemas.filters.FlowRunFilter.__init__` [bad-argument-type]
+ ERROR src/prefect/server/models/work_queues.py:671:59-77: Argument `dict[str, list[str]]` is not assignable to parameter `name` with type `FlowRunFilterStateName | None` in function `prefect.server.schemas.filters.FlowRunFilterState.__init__` [bad-argument-type]
+ ERROR src/prefect/server/schemas/core.py:879:26-57: Argument `prefect.server.database.orm_models.BlockSchema` is not assignable to parameter `block_schema` with type `prefect.server.schemas.core.BlockSchema | None` in function `BlockDocument.__init__` [bad-argument-type]
+ ERROR src/prefect/server/schemas/core.py:882:24-53: Argument `prefect.server.database.orm_models.BlockType` is not assignable to parameter `block_type` with type `prefect.server.schemas.core.BlockType | None` in function `BlockDocument.__init__` [bad-argument-type]
+ ERROR src/prefect/server/utilities/worker_channel.py:757:17-766:10: Argument `dict[str, UUID | dict[str, Any] | int | str | None]` is not assignable to parameter `payload` with type `CancellingTimeoutCleanupMessagePayload | PendingClaimCleanupMessagePayload` in function `prefect.client.schemas.worker_channel.CleanupMessageFrame.__init__` [bad-argument-type]
+ ERROR src/prefect/server/utilities/worker_channel.py:779:17-787:10: Argument `dict[str, UUID | str | None]` is not assignable to parameter `payload` with type `CleanupOperationResultPayload` in function `prefect.client.schemas.worker_channel.CleanupOperationResultFrame.__init__` [bad-argument-type]
+ ERROR src/prefect/states.py:589:28-41: Argument `Coroutine[Any, Any, WritableFileSystem] | WritableFileSystem | None` is not assignable to parameter `result_storage` with type `WritableFileSystem | None` in function `prefect.results.ResultStore.__init__` [bad-argument-type]
+ ERROR src/prefect/task_engine.py:216:21-38: Argument `dict[str, Iterable[Constant | FlowRunResult | Parameter | TaskRunResult]] | dict[str, set[RunInput]]` is not assignable to parameter `task_inputs` with type `Mapping[str, Iterable[Constant | FlowRunResult | Parameter | TaskRunResult]]` in function `prefect.client.schemas.objects.TaskRun.__init__` [bad-argument-type]
+ ERROR src/prefect/task_engine.py:784:34-46: Argument `Coroutine[Any, Any, ResultStore] | ResultStore` is not assignable to parameter `result_store` with type `ResultStore` in function `prefect.context.TaskRunContext.__init__` [bad-argument-type]
+ ERROR src/prefect/task_worker.py:336:32-85: Argument `Path | WritableFileSystem | str` is not assignable to parameter `result_storage` with type `WritableFileSystem | None` in function `prefect.results.ResultStore.__init__` [bad-argument-type]
+ ERROR src/prefect/tasks.py:940:36-89: Argument `Path | WritableFileSystem | str` is not assignable to parameter `result_storage` with type `WritableFileSystem | None` in function `prefect.results.ResultStore.__init__` [bad-argument-type]

... (truncated 4 lines) ...

freqtrade (https://github.com/freqtrade/freqtrade)
+ ERROR freqtrade/rpc/api_server/api_ws.py:112:49-56: Argument `dict[str, Any]` is not assignable to parameter `data` with type `WSAnalyzedDFMessage.AnalyzedDFData` in function `freqtrade.rpc.api_server.ws_schemas.WSAnalyzedDFMessage.__init__` [bad-argument-type]

pandera (https://github.com/pandera-dev/pandera)
+ ERROR tests/pandas/test_pydantic.py:109:42-54: Argument `type[SimpleSchema]` is not assignable to parameter `pa_schema` with type `SimpleSchema` in function `DataFrameModelPydantic.__init__` [bad-argument-type]
+ ERROR tests/pandas/test_pydantic.py:117:42-43: Argument `Literal[1]` is not assignable to parameter `pa_schema` with type `SimpleSchema` in function `DataFrameModelPydantic.__init__` [bad-argument-type]
+ ERROR tests/pandas/test_pydantic.py:120:42-66: Argument `DataFrameSchema` is not assignable to parameter `pa_schema` with type `SimpleSchema` in function `DataFrameModelPydantic.__init__` [bad-argument-type]
+ ERROR tests/pandas/test_pydantic.py:131:33-46: Argument `type[test_invalid_dataframemodel.InvalidSchema]` is not assignable to parameter `pa_schema` with type `test_invalid_dataframemodel.InvalidSchema` in function `PydanticModel.__init__` [bad-argument-type]
+ ERROR tests/pandas/test_pydantic.py:146:47-53: Argument `type[test_dataframemodel_inheritance.Parent]` is not assignable to parameter `pa_schema` with type `test_dataframemodel_inheritance.Parent` in function `PydanticModel.__init__` [bad-argument-type]
+ ERROR tests/pandas/test_pydantic.py:147:47-52: Argument `type[test_dataframemodel_inheritance.Child]` is not assignable to parameter `pa_schema` with type `test_dataframemodel_inheritance.Parent` in function `PydanticModel.__init__` [bad-argument-type]
+ ERROR tests/pandas/test_pydantic.py:153:51-59: Argument `type[test_dataframemodel_inheritance.NotChild]` is not assignable to parameter `pa_schema` with type `test_dataframemodel_inheritance.Parent` in function `PydanticModel.__init__` [bad-argument-type]
+ ERROR tests/pandas/test_pydantic.py:170:43-44: Argument `Literal[1]` is not assignable to parameter `pa_schema` with type `DataFrameSchema | None` in function `DataFrameSchemaPydantic.__init__` [bad-argument-type]
+ ERROR tests/pandas/test_pydantic.py:173:39-42: Argument `Literal['1']` is not assignable to parameter `pa_mi` with type `MultiIndex | None` in function `DataFrameSchemaPydantic.__init__` [bad-argument-type]
+ ERROR tests/pandas/test_pydantic.py:191:47-48: Argument `Literal[1]` is not assignable to parameter `pa_series_schema` with type `SeriesSchema | None` in function `SeriesSchemaPydantic.__init__` [bad-argument-type]
+ ERROR tests/pandas/test_pydantic.py:194:40-43: Argument `Literal['1']` is not assignable to parameter `pa_column` with type `Column | None` in function `SeriesSchemaPydantic.__init__` [bad-argument-type]
+ ERROR tests/pandas/test_pydantic.py:197:39-42: Argument `Literal['1']` is not assignable to parameter `pa_index` with type `Index | None` in function `SeriesSchemaPydantic.__init__` [bad-argument-type]
+ ERROR tests/polars/test_polars_pydantic.py:86:48-66: Argument `type[SimplePolarsSchema]` is not assignable to parameter `pa_schema` with type `SimplePolarsSchema` in function `PolarsDataFrameModelPydantic.__init__` [bad-argument-type]
+ ERROR tests/polars/test_polars_pydantic.py:94:48-49: Argument `Literal[1]` is not assignable to parameter `pa_schema` with type `SimplePolarsSchema` in function `PolarsDataFrameModelPydantic.__init__` [bad-argument-type]
+ ERROR tests/polars/test_polars_pydantic.py:97:48-78: Argument `DataFrameSchema` is not assignable to parameter `pa_schema` with type `SimplePolarsSchema` in function `PolarsDataFrameModelPydantic.__init__` [bad-argument-type]
+ ERROR tests/polars/test_polars_pydantic.py:112:47-53: Argument `type[test_polars_dataframemodel_inheritance.Parent]` is not assignable to parameter `pa_schema` with type `test_polars_dataframemodel_inheritance.Parent` in function `PydanticModel.__init__` [bad-argument-type]
+ ERROR tests/polars/test_polars_pydantic.py:113:47-52: Argument `type[test_polars_dataframemodel_inheritance.Child]` is not assignable to parameter `pa_schema` with type `test_polars_dataframemodel_inheritance.Parent` in function `PydanticModel.__init__` [bad-argument-type]
+ ERROR tests/polars/test_polars_pydantic.py:119:51-59: Argument `type[test_polars_dataframemodel_inheritance.NotChild]` is not assignable to parameter `pa_schema` with type `test_polars_dataframemodel_inheritance.Parent` in function `PydanticModel.__init__` [bad-argument-type]
+ ERROR tests/polars/test_polars_pydantic.py:174:49-50: Argument `Literal[1]` is not assignable to parameter `pa_schema` with type `DataFrameSchema | None` in function `PolarsDataFrameSchemaPydantic.__init__` [bad-argument-type]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pydantic union types disable Pyrefly assignment checks

2 participants