Skip to content

Commit 83cd188

Browse files
committed
Merge branch 'master' of github.com:PyCQA/modernize into release-0.8rc1
2 parents 0793c2c + f2005be commit 83cd188

Some content is hidden

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

74 files changed

+2082
-1258
lines changed

.github/workflows/main.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: CI
2+
on:
3+
push:
4+
branches:
5+
- master
6+
tags:
7+
- v*
8+
pull_request:
9+
10+
jobs:
11+
modernize:
12+
runs-on: ${{ matrix.os }}
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
python-version: [3.6, 3.7, 3.8]
17+
os: [macOS-latest, ubuntu-latest, windows-latest]
18+
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v2
22+
23+
- name: Set Up Python ${{ matrix.python-version }}
24+
uses: actions/setup-python@v2
25+
with:
26+
python-version: ${{ matrix.python-version }}
27+
28+
- name: Get pip cache dir
29+
id: pip-cache
30+
run: |
31+
echo "::set-output name=dir::$(pip cache dir)"
32+
33+
- name: pip cache
34+
uses: actions/cache@v2
35+
with:
36+
path: ${{ steps.pip-cache.outputs.dir }}
37+
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.cfg') }}
38+
restore-keys: |
39+
${{ runner.os }}-pip-
40+
41+
- name: Install
42+
run: |
43+
pip install tox
44+
45+
- name: tox
46+
env:
47+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
48+
run: tox -e py,lint,coveralls

.gitignore

Lines changed: 138 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,138 @@
1-
*.pyc
2-
*~
3-
*.egg-info
4-
5-
/build
6-
/dist
7-
/docs/_build
8-
/nose-*
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib/
18+
lib64/
19+
parts/
20+
sdist/
21+
var/
22+
wheels/
23+
share/python-wheels/
24+
*.egg-info/
25+
.installed.cfg
26+
*.egg
27+
MANIFEST
28+
29+
# PyInstaller
30+
# Usually these files are written by a python script from a template
31+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
32+
*.manifest
33+
*.spec
34+
35+
# Installer logs
36+
pip-log.txt
37+
pip-delete-this-directory.txt
38+
39+
# Unit test / coverage reports
40+
htmlcov/
41+
.tox/
42+
.nox/
43+
.coverage
44+
.coverage.*
45+
.cache
46+
nosetests.xml
47+
coverage.xml
48+
*.cover
49+
*.py,cover
50+
.hypothesis/
51+
.pytest_cache/
52+
cover/
53+
54+
# Translations
55+
*.mo
56+
*.pot
57+
58+
# Django stuff:
59+
*.log
60+
local_settings.py
61+
db.sqlite3
62+
db.sqlite3-journal
63+
64+
# Flask stuff:
65+
instance/
66+
.webassets-cache
67+
68+
# Scrapy stuff:
69+
.scrapy
70+
71+
# Sphinx documentation
72+
docs/_build/
73+
74+
# PyBuilder
75+
.pybuilder/
76+
target/
77+
78+
# Jupyter Notebook
79+
.ipynb_checkpoints
80+
81+
# IPython
82+
profile_default/
83+
ipython_config.py
84+
85+
# pyenv
86+
# For a library or package, you might want to ignore these files since the code is
87+
# intended to run in multiple environments; otherwise, check them in:
88+
# .python-version
89+
90+
# pipenv
91+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
93+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
94+
# install all needed dependencies.
95+
#Pipfile.lock
96+
97+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
98+
__pypackages__/
99+
100+
# Celery stuff
101+
celerybeat-schedule
102+
celerybeat.pid
103+
104+
# SageMath parsed files
105+
*.sage.py
106+
107+
# Environments
108+
.env
109+
.venv
110+
env/
111+
venv/
112+
ENV/
113+
env.bak/
114+
venv.bak/
115+
116+
# Spyder project settings
117+
.spyderproject
118+
.spyproject
119+
120+
# Rope project settings
121+
.ropeproject
122+
123+
# mkdocs documentation
124+
/site
125+
126+
# mypy
127+
.mypy_cache/
128+
.dmypy.json
129+
dmypy.json
130+
131+
# Pyre type checker
132+
.pyre/
133+
134+
# pytype static type analyzer
135+
.pytype/
136+
137+
# Cython debug symbols
138+
cython_debug/

.pre-commit-config.yaml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
repos:
2+
- repo: https://github.com/asottile/pyupgrade
3+
rev: v2.7.2
4+
hooks:
5+
- id: pyupgrade
6+
args: ["--py36-plus"]
7+
8+
- repo: https://github.com/psf/black
9+
rev: 20.8b1
10+
hooks:
11+
- id: black
12+
args: ["--target-version", "py36"]
13+
14+
- repo: https://gitlab.com/pycqa/flake8
15+
rev: 3.8.3
16+
hooks:
17+
- id: flake8
18+
additional_dependencies: [flake8-2020]
19+
20+
- repo: https://github.com/pycqa/isort
21+
rev: 5.4.2
22+
hooks:
23+
- id: isort
24+
25+
- repo: https://github.com/pre-commit/pygrep-hooks
26+
rev: v1.6.0
27+
hooks:
28+
- id: python-check-blanket-noqa
29+
30+
- repo: https://github.com/pre-commit/pre-commit-hooks
31+
rev: v3.2.0
32+
hooks:
33+
- id: check-merge-conflict
34+
- id: check-toml
35+
- id: check-yaml
36+
- id: mixed-line-ending
37+
38+
- repo: https://github.com/prettier/prettier
39+
rev: 2.1.1
40+
hooks:
41+
- id: prettier
42+
args: [--prose-wrap=always, --print-width=88]

