Skip to content

chore: add typing to cloudinit.distros.parsers hostname and resolv_conf#6909

Open
Ahmedaltu wants to merge 4 commits into
canonical:mainfrom
Ahmedaltu:typing/parsers-hostname
Open

chore: add typing to cloudinit.distros.parsers hostname and resolv_conf#6909
Ahmedaltu wants to merge 4 commits into
canonical:mainfrom
Ahmedaltu:typing/parsers-hostname

Conversation

@Ahmedaltu

Copy link
Copy Markdown

chore: add typing to cloudinit.distros.parsers hostname and resolv_conf

Add type annotations to fix check_untyped_defs mypy errors in:

  • cloudinit/distros/parsers/hostname.py
  • cloudinit/distros/parsers/resolv_conf.py

Use a _parsed flag to track parse state rather than checking truthiness
of _contents, since an empty list [] is a valid parsed result for empty
or comment-only input files.

Removes both modules from the mypy disabled list in pyproject.toml.

Fixes GH-5445

canonicalGH-5445

Signed-off-by: Ahmed <76178825+Ahmedaltu@users.noreply.github.com>
Signed-off-by: Ahmed <76178825+Ahmedaltu@users.noreply.github.com>
Signed-off-by: Ahmed <76178825+Ahmedaltu@users.noreply.github.com>
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.

[enhancement]: fix typing of untyped-defs

1 participant