eric7/DebugClients/Python/coverage/data.py

branch
eric7
changeset 8527
2bd1325d727e
parent 8312
800c432b34c8
child 8775
0802ae193343
equal deleted inserted replaced
8526:587202572b10 8527:2bd1325d727e
50 else: 50 else:
51 hasher.update(sorted(data.lines(filename) or [])) 51 hasher.update(sorted(data.lines(filename) or []))
52 hasher.update(data.file_tracer(filename)) 52 hasher.update(data.file_tracer(filename))
53 53
54 54
55 def combine_parallel_data(data, aliases=None, data_paths=None, strict=False): 55 def combine_parallel_data(data, aliases=None, data_paths=None, strict=False, keep=False):
56 """Combine a number of data files together. 56 """Combine a number of data files together.
57 57
58 Treat `data.filename` as a file prefix, and combine the data from all 58 Treat `data.filename` as a file prefix, and combine the data from all
59 of the data files starting with that prefix plus a dot. 59 of the data files starting with that prefix plus a dot.
60 60
66 `data.filename` plus dot as a prefix, and those files are combined. 66 `data.filename` plus dot as a prefix, and those files are combined.
67 67
68 If `data_paths` is not provided, then the directory portion of 68 If `data_paths` is not provided, then the directory portion of
69 `data.filename` is used as the directory to search for data files. 69 `data.filename` is used as the directory to search for data files.
70 70
71 Every data file found and combined is then deleted from disk. If a file 71 Unless `keep` is True every data file found and combined is then deleted from disk. If a file
72 cannot be read, a warning will be issued, and the file will not be 72 cannot be read, a warning will be issued, and the file will not be
73 deleted. 73 deleted.
74 74
75 If `strict` is true, and no files are found to combine, an error is 75 If `strict` is true, and no files are found to combine, an error is
76 raised. 76 raised.
114 # use the message as the warning. 114 # use the message as the warning.
115 data._warn(str(exc)) 115 data._warn(str(exc))
116 else: 116 else:
117 data.update(new_data, aliases=aliases) 117 data.update(new_data, aliases=aliases)
118 files_combined += 1 118 files_combined += 1
119 if data._debug.should('dataio'): 119 if not keep:
120 data._debug.write("Deleting combined data file %r" % (f,)) 120 if data._debug.should('dataio'):
121 file_be_gone(f) 121 data._debug.write("Deleting combined data file %r" % (f,))
122 file_be_gone(f)
122 123
123 if strict and not files_combined: 124 if strict and not files_combined:
124 raise CoverageException("No usable data files") 125 raise CoverageException("No usable data files")

eric ide

mercurial