Coverage for fio_wrapper/models/storage_models.py: 100%

32 statements  

« prev     ^ index     » next       coverage.py v7.3.2, created at 2023-11-16 11:50 +0100

1from typing import List, Optional 

2from datetime import datetime 

3from pydantic import BaseModel, RootModel, Field, NaiveDatetime 

4 

5 

6class StorageItem(BaseModel): 

7 MaterialId: str = Field(min_length=32) 

8 MaterialName: Optional[str] 

9 MaterialTicker: Optional[str] = Field(max_length=3, default=None) 

10 MaterialCategory: Optional[str] = Field(min_length=32, default=None) 

11 MaterialWeight: float 

12 MaterialVolume: float 

13 MaterialAmount: int 

14 MaterialValue: float 

15 MaterialValueCurrency: Optional[str] 

16 Type: str 

17 TotalWeight: float 

18 TotalVolume: float 

19 

20 

21class Storage(BaseModel): 

22 StorageItems: Optional[List[StorageItem]] 

23 StorageId: str = Field(min_length=32) 

24 AddressableId: str = Field(min_length=32) 

25 Name: Optional[str] 

26 Type: str 

27 UserNameSubmitted: str 

28 Timestamp: datetime 

29 WeightCapacity: int 

30 VolumeCapacity: int 

31 UserNameSubmitted: str 

32 Timestamp: NaiveDatetime 

33 

34 

35class StorageList(RootModel): 

36 root: List[Storage] 

37 

38 def __iter__(self): 

39 return iter(self.root)