def test_xiter(): from eve.utils import xiter it = xiter(range(6)) assert isinstance(it, XIterable) assert list(it) == [0, 1, 2, 3, 4, 5] it = xiter([0, 1, 2, 3, 4, 5]) assert isinstance(it, XIterable) assert list(it) == [0, 1, 2, 3, 4, 5]
def write_offsets(self) -> Dict[str, Set[OffsetT]]: """Get a dictionary, mapping written fields' names to sets of offset tuples.""" return self._offset_dict( xiter(self._ordered_accesses).filter(lambda x: x.is_write))
def offsets(self) -> Dict[str, Set[OffsetT]]: """Get a dictionary, mapping all accessed fields' names to sets of offset tuples.""" return self._offset_dict(xiter(self._ordered_accesses))
def write_accesses(self) -> List[AccessT]: """Get the sub-list of write accesses.""" return list( xiter(self._ordered_accesses).filter(lambda x: x.is_write))
def read_accesses(self) -> List[AccessT]: """Get the sub-list of read accesses.""" return list( xiter(self._ordered_accesses).filter(lambda x: x.is_read))
def read_offsets(self) -> Dict[str, Set[OffsetT]]: """Get a dictonary, mapping read fields' names to sets of offset tuples.""" return self._offset_dict( xiter(self._ordered_accesses).filter(lambda x: x.is_read))