Skip to content

Commit

Permalink
Add isort and sort all imports (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiencelier authored Nov 6, 2019
1 parent 4904951 commit 1e830a4
Show file tree
Hide file tree
Showing 18 changed files with 39 additions and 24 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ jobs:
run: pipenv run black . --check
- name: linting with pylint
run: pipenv run pylint universions
- name: Order imports with isort
run: pipenv run isort . --recursive --check-only
- name: Run all tests with pytest
run: pipenv run pytest .
- name: Install javascript dependencies
Expand Down
6 changes: 6 additions & 0 deletions .isort.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[settings]
multi_line_output=3
include_trailing_comma=True
force_grid_wrap=0
use_parentheses=True
line_length=88
1 change: 1 addition & 0 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ twine = "*"
sphinx = "*"
sphinx-rtd-theme = "*"
testfixtures = "*"
isort = "*"

[packages]

Expand Down
21 changes: 11 additions & 10 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions scripts/check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ pipenv run black . --check
# Pylint
pipenv run pylint universions

# Order import with isort
pipenv run isort . --recursive --check-only

# Types with Pyright
yarn run pyright universions

Expand Down
1 change: 1 addition & 0 deletions scripts/release.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import subprocess
from os import path
from pathlib import Path

from update_version import update_version

PROJECT_DIR = Path(path.abspath(path.dirname(__file__))).parent
Expand Down
1 change: 0 additions & 1 deletion scripts/update_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import datetime
import re
import subprocess

from os import path
from pathlib import Path

Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Setup universions module."""

from os import path

from setuptools import find_packages, setup


Expand Down
1 change: 0 additions & 1 deletion test/mock_popen.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""Test class with a mocked Popen."""

import pytest

from testfixtures import Replacer
from testfixtures.popen import MockPopen

Expand Down
2 changes: 1 addition & 1 deletion test/test_java_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

from universions import Version
from universions.java import _parse_version_string, get_java_version
from .mock_popen import BasicMockedPopen

from .mock_popen import BasicMockedPopen

JAVA_5 = (
b'java version "1.5.0_29"\n'
Expand Down
3 changes: 2 additions & 1 deletion test/test_node_version.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
"""Test the parsing of node version."""

from pathlib import Path

import pytest

from universions import Version
from universions.node import get_node_versions
from .mock_popen import BasicMockedPopen

from .mock_popen import BasicMockedPopen

ARGON = b"v4.9.1\n"
BORON = b"v6.17.1\n"
Expand Down
3 changes: 2 additions & 1 deletion test/test_semver_parser.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
"""Test the semver parser."""

import pytest
from universions import parse_semver, Version

from universions import Version, parse_semver
from universions.error import InvalidVersionFormatError


Expand Down
2 changes: 1 addition & 1 deletion universions/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""Universions is a tool to get the versions of other tools."""

from ._version import VERSION as __version__
from .version import Version, parse_semver
from .cli import main as cli
from .version import Version, parse_semver
3 changes: 1 addition & 2 deletions universions/_exec.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
"""Module to execute a command line and clean it."""

import subprocess

from pathlib import Path
from subprocess import PIPE, Popen
from typing import List, Union
from subprocess import Popen, PIPE


def exec_command(
Expand Down
3 changes: 2 additions & 1 deletion universions/cli.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
"""Main file to call universions from the CLI."""

import argparse

import pkg_resources

from universions.version import parse_semver
import universions.java as uj
import universions.node as un
from universions.version import parse_semver


def get_self_version():
Expand Down
3 changes: 1 addition & 2 deletions universions/java/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
"""Module to get the Java version."""

import re

from os import environ, path
from pathlib import Path
from typing import Optional, Union
from os import environ, path

from universions._exec import exec_command
from universions.error import InvalidVersionFormatError
Expand Down
5 changes: 3 additions & 2 deletions universions/node/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
"""Module for node versions."""

import subprocess
from typing import Optional, Union
from pathlib import Path
from universions.version import Version, parse_semver
from typing import Optional, Union

from universions._exec import exec_command
from universions.version import Version, parse_semver


def get_node_versions(
Expand Down
2 changes: 1 addition & 1 deletion universions/version.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Unique format for all the versions."""

from typing import Optional, NamedTuple
import re
from typing import NamedTuple, Optional

from .error import InvalidVersionFormatError

Expand Down

0 comments on commit 1e830a4

Please sign in to comment.