From fa6bd51ad125d7512e1235f28087e2c0490ff836 Mon Sep 17 00:00:00 2001 From: Ants Aasma Date: Tue, 30 Aug 2016 00:40:19 +0300 Subject: [PATCH] Appease Quantifiedcode about stylistic issues --- patroni/postgresql.py | 4 ++-- tests/test_postgresql.py | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/patroni/postgresql.py b/patroni/postgresql.py index dab5b88f..37d09460 100644 --- a/patroni/postgresql.py +++ b/patroni/postgresql.py @@ -33,7 +33,7 @@ def slot_name_from_member_name(member_name): def replace_char(match): c = match.group(0) - return '_' if c in '-.' else "u%04d" % ord(c) + return '_' if c in '-.' else "u{:04d}".format(ord(c)) slot_name = re.sub('[^a-z0-9_]', replace_char, member_name.lower()) return slot_name[0:64] @@ -922,7 +922,7 @@ $$""".format(name, ' '.join(options)), name, password, password) for name in slot_members: slot_conflicts[slot_name_from_member_name(name)].append(name) logger.error("Following cluster members share a replication slot name: %s", - "; ".join("%s map to %s" % (", ".join(v), k) + "; ".join("{} map to {}".format(", ".join(v), k) for k, v in slot_conflicts.items() if len(v) > 1)) # drop unused slots diff --git a/tests/test_postgresql.py b/tests/test_postgresql.py index ab973514..a9d729f6 100644 --- a/tests/test_postgresql.py +++ b/tests/test_postgresql.py @@ -327,7 +327,8 @@ class TestPostgresql(unittest.TestCase): cluster.members.extend([alias1, alias2]) self.p.sync_replication_slots(cluster) errorlog_mock.assert_called_once() - assert "test-3" in errorlog_mock.call_args[0][1] and "test.3" in errorlog_mock.call_args[0][1] + assert "test-3" in errorlog_mock.call_args[0][1] + assert "test.3" in errorlog_mock.call_args[0][1] @patch.object(MockConnect, 'closed', 2) def test__query(self):