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

Remove impossible add_stream overload #1614

Closed
wants to merge 1 commit into from

Conversation

cdce8p
Copy link
Contributor

@cdce8p cdce8p commented Nov 3, 2024

Remove overload which allowed codec_name and template to both have a value / have no value. The code requires that exactly one of the two has a value which is expressed by the other three overloads.

Leftover from #1610.

def add_stream(self, codec_name=None, object rate=None, Stream template=None, options=None, **kwargs):
"""add_stream(codec_name, rate=None)
Creates a new stream from a codec name or a template, and returns it.
:param codec_name: The name of a codec.
:type codec_name: str | Codec | None
:param template: Copy codec from another :class:`~av.stream.Stream` instance.
:type template: :class:`~av.stream.Stream` | None
:param dict options: Stream options.
:param \\**kwargs: Set attributes for the stream.
:rtype: The new :class:`~av.stream.Stream`.
"""
if (codec_name is None and template is None) or (codec_name is not None and template is not None):
raise ValueError("needs one of codec_name or template")

@WyattBlue
Copy link
Member

I think #1615 solves this more completely.

@WyattBlue WyattBlue closed this Nov 3, 2024
@cdce8p cdce8p deleted the remove-impossible-overload branch November 3, 2024 23:19
@cdce8p
Copy link
Contributor Author

cdce8p commented Nov 3, 2024

I think #1615 solves this more completely.

Yes it does. Thanks!

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