Skip to content

Commit 2d10c10

Browse files
author
avandras
committed
Fix some linting issues
1 parent ab43b49 commit 2d10c10

File tree

9 files changed

+13
-15
lines changed

9 files changed

+13
-15
lines changed

patroni/dcs/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,8 @@ def from_node(version: _Version, value: Union[str, Dict[str, str]]) -> 'Failover
512512
if data.get('scheduled_at'):
513513
data['scheduled_at'] = dateutil.parser.parse(data['scheduled_at'])
514514

515-
return Failover(version, data.get('leader'), data.get('member'), data.get('scheduled_at'), data.get('target_site'))
515+
return Failover(version, data.get('leader'), data.get('member'), data.get('scheduled_at'),
516+
data.get('target_site'))
516517

517518
def __len__(self) -> int:
518519
"""Implement ``len`` function capability.

patroni/dcs/etcd3.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -754,7 +754,8 @@ def _cluster_from_nodes(self, nodes: Dict[str, Any]) -> Cluster:
754754

755755
# get leader
756756
leader = nodes.get(self._LEADER)
757-
if not self._ctl and not self._multisite and leader and leader['value'] == self._name and self._lease != leader.get('lease'):
757+
if not self._ctl and not self._multisite and leader and leader['value'] == self._name and \
758+
self._lease != leader.get('lease'):
758759
logger.warning('I am the leader but not owner of the lease')
759760

760761
if leader:

patroni/ha.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ def acquire_lock(self) -> bool:
361361
self.set_is_leader(ret)
362362
multisite_ret = self.patroni.multisite.resolve_leader()
363363
if multisite_ret:
364-
logger.error("Releasing leader lock because multi site status is: "+multisite_ret)
364+
logger.error("Releasing leader lock because multi site status is: " + multisite_ret)
365365
self.dcs.delete_leader()
366366
return False
367367
return ret
@@ -1561,7 +1561,7 @@ def demote(self, mode: str) -> Optional[bool]:
15611561
'graceful': dict(stop='fast', checkpoint=True, release=True, offline=False, async_req=False), # noqa: E241,E501
15621562
'immediate': dict(stop='immediate', checkpoint=False, release=True, offline=False, async_req=True), # noqa: E241,E501
15631563
'immediate-nolock': dict(stop='immediate', checkpoint=False, release=False, offline=False, async_req=True), # noqa: E241,E501
1564-
'multisite': dict(stop='fast', checkpoint=True, release=False, offline=True, async_req=False), # noqa: E241,E501
1564+
'multisite': dict(stop='fast', checkpoint=True, release=False, offline=True, async_req=False), # noqa: E241,E501
15651565
}[mode]
15661566

15671567
logger.info('Demoting self (%s)', mode)
@@ -1583,7 +1583,7 @@ def on_shutdown(checkpoint_location: int, prev_location: int) -> None:
15831583
status['released'] = True
15841584

15851585
if mode == 'multisite':
1586-
on_shutdown = self.patroni.multisite.on_shutdown
1586+
on_shutdown = self.patroni.multisite.on_shutdown # noqa: F811
15871587

15881588
def before_shutdown() -> None:
15891589
if self.state_handler.mpp_handler.is_coordinator():
@@ -1718,7 +1718,8 @@ def process_unhealthy_cluster(self) -> str:
17181718
if failover:
17191719
if self.is_paused() and failover.leader and failover.candidate:
17201720
logger.info('Updating failover key after acquiring leader lock...')
1721-
self.dcs.manual_failover('', failover.candidate, failover.scheduled_at, version=failover.version)
1721+
self.dcs.manual_failover('', failover.candidate, failover.scheduled_at,
1722+
version=failover.version)
17221723
else:
17231724
logger.info('Cleaning up failover key after acquiring leader lock...')
17241725
self.dcs.manual_failover('', '')

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
EXTRAS_REQUIRE = {'aws': ['boto3'], 'etcd': ['python-etcd'], 'etcd3': ['python-etcd'],
2828
'consul': ['py-consul'], 'exhibitor': ['kazoo'], 'zookeeper': ['kazoo'],
29+
'systemd': ['systemd-python'],
2930
'kubernetes': [], 'raft': ['pysyncobj', 'cryptography'], 'jsonlogger': ['python-json-logger']}
3031

3132
# Add here all kinds of additional classifiers as defined under

tests/test_citus.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import etcd
21
import time
32
import unittest
43

tests/test_config.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import etcd
21
import io
32
import os
43
import sys

tests/test_ctl.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import etcd
21
import os
32
import unittest
43

tests/test_ha.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,14 @@
55

66
from unittest.mock import MagicMock, Mock, mock_open, patch, PropertyMock
77

8-
import etcd
9-
108
from patroni import global_config
119
from patroni.collections import CaseInsensitiveSet
1210
from patroni.config import Config
1311
from patroni.dcs import Cluster, ClusterConfig, Failover, get_dcs, Leader, Member, Status, SyncState, TimelineHistory
1412
from patroni.dcs.etcd import AbstractEtcdClientWithFailover
1513
from patroni.exceptions import DCSError, PatroniFatalException, PostgresConnectionException
1614
from patroni.ha import _MemberStatus, Ha
17-
from patroni.multisite import MultisiteController, SingleSiteController
15+
from patroni.multisite import SingleSiteController
1816
from patroni.postgresql import Postgresql
1917
from patroni.postgresql.bootstrap import Bootstrap
2018
from patroni.postgresql.callback_executor import CallbackAction
@@ -1005,7 +1003,8 @@ def test_manual_switchover_process_no_leader_in_synchronous_mode(self):
10051003
self.assertEqual(self.ha.run_cycle(), 'following a different leader because i am not the healthiest node')
10061004

10071005
# to our node (postgresql0), which name is not in sync nodes list
1008-
self.ha.cluster = get_cluster_initialized_without_leader(failover=Failover(0, 'leader', 'postgresql0', None, ''),
1006+
self.ha.cluster = get_cluster_initialized_without_leader(failover=Failover(0, 'leader', 'postgresql0', None,
1007+
''),
10091008
sync=('leader1', 'blabla'))
10101009
self.assertEqual(self.ha.run_cycle(), 'following a different leader because i am not the healthiest node')
10111010

tests/test_mpp.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import etcd
2-
31
from typing import Any
42

53
from patroni.exceptions import PatroniException

0 commit comments

Comments
 (0)