From 6e11124a1cd3840dfc1b78f8f3cdea5b02f65744 Mon Sep 17 00:00:00 2001 From: lukew3 Date: Fri, 2 Jun 2023 10:34:13 -0400 Subject: [PATCH] lint fixes --- mathgenerator/algebra.py | 7 +++---- mathgenerator/computer_science.py | 4 +--- mathgenerator/misc.py | 3 +-- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/mathgenerator/algebra.py b/mathgenerator/algebra.py index c6f299a..ed56d5a 100644 --- a/mathgenerator/algebra.py +++ b/mathgenerator/algebra.py @@ -158,7 +158,8 @@ def distance_two_points(max_val_xy=20, min_val_xy=-20): | --- | --- | | Find the distance between $(-19, -6)$ and $(15, -16)$ | $\sqrt{1256}$ | """ - if max_val_xy < min_val_xy: max_val_xy, min_val_xy = min_val_xy, max_val_xy + if max_val_xy < min_val_xy: + max_val_xy, min_val_xy = min_val_xy, max_val_xy point1X = random.randint(min_val_xy, max_val_xy + 1) point1Y = random.randint(min_val_xy, max_val_xy + 1) @@ -503,9 +504,7 @@ def line_equation_from_2_points(max_val=20): y2 = random.randint(-max_val, max_val) m1 = (y2 - y1) // math.gcd(y2 - y1, x2 - x1) m2 = (x2 - x1) // math.gcd(y2 - y1, x2 - x1) - c1 = (y1 * (x2 - x1) - - (y2 - y1) * x1) // math.gcd(y1 * (x2 - x1) - (y2 - y1) * x1, - (x2 - x1)) + c1 = (y1 * (x2 - x1) - (y2 - y1) * x1) // math.gcd(y1 * (x2 - x1) - (y2 - y1) * x1, (x2 - x1)) c2 = (x2 - x1) // math.gcd(y1 * (x2 - x1) - (y2 - y1) * x1, (x2 - x1)) c = rf"{'+' if c1 >= 0 else '-'}\frac{{{abs(c1)}}}{{{c2}}}" if c1 != 0 else "" if c2 < 0: diff --git a/mathgenerator/computer_science.py b/mathgenerator/computer_science.py index b772511..c3a3898 100644 --- a/mathgenerator/computer_science.py +++ b/mathgenerator/computer_science.py @@ -261,9 +261,7 @@ def createTribSeries(i): tribSeries = [] for idx in range(i): if idx not in tribDict: - tribDict[idx] = tribDict[idx - - 1] + tribDict[idx - - 2] + tribDict[idx - 3] + tribDict[idx] = tribDict[idx - 1] + tribDict[idx - 2] + tribDict[idx - 3] tribSeries.append(tribDict[idx]) return tribSeries diff --git a/mathgenerator/misc.py b/mathgenerator/misc.py index d0e1e33..80b6b13 100644 --- a/mathgenerator/misc.py +++ b/mathgenerator/misc.py @@ -220,8 +220,7 @@ def decimal_to_roman_numerals(max_decimal=4000): elif last_value == 4: solution += (roman_dict[div] + roman_dict[div * 5]) elif 5 <= last_value <= 8: - solution += (roman_dict[div * 5] + (roman_dict[div] * - (last_value - 5))) + solution += (roman_dict[div * 5] + (roman_dict[div] * (last_value - 5))) elif last_value == 9: solution += (roman_dict[div] + roman_dict[div * 10]) x = math.floor(x % div)