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


Python collections.KeysView方法代码示例

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


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

示例1: test_abc_registry

# 需要导入模块: import collections [as 别名]
# 或者: from collections import KeysView [as 别名]
def test_abc_registry(self):
        d = dict(a=1)

        self.assertIsInstance(d.viewkeys(), collections.KeysView)
        self.assertIsInstance(d.viewkeys(), collections.MappingView)
        self.assertIsInstance(d.viewkeys(), collections.Set)
        self.assertIsInstance(d.viewkeys(), collections.Sized)
        self.assertIsInstance(d.viewkeys(), collections.Iterable)
        self.assertIsInstance(d.viewkeys(), collections.Container)

        self.assertIsInstance(d.viewvalues(), collections.ValuesView)
        self.assertIsInstance(d.viewvalues(), collections.MappingView)
        self.assertIsInstance(d.viewvalues(), collections.Sized)

        self.assertIsInstance(d.viewitems(), collections.ItemsView)
        self.assertIsInstance(d.viewitems(), collections.MappingView)
        self.assertIsInstance(d.viewitems(), collections.Set)
        self.assertIsInstance(d.viewitems(), collections.Sized)
        self.assertIsInstance(d.viewitems(), collections.Iterable)
        self.assertIsInstance(d.viewitems(), collections.Container) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:22,代码来源:test_dictviews.py

示例2: keys

# 需要导入模块: import collections [as 别名]
# 或者: from collections import KeysView [as 别名]
def keys(self):
        return KeysView(self) 
开发者ID:PacktPublishing,项目名称:Python-Journey-from-Novice-to-Expert,代码行数:4,代码来源:6_16_dictsorted.py

示例3: viewkeys

# 需要导入模块: import collections [as 别名]
# 或者: from collections import KeysView [as 别名]
def viewkeys(self):
        "Return set-like object with view of mapping keys."
        return KeysView(self) 
开发者ID:eirannejad,项目名称:pyRevit,代码行数:5,代码来源:ordereddict.py

示例4: has_intrinsic_functions

# 需要导入模块: import collections [as 别名]
# 或者: from collections import KeysView [as 别名]
def has_intrinsic_functions(parameter):
    intrinsic_functions = ["Fn::Sub", "!Sub", "!GetAtt"]
    result = False
    if isinstance(parameter, (list, tuple, dict, KeysView)):
        for item in parameter:
            if item in intrinsic_functions:
                result = True
                break
    return result 
开发者ID:awslabs,项目名称:aws-cfn-template-flip,代码行数:11,代码来源:__init__.py

示例5: viewkeys

# 需要导入模块: import collections [as 别名]
# 或者: from collections import KeysView [as 别名]
def viewkeys(self):
    return collections.KeysView(self) 
开发者ID:GoogleCloudPlatform,项目名称:python-compat-runtime,代码行数:4,代码来源:request_environment.py

示例6: keys

# 需要导入模块: import collections [as 别名]
# 或者: from collections import KeysView [as 别名]
def keys(self):
        """D.keys() => a set-like object providing a view on D's keys"""
        return stdlib_collections.KeysView(self) 
开发者ID:compas-dev,项目名称:compas,代码行数:5,代码来源:_mutablemapping.py


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