當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。