Merge pull request #2021 from edx/vaxxxa/word_cloud_fix_peps
word cloud: fix pylint warnings, fix word cloud test
This commit is contained in:
@@ -11,6 +11,7 @@ import logging
|
||||
|
||||
from pkg_resources import resource_string
|
||||
from xmodule.raw_module import RawDescriptor
|
||||
from xmodule.editing_module import MetadataOnlyEditingDescriptor
|
||||
from xmodule.x_module import XModule
|
||||
|
||||
from xblock.core import Scope, String, Object, Boolean, List, Integer
|
||||
@@ -19,8 +20,13 @@ log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def pretty_bool(value):
|
||||
BOOL_DICT = [True, "True", "true", "T", "t", "1"]
|
||||
return value in BOOL_DICT
|
||||
"""Check value for possible `True` value.
|
||||
|
||||
Using this function we can manage different type of Boolean value
|
||||
in xml files.
|
||||
"""
|
||||
bool_dict = [True, "True", "true", "T", "t", "1"]
|
||||
return value in bool_dict
|
||||
|
||||
|
||||
class WordCloudFields(object):
|
||||
@@ -227,9 +233,8 @@ class WordCloudModule(WordCloudFields, XModule):
|
||||
return self.content
|
||||
|
||||
|
||||
class WordCloudDescriptor(WordCloudFields, RawDescriptor):
|
||||
class WordCloudDescriptor(MetadataOnlyEditingDescriptor, RawDescriptor, WordCloudFields):
|
||||
"""Descriptor for WordCloud Xmodule."""
|
||||
module_class = WordCloudModule
|
||||
template_dir_name = 'word_cloud'
|
||||
stores_state = True
|
||||
mako_template = "widgets/raw-edit.html"
|
||||
|
||||
@@ -18,12 +18,23 @@ The following attributes can be specified for this tag::
|
||||
[display_name| AUTOGENERATE] – Display name of xmodule. When this attribute is not defined - display name autogenerate with some hash.
|
||||
[num_inputs| 5] – Number of inputs.
|
||||
[num_top_words| 250] – Number of max words, which will be displayed.
|
||||
[display_student_percents| True] – Display usage percents for each word.
|
||||
[display_student_percents| True] – Display usage percents for each word on the same line together with words.
|
||||
|
||||
.. note::
|
||||
|
||||
Percent is shown always when mouse over the word in cloud.
|
||||
|
||||
.. note::
|
||||
|
||||
Possible answer for boolean type attributes:
|
||||
True – "True", "true", "T", "t", "1"
|
||||
False – "False", "false", "F", "f", "0"
|
||||
|
||||
.. note::
|
||||
|
||||
If you want to use the same word cloud (the same storage of words), you must use the same display_name value.
|
||||
|
||||
|
||||
Code Example
|
||||
============
|
||||
|
||||
|
||||
Reference in New Issue
Block a user