Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neoppod
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vincent Pelletier
neoppod
Commits
11debaa9
Commit
11debaa9
authored
Jun 24, 2015
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add more information in __repr__ of connections
parent
6b410098
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
5 deletions
+22
-5
neo/lib/connection.py
neo/lib/connection.py
+22
-5
No files found.
neo/lib/connection.py
View file @
11debaa9
...
...
@@ -280,14 +280,21 @@ class BaseConnection(object):
self
.
connector
=
None
self
.
aborted
=
False
def
_getReprInfo
(
self
):
return
[
(
'uuid'
,
uuid_str
(
self
.
getUUID
())),
(
'address'
,
self
.
addr
and
'%s:%d'
%
self
.
addr
or
'?'
),
(
'handler'
,
self
.
getHandler
()),
],
[
'closed'
]
if
self
.
isClosed
()
else
[]
def
__repr__
(
self
):
address
=
self
.
addr
and
'%s:%d'
%
self
.
addr
or
'?'
return
'<%s(uuid=%s, address=%s, closed=%s, handler=%s) at %x>'
%
(
r
,
flags
=
self
.
_getReprInfo
()
r
=
map
(
'%s=%s'
.
__mod__
,
r
)
r
+=
flags
return
'<%s(%s) at %x>'
%
(
self
.
__class__
.
__name__
,
uuid_str
(
self
.
getUUID
()),
address
,
int
(
self
.
isClosed
()),
self
.
getHandler
(),
', '
.
join
(
r
),
id
(
self
),
)
...
...
@@ -388,6 +395,16 @@ class Connection(BaseConnection):
self
.
_on_close
=
None
self
.
_parser_state
=
ParserState
()
def
_getReprInfo
(
self
):
r
,
flags
=
super
(
Connection
,
self
).
_getReprInfo
()
if
self
.
_queue
:
r
.
append
((
'len(queue)'
,
len
(
self
.
_queue
)))
if
self
.
_on_close
is
not
None
:
r
.
append
((
'on_close'
,
getattr
(
self
.
_on_close
,
'__name__'
,
'?'
)))
flags
.
extend
(
x
for
x
in
(
'aborted'
,
'connecting'
,
'client'
,
'server'
)
if
getattr
(
self
,
x
))
return
r
,
flags
def
setOnClose
(
self
,
callback
):
self
.
_on_close
=
callback
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment