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
« 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
5class RecipeIO(BaseModel):
6 Ticker: str = Field(max_length=3)
7 Amount: int
10class Recipe(BaseModel):
11 Inputs: List[RecipeIO]
12 Outputs: List[RecipeIO]
14 BuildingTicker: str
15 RecipeName: str
16 StandardRecipeName: str
18 TimeMs: int
21class RecipeList(RootModel):
22 root: List[Recipe]
24 def __iter__(self):
25 return iter(self.root)
28class MaterialRecipeIO(BaseModel):
29 CommodityName: str
30 CommodityTicker: str = Field(max_length=3)
31 Weight: float
32 Volume: float
33 Amount: int
36class MaterialRecipe(BaseModel):
37 BuildingTicker: str = Field(max_length=3)
38 BuildingRecipeId: Optional[str]
40 Inputs: List[MaterialRecipeIO]
41 Outputs: List[MaterialRecipeIO]
44class MaterialRecipeList(RootModel):
45 root: List[MaterialRecipe]
47 def __iter__(self):
48 return iter(self.root)