Skip to content

Commit

Permalink
Added generic url attribute to base class
Browse files Browse the repository at this point in the history
  • Loading branch information
rgerkin committed May 4, 2018
1 parent eb877fa commit 122bcc2
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions sciunit/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ def __init__(self):
self.unpicklable = [] # Attributes that cannot or should not be pickled.

unpicklable = []
_url = None

def __getstate__(self):
# Copy the object's state from self.__dict__ which contains
Expand Down Expand Up @@ -186,6 +187,10 @@ def _class(self):
def id(self):
return str(self.json)

@property
def url(self):
return self._url if self._url else self.remote_url


class SciUnitEncoder(json.JSONEncoder):
"""Custom JSON encoder for SciUnit objects"""
Expand Down

0 comments on commit 122bcc2

Please sign in to comment.