Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: PyCQA/flake8
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 3.7.4
Choose a base ref
...
head repository: PyCQA/flake8
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 3.7.5
Choose a head ref
  • 5 commits
  • 12 files changed
  • 1 contributor

Commits on Feb 1, 2019

  1. Copy the full SHA
    3d54751 View commit details
  2. Merge branch '3_7' into 'master'

    Remove noqa comments now that 3.7 has been released
    
    See merge request pycqa/flake8!301
    asottile committed Feb 1, 2019
    Copy the full SHA
    79148a0 View commit details
  3. Copy the full SHA
    8df38c9 View commit details
  4. Merge branch 'undefinde_local_code' into 'master'

    Fix reporting of UndefinedLocal pyflakes error
    
    Closes #503
    
    See merge request pycqa/flake8!302
    asottile committed Feb 1, 2019
    Copy the full SHA
    a35ed4a View commit details

Commits on Feb 4, 2019

  1. Release 3.7.5

    asottile committed Feb 4, 2019
    Copy the full SHA
    e7b8493 View commit details
23 changes: 23 additions & 0 deletions docs/source/release-notes/3.7.5.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
3.7.5 -- 2019-02-04
-------------------

You can view the `3.7.5 milestone`_ on GitLab for more details.

Bugs Fixed
~~~~~~~~~~

- Fix reporting of pyflakes "referenced before assignment" error (See also
`GitLab!301`_, `GitLab#503`_)


.. all links
.. _3.7.5 milestone:
https://gitlab.com/pycqa/flake8/milestones/28

.. issue links
.. _GitLab#503:
https://gitlab.com/pycqa/flake8/issues/503

.. merge request links
.. _GitLab!301:
https://gitlab.com/pycqa/flake8/merge_requests/301
1 change: 1 addition & 0 deletions docs/source/release-notes/index.rst
Original file line number Diff line number Diff line change
@@ -9,6 +9,7 @@ with the newest releases first.
==================

.. toctree::
3.7.5
3.7.4
3.7.3
3.7.2
2 changes: 1 addition & 1 deletion src/flake8/__init__.py
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@
LOG = logging.getLogger(__name__)
LOG.addHandler(logging.NullHandler())

__version__ = "3.7.4"
__version__ = "3.7.5"
__version_info__ = tuple(
int(i) for i in __version__.split(".") if i.isdigit()
)
2 changes: 1 addition & 1 deletion src/flake8/checker.py
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@
import signal
import sys
import tokenize
from typing import List, Optional # noqa: F401 (until flake8 3.7)
from typing import List, Optional

try:
import multiprocessing
2 changes: 1 addition & 1 deletion src/flake8/main/application.py
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@
import logging
import sys
import time
from typing import List, Optional, Sequence # noqa: F401 (until flake8 3.7)
from typing import List, Optional, Sequence

import flake8
from flake8 import checker
2 changes: 1 addition & 1 deletion src/flake8/main/cli.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""Command-line implementation of flake8."""
from typing import List, Optional # noqa: F401 (until flake8 3.7)
from typing import List, Optional

from flake8.main import application

2 changes: 1 addition & 1 deletion src/flake8/main/setuptools_command.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""The logic for Flake8's integration with setuptools."""
import os
from typing import List # noqa: F401 (until flake8 3.7)
from typing import List

import setuptools

10 changes: 5 additions & 5 deletions src/flake8/plugins/pyflakes.py
Original file line number Diff line number Diff line change
@@ -57,10 +57,7 @@ def patch_pyflakes():
"""Add error codes to Pyflakes messages."""
for name, obj in vars(pyflakes.messages).items():
if name[0].isupper() and obj.message:
obj.flake8_msg = "%s %s" % (
FLAKE8_PYFLAKES_CODES.get(name, "F999"),
obj.message,
)
obj.flake8_code = FLAKE8_PYFLAKES_CODES.get(name, "F999")


patch_pyflakes()
@@ -188,6 +185,9 @@ def run(self):
yield (
message.lineno,
col,
(message.flake8_msg % message.message_args),
"{} {}".format(
message.flake8_code,
message.message % message.message_args,
),
message.__class__,
)
2 changes: 1 addition & 1 deletion src/flake8/processor.py
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@
import logging
import sys
import tokenize
from typing import List # noqa: F401 (until flake8 3.7)
from typing import List

import flake8
from flake8 import defaults
2 changes: 1 addition & 1 deletion src/flake8/style_guide.py
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@
import linecache
import logging
import sys
from typing import Optional, Union # noqa: F401 (until flake8 3.7)
from typing import Optional, Union

from flake8 import defaults
from flake8 import statistics
7 changes: 3 additions & 4 deletions src/flake8/utils.py
Original file line number Diff line number Diff line change
@@ -8,14 +8,13 @@
import re
import sys
import tokenize
from typing import Callable, Dict, Generator # noqa: F401 (until flake8 3.7)
from typing import List, Pattern, Sequence # noqa: F401 (until flake8 3,7)
from typing import Tuple, Union # noqa: F401 (until flake8 3.7)
from typing import Callable, Dict, Generator, List, Pattern, Sequence, Tuple
from typing import Union

from flake8 import exceptions

if False: # `typing.TYPE_CHECKING` was introduced in 3.5.2
from flake8.plugins.manager import Plugin # noqa: F401 (until flake8 3.7)
from flake8.plugins.manager import Plugin

DIFF_HUNK_REGEXP = re.compile(r"^@@ -\d+(?:,\d+)? \+(\d+)(?:,(\d+))? @@.*$")
COMMA_SEPARATED_LIST_RE = re.compile(r"[,\s]")
18 changes: 18 additions & 0 deletions tests/unit/test_pyflakes_codes.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests of pyflakes monkey patches."""
import ast

import pyflakes

@@ -13,3 +14,20 @@ def test_all_pyflakes_messages_have_flake8_codes_assigned():
if name[0].isupper() and obj.message
}
assert messages == set(pyflakes_shim.FLAKE8_PYFLAKES_CODES)


def test_undefined_local_code():
"""In pyflakes 2.1.0 this code's string formatting was changed."""
src = '''\
import sys
def f():
sys = sys
'''
tree = ast.parse(src)
checker = pyflakes_shim.FlakesChecker(tree, (), 't.py')
message_texts = [s for _, _, s, _ in checker.run()]
assert message_texts == [
"F823 local variable 'sys' defined in enclosing scope on line 1 referenced before assignment", # noqa: E501
"F841 local variable 'sys' is assigned to but never used",
]