mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-07 03:07:46 +08:00
Follow Flake8 pep3101 and remove modulo formatting (#7339)
* ci: Add ``flake8-pep3101`` plugin to ``pre-commit`` * refactor: Remove all modulo string formatting * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * refactor: Remove ``flake8-pep3101`` plugin from ``pre-commit`` * revert: Revert to modulo formatting * refactor: Use f-string instead of `join` Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:

committed by
GitHub

parent
7f6e0b656f
commit
f15cc2f01c
@ -31,14 +31,14 @@ class Matrix:
|
||||
"""
|
||||
|
||||
# Prefix
|
||||
s = "Matrix consist of %d rows and %d columns\n" % (self.row, self.column)
|
||||
s = f"Matrix consist of {self.row} rows and {self.column} columns\n"
|
||||
|
||||
# Make string identifier
|
||||
max_element_length = 0
|
||||
for row_vector in self.array:
|
||||
for obj in row_vector:
|
||||
max_element_length = max(max_element_length, len(str(obj)))
|
||||
string_format_identifier = "%%%ds" % (max_element_length,)
|
||||
string_format_identifier = f"%{max_element_length}s"
|
||||
|
||||
# Make string and return
|
||||
def single_line(row_vector: list[float]) -> str:
|
||||
@ -252,7 +252,7 @@ if __name__ == "__main__":
|
||||
v[0, 0], v[1, 0], v[2, 0] = 4, -2, 5
|
||||
print(f"u is {u}")
|
||||
print(f"v is {v}")
|
||||
print("uv^T is %s" % (u * v.transpose()))
|
||||
print(f"uv^T is {u * v.transpose()}")
|
||||
# Sherman Morrison
|
||||
print(f"(a + uv^T)^(-1) is {ainv.sherman_morrison(u, v)}")
|
||||
|
||||
|
Reference in New Issue
Block a user