Skip to content

Remove invalid argument unpacking in normalize_cats#23

Merged
geoffrey-wu merged 2 commits intoqbreader:mainfrom
jhaddixcodes:remove-append-unpacking
Apr 12, 2026
Merged

Remove invalid argument unpacking in normalize_cats#23
geoffrey-wu merged 2 commits intoqbreader:mainfrom
jhaddixcodes:remove-append-unpacking

Conversation

@jhaddixcodes
Copy link
Copy Markdown
Contributor

I believe this line (and the one a few lines below it) in normalize_cats will almost always raise a TypeError as append can only take one argument, but unpacking a list as arguments could yield 0 or 2+ arguments:

final_cats.append(*to_be_pushed_cats)

This occurs any time the to_be_pushed_cats or to_be_pushed_subcats lists have 0 or more than 1 member, as this means the unpacking results in an invalid number of arguments for append.

The standard way of doing this is to instead use the extend method of list which handles iterables correctly:

final_cats.extend(to_be_pushed_cats)

@geoffrey-wu geoffrey-wu merged commit 7a29209 into qbreader:main Apr 12, 2026
8 checks passed
@jhaddixcodes jhaddixcodes deleted the remove-append-unpacking branch April 12, 2026 18:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants