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

Declare reframed.solvers.solver.Solver an abstract base class #9

Open
yaccos opened this issue Apr 5, 2022 · 1 comment
Open

Declare reframed.solvers.solver.Solver an abstract base class #9

yaccos opened this issue Apr 5, 2022 · 1 comment

Comments

@yaccos
Copy link

yaccos commented Apr 5, 2022

I have looked into the Solver class and understand it like this is basically a template class for the actual solver classes. As this class is never intended to be instanciated by itself, I recommend declaring it an Abstract Base Class, this is, inheirit the class from abc.ABC. The current setup confuses code analysis tools to think that calling the solve() method from a Solver object always throws an exception. Also, I would suggest specifying the exceptions raised by Solver when trying to class a non-implemented method as NotImplementedError instead of the plain Exception class.

@yaccos
Copy link
Author

yaccos commented Apr 5, 2022

Please read microsoft/pylance-release#790 for a discussion of the problems which occur with the current approach.

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