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

Replace @classmethod with @staticmethod? #138

Closed
heuer opened this issue Mar 5, 2024 · 2 comments · Fixed by #140
Closed

Replace @classmethod with @staticmethod? #138

heuer opened this issue Mar 5, 2024 · 2 comments · Fixed by #140
Labels
good first issue Good for newcomers

Comments

@heuer
Copy link
Contributor

heuer commented Mar 5, 2024

Several classes (Renderer, Allocator, …) have a factory function which does not use the passed cls argument at all, they can be decorated with @staticmethod without any difference.

Example:

@classmethod

    @classmethod
    def autocreate(cls, backend: Backend, renderer: Renderer) -> Allocator:
        """Creates the adequate allocator given a backend and a renderer."""
        ret = lib.wlr_allocator_autocreate(backend._ptr, renderer._ptr)
        if not ret:
            raise RuntimeError("Unable to create an allocator.")
        return Allocator(ret)
@flacjacket flacjacket added the good first issue Good for newcomers label Mar 5, 2024
@flacjacket
Copy link
Owner

This is a good point, happy to accept a PR for this, otherwise I can change these as I see them.

@heuer
Copy link
Contributor Author

heuer commented Mar 5, 2024

I'll provide a PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants