[Airflow-4668] Make airflow/contrib/utils Pylint compatible
diff --git a/airflow/contrib/utils/log/task_handler_with_custom_formatter.py b/airflow/contrib/utils/log/task_handler_with_custom_formatter.py
index 3fd690ccd8f46..83a2c6b619428 100644
--- a/airflow/contrib/utils/log/task_handler_with_custom_formatter.py
+++ b/airflow/contrib/utils/log/task_handler_with_custom_formatter.py
@@ -16,6 +16,9 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
+"""
+Custom logging formatter for Airflow
+"""
 
 import logging
 
@@ -25,10 +28,20 @@
 
 
 class TaskHandlerWithCustomFormatter(StreamHandler):
+    """
+    Custom implementation of StreamHandler, a class which writes logging records for Airflow
+    """
     def __init__(self, stream):
         super().__init__()
+        self.prefix_jinja_template = None
 
     def set_context(self, ti):
+        """
+        Accept the run-time context (i.e. the current task) and configure the formatter accordingly.
+
+        :param ti:
+        :return:
+        """
         if ti.raw:
             return
         prefix = conf.get('core', 'task_log_prefix_template')
@@ -37,8 +50,8 @@ def set_context(self, ti):
         if prefix:
             _, self.prefix_jinja_template = parse_template_string(prefix)
             rendered_prefix = self._render_prefix(ti)
-
-        self.setFormatter(logging.Formatter(rendered_prefix + ":" + self.formatter._fmt))
+        formatter = logging.Formatter(rendered_prefix + ":" + self.formatter._fmt)  # pylint:disable=W0212
+        self.setFormatter(formatter)
         self.setLevel(self.level)
 
     def _render_prefix(self, ti):
diff --git a/airflow/contrib/utils/sendgrid.py b/airflow/contrib/utils/sendgrid.py
index dfca195b56e25..243b46f47f465 100644
--- a/airflow/contrib/utils/sendgrid.py
+++ b/airflow/contrib/utils/sendgrid.py
@@ -16,6 +16,9 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
+"""
+Airflow module for emailer using sendgrid
+"""
 
 import base64
 import mimetypes
@@ -30,8 +33,8 @@
 from airflow.utils.log.logging_mixin import LoggingMixin
 
 
