From 4b38f210177d711733c43ef6113a0b84973c2905 Mon Sep 17 00:00:00 2001 From: lukew3 Date: Sat, 5 Nov 2022 14:11:29 -0400 Subject: [PATCH] fix linter issues --- mathgenerator/__init__.py | 2 ++ mathgenerator/funcs/algebra/intersection_of_two_lines.py | 4 ++-- mathgenerator/funcs/geometry/surface_area_pyramid.py | 4 ++-- mathgenerator/funcs/geometry/volume_pyramid.py | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/mathgenerator/__init__.py b/mathgenerator/__init__.py index 1e88f8b..d2cd596 100644 --- a/mathgenerator/__init__.py +++ b/mathgenerator/__init__.py @@ -11,6 +11,8 @@ genList = [] SEP = os.sep class Generator: + + def __init__(self, title, id, func, kwargs): self.title = title self.id = id diff --git a/mathgenerator/funcs/algebra/intersection_of_two_lines.py b/mathgenerator/funcs/algebra/intersection_of_two_lines.py index a9a4c5d..8bb42c2 100644 --- a/mathgenerator/funcs/algebra/intersection_of_two_lines.py +++ b/mathgenerator/funcs/algebra/intersection_of_two_lines.py @@ -18,13 +18,13 @@ def gen_func(minM=-10, """ if m[0] == 0: m = 0 - elif abs(m[0]) == abs(m[1]): + elif abs(m[0]) == abs(m[1]): m = m[0] // m[1] elif m[1] == 1: m = m[0] else: m = f"{m[0]}/{m[1]}" - base = f"y =" + base = "y =" if m != 0: if m == 1: base = f"{base} x" diff --git a/mathgenerator/funcs/geometry/surface_area_pyramid.py b/mathgenerator/funcs/geometry/surface_area_pyramid.py index 3ddef67..fd47d0c 100644 --- a/mathgenerator/funcs/geometry/surface_area_pyramid.py +++ b/mathgenerator/funcs/geometry/surface_area_pyramid.py @@ -29,7 +29,7 @@ def gen_func(unit='m', format='string'): # Calculate base area base = 4 * half_width * half_length - ans = base + 2*triangle_1 + 2*triangle_2 + ans = base + 2 * triangle_1 + 2 * triangle_2 if format == 'string': problem = f"Surface area of pyramid with base length = {2*half_length}{unit}, base width = {2*half_width}{unit}, and height = {height}{unit}" @@ -38,7 +38,7 @@ def gen_func(unit='m', format='string'): elif format == 'latex': return "Latex unavailable" else: - return 2*half_length, 2*half_width, height, ans, unit + return 2 * half_length, 2 * half_width, height, ans, unit surface_area_pyramid = Generator("Surface area of pyramid", 123, gen_func, diff --git a/mathgenerator/funcs/geometry/volume_pyramid.py b/mathgenerator/funcs/geometry/volume_pyramid.py index f69d2a9..b0eba2a 100644 --- a/mathgenerator/funcs/geometry/volume_pyramid.py +++ b/mathgenerator/funcs/geometry/volume_pyramid.py @@ -6,7 +6,7 @@ def gen_func(maxLength=20, maxWidth=20, maxHeight=50, unit='m', format='string') w = random.randint(1, maxWidth) h = random.randint(1, maxHeight) - ans = (l*w*h)/3 + ans = (l * w * h) / 3 if format == 'string': problem = f"Volume of pyramid with base length = {l} {unit}, base width = {w} {unit} and height = {h} {unit} is"