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

31 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 

3 

4 

5class RecipeIO(BaseModel): 

6 Ticker: str = Field(max_length=3) 

7 Amount: int 

8 

9 

10class Recipe(BaseModel): 

11 Inputs: List[RecipeIO] 

12 Outputs: List[RecipeIO] 

13 

14 BuildingTicker: str 

15 RecipeName: str 

16 StandardRecipeName: str 

17 

18 TimeMs: int 

19 

20 

21class RecipeList(RootModel): 

22 root: List[Recipe] 

23 

24 def __iter__(self): 

25 return iter(self.root) 

26 

27 

28class MaterialRecipeIO(BaseModel): 

29 CommodityName: str 

30 CommodityTicker: str = Field(max_length=3) 

31 Weight: float 

32 Volume: float 

33 Amount: int 

34 

35 

36class MaterialRecipe(BaseModel): 

37 BuildingTicker: str = Field(max_length=3) 

38 BuildingRecipeId: Optional[str] 

39 

40 Inputs: List[MaterialRecipeIO] 

41 Outputs: List[MaterialRecipeIO] 

42 

43 

44class MaterialRecipeList(RootModel): 

45 root: List[MaterialRecipe] 

46 

47 def __iter__(self): 

48 return iter(self.root)