Skip to content

Commit

Permalink
Add changes following review.
Browse files Browse the repository at this point in the history
* remove unreachable code
* remove commented out items
* Update docstring args to match function args.
* Use Optional[] rather than Union[T, None]
  • Loading branch information
ajkavanagh committed Nov 29, 2023
1 parent f561bcc commit 26f9a19
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
10 changes: 2 additions & 8 deletions charmhub_lp_tools/charm_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
import logging
import subprocess
import tempfile
from typing import (Any, Dict, Generator, List, Tuple, IO, Optional, Set,
Union)
from typing import (Any, Dict, Generator, List, Tuple, IO, Optional, Set)
import sys
import time
import yaml
Expand Down Expand Up @@ -465,11 +464,6 @@ def get_all_revisions_for_bases_by_arch(
if delete:
del revisions_[all_arch]
return revisions_
# now just keep the highest revision for each arch.
highest_revisions: Dict[str, int] = {}
for k, v in revisions_.items():
highest_revisions[k] = list(sorted(v))[-1]
return highest_revisions

def get_revisions_for_bases_by_arch(
self,
Expand Down Expand Up @@ -1864,7 +1858,7 @@ def copy_revisions(self,
CharmChannel.str_revisions_by_arch(destination_arch_revisions))

# don't duplicate releases to the same channel.
revision_pairs: Set[Tuple[int, Union[int, None]]] = set()
revision_pairs: Set[Tuple[int, Optional[int]]] = set()
for arch, revision in arch_revisions.items():
dest_revision = destination_arch_revisions.get(arch)
if (revision, dest_revision) in revision_pairs:
Expand Down
5 changes: 2 additions & 3 deletions charmhub_lp_tools/revisions.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ def setup_parser(
parser.add_argument(
'--format',
dest='format',
# choices=('table', 'json', 'html'),
choices=('table', 'json', 'rst'),
default='table',
type=str.lower,
Expand Down Expand Up @@ -100,8 +99,8 @@ def get_revisions(channel: CharmChannel,
"""Get the revisions by base -> arch -> [revisions].
:param channel: the charm channel to work against.
:param bases: Optional list of bases to restrict report to.
:param arches: Optional list of arches to restrict report to.
:param args_bases: Optional list of bases to restrict report to.
:param args_arches: Optional list of arches to restrict report to.
:returns: a mapping of base -> arch -> List of revisions
"""
revisions: Dict[str, Dict[str, Set[int]]] = {}
Expand Down

0 comments on commit 26f9a19

Please sign in to comment.