Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

utils.args: rewrite module #5778

Merged
merged 4 commits into from Jan 16, 2024
Merged

Conversation

bastimeyer
Copy link
Member

This updates and fixes the streamlink.utils.args module, in preparation for #5715 (which I will rebase and modify after this got merged - after the next release).


The first commit keeps the same functionality as the current implementation, apart from different exceptions being raised. The tests have been fully rewritten, but the old tests also pass (ignoring the exception class changes).

The second and third commits fix some issues with the inputs of filesize() and keyvalue(). This will affect the --ringbuffer-size argument, as well as --http-header, --http-cookie, --http-query-param, --player-env, --twitch-api-header and --twitch-access-token-param. This is mainly just whitespace character related but it fixes the missing regex anchors.

The last commit fixes the incorrect --ringbuffer-size help text and removes an old and probably unnecessary note.

- Add typing annotations
- Replace `argparse.ArgumentTypeError` with `ValueError`
  and add missing `ValueError` messages
- Simplify `comma_list_filter()` using list comprehension syntax
- Update `filesize`
  - Simplify and fix regex
  - Use unit/modifier map
  - Fix zero value check
- Rewrite tests
- Strip whitespace at the beginning and set regex anchors
- Ignore trailing key name whitespace
- Strip whitespace at the beginning and at the end
- Set regex anchors
@bastimeyer bastimeyer merged commit 163a9b6 into streamlink:master Jan 16, 2024
21 checks passed
@bastimeyer bastimeyer deleted the utils/args/rewrite branch January 16, 2024 13:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant