Skip to content

Commit

Permalink
Merge pull request #11 from jdavcs/mypy
Browse files Browse the repository at this point in the history
Add mypy to CI under python 3.8
  • Loading branch information
mvdbeek authored Feb 22, 2024
2 parents 3504cd5 + b4de841 commit da86abb
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 13 deletions.
21 changes: 10 additions & 11 deletions galaxy_release_util/point_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,13 +172,11 @@ def add_changelog_item(changes, child):
changelog_items: List[ChangelogItem] = []
root_section = document[0]
assert isinstance(root_section, docutils.nodes.section)
assert root_section.tagname == "section"
for release in root_section.children:
for node in root_section.children:
# ignore title and comment
assert isinstance(release, (docutils.nodes.title, docutils.nodes.comment, docutils.nodes.section)), release
if release.tagname == "section":
assert release[0].tagname == "title"
release_version = release[0].astext()
assert isinstance(node, (docutils.nodes.title, docutils.nodes.comment, docutils.nodes.section)), node
if isinstance(node, docutils.nodes.section):
release_version = node[0].astext()
current_date = None
if " (" in release_version:
version_str, current_date = release_version.split(" (")
Expand All @@ -189,19 +187,20 @@ def add_changelog_item(changes, child):
version_str = release_version
current_version = Version(version_str)
package.add_release(ReleaseItem(version=current_version, date=current_date))
changes = []
for changelog_item in release[1:]:
changes: List = []
for changelog_item in node[1:]:
# could be bullet list or a nested section with bugfix, docs, etc
if changelog_item.tagname == "bullet_list":
if isinstance(changelog_item, docutils.nodes.bullet_list):
for child in changelog_item.children:
add_changelog_item(changes, child)
elif changelog_item.tagname == "paragraph":
elif isinstance(changelog_item, docutils.nodes.paragraph):
changes = changelog_item.rawsource.splitlines()
elif changelog_item.tagname == "section":
elif isinstance(changelog_item, docutils.nodes.section):
kind = changelog_item[0].astext()
section_delimiter = "=" * len(kind)
changes.append(f"\n{section_delimiter}\n{kind}\n{section_delimiter}\n")
for section_changelog_item in changelog_item[1:]:
assert isinstance(section_changelog_item, docutils.nodes.bullet_list)
for child in section_changelog_item:
add_changelog_item(changes, child)
changelog_items.append(ChangelogItem(version=current_version, date=current_date, changes=changes))
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ line-length = 120
[tool.ruff]
line-length = 120
# Never enforce `E501`, enforced by black
ignore = ["E501"]
lint.ignore = ["E501"]
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ python =
3.11 = unit
3.10 = unit
3.9 = unit
3.8 = unit
3.8 = unit,mypy

[testenv]
commands =
Expand Down

0 comments on commit da86abb

Please sign in to comment.