Commit abc67b5e by Calen Pennington

Merge pull request #2021 from edx/vaxxxa/word_cloud_fix_peps

word cloud: fix pylint warnings, fix word cloud test
parents 1afe5561 b02e92a8
...@@ -11,6 +11,7 @@ import logging ...@@ -11,6 +11,7 @@ import logging
from pkg_resources import resource_string from pkg_resources import resource_string
from xmodule.raw_module import RawDescriptor from xmodule.raw_module import RawDescriptor
from xmodule.editing_module import MetadataOnlyEditingDescriptor
from xmodule.x_module import XModule from xmodule.x_module import XModule
from xblock.core import Scope, String, Object, Boolean, List, Integer from xblock.core import Scope, String, Object, Boolean, List, Integer
...@@ -19,8 +20,13 @@ log = logging.getLogger(__name__) ...@@ -19,8 +20,13 @@ log = logging.getLogger(__name__)
def pretty_bool(value): def pretty_bool(value):
BOOL_DICT = [True, "True", "true", "T", "t", "1"] """Check value for possible `True` value.
return value in BOOL_DICT
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): class WordCloudFields(object):
...@@ -227,9 +233,8 @@ class WordCloudModule(WordCloudFields, XModule): ...@@ -227,9 +233,8 @@ class WordCloudModule(WordCloudFields, XModule):
return self.content return self.content
class WordCloudDescriptor(WordCloudFields, RawDescriptor): class WordCloudDescriptor(MetadataOnlyEditingDescriptor, RawDescriptor, WordCloudFields):
"""Descriptor for WordCloud Xmodule.""" """Descriptor for WordCloud Xmodule."""
module_class = WordCloudModule module_class = WordCloudModule
template_dir_name = 'word_cloud' template_dir_name = 'word_cloud'
stores_state = True stores_state = True
mako_template = "widgets/raw-edit.html"
...@@ -18,12 +18,23 @@ The following attributes can be specified for this tag:: ...@@ -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. [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_inputs| 5] – Number of inputs.
[num_top_words| 250] – Number of max words, which will be displayed. [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:: .. note::
If you want to use the same word cloud (the same storage of words), you must use the same display_name value. If you want to use the same word cloud (the same storage of words), you must use the same display_name value.
Code Example Code Example
============ ============
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment