Skip to content

Commit

Permalink
chore: fix QA errors
Browse files Browse the repository at this point in the history
  • Loading branch information
gforcada committed Jan 2, 2020
1 parent 2deb823 commit 5bca6ed
Show file tree
Hide file tree
Showing 11 changed files with 26 additions and 25 deletions.
4 changes: 2 additions & 2 deletions haproxy/logfile.py
Original file line number Diff line number Diff line change
@@ -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):
Expand Down
6 changes: 2 additions & 4 deletions haproxy/main.py
Original file line number Diff line number Diff line change
@@ -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


Expand Down
2 changes: 1 addition & 1 deletion haproxy/tests/test_argparse.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down
1 change: 1 addition & 0 deletions haproxy/tests/test_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from datetime import timedelta
from haproxy import commands
from testfixtures import OutputCapture

import pytest


Expand Down
3 changes: 0 additions & 3 deletions haproxy/tests/test_filters.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down
3 changes: 1 addition & 2 deletions haproxy/tests/test_log_file.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-
from datetime import datetime
from haproxy.logfile import Log
from haproxy.line import parse_line

import pytest

Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion haproxy/tests/test_main.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion haproxy/tests/test_regex.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
8 changes: 4 additions & 4 deletions haproxy/tests/test_utils.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion haproxy/utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from datetime import timedelta
from datetime import datetime
from datetime import timedelta

import re

Expand Down
18 changes: 12 additions & 6 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 5bca6ed

Please sign in to comment.