accessify icon indicating copy to clipboard operation
accessify copied to clipboard

Can't use parent's public method with protected method in it.

Open mostepunk opened this issue 2 years ago • 1 comments

Hello! Here my code that raises some errors that I can't understand.

class Car:
    @protected
    def start_engine(self):
        return "Engine's sound."

    def run(self):
        return self.start_engine()


class Tesla(Car):
    pass


if __name__ == "__main__":
    t = Tesla()
    t.run()

This code raises error

Traceback (most recent call last):
  File "/home/mostepan/dev/food/plgr.py", line 98, in <module>
    t.run()
  File "/home/mostepan/dev/food/plgr.py", line 89, in run
    return self.start_engine()
  File "/home/mostepan/dev/food/venv/lib/python3.10/site-packages/accessify/access.py", line 112, in protected_wrapper
    raise InaccessibleDueToItsProtectionLevelException(
accessify.errors.InaccessibleDueToItsProtectionLevelException: Tesla.start_engine() is inaccessible due to its protection level

I think there is an error somewhere.

mostepunk avatar Oct 03 '22 21:10 mostepunk

Today I faced the same problem. On the 31st of July, 2023 it's not fixed yet.

stepan-dolgorukov avatar Jul 31 '23 17:07 stepan-dolgorukov