Skip to content

fix(azure): resolve mypy call-overload error on NIC creation - #532

Merged
blackboxsw merged 2 commits into
canonical:mainfrom
8rulerstar:fix/531-mypy-call-overload
Sep 17, 2026
Merged

blackboxsw merged 2 commits into
canonical:mainfrom
8rulerstar:fix/531-mypy-call-overload

Conversation

@8rulerstar

Copy link
Copy Markdown
Contributor

Description

mypy pycloudlib examples fails on one call: network_interfaces.begin_create_or_update is typed to take a NetworkInterface model or IO[bytes], while this module builds and passes the ARM-shaped dict the REST API expects. The call is fine at runtime, so this narrows the ignore to that single overload error instead of changing what is sent.

I used # type: ignore[call-overload] to match the ignores already used a few lines above (268-270) in the same method. As mentioned in #531, I also have a cast(NetworkInterface, default_config) version ready — NetworkInterface is already imported here — so just say the word if you'd prefer that.

Verified locally with the versions CI uses (mypy 2.3.1, azure-mgmt-network 32.0.0, ruff 0.5.0):

  • mypy pycloudlib/azure/instance.py — before: 1 error, after: Success: no issues found
  • ruff check pycloudlib examplesAll checks passed!
  • ruff format --check pycloudlib examples — 64 files already formatted

One note on the issue text: pycloudlib/gce/cloud.py:318 is a mypy note, not an error — it comes from check_untyped_defs = false for that module in the TODO override block — so this PR leaves it alone. Happy to drop that module from the override list in a separate PR if you want the bodies checked.

I did not run the unit tests locally (that needs the full cloud dependency set); this change adds no runtime behavior, so I left them to CI.

Issues

The Azure SDK types the `parameters` argument of
`network_interfaces.begin_create_or_update` as a `NetworkInterface` model
or raw bytes, while this module builds and passes an ARM-shaped dict. The
call works at runtime, so narrow the ignore to that one overload error
rather than changing what is sent.

Fixes canonicalGH-531

@blackboxsw blackboxsw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this submission and context related comment inline. I think what remains is bumping VERSION file so we can land this PR.

@8rulerstar

Copy link
Copy Markdown
Contributor Author

Bumped VERSION to 1!11.1.8. Thanks for the review!

@blackboxsw blackboxsw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, awaiting CI and then I'll merge this.

@blackboxsw
blackboxsw merged commit 8abce79 into canonical:main Sep 17, 2026
7 checks passed
@8rulerstar
8rulerstar deleted the fix/531-mypy-call-overload branch September 17, 2026 03:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ci lint errors seen against tip of main

2 participants