From 88bf96f4e6e26c8bed5549121da333aa035b89c3 Mon Sep 17 00:00:00 2001 From: Satyam Koshta <58166232+satyamkoshta340@users.noreply.github.com> Date: Mon, 19 Oct 2020 10:51:33 +0530 Subject: [PATCH 01/28] Add files via upload adding solution for isprime number --- mathgen.py | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 mathgen.py diff --git a/mathgen.py b/mathgen.py new file mode 100644 index 0000000..60e5981 --- /dev/null +++ b/mathgen.py @@ -0,0 +1,32 @@ +import random +genList =[] +class Generator: + def __init__(self, title, id, generalProb, generalSol, func): + self.title = title + self.id = id + self.generalProb = generalProb + self.generalSol = generalSol + self.func = func + genList.append([id, title, self]) + def __str__(self): + return str(self.id) + " " + self.title + " " + self.generalProb + " " + self.generalSol + def __call__(self, **kwargs): + return self.func(**kwargs) + +def isprime(max_a =100): + a =random.randint(2,max_a) + problem =a + if a == 2: + solution = True + return problem,solution + if a % 2 == 0: + solution = False + return problem,solution + for i in range(3, a // 2 + 1, 2): + if a % i == 0: + solution = False + return problem, solution + solution = True + return problem, solution + +is_prime = Generator("isprime", 61, "a any positive integer", "True/False", isprime) From a0fe001e60077779824b0ad25fc36a33c28d8f91 Mon Sep 17 00:00:00 2001 From: Satyam Koshta <58166232+satyamkoshta340@users.noreply.github.com> Date: Mon, 19 Oct 2020 11:11:26 +0530 Subject: [PATCH 02/28] Update mathgen.py --- mathgen.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mathgen.py b/mathgen.py index 60e5981..6ee4b89 100644 --- a/mathgen.py +++ b/mathgen.py @@ -29,4 +29,4 @@ def isprime(max_a =100): solution = True return problem, solution -is_prime = Generator("isprime", 61, "a any positive integer", "True/False", isprime) +is_prime = Generator("isprime", 61, "a any positive integer", "True/False", isprime()) From d2d224425a3317588a93efea32eee63922277fd5 Mon Sep 17 00:00:00 2001 From: Satyam Koshta <58166232+satyamkoshta340@users.noreply.github.com> Date: Mon, 19 Oct 2020 11:23:14 +0530 Subject: [PATCH 03/28] Create isprime.py Added solution for isprime --- mathgenerator/funcs/isprime.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 mathgenerator/funcs/isprime.py diff --git a/mathgenerator/funcs/isprime.py b/mathgenerator/funcs/isprime.py new file mode 100644 index 0000000..c45138c --- /dev/null +++ b/mathgenerator/funcs/isprime.py @@ -0,0 +1,18 @@ +__init__ import * +def isprime(max_a =100): + a =random.randint(2,max_a) + problem =a + if a == 2: + solution = True + return problem,solution + if a % 2 == 0: + solution = False + return problem,solution + for i in range(3, a // 2 + 1, 2): + if a % i == 0: + solution = False + return problem, solution + solution = True + return problem, solution + +is_prime = Generator("isprime", 61, "a any positive integer", "True/False", isprime()) From da33be5469d9104dc6e4e9abaa08cc802731cfc3 Mon Sep 17 00:00:00 2001 From: Satyam Koshta <58166232+satyamkoshta340@users.noreply.github.com> Date: Mon, 19 Oct 2020 11:24:33 +0530 Subject: [PATCH 04/28] Update __init__.py --- mathgenerator/funcs/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/mathgenerator/funcs/__init__.py b/mathgenerator/funcs/__init__.py index efb1ce7..457a4ae 100644 --- a/mathgenerator/funcs/__init__.py +++ b/mathgenerator/funcs/__init__.py @@ -71,3 +71,4 @@ from .multiplyComplexNumbersFunc import * from .geomProgrFunc import * from .geometricMeanFunc import * from .harmonicMeanFunc import * +from .isprime import * From dbccb4d38a470859ad23f302f2b41b679727666d Mon Sep 17 00:00:00 2001 From: Satyam Koshta <58166232+satyamkoshta340@users.noreply.github.com> Date: Mon, 19 Oct 2020 11:25:35 +0530 Subject: [PATCH 05/28] Update isprime.py --- mathgenerator/funcs/isprime.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mathgenerator/funcs/isprime.py b/mathgenerator/funcs/isprime.py index c45138c..fee046e 100644 --- a/mathgenerator/funcs/isprime.py +++ b/mathgenerator/funcs/isprime.py @@ -1,4 +1,4 @@ -__init__ import * +.__init__ import * def isprime(max_a =100): a =random.randint(2,max_a) problem =a @@ -15,4 +15,4 @@ def isprime(max_a =100): solution = True return problem, solution -is_prime = Generator("isprime", 61, "a any positive integer", "True/False", isprime()) +is_prime = Generator("isprime", 74, "a any positive integer", "True/False", isprime()) From 9805f810910f4019f57b3c99d925641d8d386218 Mon Sep 17 00:00:00 2001 From: Satyam Koshta <58166232+satyamkoshta340@users.noreply.github.com> Date: Mon, 19 Oct 2020 11:32:01 +0530 Subject: [PATCH 06/28] Update mathgen.py --- mathgen.py | 58 +++++++++++++++++++++++++++--------------------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/mathgen.py b/mathgen.py index 6ee4b89..3eb6ea8 100644 --- a/mathgen.py +++ b/mathgen.py @@ -1,32 +1,32 @@ -import random -genList =[] -class Generator: - def __init__(self, title, id, generalProb, generalSol, func): - self.title = title - self.id = id - self.generalProb = generalProb - self.generalSol = generalSol - self.func = func - genList.append([id, title, self]) - def __str__(self): - return str(self.id) + " " + self.title + " " + self.generalProb + " " + self.generalSol - def __call__(self, **kwargs): - return self.func(**kwargs) +# import random +# genList =[] +# class Generator: +# def __init__(self, title, id, generalProb, generalSol, func): +# self.title = title +# self.id = id +# self.generalProb = generalProb +# self.generalSol = generalSol +# self.func = func +# genList.append([id, title, self]) +# def __str__(self): +# return str(self.id) + " " + self.title + " " + self.generalProb + " " + self.generalSol +# def __call__(self, **kwargs): +# return self.func(**kwargs) -def isprime(max_a =100): - a =random.randint(2,max_a) - problem =a - if a == 2: - solution = True - return problem,solution - if a % 2 == 0: - solution = False - return problem,solution - for i in range(3, a // 2 + 1, 2): - if a % i == 0: - solution = False - return problem, solution - solution = True - return problem, solution +# def isprime(max_a =100): +# a =random.randint(2,max_a) +# problem =a +# if a == 2: +# solution = True +# return problem,solution +# if a % 2 == 0: +# solution = False +# return problem,solution +# for i in range(3, a // 2 + 1, 2): +# if a % i == 0: +# solution = False +# return problem, solution +# solution = True +# return problem, solution is_prime = Generator("isprime", 61, "a any positive integer", "True/False", isprime()) From 1023beeb9badece0869b3f3c3e94b46a97c939ed Mon Sep 17 00:00:00 2001 From: Satyam Koshta <58166232+satyamkoshta340@users.noreply.github.com> Date: Mon, 19 Oct 2020 11:33:25 +0530 Subject: [PATCH 07/28] Update isprime.py --- mathgenerator/funcs/isprime.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mathgenerator/funcs/isprime.py b/mathgenerator/funcs/isprime.py index fee046e..7851f9a 100644 --- a/mathgenerator/funcs/isprime.py +++ b/mathgenerator/funcs/isprime.py @@ -15,4 +15,4 @@ def isprime(max_a =100): solution = True return problem, solution -is_prime = Generator("isprime", 74, "a any positive integer", "True/False", isprime()) +# is_prime = Generator("isprime", 74, "a any positive integer", "True/False", isprime()) From 8e6388d661590880e1ccd00bbb9ec4b7855cc7a6 Mon Sep 17 00:00:00 2001 From: Satyam Koshta <58166232+satyamkoshta340@users.noreply.github.com> Date: Mon, 19 Oct 2020 11:41:18 +0530 Subject: [PATCH 08/28] Update mathgen.py --- mathgen.py | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/mathgen.py b/mathgen.py index 3eb6ea8..71c2c7a 100644 --- a/mathgen.py +++ b/mathgen.py @@ -13,20 +13,20 @@ # def __call__(self, **kwargs): # return self.func(**kwargs) -# def isprime(max_a =100): -# a =random.randint(2,max_a) -# problem =a -# if a == 2: -# solution = True -# return problem,solution -# if a % 2 == 0: -# solution = False -# return problem,solution -# for i in range(3, a // 2 + 1, 2): -# if a % i == 0: -# solution = False -# return problem, solution -# solution = True -# return problem, solution +def isprime(max_a =100): + a =random.randint(2,max_a) + problem =a + if a == 2: + solution = True + return problem,solution + if a % 2 == 0: + solution = False + return problem,solution + for i in range(3, a // 2 + 1, 2): + if a % i == 0: + solution = False + return problem, solution + solution = True + return problem, solution -is_prime = Generator("isprime", 61, "a any positive integer", "True/False", isprime()) +is_prime = Generator("isprime", 74, "a any positive integer", "True/False", isprime()) From 81cbc2123828c2cd358632bb7582a2df31227457 Mon Sep 17 00:00:00 2001 From: Satyam Koshta <58166232+satyamkoshta340@users.noreply.github.com> Date: Mon, 19 Oct 2020 13:34:31 +0530 Subject: [PATCH 09/28] Update mathgen.py --- mathgen.py | 32 ++++++++------------------------ 1 file changed, 8 insertions(+), 24 deletions(-) diff --git a/mathgen.py b/mathgen.py index 71c2c7a..0496c70 100644 --- a/mathgen.py +++ b/mathgen.py @@ -1,32 +1,16 @@ -# import random -# genList =[] -# class Generator: -# def __init__(self, title, id, generalProb, generalSol, func): -# self.title = title -# self.id = id -# self.generalProb = generalProb -# self.generalSol = generalSol -# self.func = func -# genList.append([id, title, self]) -# def __str__(self): -# return str(self.id) + " " + self.title + " " + self.generalProb + " " + self.generalSol -# def __call__(self, **kwargs): -# return self.func(**kwargs) - -def isprime(max_a =100): - a =random.randint(2,max_a) - problem =a +def isprime(max_a = 100): + a = random.randint(2, max_a) + problem = a if a == 2: solution = True - return problem,solution - if a % 2 == 0: + return problem, solution + if a%2 == 0: solution = False return problem,solution - for i in range(3, a // 2 + 1, 2): - if a % i == 0: + for i in range(3, (a//2)+1, 2): + if a%i == 0: solution = False return problem, solution solution = True return problem, solution - -is_prime = Generator("isprime", 74, "a any positive integer", "True/False", isprime()) +is_prime = Generator("isprime", 74, "a any positive integer", "True/False", isprime) From 900da1cb36707ad72dd0c56b2b70c71e7cea8e62 Mon Sep 17 00:00:00 2001 From: Satyam Koshta <58166232+satyamkoshta340@users.noreply.github.com> Date: Mon, 19 Oct 2020 13:38:37 +0530 Subject: [PATCH 10/28] Update mathgen.py --- mathgen.py | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/mathgen.py b/mathgen.py index 0496c70..b0a426a 100644 --- a/mathgen.py +++ b/mathgen.py @@ -1,16 +1,23 @@ -def isprime(max_a = 100): +#!/usr/bin/python +# -*- coding: utf-8 -*- + + +def isprime(max_a=100): a = random.randint(2, max_a) problem = a if a == 2: solution = True - return problem, solution - if a%2 == 0: + return (problem, solution) + if a % 2 == 0: solution = False - return problem,solution - for i in range(3, (a//2)+1, 2): - if a%i == 0: + return (problem, solution) + for i in range(3, a // 2 + 1, 2): + if a % i == 0: solution = False - return problem, solution + return (problem, solution) solution = True - return problem, solution -is_prime = Generator("isprime", 74, "a any positive integer", "True/False", isprime) + return (problem, solution) + + +is_prime = Generator('isprime', 74, 'a any positive integer', + 'True/False', isprime) From 2e55c7798a06e7b70139dadc67e9adafdaac7a38 Mon Sep 17 00:00:00 2001 From: Satyam Koshta <58166232+satyamkoshta340@users.noreply.github.com> Date: Mon, 19 Oct 2020 14:19:54 +0530 Subject: [PATCH 11/28] Update isprime.py --- mathgenerator/funcs/isprime.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/mathgenerator/funcs/isprime.py b/mathgenerator/funcs/isprime.py index 7851f9a..b24b2c1 100644 --- a/mathgenerator/funcs/isprime.py +++ b/mathgenerator/funcs/isprime.py @@ -1,18 +1,18 @@ .__init__ import * -def isprime(max_a =100): - a =random.randint(2,max_a) - problem =a + + +def isprime(max_a=100): + a = random.randint(2, max_a) + problem = a if a == 2: solution = True - return problem,solution + return (problem, solution) if a % 2 == 0: solution = False - return problem,solution + return (problem, solution) for i in range(3, a // 2 + 1, 2): if a % i == 0: solution = False - return problem, solution + return (problem, solution) solution = True - return problem, solution - -# is_prime = Generator("isprime", 74, "a any positive integer", "True/False", isprime()) + return (problem, solution) From eadc644e0da40a6975966794dd22f9b2b9b9425f Mon Sep 17 00:00:00 2001 From: Satyam Koshta <58166232+satyamkoshta340@users.noreply.github.com> Date: Mon, 19 Oct 2020 14:32:43 +0530 Subject: [PATCH 12/28] Update mathgen.py --- mathgen.py | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/mathgen.py b/mathgen.py index b0a426a..85a8f3d 100644 --- a/mathgen.py +++ b/mathgen.py @@ -1,5 +1,24 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- +import random + + +genList = [] + + +# || Generator class +class Generator: + def __init__(self, title, id, generalProb, generalSol, func): + self.title = title + self.id = id + self.generalProb = generalProb + self.generalSol = generalSol + self.func = func + genList.append([id, title, self]) + + def __str__(self): + return str(self.id) + " " + self.title + " " + self.generalProb + " " + self.generalSol + + def __call__(self, **kwargs): + return self.func(**kwargs) def isprime(max_a=100): From 653d043898992a69b2abf8ad97ddd2b9edf7eae4 Mon Sep 17 00:00:00 2001 From: Satyam Koshta <58166232+satyamkoshta340@users.noreply.github.com> Date: Mon, 19 Oct 2020 15:16:08 +0530 Subject: [PATCH 13/28] Update isprime.py --- mathgenerator/funcs/isprime.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mathgenerator/funcs/isprime.py b/mathgenerator/funcs/isprime.py index b24b2c1..9f79464 100644 --- a/mathgenerator/funcs/isprime.py +++ b/mathgenerator/funcs/isprime.py @@ -1,4 +1,4 @@ -.__init__ import * +__init__ import * def isprime(max_a=100): From e467f7ec7c641382fb0a7870fffa553a9da2f5a0 Mon Sep 17 00:00:00 2001 From: Satyam Koshta <58166232+satyamkoshta340@users.noreply.github.com> Date: Mon, 19 Oct 2020 15:35:25 +0530 Subject: [PATCH 14/28] Update isprime.py --- mathgenerator/funcs/isprime.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mathgenerator/funcs/isprime.py b/mathgenerator/funcs/isprime.py index 9f79464..ce5a58d 100644 --- a/mathgenerator/funcs/isprime.py +++ b/mathgenerator/funcs/isprime.py @@ -1,4 +1,4 @@ -__init__ import * +from __init__ import * def isprime(max_a=100): From 611469ec38de3521aca10b74cff87cdf63860008 Mon Sep 17 00:00:00 2001 From: Satyam Koshta <58166232+satyamkoshta340@users.noreply.github.com> Date: Tue, 20 Oct 2020 07:20:33 +0530 Subject: [PATCH 15/28] Update mathgen.py --- mathgen.py | 1 + 1 file changed, 1 insertion(+) diff --git a/mathgen.py b/mathgen.py index 85a8f3d..ffb2ebe 100644 --- a/mathgen.py +++ b/mathgen.py @@ -40,3 +40,4 @@ def isprime(max_a=100): is_prime = Generator('isprime', 74, 'a any positive integer', 'True/False', isprime) +print(is_prime.func) From 979e9fa9f11fae428de6492b9d3a1d0df259d01d Mon Sep 17 00:00:00 2001 From: Satyam Koshta <58166232+satyamkoshta340@users.noreply.github.com> Date: Tue, 20 Oct 2020 07:26:44 +0530 Subject: [PATCH 16/28] Update isprime.py --- mathgenerator/funcs/isprime.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mathgenerator/funcs/isprime.py b/mathgenerator/funcs/isprime.py index ce5a58d..b24b2c1 100644 --- a/mathgenerator/funcs/isprime.py +++ b/mathgenerator/funcs/isprime.py @@ -1,4 +1,4 @@ -from __init__ import * +.__init__ import * def isprime(max_a=100): From 8bf56dc57d1654bdd73bf1991db7a3b54adfd6b6 Mon Sep 17 00:00:00 2001 From: Satyam Koshta <58166232+satyamkoshta340@users.noreply.github.com> Date: Tue, 20 Oct 2020 07:31:26 +0530 Subject: [PATCH 17/28] Update isprime.py --- mathgenerator/funcs/isprime.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mathgenerator/funcs/isprime.py b/mathgenerator/funcs/isprime.py index b24b2c1..ce5a58d 100644 --- a/mathgenerator/funcs/isprime.py +++ b/mathgenerator/funcs/isprime.py @@ -1,4 +1,4 @@ -.__init__ import * +from __init__ import * def isprime(max_a=100): From 047cd7289e76ebe508058118283f28bdca93b856 Mon Sep 17 00:00:00 2001 From: Satyam Koshta <58166232+satyamkoshta340@users.noreply.github.com> Date: Tue, 20 Oct 2020 07:38:20 +0530 Subject: [PATCH 18/28] Update isprime.py --- mathgenerator/funcs/isprime.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mathgenerator/funcs/isprime.py b/mathgenerator/funcs/isprime.py index ce5a58d..9da7bfb 100644 --- a/mathgenerator/funcs/isprime.py +++ b/mathgenerator/funcs/isprime.py @@ -1,4 +1,4 @@ -from __init__ import * +from .__init__ import * def isprime(max_a=100): From ed77e8b986f680ce94f89cc02990fff474f6aab2 Mon Sep 17 00:00:00 2001 From: lukew3 Date: Tue, 20 Oct 2020 13:21:31 -0400 Subject: [PATCH 19/28] isprime fix --- mathgen.py | 43 ------------------- mathgenerator/funcs/__init__.py | 2 +- .../funcs/{isprime.py => is_prime.py} | 4 ++ 3 files changed, 5 insertions(+), 44 deletions(-) delete mode 100644 mathgen.py rename mathgenerator/funcs/{isprime.py => is_prime.py} (80%) diff --git a/mathgen.py b/mathgen.py deleted file mode 100644 index ffb2ebe..0000000 --- a/mathgen.py +++ /dev/null @@ -1,43 +0,0 @@ -import random - - -genList = [] - - -# || Generator class -class Generator: - def __init__(self, title, id, generalProb, generalSol, func): - self.title = title - self.id = id - self.generalProb = generalProb - self.generalSol = generalSol - self.func = func - genList.append([id, title, self]) - - def __str__(self): - return str(self.id) + " " + self.title + " " + self.generalProb + " " + self.generalSol - - def __call__(self, **kwargs): - return self.func(**kwargs) - - -def isprime(max_a=100): - a = random.randint(2, max_a) - problem = a - if a == 2: - solution = True - return (problem, solution) - if a % 2 == 0: - solution = False - return (problem, solution) - for i in range(3, a // 2 + 1, 2): - if a % i == 0: - solution = False - return (problem, solution) - solution = True - return (problem, solution) - - -is_prime = Generator('isprime', 74, 'a any positive integer', - 'True/False', isprime) -print(is_prime.func) diff --git a/mathgenerator/funcs/__init__.py b/mathgenerator/funcs/__init__.py index bf59c56..56a2fd5 100644 --- a/mathgenerator/funcs/__init__.py +++ b/mathgenerator/funcs/__init__.py @@ -94,4 +94,4 @@ from .degree_to_rad import * from .radian_to_deg import * from .differentiation import * from .definite_integral import * -from .isprime import * \ No newline at end of file +from .is_prime import * diff --git a/mathgenerator/funcs/isprime.py b/mathgenerator/funcs/is_prime.py similarity index 80% rename from mathgenerator/funcs/isprime.py rename to mathgenerator/funcs/is_prime.py index 9da7bfb..143f4d3 100644 --- a/mathgenerator/funcs/isprime.py +++ b/mathgenerator/funcs/is_prime.py @@ -16,3 +16,7 @@ def isprime(max_a=100): return (problem, solution) solution = True return (problem, solution) + + +is_prime = Generator('isprime', 90, 'a any positive integer', + 'True/False', isprime) From 4ca54936fb79b2cf6dfb1a1ea7c43b23709adb25 Mon Sep 17 00:00:00 2001 From: lukew3 Date: Tue, 20 Oct 2020 13:32:34 -0400 Subject: [PATCH 20/28] Fix imports --- dev-requirements.txt | 1 + mathgenerator/funcs/definite_integral.py | 1 + mathgenerator/mathgen.py | 5 +---- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/dev-requirements.txt b/dev-requirements.txt index 259022d..0226baf 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -4,3 +4,4 @@ flake8 autopep8 sympy numpy +scipy diff --git a/mathgenerator/funcs/definite_integral.py b/mathgenerator/funcs/definite_integral.py index 9dc6290..6e8453f 100644 --- a/mathgenerator/funcs/definite_integral.py +++ b/mathgenerator/funcs/definite_integral.py @@ -1,4 +1,5 @@ from .__init__ import * +import scipy from scipy.integrate import quad diff --git a/mathgenerator/mathgen.py b/mathgenerator/mathgen.py index b724345..2a969fa 100644 --- a/mathgenerator/mathgen.py +++ b/mathgenerator/mathgen.py @@ -1,9 +1,6 @@ -import random -import math -import fractions from .funcs import * from .__init__ import getGenList -import scipy + genList = getGenList() From 869207bdb521746472e47ac9d9e9d8f555f74176 Mon Sep 17 00:00:00 2001 From: Mo <58116522+Metropass@users.noreply.github.com> Date: Tue, 20 Oct 2020 13:55:21 -0400 Subject: [PATCH 21/28] Fixed Issue #289 Removed the multiplication, added '+' for proper concatenation --- mathgenerator/funcs/decimal_to_roman_numerals.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mathgenerator/funcs/decimal_to_roman_numerals.py b/mathgenerator/funcs/decimal_to_roman_numerals.py index 46a1ebd..63b64f2 100644 --- a/mathgenerator/funcs/decimal_to_roman_numerals.py +++ b/mathgenerator/funcs/decimal_to_roman_numerals.py @@ -15,7 +15,7 @@ def decimalToRomanNumeralsFunc(maxDecimal=4000): if last_value <= 3: solution += (roman_dict[divisor] * last_value) elif last_value == 4: - solution += (roman_dict[divisor] * roman_dict[divisor * 5]) + solution += (roman_dict[divisor] + roman_dict[divisor * 5]) elif 5 <= last_value <= 8: solution += (roman_dict[divisor * 5] + (roman_dict[divisor] * (last_value - 5))) elif last_value == 9: From 46c396bc4fb4e669aa6471502401f297c90f67f5 Mon Sep 17 00:00:00 2001 From: lukew3 Date: Tue, 20 Oct 2020 14:02:16 -0400 Subject: [PATCH 22/28] cache workflow update --- .github/workflows/tests.yaml | 18 ++++++++++++++++++ setup.py | 6 +++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index cc6cf9d..c28d903 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -9,15 +9,33 @@ jobs: steps: - uses: actions/checkout@v2 + - name: Set up Python uses: actions/setup-python@v2 with: python-version: '3.x' + + - name: Cache Primes + id: myCacheStep + uses: actions/cache@v2 + env: + cache-name: cache-pip-modules + with: + path: ~/.pip + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + - name: Install dependencies + if: steps.myCacheStep.outputs.cache-hit != 'true' run: | python -m pip install -U pip python -m pip install -r dev-requirements.txt + - name: Linter run: make lint + - name: Test run: make test diff --git a/setup.py b/setup.py index 4bfbcd0..10f5f36 100644 --- a/setup.py +++ b/setup.py @@ -8,5 +8,9 @@ setup(name='mathgenerator', author_email='lukew25073@gmail.com', license='MIT', packages=find_packages(), - install_requires=[], + install_requires=[ + sympy, + numpy, + scipy + ], entry_points={}) From d3c6d5d988566e552dfe9192328cf0a2b16835b0 Mon Sep 17 00:00:00 2001 From: lukew3 Date: Tue, 20 Oct 2020 14:05:43 -0400 Subject: [PATCH 23/28] fix install requires --- setup.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index 10f5f36..fbbebfd 100644 --- a/setup.py +++ b/setup.py @@ -9,8 +9,8 @@ setup(name='mathgenerator', license='MIT', packages=find_packages(), install_requires=[ - sympy, - numpy, - scipy + 'sympy', + 'numpy', + 'scipy' ], entry_points={}) From 05711e6bdfda27153b523e095c43c750c66ad2da Mon Sep 17 00:00:00 2001 From: lukew3 Date: Tue, 20 Oct 2020 14:20:54 -0400 Subject: [PATCH 24/28] Change cachestep name --- .github/workflows/tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index c28d903..87ced74 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -15,7 +15,7 @@ jobs: with: python-version: '3.x' - - name: Cache Primes + - name: Cache Dependencies id: myCacheStep uses: actions/cache@v2 env: From c165a176d06db1c1e70a7b5fd046c62d889b6d0e Mon Sep 17 00:00:00 2001 From: lukew3 Date: Tue, 20 Oct 2020 14:32:20 -0400 Subject: [PATCH 25/28] cache test --- test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test.py b/test.py index 74d73ce..2fa65b7 100644 --- a/test.py +++ b/test.py @@ -10,4 +10,4 @@ for item in list: print(item[2]) # print(mathgen.getGenList()) -print(mathgen.genById(89)) +print(mathgen.genById(85)) From 0a9b54ab0e2bdfd2f186a06205da8d24a3871122 Mon Sep 17 00:00:00 2001 From: lukew3 Date: Tue, 20 Oct 2020 19:34:23 -0400 Subject: [PATCH 26/28] update cache workflow --- .github/workflows/tests.yaml | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 87ced74..d66144a 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -15,24 +15,17 @@ jobs: with: python-version: '3.x' - - name: Cache Dependencies - id: myCacheStep - uses: actions/cache@v2 - env: - cache-name: cache-pip-modules + - uses: actions/cache@v1 with: - path: ~/.pip - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + path: ~/.cache/pip + key: ${{ runner.os }}-pip-${{ hashFiles('**/dev-requirements.txt') }} restore-keys: | - ${{ runner.os }}-build-${{ env.cache-name }}- - ${{ runner.os }}-build- - ${{ runner.os }}- + ${{ runner.os }}-pip- - - name: Install dependencies - if: steps.myCacheStep.outputs.cache-hit != 'true' + - name: Install Dependencies + if: steps.cache.outputs.cache-hit != 'true' run: | - python -m pip install -U pip - python -m pip install -r dev-requirements.txt + pip install -r dev-requirements.txt - name: Linter run: make lint From a6f784a5d078edfd170bb727e161bfef97bd2452 Mon Sep 17 00:00:00 2001 From: lukew3 Date: Tue, 20 Oct 2020 19:54:01 -0400 Subject: [PATCH 27/28] test github actions cache --- .github/workflows/python-publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index 4e1ef42..495e3c3 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -1,5 +1,5 @@ # This workflows will upload a Python Package using Twine when a release is created -# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries +# For more information see https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries name: Upload Python Package From 8cde00c324377d4dfebad9f337b4b23ff96aed17 Mon Sep 17 00:00:00 2001 From: Luke Weiler Date: Tue, 20 Oct 2020 21:16:27 -0400 Subject: [PATCH 28/28] Update setup.py --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index fbbebfd..7b022b4 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ from setuptools import setup, find_packages setup(name='mathgenerator', - version='1.1.3', + version='1.1.4', description='An open source solution for generating math problems', url='https://github.com/todarith/mathgenerator', author='Luke Weiler',