Skip to content

Commit dd8ded8

Browse files
committed
Re-order project into a better module structure
1 parent 633f5a3 commit dd8ded8

File tree

7 files changed

+196
-33
lines changed

7 files changed

+196
-33
lines changed

.pre-commit-config.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
repos:
2+
- repo: https://github.com/hadialqattan/pycln
3+
rev: v2.1.3 # must match requirements_dev.txt
4+
hooks:
5+
- id: pycln
6+
args: [--config=pyproject.toml, src]
7+
- repo: https://github.com/psf/black
8+
rev: 23.1.0 # must match requirements_dev.txt
9+
hooks:
10+
- id: black
11+
language_version: python3.11
12+
- repo: https://github.com/pycqa/isort
13+
rev: 5.12.0 # must match requirements_dev.txt
14+
hooks:
15+
- id: isort
16+
name: isort (python)
17+
- repo: https://github.com/pre-commit/mirrors-prettier
18+
rev: v2.7.1
19+
hooks:
20+
- id: prettier
21+
types_or: [yaml]
22+
23+
ci:
24+
autofix_commit_msg: "[pre-commit.ci] auto fixes from pre-commit.com hooks"
25+
autofix_prs: true
26+
autoupdate_commit_msg: "[pre-commit.ci] pre-commit autoupdate"
27+
autoupdate_schedule: quarterly
28+
submodules: false

pyproject.toml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
[build-system]
2+
requires = ["setuptools>=42.0", "wheel"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[tool.mypy]
6+
mypy_path = "src"
7+
check_untyped_defs = true
8+
disallow_any_generics = true
9+
disallow_untyped_calls = true
10+
disallow_untyped_defs = true
11+
ignore_missing_imports = true
12+
no_implicit_optional = true
13+
no_implicit_reexport = true
14+
show_column_numbers = true
15+
show_error_codes = true
16+
strict = true
17+
strict_equality = true
18+
warn_redundant_casts = true
19+
warn_return_any = true
20+
warn_unreachable = true
21+
warn_unused_configs = true
22+
warn_unused_ignores = true
23+
24+
[tool.black]
25+
line-length = 79
26+
target-version = ['py311']

requirements.txt

Whitespace-only changes.

requirements_dev.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
black==23.1.0 # must match .pre-commit-config.yaml
2+
isort==5.12.0 # must match .pre-commit-config.yaml
3+
mypy==1.0.1
4+
pycln==2.1.3 # must match .pre-commit-config.yaml
5+
pre-commit

Vector2.py renamed to src/Vector2.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@ class Vector2:
2424

2525
def __init__(
2626
self,
27-
x: int | float | list[int | float] | tuple[int | float, int | float] = 0,
27+
x: int
28+
| float
29+
| list[int | float]
30+
| tuple[int | float, int | float] = 0,
2831
y: int | float = 0,
2932
) -> None:
3033
if isinstance(x, (list, tuple)):
@@ -50,7 +53,9 @@ def get_magnitude(self) -> float:
5053
"""Return the magnitude (length) of the vector"""
5154
return sqrt(self.x**2 + self.y**2)
5255

53-
def get_distance_to(self, point: Iterable[int | float] | "Vector2") -> float:
56+
def get_distance_to(
57+
self, point: Iterable[int | float] | "Vector2"
58+
) -> float:
5459
"""Get the magnitude to a point"""
5560
vec: "Vector2" = self.__class__.from_points(point, self)
5661
return vec.get_magnitude()

0 commit comments

Comments
 (0)