mirror of https://github.com/doccano/doccano.git
pythondatasetsactive-learningtext-annotationdatasetnatural-language-processingdata-labelingmachine-learningannotation-tool
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
20 lines
424 B
from typing import List
|
|
|
|
from pydantic import BaseModel, NonNegativeInt
|
|
|
|
|
|
class Workload(BaseModel):
|
|
weight: NonNegativeInt
|
|
member_id: int
|
|
|
|
|
|
class WorkloadAllocation(BaseModel):
|
|
workloads: List[Workload]
|
|
|
|
@property
|
|
def member_ids(self) -> List[int]:
|
|
return [w.member_id for w in self.workloads]
|
|
|
|
@property
|
|
def weights(self) -> List[int]:
|
|
return [w.weight for w in self.workloads]
|