本文整理汇总了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
示例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]
示例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
示例4: items
# 需要导入模块: import typing [as 别名]
# 或者: from typing import ItemsView [as 别名]
def items(self) -> ItemsView:
return self._data.items()
示例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()
示例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()
示例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
示例8: items
# 需要导入模块: import typing [as 别名]
# 或者: from typing import ItemsView [as 别名]
def items(self) -> ItemsView[str, DXFAttr]:
return self._attribs.items()
示例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()
示例10: items
# 需要导入模块: import typing [as 别名]
# 或者: from typing import ItemsView [as 别名]
def items(self) -> ItemsView[KT, VT]:
return cast(ItemsView[KT, VT], sorted(super().items()))
示例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())