Skip to content

Commit

Permalink
Add isort config + reorder imports
Browse files Browse the repository at this point in the history
  • Loading branch information
cdce8p committed Jan 19, 2021
1 parent 3f08e86 commit ebc95e2
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 26 deletions.
26 changes: 12 additions & 14 deletions piplicenses.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,32 +32,30 @@
import os
import sys
from collections import Counter
from enum import Enum, auto
from email import message_from_string
from email.parser import FeedParser
from enum import Enum, auto
from functools import partial
from typing import Optional, List, Text
from typing import List, Optional, Text

try:
from pip._internal.utils.misc import get_installed_distributions
except ImportError: # pragma: no cover
from pip import get_installed_distributions

from prettytable import PrettyTable

try:
from prettytable.prettytable import (
ALL as RULE_ALL,
FRAME as RULE_FRAME,
HEADER as RULE_HEADER,
NONE as RULE_NONE,
)
from prettytable.prettytable import ALL as RULE_ALL
from prettytable.prettytable import FRAME as RULE_FRAME
from prettytable.prettytable import HEADER as RULE_HEADER
from prettytable.prettytable import NONE as RULE_NONE
PTABLE = True
except ImportError: # pragma: no cover
from prettytable import (
ALL as RULE_ALL,
FRAME as RULE_FRAME,
HEADER as RULE_HEADER,
NONE as RULE_NONE,
)
from prettytable import ALL as RULE_ALL
from prettytable import FRAME as RULE_FRAME
from prettytable import HEADER as RULE_HEADER
from prettytable import NONE as RULE_NONE
PTABLE = False

open = open # allow monkey patching
Expand Down
7 changes: 7 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,10 @@ test = pytest

[tool:pytest]
addopts = --pycodestyle -v --cov --cov-report term-missing

[tool:isort]
# https://github.com/timothycrosley/isort
multi_line_output = 4
line_length = 72
known_first_party =
piplicenses
21 changes: 9 additions & 12 deletions test_piplicenses.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,21 @@
from email import message_from_string
from enum import Enum, auto

import docutils.frontend
import docutils.parsers.rst
import docutils.utils
import docutils.frontend
import pytest
from _pytest.capture import CaptureFixture

import piplicenses
from piplicenses import (FromArg, __pkgname__, create_parser, output_colored,
create_licenses_table, get_output_fields, get_sortby,
factory_styled_table_with_args, create_warn_string,
find_license_from_classifier, create_output_string,
select_license_by_source, save_if_needs,
RULE_ALL, RULE_FRAME, RULE_HEADER, RULE_NONE,
DEFAULT_OUTPUT_FIELDS, SYSTEM_PACKAGES,
LICENSE_UNKNOWN,
CompatibleArgumentParser, value_to_enum_key,
enum_key_to_value)

from piplicenses import (
DEFAULT_OUTPUT_FIELDS, LICENSE_UNKNOWN, RULE_ALL, RULE_FRAME,
RULE_HEADER, RULE_NONE, SYSTEM_PACKAGES, CompatibleArgumentParser,
FromArg, __pkgname__, create_licenses_table, create_output_string,
create_parser, create_warn_string, enum_key_to_value,
factory_styled_table_with_args, find_license_from_classifier,
get_output_fields, get_sortby, output_colored, save_if_needs,
select_license_by_source, value_to_enum_key)

UNICODE_APPENDIX = ""
with open('tests/fixtures/unicode_characters.txt', encoding='utf-8') as f:
Expand Down

0 comments on commit ebc95e2

Please sign in to comment.