All patches and comments are welcome. Please squash your changes to logical
commits before using git-format-patch and git-send-email to
patches@git.madduck.net.
If you'd read over the Git project's submission guidelines and adhered to them,
I'd be especially grateful.
2 Check that the rev value in the example from ``the_basics.md`` matches
3 the latest version of Black. This saves us from forgetting to update that
4 during the release process.
11 from bs4 import BeautifulSoup
14 def main(changes: str, the_basics: str) -> None:
15 changes_html = commonmark.commonmark(changes)
16 changes_soup = BeautifulSoup(changes_html, "html.parser")
17 headers = changes_soup.find_all("h2")
18 tags = [header.string for header in headers if header.string != "Unreleased"]
21 the_basics_html = commonmark.commonmark(the_basics)
22 the_basics_soup = BeautifulSoup(the_basics_html, "html.parser")
25 for code_block in the_basics_soup.find_all(class_="language-console")
26 if "$ black --version" in code_block.string
30 for version_example in version_examples:
31 if tag in version_example and tag != latest_tag:
33 "Please set the version in the ``black --version`` "
34 "examples from ``the_basics.md`` to be the latest one.\n"
35 f"Expected {latest_tag}, got {tag}.\n"
40 if __name__ == "__main__":
41 with open("CHANGES.md", encoding="utf-8") as fd:
44 os.path.join("docs", "usage_and_configuration", "the_basics.md"),
47 the_basics = fd.read()
48 main(changes, the_basics)