| 69 | """ |
| 70 | |
| 71 | def __init__(self, filename, sort="cumulative", dump=None): |
| 72 | self.force_write = ( |
| 73 | config.options is not None and config.options.force_write_profiles |
| 74 | ) |
| 75 | self.write = self.force_write or ( |
| 76 | config.options is not None and config.options.write_profiles |
| 77 | ) |
| 78 | self.fname = os.path.abspath(filename) |
| 79 | self.short_fname = os.path.split(self.fname)[-1] |
| 80 | self.data = collections.defaultdict( |
| 81 | lambda: collections.defaultdict(dict) |
| 82 | ) |
| 83 | self.dump = dump |
| 84 | self.sort = sort |
| 85 | self._read() |
| 86 | if self.write: |
| 87 | # rewrite for the case where features changed, |
| 88 | # etc. |
| 89 | self._write() |
| 90 | |
| 91 | @property |
| 92 | def platform_key(self): |