Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __init__(self, help=None, default=UNSET, scope=Scope.content, display_name=None, **kwargs): # pylint: disable=redefined-builtin
super(Boolean, self).__init__(help, default, scope, display_name,
values=({'display_name': "True", "value": True},
{'display_name': "False", "value": False}),
**kwargs)
default='',
scope=Scope.content,
display_name=_('Enabled transcripts'),
help=_(
'Add transcripts in different languages. Click below to specify a language and upload an .srt transcript'
' file for that language.'
)
)
transcripts_enabled = Boolean(
default=False,
scope=Scope.preferences,
help="Transcripts are enabled or not"
)
captions_enabled = Boolean(
default=False,
scope=Scope.preferences,
help="Captions are enabled or not"
)
player_state_fields = (
'current_time', 'muted', 'playback_rate', 'volume', 'transcripts_enabled',
'captions_enabled', 'captions_language', 'transcripts'
)
@property
def course_default_language(self):
"""
Utility method returns course's language.
Falls back to 'en' if runtime doen't provide `modulestore` service.
help='Seconds played back after the start'
)
playback_rate = Float(
default=1,
scope=Scope.preferences,
help='Supported video playbacks speeds are: 0.5, 1, 1.5, 2'
)
volume = Float(
default=1,
scope=Scope.preferences,
help='Video volume: from 0 to 1'
)
muted = Boolean(
default=False,
scope=Scope.preferences,
help="Video is muted or not"
)
captions_language = String(
default='',
scope=Scope.preferences,
help="ISO code for the current language for captions and transcripts"
)
transcripts = String(
default='',
scope=Scope.content,
display_name=_('Enabled transcripts'),
help=_(
cell_timeout = Integer(
help="Max seconds to wait for each cell to execute",
scope=Scope.settings,
display_name="Cell Timeout (s)",
default=15
)
max_file_size = Integer(
help="Max allowable file size of student uploaded file (Bytes)",
scope=Scope.settings,
display_name="Max File Size (B)",
default=None
)
allow_network = Boolean (
help="If True, allows network access from student notebook",
scope=Scope.settings,
display_name="Network Allowed",
default=False
)
allow_graded_dl = Boolean (
help="If True, allows student to download .html version of their autograded notebook",
scope=Scope.settings,
display_name="Allow Graded NB Download",
default=False
)
# ------- Internal Fields -------
nb_name = String(
help="filename of the notebook",
"""
contentstore_service = self.runtime.service(self, 'contentstore')
if contentstore_service:
return contentstore_service.StaticContent
return import_from('xmodule.contentstore.content', 'StaticContent')
class TranscriptsMixin(XBlock):
"""
TranscriptsMixin class to encapsulate transcripts-related logic.
"""
THREE_PLAY_MEDIA_API_DOMAIN = 'https://static.3playmedia.com/'
threeplaymedia_streaming = Boolean(
default=False,
display_name=_('Direct 3PlayMedia'),
scope=Scope.content,
help=_("Direct <a href="http://www.3playmedia.com/">3PlayMedia</a> transcripts usage enabled.")
)
threeplaymedia_apikey = String(
default='',
display_name=_('3PlayMedia API Key'),
help=_('You can generate a client token following official documentation of your video platform\'s API.'),
scope=Scope.content,
resettable_editor=False
)
threeplaymedia_file_id = String(
default='',
import string # pylint: disable=W0402
import time
from xblock.core import XBlock
from xblock.fields import Integer, Scope, String, Any, Boolean, Dict
from xblock.run_script import run_script
from xblock.fragment import Fragment
class ProblemBlock(XBlock):
"""A generalized container of InputBlocks and Checkers.
"""
script = String(help="Python code to compute values", scope=Scope.content, default="")
seed = Integer(help="Random seed for this student", scope=Scope.user_state, default=0)
problem_attempted = Boolean(help="Has the student attempted this problem?", scope=Scope.user_state, default=False)
has_children = True
@classmethod
def parse_xml(cls, node, runtime, keys):
block = runtime.construct_xblock_from_class(cls, keys)
# Find
display_name = String(
default=_('Video'),
display_name=_('Component Display Name'),
help=_('The name students see. This name appears in the course ribbon and as a header for the video.'),
scope=Scope.content,
)
href = String(
default='',
display_name=_('Video URL'),
help=_('URL of the video page. E.g. https://example.wistia.com/medias/12345abcde'),
scope=Scope.content
)
download_video_allowed = Boolean(
default=False,
scope=Scope.content,
display_name=_('Video Download Allowed'),
help=_(
"Allow students to download this video if they cannot use the edX video player."
" A link to download the file appears below the video."
),
resettable_editor=False
)
download_video_url = String(
default='',
display_name=_('Video file URL'),
help=_("The URL where you've posted non hosted versions of the video. URL must end in .mpeg, .mp4, .ogg, or"
" .webm. (For browser compatibility, we strongly recommend .mp4 and .webm format.) To allow students to"
" download these videos, set Video Download Allowed to True."),
icon_class = "video"
'''
Fields
'''
display_name = String(display_name="Display Name",
default="Video JS",
scope=Scope.settings,
help="This name appears in the horizontal navigation at the top of the page.")
url = String(display_name="Video URL",
default="http://vjs.zencdn.net/v/oceans.mp4",
scope=Scope.content,
help="The URL for your video.")
allow_download = Boolean(display_name="Video Download Allowed",
default=True,
scope=Scope.content,
help="Allow students to download this video.")
source_text = String(display_name="Source document button text",
default="",
scope=Scope.content,
help="Add a download link for the source file of your video. Use it for example to provide the PowerPoint or PDF file used for this video.")
source_url = String(display_name="Source document URL",
default="",
scope=Scope.content,
help="Add a download link for the source file of your video. Use it for example to provide the PowerPoint or PDF file used for this video.")
start_time = String(display_name="Start time",
default="",
max_file_size = Integer(
help="Max allowable file size of student uploaded file (Bytes)",
scope=Scope.settings,
display_name="Max File Size (B)",
default=None
)
allow_network = Boolean (
help="If True, allows network access from student notebook",
scope=Scope.settings,
display_name="Network Allowed",
default=False
)
allow_graded_dl = Boolean (
help="If True, allows student to download .html version of their autograded notebook",
scope=Scope.settings,
display_name="Allow Graded NB Download",
default=False
)
# ------- Internal Fields -------
nb_name = String(
help="filename of the notebook",
scope=Scope.settings,
default=""
)
nb_upload_datetime = String(
help="UTC datetime the notebook was uploaded",
scope=Scope.settings,
help=_(
"This value must match what is in the 'Content Protection' area of the Azure Media Services portal"
),
default="urn:xblock-azure-media-services",
scope=Scope.settings
)
captions = List(
display_name=_("Captions"),
help=_("A list of caption definitions"),
scope=Scope.settings
)
caption_ids = List(
default=[],
scope=Scope.settings
)
transcripts_enabled = Boolean(
display_name=_("Transcripts enabled"),
help=_("Transcripts switch"),
default=True,
scope=Scope.settings
)
download_url = String(
display_name=_("Video Download URL"),
help=_("A download URL"),
scope=Scope.settings
)
# These are what become visible in the Mixin editor
editable_fields = (
'display_name', 'video_url', 'verification_key', 'protection_type',
'token_issuer', 'token_scope', 'captions', 'transcripts_enabled', 'download_url',
'edx_video_id', 'caption_ids'