Merge pull request #335 from lukew3/organize-generators

Organize generators
This commit is contained in:
Luke Weiler
2020-11-20 21:00:12 -05:00
committed by GitHub
124 changed files with 175 additions and 116 deletions

27
makeinit.py Normal file
View File

@@ -0,0 +1,27 @@
import os
def get_filepaths(directory):
"""
This function will generate the file names in a directory
tree by walking the tree either top-down or bottom-up. For each
directory in the tree rooted at directory top (including top itself),
it yields a 3-tuple (dirpath, dirnames, filenames).
"""
file_paths = [] # List which will store all of the full filepaths.
# Walk the tree.
for root, directories, files in os.walk(directory):
for filename in files:
# Join the two strings in order to form the full filepath.
filepath = os.path.join(root, filename)
filename = filepath[31:-3]
file_paths.append(filename) # Add it to the list.
return file_paths # Self-explanatory.
# Run the above function and store its results in a variable.
full_file_paths = get_filepaths("mathgenerator/funcs/statistics")
full_file_paths.sort()
#print(full_file_paths)
for item in full_file_paths:
print("from ." + item + " import *")

View File

@@ -1,5 +1,11 @@
import sys import sys
import traceback import traceback
import random
import sympy
import numpy
import scipy
genList = [] genList = []
@@ -15,8 +21,10 @@ class Generator:
text) = traceback.extract_stack()[-2] text) = traceback.extract_stack()[-2]
funcname = filename[filename.rfind('/'):].strip() funcname = filename[filename.rfind('/'):].strip()
funcname = funcname[1:-3] funcname = funcname[1:-3]
# print(funcname) groupname = filename[:filename.rfind('/')].strip()
genList.append([id, title, self, funcname]) groupname = groupname[groupname.rfind('/'):].strip()
groupname = groupname[1:]
genList.append([id, title, self, funcname, groupname])
def __str__(self): def __str__(self):
return str( return str(
@@ -29,4 +37,6 @@ class Generator:
def getGenList(): def getGenList():
correctedList = genList[-1:] + genList[:-1] correctedList = genList[-1:] + genList[:-1]
# Orders list by id
correctedList.sort()
return correctedList return correctedList

View File

@@ -4,116 +4,10 @@ import fractions
from ..__init__ import * from ..__init__ import *
from .addition import * from .algebra import *
from .subtraction import * from .basic_math import *
from .multiplication import * from .calculus import *
from .division import * from .computer_science import *
from .binary_complement_1s import * from .geometry import *
from .modulo_division import * from .misc import *
from .square_root import * from .statistics import *
from .power_rule_differentiation import *
from .square import *
from .lcm import *
from .gcd import *
from .basic_algebra import *
from .log import *
from .complex_division import *
from .decimal_to_binary import *
from .binary_to_decimal import *
from .divide_fractions import *
from .multiply_int_to_22_matrix import *
from .area_of_triangle import *
from .valid_triangle import *
from .midpoint_of_two_points import *
from .factoring import *
from .third_angle_of_triangle import *
from .system_of_equations import *
from .distance_two_points import *
from .pythagorean_theorem import *
from .linear_equations import *
from .prime_factors import *
from .fraction_multiplication import *
from .angle_regular_polygon import *
from .combinations import *
from .factorial import *
from .surface_area_cube import *
from .surface_area_cuboid import *
from .surface_area_cylinder import *
from .volume_cube import *
from .volume_cuboid import *
from .volume_cylinder import *
from .surface_area_cone import *
from .volume_cone import *
from .common_factors import *
from .intersection_of_two_lines import *
from .permutation import *
from .vector_cross import *
from .compare_fractions import *
from .simple_interest import *
from .matrix_multiplication import *
from .cube_root import *
from .power_rule_integration import *
from .fourth_angle_of_quadrilateral import *
from .quadratic_equation import *
from .hcf import *
from .dice_sum_probability import *
from .exponentiation import *
from .confidence_interval import *
from .surds_comparison import *
from .fibonacci_series import *
from .basic_trigonometry import *
from .sum_of_polygon_angles import *
from .data_summary import *
from .surface_area_sphere import *
from .volume_sphere import *
from .nth_fibonacci_number import *
from .profit_loss_percent import *
from .binary_to_hex import *
from .multiply_complex_numbers import *
from .geometric_progression import *
from .geometric_mean import *
from .harmonic_mean import *
from .euclidian_norm import *
from .angle_btw_vectors import *
from .absolute_difference import *
from .vector_dot import *
from .binary_2s_complement import *
from .invert_matrix import *
from .sector_area import *
from .mean_median import *
from .int_matrix_22_determinant import *
from .compound_interest import *
from .decimal_to_hexadeci import *
from .percentage import *
from .celsius_to_fahrenheit import *
from .arithmetic_progression_term import *
from .arithmetic_progression_sum import *
from .decimal_to_octal import *
from .decimal_to_roman_numerals import *
from .degree_to_rad import *
from .radian_to_deg import *
from .differentiation import *
from .definite_integral import *
from .is_prime import *
from .bcd_to_decimal import *
from .complex_to_polar import *
from .set_operation import *
from .base_conversion import *
from .curved_surface_area_cylinder import *
from .perimeter_of_polygons import *
from .power_of_powers import *
from .quotient_of_power_same_base import *
from .quotient_of_power_same_power import *
from .complex_quadratic import *
from .is_leap_year import *
from .minutes_to_hours import *
from .decimal_to_bcd import *
from .circumference import *
from .combine_like_terms import *
from .signum_function import *
from .conditional_probability import *
from .arc_length import *
from .binomial_distribution import *
from .stationary_points import *
from .expanding import *
from .area_of_circle import *

View File

@@ -0,0 +1,23 @@
from ...__init__ import *
from .basic_algebra import *
from .combine_like_terms import *
from .complex_quadratic import *
from .compound_interest import *
from .distance_two_points import *
from .expanding import *
from .factoring import *
from .int_matrix_22_determinant import *
from .intersection_of_two_lines import *
from .invert_matrix import *
from .linear_equations import *
from .log import *
from .matrix_multiplication import *
from .midpoint_of_two_points import *
from .multiply_complex_numbers import *
from .multiply_int_to_22_matrix import *
from .quadratic_equation import *
from .simple_interest import *
from .system_of_equations import *
from .vector_cross import *
from .vector_dot import *

View File

@@ -0,0 +1,19 @@
from ...__init__ import *
from .absolute_difference import *
from .addition import *
from .compare_fractions import *
from .complex_division import *
from .cube_root import *
from .divide_fractions import *
from .division import *
from .exponentiation import *
from .factorial import *
from .fraction_multiplication import *
from .is_prime import *
from .multiplication import *
from .percentage import *
from .power_of_powers import *
from .square import *
from .square_root import *
from .subtraction import *

View File

@@ -0,0 +1,7 @@
from ...__init__ import *
from .definite_integral import *
from .differentiation import *
from .power_rule_differentiation import *
from .power_rule_integration import *
from .stationary_points import *

View File

@@ -0,0 +1,14 @@
from ...__init__ import *
from .bcd_to_decimal import *
from .binary_2s_complement import *
from .binary_complement_1s import *
from .binary_to_decimal import *
from .binary_to_hex import *
from .decimal_to_bcd import *
from .decimal_to_binary import *
from .decimal_to_hexadeci import *
from .decimal_to_octal import *
from .fibonacci_series import *
from .modulo_division import *
from .nth_fibonacci_number import *

View File

@@ -0,0 +1,29 @@
from ...__init__ import *
from .angle_btw_vectors import *
from .angle_regular_polygon import *
from .arc_length import *
from .area_of_circle import *
from .area_of_triangle import *
from .basic_trigonometry import *
from .circumference import *
from .curved_surface_area_cylinder import *
from .degree_to_rad import *
from .fourth_angle_of_quadrilateral import *
from .perimeter_of_polygons import *
from .pythagorean_theorem import *
from .radian_to_deg import *
from .sector_area import *
from .sum_of_polygon_angles import *
from .surface_area_cone import *
from .surface_area_cube import *
from .surface_area_cuboid import *
from .surface_area_cylinder import *
from .surface_area_sphere import *
from .third_angle_of_triangle import *
from .valid_triangle import *
from .volume_cone import *
from .volume_cube import *
from .volume_cuboid import *
from .volume_cylinder import *
from .volume_sphere import *

View File

@@ -0,0 +1,26 @@
from ...__init__ import *
from .arithmetic_progression_sum import *
from .arithmetic_progression_term import *
from .base_conversion import *
from .binomial_distribution import *
from .celsius_to_fahrenheit import *
from .common_factors import *
from .complex_to_polar import *
from .decimal_to_roman_numerals import *
from .euclidian_norm import *
from .gcd import *
from .geometric_mean import *
from .geometric_progression import *
from .harmonic_mean import *
from .hcf import *
from .is_leap_year import *
from .lcm import *
from .minutes_to_hours import *
from .prime_factors import *
from .profit_loss_percent import *
from .quotient_of_power_same_base import *
from .quotient_of_power_same_power import *
from .set_operation import *
from .signum_function import *
from .surds_comparison import *

Some files were not shown because too many files have changed in this diff Show More