🎨 Rename list attribute in CalculatorArtifactResult

The `list` attribute in the `CalculatorArtifactResult` class was renamed to `consumable_list`. This was done to avoid confusion and potential issues with the use of `list`, which is a built-in name in Python.
This commit is contained in:
洛水居室 2023-07-18 22:11:43 +08:00
parent d0f7ec35c3
commit cc06be92fb
No known key found for this signature in database
GPG Key ID: C9DE87DA724B88FC

View File

@ -315,12 +315,12 @@ class CalculatorArtifactResult(APIModel):
Attributes:
artifact_id (int): The ID of the artifact.
list (List[CalculatorConsumable]): A list of CalculatorConsumable objects representing the consumables
used by this artifact.
consumable_list (List[CalculatorConsumable]): A list of CalculatorConsumable objects representing the
consumables used by this artifact.
"""
artifact_id: int = Field(alias="reliquary_id")
list: List[CalculatorConsumable] = Field(alias="id_consume_list")
consumable_list: List[CalculatorConsumable] = Field(alias="id_consume_list")
class CalculatorResult(APIModel):
@ -347,7 +347,7 @@ class CalculatorResult(APIModel):
List[CalculatorConsumable]: A list of CalculatorConsumable objects representing the total
consumables used across all categories.
"""
artifacts = [i for a in self.artifacts for i in a.list]
artifacts = [i for a in self.artifacts for i in a.consumable_list]
combined = self.character + self.weapon + self.talents + artifacts
grouped: Dict[int, List[CalculatorConsumable]] = collections.defaultdict(list)