eric7/DebugClients/Python/coverage/disposition.py

branch
eric7
changeset 8312
800c432b34c8
parent 7427
362cd1b6f81a
child 8775
0802ae193343
equal deleted inserted replaced
8311:4e8b98454baa 8312:800c432b34c8
1 # Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
2 # For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt
3
4 """Simple value objects for tracking what to do with files."""
5
6
7 class FileDisposition(object):
8 """A simple value type for recording what to do with a file."""
9 pass
10
11
12 # FileDisposition "methods": FileDisposition is a pure value object, so it can
13 # be implemented in either C or Python. Acting on them is done with these
14 # functions.
15
16 def disposition_init(cls, original_filename):
17 """Construct and initialize a new FileDisposition object."""
18 disp = cls()
19 disp.original_filename = original_filename
20 disp.canonical_filename = original_filename
21 disp.source_filename = None
22 disp.trace = False
23 disp.reason = ""
24 disp.file_tracer = None
25 disp.has_dynamic_filename = False
26 return disp
27
28
29 def disposition_debug_msg(disp):
30 """Make a nice debug message of what the FileDisposition is doing."""
31 if disp.trace:
32 msg = "Tracing %r" % (disp.original_filename,)
33 if disp.file_tracer:
34 msg += ": will be traced by %r" % disp.file_tracer
35 else:
36 msg = "Not tracing %r: %s" % (disp.original_filename, disp.reason)
37 return msg

eric ide

mercurial