diff --git a/haproxy/logfile.py b/haproxy/logfile.py index aa57ebe..5292c2a 100644 --- a/haproxy/logfile.py +++ b/haproxy/logfile.py @@ -1,9 +1,9 @@ # -*- coding: utf-8 -*- -from multiprocessing import Pool from datetime import datetime from haproxy.line import parse_line -from haproxy.utils import delta_str_to_timedelta from haproxy.utils import date_str_to_datetime +from haproxy.utils import delta_str_to_timedelta +from multiprocessing import Pool class Log(object): diff --git a/haproxy/main.py b/haproxy/main.py index 15954b2..8e63075 100644 --- a/haproxy/main.py +++ b/haproxy/main.py @@ -1,13 +1,11 @@ # -*- encoding: utf-8 -*- from haproxy.logfile import Log -from haproxy.utils import validate_arg_date -from haproxy.utils import validate_arg_delta from haproxy.utils import VALID_COMMANDS from haproxy.utils import VALID_FILTERS +from haproxy.utils import validate_arg_date +from haproxy.utils import validate_arg_delta import argparse -import datetime -import json import os diff --git a/haproxy/tests/test_argparse.py b/haproxy/tests/test_argparse.py index a5ddafd..4db5caa 100644 --- a/haproxy/tests/test_argparse.py +++ b/haproxy/tests/test_argparse.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from haproxy.main import create_parser -from haproxy.main import parse_arguments from haproxy.main import parse_arg_filters +from haproxy.main import parse_arguments import pytest diff --git a/haproxy/tests/test_commands.py b/haproxy/tests/test_commands.py index 81763ee..05ae8b8 100644 --- a/haproxy/tests/test_commands.py +++ b/haproxy/tests/test_commands.py @@ -2,6 +2,7 @@ from datetime import timedelta from haproxy import commands from testfixtures import OutputCapture + import pytest diff --git a/haproxy/tests/test_filters.py b/haproxy/tests/test_filters.py index fe82274..2cba9c7 100644 --- a/haproxy/tests/test_filters.py +++ b/haproxy/tests/test_filters.py @@ -1,8 +1,5 @@ # -*- coding: utf-8 -*- -from datetime import datetime -from datetime import timedelta from haproxy import filters -from haproxy.line import Line import pytest diff --git a/haproxy/tests/test_log_file.py b/haproxy/tests/test_log_file.py index 7ef98d9..7c9ee63 100644 --- a/haproxy/tests/test_log_file.py +++ b/haproxy/tests/test_log_file.py @@ -1,7 +1,6 @@ # -*- coding: utf-8 -*- from datetime import datetime from haproxy.logfile import Log -from haproxy.line import parse_line import pytest @@ -47,7 +46,7 @@ def test_lines_validity(tmp_path, line_factory, accept_date): with open(file_path, 'w') as file_obj: file_obj.write(f'{line}\n') log_file = Log(file_path) - lines = [x for x in log_file] + _ = [x for x in log_file] assert log_file.total_lines == 1 if accept_date: diff --git a/haproxy/tests/test_main.py b/haproxy/tests/test_main.py index 9549117..7209bb1 100644 --- a/haproxy/tests/test_main.py +++ b/haproxy/tests/test_main.py @@ -1,6 +1,6 @@ from haproxy.main import create_parser -from haproxy.main import parse_arguments from haproxy.main import main +from haproxy.main import parse_arguments from haproxy.utils import VALID_COMMANDS from haproxy.utils import VALID_FILTERS diff --git a/haproxy/tests/test_regex.py b/haproxy/tests/test_regex.py index f928aed..4ead7a4 100644 --- a/haproxy/tests/test_regex.py +++ b/haproxy/tests/test_regex.py @@ -3,8 +3,8 @@ from haproxy.line import HAPROXY_LINE_REGEX from haproxy.line import HTTP_REQUEST_REGEX -import random import pytest +import random def test_default_values(line_factory, default_line_data): diff --git a/haproxy/tests/test_utils.py b/haproxy/tests/test_utils.py index 978e908..3f2298d 100644 --- a/haproxy/tests/test_utils.py +++ b/haproxy/tests/test_utils.py @@ -1,11 +1,11 @@ -from datetime import timedelta from datetime import datetime -from haproxy.utils import delta_str_to_timedelta +from datetime import timedelta from haproxy.utils import date_str_to_datetime -from haproxy.utils import validate_arg_date -from haproxy.utils import validate_arg_delta +from haproxy.utils import delta_str_to_timedelta from haproxy.utils import VALID_COMMANDS from haproxy.utils import VALID_FILTERS +from haproxy.utils import validate_arg_date +from haproxy.utils import validate_arg_delta import pytest diff --git a/haproxy/utils.py b/haproxy/utils.py index 960307f..7e5490b 100644 --- a/haproxy/utils.py +++ b/haproxy/utils.py @@ -1,5 +1,5 @@ -from datetime import timedelta from datetime import datetime +from datetime import timedelta import re diff --git a/setup.cfg b/setup.cfg index b23ee68..5933891 100644 --- a/setup.cfg +++ b/setup.cfg @@ -13,9 +13,15 @@ testpaths = haproxy/tests norecursedirs = .venv [flake8] -ignore = E501, W503, D105, D202, E211 -# E501 black takes care of line length -# W503 black takes care of where to break lines -# D105 missing docstring in magic method -# D202 black takes care of blank lines -# E211 whitespace before ( +ignore = C101, # coding magic comment not found + D104, # missing docstring in public package + D105, # missing docstring in magic method + D106, # missing docstring in public nested class (e.g. Meta class) + D107, # missing docstring in __init__ (against Google/NumPy guidelines) + D413, # missing blank line after last section + E203, # black takes care of whitespace before colons (:) + E231, # black takes care of whitespace after commas + E501, # black takes care of line length + N802, # all-lowercase method names + Q003, # Change outer quotes to avoid escaping inner quotes + W503, # black takes care of where to break lines