summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Frost <indigo@bitglue.com>2017-02-26 19:18:09 -0500
committerPhil Frost <indigo@bitglue.com>2017-02-26 19:18:09 -0500
commit770f127c9d53234bcf41238d3194c3b91eab841a (patch)
tree155ba80b7b9d09c87e936082da92447f0aa2b276
parent4dfa2b8cd367869bfa776f03efc64e514f70e483 (diff)
parent41148b45f797951057dc782682dd4055a4a3c1b6 (diff)
downloadpyflakes-770f127c9d53234bcf41238d3194c3b91eab841a.tar.gz
Merge branch 'master' of github.com:pyflakes/pyflakes
Forgot to push the commit that increments to 1.5.0 when I made the release, and some changes have been made since then :(
-rw-r--r--.appveyor.yml12
-rw-r--r--pyflakes/checker.py9
-rw-r--r--pyflakes/test/test_api.py3
-rw-r--r--pyflakes/test/test_other.py7
4 files changed, 15 insertions, 16 deletions
diff --git a/.appveyor.yml b/.appveyor.yml
index 149be37..4011606 100644
--- a/.appveyor.yml
+++ b/.appveyor.yml
@@ -30,13 +30,11 @@ install:
# pypy3-2.4.0 and pypy-2.6.1 are manually bootstrapped and tested
- ps: (New-Object Net.WebClient).DownloadFile('https://bootstrap.pypa.io/get-pip.py', "$env:appveyor_build_folder\get-pip.py")
- - git clone https://github.com/pypa/setuptools/
- - cd setuptools
- - C:\pypy3-2.4.0-win32\pypy3 bootstrap.py
- - C:\pypy3-2.4.0-win32\pypy3 setup.py install
- - C:\pypy-2.6.1-win32\pypy bootstrap.py
- - C:\pypy-2.6.1-win32\pypy setup.py install
- - cd ..
+ # errors are ignored due to https://github.com/pypa/pip/issues/2669#issuecomment-136405390
+ # NOTE: If and when a new version of PyPy3 is released for Windows that
+ # supports anything newer than Python 3.2, remove the setuptools pin.
+ - ps: C:\pypy3-2.4.0-win32\pypy3 "$env:appveyor_build_folder\get-pip.py"; C:\pypy3-2.4.0-win32\pypy3 -m pip install -U --force-reinstall pip==8.1.2 "setuptools<30"; echo "ignore error"
+ - ps: C:\pypy-2.6.1-win32\pypy "$env:appveyor_build_folder\get-pip.py"
build: off
diff --git a/pyflakes/checker.py b/pyflakes/checker.py
index 3e8dc8d..382574e 100644
--- a/pyflakes/checker.py
+++ b/pyflakes/checker.py
@@ -1337,19 +1337,12 @@ class Checker(object):
pass
def ANNASSIGN(self, node):
- """
- Annotated assignments don't have annotations evaluated on function
- scope, hence the custom implementation.
-
- See: PEP 526.
- """
if node.value:
# Only bind the *targets* if the assignment has a value.
# Otherwise it's not really ast.Store and shouldn't silence
# UndefinedLocal warnings.
self.handleNode(node.target, node)
- if not isinstance(self.scope, FunctionScope):
- self.handleNode(node.annotation, node)
+ self.handleNode(node.annotation, node)
if node.value:
# If the assignment has value, handle the *value* now.
self.handleNode(node.value, node)
diff --git a/pyflakes/test/test_api.py b/pyflakes/test/test_api.py
index 77ee33c..51b0027 100644
--- a/pyflakes/test/test_api.py
+++ b/pyflakes/test/test_api.py
@@ -518,6 +518,9 @@ foo = '\\xyz'
If the source file is not readable, this is reported on standard
error.
"""
+ if os.getuid() == 0:
+ self.skipTest('root user can access all files regardless of '
+ 'permissions')
sourcePath = self.makeTempFile('')
os.chmod(sourcePath, 0)
count, errors = self.getErrors(sourcePath)
diff --git a/pyflakes/test/test_other.py b/pyflakes/test/test_other.py
index 6f02001..9c8462e 100644
--- a/pyflakes/test/test_other.py
+++ b/pyflakes/test/test_other.py
@@ -1839,13 +1839,18 @@ class TestAsyncStatements(TestCase):
name: str = 'Bob'
age: int = 18
foo: not_a_real_type = None
- ''', m.UnusedVariable, m.UnusedVariable, m.UnusedVariable)
+ ''', m.UnusedVariable, m.UnusedVariable, m.UnusedVariable, m.UndefinedName)
self.flakes('''
def f():
name: str
print(name)
''', m.UndefinedName)
self.flakes('''
+ from typing import Any
+ def f():
+ a: Any
+ ''')
+ self.flakes('''
foo: not_a_real_type
''', m.UndefinedName)
self.flakes('''