.pre-commit-hooks.yaml

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
1-
- id: python-modernize
2-
name: python-modernize
3-
description: Modernizes Python code for eventual Python 3 migration.
4-
entry: python-modernize
5-
args: [--write, --fix=default, --nobackups]
6-
language: python
7-
types: [python]
1+
- &modernize
2+
id: modernize
3+
name: modernize
4+
description: Modernizes Python code for eventual Python 3 migration.
5+
entry: modernize
6+
args: [--write, --fix=default, --nobackups]
7+
language: python
8+
types: [python]
9+
- <<: *modernize
10+
id: python-modernize
11+
name: modernize (deprecated)
12+
description: "Deprecated in favour of `id: modernize`"

.readthedocs.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
version: 2
2+
3+
sphinx:
4+
fail_on_warning: true
5+
6+
python:
7+
version: 3.8
8+
install:
9+
- method: pip
10+
path: .
11+
extra_requirements:
12+
- docs

.travis.yml

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

CHANGELOG.rst

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
1-
Unreleased
2-
==========
1+
Version 0.8rc2-dev
2+
==================
3+
4+
Unreleased.
5+
6+
* add ``modernize`` console_script
7+
* move project to https://github.com/PyCQA/modernize/
8+
9+
Version 0.8rc1
10+
==============
11+
12+
Released 2020-07-20.
13+
14+
* use fissix instead of deprecated lib2to3
15+
16+
Version 0.5-0.7
17+
===============
318

419
* Added the opt-in classic_division fixer.
520
* Updated the ``dict_six`` fixer to support ``six.viewitems()`` and friends.
@@ -48,7 +63,7 @@ Released 2014-10-14.
4863
Python 2.6, such as the ``except ... as`` construct, but this was not
4964
documented.)
5065

51-
.. _Documentation: http://python-modernize.readthedocs.org/en/latest/
66+
.. _Documentation: https://modernize.readthedocs.org/en/latest/
5267

5368

5469
Version 0.3
@@ -59,7 +74,7 @@ Released 2014-08-12.
5974
* New fixer for ``raise E, V, T``, changed to ``six.reraise(E, V, T)``.
6075
* New fixer for metaclasses, using ``six.with_metaclass``.
6176
* Avoid adding redundant parentheses to ``print(x)``.
62-
* python-modernize can now be installed and run on Python 3.
77+
* modernize can now be installed and run on Python 3.
6378
* Fixed a bug where ``__future__`` imports were added multiple times.
6479
* Fixed a bug where fixer for ``zip()`` was recognising ``map()``.
6580
* The default is now to leave Unicode literals unchanged.

README.rst

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@ This library is a very thin wrapper around `fissix
1010
to make Python 2 code more modern with the intention of eventually
1111
porting it over to Python 3.
1212

13-
The ``python-modernize`` command works like `2to3
14-
<https://docs.python.org/3/library/2to3.html>`_. Here's how you'd rewrite a
13+
The ``python -m modernize`` command works like
14+
``python -m fissix``, see `fissix <https://github.com/jreese/fissix>`_.
15+
Here's how you'd rewrite a
1516
single file::
1617

17-
python-modernize -w example.py
18+
python -m modernize -w example.py
1819

1920
It does not guarantee, but it attempts to spit out a codebase compatible
2021
with Python 2.6+ or Python 3. The code that it generates has a runtime
@@ -23,18 +24,18 @@ dependency on `six <https://pypi.python.org/pypi/six>`_, unless the
2324
recommended. Some of the fixers output code that is not compatible with
2425
Python 2.5 or lower.
2526

26-
**Documentation:** `python-modernize.readthedocs.io
27-
<https://python-modernize.readthedocs.io/>`_.
27+
**Documentation:** `modernize.readthedocs.io
28+
<https://modernize.readthedocs.io/>`_.
2829

29-
See the ``LICENSE`` file for the license of ``python-modernize``.
30+
See the ``LICENSE`` file for the license of ``modernize``.
3031
Using this tool does not affect licensing of the modernized code.
3132

32-
.. image:: https://readthedocs.org/projects/python-modernize/badge/
33-
:target: https://readthedocs.org/projects/python-modernize/?badge=latest
33+
.. image:: https://readthedocs.org/projects/modernize/badge/
34+
:target: https://readthedocs.org/projects/modernize/?badge=latest
3435
:alt: Documentation Status
3536

36-
.. image:: https://api.travis-ci.org/python-modernize/python-modernize.svg?branch=master
37-
:target: https://travis-ci.org/python-modernize/python-modernize
37+
.. image:: https://api.travis-ci.org/pycqa/modernize.svg?branch=master
38+
:target: https://travis-ci.org/pycqa/modernize
3839

39-
.. image:: https://coveralls.io/repos/python-modernize/python-modernize/badge.png?branch=master
40-
:target: https://coveralls.io/r/python-modernize/python-modernize?branch=master
40+
.. image:: https://coveralls.io/repos/pycqa/modernize/badge.png?branch=master
41+
:target: https://coveralls.io/r/pycqa/modernize?branch=master

__main__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
from __future__ import absolute_import
1+
from __future__ import generator_stop
22

33
from libmodernize import main
44

5-
if __name__ == '__main__':
5+
if __name__ == "__main__":
66
main.main()

docs/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ BUILDDIR = _build
99

1010
# User-friendly check for sphinx-build
1111
ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
12-
$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/)
12+
$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from https://www.sphinx-doc.org/)
1313
endif
1414

1515
# Internal variables.

0 commit comments

Comments
 (0)