eric7/DebugClients/Python/coverage/data.py

branch
eric7
changeset 8775
0802ae193343
parent 8527
2bd1325d727e
child 8929
fcca2fa618bf
--- a/eric7/DebugClients/Python/coverage/data.py	Fri Nov 19 19:28:47 2021 +0100
+++ b/eric7/DebugClients/Python/coverage/data.py	Sat Nov 20 16:47:38 2021 +0100
@@ -13,7 +13,8 @@
 import glob
 import os.path
 
-from coverage.misc import CoverageException, file_be_gone
+from coverage.exceptions import CoverageException
+from coverage.misc import file_be_gone
 from coverage.sqldata import CoverageData
 
 
@@ -52,7 +53,9 @@
     hasher.update(data.file_tracer(filename))
 
 
-def combine_parallel_data(data, aliases=None, data_paths=None, strict=False, keep=False):
+def combine_parallel_data(
+    data, aliases=None, data_paths=None, strict=False, keep=False, message=None,
+):
     """Combine a number of data files together.
 
     Treat `data.filename` as a file prefix, and combine the data from all
@@ -90,7 +93,7 @@
             pattern = os.path.join(os.path.abspath(p), localdot)
             files_to_combine.extend(glob.glob(pattern))
         else:
-            raise CoverageException("Couldn't combine from non-existent path '%s'" % (p,))
+            raise CoverageException(f"Couldn't combine from non-existent path '{p}'")
 
     if strict and not files_to_combine:
         raise CoverageException("No data to combine")
@@ -101,10 +104,10 @@
             # Sometimes we are combining into a file which is one of the
             # parallel files.  Skip that file.
             if data._debug.should('dataio'):
-                data._debug.write("Skipping combining ourself: %r" % (f,))
+                data._debug.write(f"Skipping combining ourself: {f!r}")
             continue
         if data._debug.should('dataio'):
-            data._debug.write("Combining data file %r" % (f,))
+            data._debug.write(f"Combining data file {f!r}")
         try:
             new_data = CoverageData(f, debug=data._debug)
             new_data.read()
@@ -116,9 +119,11 @@
         else:
             data.update(new_data, aliases=aliases)
             files_combined += 1
+            if message:
+                message(f"Combined data file {os.path.relpath(f)}")
             if not keep:
                 if data._debug.should('dataio'):
-                    data._debug.write("Deleting combined data file %r" % (f,))
+                    data._debug.write(f"Deleting combined data file {f!r}")
                 file_be_gone(f)
 
     if strict and not files_combined:

eric ide

mercurial