cog-imperial / OMLT

Represent trained machine learning models as Pyomo optimization formulations
Other
257 stars 56 forks source link

Linting and Formatting #84

Closed jalving closed 2 years ago

jalving commented 2 years ago

Legal Acknowledgement\ By contributing to this software project, I agree my contributions are submitted under the BSD license. I represent I am authorized to make the contributions and grant the license. If my employer has rights to intellectual property that includes these contributions, I represent that I have received permission to make contributions and grant the required license on behalf of that employer.

This PR makes many changes because it updates all of the code formatting. The main changes are:

Note that most linting is ignored. A separate issue will be opened to address flake8 stylistic requirements.

codecov[bot] commented 2 years ago

Codecov Report

Merging #84 (76c790c) into main (bc46b99) will not change coverage. The diff coverage is 90.67%.

@@           Coverage Diff           @@
##             main      #84   +/-   ##
=======================================
  Coverage   94.19%   94.19%           
=======================================
  Files          25       25           
  Lines        1240     1240           
  Branches      192      192           
=======================================
  Hits         1168     1168           
  Misses         42       42           
  Partials       30       30           
Impacted Files Coverage Δ
src/omlt/__init__.py 100.00% <ø> (ø)
src/omlt/block.py 100.00% <ø> (ø)
src/omlt/io/__init__.py 100.00% <ø> (ø)
src/omlt/neuralnet/__init__.py 100.00% <ø> (ø)
src/omlt/neuralnet/layer.py 90.57% <60.00%> (ø)
src/omlt/io/keras/keras_reader.py 89.47% <83.33%> (ø)
src/omlt/neuralnet/nn_formulation.py 92.92% <87.50%> (ø)
src/omlt/io/onnx_parser.py 95.00% <88.23%> (ø)
src/omlt/formulation.py 92.53% <100.00%> (ø)
src/omlt/gbt/gbt_formulation.py 93.65% <100.00%> (ø)
... and 16 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update bc46b99...76c790c. Read the comment docs.

jalving commented 2 years ago

The linting check now gets hit on the Python 3.8 CI tests.

The codecov/patch coverage drops because the black reformatting creates more lines of code for calls we don't test yet. I think it is okay to ignore, but we should look at the warnings and write those tests at some point.

Also note that almost all flake8 checks are ignored. We should make an issue to clean up our code for flake8 style requirements.