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

EnforceOverrides fails on nested classes #86

Open
ashwin153 opened this issue May 13, 2021 · 3 comments
Open

EnforceOverrides fails on nested classes #86

ashwin153 opened this issue May 13, 2021 · 3 comments
Labels

Comments

@ashwin153
Copy link
Collaborator

If you run this in a REPL it fails (Python 3.8). I've stared at this for an hour and I have no idea why it fails. Do you guys have any ideas?

import overrides

class Foo:
    class Bar(overrides.EnforceOverrides):
        def to_dict(self): 
            pass
    class Car(Bar):
        @overrides.overrides
        def to_dict(self):
            pass

To be clear, this works fine.

class Foo:
    class Bar:
        def to_dict(self): 
            pass
    class Car(Bar):
        def to_dict(self):
            pass
@hubertqtf
Copy link

hubertqtf commented Jul 15, 2022

I have same issue

class Outer(object):
    class Inner(object):
             pass
 
class ChildOuter(Outer):
     class Inner(Outer.Inner):
            pass

this doesn't work as well

@mkorpela mkorpela added the bug label Oct 7, 2022
@mkorpela
Copy link
Owner

mkorpela commented Oct 9, 2022

This currently works

from overrides import overrides


class Outer(object):
    class Inner(object):
        pass


class ChildOuter(Outer):
    @overrides
    class Inner(Outer.Inner):
        pass

@hubertqtf
Copy link

This currently works

from overrides import overrides


class Outer(object):
    class Inner(object):
        pass


class ChildOuter(Outer):
    @overrides
    class Inner(Outer.Inner):
        pass

Awesome! This may look like narrow case, but in case of web automation, where code resembles page layout - i use it quite a lot! My worst case was to get data from a graph, that has inner dots to hover, that opened a tooltip, that had those data, so 3 times nested classes just for that graph... and all svg elements! It was a nightmare, but currently i can fetch those data and even self-recover in case of mis-hover or any other interruption...
Nevertheless, as always, thank you for support and I am glad that code continues to improve!
Have a nice day!
Hubert

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

No branches or pull requests

3 participants