Skip to content

Commit 9d8be07

Browse files
author
Zhen
committed
Change the string concatenation and formatting to correct python style
1 parent 0473a2f commit 9d8be07

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

neo4j/addressing.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,11 @@ def parse_routing_context(cls, uri):
9090
for keyValue in parameters:
9191
pair = keyValue.split('=')
9292
if len(pair) != 2 or not pair[0] or not pair[1]:
93-
raise ValueError("Invalid parameters: '" + keyValue + "' in URI '" + uri + "'.")
93+
raise ValueError("Invalid parameters: '%s' in URI '%s'." % (keyValue, uri))
9494
key = pair[0]
9595
value = pair[1]
9696
if key in context:
97-
raise ValueError("Duplicated query parameters with key '" + key + "' found in URL '" + uri + "'")
97+
raise ValueError("Duplicated query parameters with key '%s' found in URL '%s'" % (key, uri))
9898
context[key] = value
9999
return context
100100

neo4j/v1/direct.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def __init__(self, uri, **config):
5757
# the connection pool may contain multiple IP address keys, one for
5858
# an old address and one for a new address.
5959
if SocketAddress.parse_routing_context(uri):
60-
raise ValueError("Routing parameters are not supported with scheme 'bolt'. Given URI: '" + uri + "'.")
60+
raise ValueError("Routing parameters are not supported with scheme 'bolt'. Given URI: '%s'." % uri)
6161
self.address = SocketAddress.from_uri(uri, DEFAULT_PORT)
6262
self.security_plan = security_plan = SecurityPlan.build(**config)
6363
self.encrypted = security_plan.encrypted

neo4j/v1/routing.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ class RoutingConnectionPool(ConnectionPool):
156156

157157
call_get_servers = "CALL dbms.cluster.routing.getServers"
158158
get_routing_table_param = "context"
159-
call_get_routing_table = "CALL dbms.cluster.routing.getRoutingTable({" + get_routing_table_param + "})"
159+
call_get_routing_table = "CALL dbms.cluster.routing.getRoutingTable({%s})" % get_routing_table_param
160160

161161
def __init__(self, connector, initial_address, routing_context, *routers):
162162
super(RoutingConnectionPool, self).__init__(connector)
@@ -170,7 +170,7 @@ def routing_info_procedure(self, connection):
170170
if ServerVersion.from_str(connection.server.version).at_least_version(3, 2):
171171
return self.call_get_routing_table, {self.get_routing_table_param: self.routing_context}
172172
else:
173-
return self.call_get_servers, None
173+
return self.call_get_servers
174174

175175
def fetch_routing_info(self, address):
176176
""" Fetch raw routing info from a given router address.
@@ -315,8 +315,7 @@ def acquire(self, access_mode=None):
315315
self.remove(address)
316316
else:
317317
return connection
318-
raise SessionExpired("Failed to obtain connection towards '" + access_mode +
319-
"' server. Known routing table is: '" + self.routing_table + "'.")
318+
raise SessionExpired("Failed to obtain connection towards '%s' server." % access_mode)
320319

321320
def remove(self, address):
322321
""" Remove an address from the connection pool, if present, closing

0 commit comments

Comments
 (0)