当前位置: 首页>>代码示例>>Python>>正文


Python Palette.list方法代码示例

本文整理汇总了Python中landlab.Palette.list方法的典型用法代码示例。如果您正苦于以下问题:Python Palette.list方法的具体用法?Python Palette.list怎么用?Python Palette.list使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在landlab.Palette的用法示例。


在下文中一共展示了Palette.list方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_empty_palette

# 需要导入模块: from landlab import Palette [as 别名]
# 或者: from landlab.Palette import list [as 别名]
def test_empty_palette():
    """Create a palette without components."""
    palette = Palette()

    assert len(palette) == 0
    assert list(palette.list()) == []
    assert list(palette.keys()) == []
    assert palette.uses() == []
    assert palette.provides() == []

    providers = palette.find_provider("air__temperature")
    assert providers == []

    users = palette.find_user("air__temperature")
    assert users == []

    connections = palette.find_connections()
    assert connections == {}
开发者ID:landlab,项目名称:landlab,代码行数:20,代码来源:test_collections.py

示例2: test_empty_palette

# 需要导入模块: from landlab import Palette [as 别名]
# 或者: from landlab.Palette import list [as 别名]
def test_empty_palette():
    """Create a palette without components."""
    palette = Palette()

    assert_equal(len(palette), 0)
    assert_equal(list(palette.list()), [])
    assert_equal(list(palette.keys()), [])
    assert_equal(palette.uses(), [])
    assert_equal(palette.provides(), [])

    providers = palette.find_provider('air__temperature')
    assert_equal(providers, [])

    users = palette.find_user('air__temperature')
    assert_equal(users, [])

    connections = palette.find_connections()
    assert_dict_equal(connections, {})
开发者ID:Carralex,项目名称:landlab,代码行数:20,代码来源:test_collections.py

示例3: test_1_component_list

# 需要导入模块: from landlab import Palette [as 别名]
# 或者: from landlab.Palette import list [as 别名]
def test_1_component_list():
    palette = Palette(sample=Sample1)

    assert_equal(['sample'], palette.list())
开发者ID:Kirubaharan,项目名称:landlab,代码行数:6,代码来源:test_collections.py

示例4: test_2_components_list

# 需要导入模块: from landlab import Palette [as 别名]
# 或者: from landlab.Palette import list [as 别名]
def test_2_components_list():
    palette = Palette(one=Sample1, two=Sample2)

    list = palette.list()
    list.sort()
    assert_list_equal(['one', 'two'], list)
开发者ID:Kirubaharan,项目名称:landlab,代码行数:8,代码来源:test_collections.py

示例5: test_list

# 需要导入模块: from landlab import Palette [as 别名]
# 或者: from landlab.Palette import list [as 别名]
    def test_list(self):
        palette = Palette(sample=Sample1)

        self.assertEqual(['sample'], palette.list())
开发者ID:JianweiHan,项目名称:landlab,代码行数:6,代码来源:test_collections.py

示例6: test_2_components_list

# 需要导入模块: from landlab import Palette [as 别名]
# 或者: from landlab.Palette import list [as 别名]
def test_2_components_list():
    palette = Palette(one=Sample1, two=Sample2)

    components = list(palette.list())
    components.sort()
    assert ["one", "two"] == components
开发者ID:landlab,项目名称:landlab,代码行数:8,代码来源:test_collections.py

示例7: test_1_component_list

# 需要导入模块: from landlab import Palette [as 别名]
# 或者: from landlab.Palette import list [as 别名]
def test_1_component_list():
    palette = Palette(sample=Sample1)

    assert ["sample"] == list(palette.list())
开发者ID:landlab,项目名称:landlab,代码行数:6,代码来源:test_collections.py

示例8: Framework

# 需要导入模块: from landlab import Palette [as 别名]
# 或者: from landlab.Palette import list [as 别名]
class Framework(object):
    """
    A framework for connecting and running component from The Landlab.
    """

    def __init__(self):
        self._palette = Palette(**load_landlab_components())
        self._arena = Arena()

    def instantiate(self, name):
        """
        Instantiate a component called *name* from the palette and move it to
        the arena.
        """
        try:
            self._arena.instantiate(self._palette.get(name), name)
        except KeyError:
            pass

    def remove(self, name):
        """
        Remove a component called *name* from the arena.
        """
        try:
            self._arena.remove(name)
        except KeyError:
            pass

    def list_palette(self):
        """
        Get a list of names of the components in the palette.
        """
        return self._palette.list()

    def list_arena(self):
        """
        Get a list of names of the components in the arena.
        """
        return self._arena.list()

    def arena_uses(self):
        """
        Get a list of variable names that components in the arena use.
        """
        return self._arena.uses()

    def arena_provides(self):
        """
        Get a list of variable names that components in the arena provide.
        """
        return self._arena.provides()

    def palette_uses(self):
        """
        Get a list of variable names that components in the palette use.
        """
        return self._palette.uses()

    def palette_provides(self):
        """
        Get a list of variable names that components in the palette provide.
        """
        return self._palette.provides()

    def __repr__(self):
        return 'Framework(%s)' % ', '.join(self._palette.keys())
开发者ID:ericthred,项目名称:landlab,代码行数:68,代码来源:framework.py

示例9: test_2_components_list

# 需要导入模块: from landlab import Palette [as 别名]
# 或者: from landlab.Palette import list [as 别名]
def test_2_components_list():
    palette = Palette(one=Sample1, two=Sample2)

    components = list(palette.list())
    components.sort()
    assert_list_equal(['one', 'two'], components)
开发者ID:brigidlynch,项目名称:landlab,代码行数:8,代码来源:test_collections.py


注:本文中的landlab.Palette.list方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。