noqa to silence flake8 on Python 3 only syntax

This commit is contained in:
cclauss 2018-01-20 12:33:27 +01:00 committed by GitHub
parent b3873be7b5
commit cc5102ab01
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -7,14 +7,14 @@ import sys
# returns F(n) # returns F(n)
def fibonacci(n: int): def fibonacci(n: int): # noqa: F821 This syntax is Python 3 only
if n < 0: if n < 0:
raise ValueError("Negative arguments are not supported") raise ValueError("Negative arguments are not supported")
return _fib(n)[0] return _fib(n)[0]
# returns (F(n), F(n-1)) # returns (F(n), F(n-1))
def _fib(n: int): def _fib(n: int): # noqa: F821 This syntax is Python 3 only
if n == 0: if n == 0:
# (F(0), F(1)) # (F(0), F(1))
return (0, 1) return (0, 1)