From 71fce312c25325915d569173505d4587d0414c43 Mon Sep 17 00:00:00 2001 From: Alexander Kukushkin Date: Fri, 10 Jul 2015 10:53:04 +0200 Subject: [PATCH] Enforce flake8 check --- .travis.yml | 1 + helpers/aws.py | 4 ++-- helpers/postgresql.py | 4 +++- tests/test_postgresql.py | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7c67278e..7debc49e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,5 +9,6 @@ install: - pip install coveralls script: - python setup.py test + - python setup.py flake8 after_success: - coveralls diff --git a/helpers/aws.py b/helpers/aws.py index b47e4e0f..352e3617 100644 --- a/helpers/aws.py +++ b/helpers/aws.py @@ -1,5 +1,4 @@ import logging -import re import requests from requests.exceptions import RequestException import yaml @@ -9,6 +8,7 @@ logger = logging.getLogger(__name__) class AWSConnection: + def __init__(self, config): self.available = False self.config = config @@ -43,7 +43,7 @@ class AWSConnection: if not self.available: return False - tags = {'Name': 'spilo_'+self.cluster_name, 'Role': role, 'Instance': self.instance_id} + tags = {'Name': 'spilo_' + self.cluster_name, 'Role': role, 'Instance': self.instance_id} try: conn = boto.ec2.connect_to_region(self.region) volumes = conn.get_all_volumes(filters={'attachment.instance-id': self.instance_id}) diff --git a/helpers/postgresql.py b/helpers/postgresql.py index 560d7a98..bbf5ffe9 100644 --- a/helpers/postgresql.py +++ b/helpers/postgresql.py @@ -9,6 +9,7 @@ from helpers.utils import sleep if sys.hexversion >= 0x03000000: from urllib.parse import urlparse + long = int else: from urlparse import urlparse @@ -169,7 +170,8 @@ class Postgresql: try: latest_backup = subprocess.check_output(self.wal_e_path.split() + ['backup-list', '--detail', 'LATEST']) - # name last_modified expanded_size_bytes wal_segment_backup_start wal_segment_offset_backup_start wal_segment_backup_stop wal_segment_offset_backup_stop + # name last_modified expanded_size_bytes wal_segment_backup_start wal_segment_offset_backup_start + # wal_segment_backup_stop wal_segment_offset_backup_stop # base_00000001000000000000007F_00000040 2015-05-18T10:13:25.000Z # 20310671 00000001000000000000007F 00000040 # 00000001000000000000007F 00000240 diff --git a/tests/test_postgresql.py b/tests/test_postgresql.py index d6c01f5b..cb2d09a6 100644 --- a/tests/test_postgresql.py +++ b/tests/test_postgresql.py @@ -118,7 +118,7 @@ class TestPostgresql(unittest.TestCase): 'password': 'rep-pass', 'network': '127.0.0.1/32'}, 'parameters': {'foo': 'bar'}, 'recovery_conf': {'foo': 'bar'}}, - on_change_callback=lambda state: True) + on_change_callback=lambda state: True) psycopg2.connect = psycopg2_connect if not os.path.exists(self.p.data_dir): os.makedirs(self.p.data_dir)