pyupgrade --py37-plus **/*.py (#1654)

* pyupgrade --py37-plus **/*.py

* fixup! Format Python code with psf/black push
This commit is contained in:
Christian Clauss
2020-01-03 15:25:36 +01:00
committed by John Law
parent 34c808b375
commit 28419cf839
77 changed files with 71 additions and 128 deletions

View File

@ -148,9 +148,9 @@ def main():
% (matrix_a, matrix_b, multiply(matrix_a, matrix_b))
)
print("Identity: %s \n" % identity(5))
print("Minor of %s = %s \n" % (matrix_c, minor(matrix_c, 1, 2)))
print("Determinant of %s = %s \n" % (matrix_b, determinant(matrix_b)))
print("Inverse of %s = %s\n" % (matrix_d, inverse(matrix_d)))
print("Minor of {} = {} \n".format(matrix_c, minor(matrix_c, 1, 2)))
print("Determinant of {} = {} \n".format(matrix_b, determinant(matrix_b)))
print("Inverse of {} = {}\n".format(matrix_d, inverse(matrix_d)))
if __name__ == "__main__":

View File

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
"""
In this problem, we want to rotate the matrix elements by 90, 180, 270 (counterclockwise)
Discussion in stackoverflow:

View File

@ -2,7 +2,7 @@ def search_in_a_sorted_matrix(mat, m, n, key):
i, j = m - 1, 0
while i >= 0 and j < n:
if key == mat[i][j]:
print("Key %s found at row- %s column- %s" % (key, i + 1, j + 1))
print("Key {} found at row- {} column- {}".format(key, i + 1, j + 1))
return
if key < mat[i][j]:
i -= 1

View File

@ -176,7 +176,7 @@ class Matrix:
return result
else:
raise TypeError(
"Unsupported type given for another (%s)" % (type(another),)
"Unsupported type given for another ({})".format(type(another))
)
def transpose(self):
@ -248,17 +248,17 @@ if __name__ == "__main__":
ainv = Matrix(3, 3, 0)
for i in range(3):
ainv[i, i] = 1
print("a^(-1) is %s" % (ainv,))
print(f"a^(-1) is {ainv}")
# u, v
u = Matrix(3, 1, 0)
u[0, 0], u[1, 0], u[2, 0] = 1, 2, -3
v = Matrix(3, 1, 0)
v[0, 0], v[1, 0], v[2, 0] = 4, -2, 5
print("u is %s" % (u,))
print("v is %s" % (v,))
print(f"u is {u}")
print(f"v is {v}")
print("uv^T is %s" % (u * v.transpose()))
# Sherman Morrison
print("(a + uv^T)^(-1) is %s" % (ainv.ShermanMorrison(u, v),))
print("(a + uv^T)^(-1) is {}".format(ainv.ShermanMorrison(u, v)))
def test2():
import doctest