from importlib import reload for Python 3#675
Conversation
__reload()__ was moved into __importlib__ in Python 3 because it was being overuse and led issues that were to difficult-to-debug. flake8 testing of https://github.com/joblib/joblib on Python 3.6.3 $ __flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics__ ``` ./joblib/test/test_memory.py:599:36: F821 undefined name 'func_with_kwonly_args' func_cached = memory.cache(func_with_kwonly_args) ^ ./joblib/test/test_memory.py:620:36: F821 undefined name 'func_with_kwonly_args' func_cached = memory.cache(func_with_kwonly_args, ignore=['kw2']) ^ ./joblib/test/test_memory.py:626:36: F821 undefined name 'func_with_signature' func_cached = memory.cache(func_with_signature) ^ ./joblib/test/test_parallel.py:490:5: F821 undefined name 'reload' reload(module) ^ 4 F821 undefined name 'func_with_kwonly_args' 4 ```
Codecov Report
@@ Coverage Diff @@
## master #675 +/- ##
==========================================
+ Coverage 95.1% 95.14% +0.03%
==========================================
Files 40 40
Lines 5746 5750 +4
==========================================
+ Hits 5465 5471 +6
+ Misses 281 279 -2
Continue to review full report at Codecov.
|
|
Guessing this refers to this line? Confusing why it wasn't causing issues before. Maybe I'm overlooking something? |
|
The comment says that the reload() line should raise an error but perhaps currently on Python 3 that is NameError because reload() is undefined. |
|
Yes, it would be good to investigate why it was not causing a crash (maybe a bare In any case, it would be great to add a non-regression test to show that the call to reload actually work if not too cumbersome to add. |
|
IIRC test_multiple_spawning actually does not actually test anything because joblib/joblib/test/test_parallel.py Lines 543 to 551 in bb027ab I think the original intent of the test was to test these lines but it hasn't fulfilled its purposes for a while: joblib/joblib/_parallel_backends.py Lines 428 to 435 in bb027ab I think it's fine to merge this PR, but finding a replacement test for |
* tag '0.12.1': Release 0.12.1 fix kwonlydefaults key error in filter_args (joblib#715) MNT fix some "undefined name" flake8 warnings (joblib#713). from importlib import reload for Python 3 (joblib#675) MTN vendor loky2.1.4 (joblib#708)
* releases: (121 commits) Release 0.12.1 fix kwonlydefaults key error in filter_args (joblib#715) MNT fix some "undefined name" flake8 warnings (joblib#713). from importlib import reload for Python 3 (joblib#675) MTN vendor loky2.1.4 (joblib#708) Release 0.12 typo typo typo ENH add initializer limiting n_threads for C-libs (joblib#701) DOC better parallel docstring (joblib#704) [MRG] Nested parallel call thread bomb mitigation (joblib#700) MTN vendor loky2.1.3 (joblib#699) Make it possible to configure the reusable executor workers timeout (joblib#698) MAINT increase timeouts to make test more robust on travis DOC: use the .joblib extension instead of .pkl (joblib#697) [MRG] Fix exception handling in nested parallel calls (joblib#696) Fix skip test lz4 not installed (joblib#695) [MRG] numpy_pickle: several enhancements (joblib#626) Introduce Parallel.__call__ backend callbacks (joblib#689) ...
reload() was moved into importlib in Python 3 because it was being overuse and led issues that were to difficult-to-debug.
flake8 testing of https://github.com/joblib/joblib on Python 3.6.3
$ flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics