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


Python typing.ItemsView方法代码示例

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


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

示例1: items

# 需要导入模块: import typing [as 别名]
# 或者: from typing import ItemsView [as 别名]
def items(self) -> ItemsView:
        """
        Fetch all the key/value pairs in the cache.

        Returns a normal ItemsView, like you would get from dict.items().

        Keep in mind that these items are just a _copy_ of the data in the
        RedisCache - any changes you make to them will not be reflected
        into the RedisCache itself. If you want to change these, you need
        to make a .set call.

        Example:
        items = await my_cache.items()
        for key, value in items:
            # Iterate like a normal dictionary
        """
        await self._validate_cache()
        items = self._dict_from_typestring(
            await self._redis.hgetall(self._namespace)
        ).items()

        log.trace(f"Retrieving all key/value pairs from cache, total of {len(items)} items.")
        return items 
开发者ID:python-discord,项目名称:bot,代码行数:25,代码来源:redis_cache.py

示例2: items

# 需要导入模块: import typing [as 别名]
# 或者: from typing import ItemsView [as 别名]
def items(self, path: Optional[str] = None) -> Union[ItemsView, List]:
        """Provides an list of tuples as (key,value), similar to calling dict.items.
        If a path is given, only contracts derived from that source file are returned."""
        if path is None:
            return self._build.items()
        return [(k, v) for k, v in self._build.items() if v.get("sourcePath") == path] 
开发者ID:eth-brownie,项目名称:brownie,代码行数:8,代码来源:build.py

示例3: items

# 需要导入模块: import typing [as 别名]
# 或者: from typing import ItemsView [as 别名]
def items(self) -> ItemsView:
        """ReturnValue.items() -> a set-like object providing a view on ReturnValue's named items"""
        return self._dict.items()  # type: ignore 
开发者ID:eth-brownie,项目名称:brownie,代码行数:5,代码来源:datatypes.py

示例4: items

# 需要导入模块: import typing [as 别名]
# 或者: from typing import ItemsView [as 别名]
def items(self) -> ItemsView:
		return self._data.items() 
开发者ID:project-alice-assistant,项目名称:ProjectAlice,代码行数:4,代码来源:TomlFile.py

示例5: get_all

# 需要导入模块: import typing [as 别名]
# 或者: from typing import ItemsView [as 别名]
def get_all(self) -> ItemsView[str, Set[Stress]]:
        """
        :return items: все ключи и ударения словаря.
        """
        return self.data.items() 
开发者ID:IlyaGusev,项目名称:rupo,代码行数:7,代码来源:dict.py

示例6: items

# 需要导入模块: import typing [as 别名]
# 或者: from typing import ItemsView [as 别名]
def items(self) -> ItemsView:
        """
        Returns all of the steps as tuples items (step_name, step).

        :return: step items tuple : (step name, step)
        """
        return self.steps.items() 
开发者ID:Neuraxio,项目名称:Neuraxle,代码行数:9,代码来源:base.py

示例7: items

# 需要导入模块: import typing [as 别名]
# 或者: from typing import ItemsView [as 别名]
def items(self) -> ItemsView:
        """ Returns :class:`ItemsView` for all dictionary entries as (:attr:`key`, :class:`DXFEntity`) pairs. """
        for key in self.keys():
            yield key, self.get(key)  # maybe handle -> DXFEntity 
开发者ID:mozman,项目名称:ezdxf,代码行数:6,代码来源:dictionary.py

示例8: items

# 需要导入模块: import typing [as 别名]
# 或者: from typing import ItemsView [as 别名]
def items(self) -> ItemsView[str, DXFAttr]:
        return self._attribs.items() 
开发者ID:mozman,项目名称:ezdxf,代码行数:4,代码来源:attributes.py

示例9: _make_iter_from_node

# 需要导入模块: import typing [as 别名]
# 或者: from typing import ItemsView [as 别名]
def _make_iter_from_node(self, offset: int) -> ItemsView[str, int]:
        """ Return an iterator over the prefixes and next node pointers
            of the edge at the given offset. If this is the first time
            that the edge is iterated, cache its unpacked contents
            in a dictionary for quicker subsequent iteration. """
        try:
            d = self._iter_cache[offset]
        except KeyError:
            d = {
                prefix: nextnode
                for prefix, nextnode in self._iter_from_node(offset)
            }
            self._iter_cache[offset] = d
        return d.items() 
开发者ID:mideind,项目名称:ReynirPackage,代码行数:16,代码来源:dawgdictionary.py

示例10: items

# 需要导入模块: import typing [as 别名]
# 或者: from typing import ItemsView [as 别名]
def items(self) -> ItemsView[KT, VT]:
        return cast(ItemsView[KT, VT], sorted(super().items())) 
开发者ID:m13253,项目名称:VxWireguard-Generator,代码行数:4,代码来源:common.py

示例11: test_items

# 需要导入模块: import typing [as 别名]
# 或者: from typing import ItemsView [as 别名]
def test_items(self):
        conn = AMQPConnection(
            hostname="localhost", username="guest", password="pwd"
        )
        self.assertEqual(ItemsView(conn), conn.items()) 
开发者ID:b2wdigital,项目名称:async-worker,代码行数:7,代码来源:test_rabbitmq_connections.py


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