Repository: celery/celery

Issue:
flake8 check fails due to update
## Steps to reproduce

Simply run flake8 linter

```tox -e flake8```

## Expected behavior

flake8 linter must pass tests

## Actual behavior

flake8 linter fails

```with error W504 line break after binary operator```
```F841 local variable 'exc' is assigned to but never used```

```tox -e flake8                                                                                                                              
flake8 create: /home/henrylf/python/celery/.tox/flake8                                                                                                                                           
flake8 installdeps: -r/home/henrylf/python/celery/requirements/default.txt, -r/home/henrylf/python/celery/requirements/test.txt, -r/home/henrylf/python/celery/requirements/pkgutils.txt         
flake8 develop-inst: /home/henrylf/python/celery                                                                                                                                                 
flake8 installed: amqp==2.3.2,atomicwrites==1.2.1,attrs==18.2.0,billiard==3.5.0.4,bumpversion==0.5.3,case==1.5.3,-e git+https://github.com/othalla/celery.git@2a33ba326645bd217a7286929f409ef171cf
d8bf#egg=celery,cyanide==1.3.0,filelock==3.0.9,flake8==3.6.0,flakeplus==1.1.0,kombu==4.2.1,linecache2==1.0.0,mccabe==0.6.1,mock==2.0.0,more-itertools==4.3.0,nose==1.3.7,pbr==5.1.0,pluggy==0.8.0,
py==1.7.0,pycodestyle==2.4.0,pydocstyle==1.1.1,pyflakes==2.0.0,pytest==3.8.2,python-vagrant==0.5.15,pytz==2018.5,six==1.11.0,sphinx2rst==1.1.0,toml==0.10.0,tox==3.5.2,traceback2==1.4.0,Unipath==
1.1,unittest2==1.1.0,vine==1.1.4,virtualenv==16.0.0                                                                                                                                              
flake8 run-test-pre: PYTHONHASHSEED='3688869430'                                                                                                                                                 
flake8 runtests: commands[0] | flake8 -j 2 /home/henrylf/python/celery/celery /home/henrylf/python/celery/t                                                                                      
/home/henrylf/python/celery/celery/result.py:830:17: W504 line break after binary operator                                                                                                       
/home/henrylf/python/celery/celery/result.py:930:17: W504 line break after binary operator                                                                                                       
/home/henrylf/python/celery/celery/result.py:931:17: W504 line break after binary operator                                                                                                       
/home/henrylf/python/celery/celery/beat.py:216:30: W504 line break after binary operator                                                                                                         
/home/henrylf/python/celery/celery/beat.py:217:30: W504 line break after binary operator                                                                                                         
/home/henrylf/python/celery/celery/beat.py:263:17: W504 line break after binary operator                                                                                                         
/home/henrylf/python/celery/celery/beat.py:264:17: W504 line break after binary operator                                                                                                         
/home/henrylf/python/celery/celery/beat.py:295:17: W504 line break after binary operator                                                                                                         
/home/henrylf/python/celery/celery/beat.py:334:16: W504 line break after binary operator                                                                                                         
/home/henrylf/python/celery/celery/beat.py:335:13: W504 line break after binary operator                                                                                                         
/home/henrylf/python/celery/celery/beat.py:336:17: W504 line break after binary operator                                                                                                         
/home/henrylf/python/celery/celery/beat.py:568:30: W504 line break after binary operator                                                                                                         
/home/henrylf/python/celery/celery/schedules.py:277:25: W504 line break after binary operator                                                                                                    
/home/henrylf/python/celery/celery/schedules.py:484:25: W504 line break after binary operator                                                                                                    
/home/henrylf/python/celery/celery/schedules.py:487:25: W504 line break after binary operator                                                                                                    
/home/henrylf/python/celery/celery/schedules.py:556:13: W504 line break after binary operator                                                                                                    
/home/henrylf/python/celery/celery/schedules.py:557:13: W504 line break after binary operator                                                                                                    
/home/henrylf/python/celery/celery/schedules.py:562:13: W504 line break after binary operator                                                                                                    
/home/henrylf/python/celery/celery/schedules.py:563:13: W504 line break after binary operator                                                                                                    
/home/henrylf/python/celery/celery/schedules.py:564:13: W504 line break after binary operator                                                                                                    
/home/henrylf/python/celery/celery/schedules.py:565:13: W504 line break after binary operator                                                                                                    
/home/henrylf/python/celery/celery/schedules.py:566:13: W504 line break after binary operator                                                                                                    
/home/henrylf/python/celery/celery/schedules.py:576:30: W504 line break after binary operator            
/home/henrylf/python/celery/celery/schedules.py:586:32: W504 line break after binary operator            
/home/henrylf/python/celery/celery/schedules.py:636:17: W504 line break after binary operator             
/home/henrylf/python/celery/celery/schedules.py:637:17: W504 line break after binary operator
/home/henrylf/python/celery/celery/platforms.py:191:9: F841 local variable 'exc' is assigned to but never used                                                                                   
/home/henrylf/python/celery/celery/platforms.py:206:9: F841 local variable 'exc' is assigned to but never used
/home/henrylf/python/celery/celery/bin/amqp.py:283:9: F841 local variable 'exc' is assigned to but never used
/home/henrylf/python/celery/celery/app/trace.py:397:17: F841 local variable 'exc' is assigned to but never used
...
```


Discussion:

Resolving patch:
diff --git a/celery/app/trace.py b/celery/app/trace.py
--- a/celery/app/trace.py
+++ b/celery/app/trace.py
@@ -394,7 +394,7 @@ def trace_task(uuid, args, kwargs, request=None):
                         task_request, exc, uuid, RETRY, call_errbacks=False)
                 except Exception as exc:
                     I, R, state, retval = on_error(task_request, exc, uuid)
-                except BaseException as exc:
+                except BaseException:
                     raise
                 else:
                     try:
diff --git a/celery/bin/amqp.py b/celery/bin/amqp.py
--- a/celery/bin/amqp.py
+++ b/celery/bin/amqp.py
@@ -280,7 +280,7 @@ def onecmd(self, line):
         self.counter = next(self.inc_counter)
         try:
             self.respond(self.dispatch(cmd, arg))
-        except (AttributeError, KeyError) as exc:
+        except (AttributeError, KeyError):
             self.default(line)
         except Exception as exc:  # pylint: disable=broad-except
             self.say(exc)
diff --git a/celery/platforms.py b/celery/platforms.py
--- a/celery/platforms.py
+++ b/celery/platforms.py
@@ -188,7 +188,7 @@ def remove_if_stale(self):
         """
         try:
             pid = self.read_pid()
-        except ValueError as exc:
+        except ValueError:
             print('Broken pidfile found - Removing it.', file=sys.stderr)
             self.remove()
             return True
@@ -203,7 +203,7 @@ def remove_if_stale(self):
                 print('Stale pidfile exists - Removing it.', file=sys.stderr)
                 self.remove()
                 return True
-        except SystemError as exc:
+        except SystemError:
             print('Stale pidfile exists - Removing it.', file=sys.stderr)
             self.remove()
             return True


Test patch: