Sweep the tree for everything conditional on python 2.#425
Sweep the tree for everything conditional on python 2.#425
Conversation
28821b6 to
e13d7ec
Compare
|
Have found everything I can for now - remaining lint failures are pre-existing issues in the code that complaints now because the corresponding are only applied to changed files, which removal of the constant has made true here. |
Thanks, and yes, we can just point to #338 about the lint errors here, like I did in #424 about the corresponding work on cleaning out the |
|
Well, I suppose we could easily just fix the missing migrid-sync/tests/support/wsgisupp.py Line 81 in e13d7ec which is not covered by #338, but I agree that it's not new and probably slipped in before we had the lint action. |
I've got a stack of other changes to wsgisupp elsewhere, so I'd prefer to add this fix either there or to fix it alongsside a test that exercises whatever path through the code requires this. :) |
Fine with me, it was just to point out that not all lint errors here were already registered and covered e.g. by #338 as I initially thought. I'll let you decide if you want to keep track of it in a new wsgisupp branch or make a mock PR like #338. |
e13d7ec to
eb81f25
Compare
…h cause noisy errors in annotation as e.g. seen in PR #425 .
eb81f25 to
3a23c64
Compare
The only thing explicitly left out is the walk relted code in fileio which is rather weedy and being tackled in a separate change.
3a23c64 to
d0a3a82
Compare
| return textual_output | ||
|
|
||
|
|
||
| def NativeStringIO(initial_value=''): |
There was a problem hiding this comment.
We have only two modules using NativeStringIO, namely
mig/shared/ssh.py(importing fromcompat.py)mig/server/grid_sftp.py(importing frombase.py
We probably want to either completely eliminate the wrapper in those two cases, or keep the wrapper here incompat.pyso that it is completely clear that it only has relevance in compatibility context and can be phased out along with other py2+3 helpers.
| MIG_BASE = os.path.realpath(os.path.join(os.path.dirname(__file__), '../..')) | ||
| MIG_ENV = os.getenv('MIG_ENV', 'default') | ||
|
|
||
| # NOTE: python3 switched strings to use unicode by default in contrast to bytes |
There was a problem hiding this comment.
I think we'll want to preserve a short note about the point of these variables and their use in shared.base to prevent inadvertent future changes.
| # to ensure that all rule files are loaded | ||
|
|
||
| for ent in scandir(src_path): | ||
| for ent in os.scandir(src_path): |
| return [os.fsencode(arg) for arg in argv] | ||
|
|
||
|
|
||
| def NativeStringIO(initial_value=''): |
There was a problem hiding this comment.
See note below about NativeStringIO
| from mig.shared.base import client_id_dir, force_utf8 | ||
| from mig.shared.base import client_id_dir, force_utf8, NativeStringIO | ||
| from mig.shared.conf import get_resource_exe, get_configuration_object | ||
| from mig.shared.compat import NativeStringIO |
There was a problem hiding this comment.
See note about NativeStringIO above
|
|
||
| # NOTE: moved to urllib.parse in python3 and are re-exposed with future. | ||
| # Other modules should import helpers from here for consistency. | ||
| # TODO: handle the unicode returned by python3 and future versions! |
There was a problem hiding this comment.
Hmm, I suppose this is resolved or just works now but it would be nice to either comment about specifically in the PR / commit log or add a regression test for instead of just silently dropping the TODO.
jonasbardino
left a comment
There was a problem hiding this comment.
The PR is still left marked as draft and the changes to scandir calls no longer apply after merging #424, but I've commented inline and will leave it to you to (eventually) update it before it will be considered for merging @albu-diku.
|
For the record I've adjusted the lint annotation helper to ignore some common expected |
The only thing explicitly left out is the walk relted code in fileio which is rather weedy and being tackled in a separate change.