Skip to content

Commit

Permalink
flake8: Enforce uniform import order
Browse files Browse the repository at this point in the history
  • Loading branch information
nbraud committed Feb 24, 2019
1 parent f7429e5 commit 0e33b60
Show file tree
Hide file tree
Showing 21 changed files with 57 additions and 31 deletions.
1 change: 1 addition & 0 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
flake8
flake8-bugbear
flake8-commas
flake8-import-order
hypothesis
mypy==0.641
perf
Expand Down
8 changes: 4 additions & 4 deletions ppb_vector/vector2.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import typing
import functools
import dataclasses
import functools
import typing
from collections.abc import Mapping, Sequence
from dataclasses import dataclass
from math import atan2, cos, degrees, hypot, isclose, radians, sin, copysign, sqrt
from collections.abc import Sequence, Mapping
from math import atan2, copysign, cos, degrees, hypot, isclose, radians, sin, sqrt

__all__ = ('Vector2',)

Expand Down
5 changes: 4 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
[flake8]
select = C,E,F,W,B,B9
select = C,E,F,I,W,B,B9
ignore = E704
max-line-length = 100

application-import-names = ppb_vector,utils
import-order-style = smarkets
1 change: 1 addition & 0 deletions tests/benchmark.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/env python3
import perf # type: ignore

from ppb_vector import Vector2
from utils import *

Expand Down
1 change: 1 addition & 0 deletions tests/test_vector2_addition.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import pytest # type: ignore

from ppb_vector import Vector2


Expand Down
4 changes: 3 additions & 1 deletion tests/test_vector2_angle.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
from ppb_vector import Vector2
from math import isclose

import pytest # type: ignore
from hypothesis import assume, given

from ppb_vector import Vector2
from utils import angle_isclose, floats, vectors


Expand Down
2 changes: 1 addition & 1 deletion tests/test_vector2_ctor.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import pytest # type: ignore
from hypothesis import given
from utils import floats, vectors, vector_likes

from ppb_vector import Vector2
from utils import floats, vector_likes, vectors


class V(Vector2):
Expand Down
5 changes: 3 additions & 2 deletions tests/test_vector2_dot.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from ppb_vector import Vector2

from math import sqrt

from hypothesis import assume, given, note

from ppb_vector import Vector2
from utils import angles, floats, isclose, vectors


Expand Down
3 changes: 2 additions & 1 deletion tests/test_vector2_equality.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from hypothesis import assume, given

from ppb_vector import Vector2
from utils import vectors, vector_likes
from utils import vector_likes, vectors


@given(x=vectors())
Expand Down
10 changes: 6 additions & 4 deletions tests/test_vector2_isclose.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
from ppb_vector import Vector2
from pytest import raises # type: ignore
from math import sqrt
from utils import units, lengths, vectors
from hypothesis import assume, given, note, example

from hypothesis import assume, example, given, note
from hypothesis.strategies import floats
from pytest import raises # type: ignore

from ppb_vector import Vector2
from utils import lengths, units, vectors


@given(x=vectors(), abs_tol=floats(min_value=0), rel_tol=floats(min_value=0))
Expand Down
3 changes: 2 additions & 1 deletion tests/test_vector2_length.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import ppb_vector
import pytest # type: ignore

import ppb_vector


@pytest.mark.parametrize(
"x, y, expected",
Expand Down
1 change: 1 addition & 0 deletions tests/test_vector2_member_access.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import pytest # type: ignore

from ppb_vector import Vector2


Expand Down
4 changes: 3 additions & 1 deletion tests/test_vector2_normalize.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from hypothesis import assume, given
from math import isclose

from hypothesis import assume, given

from utils import vectors


Expand Down
8 changes: 5 additions & 3 deletions tests/test_vector2_reflect.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
from ppb_vector import Vector2
import pytest # type: ignore
from hypothesis import given, assume, note
from math import isclose, isinf

import pytest # type: ignore
from hypothesis import assume, given, note

from ppb_vector import Vector2
from utils import angle_isclose, units, vectors


Expand Down
9 changes: 5 additions & 4 deletions tests/test_vector2_rotate.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
from ppb_vector import Vector2
from utils import angle_isclose, angles, floats, vectors
import pytest # type: ignore
import math
from hypothesis import assume, given, note, example

import hypothesis.strategies as st
import pytest # type: ignore
from hypothesis import assume, example, given, note

from ppb_vector import Vector2
from utils import angle_isclose, angles, floats, vectors

data_exact = [
(Vector2(1, 1), -90, Vector2(1, -1)),
Expand Down
5 changes: 3 additions & 2 deletions tests/test_vector2_scalar_multiplication.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from hypothesis import assume, given
from math import isclose
from utils import floats, vectors

from hypothesis import assume, given

from ppb_vector import Vector2
from utils import floats, vectors


@given(scalar=floats(), vector=vectors())
Expand Down
5 changes: 3 additions & 2 deletions tests/test_vector2_scale.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from hypothesis import assume, given
from math import isclose
from utils import angle_isclose, floats, lengths, vectors

from hypothesis import assume, given

from ppb_vector import Vector2
from utils import angle_isclose, floats, lengths, vectors


@given(x=vectors(), length=floats())
Expand Down
1 change: 1 addition & 0 deletions tests/test_vector2_substraction.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import pytest # type: ignore

from ppb_vector import Vector2


Expand Down
5 changes: 3 additions & 2 deletions tests/test_vector2_truncate.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from hypothesis import assume, event, example, given, note
from typing import Type, Union
from utils import floats, lengths, vectors

from hypothesis import assume, event, example, given, note

from ppb_vector import Vector2
from utils import floats, lengths, vectors


@given(x=vectors(), max_length=lengths())
Expand Down
1 change: 1 addition & 0 deletions tests/test_vector2_update.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from hypothesis import given

from ppb_vector import Vector2
from utils import floats, vectors

Expand Down
6 changes: 4 additions & 2 deletions tests/utils.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
from ppb_vector import Vector2
from hypothesis import note
from typing import Sequence, Union

import hypothesis.strategies as st
from hypothesis import note

from ppb_vector import Vector2


UNIT_X, UNIT_Y = Vector2(1, 0), Vector2(0, 1)
Expand Down

0 comments on commit 0e33b60

Please sign in to comment.