-
Notifications
You must be signed in to change notification settings - Fork 32
Expand file tree
/
Copy pathprojects.py
More file actions
30 lines (24 loc) · 861 Bytes
/
projects.py
File metadata and controls
30 lines (24 loc) · 861 Bytes
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
class Project:
"""Project class, containing Project information."""
def __init__(self, json, client):
self._json = json
self.name = json["name"]
self.type = json["type"]
self._client = client
self.params = None
self.version = None
self.instruction = None
if len(json["param_history"]):
self.params = json["param_history"][-1]
self.version = self.params["version"]
if "instruction" in self.params:
self.instruction = self.params["instruction"]
def __hash__(self):
return hash(self.name)
def __str__(self):
return f"Project(name={self.name})"
def __repr__(self):
return f"Project({self._json})"
def as_dict(self):
"""Returns all attributes as a dictionary"""
return self._json