Skip to content

Commit

Permalink
Fixed flake errors after it was moved to Python 3
Browse files Browse the repository at this point in the history
  • Loading branch information
Konstantin Gudkov committed Apr 16, 2019
1 parent 4129069 commit 64fe0cf
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion luigi/contrib/docker_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ def run(self):
self.__logger.error("Container " + container_name +
" exited with non zero code: " + message)
raise
except ImageNotFound as e:
except ImageNotFound:
self.__logger.error("Image " + self._image + " not found")
raise
except APIError as e:
Expand Down
4 changes: 2 additions & 2 deletions luigi/contrib/ftp.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ def _rm_recursive(self, ftp, path):

try:
names = ftp.nlst()
except ftplib.all_errors as e:
except ftplib.all_errors:
# some FTP servers complain when you try and list non-existent paths
return

Expand All @@ -226,7 +226,7 @@ def _rm_recursive(self, ftp, path):
ftp.cwd(wd) # don't try a nuke a folder we're in
ftp.cwd(path) # then go back to where we were
self._rm_recursive(ftp, name)
except ftplib.all_errors as e:
except ftplib.all_errors:
ftp.delete(name)

try:
Expand Down
2 changes: 1 addition & 1 deletion luigi/contrib/mssqldb.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

try:
import _mssql
except ImportError as e:
except ImportError:
logger.warning("Loading MSSQL module without the python package pymssql. \
This will crash at runtime if SQL Server functionality is used.")

Expand Down
2 changes: 1 addition & 1 deletion luigi/contrib/mysqldb.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
try:
import mysql.connector
from mysql.connector import errorcode, Error
except ImportError as e:
except ImportError:
logger.warning("Loading MySQL module without the python package mysql-connector-python. \
This will crash at runtime if MySQL functionality is used.")

Expand Down
6 changes: 3 additions & 3 deletions luigi/lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,11 @@ def acquire_for(pid_dir, num_available=1, kill_signal=None):
def _read_pids_file(pid_file):
# First setup a python 2 vs 3 compatibility
# http://stackoverflow.com/a/21368622/621449
try:
FileNotFoundError
except NameError:
if six.PY2:
# Should only happen on python 2
FileNotFoundError = IOError
else:
global FileNotFoundError
# If the file happen to not exist, simply return
# an empty set()
try:
Expand Down
1 change: 1 addition & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ commands =
# By putting it here, local flake8 runs will also pick it up.
[flake8]
max-line-length=160
builtins = unicode

[testenv:flake8]
deps =
Expand Down

0 comments on commit 64fe0cf

Please sign in to comment.