2018-11-17 17:24:34 +00:00
|
|
|
|
from contextlib import suppress
|
2018-06-10 16:47:49 +00:00
|
|
|
|
from enum import Enum, IntEnum, unique
|
2018-11-17 17:24:34 +00:00
|
|
|
|
from typing import Set, Union
|
2018-06-10 16:47:49 +00:00
|
|
|
|
|
2018-10-16 06:46:55 +00:00
|
|
|
|
import inflection
|
|
|
|
|
|
2018-06-10 16:47:49 +00:00
|
|
|
|
|
|
|
|
|
@unique
|
|
|
|
|
class SnapshotSoftware(Enum):
|
2018-07-14 14:41:22 +00:00
|
|
|
|
"""The software used to perform the Snapshot."""
|
2022-03-25 12:55:05 +00:00
|
|
|
|
|
2018-06-10 16:47:49 +00:00
|
|
|
|
Workbench = 'Workbench'
|
2020-03-03 11:03:09 +00:00
|
|
|
|
WorkbenchAndroid = 'WorkbenchAndroid'
|
2018-06-10 16:47:49 +00:00
|
|
|
|
AndroidApp = 'AndroidApp'
|
|
|
|
|
Web = 'Web'
|
|
|
|
|
DesktopApp = 'DesktopApp'
|
2020-12-29 19:39:04 +00:00
|
|
|
|
WorkbenchDesktop = 'WorkbenchDesktop'
|
2018-06-10 16:47:49 +00:00
|
|
|
|
|
2018-10-16 06:46:55 +00:00
|
|
|
|
def __str__(self):
|
|
|
|
|
return self.name
|
|
|
|
|
|
2018-06-10 16:47:49 +00:00
|
|
|
|
|
2019-05-08 17:12:05 +00:00
|
|
|
|
R_POSITIVE = 0, 10
|
|
|
|
|
R_NEGATIVE = -3, 5
|
2018-06-10 16:47:49 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@unique
|
|
|
|
|
class RatingRange(IntEnum):
|
|
|
|
|
"""
|
|
|
|
|
The human translation to score range.
|
|
|
|
|
|
2018-11-17 16:03:03 +00:00
|
|
|
|
You can compare them: ScoreRange.VERY_LOW < ScoreRange.LOW.
|
|
|
|
|
There are four levels:
|
|
|
|
|
|
|
|
|
|
1. Very low.
|
|
|
|
|
2. Low.
|
|
|
|
|
3. Medium.
|
|
|
|
|
4. High.
|
2018-06-10 16:47:49 +00:00
|
|
|
|
"""
|
2022-03-25 12:55:05 +00:00
|
|
|
|
|
2019-10-22 13:53:44 +00:00
|
|
|
|
VERY_LOW = 1
|
|
|
|
|
LOW = 2
|
|
|
|
|
MEDIUM = 3
|
|
|
|
|
HIGH = 4
|
2018-06-10 16:47:49 +00:00
|
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
|
def from_score(cls, val: Union[int, float]) -> 'RatingRange':
|
|
|
|
|
assert 0 <= val <= 10, 'Value is not a valid score.'
|
|
|
|
|
|
|
|
|
|
if val <= cls.VERY_LOW:
|
|
|
|
|
return cls.VERY_LOW
|
|
|
|
|
elif val <= cls.LOW:
|
|
|
|
|
return cls.LOW
|
|
|
|
|
elif val <= cls.MEDIUM:
|
|
|
|
|
return cls.MEDIUM
|
|
|
|
|
else:
|
|
|
|
|
return cls.HIGH
|
|
|
|
|
|
2018-10-16 06:46:55 +00:00
|
|
|
|
def __str__(self):
|
|
|
|
|
return inflection.humanize(self.name)
|
|
|
|
|
|
|
|
|
|
def __format__(self, format_spec):
|
|
|
|
|
return str(self)
|
|
|
|
|
|
2018-06-10 16:47:49 +00:00
|
|
|
|
|
2018-07-14 14:41:22 +00:00
|
|
|
|
@unique
|
|
|
|
|
class PriceSoftware(Enum):
|
|
|
|
|
Ereuse = 'Ereuse'
|
|
|
|
|
|
|
|
|
|
|
2018-06-10 16:47:49 +00:00
|
|
|
|
@unique
|
|
|
|
|
class AppearanceRange(Enum):
|
2019-05-08 17:12:05 +00:00
|
|
|
|
"""Grades the imperfections that aesthetically affect the device, but not its usage."""
|
2022-03-25 12:55:05 +00:00
|
|
|
|
|
2019-03-10 19:41:10 +00:00
|
|
|
|
Z = 'Z. The device is new'
|
|
|
|
|
A = 'A. Is like new; without visual damage'
|
|
|
|
|
B = 'B. Is in really good condition; small visual damage in difficult places to spot'
|
2019-05-08 17:12:05 +00:00
|
|
|
|
C = 'C. Is in good condition; small visual damage in parts that are easy to spot, minor cosmetic blemishes on chassis'
|
2019-03-19 23:08:05 +00:00
|
|
|
|
D = 'D. Is acceptable; visual damage in visible parts, major cosmetic blemishes on chassis, missing cosmetic parts'
|
2019-05-08 17:12:05 +00:00
|
|
|
|
E = 'E. Is unacceptable; considerable visual damage, missing essential parts'
|
2019-03-10 19:41:10 +00:00
|
|
|
|
|
2019-05-08 17:12:05 +00:00
|
|
|
|
def __str__(self):
|
|
|
|
|
return self.name
|
2019-03-10 19:41:10 +00:00
|
|
|
|
|
|
|
|
|
|
2018-06-10 16:47:49 +00:00
|
|
|
|
@unique
|
|
|
|
|
class FunctionalityRange(Enum):
|
2019-05-08 17:12:05 +00:00
|
|
|
|
"""Grades the defects of a device that affect its usage."""
|
2022-03-25 12:55:05 +00:00
|
|
|
|
|
2019-03-19 23:08:05 +00:00
|
|
|
|
A = 'A. All the buttons works perfectly, no screen/camera defects and chassis without usage issues'
|
2019-02-27 22:36:26 +00:00
|
|
|
|
B = 'B. There is a button difficult to press or unstable it, a screen/camera defect or chassis problem'
|
2019-03-19 23:08:05 +00:00
|
|
|
|
C = 'C. Chassis defects or multiple buttons don\'t work; broken or unusable it, some screen/camera defect'
|
|
|
|
|
D = 'D. Chassis severity usage problems. All buttons, screen or camera don\'t work; broken or unusable it'
|
2019-02-27 22:36:26 +00:00
|
|
|
|
|
2019-05-08 17:12:05 +00:00
|
|
|
|
def __str__(self):
|
|
|
|
|
return self.name
|
2019-03-13 12:06:58 +00:00
|
|
|
|
|
|
|
|
|
|
2019-03-10 19:41:10 +00:00
|
|
|
|
@unique
|
|
|
|
|
class BatteryHealthRange(Enum):
|
|
|
|
|
"""Grade the battery health status, depending on self report Android system"""
|
2022-03-25 12:55:05 +00:00
|
|
|
|
|
2019-03-10 19:41:10 +00:00
|
|
|
|
A = 'A. The battery health is very good'
|
|
|
|
|
B = 'B. Battery health is good'
|
|
|
|
|
C = 'C. Battery health is overheat / over voltage status but can stand the minimum duration'
|
|
|
|
|
D = 'D. Battery health is bad; can’t stand the minimum duration time'
|
2019-05-08 17:12:05 +00:00
|
|
|
|
E = 'E. Battery health is very bad; and status is dead; unusable or miss it'
|
2019-03-10 19:41:10 +00:00
|
|
|
|
NONE = 'NA. Grade doesn’t exists'
|
|
|
|
|
|
2019-05-08 17:12:05 +00:00
|
|
|
|
def __str__(self):
|
|
|
|
|
return self.name
|
2019-03-10 19:41:10 +00:00
|
|
|
|
|
2019-04-11 16:29:51 +00:00
|
|
|
|
|
2018-06-10 16:47:49 +00:00
|
|
|
|
@unique
|
2019-04-11 16:29:51 +00:00
|
|
|
|
class BiosAccessRange(Enum):
|
2018-06-10 16:47:49 +00:00
|
|
|
|
"""How difficult it has been to set the bios to boot from the network."""
|
2022-03-25 12:55:05 +00:00
|
|
|
|
|
2018-06-10 16:47:49 +00:00
|
|
|
|
A = 'A. If by pressing a key you could access a boot menu with the network boot'
|
|
|
|
|
B = 'B. You had to get into the BIOS, and in less than 5 steps you could set the network boot'
|
|
|
|
|
C = 'C. Like B, but with more than 5 steps'
|
|
|
|
|
D = 'D. Like B or C, but you had to unlock the BIOS (i.e. by removing the battery)'
|
|
|
|
|
E = 'E. The device could not be booted through the network.'
|
|
|
|
|
|
2019-05-08 17:12:05 +00:00
|
|
|
|
def __str__(self):
|
|
|
|
|
return self.name
|
|
|
|
|
|
2018-06-10 16:47:49 +00:00
|
|
|
|
|
|
|
|
|
@unique
|
|
|
|
|
class Orientation(Enum):
|
|
|
|
|
Vertical = 'vertical'
|
|
|
|
|
Horizontal = 'Horizontal'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@unique
|
2018-10-08 08:37:32 +00:00
|
|
|
|
class TestDataStorageLength(Enum):
|
2018-06-10 16:47:49 +00:00
|
|
|
|
Short = 'Short'
|
|
|
|
|
Extended = 'Extended'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@unique
|
|
|
|
|
class ImageSoftware(Enum):
|
|
|
|
|
Photobox = 'Photobox'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@unique
|
|
|
|
|
class ImageMimeTypes(Enum):
|
|
|
|
|
"""Supported image Mimetypes for Devicehub."""
|
2022-03-25 12:55:05 +00:00
|
|
|
|
|
2018-06-10 16:47:49 +00:00
|
|
|
|
jpg = 'image/jpeg'
|
|
|
|
|
png = 'image/png'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BOX_RATE_5 = 1, 5
|
|
|
|
|
BOX_RATE_3 = 1, 3
|
2018-06-12 14:50:05 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# After looking at own databases
|
|
|
|
|
|
2022-03-25 12:55:05 +00:00
|
|
|
|
|
2018-06-12 14:50:05 +00:00
|
|
|
|
@unique
|
|
|
|
|
class RamInterface(Enum):
|
2018-09-08 14:46:39 +00:00
|
|
|
|
"""
|
|
|
|
|
The interface or type of RAM.
|
|
|
|
|
|
|
|
|
|
The more common type of RAM nowadays for RamModules is SDRAM.
|
|
|
|
|
Note that we have not added all sub-types (please contact if
|
|
|
|
|
you want them). See more here
|
|
|
|
|
https://en.wikipedia.org/wiki/Category:SDRAM.
|
|
|
|
|
|
|
|
|
|
Although SDRAM is the generic naming for any DDR we include it
|
|
|
|
|
here for those cases where there is no more specific information.
|
|
|
|
|
Please, try to always use DDRø-6 denominations.
|
|
|
|
|
"""
|
2022-03-25 12:55:05 +00:00
|
|
|
|
|
2018-09-08 14:46:39 +00:00
|
|
|
|
SDRAM = 'SDRAM'
|
|
|
|
|
DDR = 'DDR SDRAM'
|
|
|
|
|
DDR2 = 'DDR2 SDRAM'
|
|
|
|
|
DDR3 = 'DDR3 SDRAM'
|
|
|
|
|
DDR4 = 'DDR4 SDRAM'
|
|
|
|
|
DDR5 = 'DDR5 SDRAM'
|
|
|
|
|
DDR6 = 'DDR6 SDRAM'
|
2022-03-25 12:55:05 +00:00
|
|
|
|
LPDDR3 = 'LPDDR3'
|
2018-06-12 14:50:05 +00:00
|
|
|
|
|
2018-10-03 12:51:22 +00:00
|
|
|
|
def __str__(self):
|
|
|
|
|
return self.value
|
|
|
|
|
|
2018-06-12 14:50:05 +00:00
|
|
|
|
|
|
|
|
|
@unique
|
|
|
|
|
class RamFormat(Enum):
|
|
|
|
|
DIMM = 'DIMM'
|
|
|
|
|
SODIMM = 'SODIMM'
|
|
|
|
|
|
2018-10-03 12:51:22 +00:00
|
|
|
|
def __str__(self):
|
|
|
|
|
return self.value
|
|
|
|
|
|
2018-06-12 14:50:05 +00:00
|
|
|
|
|
|
|
|
|
@unique
|
|
|
|
|
class DataStorageInterface(Enum):
|
|
|
|
|
ATA = 'ATA'
|
|
|
|
|
USB = 'USB'
|
|
|
|
|
PCI = 'PCI'
|
2022-04-08 09:40:39 +00:00
|
|
|
|
NVME = 'NVME'
|
2018-06-20 21:18:15 +00:00
|
|
|
|
|
2018-10-03 12:51:22 +00:00
|
|
|
|
def __str__(self):
|
|
|
|
|
return self.value
|
|
|
|
|
|
2018-06-20 21:18:15 +00:00
|
|
|
|
|
|
|
|
|
@unique
|
2018-06-26 13:35:13 +00:00
|
|
|
|
class DisplayTech(Enum):
|
2018-06-20 21:18:15 +00:00
|
|
|
|
CRT = 'Cathode ray tube (CRT)'
|
|
|
|
|
TFT = 'Thin-film-transistor liquid-crystal (TFT)'
|
|
|
|
|
LED = 'LED-backlit (LED)'
|
|
|
|
|
PDP = 'Plasma display panel (Plasma)'
|
|
|
|
|
LCD = 'Liquid-crystal display (any of TFT, LED, Blue Phase, IPS)'
|
|
|
|
|
OLED = 'Organic light-emitting diode (OLED)'
|
|
|
|
|
AMOLED = 'Organic light-emitting diode (AMOLED)'
|
2018-06-26 13:36:21 +00:00
|
|
|
|
|
2018-10-03 12:51:22 +00:00
|
|
|
|
def __str__(self):
|
|
|
|
|
return self.name
|
|
|
|
|
|
2018-06-26 13:36:21 +00:00
|
|
|
|
|
|
|
|
|
@unique
|
|
|
|
|
class ComputerChassis(Enum):
|
|
|
|
|
"""The chassis of a computer."""
|
2022-03-25 12:55:05 +00:00
|
|
|
|
|
2018-06-26 13:36:21 +00:00
|
|
|
|
Tower = 'Tower'
|
|
|
|
|
Docking = 'Docking'
|
2018-10-03 12:51:22 +00:00
|
|
|
|
AllInOne = 'All in one'
|
2018-06-26 13:36:21 +00:00
|
|
|
|
Microtower = 'Microtower'
|
2018-10-03 12:51:22 +00:00
|
|
|
|
PizzaBox = 'Pizza box'
|
2018-06-26 13:36:21 +00:00
|
|
|
|
Lunchbox = 'Lunchbox'
|
|
|
|
|
Stick = 'Stick'
|
|
|
|
|
Netbook = 'Netbook'
|
|
|
|
|
Handheld = 'Handheld'
|
|
|
|
|
Laptop = 'Laptop'
|
|
|
|
|
Convertible = 'Convertible'
|
|
|
|
|
Detachable = 'Detachable'
|
|
|
|
|
Tablet = 'Tablet'
|
2018-10-03 12:51:22 +00:00
|
|
|
|
Virtual = 'Non-physical device'
|
|
|
|
|
|
2018-10-25 10:36:25 +00:00
|
|
|
|
def __str__(self):
|
2018-10-16 14:30:10 +00:00
|
|
|
|
return inflection.humanize(inflection.underscore(self.value))
|
2018-08-03 16:15:08 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ReceiverRole(Enum):
|
|
|
|
|
"""
|
|
|
|
|
The role that the receiver takes in the reception;
|
|
|
|
|
the meaning of the reception.
|
|
|
|
|
"""
|
2022-03-25 12:55:05 +00:00
|
|
|
|
|
2018-08-03 16:15:08 +00:00
|
|
|
|
Intermediary = 'Generic user in the workflow of the device.'
|
|
|
|
|
FinalUser = 'The user that will use the device.'
|
|
|
|
|
CollectionPoint = 'A collection point.'
|
|
|
|
|
RecyclingPoint = 'A recycling point.'
|
|
|
|
|
Transporter = 'An user that ships the devices to another one.'
|
2018-10-13 12:53:46 +00:00
|
|
|
|
|
|
|
|
|
|
2018-10-23 13:37:37 +00:00
|
|
|
|
class PrinterTechnology(Enum):
|
|
|
|
|
"""Technology of the printer."""
|
2022-03-25 12:55:05 +00:00
|
|
|
|
|
2018-10-23 13:37:37 +00:00
|
|
|
|
Toner = 'Toner / Laser'
|
|
|
|
|
Inkjet = 'Liquid inkjet'
|
|
|
|
|
SolidInk = 'Solid ink'
|
|
|
|
|
Dye = 'Dye-sublimation'
|
|
|
|
|
Thermal = 'Thermal'
|
2018-11-08 16:37:14 +00:00
|
|
|
|
|
|
|
|
|
|
2019-07-01 18:39:32 +00:00
|
|
|
|
@unique
|
|
|
|
|
class CameraFacing(Enum):
|
|
|
|
|
Front = 'Front'
|
|
|
|
|
Back = 'Back'
|
|
|
|
|
|
|
|
|
|
|
2019-05-03 12:31:49 +00:00
|
|
|
|
@unique
|
|
|
|
|
class BatteryHealth(Enum):
|
|
|
|
|
"""The battery health status as in Android."""
|
2022-03-25 12:55:05 +00:00
|
|
|
|
|
2019-05-03 12:31:49 +00:00
|
|
|
|
Cold = 'Cold'
|
|
|
|
|
Dead = 'Dead'
|
|
|
|
|
Good = 'Good'
|
|
|
|
|
Overheat = 'Overheat'
|
|
|
|
|
OverVoltage = 'OverVoltage'
|
|
|
|
|
UnspecifiedValue = 'UnspecifiedValue'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@unique
|
|
|
|
|
class BatteryTechnology(Enum):
|
2019-06-29 14:26:14 +00:00
|
|
|
|
"""The technology of the Battery. Adapted from
|
|
|
|
|
https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-class-power
|
|
|
|
|
adding ``Alkaline``.
|
|
|
|
|
"""
|
2022-03-25 12:55:05 +00:00
|
|
|
|
|
2019-05-03 12:31:49 +00:00
|
|
|
|
LiIon = 'Lithium-ion'
|
2019-06-29 14:26:14 +00:00
|
|
|
|
NiCd = 'Nickel-Cadmium'
|
2019-05-03 12:31:49 +00:00
|
|
|
|
NiMH = 'Nickel-metal hydride'
|
2019-06-29 14:26:14 +00:00
|
|
|
|
LiPoly = 'Lithium-ion Polymer'
|
|
|
|
|
LiFe = 'LiFe'
|
|
|
|
|
LiMn = 'Lithium Manganese'
|
2019-05-03 12:31:49 +00:00
|
|
|
|
Al = 'Alkaline'
|
|
|
|
|
|
|
|
|
|
|
2018-11-08 16:37:14 +00:00
|
|
|
|
class Severity(IntEnum):
|
2019-05-11 14:27:22 +00:00
|
|
|
|
"""A flag evaluating the action execution. Ex. failed actions
|
2019-02-03 16:12:53 +00:00
|
|
|
|
have the value `Severity.Error`. Devicehub uses 4 severity levels:
|
2018-11-08 16:37:14 +00:00
|
|
|
|
|
2019-05-14 18:31:43 +00:00
|
|
|
|
* Info (Pass): default neutral severity. The action succeeded.
|
2019-05-11 14:27:22 +00:00
|
|
|
|
* Notice: The action succeeded but it is raising awareness.
|
2018-11-08 16:37:14 +00:00
|
|
|
|
Notices are not usually that important but something
|
|
|
|
|
(good or bad) worth checking.
|
2019-05-11 14:27:22 +00:00
|
|
|
|
* Warning: The action succeeded but there is something important
|
|
|
|
|
to check negatively affecting the action.
|
2019-05-14 18:31:43 +00:00
|
|
|
|
* Error (Fail): the action failed.
|
2018-11-08 16:37:14 +00:00
|
|
|
|
|
2019-05-11 14:27:22 +00:00
|
|
|
|
Devicehub specially raises user awareness when an action
|
2018-11-08 16:37:14 +00:00
|
|
|
|
has a Severity of ``Warning`` or greater.
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
Info = 0
|
|
|
|
|
Notice = 1
|
|
|
|
|
Warning = 2
|
|
|
|
|
Error = 3
|
|
|
|
|
|
|
|
|
|
def __str__(self):
|
|
|
|
|
if self == self.Info:
|
|
|
|
|
m = '✓'
|
|
|
|
|
elif self == self.Notice:
|
|
|
|
|
m = 'ℹ️'
|
|
|
|
|
elif self == self.Warning:
|
|
|
|
|
m = '⚠'
|
|
|
|
|
else:
|
|
|
|
|
m = '❌'
|
|
|
|
|
return m
|
2018-11-15 12:35:19 +00:00
|
|
|
|
|
2018-11-21 13:26:56 +00:00
|
|
|
|
def __format__(self, format_spec):
|
|
|
|
|
return str(self)
|
|
|
|
|
|
2018-11-15 12:35:19 +00:00
|
|
|
|
|
|
|
|
|
class PhysicalErasureMethod(Enum):
|
|
|
|
|
"""Methods of physically erasing the data-storage, usually
|
|
|
|
|
destroying the whole component.
|
|
|
|
|
|
|
|
|
|
Certified data-storage destruction mean, as of `UNE-EN 15713
|
|
|
|
|
<https://www.une.org/encuentra-tu-norma/busca-tu-norma/norma?c=N0044792>`_,
|
|
|
|
|
reducing the material to a size making it undecipherable, illegible,
|
|
|
|
|
and non able to be re-built.
|
|
|
|
|
"""
|
|
|
|
|
|
2022-03-25 12:55:05 +00:00
|
|
|
|
Shred = 'Reduction of the data-storage to the required certified ' 'standard sizes.'
|
|
|
|
|
Disintegration = (
|
|
|
|
|
'Reduction of the data-storage to smaller sizes '
|
|
|
|
|
'than the certified standard ones.'
|
|
|
|
|
)
|
2018-11-15 12:35:19 +00:00
|
|
|
|
|
|
|
|
|
def __str__(self):
|
|
|
|
|
return self.name
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ErasureStandards(Enum):
|
2018-11-17 16:03:03 +00:00
|
|
|
|
"""Software erasure standards."""
|
|
|
|
|
|
2018-11-15 12:35:19 +00:00
|
|
|
|
HMG_IS5 = 'British HMG Infosec Standard 5 (HMG IS5)'
|
2023-01-25 12:20:43 +00:00
|
|
|
|
"""`British HMG Infosec Standard 5 (HMG IS5)
|
|
|
|
|
<https://en.wikipedia.org/wiki/Infosec_Standard_5>`.
|
|
|
|
|
|
2018-11-15 12:35:19 +00:00
|
|
|
|
In order to follow this standard, an erasure must have the
|
|
|
|
|
following steps:
|
2023-01-25 12:20:43 +00:00
|
|
|
|
|
2018-11-15 12:35:19 +00:00
|
|
|
|
1. A first step writing zeroes to the data-storage units.
|
|
|
|
|
2. A second step erasing with random data, verifying the erasure
|
|
|
|
|
success in each hard-drive sector.
|
2023-01-25 12:20:43 +00:00
|
|
|
|
|
2019-05-11 14:27:22 +00:00
|
|
|
|
And be an :class:`ereuse_devicehub.resources.action.models.EraseSectors`.
|
2018-11-15 12:35:19 +00:00
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
def __str__(self):
|
|
|
|
|
return self.value
|
|
|
|
|
|
|
|
|
|
@classmethod
|
2018-11-17 17:24:34 +00:00
|
|
|
|
def from_data_storage(cls, erasure) -> Set['ErasureStandards']:
|
|
|
|
|
"""Returns a set of erasure standards."""
|
2019-05-11 14:27:22 +00:00
|
|
|
|
from ereuse_devicehub.resources.action import models as actions
|
2022-03-25 12:55:05 +00:00
|
|
|
|
|
2018-11-17 17:24:34 +00:00
|
|
|
|
standards = set()
|
2019-05-11 14:27:22 +00:00
|
|
|
|
if isinstance(erasure, actions.EraseSectors):
|
2018-11-17 17:24:34 +00:00
|
|
|
|
with suppress(ValueError):
|
|
|
|
|
first_step, *other_steps = erasure.steps
|
2022-03-25 12:55:05 +00:00
|
|
|
|
if isinstance(first_step, actions.StepZero) and all(
|
|
|
|
|
isinstance(step, actions.StepRandom) for step in other_steps
|
|
|
|
|
):
|
2018-11-17 17:24:34 +00:00
|
|
|
|
standards.add(cls.HMG_IS5)
|
|
|
|
|
return standards
|
2019-12-12 00:25:11 +00:00
|
|
|
|
|
2020-08-17 14:45:18 +00:00
|
|
|
|
|
2019-12-12 00:25:11 +00:00
|
|
|
|
@unique
|
2019-12-16 19:38:41 +00:00
|
|
|
|
class TransferState(IntEnum):
|
2022-03-25 12:55:05 +00:00
|
|
|
|
"""State of transfer for a given Lot of devices."""
|
2019-12-12 00:25:11 +00:00
|
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
* Initial: No transfer action in place.
|
|
|
|
|
* Initiated: The transfer action has been initiated by orginator.
|
|
|
|
|
* Accepted: The transfer action has been accepted by destinator.
|
|
|
|
|
|
|
|
|
|
Devicehub specially raises user awareness when an action
|
|
|
|
|
has a Severity of ``Warning`` or greater.
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
Initial = 0
|
|
|
|
|
Initiated = 1
|
|
|
|
|
Accepted = 2
|
|
|
|
|
Completed = 3
|
|
|
|
|
|
|
|
|
|
def __str__(self):
|
|
|
|
|
return self.name
|
2022-03-25 12:55:05 +00:00
|
|
|
|
|
2021-04-13 16:33:15 +00:00
|
|
|
|
|
|
|
|
|
@unique
|
|
|
|
|
class SessionType(IntEnum):
|
|
|
|
|
"""
|
|
|
|
|
Enumaration of types of sessions:
|
|
|
|
|
|
|
|
|
|
* Internal: permanent Session for internal user. This is used in usb of WorkBench.
|
|
|
|
|
* External: permanent Session for external users. This is used in usb of WorkBench.
|
|
|
|
|
* Session: This is used for keep more than one session in the app frontend.
|
|
|
|
|
|
|
|
|
|
Devicehub specially raises user awareness when an action
|
|
|
|
|
has a Severity of ``Warning`` or greater.
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
Internal = 0
|
|
|
|
|
External = 1
|
|
|
|
|
Session = 2
|
|
|
|
|
|
|
|
|
|
def __str__(self):
|
|
|
|
|
return self.name
|
2023-01-25 12:20:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class StatusCode(IntEnum):
|
|
|
|
|
"""The code of the status response of api dlt."""
|
|
|
|
|
|
|
|
|
|
Success = 201
|
|
|
|
|
NotWork = 400
|
|
|
|
|
|
|
|
|
|
def __str__(self):
|
|
|
|
|
return self.name
|