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

39 statements  

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

1from typing import List, Optional 

2from pydantic import BaseModel, RootModel, Field, NaiveDatetime 

3 

4 

5class BuildingRecipeIO(BaseModel): 

6 CommodityName: str 

7 CommodityTicker: str = Field(max_length=3) 

8 Weight: float 

9 Volume: float 

10 Amount: int 

11 

12 

13class BuildingRecipe(BaseModel): 

14 Inputs: List[BuildingRecipeIO] 

15 Outputs: List[BuildingRecipeIO] 

16 

17 BuildingRecipeId: str 

18 RecipeName: str 

19 StandardRecipeName: str 

20 

21 DurationMs: int 

22 

23 

24class BuildingCost(BaseModel): 

25 CommodityName: str 

26 CommodityTicker: str = Field(max_length=3) 

27 Weight: float 

28 Volume: float 

29 Amount: int 

30 

31 

32class BuildingTicker(BaseModel): 

33 Recipes: Optional[List[BuildingRecipe]] 

34 BuildingId: str = Field(min_length=32) 

35 Name: str 

36 Ticker: str = Field(max_length=3) 

37 Expertise: Optional[str] 

38 Pioneers: int 

39 Settlers: int 

40 Technicians: int 

41 Engineers: int 

42 Scientists: int 

43 AreaCost: int 

44 UserNameSubmitted: str 

45 Timestamp: NaiveDatetime 

46 

47 

48class BuildingTickerList(RootModel): 

49 root: List[BuildingTicker] 

50 

51 def __iter__(self): 

52 return iter(self.root)