Commit 8d7d8194 by Adam

Merge pull request #843 from edx/adam/calc-refactor

Adam/calc refactor
parents ea36b834 5b0194d9
"""
Ideally, we wouldn't need to pull in all the calc symbols here,
but courses were using 'import calc', so we need this for
backwards compatibility
"""
from calc import *
...@@ -9,7 +9,7 @@ import operator ...@@ -9,7 +9,7 @@ import operator
import numbers import numbers
import numpy import numpy
import scipy.constants import scipy.constants
import calcfunctions import functions
from pyparsing import ( from pyparsing import (
Word, Literal, CaselessLiteral, ZeroOrMore, MatchFirst, Optional, Forward, Word, Literal, CaselessLiteral, ZeroOrMore, MatchFirst, Optional, Forward,
...@@ -20,9 +20,9 @@ DEFAULT_FUNCTIONS = { ...@@ -20,9 +20,9 @@ DEFAULT_FUNCTIONS = {
'sin': numpy.sin, 'sin': numpy.sin,
'cos': numpy.cos, 'cos': numpy.cos,
'tan': numpy.tan, 'tan': numpy.tan,
'sec': calcfunctions.sec, 'sec': functions.sec,
'csc': calcfunctions.csc, 'csc': functions.csc,
'cot': calcfunctions.cot, 'cot': functions.cot,
'sqrt': numpy.sqrt, 'sqrt': numpy.sqrt,
'log10': numpy.log10, 'log10': numpy.log10,
'log2': numpy.log2, 'log2': numpy.log2,
...@@ -31,24 +31,24 @@ DEFAULT_FUNCTIONS = { ...@@ -31,24 +31,24 @@ DEFAULT_FUNCTIONS = {
'arccos': numpy.arccos, 'arccos': numpy.arccos,
'arcsin': numpy.arcsin, 'arcsin': numpy.arcsin,
'arctan': numpy.arctan, 'arctan': numpy.arctan,
'arcsec': calcfunctions.arcsec, 'arcsec': functions.arcsec,
'arccsc': calcfunctions.arccsc, 'arccsc': functions.arccsc,
'arccot': calcfunctions.arccot, 'arccot': functions.arccot,
'abs': numpy.abs, 'abs': numpy.abs,
'fact': math.factorial, 'fact': math.factorial,
'factorial': math.factorial, 'factorial': math.factorial,
'sinh': numpy.sinh, 'sinh': numpy.sinh,
'cosh': numpy.cosh, 'cosh': numpy.cosh,
'tanh': numpy.tanh, 'tanh': numpy.tanh,
'sech': calcfunctions.sech, 'sech': functions.sech,
'csch': calcfunctions.csch, 'csch': functions.csch,
'coth': calcfunctions.coth, 'coth': functions.coth,
'arcsinh': numpy.arcsinh, 'arcsinh': numpy.arcsinh,
'arccosh': numpy.arccosh, 'arccosh': numpy.arccosh,
'arctanh': numpy.arctanh, 'arctanh': numpy.arctanh,
'arcsech': calcfunctions.arcsech, 'arcsech': functions.arcsech,
'arccsch': calcfunctions.arccsch, 'arccsch': functions.arccsch,
'arccoth': calcfunctions.arccoth 'arccoth': functions.arccoth
} }
DEFAULT_VARIABLES = { DEFAULT_VARIABLES = {
'i': numpy.complex(0, 1), 'i': numpy.complex(0, 1),
......
...@@ -4,7 +4,7 @@ Unit tests for preview.py ...@@ -4,7 +4,7 @@ Unit tests for preview.py
""" """
import unittest import unittest
import preview from calc import preview
import pyparsing import pyparsing
......
...@@ -2,8 +2,8 @@ from setuptools import setup ...@@ -2,8 +2,8 @@ from setuptools import setup
setup( setup(
name="calc", name="calc",
version="0.1.1", version="0.2",
py_modules=["calc"], packages=["calc"],
install_requires=[ install_requires=[
"pyparsing==1.5.6", "pyparsing==1.5.6",
"numpy", "numpy",
......
...@@ -49,7 +49,7 @@ import pyparsing ...@@ -49,7 +49,7 @@ import pyparsing
from .registry import TagRegistry from .registry import TagRegistry
from chem import chemcalc from chem import chemcalc
from preview import latex_preview from calc.preview import latex_preview
import xqueue_interface import xqueue_interface
from datetime import datetime from datetime import datetime
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment