Skip to content

Commit

Permalink
up
Browse files Browse the repository at this point in the history
  • Loading branch information
franneck94 committed Mar 11, 2023
1 parent e09f3cd commit 727fc3a
Show file tree
Hide file tree
Showing 10 changed files with 45 additions and 138 deletions.
8 changes: 4 additions & 4 deletions benchmarks/test_computations.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def test_python_clip_vector(benchmark: Any) -> None:
fastvector.python_clip_vector,
args=(v, -1, 1, v),
rounds=NUM_ROUNDS,
iterations=NUM_ITERATIONS
iterations=NUM_ITERATIONS,
)


Expand All @@ -27,7 +27,7 @@ def test_naive_cython_clip_vector(benchmark: Any) -> None:
fastvector.naive_cython_clip_vector,
args=(v, -1, 1, v),
rounds=NUM_ROUNDS,
iterations=NUM_ITERATIONS
iterations=NUM_ITERATIONS,
)


Expand All @@ -36,7 +36,7 @@ def test_cython_clip_vector(benchmark: Any) -> None:
fastvector.cython_clip_vector,
args=(v, -1, 1, v),
rounds=NUM_ROUNDS,
iterations=NUM_ITERATIONS
iterations=NUM_ITERATIONS,
)


Expand All @@ -45,5 +45,5 @@ def test_np_clip(benchmark: Any) -> None:
np.clip,
args=(a, -1, 1, a),
rounds=NUM_ROUNDS,
iterations=NUM_ITERATIONS
iterations=NUM_ITERATIONS,
)
5 changes: 1 addition & 4 deletions fastvector/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,4 @@
from .version import __version__


__all__ = [
'Vector2D'
'__version__'
]
__all__ = ["Vector2D", "__version__"]
37 changes: 0 additions & 37 deletions fastvector/computations.py

This file was deleted.

36 changes: 0 additions & 36 deletions fastvector/cython_computations.pyx

This file was deleted.

16 changes: 0 additions & 16 deletions fastvector/dtypes.py

This file was deleted.

16 changes: 8 additions & 8 deletions fastvector/vector.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,23 @@ def __init__(self, x: SupportsFloat = 0.0, y: SupportsFloat = 0.0) -> None:
self.x = x
self.y = y
else:
raise TypeError('You must pass in int/float value for x and y!')
raise TypeError("You must pass in int/float value for x and y!")

def __repr__(self) -> str:
"""Return the vector representation.
Returns:
The representation of the vector.
"""
return f'vector.Vector2D({self.x}, {self.y})'
return f"vector.Vector2D({self.x}, {self.y})"

def __str__(self) -> str:
"""The vector as a string.
Returns:
The vector as a string.
"""
return f'({self.x}, {self.y})'
return f"({self.x}, {self.y})"

def __abs__(self) -> float:
"""Return the length (magnitude) of the vector.
Expand Down Expand Up @@ -74,7 +74,7 @@ def __lt__(self, other_vector: Vector2D) -> bool:
False, else.
"""
if not isinstance(other_vector, Vector2D):
raise TypeError('You must pass in a Vector2D instance!')
raise TypeError("You must pass in a Vector2D instance!")
return abs(self) < abs(other_vector)

def __add__(self, other_vector: Vector2D) -> Vector2D:
Expand All @@ -87,7 +87,7 @@ def __add__(self, other_vector: Vector2D) -> Vector2D:
The addition vector of the self and the other vector.
"""
if not isinstance(other_vector, Vector2D):
raise TypeError('You must pass in a Vector2D instance!')
raise TypeError("You must pass in a Vector2D instance!")
x = self.x + other_vector.x
y = self.y + other_vector.y
return Vector2D(x, y)
Expand All @@ -102,7 +102,7 @@ def __sub__(self, other_vector: Vector2D) -> Vector2D:
The subtraction vector of the self and the other vector.
"""
if not isinstance(other_vector, Vector2D):
raise TypeError('You must pass in a Vector2D instance!')
raise TypeError("You must pass in a Vector2D instance!")
x = self.x - other_vector.x
y = self.y - other_vector.y
return Vector2D(x, y)
Expand All @@ -125,7 +125,7 @@ def __mul__(
result: SupportsFloat = self.x * other.x + self.y * other.y
return result
if not isinstance(other, numbers.Real):
raise TypeError('You must pass in an int/float!')
raise TypeError("You must pass in an int/float!")
return Vector2D(self.x * other, self.y * other)

def __truediv__(self, other: SupportsFloat) -> Vector2D:
Expand All @@ -142,5 +142,5 @@ def __truediv__(self, other: SupportsFloat) -> Vector2D:
The multiplication of self and the other vector/number.
"""
if not isinstance(other, numbers.Real):
raise TypeError('You must pass in an int/float!')
raise TypeError("You must pass in an int/float!")
return Vector2D(self.x / other, self.y / other)
2 changes: 1 addition & 1 deletion fastvector/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '3.0.0'
__version__ = "4.0.0"
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

[metadata]
name = fastvector
version = 3.0.0
version = 4.0.0
description = "This is a simple vector python package."
long_description = file: README.md
long_description_content_type = text/markdown
Expand Down
4 changes: 1 addition & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ def main() -> None:
with open("requirements.txt") as fp:
install_requires = fp.read().strip().split("\n")

metadata = dict(
install_requires=install_requires
)
metadata = dict(install_requires=install_requires)
setup(**metadata)


Expand Down
Loading

0 comments on commit 727fc3a

Please sign in to comment.