(self, args: tuple[str, ...])
| 223 | args: dc.InitVar[tuple[str, ...]] = () |
| 224 | |
| 225 | def __post_init__(self, args: tuple[str, ...]) -> None: |
| 226 | valid_types = ('buffer', 'file', 'suppress') |
| 227 | if self.type not in valid_types: |
| 228 | fail( |
| 229 | f"Invalid destination type {self.type!r} for {self.name}, " |
| 230 | f"must be {', '.join(valid_types)}" |
| 231 | ) |
| 232 | extra_arguments = 1 if self.type == "file" else 0 |
| 233 | if len(args) < extra_arguments: |
| 234 | fail(f"Not enough arguments for destination " |
| 235 | f"{self.name!r} new {self.type!r}") |
| 236 | if len(args) > extra_arguments: |
| 237 | fail(f"Too many arguments for destination {self.name!r} new {self.type!r}") |
| 238 | if self.type =='file': |
| 239 | d = {} |
| 240 | filename = self.clinic.filename |
| 241 | d['path'] = filename |
| 242 | dirname, basename = os.path.split(filename) |
| 243 | if not dirname: |
| 244 | dirname = '.' |
| 245 | d['dirname'] = dirname |
| 246 | d['basename'] = basename |
| 247 | d['basename_root'], d['basename_extension'] = os.path.splitext(filename) |
| 248 | self.filename = args[0].format_map(d) |
| 249 | |
| 250 | def __repr__(self) -> str: |
| 251 | if self.type == 'file': |
nothing calls this directly
no test coverage detected