Yulia Portnova | 21289b2 | 2015-03-18 15:21:43 +0200 | [diff] [blame] | 1 | class Node(object): |
| 2 | |
koder aka kdanilov | 2c47309 | 2015-03-29 17:12:13 +0300 | [diff] [blame] | 3 | def __init__(self, conn_url, roles): |
Yulia Portnova | 21289b2 | 2015-03-18 15:21:43 +0200 | [diff] [blame] | 4 | self.roles = roles |
koder aka kdanilov | 2c47309 | 2015-03-29 17:12:13 +0300 | [diff] [blame] | 5 | self.conn_url = conn_url |
koder aka kdanilov | e06762a | 2015-03-22 23:32:09 +0200 | [diff] [blame] | 6 | self.connection = None |
| 7 | |
| 8 | def __str__(self): |
koder aka kdanilov | 2c47309 | 2015-03-29 17:12:13 +0300 | [diff] [blame] | 9 | templ = "<Node: url={conn_url!r} roles={roles}" + \ |
| 10 | " connected={is_connected}>" |
| 11 | return templ.format(conn_url=self.conn_url, |
| 12 | roles=", ".join(self.roles), |
| 13 | is_connected=self.connection is not None) |
Yulia Portnova | 21289b2 | 2015-03-18 15:21:43 +0200 | [diff] [blame] | 14 | |
Yulia Portnova | 0e64ea2 | 2015-03-20 17:27:22 +0200 | [diff] [blame] | 15 | def __repr__(self): |
koder aka kdanilov | e06762a | 2015-03-22 23:32:09 +0200 | [diff] [blame] | 16 | return str(self) |