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

@ -9,9 +9,9 @@ def n31(a: int) -> Tuple[List[int], int]:
"""
if not isinstance(a, int):
raise TypeError("Must be int, not {0}".format(type(a).__name__))
raise TypeError("Must be int, not {}".format(type(a).__name__))
if a < 1:
raise ValueError("Given integer must be greater than 1, not {0}".format(a))
raise ValueError(f"Given integer must be greater than 1, not {a}")
path = [a]
while a != 1:

View File

@ -1 +0,0 @@

View File

@ -37,7 +37,7 @@ def exactPrimeFactorCount(n):
if __name__ == "__main__":
n = 51242183
print(f"The number of distinct prime factors is/are {exactPrimeFactorCount(n)}")
print("The value of log(log(n)) is {0:.4f}".format(math.log(math.log(n))))
print("The value of log(log(n)) is {:.4f}".format(math.log(math.log(n))))
"""
The number of distinct prime factors is/are 3

View File

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
"""
In mathematics, the LucasLehmer test (LLT) is a primality test for Mersenne numbers.
https://en.wikipedia.org/wiki/Lucas%E2%80%93Lehmer_primality_test

View File

@ -10,7 +10,7 @@ https://www.hackerearth.com/practice/notes/matrix-exponentiation-1/
"""
class Matrix(object):
class Matrix:
def __init__(self, arg):
if isinstance(arg, list): # Initialzes a matrix identical to the one provided.
self.t = arg

View File

@ -52,4 +52,4 @@ if __name__ == "__main__":
plt.xlabel("step")
plt.ylabel("error")
plt.show()
print("solution = {%f}, error = {%f}" % (solution, error))
print(f"solution = {{{solution:f}}}, error = {{{error:f}}}")

View File

@ -14,7 +14,7 @@ class Point:
def distance(a: Point, b: Point) -> float:
return math.sqrt(abs(((b.x - a.x) ** 2 + (b.y - a.y) ** 2 + (b.z - a.z) ** 2)))
return math.sqrt(abs((b.x - a.x) ** 2 + (b.y - a.y) ** 2 + (b.z - a.z) ** 2))
def test_distance() -> None:

View File

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
"""
Sieve of Eratosthones