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
import numbers
import numpy
import scipy.constants
import calcfunctions
import functions
from pyparsing import (
Word, Literal, CaselessLiteral, ZeroOrMore, MatchFirst, Optional, Forward,
......@@ -20,9 +20,9 @@ DEFAULT_FUNCTIONS = {
'sin': numpy.sin,
'cos': numpy.cos,
'tan': numpy.tan,
'sec': calcfunctions.sec,
'csc': calcfunctions.csc,
'cot': calcfunctions.cot,
'sec': functions.sec,
'csc': functions.csc,
'cot': functions.cot,
'sqrt': numpy.sqrt,
'log10': numpy.log10,
'log2': numpy.log2,
......@@ -31,24 +31,24 @@ DEFAULT_FUNCTIONS = {
'arccos': numpy.arccos,
'arcsin': numpy.arcsin,
'arctan': numpy.arctan,
'arcsec': calcfunctions.arcsec,
'arccsc': calcfunctions.arccsc,
'arccot': calcfunctions.arccot,
'arcsec': functions.arcsec,
'arccsc': functions.arccsc,
'arccot': functions.arccot,
'abs': numpy.abs,
'fact': math.factorial,
'factorial': math.factorial,
'sinh': numpy.sinh,
'cosh': numpy.cosh,
'tanh': numpy.tanh,
'sech': calcfunctions.sech,
'csch': calcfunctions.csch,
'coth': calcfunctions.coth,
'sech': functions.sech,
'csch': functions.csch,
'coth': functions.coth,
'arcsinh': numpy.arcsinh,
'arccosh': numpy.arccosh,
'arctanh': numpy.arctanh,
'arcsech': calcfunctions.arcsech,
'arccsch': calcfunctions.arccsch,
'arccoth': calcfunctions.arccoth
'arcsech': functions.arcsech,
'arccsch': functions.arccsch,
'arccoth': functions.arccoth
}
DEFAULT_VARIABLES = {
'i': numpy.complex(0, 1),
......
......@@ -4,7 +4,7 @@ Unit tests for preview.py
"""
import unittest
import preview
from calc import preview
import pyparsing
......
......@@ -2,8 +2,8 @@ from setuptools import setup
setup(
name="calc",
version="0.1.1",
py_modules=["calc"],
version="0.2",
packages=["calc"],
install_requires=[
"pyparsing==1.5.6",
"numpy",
......
......@@ -49,7 +49,7 @@ import pyparsing
from .registry import TagRegistry
from chem import chemcalc
from preview import latex_preview
from calc.preview import latex_preview
import xqueue_interface
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