See the commit that added round_away_from_zero for details.
IN the case of dashboard_data.py:
We don't first cast to decimal here because in python 2 this didn't do
anything. The python 2 rounding method would just cast things to float
before doing the rounding anyway so it just wastes cpu cycles. In
python 3 this causes some typing issues so just removing it.
We did this already for the 'get_html' function for a capa problem but
there wasn't a test to ensure this works correctly for the
get_question_answer function that powers the show answer button.
I ran into it while doing a quick smoke test on the python 3 sandbox.
BOM-898 fix test_responsetypes.py issues
Updated safe_exec to use random2 library instead of random.
As python3 random generates different results as compared to
python2, which causes a lot of test failures and if we use
python3 random and fix tests it will cause state invalidation
of capa problems, So random2 was uses to make the behaviour same
in python3.
BOM-899 name xrange is not defined
xrange is used in safe_exec and there might be old courses where
this is being used in capa problems. All those tests fail in python3
as this was renamed to range. Used six.moves.xrange so that code
works for python3 and if there is any old code using xrange it
works too.
Python3 RNG produces different results as compared to python2
In capa problems we save seed value and generate random state
using the seed. Python3 random generates a different state as
compared to python2. Thats why using random2 library to make
state genration consistent in both python versions.
The underlying data is put into json documents that expect unicode
strings not byte strings. In python2 lxml provided strings that were
auto coerced but in python3 it provides byte strings.
by making CAPA <input> elements siblings of their <label>s, instead of children.
Also:
* Moves radio submitted status block down below the problem
to match the checkbox problem status blocks.
* Marks submitted choicegroup answers with a class
* Remove old performance tests that we haven't been running.
As far as I can tell, these tests to capture HAR files were created 5
years ago and not being run as a part of our suite? They capture HAR
data that we do nothing with so even if they were running we should
remove them until we're ready to care about consuming this kind of
information.
* Update password test unicode string.
* Add ugettext translation helper function.
* Fix lambda syntax that is not valid in python 3.
* Fix ur raw strings which his not valid in python 3
* Use edx_six.get_gettext instead of ugettext.
* Fix a few other encoding issues.
* Don't use old form of sorted funciton.
This form which uses a 'cmp' method is not available in python 3.
Updated the file as suggested
ran python-modernize and isort on files mentioned in INCR-410
Updated the file as suggested
changes made to comply with quality
ran python-modernize and isort on files mentioned in INCR-410
Updated the file as suggested
changes made to comply with quality
* INCR-245: Make compatible with Python 3.x without breaking Python 2.7 support > common/lib/capa/capa/safe_exec
* INCR-245: Add absolute_import to CODE_PROLOG