Skip to content

Commit b9a6e67

Browse files
committed
Removed hex2
1 parent f7c2f77 commit b9a6e67

File tree

2 files changed

+4
-18
lines changed

2 files changed

+4
-18
lines changed

neo4j/v1/bolt.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
from struct import pack as struct_pack, unpack as struct_unpack, unpack_from as struct_unpack_from
4040

4141
from .constants import DEFAULT_USER_AGENT, KNOWN_HOSTS, MAGIC_PREAMBLE, TRUST_DEFAULT, TRUST_ON_FIRST_USE
42-
from .compat import hex2
4342
from .exceptions import ProtocolError, Unauthorized
4443
from .packstream import Packer, Unpacker
4544
from .ssl_compat import SSL_AVAILABLE, HAS_SNI, SSLError
@@ -137,7 +136,7 @@ def send(self):
137136
"""
138137
data = self.raw.getvalue()
139138
if __debug__:
140-
log_debug("C: %s", ":".join(map(hex2, data)))
139+
log_debug("C: b%r", data)
141140
self.socket.sendall(data)
142141

143142
self.raw.seek(self.raw.truncate(0))
@@ -150,7 +149,7 @@ def _recv(self, size):
150149
# Read up to the required amount remaining
151150
b = self.socket.recv(8192)
152151
if b:
153-
if __debug__: log_debug("S: %s", ":".join(map(hex2, b)))
152+
if __debug__: log_debug("S: b%r", b)
154153
else:
155154
if ready_to_read is not None:
156155
raise ProtocolError("Server closed connection")
@@ -454,7 +453,7 @@ def connect(host_port, ssl_context=None, **config):
454453
handshake = [MAGIC_PREAMBLE] + supported_versions
455454
if __debug__: log_info("C: [HANDSHAKE] 0x%X %r", MAGIC_PREAMBLE, supported_versions)
456455
data = b"".join(struct_pack(">I", num) for num in handshake)
457-
if __debug__: log_debug("C: %s", ":".join(map(hex2, data)))
456+
if __debug__: log_debug("C: b%r", data)
458457
s.sendall(data)
459458

460459
# Handle the handshake response
@@ -469,7 +468,7 @@ def connect(host_port, ssl_context=None, **config):
469468
log_error("S: [CLOSE]")
470469
raise ProtocolError("Server closed connection without responding to handshake")
471470
if data_size == 4:
472-
if __debug__: log_debug("S: %s", ":".join(map(hex2, data)))
471+
if __debug__: log_debug("S: b%r", data)
473472
else:
474473
# Some other garbled data has been received
475474
log_error("S: @*#!")

neo4j/v1/compat.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,6 @@ def ustr(x):
4545
else:
4646
return str(x)
4747

48-
def hex2(x):
49-
if x < 0x10:
50-
return "0" + hex(x)[2:].upper()
51-
else:
52-
return hex(x)[2:].upper()
53-
5448
else:
5549
# Python 2
5650

@@ -65,13 +59,6 @@ def ustr(x):
6559
else:
6660
return unicode(x)
6761

68-
def hex2(x):
69-
x = ord(x)
70-
if x < 0x10:
71-
return "0" + hex(x)[2:].upper()
72-
else:
73-
return hex(x)[2:].upper()
74-
7562

7663
try:
7764
from multiprocessing import Array, Process

0 commit comments

Comments
 (0)