Skip to content
This repository was archived by the owner on Mar 30, 2023. It is now read-only.

Commit 6271d51

Browse files
author
Jason Costello
committed
Adding .refresh() methods to each resource type
1 parent 4b56419 commit 6271d51

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

hypervector/resources/core/benchmark.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ def to_response(self):
3131
def from_get(cls, response):
3232
return cls.from_response(response.json())
3333

34+
def refresh(self):
35+
benchmark = self.get(self.benchmark_uuid)
36+
self.__dict__.update(benchmark.__dict__)
37+
3438
@classmethod
3539
def list(cls, ensemble):
3640
parent_endpoint = f"{hypervector.API_BASE}/definition/{ensemble.definition_uuid}" \

hypervector/resources/core/ensemble.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ def to_response(self):
4646
def from_get(cls, response):
4747
return cls.from_response(response.json())
4848

49+
def refresh(self):
50+
ensemble = self.get(self.ensemble_uuid)
51+
self.__dict__.update(ensemble.__dict__)
52+
4953
@classmethod
5054
def list(cls, definition):
5155
parent_endpoint = f"{hypervector.API_BASE}/definition/{definition.definition_uuid}"

hypervector/resources/core/project.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ def to_response(self):
3333
def from_get(cls, response):
3434
return cls.from_response(response.json())
3535

36+
def refresh(self):
37+
project = self.get(self.project_uuid)
38+
self.__dict__.update(project.__dict__)
39+
3640
@classmethod
3741
def list(cls):
3842
endpoint = f"{hypervector.API_BASE}/projects"

0 commit comments

Comments
 (0)