blob: 701074ab13dc10da3c8d624c5e53e0da5e93f511 (
plain)
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 Link():
"""
documentation anchor - this class currently carries no implementation
and only acts as a documentation anchor
link['__src'] - meta attribute for link source
link['__dst'] - meta attribute for link destination
"""
class Link_Ptr(dict):
def __init__(self, src_id=None, dst_id=None):
assert None != src_id or None != dst_id
self['__src'] = src_id
self['__dst'] = dst_id
@property
def src_id(self):
return self['__src']
@property
def dst_id(self):
return self['__dst']
@staticmethod
def link_ptr(src_id=None, dst_id=None):
"""
init from src_id or dst_id attributes - at least one must be provided
"""
return Link.Link_Ptr(src_id, dst_id)
|