| 17 | |
| 18 | |
| 19 | class ChangelogFormat(Protocol): |
| 20 | extension: ClassVar[str] |
| 21 | """Standard known extension associated with this format""" |
| 22 | |
| 23 | alternative_extensions: ClassVar[set[str]] |
| 24 | """Known alternatives extensions for this format""" |
| 25 | |
| 26 | config: BaseConfig |
| 27 | |
| 28 | def __init__(self, config: BaseConfig) -> None: |
| 29 | self.config = config |
| 30 | |
| 31 | @property |
| 32 | def ext(self) -> str: |
| 33 | """Dotted version of extensions, as in `pathlib` and `os` modules""" |
| 34 | return f".{self.extension}" |
| 35 | |
| 36 | @property |
| 37 | def template(self) -> str: |
| 38 | """Expected template name for this format""" |
| 39 | return f"CHANGELOG.{self.extension}.{TEMPLATE_EXTENSION}" |
| 40 | |
| 41 | @property |
| 42 | def default_changelog_file(self) -> str: |
| 43 | return f"CHANGELOG.{self.extension}" |
| 44 | |
| 45 | def get_metadata(self, filepath: str) -> Metadata: |
| 46 | """ |
| 47 | Extract the changelog metadata. |
| 48 | """ |
| 49 | raise NotImplementedError |
| 50 | |
| 51 | def get_latest_full_release(self, filepath: str) -> IncrementalMergeInfo: |
| 52 | """ |
| 53 | Extract metadata for the last non-pre-release. |
| 54 | """ |
| 55 | raise NotImplementedError |
| 56 | |
| 57 | |
| 58 | KNOWN_CHANGELOG_FORMATS: dict[str, type[ChangelogFormat]] = { |
nothing calls this directly
no outgoing calls
no test coverage detected