Skip to content

Commit

Permalink
common: cleanup - remove six dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
xsuchy authored and praiskup committed Sep 11, 2024
1 parent 2bdec45 commit ff5288d
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions common/copr_common/enums.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import random
import string

from six import with_metaclass

# We don't know how to define the enums without `class`.
# pylint: disable=too-few-public-methods

Expand All @@ -22,7 +20,7 @@ def __getattr__(cls, attr):
return cls._wrap(attr)


class ActionTypeEnum(with_metaclass(EnumType, object)):
class ActionTypeEnum(metaclass=EnumType):
vals = {
"delete": 0,
"rename": 1,
Expand All @@ -39,15 +37,15 @@ class ActionTypeEnum(with_metaclass(EnumType, object)):
}


class ActionResult(with_metaclass(EnumType, object)):
class ActionResult(metaclass=EnumType):
vals = {
'WAITING': 0,
'SUCCESS': 1,
'FAILURE': 2,
}


class DefaultActionPriorityEnum(with_metaclass(EnumType, object)):
class DefaultActionPriorityEnum(metaclass=EnumType):
"""
The higher the 'priority' is, the later the task is taken.
Keep actions priority in range -100 to 100
Expand All @@ -64,7 +62,7 @@ class DefaultActionPriorityEnum(with_metaclass(EnumType, object)):
}


class ActionPriorityEnum(with_metaclass(EnumType, object)):
class ActionPriorityEnum(metaclass=EnumType):
"""
Naming/assigning the values is a little bit tricky because
how the current implementation works (i.e. it is inverted).
Expand All @@ -74,15 +72,15 @@ class ActionPriorityEnum(with_metaclass(EnumType, object)):
vals = {"highest": -99, "lowest": 99}


class BackendResultEnum(with_metaclass(EnumType, object)):
class BackendResultEnum(metaclass=EnumType):
vals = {"waiting": 0, "success": 1, "failure": 2}


class RoleEnum(with_metaclass(EnumType, object)):
class RoleEnum(metaclass=EnumType):
vals = {"user": 0, "admin": 1}


class StatusEnum(with_metaclass(EnumType, object)):
class StatusEnum(metaclass=EnumType):
vals = {
"failed": 0, # build failed
"succeeded": 1, # build succeeded
Expand Down Expand Up @@ -111,7 +109,7 @@ class ModuleStatusEnum(StatusEnum):
"failed", "succeeded", "waiting", "unknown"])


class BuildSourceEnum(with_metaclass(EnumType, object)):
class BuildSourceEnum(metaclass=EnumType):
vals = {"unset": 0,
"link": 1, # url
"upload": 2, # pkg, tmp, url
Expand All @@ -123,7 +121,7 @@ class BuildSourceEnum(with_metaclass(EnumType, object)):
}


class FailTypeEnum(with_metaclass(EnumType, object)):
class FailTypeEnum(metaclass=EnumType):
vals = {"unset": 0,
# General errors mixed with errors for SRPM URL/upload:
"unknown_error": 1,
Expand All @@ -139,7 +137,7 @@ class FailTypeEnum(with_metaclass(EnumType, object)):
}


class StorageEnum(with_metaclass(EnumType, object)):
class StorageEnum(metaclass=EnumType):
"""
Supported storages
"""
Expand Down

0 comments on commit ff5288d

Please sign in to comment.