Skip to content

Commit 212ec60

Browse files
hugovkAA-Turner
andauthored
Apply suggestions from code review
Co-authored-by: Adam Turner <[email protected]>
1 parent 7aef3ec commit 212ec60

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

build_docs.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def from_json(cls, data) -> Versions:
8686
)
8787
return cls(versions)
8888

89-
def filter(self, branches: list[str] = None) -> Sequence[Version]:
89+
def filter(self, branches: Sequence[str] = ()) -> Sequence[Version]:
9090
"""Filter the given versions.
9191
9292
If *branches* is given, only *versions* matching *branches* are returned.
@@ -95,8 +95,9 @@ def filter(self, branches: list[str] = None) -> Sequence[Version]:
9595
security-fixes branches).
9696
"""
9797
if branches:
98+
branches = frozenset(branches)
9899
return [
99-
v for v in self if v.name in branches or v.branch_or_tag in branches
100+
v for v in self if {v.name, v.branch_or_tag} & branches
100101
]
101102
return [v for v in self if v.status not in {"EOL", "security-fixes"}]
102103

@@ -996,9 +997,6 @@ def parse_args():
996997
version_info()
997998
sys.exit(0)
998999
del args.version
999-
if args.branch and not args.branches:
1000-
args.branches = args.branch
1001-
del args.branch
10021000
if args.log_directory:
10031001
args.log_directory = args.log_directory.resolve()
10041002
if args.build_root:

0 commit comments

Comments
 (0)