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

Inherited classes won't inherit decorators #224

Open
gs202 opened this issue May 18, 2021 · 0 comments
Open

Inherited classes won't inherit decorators #224

gs202 opened this issue May 18, 2021 · 0 comments

Comments

@gs202
Copy link

gs202 commented May 18, 2021

Describe the bug
If a child class inherits parent class, the decorators of the parent class won't be inherited

To Reproduce
For example

import uplink

@uplink.response_handler
def rsp_handler(response):
    print(f'request: {response.request.url}')
    return response

@rsp_handler
class GitHub(uplink.Consumer):
    @uplink.get("/users/{user}")
    def get_user(self, user):
        pass

class InheritedGitHub(GitHub):
    @uplink.get("/users/{user}")
    def get_user(self, user):
        pass

base_url = "https://api.github.com/"
GitHub(base_url).get_user("user_1")
InheritedGitHub(base_url).get_user("user_2")

will print only:
request: https://api.github.com/users/user_1

Expected behavior
I've expected both client classes to inherit the decorator and see this:

request: https://api.github.com/users/user_1
request: https://api.github.com/users/user_2

Additional context
uplink==0.9.3

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

No branches or pull requests

1 participant