Thanks to visit codestin.com
Credit goes to github.com

Skip to content

plugin.api.validate: add RegexSchema#4709

Merged
gravyboat merged 1 commit into
streamlink:masterfrom
bastimeyer:plugin/api/validate/regexschema
Aug 5, 2022
Merged

plugin.api.validate: add RegexSchema#4709
gravyboat merged 1 commit into
streamlink:masterfrom
bastimeyer:plugin/api/validate/regexschema

Conversation

@bastimeyer

Copy link
Copy Markdown
Member

Follow-up of #4691 / #4708

As mentioned in #4702 (comment), non-optional regexes currently don't raise useful error messages when a simple re.Pattern or validate.transform(re.Pattern.search) validation is made. The RegexSchema raises a ValidationError with a proper error message if the return value is None. See the added tests.

validate.regex (RegexSchema) also takes a second parameter which changes the method that's called on the compiled regex pattern. This is useful for calling re.Pattern.findall for example.

@gravyboat gravyboat merged commit cd3645a into streamlink:master Aug 5, 2022
@bastimeyer bastimeyer deleted the plugin/api/validate/regexschema branch August 5, 2022 19:43
Billy2011 added a commit to Billy2011/streamlink-27 that referenced this pull request Aug 12, 2022
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.

2 participants