This repository has been archived on 2024-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
devicehub-teal/ereuse_devicehub/resources/event/models.pyi

262 lines
7.9 KiB
Python
Raw Normal View History

2018-06-10 16:47:49 +00:00
from datetime import datetime, timedelta
from distutils.version import StrictVersion
from typing import List, Set
from uuid import UUID
from sqlalchemy import Column
from sqlalchemy.orm import relationship
from ereuse_devicehub.resources.device.models import Component, Computer, Device
from ereuse_devicehub.resources.enums import AppearanceRange, Bios, FunctionalityRange, \
2018-06-14 13:14:23 +00:00
RatingSoftware, SnapshotExpectedEvents, SnapshotSoftware, TestHardDriveLength
2018-06-10 16:47:49 +00:00
from ereuse_devicehub.resources.image.models import Image
from ereuse_devicehub.resources.models import Thing
from ereuse_devicehub.resources.user import User
from teal.db import Model
class Event(Thing):
id = ... # type: Column
2018-06-12 14:50:05 +00:00
name = ... # type: Column
2018-06-10 16:47:49 +00:00
date = ... # type: Column
type = ... # type: Column
2018-06-14 13:14:23 +00:00
error = ... # type: Column
2018-06-10 16:47:49 +00:00
incidence = ... # type: Column
description = ... # type: Column
finalized = ... # type: Column
snapshot_id = ... # type: Column
snapshot = ... # type: relationship
author_id = ... # type: Column
author = ... # type: relationship
components = ... # type: relationship
parent_id = ... # type: Column
parent = ... # type: relationship
2018-06-10 16:47:49 +00:00
def __init__(self, **kwargs) -> None:
super().__init__(**kwargs)
self.id = ... # type: UUID
2018-06-12 14:50:05 +00:00
self.name = ... # type: str
2018-06-10 16:47:49 +00:00
self.type = ... # type: str
self.incidence = ... # type: bool
self.closed = ... # type: bool
self.error = ... # type: bool
self.description = ... # type: str
self.date = ... # type: datetime
self.snapshot_id = ... # type: UUID
self.snapshot = ... # type: Snapshot
self.author_id = ... # type: UUID
self.author = ... # type: User
self.components = ... # type: Set[Component]
self.parent_id = ... # type: Computer
self.parent = ... # type: Computer
2018-06-10 16:47:49 +00:00
class EventWithOneDevice(Event):
def __init__(self, **kwargs) -> None:
super().__init__(**kwargs)
self.device_id = ... # type: int
self.device = ... # type: Device
class EventWithMultipleDevices(Event):
def __init__(self, **kwargs) -> None:
super().__init__(**kwargs)
self.devices = ... # type: Set[Device]
class Step(Model):
def __init__(self, **kwargs) -> None:
self.erasure_id = ... # type: UUID
self.type = ... # type: str
self.num = ... # type: int
self.success = ... # type: bool
self.start_time = ... # type: datetime
self.end_time = ... # type: datetime
self.secure_random_steps = ... # type: int
self.clean_with_zeros = ... # type: bool
self.erasure = ... # type: EraseBasic
class StepZero(Step):
pass
class StepRandom(Step):
pass
class Snapshot(EventWithOneDevice):
def __init__(self, **kwargs) -> None:
super().__init__(**kwargs)
self.uuid = ... # type: UUID
self.version = ... # type: StrictVersion
self.software = ... # type: SnapshotSoftware
self.elapsed = ... # type: timedelta
self.device = ... # type: Computer
self.events = ... # type: Set[Event]
2018-06-14 13:14:23 +00:00
self.expected_events = ... # type: List[SnapshotExpectedEvents]
2018-06-10 16:47:49 +00:00
class Install(EventWithOneDevice):
def __init__(self, **kwargs) -> None:
super().__init__(**kwargs)
self.name = ... # type: str
self.elapsed = ... # type: timedelta
self.success = ... # type: bool
class SnapshotRequest(Model):
def __init__(self, **kwargs) -> None:
self.id = ... # type: UUID
self.request = ... # type: dict
self.snapshot = ... # type: Snapshot
class Rate(EventWithOneDevice):
2018-06-14 13:14:23 +00:00
rating = ... # type: Column
appearance = ... # type: Column
functionality = ... # type: Column
2018-06-10 16:47:49 +00:00
def __init__(self, **kwargs) -> None:
super().__init__(**kwargs)
self.rating = ... # type: float
self.algorithm_software = ... # type: RatingSoftware
self.algorithm_version = ... # type: StrictVersion
self.appearance = ... # type: float
self.functionality = ... # type: float
self.rating_range = ... # type: str
class IndividualRate(Rate):
def __init__(self, **kwargs) -> None:
super().__init__(**kwargs)
self.aggregated_ratings = ... # type: Set[AggregateRate]
class AggregateRate(Rate):
def __init__(self, **kwargs) -> None:
super().__init__(**kwargs)
self.ratings = ... # type: Set[IndividualRate]
class WorkbenchRate(IndividualRate):
def __init__(self, **kwargs) -> None:
super().__init__(**kwargs)
self.processor = ... # type: float
self.ram = ... # type: float
self.data_storage = ... # type: float
self.graphic_card = ... # type: float
self.labelling = ... # type: bool
self.bios = ... # type: Bios
self.appearance_range = ... # type: AppearanceRange
self.functionality_range = ... # type: FunctionalityRange
class PhotoboxRate(IndividualRate):
def __init__(self, **kwargs) -> None:
super().__init__(**kwargs)
self.num = ... # type: int
self.image_id = ... # type: UUID
self.image = ... # type: Image
class PhotoboxUserRate(PhotoboxRate):
def __init__(self, **kwargs) -> None:
super().__init__(**kwargs)
self.assembling = ... # type: int
self.parts = ... # type: int
self.buttons = ... # type: int
self.dents = ... # type: int
self.decolorization = ... # type: int
self.scratches = ... # type: int
self.tag_adhesive = ... # type: int
self.dirt = ... # type: int
class PhotoboxSystemRate(PhotoboxRate):
pass
class Test(EventWithOneDevice):
def __init__(self, **kwargs) -> None:
super().__init__(**kwargs)
self.elapsed = ... # type: timedelta
self.success = ... # type: bool
class TestDataStorage(Test):
def __init__(self, **kwargs) -> None:
super().__init__(**kwargs)
self.id = ... # type: UUID
self.length = ... # type: TestHardDriveLength
self.status = ... # type: str
self.lifetime = ... # type: timedelta
self.first_error = ... # type: int
self.passed_lifetime = ... # type: timedelta
self.assessment = ... # type: int
self.reallocated_sector_count = ... # type: int
self.power_cycle_count = ... # type: int
self.reported_uncorrectable_errors = ... # type: int
self.command_timeout = ... # type: int
self.current_pending_sector_count = ... # type: int
self.offline_uncorrectable = ... # type: int
self.remaining_lifetime_percentage = ... # type: int
class StressTest(Test):
pass
class EraseBasic(EventWithOneDevice):
def __init__(self, **kwargs) -> None:
super().__init__(**kwargs)
self.start_time = ... # type: datetime
self.end_time = ... # type: datetime
self.secure_random_steps = ... # type: int
self.steps = ... # type: List[Step]
self.clean_with_zeros = ... # type: bool
self.success = ... # type: bool
class Ready(EventWithMultipleDevices):
pass
2018-06-10 16:47:49 +00:00
class EraseSectors(EraseBasic):
def __init__(self, **kwargs) -> None:
super().__init__(**kwargs)
2018-06-14 13:14:23 +00:00
class Benchmark(EventWithOneDevice):
pass
class BenchmarkDataStorage(Benchmark):
read_speed = ... # type: Column
write_speed = ... # type: Column
def __init__(self, **kwargs) -> None:
super().__init__(**kwargs)
self.read_speed = ... # type: float
self.write_speed = ... # type: float
class BenchmarkWithRate(Benchmark):
rate = ... # type: Column
def __init__(self, **kwargs) -> None:
super().__init__(**kwargs)
self.rate = ... # type: int
class BenchmarkProcessor(BenchmarkWithRate):
pass
class BenchmarkProcessorSysbench(BenchmarkProcessor):
pass
class BenchmarkRamSysbench(BenchmarkWithRate):
pass