Scan-o-Matic / scanomatic

Scanomatic
GNU General Public License v3.0
10 stars 4 forks source link

Remove `__CCC` global #311

Closed gdetrez closed 6 years ago

gdetrez commented 6 years ago

Refactor scanomatic.data_processing.calibration to remove the global __CCC global.

This doesn't really change the way it works: calibrations are still stored in an in-memory dictionary that is saved to disk explicitly in some of the functions. But instead of being a global dictionary, the calibration store is now encapsulated in a custom class (with dictionary-ish methods), passed to the calibration functions explicitly and referenced from the flask app.

A "store" is also created when needed in the different analysis jobs that used the calibration module. If I understand thing correctly, this has the side benefits that it is no longer necessary to restart the backend when adding a new calibration.

codecov-io commented 6 years ago

Codecov Report

Merging #311 into master will increase coverage by 0.08%. The diff coverage is 76.92%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #311      +/-   ##
==========================================
+ Coverage   36.16%   36.25%   +0.08%     
==========================================
  Files         167      167              
  Lines       16325    16349      +24     
  Branches     2898     2897       -1     
==========================================
+ Hits         5904     5927      +23     
- Misses      10000    10004       +4     
+ Partials      421      418       -3
Impacted Files Coverage Δ
scanomatic/ui_server/ui_server.py 0% <0%> (ø) :arrow_up:
scanomatic/ui_server/data_api.py 0% <0%> (ø) :arrow_up:
scanomatic/io/ccc_data.py 87.91% <100%> (+0.08%) :arrow_up:
...omatic/models/factories/compile_project_factory.py 42.5% <50%> (ø) :arrow_up:
scanomatic/ui_server/calibration_api.py 31.31% <78.57%> (+0.46%) :arrow_up:
scanomatic/data_processing/calibration.py 66.86% <79.26%> (+1.45%) :arrow_up:
scanomatic/models/factories/scanning_factory.py 55.74% <80%> (+0.25%) :arrow_up:
scanomatic/models/factories/analysis_factories.py 60.71% <80%> (+0.56%) :arrow_up:
scanomatic/data_processing/phases/segmentation.py 74.58% <0%> (+0.27%) :arrow_up:
scanomatic/image_analysis/grid.py 76.6% <0%> (+0.75%) :arrow_up:

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 8215dbc...3b251fe. Read the comment docs.