Skip to content

Commit 48f9892

Browse files
author
vshepard
committed
fix flake8 problems
1 parent 204746d commit 48f9892

File tree

3 files changed

+18
-25
lines changed

3 files changed

+18
-25
lines changed

testgres/plugins/probackup/app.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -132,14 +132,12 @@ def run(self, command, gdb=False, old_binary=False, return_id=True, env=None,
132132
def init(self, options=None, old_binary=False, skip_log_directory=False, expect_error=False, use_backup_dir=True):
133133
if options is None:
134134
options = []
135-
return self.run([
136-
'init',
137-
] + options,
138-
old_binary=old_binary,
139-
skip_log_directory=skip_log_directory,
140-
expect_error=expect_error,
141-
use_backup_dir=use_backup_dir
142-
)
135+
return self.run(['init', ] + options,
136+
old_binary=old_binary,
137+
skip_log_directory=skip_log_directory,
138+
expect_error=expect_error,
139+
use_backup_dir=use_backup_dir
140+
)
143141

144142
def add_instance(self, instance, node, old_binary=False, options=None, expect_error=False):
145143
if options is None:
@@ -535,7 +533,6 @@ def show_archive(
535533
break
536534

537535
if tli > 0:
538-
timeline_data = None
539536
for timeline in instance_timelines:
540537
if timeline['tli'] == tli:
541538
return timeline
@@ -664,7 +661,7 @@ def set_archiving(
664661
archive_command += ' --remote-proto=ssh --remote-host=localhost'
665662

666663
if init_params.archive_compress and compress:
667-
archive_command += ' --compress-algorithm='+init_params.archive_compress
664+
archive_command += ' --compress-algorithm=' + init_params.archive_compress
668665

669666
if overwrite:
670667
archive_command += ' --overwrite'

testgres/plugins/probackup/gdb.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -191,10 +191,7 @@ def continue_execution_until_exit(self):
191191
continue
192192
if line.startswith('*stopped,reason="breakpoint-hit"'):
193193
continue
194-
if (
195-
line.startswith('*stopped,reason="exited') or
196-
line == '*stopped\n'
197-
):
194+
if line.startswith('*stopped,reason="exited') or line == '*stopped\n':
198195
self.quit()
199196
return
200197

testgres/plugins/probackup/init_helpers.py

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,16 @@
88
import testgres
99

1010
try:
11-
import lz4.frame
11+
import lz4.frame # noqa: F401
12+
1213
HAVE_LZ4 = True
1314
except ImportError as e:
1415
HAVE_LZ4 = False
1516
LZ4_error = e
1617

1718
try:
18-
import zstd
19+
import zstd # noqa: F401
20+
1921
HAVE_ZSTD = True
2022
except ImportError as e:
2123
HAVE_ZSTD = False
@@ -28,8 +30,8 @@
2830
cache_initdb=False,
2931
cached_initdb_dir=False,
3032
node_cleanup_full=delete_logs)
31-
except:
32-
pass
33+
except Exception as e:
34+
print("Can't configure testgres: {0}".format(e))
3335

3436

3537
class Init(object):
@@ -46,7 +48,7 @@ def __init__(self):
4648
version = self._pg_config['VERSION'].rstrip('develalphabetapre')
4749
parts = [*version.split(' ')[1].split('.'), '0', '0'][:3]
4850
parts[0] = re.match(r'\d+', parts[0]).group()
49-
self.pg_config_version = reduce(lambda v, x: v*100+int(x), parts, 0)
51+
self.pg_config_version = reduce(lambda v, x: v * 100 + int(x), parts, 0)
5052

5153
test_env = os.environ.copy()
5254
envs_list = [
@@ -133,10 +135,7 @@ def __init__(self):
133135

134136
self.probackup_old_path = None
135137
if 'PGPROBACKUPBIN_OLD' in test_env:
136-
if (
137-
os.path.isfile(test_env['PGPROBACKUPBIN_OLD']) and
138-
os.access(test_env['PGPROBACKUPBIN_OLD'], os.X_OK)
139-
):
138+
if (os.path.isfile(test_env['PGPROBACKUPBIN_OLD']) and os.access(test_env['PGPROBACKUPBIN_OLD'], os.X_OK)):
140139
self.probackup_old_path = test_env['PGPROBACKUPBIN_OLD']
141140
else:
142141
if self.verbose:
@@ -166,8 +165,7 @@ def __init__(self):
166165
).group(0)
167166

168167
self.remote = test_env.get('PGPROBACKUP_SSH_REMOTE', None) == 'ON'
169-
self.ptrack = test_env.get('PG_PROBACKUP_PTRACK', None) == 'ON' and \
170-
self.pg_config_version >= 110000
168+
self.ptrack = test_env.get('PG_PROBACKUP_PTRACK', None) == 'ON' and self.pg_config_version >= 110000
171169

172170
self.paranoia = test_env.get('PG_PROBACKUP_PARANOIA', None) == 'ON'
173171
env_compress = test_env.get('ARCHIVE_COMPRESSION', None)
@@ -200,4 +198,5 @@ def __init__(self):
200198
def test_env(self):
201199
return self._test_env.copy()
202200

201+
203202
init_params = Init()

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy