Skip to content

Possible use for pass #2642

@Day0Dreamer

Description

@Day0Dreamer

From:
WPS420 — Forbid some python keywords.

pass keyword is just useless by design. There’s no use-case for it. Because it does literally nothing.

This is a snippet from a selector. In short, we need at the end a copy of render_data. We can get render_data out of doc, but sometimes we have only the data and no doc in sight.

class RenderSettings(object):

    def __init__(
        self,
        doc: Optional[c4d.documents.BaseDocument] | None = None,
        render_data: Optional[RenderData] | None = None,
    ):
        match (doc, render_data):
            case (None, None):
                doc = c4d.documents.GetActiveDocument()
                render_data = doc.GetActiveRenderData()
            case (None, _):
                pass
            case (_, None):
                render_data = doc.GetActiveRenderData()
            case (_, _):
                raise ValueError("doc and render_data are mutually exclusive.")

        if render_data is None:
            raise RuntimeError("No render data found.")

        self.rd: RenderData = render_data.GetClone()

It would seem, I literally want to just exit the match-case in a case where we have only render_data at the input.

Am I missing something?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions