Ejemplo n.º 1
0
 def from_file(f):
     """Deserialize results from a given file handle."""
     try:
         for result in pickling.iter_stream(f):
             if isinstance(result, results.Result):
                 yield result
             else:
                 raise DeserializationError(f'invalid data type: {result!r}')
     except pickle.UnpicklingError as e:
         raise DeserializationError(f'failed unpickling result') from e
Ejemplo n.º 2
0
 def digest(self, pickle_file):
     """Loads pkgcore_checks reports from pickle_file, formats them as 
        QAReport objects, and stuffs them into a tuple.
     """
     qareports = []
     pchecks = tuple(iter_stream(open(pickle_file)))
     # The first pcheck is a pickle streamheader, and the last is an
     # unusedglobalflagresult, whatever that means, anyways, I don't
     # want them.
     for pcheck in pchecks[1:-1]:
         qareports.append(QAReport(pcheck))
     self.qareports = tuple(qareports)
Ejemplo n.º 3
0
def _load_pickles(file):
    """ _load_pickles(file): Unpickles the given file and returns a tuple 
        containing the objects within.
    """
    return tuple(iter_stream(open(file)))
Ejemplo n.º 4
0
 def unpack_pickles(self, filename):
     """returns a tuple containing pkgcore_checks report objects"""
     return tuple(iter_stream(open(filename)))