-
Notifications
You must be signed in to change notification settings - Fork 32
Expand file tree
/
Copy pathstudio.py
More file actions
116 lines (85 loc) · 2.92 KB
/
studio.py
File metadata and controls
116 lines (85 loc) · 2.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
from enum import Enum
class StudioLabelerAssignment:
"""Labeler Assignment class, contains information about
assignments for labelers."""
def __init__(self, assigned_projects, email, client):
self._json = assigned_projects
self._client = client
self.email = email
self.assigned_projects = assigned_projects
def __hash__(self):
return hash(self.email)
def __str__(self):
return (
f"StudioLabelerAssignment(email={self.email},"
f"assigned_projects={self.assigned_projects})"
)
def __repr__(self):
return f"StudioLabelerAssignment({self._json})"
def as_dict(self):
"""Returns all attributes as a dictionary"""
return self._json
class StudioWorker:
"""Worker object that is returned in the 'workers' array."""
def __init__(self, json, client):
self._json = json
self._client = client
self.id = json["id"]
self.email = json["email"]
def __hash__(self):
return hash(self.id)
def __str__(self):
return f"StudioWorker(id={self.email})"
def __repr__(self):
return f"StudioWorker({self._json})"
def as_dict(self):
"""Returns all attributes as a dictionary"""
return self._json
class StudioProjectGroup:
"""Studio project group."""
def __init__(self, json, client):
self._json = json
self._client = client
self.id = json["id"]
self.name = json["name"]
self.numWorkers = json["numWorkers"]
self.isSingleton = json["isSingleton"]
if json.get("workers"):
self.workers = ([StudioWorker(w, client) for w in json["workers"]],)
else:
self.workers = []
def __hash__(self):
return hash(self.id)
def __str__(self):
return f"StudioProjectGroup(name={self.name})"
def __repr__(self):
return f"StudioProjectGroup({self._json})"
def as_dict(self):
"""Returns all attributes as a dictionary"""
return self._json
class StudioBatchStatus(Enum):
"""Studio Batch Statuses"""
Production = "Production"
class StudioBatch:
"""Studio Batch"""
def __init__(self, json, client):
self._json = json
self._client = client
self.id = json["id"]
self.name = json["name"]
self.project_id = json["projectId"]
self.project_name = json["projectName"]
self.batch_type = json["batchType"]
self.studio_priority = json.get("studioPriority")
self.total = json["total"]
self.completed = json["completed"]
self.groups = json["groups"]
def __hash__(self):
return hash(self.id)
def __str__(self):
return f"StudioBatch(name={self.name})"
def __repr__(self):
return f"StudioBatch({self._json})"
def as_dict(self):
"""Returns all attributes as a dictionary"""
return self._json