[19.05] Run futurize for python2 cheetah templates, fix scope issue for py3 comprehensions#7867
Merged
martenson merged 10 commits intogalaxyproject:release_19.05from May 8, 2019
Conversation
46f8641 to
4f7c193
Compare
Member
Author
|
Hah, turns out dict, set and generator comprehensions all have that problem on python 2, so I guess we don't need to fix that. |
7f53d90 to
d3821c0
Compare
29 tasks
nsoranzo
reviewed
May 2, 2019
832b241 to
02c4c46
Compare
nsoranzo
reviewed
May 2, 2019
Member
nsoranzo
left a comment
There was a problem hiding this comment.
I'd prefer to parse python_template_version with packaging.version.parse() instead of casting with float(), see comments inline.
205b4a6 to
5cafb90
Compare
jmchilton
approved these changes
May 7, 2019
040f8e6 to
3d56230
Compare
This will allow tools to work that access variables from the enclosing scope in a list/dict/tuple comprehension.
Now if we could figure out the exact position in the template source where a NotFound error is raised we could replace `$variable` with `variable` and add `#variable = $variable` just before the failing statement.
…urrounding scope While fixable this seems to not work on python 2 either, so we will not attempt to fix it.
or python_template_version < 3.
We use a list of fixers from past.translation. This is just a list of strings pointing to fixers to import. Currently this is ``` ['libfuturize.fixes.fix_absolute_import', 'libfuturize.fixes.fix_print_with_import', 'libfuturize.fixes.fix_raise', 'libfuturize.fixes.fix_next_call', 'lib2to3.fixes.fix_reduce', 'lib2to3.fixes.fix_sys_exc', 'lib2to3.fixes.fix_throw', 'lib2to3.fixes.fix_tuple_params', 'lib2to3.fixes.fix_exec', 'lib2to3.fixes.fix_standarderror', 'lib2to3.fixes.fix_apply', 'lib2to3.fixes.fix_paren', 'lib2to3.fixes.fix_types', 'lib2to3.fixes.fix_methodattrs', 'lib2to3.fixes.fix_renames', 'lib2to3.fixes.fix_ws_comma', 'lib2to3.fixes.fix_repr', 'lib2to3.fixes.fix_intern', 'lib2to3.fixes.fix_numliterals', 'lib2to3.fixes.fix_funcattrs', 'lib2to3.fixes.fix_ne', 'lib2to3.fixes.fix_exitfunc', 'lib2to3.fixes.fix_has_key', 'lib2to3.fixes.fix_isinstance', 'lib2to3.fixes.fix_idioms', 'lib2to3.fixes.fix_xreadlines', 'lib2to3.fixes.fix_except', 'libfuturize.fixes.fix_execfile', 'libfuturize.fixes.fix_future_standard_library', 'libfuturize.fixes.fix_metaclass', 'libfuturize.fixes.fix_future_builtins', 'libpasteurize.fixes.fix_newstyle', 'libfuturize.fixes.fix_basestring', 'libfuturize.fixes.fix_future_standard_library_urllib', 'libfuturize.fixes.fix_xrange_with_import', 'libfuturize.fixes.fix_cmp', 'libfuturize.fixes.fix_unicode_keep_u', 'libfuturize.fixes.fix_division_safe', 'libfuturize.fixes.fix_object', 'lib2to3.fixes.fix_input', 'lib2to3.fixes.fix_operator', 'lib2to3.fixes.fix_zip', 'lib2to3.fixes.fix_dict', 'lib2to3.fixes.fix_next', 'lib2to3.fixes.fix_filter', 'lib2to3.fixes.fix_raw_input', 'lib2to3.fixes.fix_getcwdu', 'lib2to3.fixes.fix_itertools_imports', 'lib2to3.fixes.fix_nonzero', 'lib2to3.fixes.fix_itertools', 'lib2to3.fixes.fix_long', 'lib2to3.fixes.fix_map'] ``` And then we drop pasterurize, which we don't need for our purposes.
3d56230 to
a05d24c
Compare
f16cf9f to
ccea1ee
Compare
Member
Author
|
@galaxybot test py3 |
Member
|
merged forward |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I think this should cover the python 2/3 errors I have seen so far