Python typing.ItemsView() Examples
The following are 12
code examples of typing.ItemsView().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
typing
, or try the search function
.
Example #1
Source File: redis_cache.py From bot with MIT License | 6 votes |
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
Example #2
Source File: build.py From brownie with MIT License | 5 votes |
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]
Example #3
Source File: datatypes.py From brownie with MIT License | 5 votes |
def items(self) -> ItemsView: """ReturnValue.items() -> a set-like object providing a view on ReturnValue's named items""" return self._dict.items() # type: ignore
Example #4
Source File: TomlFile.py From ProjectAlice with GNU General Public License v3.0 | 5 votes |
def items(self) -> ItemsView: return self._data.items()
Example #5
Source File: TomlFile.py From ProjectAlice with GNU General Public License v3.0 | 5 votes |
def items(self) -> ItemsView: return self.data.items() # noinspection PyMethodOverriding
Example #6
Source File: dict.py From rupo with Apache License 2.0 | 5 votes |
def get_all(self) -> ItemsView[str, Set[Stress]]: """ :return items: все ключи и ударения словаря. """ return self.data.items()
Example #7
Source File: base.py From Neuraxle with Apache License 2.0 | 5 votes |
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()
Example #8
Source File: dictionary.py From ezdxf with MIT License | 5 votes |
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
Example #9
Source File: attributes.py From ezdxf with MIT License | 5 votes |
def items(self) -> ItemsView[str, DXFAttr]: return self._attribs.items()
Example #10
Source File: dawgdictionary.py From ReynirPackage with GNU General Public License v3.0 | 5 votes |
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()
Example #11
Source File: common.py From VxWireguard-Generator with MIT License | 5 votes |
def items(self) -> ItemsView[KT, VT]: return cast(ItemsView[KT, VT], sorted(super().items()))
Example #12
Source File: test_rabbitmq_connections.py From async-worker with MIT License | 5 votes |
def test_items(self): conn = AMQPConnection( hostname="localhost", username="guest", password="pwd" ) self.assertEqual(ItemsView(conn), conn.items())