mirror of
https://github.com/vinta/awesome-python.git
synced 2026-05-09 11:13:01 +08: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:
@@ -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 = []
|
||||
|
||||
|
||||
Reference in New Issue
Block a user