From e4af28c4a398cd87378d3833b1d25db0f291ac9e Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Fri, 9 Oct 2026 11:35:11 +0500 Subject: upgrade to StrEnum --- vk/user.py | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) (limited to 'vk/user.py') diff --git a/vk/user.py b/vk/user.py index 010a198..26d9cf1 100644 --- a/vk/user.py +++ b/vk/user.py @@ -5,7 +5,7 @@ from collections import OrderedDict from collections.abc import Hashable, Mapping, MutableMapping -from enum import Enum +from enum import auto, StrEnum from .last_seen import LastSeen @@ -36,27 +36,21 @@ def _parse_online_flag(x): return _parse_bool(x) -class UserField(Enum): +class UserField(StrEnum): UID = "id" - FIRST_NAME = "first_name" - LAST_NAME = "last_name" - DEACTIVATED = "deactivated" - HIDDEN = "hidden" + FIRST_NAME = auto() + LAST_NAME = auto() + DEACTIVATED = auto() + HIDDEN = auto() - DOMAIN = "domain" - ONLINE = "online" - LAST_SEEN = "last_seen" + DOMAIN = auto() + ONLINE = auto() + LAST_SEEN = auto() - def __str__(self): - return self.value - -class DeactivationReason(Enum): - DELETED = "deleted" - BANNED = "banned" - - def __str__(self): - return self.value +class DeactivationReason(StrEnum): + DELETED = auto() + BANNED = auto() def _parse_deactivated(s): -- cgit v1.3