Skip to content

Commit

Permalink
Merge pull request #843 from edx/adam/calc-refactor
Browse files Browse the repository at this point in the history
Adam/calc refactor
  • Loading branch information
adampalay committed Aug 30, 2013
2 parents ea36b83 + 5b0194d commit 8d7d819
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 17 deletions.
6 changes: 6 additions & 0 deletions common/lib/calc/calc/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
"""
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 *
26 changes: 13 additions & 13 deletions common/lib/calc/calc.py → common/lib/calc/calc/calc.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import numbers
import numpy
import scipy.constants
import calcfunctions
import functions

from pyparsing import (
Word, Literal, CaselessLiteral, ZeroOrMore, MatchFirst, Optional, Forward,
Expand All @@ -20,9 +20,9 @@
'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,
Expand All @@ -31,24 +31,24 @@
'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),
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"""

import unittest
import preview
from calc import preview
import pyparsing


Expand Down
4 changes: 2 additions & 2 deletions common/lib/calc/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

setup(
name="calc",
version="0.1.1",
py_modules=["calc"],
version="0.2",
packages=["calc"],
install_requires=[
"pyparsing==1.5.6",
"numpy",
Expand Down
2 changes: 1 addition & 1 deletion common/lib/capa/capa/inputtypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@

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

Expand Down

0 comments on commit 8d7d819

Please sign in to comment.