PyPSA / linopy

Linear optimization with N-D labeled arrays in Python
https://linopy.readthedocs.io
MIT License
165 stars 51 forks source link

Improve cleanliness method print_infeasibilities() #354

Closed kruksik-dev closed 1 month ago

kruksik-dev commented 1 month ago

Currently, this method takes an argument that is of type None, and by default this parameter is also None. This is confusing when we want to use this method. In this MR, I correct the typing of this method so that it can accept int and None, but by default None is passed.

Additionally, the docstring for this method was difficult to read, so the generated documentation could also mislead the user. In the generated documentation there was no word about what this parameter is and that this method is only available when the gurobi solver is used (only visible in codebase via comment or when exception raised).

image

The revised docstring after generating the documentation should correct this and indicate that this method is only available when using the gurobi solver