def test_list():
    return Block([
        "Simple string content",
        Block("Block content"),
        series.plot(),
        test_widepanel()
    ],
                 cols=2)
Exemple #2
0
    def __init__(self, contents, **kwargs):
        """
        Wrap the supplied content (can be anything that is supported by the basic blocks)
        in a container.

        :param contents: Content to wrap
        :param kwargs: Optional styling arguments. The `style` keyword argument has special
                       meaning in that it allows styling to be grouped as one argument.
                       It is also useful in case a styling parameter name clashes with a standard
                       block parameter.
        """
        super(Box, self).__init__(**kwargs)

        # Blockify the content
        self._contents = Block(contents)
Exemple #3
0
    def _blockify_contents(contents, kwargs, parent_title_level):
        """
        Blockify the contents (e.g. by unstacking WidePanels)
        """
        if isinstance(contents, pd.WidePanel):
            # Pop title and title_level out of the sub-block kwargs to avoid duplicate parameters.
            sub_kwargs = kwargs.copy()
            sub_kwargs.pop("title", None)
            sub_kwargs.pop("title_level", None)
            contents = [
                Block(df,
                      title=str(title),
                      title_level=parent_title_level + 1,
                      **sub_kwargs) for title, df in contents.iteritems()
            ]
        else:
            # Blockify the contents
            contents = [Block(content) for content in contents]

        return contents
def test_dframe():
    return Block(df, title="DataFrame Block")
def test_matplotlib():
    return Block(series.plot(), title="Matplotlib Block")
def test_none():
    return Block(None, title="Empty Block")
def test_block():
    return Block(test_string(), title="Wrapped Block")
def test_unicode_string():
    return Block(u"Hello £&ö World!", title=u"Salutations")
def test_string():
    return Block("Hello World!", title="Salutations")
def test_widepanel():
    return Block(panel, title="WidePanel Block")
Exemple #11
0
 def _blockify_contents(contents, kwargs, parent_title_level):
     """
     Blockify the contents
     """
     return [Block(content) for content in contents]