(cls, uri: str, parsed=None)
| 46 | |
| 47 | @classmethod |
| 48 | def get_format(cls, uri: str, parsed=None) -> OutputBase: |
| 49 | if not parsed: |
| 50 | parsed = parse.urlparse(uri) |
| 51 | |
| 52 | for fmt_name, fmt in cls.get_all_output_formats().items(): |
| 53 | if fmt_name == uri: # This will match also "protocol" so we don't need to specify "protocol://" |
| 54 | return fmt |
| 55 | elif fmt.is_supported(parsed_uri=parsed): |
| 56 | return fmt |
| 57 | |
| 58 | raise exceptions.InvalidOutput(f"No such output format `{uri}`") |
| 59 | |
| 60 | |
| 61 | @dataclass() |
no test coverage detected