Skip to content

Commit

Permalink
rm LegacyVersion
Browse files Browse the repository at this point in the history
  • Loading branch information
awoimbee committed Jan 25, 2023
1 parent 6dd1aff commit d6063fd
Showing 1 changed file with 18 additions and 22 deletions.
40 changes: 18 additions & 22 deletions src/docs_versions_menu/groups.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""Classification of folders into groups according to :pep:`440`."""
from packaging.version import LegacyVersion
from packaging.version import parse as parse_version


Expand Down Expand Up @@ -51,26 +50,23 @@ def get_groups(folders, default_branches=None):
version = parse_version(folder)
if folder in default_branches:
groups['default-branch'].add(folder)
if isinstance(version, LegacyVersion):
groups['branches'].add(folder)
else:
groups['releases'].add(folder)
is_final = True
if version.local is not None:
groups['local-releases'].add(folder)
is_final = False
if version.is_devrelease:
groups['dev-releases'].add(folder)
is_final = False
if version.is_prerelease:
groups['pre-releases'].add(folder)
is_final = False
if version.is_postrelease:
groups['post-releases'].add(folder)
groups['public-releases'].add(folder)
is_final = False
if is_final:
groups['final-releases'].add(folder)
groups['public-releases'].add(folder)
groups['releases'].add(folder)
is_final = True
if version.local is not None:
groups['local-releases'].add(folder)
is_final = False
if version.is_devrelease:
groups['dev-releases'].add(folder)
is_final = False
if version.is_prerelease:
groups['pre-releases'].add(folder)
is_final = False
if version.is_postrelease:
groups['post-releases'].add(folder)
groups['public-releases'].add(folder)
is_final = False
if is_final:
groups['final-releases'].add(folder)
groups['public-releases'].add(folder)
groups['all'] = set(folders)
return groups

0 comments on commit d6063fd

Please sign in to comment.