Fix Pydantic deprecation warnings (#3301)

This commit also enables mypy checks for deprecated calls.
This commit is contained in:
correctmost 2025-03-25 17:14:11 -04:00 committed by GitHub
parent d43482e585
commit 4711f7abad
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 4 additions and 3 deletions

View File

@ -598,7 +598,7 @@ class DeviceHandler:
debug(f'Unable to determine new uuid: {path}\n{lsblk_info}')
raise DiskError(f'Unable to determine new uuid: {path}')
debug(f'partition information found: {lsblk_info.json()}')
debug(f'partition information found: {lsblk_info.model_dump_json()}')
return lsblk_info

View File

@ -155,12 +155,12 @@ class AvailablePackage(BaseModel):
@cached_property
def longest_key(self) -> int:
return max(len(key) for key in self.dict().keys())
return max(len(key) for key in self.model_dump().keys())
# return all package info line by line
def info(self) -> str:
output = ''
for key, value in self.dict().items():
for key, value in self.model_dump().items():
key = key.replace('_', ' ').capitalize()
key = key.ljust(self.longest_key)
output += f'{key} : {value}\n'

View File

@ -70,6 +70,7 @@ disallow_any_explicit = false
disallow_any_expr = false
disallow_any_unimported = true
enable_error_code = [
"deprecated",
"explicit-override",
"ignore-without-code",
"mutable-override",