You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
424 B

  1. from typing import List
  2. from pydantic import BaseModel, NonNegativeInt
  3. class Workload(BaseModel):
  4. weight: NonNegativeInt
  5. member_id: int
  6. class WorkloadAllocation(BaseModel):
  7. workloads: List[Workload]
  8. @property
  9. def member_ids(self) -> List[int]:
  10. return [w.member_id for w in self.workloads]
  11. @property
  12. def weights(self) -> List[int]:
  13. return [w.weight for w in self.workloads]