mirror of
https://github.com/vinta/awesome-python.git
synced 2026-05-13 16:37:59 +00:00
refactor(readme_parser): consolidate state reset to tail of flush_group
State reset (current_group_name = None, current_group_cats = []) was duplicated in both branches of the early-return guard. Move it after the conditional so it runs exactly once regardless of path. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
b897676e01
commit
e47d229528
1 changed files with 7 additions and 10 deletions
|
|
@ -324,16 +324,13 @@ def _parse_grouped_sections(
|
|||
|
||||
def flush_group() -> None:
|
||||
nonlocal current_group_name, current_group_cats
|
||||
if not current_group_cats:
|
||||
current_group_name = None
|
||||
current_group_cats = []
|
||||
return
|
||||
name = current_group_name or "Other"
|
||||
groups.append(ParsedGroup(
|
||||
name=name,
|
||||
slug=slugify(name),
|
||||
categories=list(current_group_cats),
|
||||
))
|
||||
if current_group_cats:
|
||||
name = current_group_name or "Other"
|
||||
groups.append(ParsedGroup(
|
||||
name=name,
|
||||
slug=slugify(name),
|
||||
categories=list(current_group_cats),
|
||||
))
|
||||
current_group_name = None
|
||||
current_group_cats = []
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue