Exemplo n.º 1
0
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]
Exemplo n.º 2
0
 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))
Exemplo n.º 3
0
 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))
Exemplo n.º 4
0
 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))
Exemplo n.º 5
0
 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))
Exemplo n.º 6
0
 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))