Mercurial > repos > guerler > springsuite
comparison planemo/lib/python3.7/site-packages/libfuturize/fixes/__init__.py @ 1:56ad4e20f292 draft
"planemo upload commit 6eee67778febed82ddd413c3ca40b3183a3898f1"
author | guerler |
---|---|
date | Fri, 31 Jul 2020 00:32:28 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
0:d30785e31577 | 1:56ad4e20f292 |
---|---|
1 import sys | |
2 from lib2to3 import refactor | |
3 | |
4 # The following fixers are "safe": they convert Python 2 code to more | |
5 # modern Python 2 code. They should be uncontroversial to apply to most | |
6 # projects that are happy to drop support for Py2.5 and below. Applying | |
7 # them first will reduce the size of the patch set for the real porting. | |
8 lib2to3_fix_names_stage1 = set([ | |
9 'lib2to3.fixes.fix_apply', | |
10 'lib2to3.fixes.fix_except', | |
11 'lib2to3.fixes.fix_exec', | |
12 'lib2to3.fixes.fix_exitfunc', | |
13 'lib2to3.fixes.fix_funcattrs', | |
14 'lib2to3.fixes.fix_has_key', | |
15 'lib2to3.fixes.fix_idioms', | |
16 # 'lib2to3.fixes.fix_import', # makes any implicit relative imports explicit. (Use with ``from __future__ import absolute_import) | |
17 'lib2to3.fixes.fix_intern', | |
18 'lib2to3.fixes.fix_isinstance', | |
19 'lib2to3.fixes.fix_methodattrs', | |
20 'lib2to3.fixes.fix_ne', | |
21 # 'lib2to3.fixes.fix_next', # would replace ``next`` method names | |
22 # with ``__next__``. | |
23 'lib2to3.fixes.fix_numliterals', # turns 1L into 1, 0755 into 0o755 | |
24 'lib2to3.fixes.fix_paren', | |
25 # 'lib2to3.fixes.fix_print', # see the libfuturize fixer that also | |
26 # adds ``from __future__ import print_function`` | |
27 # 'lib2to3.fixes.fix_raise', # uses incompatible with_traceback() method on exceptions | |
28 'lib2to3.fixes.fix_reduce', # reduce is available in functools on Py2.6/Py2.7 | |
29 'lib2to3.fixes.fix_renames', # sys.maxint -> sys.maxsize | |
30 # 'lib2to3.fixes.fix_set_literal', # this is unnecessary and breaks Py2.6 support | |
31 'lib2to3.fixes.fix_repr', | |
32 'lib2to3.fixes.fix_standarderror', | |
33 'lib2to3.fixes.fix_sys_exc', | |
34 'lib2to3.fixes.fix_throw', | |
35 'lib2to3.fixes.fix_tuple_params', | |
36 'lib2to3.fixes.fix_types', | |
37 'lib2to3.fixes.fix_ws_comma', # can perhaps decrease readability: see issue #58 | |
38 'lib2to3.fixes.fix_xreadlines', | |
39 ]) | |
40 | |
41 # The following fixers add a dependency on the ``future`` package on order to | |
42 # support Python 2: | |
43 lib2to3_fix_names_stage2 = set([ | |
44 # 'lib2to3.fixes.fix_buffer', # perhaps not safe. Test this. | |
45 # 'lib2to3.fixes.fix_callable', # not needed in Py3.2+ | |
46 'lib2to3.fixes.fix_dict', # TODO: add support for utils.viewitems() etc. and move to stage2 | |
47 # 'lib2to3.fixes.fix_execfile', # some problems: see issue #37. | |
48 # We use a custom fixer instead (see below) | |
49 # 'lib2to3.fixes.fix_future', # we don't want to remove __future__ imports | |
50 'lib2to3.fixes.fix_getcwdu', | |
51 # 'lib2to3.fixes.fix_imports', # called by libfuturize.fixes.fix_future_standard_library | |
52 # 'lib2to3.fixes.fix_imports2', # we don't handle this yet (dbm) | |
53 # 'lib2to3.fixes.fix_input', # Called conditionally by libfuturize.fixes.fix_input | |
54 'lib2to3.fixes.fix_itertools', | |
55 'lib2to3.fixes.fix_itertools_imports', | |
56 'lib2to3.fixes.fix_filter', | |
57 'lib2to3.fixes.fix_long', | |
58 'lib2to3.fixes.fix_map', | |
59 # 'lib2to3.fixes.fix_metaclass', # causes SyntaxError in Py2! Use the one from ``six`` instead | |
60 'lib2to3.fixes.fix_next', | |
61 'lib2to3.fixes.fix_nonzero', # TODO: cause this to import ``object`` and/or add a decorator for mapping __bool__ to __nonzero__ | |
62 'lib2to3.fixes.fix_operator', # we will need support for this by e.g. extending the Py2 operator module to provide those functions in Py3 | |
63 'lib2to3.fixes.fix_raw_input', | |
64 # 'lib2to3.fixes.fix_unicode', # strips off the u'' prefix, which removes a potentially helpful source of information for disambiguating unicode/byte strings | |
65 # 'lib2to3.fixes.fix_urllib', # included in libfuturize.fix_future_standard_library_urllib | |
66 # 'lib2to3.fixes.fix_xrange', # custom one because of a bug with Py3.3's lib2to3 | |
67 'lib2to3.fixes.fix_zip', | |
68 ]) | |
69 | |
70 libfuturize_fix_names_stage1 = set([ | |
71 'libfuturize.fixes.fix_absolute_import', | |
72 'libfuturize.fixes.fix_next_call', # obj.next() -> next(obj). Unlike | |
73 # lib2to3.fixes.fix_next, doesn't change | |
74 # the ``next`` method to ``__next__``. | |
75 'libfuturize.fixes.fix_print_with_import', | |
76 'libfuturize.fixes.fix_raise', | |
77 # 'libfuturize.fixes.fix_order___future__imports', # TODO: consolidate to a single line to simplify testing | |
78 ]) | |
79 | |
80 libfuturize_fix_names_stage2 = set([ | |
81 'libfuturize.fixes.fix_basestring', | |
82 # 'libfuturize.fixes.fix_add__future__imports_except_unicode_literals', # just in case | |
83 'libfuturize.fixes.fix_cmp', | |
84 'libfuturize.fixes.fix_division_safe', | |
85 'libfuturize.fixes.fix_execfile', | |
86 'libfuturize.fixes.fix_future_builtins', | |
87 'libfuturize.fixes.fix_future_standard_library', | |
88 'libfuturize.fixes.fix_future_standard_library_urllib', | |
89 'libfuturize.fixes.fix_input', | |
90 'libfuturize.fixes.fix_metaclass', | |
91 'libpasteurize.fixes.fix_newstyle', | |
92 'libfuturize.fixes.fix_object', | |
93 # 'libfuturize.fixes.fix_order___future__imports', # TODO: consolidate to a single line to simplify testing | |
94 'libfuturize.fixes.fix_unicode_keep_u', | |
95 # 'libfuturize.fixes.fix_unicode_literals_import', | |
96 'libfuturize.fixes.fix_xrange_with_import', # custom one because of a bug with Py3.3's lib2to3 | |
97 ]) |