2018-08-03 16:15:08 +00:00
|
|
|
import ipaddress
|
2018-06-10 16:47:49 +00:00
|
|
|
from datetime import datetime, timedelta
|
2018-08-03 16:15:08 +00:00
|
|
|
from decimal import Decimal
|
2018-06-10 16:47:49 +00:00
|
|
|
from distutils.version import StrictVersion
|
2019-05-08 17:12:05 +00:00
|
|
|
from typing import Dict, List, Optional, Set, Tuple, Union
|
2018-06-10 16:47:49 +00:00
|
|
|
from uuid import UUID
|
|
|
|
|
2018-10-05 15:13:23 +00:00
|
|
|
from boltons import urlutils
|
2018-08-03 16:15:08 +00:00
|
|
|
from boltons.urlutils import URL
|
2018-06-10 16:47:49 +00:00
|
|
|
from sqlalchemy import Column
|
|
|
|
from sqlalchemy.orm import relationship
|
2018-07-14 14:41:22 +00:00
|
|
|
from sqlalchemy_utils import Currency
|
2018-09-07 10:38:02 +00:00
|
|
|
from teal import enums
|
|
|
|
from teal.db import Model
|
|
|
|
from teal.enums import Country
|
2018-06-10 16:47:49 +00:00
|
|
|
|
2018-08-03 16:15:08 +00:00
|
|
|
from ereuse_devicehub.resources.agent.models import Agent
|
2018-06-10 16:47:49 +00:00
|
|
|
from ereuse_devicehub.resources.device.models import Component, Computer, Device
|
2019-05-11 14:27:22 +00:00
|
|
|
from ereuse_devicehub.resources.enums import AppearanceRange, BatteryHealth, ErasureStandards, \
|
|
|
|
FunctionalityRange, PhysicalErasureMethod, PriceSoftware, RatingRange, ReceiverRole, Severity, \
|
|
|
|
SnapshotSoftware, TestDataStorageLength
|
2018-06-10 16:47:49 +00:00
|
|
|
from ereuse_devicehub.resources.models import Thing
|
2018-08-03 16:15:08 +00:00
|
|
|
from ereuse_devicehub.resources.user.models import User
|
2018-06-10 16:47:49 +00:00
|
|
|
|
|
|
|
|
2019-05-11 14:27:22 +00:00
|
|
|
class Action(Thing):
|
2018-06-10 16:47:49 +00:00
|
|
|
id = ... # type: Column
|
2018-06-12 14:50:05 +00:00
|
|
|
name = ... # type: Column
|
2018-06-10 16:47:49 +00:00
|
|
|
type = ... # type: Column
|
|
|
|
description = ... # type: Column
|
|
|
|
snapshot_id = ... # type: Column
|
|
|
|
snapshot = ... # type: relationship
|
|
|
|
author_id = ... # type: Column
|
2018-08-03 16:15:08 +00:00
|
|
|
agent = ... # type: relationship
|
2018-06-10 16:47:49 +00:00
|
|
|
components = ... # type: relationship
|
2018-06-16 10:41:12 +00:00
|
|
|
parent_id = ... # type: Column
|
|
|
|
parent = ... # type: relationship
|
2018-07-14 14:41:22 +00:00
|
|
|
closed = ... # type: Column
|
2018-08-03 16:15:08 +00:00
|
|
|
start_time = ... # type: Column
|
|
|
|
end_time = ... # type: Column
|
|
|
|
agent_id = ... # type: Column
|
2018-11-08 16:37:14 +00:00
|
|
|
severity = ... # type: Column
|
2018-08-03 16:15:08 +00:00
|
|
|
|
2018-11-08 16:37:14 +00:00
|
|
|
def __init__(self, **kwargs) -> None:
|
2019-05-08 17:12:05 +00:00
|
|
|
super().__init__(**kwargs)
|
2018-06-10 16:47:49 +00:00
|
|
|
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.closed = ... # type: bool
|
|
|
|
self.description = ... # type: str
|
2018-08-03 16:15:08 +00:00
|
|
|
self.start_time = ... # type: datetime
|
|
|
|
self.end_time = ... # type: datetime
|
2018-06-10 16:47:49 +00:00
|
|
|
self.snapshot = ... # type: Snapshot
|
|
|
|
self.components = ... # type: Set[Component]
|
2018-06-16 10:41:12 +00:00
|
|
|
self.parent = ... # type: Computer
|
2018-08-03 16:15:08 +00:00
|
|
|
self.agent = ... # type: Agent
|
|
|
|
self.author = ... # type: User
|
2018-11-08 16:37:14 +00:00
|
|
|
self.severity = ... # type: Severity
|
2018-06-10 16:47:49 +00:00
|
|
|
|
2018-10-05 15:13:23 +00:00
|
|
|
@property
|
|
|
|
def url(self) -> urlutils.URL:
|
|
|
|
pass
|
2018-06-10 16:47:49 +00:00
|
|
|
|
2019-01-29 15:29:08 +00:00
|
|
|
@property
|
|
|
|
def elapsed(self) -> timedelta:
|
|
|
|
pass
|
|
|
|
|
|
|
|
@property
|
|
|
|
def certificate(self) -> Optional[urlutils.URL]:
|
|
|
|
return None
|
|
|
|
|
|
|
|
@property
|
|
|
|
def date_str(self):
|
|
|
|
return '{:%c}'.format(self.end_time or self.created)
|
|
|
|
|
2018-10-08 08:37:32 +00:00
|
|
|
|
2019-05-11 14:27:22 +00:00
|
|
|
class ActionWithOneDevice(Action):
|
2018-11-08 16:37:14 +00:00
|
|
|
def __init__(self, **kwargs) -> None:
|
|
|
|
super().__init__(**kwargs)
|
2018-06-10 16:47:49 +00:00
|
|
|
self.device = ... # type: Device
|
|
|
|
|
|
|
|
|
2019-05-11 14:27:22 +00:00
|
|
|
class ActionWithMultipleDevices(Action):
|
2018-10-13 12:53:46 +00:00
|
|
|
devices = ... # type: relationship
|
2018-08-03 16:15:08 +00:00
|
|
|
|
2018-11-08 16:37:14 +00:00
|
|
|
def __init__(self, **kwargs) -> None:
|
|
|
|
super().__init__(**kwargs)
|
2018-06-10 16:47:49 +00:00
|
|
|
self.devices = ... # type: Set[Device]
|
|
|
|
|
|
|
|
|
2019-05-11 14:27:22 +00:00
|
|
|
class Add(ActionWithOneDevice):
|
2018-06-26 13:35:13 +00:00
|
|
|
pass
|
|
|
|
|
|
|
|
|
2019-05-11 14:27:22 +00:00
|
|
|
class Remove(ActionWithOneDevice):
|
2018-06-26 13:35:13 +00:00
|
|
|
pass
|
|
|
|
|
|
|
|
|
2018-06-10 16:47:49 +00:00
|
|
|
class Step(Model):
|
2018-11-08 16:37:14 +00:00
|
|
|
type = ... # type: Column
|
|
|
|
num = ... # type: Column
|
|
|
|
start_time = ... # type: Column
|
|
|
|
end_time = ... # type: Column
|
|
|
|
erasure = ... # type: relationship
|
|
|
|
severity = ... # type: Column
|
|
|
|
|
2018-08-03 16:15:08 +00:00
|
|
|
def __init__(self, num=None, success=None, start_time=None, end_time=None,
|
2018-11-08 16:37:14 +00:00
|
|
|
erasure=None, severity=None) -> None:
|
2018-06-10 16:47:49 +00:00
|
|
|
self.type = ... # type: str
|
|
|
|
self.num = ... # type: int
|
|
|
|
self.start_time = ... # type: datetime
|
|
|
|
self.end_time = ... # type: datetime
|
|
|
|
self.erasure = ... # type: EraseBasic
|
2018-11-08 16:37:14 +00:00
|
|
|
self.severity = ... # type: Severity
|
2018-06-10 16:47:49 +00:00
|
|
|
|
|
|
|
|
|
|
|
class StepZero(Step):
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
class StepRandom(Step):
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
2019-05-11 14:27:22 +00:00
|
|
|
class EraseBasic(ActionWithOneDevice):
|
2019-04-11 16:29:51 +00:00
|
|
|
def __init__(self, **kwargs) -> None:
|
|
|
|
super().__init__(**kwargs)
|
|
|
|
self.start_time = ... # type: datetime
|
|
|
|
self.end_time = ... # type: datetime
|
|
|
|
self.steps = ... # type: List[Step]
|
|
|
|
self.zeros = ... # type: bool
|
|
|
|
self.success = ... # type: bool
|
|
|
|
|
|
|
|
@property
|
|
|
|
def standards(self) -> Set[ErasureStandards]:
|
|
|
|
pass
|
|
|
|
|
|
|
|
@property
|
|
|
|
def certificate(self) -> urlutils.URL:
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
class EraseSectors(EraseBasic):
|
|
|
|
def __init__(self, **kwargs) -> None:
|
|
|
|
super().__init__(**kwargs)
|
|
|
|
|
|
|
|
|
|
|
|
class ErasePhysical(EraseBasic):
|
|
|
|
method = ... # type: Column
|
|
|
|
|
|
|
|
def __init__(self, **kwargs) -> None:
|
|
|
|
super().__init__(**kwargs)
|
|
|
|
self.method = ... # type: PhysicalErasureMethod
|
|
|
|
|
|
|
|
|
2019-05-11 14:27:22 +00:00
|
|
|
class Snapshot(ActionWithOneDevice):
|
2018-06-10 16:47:49 +00:00
|
|
|
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
|
2019-05-11 14:27:22 +00:00
|
|
|
self.actions = ... # type: Set[Action]
|
2018-06-10 16:47:49 +00:00
|
|
|
|
|
|
|
|
2019-05-11 14:27:22 +00:00
|
|
|
class Install(ActionWithOneDevice):
|
2018-11-26 12:11:07 +00:00
|
|
|
name = ... # type: Column
|
|
|
|
elapsed = ... # type: Column
|
|
|
|
address = ... # type: Column
|
|
|
|
|
2018-06-10 16:47:49 +00:00
|
|
|
def __init__(self, **kwargs) -> None:
|
|
|
|
super().__init__(**kwargs)
|
|
|
|
self.name = ... # type: str
|
|
|
|
self.elapsed = ... # type: timedelta
|
2018-11-26 12:11:07 +00:00
|
|
|
self.address = ... # type: Optional[int]
|
2018-06-10 16:47:49 +00:00
|
|
|
|
|
|
|
|
2019-05-08 17:12:05 +00:00
|
|
|
class SnapshotRequest(Model):
|
2018-06-10 16:47:49 +00:00
|
|
|
def __init__(self, **kwargs) -> None:
|
|
|
|
self.id = ... # type: UUID
|
|
|
|
self.request = ... # type: dict
|
|
|
|
self.snapshot = ... # type: Snapshot
|
|
|
|
|
|
|
|
|
2019-05-11 14:27:22 +00:00
|
|
|
class Benchmark(ActionWithOneDevice):
|
2019-04-11 16:29:51 +00:00
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
class BenchmarkDataStorage(Benchmark):
|
|
|
|
read_speed = ... # type: Column
|
|
|
|
write_speed = ... # type: Column
|
2018-06-14 13:14:23 +00:00
|
|
|
|
2018-06-10 16:47:49 +00:00
|
|
|
def __init__(self, **kwargs) -> None:
|
|
|
|
super().__init__(**kwargs)
|
2019-04-11 16:29:51 +00:00
|
|
|
self.read_speed = ... # type: float
|
|
|
|
self.write_speed = ... # type: float
|
|
|
|
|
2018-06-10 16:47:49 +00:00
|
|
|
|
2019-04-11 16:29:51 +00:00
|
|
|
class BenchmarkWithRate(Benchmark):
|
|
|
|
rate = ... # type: Column
|
2018-06-10 16:47:49 +00:00
|
|
|
|
|
|
|
def __init__(self, **kwargs) -> None:
|
|
|
|
super().__init__(**kwargs)
|
2019-04-11 16:29:51 +00:00
|
|
|
self.rate = ... # type: int
|
2018-06-10 16:47:49 +00:00
|
|
|
|
|
|
|
|
2019-04-11 16:29:51 +00:00
|
|
|
class BenchmarkProcessor(BenchmarkWithRate):
|
|
|
|
pass
|
2018-10-13 12:53:46 +00:00
|
|
|
|
2019-04-11 16:29:51 +00:00
|
|
|
|
|
|
|
class BenchmarkProcessorSysbench(BenchmarkProcessor):
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
class BenchmarkRamSysbench(BenchmarkWithRate):
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
class BenchmarkGraphicCard(BenchmarkWithRate):
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
2019-05-11 14:27:22 +00:00
|
|
|
class Test(ActionWithOneDevice):
|
2019-04-23 19:27:31 +00:00
|
|
|
elapsed = ... # type: Column
|
2019-05-08 17:12:05 +00:00
|
|
|
|
2018-06-10 16:47:49 +00:00
|
|
|
def __init__(self, **kwargs) -> None:
|
|
|
|
super().__init__(**kwargs)
|
2019-04-23 19:27:31 +00:00
|
|
|
self.elapsed = ... # type: Optional[timedelta]
|
2019-04-11 16:29:51 +00:00
|
|
|
self.success = ... # type: bool
|
2018-06-10 16:47:49 +00:00
|
|
|
|
2018-10-13 12:53:46 +00:00
|
|
|
|
2019-05-11 14:27:22 +00:00
|
|
|
class MeasureBattery(Test):
|
|
|
|
size = ... # type: Column
|
|
|
|
voltage = ... # type: Column
|
|
|
|
cycle_count = ... # type: Column
|
|
|
|
health = ... # type: Column
|
|
|
|
|
|
|
|
def __init__(self, **kwargs) -> None:
|
|
|
|
super().__init__(**kwargs)
|
|
|
|
self.size = ... # type: int
|
|
|
|
self.voltage = ... # type: int
|
|
|
|
self.cycle_count = ... # type: Optional[int]
|
|
|
|
self.health = ... # type: Optional[BatteryHealth]
|
|
|
|
|
|
|
|
|
2019-04-11 16:29:51 +00:00
|
|
|
class TestDataStorage(Test):
|
2019-05-08 17:12:05 +00:00
|
|
|
length = ... # type: Column
|
|
|
|
status = ... # type: Column
|
|
|
|
lifetime = ... # type: Column
|
|
|
|
first_error = ... # type: Column
|
|
|
|
passed_lifetime = ... # type: Column
|
|
|
|
assessment = ... # type: Column
|
|
|
|
reallocated_sector_count = ... # type: Column
|
|
|
|
power_cycle_count = ... # type: Column
|
|
|
|
reported_uncorrectable_errors = ... # type: Column
|
|
|
|
command_timeout = ... # type: Column
|
|
|
|
current_pending_sector_count = ... # type: Column
|
|
|
|
offline_uncorrectable = ... # type: Column
|
|
|
|
remaining_lifetime_percentage = ... # type: Column
|
|
|
|
|
2019-04-11 16:29:51 +00:00
|
|
|
def __init__(self, **kwargs) -> None:
|
|
|
|
super().__init__(**kwargs)
|
|
|
|
self.id = ... # type: UUID
|
|
|
|
self.length = ... # type: TestDataStorageLength
|
|
|
|
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
|
2018-10-13 12:53:46 +00:00
|
|
|
|
|
|
|
|
2019-04-11 16:29:51 +00:00
|
|
|
class StressTest(Test):
|
|
|
|
pass
|
2018-10-13 12:53:46 +00:00
|
|
|
|
|
|
|
|
2019-04-11 16:29:51 +00:00
|
|
|
class TestAudio(Test):
|
|
|
|
"""
|
|
|
|
Test to check all this aspects related with audio functions, Manual Tests??
|
|
|
|
"""
|
2019-05-08 17:12:05 +00:00
|
|
|
_speaker = ... # type: Column
|
|
|
|
_microphone = ... # type: Column
|
2018-10-15 12:20:26 +00:00
|
|
|
|
2019-05-08 17:12:05 +00:00
|
|
|
def __init__(self, **kwargs) -> None:
|
|
|
|
super().__init__(**kwargs)
|
|
|
|
self.speaker = ... # type: bool
|
|
|
|
self.microphone = ... # type: bool
|
2018-10-15 12:20:26 +00:00
|
|
|
|
|
|
|
|
2019-05-08 17:12:05 +00:00
|
|
|
class TestConnectivity(Test):
|
|
|
|
pass
|
2018-10-13 12:53:46 +00:00
|
|
|
|
2018-06-10 16:47:49 +00:00
|
|
|
|
2019-04-11 16:29:51 +00:00
|
|
|
class TestCamera(Test):
|
2019-05-08 17:12:05 +00:00
|
|
|
pass
|
2018-10-14 09:37:10 +00:00
|
|
|
|
2018-06-20 21:18:15 +00:00
|
|
|
|
2019-04-11 16:29:51 +00:00
|
|
|
class TestKeyboard(Test):
|
2019-05-08 17:12:05 +00:00
|
|
|
pass
|
2018-11-17 18:22:41 +00:00
|
|
|
|
2018-06-20 21:18:15 +00:00
|
|
|
|
2019-04-11 16:29:51 +00:00
|
|
|
class TestTrackpad(Test):
|
2019-05-08 17:12:05 +00:00
|
|
|
pass
|
2018-10-14 09:37:10 +00:00
|
|
|
|
2018-06-20 21:18:15 +00:00
|
|
|
|
2019-04-11 16:29:51 +00:00
|
|
|
class TestBios(Test):
|
|
|
|
bios_power_on = ... # type: Column
|
2019-05-08 17:12:05 +00:00
|
|
|
access_range = ... # type: Column
|
2018-10-16 06:46:55 +00:00
|
|
|
|
2019-04-11 16:29:51 +00:00
|
|
|
|
2019-05-08 17:12:05 +00:00
|
|
|
class VisualTest(Test):
|
2019-05-10 09:58:38 +00:00
|
|
|
appearance_range = ... # type: Column
|
|
|
|
functionality_range = ... # type: Column
|
2019-04-30 00:02:23 +00:00
|
|
|
labelling = ... # type: Column
|
2019-04-11 16:29:51 +00:00
|
|
|
|
2019-05-10 09:58:38 +00:00
|
|
|
def __init__(self, **kwargs) -> None:
|
|
|
|
super().__init__(**kwargs)
|
2019-05-11 14:27:22 +00:00
|
|
|
self.appearance_range = ... # type: AppearanceRange
|
|
|
|
self.functionality_range = ... # type: FunctionalityRange
|
|
|
|
self.labelling = ... # type: Optional[bool]
|
2019-05-10 09:58:38 +00:00
|
|
|
|
2019-04-11 16:29:51 +00:00
|
|
|
|
2019-05-11 14:27:22 +00:00
|
|
|
class Rate(ActionWithOneDevice):
|
2019-05-08 17:12:05 +00:00
|
|
|
N = 2
|
|
|
|
_rating = ... # type: Column
|
|
|
|
_appearance = ... # type: Column
|
|
|
|
_functionality = ... # type: Column
|
2019-04-11 16:29:51 +00:00
|
|
|
version = ... # type: Column
|
|
|
|
|
|
|
|
def __init__(self, **kwargs) -> None:
|
|
|
|
super().__init__(**kwargs)
|
|
|
|
self.rating = ... # type: float
|
|
|
|
self.version = ... # type: StrictVersion
|
|
|
|
self.appearance = ... # type: float
|
|
|
|
self.functionality = ... # type: float
|
2019-05-08 17:12:05 +00:00
|
|
|
|
|
|
|
@property
|
|
|
|
def rating_range(self) -> RatingRange:
|
|
|
|
pass
|
2019-04-11 16:29:51 +00:00
|
|
|
|
|
|
|
|
|
|
|
class RateComputer(Rate):
|
2019-05-08 17:12:05 +00:00
|
|
|
_processor = ... # type: Column
|
|
|
|
_ram = ... # type: Column
|
|
|
|
_data_storage = ... # type: Column
|
|
|
|
_graphic_card = ... # type: Column
|
|
|
|
|
|
|
|
def __init__(self, **kwargs) -> None:
|
|
|
|
super().__init__(**kwargs)
|
2019-05-10 09:58:38 +00:00
|
|
|
self.processor = ... # type: Optional[float]
|
|
|
|
self.ram = ... # type: Optional[float]
|
|
|
|
self.data_storage = ... # type: Optional[float]
|
|
|
|
self.graphic_card = ... # type: Optional[float]
|
2018-10-16 06:46:55 +00:00
|
|
|
|
2019-04-23 19:27:31 +00:00
|
|
|
@classmethod
|
2019-05-08 17:12:05 +00:00
|
|
|
def compute(cls, device: Device) -> Tuple[RateComputer, EreusePrice]:
|
|
|
|
pass
|
|
|
|
|
|
|
|
@property
|
|
|
|
def data_storage_range(self) -> Optional[RatingRange]:
|
|
|
|
pass
|
|
|
|
|
|
|
|
@property
|
|
|
|
def ram_range(self) -> Optional[RatingRange]:
|
|
|
|
pass
|
|
|
|
|
|
|
|
@property
|
|
|
|
def processor_range(self) -> Optional[RatingRange]:
|
|
|
|
pass
|
|
|
|
|
|
|
|
@property
|
|
|
|
def graphic_card_range(self) -> Optional[RatingRange]:
|
2019-04-23 19:27:31 +00:00
|
|
|
pass
|
|
|
|
|
2018-06-10 16:47:49 +00:00
|
|
|
|
2019-05-11 14:27:22 +00:00
|
|
|
class Price(ActionWithOneDevice):
|
2018-10-15 09:21:21 +00:00
|
|
|
SCALE = ...
|
|
|
|
ROUND = ...
|
2018-07-14 14:41:22 +00:00
|
|
|
currency = ... # type: Column
|
|
|
|
price = ... # type: Column
|
|
|
|
software = ... # type: Column
|
|
|
|
version = ... # type: Column
|
|
|
|
rating_id = ... # type: Column
|
|
|
|
rating = ... # type: relationship
|
|
|
|
|
|
|
|
def __init__(self, **kwargs) -> None:
|
|
|
|
super().__init__(**kwargs)
|
2018-08-03 16:15:08 +00:00
|
|
|
self.price = ... # type: Decimal
|
2018-07-14 14:41:22 +00:00
|
|
|
self.currency = ... # type: Currency
|
|
|
|
self.software = ... # type: PriceSoftware
|
|
|
|
self.version = ... # type: StrictVersion
|
2019-04-23 19:27:31 +00:00
|
|
|
self.rating = ... # type: Rate
|
2018-07-14 14:41:22 +00:00
|
|
|
|
2018-10-15 09:21:21 +00:00
|
|
|
@classmethod
|
|
|
|
def to_price(cls, value: Union[Decimal, float], rounding=ROUND) -> Decimal:
|
|
|
|
pass
|
|
|
|
|
2018-07-14 14:41:22 +00:00
|
|
|
|
|
|
|
class EreusePrice(Price):
|
|
|
|
MULTIPLIER = ... # type: Dict
|
|
|
|
|
2018-10-13 12:53:46 +00:00
|
|
|
class Type:
|
2018-10-14 21:56:54 +00:00
|
|
|
def __init__(self, percentage, price) -> None:
|
2018-10-13 12:53:46 +00:00
|
|
|
super().__init__()
|
|
|
|
self.amount = ... # type: float
|
|
|
|
self.percentage = ... # type: float
|
|
|
|
|
|
|
|
class Service:
|
|
|
|
def __init__(self) -> None:
|
|
|
|
super().__init__()
|
|
|
|
self.standard = ... # type: EreusePrice.Type
|
|
|
|
self.warranty2 = ... # type: EreusePrice.Type
|
|
|
|
|
2019-04-23 19:27:31 +00:00
|
|
|
def __init__(self, rating: Rate, **kwargs) -> None:
|
2018-07-14 14:41:22 +00:00
|
|
|
super().__init__(**kwargs)
|
2018-10-13 12:53:46 +00:00
|
|
|
self.retailer = ... # type: EreusePrice.Service
|
|
|
|
self.platform = ... # type: EreusePrice.Service
|
|
|
|
self.refurbisher = ... # type: EreusePrice.Service
|
|
|
|
self.warranty2 = ... # type: float
|
2018-07-14 14:41:22 +00:00
|
|
|
|
|
|
|
|
2019-05-11 14:27:22 +00:00
|
|
|
class ToRepair(ActionWithMultipleDevices):
|
2018-07-22 20:42:49 +00:00
|
|
|
pass
|
|
|
|
|
|
|
|
|
2019-05-11 14:27:22 +00:00
|
|
|
class Repair(ActionWithMultipleDevices):
|
2018-07-22 20:42:49 +00:00
|
|
|
pass
|
|
|
|
|
|
|
|
|
2019-07-07 19:36:09 +00:00
|
|
|
class Ready(ActionWithMultipleDevices):
|
2018-08-03 16:15:08 +00:00
|
|
|
pass
|
|
|
|
|
|
|
|
|
2019-05-11 14:27:22 +00:00
|
|
|
class ToPrepare(ActionWithMultipleDevices):
|
2018-07-22 20:42:49 +00:00
|
|
|
pass
|
|
|
|
|
|
|
|
|
2019-05-11 14:27:22 +00:00
|
|
|
class Prepare(ActionWithMultipleDevices):
|
2018-07-22 20:42:49 +00:00
|
|
|
pass
|
|
|
|
|
|
|
|
|
2019-05-11 14:27:22 +00:00
|
|
|
class Live(ActionWithOneDevice):
|
2018-08-03 16:15:08 +00:00
|
|
|
ip = ... # type: Column
|
|
|
|
subdivision_confidence = ... # type: Column
|
|
|
|
subdivision = ... # type: Column
|
|
|
|
city = ... # type: Column
|
|
|
|
city_confidence = ... # type: Column
|
|
|
|
isp = ... # type: Column
|
|
|
|
organization = ... # type: Column
|
|
|
|
organization_type = ... # type: Column
|
|
|
|
|
|
|
|
def __init__(self, **kwargs) -> None:
|
|
|
|
super().__init__(**kwargs)
|
|
|
|
self.ip = ... # type: Union[ipaddress.IPv4Address, ipaddress.IPv6Address]
|
|
|
|
self.subdivision_confidence = ... # type: int
|
|
|
|
self.subdivision = ... # type: enums.Subdivision
|
|
|
|
self.city = ... # type: str
|
|
|
|
self.city_confidence = ... # type: int
|
|
|
|
self.isp = ... # type: str
|
|
|
|
self.organization = ... # type: str
|
|
|
|
self.organization_type = ... # type: str
|
|
|
|
self.country = ... # type: Country
|
|
|
|
|
|
|
|
|
2019-05-11 14:27:22 +00:00
|
|
|
class Organize(ActionWithMultipleDevices):
|
2018-08-03 16:15:08 +00:00
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
class Reserve(Organize):
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
2019-05-11 14:27:22 +00:00
|
|
|
class Trade(ActionWithMultipleDevices):
|
2018-08-03 16:15:08 +00:00
|
|
|
shipping_date = ... # type: Column
|
|
|
|
invoice_number = ... # type: Column
|
|
|
|
price = ... # type: relationship
|
|
|
|
to = ... # type: relationship
|
|
|
|
confirms = ... # type: relationship
|
|
|
|
|
|
|
|
def __init__(self, **kwargs) -> None:
|
|
|
|
super().__init__(**kwargs)
|
|
|
|
self.shipping_date = ... # type: datetime
|
|
|
|
self.invoice_number = ... # type: str
|
|
|
|
self.price = ... # type: Price
|
|
|
|
self.to = ... # type: Agent
|
|
|
|
self.confirms = ... # type: Organize
|
|
|
|
|
|
|
|
|
2019-12-12 20:17:35 +00:00
|
|
|
class InitTransfer(Trade):
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
2018-08-03 16:15:08 +00:00
|
|
|
class Sell(Trade):
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
class Donate(Trade):
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
class Rent(Trade):
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
2019-07-07 19:36:09 +00:00
|
|
|
class MakeAvailable(ActionWithMultipleDevices):
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
2018-08-03 16:15:08 +00:00
|
|
|
class CancelTrade(Trade):
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
class ToDisposeProduct(Trade):
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
class DisposeProduct(Trade):
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
2019-12-21 15:41:23 +00:00
|
|
|
class TransferOwnershipBlockchain(Trade):
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
2019-05-11 14:27:22 +00:00
|
|
|
class Receive(ActionWithMultipleDevices):
|
2018-08-03 16:15:08 +00:00
|
|
|
role = ... # type:Column
|
|
|
|
|
|
|
|
def __init__(self, **kwargs) -> None:
|
|
|
|
super().__init__(**kwargs)
|
|
|
|
self.role = ... # type: ReceiverRole
|
|
|
|
|
|
|
|
|
2019-12-09 16:24:24 +00:00
|
|
|
class ShareDeliveryNote(ActionWithMultipleDevices):
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
2019-05-11 14:27:22 +00:00
|
|
|
class Migrate(ActionWithMultipleDevices):
|
2018-08-03 16:15:08 +00:00
|
|
|
other = ... # type: Column
|
|
|
|
|
|
|
|
def __init__(self, **kwargs) -> None:
|
|
|
|
super().__init__(**kwargs)
|
|
|
|
self.other = ... # type: URL
|
|
|
|
|
|
|
|
|
|
|
|
class MigrateTo(Migrate):
|
2018-07-22 20:42:49 +00:00
|
|
|
pass
|
|
|
|
|
|
|
|
|
2018-08-03 16:15:08 +00:00
|
|
|
class MigrateFrom(Migrate):
|
2018-07-22 20:42:49 +00:00
|
|
|
pass
|
2019-12-23 12:31:54 +00:00
|
|
|
|
|
|
|
class Transferred(ActionWithMultipleDevices):
|
|
|
|
pass
|