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

Skip to content

plugin.api.validate: deprecate text alias#5090

Merged
gravyboat merged 1 commit into
streamlink:masterfrom
bastimeyer:plugin/api/validate/deprecate-text
Jan 13, 2023
Merged

plugin.api.validate: deprecate text alias#5090
gravyboat merged 1 commit into
streamlink:masterfrom
bastimeyer:plugin/api/validate/deprecate-text

Conversation

@bastimeyer

Copy link
Copy Markdown
Member
  • Deprecate text alias and raise StreamlinkDeprecationWarning on access
  • Add deprecation to docs
  • Replace validate.text with str in remaining plugins
  • Update test

The deprecation warning gets triggered when accessing text via the module's __getattr__() method. This is better than raising the warning when validating a specifc schema with a specific input.

Importing * from the validate module will also trigger the deprecation warning, but that's nothing that can be changed unless text gets removed from __all__, but that would be a breaking change from the previous implicit inclusion of all module namespace members. So if there are third-party plugins which import * and are not using text, then they will still trigger the warning. But since importing * is already considered bad practice, I don't care much about that.

As you can see from the number of plugin changes, there are quite a few plugins which haven't been touched in a long time, and I suspect that some of them are also broken. Either way, validate.text had to be replaced with str, even though I don't really like touching unmaintained plugin code with automated changes like this.

- Deprecate text alias and raise StreamlinkDeprecationWarning on access
- Add deprecation to docs
- Replace validate.text with str in remaining plugins
- Update test
@gravyboat gravyboat merged commit c211e58 into streamlink:master Jan 13, 2023
@bastimeyer bastimeyer deleted the plugin/api/validate/deprecate-text branch January 13, 2023 21:11
jbleyel added a commit to oe-mirrors/streamlink-plugins that referenced this pull request Jul 3, 2023
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