Skip to content

Commit 02fd478

Browse files
authored
Merge pull request #234 from graingert/move-to-flit
2 parents 99ce5b2 + 434213e commit 02fd478

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+159
-210
lines changed

.pre-commit-config.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,14 @@ repos:
4040
hooks:
4141
- id: prettier
4242
args: [--prose-wrap=always, --print-width=88]
43+
44+
- repo: https://github.com/myint/autoflake
45+
rev: v1.4
46+
hooks:
47+
- id: autoflake
48+
args:
49+
- --in-place
50+
- --remove-all-unused-imports
51+
- --expand-star-imports
52+
- --remove-duplicate-keys
53+
- --remove-unused-variables

CHANGELOG.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
0.8.1 (unreleased)
22
==================
33

4-
- Nothing changed yet.
4+
- move all code under the ``modernize`` namespace.
5+
- use flit to create PyPI distributions.
56

67

78
0.8.0 (2020-09-27)

MANIFEST.in

Lines changed: 0 additions & 2 deletions
This file was deleted.

docs/fixers.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ Opt-in
305305
To specify an opt-in fixer while also running all the default fixers, make sure
306306
to specify the ``-f default`` or ``--fix=default`` option, e.g.::
307307

308-
python -m modernize -f default -f libmodernize.fixes.fix_open
308+
python -m modernize -f default -f modernize.fixes.fix_open
309309

310310
.. attribute:: classic_division
311311

docs/index.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@ A note about handling text literals
4242
along with Python 2.
4343
- Alternatively, there is the ``--six-unicode`` flag which will wrap Unicode
4444
literals with the six helper function ``six.u()`` using the
45-
``libmodernize.fixes.fix_unicode`` fixer. This is useful if you want
45+
``modernize.fixes.fix_unicode`` fixer. This is useful if you want
4646
to support Python 3.1 and Python 3.2 without bigger changes.
4747
- The last alternative is the ``--future-unicode`` flag which
4848
imports the ``unicode_literals`` from the ``__future__`` module using the
49-
``libmodernize.fixes.fix_unicode_future`` fixer.
49+
``modernize.fixes.fix_unicode_future`` fixer.
5050
This requires Python 2.6 and later, and will require that you
5151
mark bytestrings with ``b''`` and native strings in ``str('')``
5252
or something similar that survives the transformation.

modernize.py

Lines changed: 0 additions & 7 deletions
This file was deleted.

modernize/__init__.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
"""
2+
A hack on top of fissix (lib2to3 fork) for modernizing code for hybrid codebases.
3+
"""
4+
5+
from __future__ import generator_stop
6+
7+
__version__ = "0.8.1.dev0"
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
from __future__ import generator_stop
22

3-
from libmodernize import main
3+
import sys
4+
5+
from .main import main
46

57
if __name__ == "__main__":
6-
main.main()
8+
sys.exit(main())

libmodernize/fixes/__init__.py renamed to modernize/fixes/__init__.py

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -28,31 +28,29 @@
2828
"fissix.fixes.fix_xreadlines",
2929
}
3030

31-
lib2to3_fix_names = fissix_fix_names
32-
3331
# fixes that involve using six
3432
six_fix_names = {
35-
"libmodernize.fixes.fix_basestring",
36-
"libmodernize.fixes.fix_dict_six",
37-
"libmodernize.fixes.fix_filter",
38-
"libmodernize.fixes.fix_imports_six",
39-
"libmodernize.fixes.fix_itertools_six",
40-
"libmodernize.fixes.fix_itertools_imports_six",
41-
"libmodernize.fixes.fix_input_six",
42-
"libmodernize.fixes.fix_int_long_tuple",
43-
"libmodernize.fixes.fix_map",
44-
"libmodernize.fixes.fix_metaclass",
45-
"libmodernize.fixes.fix_raise_six",
46-
"libmodernize.fixes.fix_unicode",
47-
"libmodernize.fixes.fix_unicode_type",
48-
"libmodernize.fixes.fix_urllib_six",
49-
"libmodernize.fixes.fix_unichr",
50-
"libmodernize.fixes.fix_xrange_six",
51-
"libmodernize.fixes.fix_zip",
33+
"modernize.fixes.fix_basestring",
34+
"modernize.fixes.fix_dict_six",
35+
"modernize.fixes.fix_filter",
36+
"modernize.fixes.fix_imports_six",
37+
"modernize.fixes.fix_itertools_six",
38+
"modernize.fixes.fix_itertools_imports_six",
39+
"modernize.fixes.fix_input_six",
40+
"modernize.fixes.fix_int_long_tuple",
41+
"modernize.fixes.fix_map",
42+
"modernize.fixes.fix_metaclass",
43+
"modernize.fixes.fix_raise_six",
44+
"modernize.fixes.fix_unicode",
45+
"modernize.fixes.fix_unicode_type",
46+
"modernize.fixes.fix_urllib_six",
47+
"modernize.fixes.fix_unichr",
48+
"modernize.fixes.fix_xrange_six",
49+
"modernize.fixes.fix_zip",
5250
}
5351

5452
# Fixes that are opt-in only.
5553
opt_in_fix_names = {
56-
"libmodernize.fixes.fix_classic_division",
57-
"libmodernize.fixes.fix_open",
54+
"modernize.fixes.fix_classic_division",
55+
"modernize.fixes.fix_open",
5856
}

libmodernize/fixes/fix_basestring.py renamed to modernize/fixes/fix_basestring.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,11 @@
22

33
from fissix import fixer_base, fixer_util
44

5-
import libmodernize
6-
75

86
class FixBasestring(fixer_base.BaseFix):
97
BM_compatible = True
108
PATTERN = """'basestring'"""
119

1210
def transform(self, node, results):
13-
libmodernize.touch_import(None, "six", node)
11+
fixer_util.touch_import(None, "six", node)
1412
return fixer_util.Name("six.string_types", prefix=node.prefix)

0 commit comments

Comments
 (0)