-def send_email(to, subject, html_content, files=None, dryrun=False, cc=None,
-               bcc=None, mime_subtype='mixed', sandbox_mode=False, **kwargs):
+def send_email(to, subject, html_content, files=None, cc=None,
+               bcc=None, sandbox_mode=False, **kwargs):
     """
     Send an email with html content using sendgrid.
 
@@ -104,8 +107,8 @@ def send_email(to, subject, html_content, files=None, dryrun=False, cc=None,
 
 def _post_sendgrid_mail(mail_data):
     log = LoggingMixin().log
-    sg = sendgrid.SendGridAPIClient(apikey=os.environ.get('SENDGRID_API_KEY'))
-    response = sg.client.mail.send.post(request_body=mail_data)
+    sendgrid_client = sendgrid.SendGridAPIClient(apikey=os.environ.get('SENDGRID_API_KEY'))
+    response = sendgrid_client.client.mail.send.post(request_body=mail_data)
     # 2xx status code.
     if 200 <= response.status_code < 300:
         log.info('Email with subject %s is successfully sent to recipients: %s',
diff --git a/airflow/contrib/utils/weekday.py b/airflow/contrib/utils/weekday.py
index 8630e5a3dca7c..10bac42f5c2dd 100644
--- a/airflow/contrib/utils/weekday.py
+++ b/airflow/contrib/utils/weekday.py
@@ -16,6 +16,9 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
+"""
+Get the ISO standard day number of the week from a given day string
+"""
 import enum
 
 
diff --git a/scripts/ci/pylint_todo.txt b/scripts/ci/pylint_todo.txt
index 34b7c4b6f0504..55afbe991d6c9 100644
--- a/scripts/ci/pylint_todo.txt
+++ b/scripts/ci/pylint_todo.txt
@@ -130,9 +130,8 @@
 ./airflow/contrib/sensors/sftp_sensor.py
 ./airflow/contrib/sensors/wasb_sensor.py
 ./airflow/contrib/sensors/weekday_sensor.py
-./airflow/contrib/utils/log/task_handler_with_custom_formatter.py
-./airflow/contrib/utils/sendgrid.py
-./airflow/contrib/utils/weekday.py
+./airflow/gcp/utils/mlengine_operator_utils.py
+./airflow/gcp/utils/mlengine_prediction_summary.
 ./airflow/exceptions.py
 ./airflow/executors/base_executor.py
 ./airflow/executors/celery_executor.py
diff --git a/tests/contrib/utils/logging_command_executor.py b/tests/contrib/utils/logging_command_executor.py
index 9c5678cea9580..d79da868b16a4 100644
--- a/tests/contrib/utils/logging_command_executor.py
+++ b/tests/contrib/utils/logging_command_executor.py
@@ -27,8 +27,8 @@ class LoggingCommandExecutor(LoggingMixin):
     def execute_cmd(self, cmd, silent=False, cwd=None):
         if silent:
             self.log.info("Executing in silent mode: '{}'".format(" ".join(cmd)))
-            with open(os.devnull, 'w') as FNULL:
-                return subprocess.call(args=cmd, stdout=FNULL, stderr=subprocess.STDOUT)
+            with open(os.devnull, 'w') as dev_null:
+                return subprocess.call(args=cmd, stdout=dev_null, stderr=subprocess.STDOUT)
         else:
             self.log.info("Executing: '{}'".format(" ".join(cmd)))
             process = subprocess.Popen(
diff --git a/tests/contrib/utils/run_once_decorator.py b/tests/contrib/utils/run_once_decorator.py
index 934250ec2ffa7..89120446f9270 100644
--- a/tests/contrib/utils/run_once_decorator.py
+++ b/tests/contrib/utils/run_once_decorator.py
@@ -31,5 +31,6 @@ def wrapper(*args, **kwargs):
             result = f(*args, **kwargs)
             wrapper.has_run = True
             return result
+        return None
     wrapper.has_run = False
     return wrapper
diff --git a/tests/contrib/utils/test_sendgrid.py b/tests/contrib/utils/test_sendgrid.py
index cb92d654baf34..3561548341e11 100644
--- a/tests/contrib/utils/test_sendgrid.py
+++ b/tests/contrib/utils/test_sendgrid.py
@@ -30,10 +30,10 @@
 class TestSendEmailSendGrid(unittest.TestCase):
     # Unit test for sendgrid.send_email()
     def setUp(self):
-        self.to = ['foo@foo.com', 'bar@bar.com']
+        self.recepients = ['foo@foo.com', 'bar@bar.com']
         self.subject = 'sendgrid-send-email unit test'
         self.html_content = '<b>Foo</b> bar'
-        self.cc = ['foo-cc@foo.com', 'bar-cc@bar.com']
+        self.carbon_copy = ['foo-cc@foo.com', 'bar-cc@bar.com']
         self.bcc = ['foo-bcc@foo.com', 'bar-bcc@bar.com']
         self.expected_mail_data = {
             'content': [{'type': 'text/html', 'value': self.html_content}],
@@ -83,10 +83,10 @@ def test_send_email_sendgrid_correct_email(self, mock_post):
                 }],
             )
 
-            send_email(self.to,
+            send_email(self.recepients,
                        self.subject,
                        self.html_content,
-                       cc=self.cc,
+                       cc=self.carbon_copy,
                        bcc=self.bcc,
                        files=[f.name])
             mock_post.assert_called_once_with(expected_mail_data)
@@ -100,7 +100,7 @@ def test_send_email_sendgrid_correct_email(self, mock_post):
     )
     @mock.patch('airflow.contrib.utils.sendgrid._post_sendgrid_mail')
     def test_send_email_sendgrid_correct_email_extras(self, mock_post):
-        send_email(self.to, self.subject, self.html_content, cc=self.cc, bcc=self.bcc,
+        send_email(self.recepients, self.subject, self.html_content, cc=self.carbon_copy, bcc=self.bcc,
                    personalization_custom_args=self.personalization_custom_args,
                    categories=self.categories)
         mock_post.assert_called_once_with(self.expected_mail_data_extras)
@@ -108,6 +108,6 @@ def test_send_email_sendgrid_correct_email_extras(self, mock_post):
     @mock.patch('os.environ', {})
     @mock.patch('airflow.contrib.utils.sendgrid._post_sendgrid_mail')
     def test_send_email_sendgrid_sender(self, mock_post):
-        send_email(self.to, self.subject, self.html_content, cc=self.cc, bcc=self.bcc,
+        send_email(self.recepients, self.subject, self.html_content, cc=self.carbon_copy, bcc=self.bcc,
                    from_email='foo@foo.bar', from_name='Foo Bar')
         mock_post.assert_called_once_with(self.expected_mail_data_sender)
diff --git a/tests/contrib/utils/test_weekday.py b/tests/contrib/utils/test_weekday.py
index 3b4384344cb2c..906eec52005ed 100644
--- a/tests/contrib/utils/test_weekday.py
+++ b/tests/contrib/utils/test_weekday.py
@@ -31,12 +31,12 @@ def test_weekday_name_value(self):
         weekdays = "MONDAY TUESDAY WEDNESDAY THURSDAY FRIDAY SATURDAY SUNDAY"
         weekdays = weekdays.split()
         for i, weekday in enumerate(weekdays, start=1):
-            e = WeekDay(i)
-            self.assertEqual(e, i)
-            self.assertEqual(int(e), i)
-            self.assertEqual(e.name, weekday)
-            self.assertTrue(e in WeekDay)
-            self.assertTrue(0 < e < 8)
-            self.assertTrue(type(e) is WeekDay)
-            self.assertTrue(isinstance(e, int))
-            self.assertTrue(isinstance(e, Enum))
+            weekday_enum = WeekDay(i)
+            self.assertEqual(weekday_enum, i)
+            self.assertEqual(int(weekday_enum), i)
+            self.assertEqual(weekday_enum.name, weekday)
+            self.assertTrue(weekday_enum in WeekDay)
+            self.assertTrue(0 < weekday_enum < 8)
+            self.assertIsInstance(weekday_enum, WeekDay)
+            self.assertIsInstance(weekday_enum, int)
+            self.assertIsInstance(weekday_enum, Enum)

Make sure you have checked _all_ steps below.

### Jira

- [x] My PR addresses the following [Airflow Jira](https://issues.apache.org/jira/browse/AIRFLOW/) issues and references them in the PR title. For example, "\[AIRFLOW-XXX\] My Airflow PR"
  - https://issues.apache.org/jira/browse/AIRFLOW-4668
  - In case you are fixing a typo in the documentation you can prepend your commit with \[AIRFLOW-XXX\], code changes always need a Jira issue.
  - In case you are proposing a fundamental code change, you need to create an Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvements+Proposals)).
  - In case you are adding a dependency, check if the license complies with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).

### Description

- [x] Here are some details about my PR, including screenshots of any UI changes:
Makes airflow/contrib/utils pylint compatible

### Tests

- [x] My PR adds the following unit tests __OR__ does not need testing for this extremely good reason:
No change in code

### Commits

- [x] My commits all reference Jira issues in their subject lines, and I have squashed multiple commits if they address the same issue. In addition, my commits follow the guidelines from "[How to write a good git commit message](http://chris.beams.io/posts/git-commit/)":
  1. Subject is separated from body by a blank line
  1. Subject is limited to 50 characters (not including Jira issue reference)
  1. Subject does not end with a period
  1. Subject uses the imperative mood ("add", not "adding")
  1. Body wraps at 72 characters
  1. Body explains "what" and "why", not "how"

### Documentation

- [x] In case of new functionality, my PR adds documentation that describes how to use it.
  - All the public functions and the classes in the PR contain docstrings that explain what it does
  - If you implement backwards incompatible changes, please leave a note in the [Updating.md](https://github.com/apache/airflow/blob/master/UPDATING.md) so we can assign it to a appropriate release

### Code Quality

- [x] Passes `flake8`
