(cls, raw)
| 161 | class FileInfo(namedtuple('FileInfo', 'filename lno')): |
| 162 | @classmethod |
| 163 | def from_raw(cls, raw): |
| 164 | if isinstance(raw, cls): |
| 165 | return raw |
| 166 | elif isinstance(raw, tuple): |
| 167 | return cls(*raw) |
| 168 | elif not raw: |
| 169 | return None |
| 170 | elif isinstance(raw, str): |
| 171 | return cls(raw, -1) |
| 172 | else: |
| 173 | raise TypeError(f'unsupported "raw": {raw:!r}') |
| 174 | |
| 175 | def __str__(self): |
| 176 | return self.filename |
no test coverage detected