mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-08 03:54:26 +08:00
Ruff pandas vet (#10281)
* Python linting: Add ruff rules for Pandas-vet and Pytest-style * updating DIRECTORY.md --------- Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
This commit is contained in:
@ -200,7 +200,8 @@ def unit_basis_vector(dimension: int, pos: int) -> Vector:
|
||||
at index 'pos' (indexing at 0)
|
||||
"""
|
||||
# precondition
|
||||
assert isinstance(dimension, int) and (isinstance(pos, int))
|
||||
assert isinstance(dimension, int)
|
||||
assert isinstance(pos, int)
|
||||
ans = [0] * dimension
|
||||
ans[pos] = 1
|
||||
return Vector(ans)
|
||||
@ -213,11 +214,9 @@ def axpy(scalar: float, x: Vector, y: Vector) -> Vector:
|
||||
computes the axpy operation
|
||||
"""
|
||||
# precondition
|
||||
assert (
|
||||
isinstance(x, Vector)
|
||||
and isinstance(y, Vector)
|
||||
and (isinstance(scalar, (int, float)))
|
||||
)
|
||||
assert isinstance(x, Vector)
|
||||
assert isinstance(y, Vector)
|
||||
assert isinstance(scalar, (int, float))
|
||||
return x * scalar + y
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user