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/device/models.pyi

213 lines
5.5 KiB
Python
Raw Normal View History

2018-06-10 16:47:49 +00:00
from typing import Dict, List, Set
from colour import Color
2018-06-20 21:18:15 +00:00
from sqlalchemy import Column, Integer
from sqlalchemy.orm import relationship
2018-06-10 16:47:49 +00:00
2018-06-26 13:35:13 +00:00
from ereuse_devicehub.resources.enums import ComputerChassis, DataStorageInterface, DisplayTech, \
2018-06-20 21:18:15 +00:00
RamFormat, RamInterface
2018-06-10 16:47:49 +00:00
from ereuse_devicehub.resources.event.models import Event, EventWithMultipleDevices, \
EventWithOneDevice
from ereuse_devicehub.resources.image.models import ImageList
from ereuse_devicehub.resources.lot.models import Lot
2018-06-10 16:47:49 +00:00
from ereuse_devicehub.resources.models import Thing
from ereuse_devicehub.resources.tag import Tag
class Device(Thing):
id = ... # type: Column
type = ... # type: Column
hid = ... # type: Column
model = ... # type: Column
manufacturer = ... # type: Column
serial_number = ... # type: Column
weight = ... # type: Column
width = ... # type: Column
height = ... # type: Column
depth = ... # type: Column
color = ... # type: Column
2018-09-07 10:38:02 +00:00
parents = ... # type: relationship
2018-06-10 16:47:49 +00:00
def __init__(self, **kwargs) -> None:
super().__init__(**kwargs)
self.id = ... # type: int
self.type = ... # type: str
self.hid = ... # type: str
self.model = ... # type: str
self.manufacturer = ... # type: str
self.serial_number = ... # type: str
self.weight = ... # type: float
self.width = ... # type:float
self.height = ... # type: float
self.depth = ... # type: float
self.color = ... # type: Color
self.events = ... # type: List[Event]
self.physical_properties = ... # type: Dict[str, object or None]
self.events_multiple = ... # type: Set[EventWithMultipleDevices]
self.events_one = ... # type: Set[EventWithOneDevice]
self.images = ... # type: ImageList
self.tags = ... # type: Set[Tag]
2018-09-07 10:38:02 +00:00
self.parents = ... # type: Set[Lot]
2018-06-10 16:47:49 +00:00
2018-06-26 13:35:13 +00:00
class DisplayMixin:
technology = ... # type: Column
size = ... # type: Column
resolution_width = ... # type: Column
resolution_height = ... # type: Column
def __init__(self) -> None:
super().__init__()
self.technology = ... # type: DisplayTech
self.size = ... # type: Integer
self.resolution_width = ... # type: int
self.resolution_height = ... # type: int
class Computer(DisplayMixin, Device):
components = ... # type: Column
chassis = ... # type: Column
2018-06-10 16:47:49 +00:00
def __init__(self, **kwargs) -> None:
super().__init__(**kwargs)
self.components = ... # type: Set[Component]
self.events_parent = ... # type: Set[Event]
2018-06-26 13:36:21 +00:00
self.chassis = ... # type: ComputerChassis
2018-06-10 16:47:49 +00:00
class Desktop(Computer):
pass
2018-06-26 13:36:21 +00:00
class Laptop(Computer):
2018-06-26 13:35:13 +00:00
pass
2018-06-26 13:36:21 +00:00
class Server(Computer):
2018-06-10 16:47:49 +00:00
pass
2018-06-26 13:36:21 +00:00
class Monitor(DisplayMixin, Device):
2018-06-10 16:47:49 +00:00
pass
2018-06-26 13:36:21 +00:00
class ComputerMonitor(Monitor):
2018-06-10 16:47:49 +00:00
pass
2018-06-26 13:36:21 +00:00
class TelevisionSet(Monitor):
2018-06-10 16:47:49 +00:00
pass
2018-06-26 13:36:21 +00:00
class Mobile(Device):
imei = ... # type: Column
meid = ... # type: Column
2018-06-20 21:18:15 +00:00
def __init__(self, **kwargs) -> None:
super().__init__(**kwargs)
2018-06-26 13:36:21 +00:00
self.imei = ... # type: int
self.meid = ... # type: str
class Smartphone(Mobile):
pass
class Tablet(Mobile):
pass
class Cellphone(Mobile):
pass
2018-06-20 21:18:15 +00:00
2018-06-10 16:47:49 +00:00
class Component(Device):
def __init__(self, **kwargs) -> None:
super().__init__(**kwargs)
self.parent_id = ... # type: int
self.parent = ... # type: Computer
self.events_components = ... # type: Set[Event]
def similar_one(self, parent: Computer, blacklist: Set[int]) -> 'Component':
pass
class GraphicCard(Component):
memory = ... # type: Column
def __init__(self, **kwargs) -> None:
super().__init__(**kwargs)
self.memory = ... # type: int
class DataStorage(Component):
size = ... # type: Column
interface = ... # type: Column
2018-06-10 16:47:49 +00:00
def __init__(self, **kwargs) -> None:
super().__init__(**kwargs)
self.size = ... # type: int
self.interface = ... # type: DataStorageInterface
2018-06-10 16:47:49 +00:00
class HardDrive(DataStorage):
pass
class SolidStateDrive(DataStorage):
pass
class Motherboard(Component):
slots = ... # type: Column
usb = ... # type: Column
firewire = ... # type: Column
serial = ... # type: Column
pcmcia = ... # type: Column
def __init__(self, **kwargs) -> None:
super().__init__(**kwargs)
self.slots = ... # type: int
self.usb = ... # type: int
self.firewire = ... # type: int
self.serial = ... # type: int
self.pcmcia = ... # type: int
class NetworkAdapter(Component):
speed = ... # type: Column
def __init__(self, **kwargs) -> None:
super().__init__(**kwargs)
self.speed = ... # type: int
class Processor(Component):
speed = ... # type: Column
cores = ... # type: Column
address = ... # type: Column
def __init__(self, **kwargs) -> None:
super().__init__(**kwargs)
self.speed = ... # type: float
self.cores = ... # type: int
self.address = ... # type: int
class RamModule(Component):
size = ... # type: Column
speed = ... # type: Column
interface = ... # type: Column
format = ... # type: Column
2018-06-10 16:47:49 +00:00
def __init__(self, **kwargs) -> None:
super().__init__(**kwargs)
self.size = ... # type: int
self.speed = ... # type: float
self.interface = ... # type: RamInterface
self.format = ... # type: RamFormat
2018-06-26 13:36:21 +00:00
class Display(DisplayMixin, Component):
pass