Fix Pydantic deprecation warnings (#3301)
This commit also enables mypy checks for deprecated calls.
This commit is contained in:
parent
d43482e585
commit
4711f7abad
|
|
@ -598,7 +598,7 @@ class DeviceHandler:
|
||||||
debug(f'Unable to determine new uuid: {path}\n{lsblk_info}')
|
debug(f'Unable to determine new uuid: {path}\n{lsblk_info}')
|
||||||
raise DiskError(f'Unable to determine new uuid: {path}')
|
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
|
return lsblk_info
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -155,12 +155,12 @@ class AvailablePackage(BaseModel):
|
||||||
|
|
||||||
@cached_property
|
@cached_property
|
||||||
def longest_key(self) -> int:
|
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
|
# return all package info line by line
|
||||||
def info(self) -> str:
|
def info(self) -> str:
|
||||||
output = ''
|
output = ''
|
||||||
for key, value in self.dict().items():
|
for key, value in self.model_dump().items():
|
||||||
key = key.replace('_', ' ').capitalize()
|
key = key.replace('_', ' ').capitalize()
|
||||||
key = key.ljust(self.longest_key)
|
key = key.ljust(self.longest_key)
|
||||||
output += f'{key} : {value}\n'
|
output += f'{key} : {value}\n'
|
||||||
|
|
|
||||||
|
|
@ -70,6 +70,7 @@ disallow_any_explicit = false
|
||||||
disallow_any_expr = false
|
disallow_any_expr = false
|
||||||
disallow_any_unimported = true
|
disallow_any_unimported = true
|
||||||
enable_error_code = [
|
enable_error_code = [
|
||||||
|
"deprecated",
|
||||||
"explicit-override",
|
"explicit-override",
|
||||||
"ignore-without-code",
|
"ignore-without-code",
|
||||||
"mutable-override",
|
"mutable-override",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue