BayesWatch / pytorch-experiments-template

A pytorch based classification experiments template
GNU General Public License v3.0
5 stars 1 forks source link

Refactoring that ensures lines are at most 88 chars even when they ar… #51

Closed AntreasAntoniou closed 3 years ago

AntreasAntoniou commented 3 years ago

…e comments - helps with github visibility/smaller displays, also using sourcely to optimize readability, format and efficiency

sourcery-ai[bot] commented 3 years ago

Sourcery Code Quality Report

✅  Merging this PR will increase code quality in the affected files by 0.22%.

Quality metrics Before After Change
Complexity 7.34 ⭐ 7.28 ⭐ -0.06 👍
Method Length 68.90 🙂 68.36 🙂 -0.54 👍
Working memory 12.15 😞 12.10 😞 -0.05 👍
Quality 60.33% 🙂 60.55% 🙂 0.22% 👍
Other metrics Before After Change
Lines 2866 2876 10
Changed files Quality Before Quality After Quality Change
train.py 29.04% 😞 29.04% 😞 0.00%
datasets/custom_transforms.py 65.68% 🙂 65.68% 🙂 0.00%
datasets/dataset_loading_hub.py 69.79% 🙂 69.79% 🙂 0.00%
models/auto_builder_models.py 63.30% 🙂 63.30% 🙂 0.00%
models/densenet.py 69.80% 🙂 69.80% 🙂 0.00%
models/wresnet.py 65.83% 🙂 65.55% 🙂 -0.28% 👎
test/auto_builder_models_test.py 77.21% ⭐ 77.21% ⭐ 0.00%
test/test_data_loader.py 57.27% 🙂 62.25% 🙂 4.98% 👍
utils/arg_parsing.py 70.50% 🙂 70.50% 🙂 0.00%
utils/cinic_utils.py 43.44% 😞 43.44% 😞 0.00%
utils/gpu_selection_utils.py 68.77% 🙂 68.77% 🙂 0.00%
utils/metric_tracking.py 56.53% 🙂 56.55% 🙂 0.02% 👍
utils/pretty_progress_reporting.py 52.74% 🙂 52.74% 🙂 0.00%
utils/storage.py 68.14% 🙂 68.14% 🙂 0.00%
utils/script_generation_utils/config_utils.py 71.39% 🙂 75.32% ⭐ 3.93% 👍

Here are some functions in these files that still need a tune-up:

File Function Complexity Length Working Memory Quality Recommendation
utils/cinic_utils.py extend_cinic_10 55 ⛔ 257 ⛔ 14 😞 17.36% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
models/auto_builder_models.py BatchRelationalModule.forward 13 🙂 373 ⛔ 15 😞 31.20% 😞 Try splitting into smaller methods. Extract out complex expressions
models/auto_builder_models.py BatchRelationalModule.build 13 🙂 451 ⛔ 14 😞 31.54% 😞 Try splitting into smaller methods. Extract out complex expressions
utils/metric_tracking.py MetricTracker.refresh_best_n_epoch_models 10 🙂 142 😞 18 ⛔ 43.22% 😞 Try splitting into smaller methods. Extract out complex expressions
models/wresnet.py WideResNet.__init__ 5 ⭐ 228 ⛔ 14 😞 44.93% 😞 Try splitting into smaller methods. Extract out complex expressions

Legend and Explanation

The emojis denote the absolute quality of the code:

The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request.


Please see our documentation here for details on how these metrics are calculated.

We are actively working on this report - lots more documentation and extra metrics to come!

Let us know what you think of it by mentioning @sourcery-ai in a comment.