-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove usage of sys.version_info #449
Conversation
and replace it's usage with six.PY2/six.PY3 instead and remove outdated pieces of code which added workarounds for python < 2.7 and < 3.4 modified: traits/_py2to3.py modified: traits/adaptation/adaptation_manager.py modified: traits/etsconfig/tests/test_etsconfig.py modified: traits/has_traits.py modified: traits/tests/test_float.py modified: traits/tests/test_list.py modified: traits/tests/test_traits.py modified: traits/trait_handlers.py modified: traits/trait_types.py modified: traits/traits.py
Codecov Report
@@ Coverage Diff @@
## master #449 +/- ##
==========================================
+ Coverage 64.71% 65.37% +0.66%
==========================================
Files 44 44
Lines 7130 7053 -77
Branches 1418 1410 -8
==========================================
- Hits 4614 4611 -3
+ Misses 2092 2021 -71
+ Partials 424 421 -3
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great; thank you! A few minor change requests. In particular, we should avoid the use of six.PY3
, since it'll be false for Python >= 4.0, which almost certainly isn't what we want. (Note: there may be a better constant in some future version of six. I wouldn't recommend using PY34
: it's not clear to readers what it means, and judging by the linked issue there's a possibility it could change in the future.)
- replace use of _py2to3.assertCountEqual with six.assertCountEqual - reverse the order of if/else statements to check for six.PY2 instead of six.PY3 - reorder import
the CI fails with two traitsui errors. this is because See the traceback below :
|
@mdickinson I've chosen to move the two aliases to |
This reverts commit cd320a6.
and their usage in traitsui. document the PR that removes the use of the private module in traitsui. modified: traits/_py2to3.py
@mdickinson what about the |
That should definitely go. I think the UUID change in this PR removes its only use, right? Technically this isn't private, so there's a possibility that a 3rd party package is importing this, but I doubt that's the case. And expressing a package version as a float is a horrible, no-good, broken thing to do, especially if there's a prospect of minor version numbers larger than |
modified: traits/api.py modified: traits/trait_base.py modified: traits/trait_types.py
Yep. The only place it was being used was in the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes LGTM. Thank you!
modified: CHANGES.rst
NOTE : There is still one place wheresys.version_info
I don't see any uses ofpython_version
but I'm not sure if we want to/can remove it completely.
Replace it's usage with six.PY2/six.PY3 instead
and remove outdated pieces of code which added workarounds for
python < 2.7 and < 3.4
With this PR, #364 can be closed, as 2to3 have been replaced and
sys.version_info usage has been removed.