From 4711f7abad7b4b7c29b5f72a9839e734d97d8cc8 Mon Sep 17 00:00:00 2001 From: correctmost <134317971+correctmost@users.noreply.github.com> Date: Tue, 25 Mar 2025 17:14:11 -0400 Subject: [PATCH] Fix Pydantic deprecation warnings (#3301) This commit also enables mypy checks for deprecated calls. --- archinstall/lib/disk/device_handler.py | 2 +- archinstall/lib/models/packages.py | 4 ++-- pyproject.toml | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/archinstall/lib/disk/device_handler.py b/archinstall/lib/disk/device_handler.py index ceb263ae..ad78153e 100644 --- a/archinstall/lib/disk/device_handler.py +++ b/archinstall/lib/disk/device_handler.py @@ -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 diff --git a/archinstall/lib/models/packages.py b/archinstall/lib/models/packages.py index 9d3b3d0f..0e2e05d7 100644 --- a/archinstall/lib/models/packages.py +++ b/archinstall/lib/models/packages.py @@ -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' diff --git a/pyproject.toml b/pyproject.toml index da24eda3..4add65ca 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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",