Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softwar
# distributed under the License is distributed on an "AS-IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from extensions.interactions import base
class GraphInput(base.BaseInteraction):
"""Interaction for evaluating graphs."""
name = 'Graph Theory'
description = 'Allows learners to create and manipulate graphs.'
display_mode = base.DISPLAY_MODE_SUPPLEMENTAL
is_trainable = False
_dependency_ids = []
answer_type = 'Graph'
instructions = 'Create a graph'
narrow_instructions = 'View graph'
needs_summary = True
_customization_arg_specs = [{
'name': 'graph',
'description': 'Initial graph',
'schema': {
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softwar
# distributed under the License is distributed on an "AS-IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from extensions.interactions import base
class Continue(base.BaseInteraction):
"""Interaction that takes the form of a simple 'Continue' button."""
name = 'Continue Button'
description = 'A simple \'go to next state\' button.'
display_mode = base.DISPLAY_MODE_INLINE
_dependency_ids = []
answer_type = 'Null'
_customization_arg_specs = [{
'name': 'buttonText',
'description': 'Button label',
'schema': {
'type': 'unicode',
},
'default_value': 'Continue',
}]
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softwar
# distributed under the License is distributed on an "AS-IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Python configuration for TextInput interaction."""
from __future__ import absolute_import # pylint: disable=import-only-modules
from extensions.interactions import base
class TextInput(base.BaseInteraction):
"""Interaction for entering text strings."""
name = 'Text Input'
description = 'Allows learners to enter arbitrary text strings.'
display_mode = base.DISPLAY_MODE_INLINE
is_trainable = True
_dependency_ids = []
answer_type = 'NormalizedString'
instructions = None
narrow_instructions = None
needs_summary = False
can_have_solution = True
show_generic_submit_button = True
# NB: There used to be an integer-typed parameter here called 'columns'
# that was removed in revision 628942010573. Some text interactions in
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softwar
# distributed under the License is distributed on an "AS-IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Python configuration for FractionInput interaction."""
from __future__ import absolute_import # pylint: disable=import-only-modules
from extensions.interactions import base
class FractionInput(base.BaseInteraction):
"""Interaction for fraction input."""
name = 'Fraction Input'
description = 'Allows learners to enter integers and fractions.'
display_mode = base.DISPLAY_MODE_INLINE
is_trainable = False
_dependency_ids = []
answer_type = 'Fraction'
instructions = None
narrow_instructions = None
needs_summary = False
can_have_solution = True
show_generic_submit_button = True
_customization_arg_specs = [{
'name': 'requireSimplestForm',
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softwar
# distributed under the License is distributed on an "AS-IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
__author__ = 'Zoe Madden-Wood'
from extensions.interactions import base
class NumberWithUnitInput(base.BaseInteraction):
"""Interaction for number with unit input."""
name = 'Number with Unit'
description = (
'Allows learners to enter integers and floating point numbers '
'followed by standard units.')
display_mode = base.DISPLAY_MODE_INLINE
dependency_ids = ['number_with_unit_parser']
answer_type = 'RealWithUnit'
_customization_arg_specs = []
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softwar
# distributed under the License is distributed on an "AS-IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Python configuration for LogicProof interaction."""
from extensions.interactions import base
class LogicProof(base.BaseInteraction):
"""Interaction for entering logic proofs."""
name = 'Logic Proof'
description = (
'Allows learners to write proofs for simple logical statements.')
display_mode = base.DISPLAY_MODE_SUPPLEMENTAL
_dependency_ids = ['logic_proof', 'codemirror']
answer_type = 'CheckedProof'
instructions = 'Construct a proof'
narrow_instructions = 'Construct a proof'
needs_summary = True
can_have_solution = True
show_generic_submit_button = True
_customization_arg_specs = [{
'name': 'question',
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softwar
# distributed under the License is distributed on an "AS-IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Python configuration for MusicNotesInput interaction."""
from __future__ import absolute_import # pylint: disable=import-only-modules
from extensions.interactions import base
class MusicNotesInput(base.BaseInteraction):
"""Interaction for music notes input."""
name = 'Music Notes Input'
description = (
'Allows learners to drag and drop notes onto the lines of a music '
'staff.')
display_mode = base.DISPLAY_MODE_SUPPLEMENTAL
_dependency_ids = ['midijs']
answer_type = 'MusicPhrase'
instructions = 'Drag notes to the staff to form a sequence'
narrow_instructions = 'Show music staff'
needs_summary = True
can_have_solution = True
show_generic_submit_button = True
_customization_arg_specs = [{
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softwar
# distributed under the License is distributed on an "AS-IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Python configuration for InteractiveMap interaction."""
from __future__ import absolute_import # pylint: disable=import-only-modules
from extensions.interactions import base
class InteractiveMap(base.BaseInteraction):
"""Interaction for pinpointing a location on a map."""
name = 'World Map'
description = 'Allows learners to specify a position on a world map.'
display_mode = base.DISPLAY_MODE_SUPPLEMENTAL
is_trainable = False
_dependency_ids = ['ui_leaflet']
answer_type = 'CoordTwoDim'
instructions = 'Click on the map'
narrow_instructions = 'View map'
needs_summary = True
# There needs to be a way to pass marker location so that an answer can be
# conveyed meaningfully to the learner. Once this issue is fixed,
# InteractiveMap interaction can be supported by the solution feature.
can_have_solution = False
show_generic_submit_button = False
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softwar
# distributed under the License is distributed on an "AS-IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Python configuration for EndExploration interaction."""
from __future__ import absolute_import # pylint: disable=import-only-modules
from extensions.interactions import base
class EndExploration(base.BaseInteraction):
"""Interaction that allows the exploration to end.
This interaction is unusual in that there is no way for the learner to
submit an answer, so the exploration effectively terminates at the state
containing it.
"""
name = 'End Exploration'
description = (
'Ends the exploration, and suggests recommendations for explorations '
'to try next.')
display_mode = base.DISPLAY_MODE_INLINE
is_terminal = True
_dependency_ids = []
instructions = None
narrow_instructions = None
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softwar
# distributed under the License is distributed on an "AS-IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Python configuration for ItemSelectionInput interaction."""
from __future__ import absolute_import # pylint: disable=import-only-modules
from extensions.interactions import base
class ItemSelectionInput(base.BaseInteraction):
"""Interaction for item selection input."""
name = 'Item Selection'
description = (
'Allows learners to select various options.')
display_mode = base.DISPLAY_MODE_INLINE
_dependency_ids = []
answer_type = 'SetOfHtmlString'
# Radio buttons get unselected when specifying a solution. This needs to be
# fixed before solution feature can support this interaction.
can_have_solution = False
# ItemSelectionInput's submit button is dynamic and is handled
# separately.
show_generic_submit_button = False
_customization_arg_specs = [{