Last change
on this file since 65 was 59, checked in by Wouter Pasman, 3 years ago |
#44 manual commit of first public release, because this will cause the dist directory to move
|
File size:
988 bytes
|
Rev | Line | |
---|
[59] | 1 | from pyson.JsonGetter import JsonGetter
|
---|
| 2 | from pyson.JsonValue import JsonValue
|
---|
| 3 | from uri import URI # type: ignore
|
---|
| 4 |
|
---|
| 5 | from geniusweb.references.Reference import Reference
|
---|
| 6 |
|
---|
| 7 |
|
---|
| 8 | class ProtocolRef (Reference):
|
---|
| 9 | '''
|
---|
| 10 | A URI reference to get a copy of a profile. This usually is a "ws://"
|
---|
| 11 | (websocket) URI, allowing users (parties) to get notifications if the profile
|
---|
| 12 | is changed.
|
---|
| 13 | <p>
|
---|
| 14 | In debugging scenarios, this is usually a "file://" URI, in which case the
|
---|
| 15 | profile is assumed to be static during the run. Parties that support
|
---|
| 16 | debugging eg with the simplerunner should support the file: protocol.
|
---|
| 17 | '''
|
---|
| 18 |
|
---|
| 19 | def __init__(self, uri:URI):
|
---|
| 20 | assert isinstance(uri, URI)
|
---|
| 21 | self._protocol = uri
|
---|
| 22 |
|
---|
| 23 | @JsonValue()
|
---|
| 24 | def getURI(self) -> URI :
|
---|
| 25 | return self._protocol
|
---|
| 26 |
|
---|
| 27 | def __repr__(self):
|
---|
| 28 | return "ProtocolRef[" + str(self._protocol) + "]"
|
---|
| 29 |
|
---|
| 30 | def __eq__(self, other):
|
---|
| 31 | return isinstance(other, self.__class__) and \
|
---|
| 32 | self._protocol==other._protocol
|
---|
| 33 |
|
---|
| 34 | def __hash__(self):
|
---|
| 35 | return hash(str(self._protocol))
|
---|
Note:
See
TracBrowser
for help on using the repository browser.