From 4463ee751da615b53da62be81da64c84e79f02e0 Mon Sep 17 00:00:00 2001 From: Muhammad Soban Javed <58461728+iamsobanjaved@users.noreply.github.com> Date: Thu, 21 Jul 2022 18:22:15 +0500 Subject: [PATCH] Revert "refactor: move common/lib/capa/capa to xmodule/capa" (#30762) --- .coveragerc | 1 + .coveragerc-local | 1 + .eslintignore | 8 ++-- .github/workflows/unit-test-shards.json | 6 +++ .github/workflows/unit-tests.yml | 3 +- .../workflows/verify-gha-unit-tests-count.yml | 2 +- cms/envs/common.py | 4 +- {xmodule => common/lib/capa}/capa/__init__.py | 0 .../lib/capa}/capa/capa_problem.py | 14 +++--- {xmodule => common/lib/capa}/capa/checker.py | 2 +- .../lib/capa}/capa/correctmap.py | 0 .../lib/capa}/capa/customrender.py | 0 .../lib/capa}/capa/inputtypes.py | 2 +- {xmodule => common/lib/capa}/capa/registry.py | 0 .../lib/capa}/capa/responsetypes.py | 4 +- .../lib/capa}/capa/safe_exec/README.rst | 0 .../lib/capa}/capa/safe_exec/__init__.py | 0 .../lib/capa}/capa/safe_exec/exceptions.py | 0 .../lib/capa}/capa/safe_exec/lazymod.py | 0 .../lib/capa}/capa/safe_exec/remote_exec.py | 6 +-- .../lib/capa}/capa/safe_exec/safe_exec.py | 0 .../capa}/capa/safe_exec/tests/__init__.py | 0 .../tests/test_files/pylib/constant.py | 0 .../capa/safe_exec/tests/test_lazymod.py | 2 +- .../capa/safe_exec/tests/test_safe_exec.py | 2 +- .../capa}/capa/templates/annotationinput.html | 0 .../capa/templates/chemicalequationinput.html | 2 +- .../lib/capa}/capa/templates/choicegroup.html | 0 .../lib/capa}/capa/templates/choicetext.html | 2 +- .../capa}/capa/templates/clarification.html | 0 .../lib/capa}/capa/templates/codeinput.html | 0 .../capa}/capa/templates/crystallography.html | 0 .../capa/templates/designprotein2dinput.html | 0 .../capa/templates/drag_and_drop_input.html | 0 .../capa}/capa/templates/editageneinput.html | 0 .../capa}/capa/templates/editamolecule.html | 0 .../capa}/capa/templates/filesubmission.html | 0 .../capa/templates/formulaequationinput.html | 0 .../lib/capa}/capa/templates/imageinput.html | 0 .../lib/capa}/capa/templates/jsinput.html | 0 .../lib/capa}/capa/templates/mathstring.html | 0 .../lib/capa}/capa/templates/matlabinput.html | 0 .../lib/capa}/capa/templates/optioninput.html | 0 .../capa}/capa/templates/schematicinput.html | 2 +- .../capa}/capa/templates/solutionspan.html | 0 .../lib/capa}/capa/templates/status_span.html | 0 .../lib/capa}/capa/templates/textline.html | 0 .../lib/capa}/capa/templates/vsepr_input.html | 0 .../lib/capa}/capa/tests/__init__.py | 0 .../lib/capa}/capa/tests/helpers.py | 4 +- .../capa}/capa/tests/response_xml_factory.py | 0 .../lib/capa}/capa/tests/test_answer_pool.py | 4 +- .../lib/capa}/capa/tests/test_capa_problem.py | 4 +- .../lib/capa}/capa/tests/test_correctmap.py | 4 +- .../lib/capa}/capa/tests/test_customrender.py | 4 +- .../capa/tests/test_files/dynamath_input.txt | 0 .../capa/tests/test_files/extended_hints.xml | 0 .../test_files/extended_hints_checkbox.xml | 0 .../test_files/extended_hints_dropdown.xml | 0 .../extended_hints_multiple_choice.xml | 0 ...tended_hints_multiple_choice_with_html.xml | 0 .../extended_hints_numeric_input.xml | 0 .../test_files/extended_hints_text_input.xml | 0 .../test_files/extended_hints_with_errors.xml | 0 .../test_files/filename_convert_test.txt | 0 .../test_files/js/mersenne-twister-min.js | 0 .../test_files/js/test_problem_display.js | 0 .../test_files/js/test_problem_generator.js | 0 .../test_files/js/test_problem_grader.js | 0 .../capa/tests/test_files/js/xproblem.js | 0 .../tests/test_files/snuggletex_2x+3y.xml | 0 .../tests/test_files/snuggletex_correct.html | 0 .../tests/test_files/snuggletex_wrong.html | 0 .../tests/test_files/snuggletex_x+x+3y.xml | 0 .../tests/test_files/targeted_feedback.xml | 0 .../test_files/targeted_feedback_multiple.xml | 0 .../capa/tests/test_hint_functionality.py | 2 +- .../lib/capa}/capa/tests/test_html_render.py | 2 +- .../capa}/capa/tests/test_input_templates.py | 4 +- .../lib/capa}/capa/tests/test_inputtypes.py | 32 ++++++------- .../capa}/capa/tests/test_responsetypes.py | 20 ++++---- .../lib/capa}/capa/tests/test_shuffle.py | 4 +- .../capa/tests/test_targeted_feedback.py | 2 +- .../lib/capa}/capa/tests/test_util.py | 4 +- .../capa}/capa/tests/test_xqueue_interface.py | 2 +- {xmodule => common/lib/capa}/capa/util.py | 0 .../lib/capa}/capa/xqueue_interface.py | 0 common/lib/capa/setup.py | 14 ++++++ conf/locale/babel_mako.cfg | 4 +- docs/guides/conf.py | 2 + docs/guides/docstrings/common_lib.rst | 2 + docs/guides/testing/testing.rst | 4 +- lms/djangoapps/ccx/tests/test_views.py | 3 +- lms/djangoapps/courseware/module_render.py | 2 +- .../courseware/tests/test_entrance_exam.py | 3 +- .../courseware/tests/test_masquerade.py | 2 +- .../courseware/tests/test_module_render.py | 4 +- .../tests/test_submitting_problems.py | 4 +- lms/djangoapps/courseware/tests/test_views.py | 4 +- .../v1/tests/test_grading_policy_view.py | 3 +- lms/djangoapps/grades/tests/base.py | 4 +- .../grades/tests/integration/test_access.py | 2 +- .../grades/tests/integration/test_events.py | 2 +- .../grades/tests/integration/test_problems.py | 3 +- .../instructor/tests/test_enrollment.py | 2 +- .../instructor/tests/test_spoc_gradebook.py | 2 +- .../tasks_helper/module_state.py | 2 +- .../instructor_task/tests/test_base.py | 2 +- .../instructor_task/tests/test_integration.py | 10 ++-- .../tests/test_tasks_helper.py | 4 +- lms/envs/common.py | 9 ++-- .../content/block_structure/tasks.py | 2 +- requirements/edx/base.txt | 2 + requirements/edx/development.txt | 2 + requirements/edx/local.in | 1 + requirements/edx/testing.txt | 2 + scripts/verify-dunder-init.sh | 3 +- xmodule/capa_module.py | 14 +++--- xmodule/library_content_module.py | 2 +- xmodule/tests/__init__.py | 2 +- xmodule/tests/test_capa_module.py | 48 +++++++++---------- 121 files changed, 182 insertions(+), 144 deletions(-) rename {xmodule => common/lib/capa}/capa/__init__.py (100%) rename {xmodule => common/lib/capa}/capa/capa_problem.py (99%) rename {xmodule => common/lib/capa}/capa/checker.py (99%) rename {xmodule => common/lib/capa}/capa/correctmap.py (100%) rename {xmodule => common/lib/capa}/capa/customrender.py (100%) rename {xmodule => common/lib/capa}/capa/inputtypes.py (99%) rename {xmodule => common/lib/capa}/capa/registry.py (100%) rename {xmodule => common/lib/capa}/capa/responsetypes.py (99%) rename {xmodule => common/lib/capa}/capa/safe_exec/README.rst (100%) rename {xmodule => common/lib/capa}/capa/safe_exec/__init__.py (100%) rename {xmodule => common/lib/capa}/capa/safe_exec/exceptions.py (100%) rename {xmodule => common/lib/capa}/capa/safe_exec/lazymod.py (100%) rename {xmodule => common/lib/capa}/capa/safe_exec/remote_exec.py (100%) rename {xmodule => common/lib/capa}/capa/safe_exec/safe_exec.py (100%) rename {xmodule => common/lib/capa}/capa/safe_exec/tests/__init__.py (100%) rename {xmodule => common/lib/capa}/capa/safe_exec/tests/test_files/pylib/constant.py (100%) rename {xmodule => common/lib/capa}/capa/safe_exec/tests/test_lazymod.py (97%) rename {xmodule => common/lib/capa}/capa/safe_exec/tests/test_safe_exec.py (99%) rename {xmodule => common/lib/capa}/capa/templates/annotationinput.html (100%) rename {xmodule => common/lib/capa}/capa/templates/chemicalequationinput.html (93%) rename {xmodule => common/lib/capa}/capa/templates/choicegroup.html (100%) rename {xmodule => common/lib/capa}/capa/templates/choicetext.html (98%) rename {xmodule => common/lib/capa}/capa/templates/clarification.html (100%) rename {xmodule => common/lib/capa}/capa/templates/codeinput.html (100%) rename {xmodule => common/lib/capa}/capa/templates/crystallography.html (100%) rename {xmodule => common/lib/capa}/capa/templates/designprotein2dinput.html (100%) rename {xmodule => common/lib/capa}/capa/templates/drag_and_drop_input.html (100%) rename {xmodule => common/lib/capa}/capa/templates/editageneinput.html (100%) rename {xmodule => common/lib/capa}/capa/templates/editamolecule.html (100%) rename {xmodule => common/lib/capa}/capa/templates/filesubmission.html (100%) rename {xmodule => common/lib/capa}/capa/templates/formulaequationinput.html (100%) rename {xmodule => common/lib/capa}/capa/templates/imageinput.html (100%) rename {xmodule => common/lib/capa}/capa/templates/jsinput.html (100%) rename {xmodule => common/lib/capa}/capa/templates/mathstring.html (100%) rename {xmodule => common/lib/capa}/capa/templates/matlabinput.html (100%) rename {xmodule => common/lib/capa}/capa/templates/optioninput.html (100%) rename {xmodule => common/lib/capa}/capa/templates/schematicinput.html (92%) rename {xmodule => common/lib/capa}/capa/templates/solutionspan.html (100%) rename {xmodule => common/lib/capa}/capa/templates/status_span.html (100%) rename {xmodule => common/lib/capa}/capa/templates/textline.html (100%) rename {xmodule => common/lib/capa}/capa/templates/vsepr_input.html (100%) rename {xmodule => common/lib/capa}/capa/tests/__init__.py (100%) rename {xmodule => common/lib/capa}/capa/tests/helpers.py (97%) rename {xmodule => common/lib/capa}/capa/tests/response_xml_factory.py (100%) rename {xmodule => common/lib/capa}/capa/tests/test_answer_pool.py (99%) rename {xmodule => common/lib/capa}/capa/tests/test_capa_problem.py (99%) rename {xmodule => common/lib/capa}/capa/tests/test_correctmap.py (98%) rename {xmodule => common/lib/capa}/capa/tests/test_customrender.py (96%) rename {xmodule => common/lib/capa}/capa/tests/test_files/dynamath_input.txt (100%) rename {xmodule => common/lib/capa}/capa/tests/test_files/extended_hints.xml (100%) rename {xmodule => common/lib/capa}/capa/tests/test_files/extended_hints_checkbox.xml (100%) rename {xmodule => common/lib/capa}/capa/tests/test_files/extended_hints_dropdown.xml (100%) rename {xmodule => common/lib/capa}/capa/tests/test_files/extended_hints_multiple_choice.xml (100%) rename {xmodule => common/lib/capa}/capa/tests/test_files/extended_hints_multiple_choice_with_html.xml (100%) rename {xmodule => common/lib/capa}/capa/tests/test_files/extended_hints_numeric_input.xml (100%) rename {xmodule => common/lib/capa}/capa/tests/test_files/extended_hints_text_input.xml (100%) rename {xmodule => common/lib/capa}/capa/tests/test_files/extended_hints_with_errors.xml (100%) rename {xmodule => common/lib/capa}/capa/tests/test_files/filename_convert_test.txt (100%) rename {xmodule => common/lib/capa}/capa/tests/test_files/js/mersenne-twister-min.js (100%) rename {xmodule => common/lib/capa}/capa/tests/test_files/js/test_problem_display.js (100%) rename {xmodule => common/lib/capa}/capa/tests/test_files/js/test_problem_generator.js (100%) rename {xmodule => common/lib/capa}/capa/tests/test_files/js/test_problem_grader.js (100%) rename {xmodule => common/lib/capa}/capa/tests/test_files/js/xproblem.js (100%) rename {xmodule => common/lib/capa}/capa/tests/test_files/snuggletex_2x+3y.xml (100%) rename {xmodule => common/lib/capa}/capa/tests/test_files/snuggletex_correct.html (100%) rename {xmodule => common/lib/capa}/capa/tests/test_files/snuggletex_wrong.html (100%) rename {xmodule => common/lib/capa}/capa/tests/test_files/snuggletex_x+x+3y.xml (100%) rename {xmodule => common/lib/capa}/capa/tests/test_files/targeted_feedback.xml (100%) rename {xmodule => common/lib/capa}/capa/tests/test_files/targeted_feedback_multiple.xml (100%) rename {xmodule => common/lib/capa}/capa/tests/test_hint_functionality.py (99%) rename {xmodule => common/lib/capa}/capa/tests/test_html_render.py (99%) rename {xmodule => common/lib/capa}/capa/tests/test_input_templates.py (99%) rename {xmodule => common/lib/capa}/capa/tests/test_inputtypes.py (98%) rename {xmodule => common/lib/capa}/capa/tests/test_responsetypes.py (99%) rename {xmodule => common/lib/capa}/capa/tests/test_shuffle.py (99%) rename {xmodule => common/lib/capa}/capa/tests/test_targeted_feedback.py (99%) rename {xmodule => common/lib/capa}/capa/tests/test_util.py (98%) rename {xmodule => common/lib/capa}/capa/tests/test_xqueue_interface.py (94%) rename {xmodule => common/lib/capa}/capa/util.py (100%) rename {xmodule => common/lib/capa}/capa/xqueue_interface.py (100%) create mode 100644 common/lib/capa/setup.py diff --git a/.coveragerc b/.coveragerc index b48299d3d7..397a19c100 100644 --- a/.coveragerc +++ b/.coveragerc @@ -4,6 +4,7 @@ data_file = reports/${TEST_SUITE}.coverage source = cms common/djangoapps + common/lib/capa lms openedx pavelib diff --git a/.coveragerc-local b/.coveragerc-local index f14fdeea9c..a651388835 100644 --- a/.coveragerc-local +++ b/.coveragerc-local @@ -4,6 +4,7 @@ data_file = reports/.coverage source = cms common/djangoapps + common/lib/capa common/lib/xmodule lms openedx diff --git a/.eslintignore b/.eslintignore index 82cdcd00dc..87fc6073da 100644 --- a/.eslintignore +++ b/.eslintignore @@ -46,10 +46,10 @@ cms/static/js/spec/views/course_info_spec.js cms/static/js/spec/views/metadata_edit_spec.js cms/static/js/spec/views/textbook_spec.js cms/static/js/spec/views/upload_spec.js -xmodule/capa/tests/test_files/js/test_problem_display.js -xmodule/capa/tests/test_files/js/test_problem_generator.js -xmodule/capa/tests/test_files/js/test_problem_grader.js -xmodule/capa/tests/test_files/js/xproblem.js +common/lib/capa/capa/tests/test_files/js/test_problem_display.js +common/lib/capa/capa/tests/test_files/js/test_problem_generator.js +common/lib/capa/capa/tests/test_files/js/test_problem_grader.js +common/lib/capa/capa/tests/test_files/js/xproblem.js lms/static/js/spec/calculator_spec.js lms/static/js/spec/courseware_spec.js lms/static/js/spec/feedback_form_spec.js diff --git a/.github/workflows/unit-test-shards.json b/.github/workflows/unit-test-shards.json index 1ca3f847fe..81a618f1e6 100644 --- a/.github/workflows/unit-test-shards.json +++ b/.github/workflows/unit-test-shards.json @@ -261,6 +261,12 @@ ] }, "common-2": { + "settings": "lms.envs.test", + "paths": [ + "common/lib/" + ] + }, + "common-3": { "settings": "cms.envs.test", "paths": [ "common/djangoapps/" diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 3b17418e58..dfe2412a24 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -31,6 +31,7 @@ jobs: "cms-2", "common-1", "common-2", + "common-3", "xmodule-1" ] @@ -61,7 +62,7 @@ jobs: - name: install requirements run: | sudo pip install -r requirements/pip.txt - sudo pip install --exists-action='w' -r requirements/edx/testing.txt + sudo pip install -r requirements/edx/testing.txt if [[ "${{ matrix.django-version }}" == "pinned" ]]; then sudo pip install -r requirements/edx/django.txt else diff --git a/.github/workflows/verify-gha-unit-tests-count.yml b/.github/workflows/verify-gha-unit-tests-count.yml index 8b5701af48..70e2295752 100644 --- a/.github/workflows/verify-gha-unit-tests-count.yml +++ b/.github/workflows/verify-gha-unit-tests-count.yml @@ -18,7 +18,7 @@ jobs: - name: install requirements run: | sudo pip install -r requirements/pip.txt - sudo pip install --exists-action='w' -r requirements/edx/testing.txt + sudo pip install -r requirements/edx/testing.txt - name: verify unit tests count uses: ./.github/actions/verify-tests-count diff --git a/cms/envs/common.py b/cms/envs/common.py index 0e9ec0d20c..7fe7f7ea5c 100644 --- a/cms/envs/common.py +++ b/cms/envs/common.py @@ -1112,10 +1112,10 @@ COURSES_WITH_UNSAFE_CODE = [] # Cojail REST service ENABLE_CODEJAIL_REST_SERVICE = False # .. setting_name: CODE_JAIL_REST_SERVICE_REMOTE_EXEC -# .. setting_default: 'xmodule.capa.safe_exec.remote_exec.send_safe_exec_request_v0' +# .. setting_default: 'capa.safe_exec.remote_exec.send_safe_exec_request_v0' # .. setting_description: Set the python package.module.function that is reponsible of # calling the remote service in charge of jailed code execution -CODE_JAIL_REST_SERVICE_REMOTE_EXEC = 'xmodule.capa.safe_exec.remote_exec.send_safe_exec_request_v0' +CODE_JAIL_REST_SERVICE_REMOTE_EXEC = 'capa.safe_exec.remote_exec.send_safe_exec_request_v0' # .. setting_name: CODE_JAIL_REST_SERVICE_HOST # .. setting_default: 'http://127.0.0.1:8550' # .. setting_description: Set the codejail remote service host diff --git a/xmodule/capa/__init__.py b/common/lib/capa/capa/__init__.py similarity index 100% rename from xmodule/capa/__init__.py rename to common/lib/capa/capa/__init__.py diff --git a/xmodule/capa/capa_problem.py b/common/lib/capa/capa/capa_problem.py similarity index 99% rename from xmodule/capa/capa_problem.py rename to common/lib/capa/capa/capa_problem.py index 66242b8438..30295b0919 100644 --- a/xmodule/capa/capa_problem.py +++ b/common/lib/capa/capa/capa_problem.py @@ -27,13 +27,13 @@ import six from lxml import etree from pytz import UTC -import xmodule.capa.customrender as customrender -import xmodule.capa.inputtypes as inputtypes -import xmodule.capa.responsetypes as responsetypes -import xmodule.capa.xqueue_interface as xqueue_interface -from xmodule.capa.correctmap import CorrectMap -from xmodule.capa.safe_exec import safe_exec -from xmodule.capa.util import contextualize_text, convert_files_to_filenames, get_course_id_from_capa_module +import capa.customrender as customrender +import capa.inputtypes as inputtypes +import capa.responsetypes as responsetypes +import capa.xqueue_interface as xqueue_interface +from capa.correctmap import CorrectMap +from capa.safe_exec import safe_exec +from capa.util import contextualize_text, convert_files_to_filenames, get_course_id_from_capa_module from openedx.core.djangolib.markup import HTML, Text from openedx.core.lib.edx_six import get_gettext from xmodule.stringify import stringify_children diff --git a/xmodule/capa/checker.py b/common/lib/capa/capa/checker.py similarity index 99% rename from xmodule/capa/checker.py rename to common/lib/capa/capa/checker.py index bcbdd85e52..c3873085d9 100755 --- a/xmodule/capa/checker.py +++ b/common/lib/capa/capa/checker.py @@ -13,7 +13,7 @@ from calc import UndefinedVariable from mako.lookup import TemplateLookup from path import Path as path -from xmodule.capa.capa_problem import LoncapaProblem +from capa.capa_problem import LoncapaProblem logging.basicConfig(format="%(levelname)s %(message)s") log = logging.getLogger('capa.checker') diff --git a/xmodule/capa/correctmap.py b/common/lib/capa/capa/correctmap.py similarity index 100% rename from xmodule/capa/correctmap.py rename to common/lib/capa/capa/correctmap.py diff --git a/xmodule/capa/customrender.py b/common/lib/capa/capa/customrender.py similarity index 100% rename from xmodule/capa/customrender.py rename to common/lib/capa/capa/customrender.py diff --git a/xmodule/capa/inputtypes.py b/common/lib/capa/capa/inputtypes.py similarity index 99% rename from xmodule/capa/inputtypes.py rename to common/lib/capa/capa/inputtypes.py index f1817415ca..6adef536a3 100644 --- a/xmodule/capa/inputtypes.py +++ b/common/lib/capa/capa/inputtypes.py @@ -57,7 +57,7 @@ from chem import chemcalc from lxml import etree from six import text_type -from xmodule.capa.xqueue_interface import XQUEUE_TIMEOUT +from capa.xqueue_interface import XQUEUE_TIMEOUT from openedx.core.djangolib.markup import HTML, Text from openedx.core.lib import edx_six from xmodule.stringify import stringify_children diff --git a/xmodule/capa/registry.py b/common/lib/capa/capa/registry.py similarity index 100% rename from xmodule/capa/registry.py rename to common/lib/capa/capa/registry.py diff --git a/xmodule/capa/responsetypes.py b/common/lib/capa/capa/responsetypes.py similarity index 99% rename from xmodule/capa/responsetypes.py rename to common/lib/capa/capa/responsetypes.py index 39000c544a..35cc8eaa1c 100644 --- a/xmodule/capa/responsetypes.py +++ b/common/lib/capa/capa/responsetypes.py @@ -43,8 +43,8 @@ from shapely.geometry import MultiPoint, Point from six import text_type from six.moves import map, range, zip -import xmodule.capa.safe_exec as safe_exec -import xmodule.capa.xqueue_interface as xqueue_interface +import capa.safe_exec as safe_exec +import capa.xqueue_interface as xqueue_interface from openedx.core.djangolib.markup import HTML, Text from openedx.core.lib import edx_six from openedx.core.lib.grade_utils import round_away_from_zero diff --git a/xmodule/capa/safe_exec/README.rst b/common/lib/capa/capa/safe_exec/README.rst similarity index 100% rename from xmodule/capa/safe_exec/README.rst rename to common/lib/capa/capa/safe_exec/README.rst diff --git a/xmodule/capa/safe_exec/__init__.py b/common/lib/capa/capa/safe_exec/__init__.py similarity index 100% rename from xmodule/capa/safe_exec/__init__.py rename to common/lib/capa/capa/safe_exec/__init__.py diff --git a/xmodule/capa/safe_exec/exceptions.py b/common/lib/capa/capa/safe_exec/exceptions.py similarity index 100% rename from xmodule/capa/safe_exec/exceptions.py rename to common/lib/capa/capa/safe_exec/exceptions.py diff --git a/xmodule/capa/safe_exec/lazymod.py b/common/lib/capa/capa/safe_exec/lazymod.py similarity index 100% rename from xmodule/capa/safe_exec/lazymod.py rename to common/lib/capa/capa/safe_exec/lazymod.py diff --git a/xmodule/capa/safe_exec/remote_exec.py b/common/lib/capa/capa/safe_exec/remote_exec.py similarity index 100% rename from xmodule/capa/safe_exec/remote_exec.py rename to common/lib/capa/capa/safe_exec/remote_exec.py index a7aa7f8344..8baf0b7108 100644 --- a/xmodule/capa/safe_exec/remote_exec.py +++ b/common/lib/capa/capa/safe_exec/remote_exec.py @@ -2,19 +2,19 @@ Helper methods related to safe exec. """ +import requests import json import logging -from importlib import import_module -import requests from codejail.safe_exec import SafeExecException from django.conf import settings from edx_toggles.toggles import SettingToggle +from importlib import import_module from requests.exceptions import RequestException, HTTPError from simplejson import JSONDecodeError -from django.utils.translation import gettext as _ from .exceptions import CodejailServiceParseError, CodejailServiceStatusError, CodejailServiceUnavailable +from django.utils.translation import gettext as _ log = logging.getLogger(__name__) diff --git a/xmodule/capa/safe_exec/safe_exec.py b/common/lib/capa/capa/safe_exec/safe_exec.py similarity index 100% rename from xmodule/capa/safe_exec/safe_exec.py rename to common/lib/capa/capa/safe_exec/safe_exec.py diff --git a/xmodule/capa/safe_exec/tests/__init__.py b/common/lib/capa/capa/safe_exec/tests/__init__.py similarity index 100% rename from xmodule/capa/safe_exec/tests/__init__.py rename to common/lib/capa/capa/safe_exec/tests/__init__.py diff --git a/xmodule/capa/safe_exec/tests/test_files/pylib/constant.py b/common/lib/capa/capa/safe_exec/tests/test_files/pylib/constant.py similarity index 100% rename from xmodule/capa/safe_exec/tests/test_files/pylib/constant.py rename to common/lib/capa/capa/safe_exec/tests/test_files/pylib/constant.py diff --git a/xmodule/capa/safe_exec/tests/test_lazymod.py b/common/lib/capa/capa/safe_exec/tests/test_lazymod.py similarity index 97% rename from xmodule/capa/safe_exec/tests/test_lazymod.py rename to common/lib/capa/capa/safe_exec/tests/test_lazymod.py index 548422d7c8..fb7bdda28d 100644 --- a/xmodule/capa/safe_exec/tests/test_lazymod.py +++ b/common/lib/capa/capa/safe_exec/tests/test_lazymod.py @@ -4,7 +4,7 @@ import sys import unittest -from xmodule.capa.safe_exec.lazymod import LazyModule +from capa.safe_exec.lazymod import LazyModule class ModuleIsolation(object): diff --git a/xmodule/capa/safe_exec/tests/test_safe_exec.py b/common/lib/capa/capa/safe_exec/tests/test_safe_exec.py similarity index 99% rename from xmodule/capa/safe_exec/tests/test_safe_exec.py rename to common/lib/capa/capa/safe_exec/tests/test_safe_exec.py index 3ed60c6914..ea0b9ea67e 100644 --- a/xmodule/capa/safe_exec/tests/test_safe_exec.py +++ b/common/lib/capa/capa/safe_exec/tests/test_safe_exec.py @@ -19,7 +19,7 @@ from django.test import override_settings from six import text_type, unichr from six.moves import range -from xmodule.capa.safe_exec import safe_exec, update_hash +from capa.safe_exec import safe_exec, update_hash class TestSafeExec(unittest.TestCase): # lint-amnesty, pylint: disable=missing-class-docstring diff --git a/xmodule/capa/templates/annotationinput.html b/common/lib/capa/capa/templates/annotationinput.html similarity index 100% rename from xmodule/capa/templates/annotationinput.html rename to common/lib/capa/capa/templates/annotationinput.html diff --git a/xmodule/capa/templates/chemicalequationinput.html b/common/lib/capa/capa/templates/chemicalequationinput.html similarity index 93% rename from xmodule/capa/templates/chemicalequationinput.html rename to common/lib/capa/capa/templates/chemicalequationinput.html index ca01d3d7c2..3f18a699e6 100644 --- a/xmodule/capa/templates/chemicalequationinput.html +++ b/common/lib/capa/capa/templates/chemicalequationinput.html @@ -1,4 +1,4 @@ -<%! from xmodule.capa.util import remove_markup %> +<%! from capa.util import remove_markup %>