[AIRFLOW-4837] Fix pylint errors regarding ungrouped imports (#5464)

This commit is contained in:
Kamil Breguła 2019-06-24 00:01:47 +02:00 коммит произвёл Jarek Potiuk
Родитель 487ad38d60
Коммит 0d38bf40e5
41 изменённых файлов: 58 добавлений и 81 удалений

Просмотреть файл

@ -480,7 +480,6 @@
./tests/contrib/hooks/test_gcs_hook.py
./tests/contrib/hooks/test_grpc_hook.py
./tests/contrib/hooks/test_imap_hook.py
./tests/contrib/hooks/test_jdbc_hook.py
./tests/contrib/hooks/test_jira_hook.py
./tests/contrib/hooks/test_mongo_hook.py
./tests/contrib/hooks/test_openfaas_hook.py
@ -563,14 +562,12 @@
./tests/contrib/sensors/test_aws_redshift_cluster_sensor.py
./tests/contrib/sensors/test_bash_sensor.py
./tests/contrib/sensors/test_celery_queue_sensor.py
./tests/contrib/sensors/test_emr_job_flow_sensor.py
./tests/contrib/sensors/test_emr_step_sensor.py
./tests/contrib/sensors/test_file_sensor.py
./tests/contrib/sensors/test_ftp_sensor.py
./tests/contrib/sensors/test_gcp_transfer_sensor.py
./tests/contrib/sensors/test_jira_sensor_test.py
./tests/contrib/sensors/test_python_sensor.py
./tests/contrib/sensors/test_qubole_sensor.py
./tests/contrib/sensors/test_redis_pub_sub_sensor.py
./tests/contrib/sensors/test_sagemaker_endpoint_sensor.py
./tests/contrib/sensors/test_sagemaker_training_sensor.py
@ -625,7 +622,6 @@
./tests/minikube/test_kubernetes_executor.py
./tests/minikube/test_kubernetes_pod_operator.py
./tests/models/test_cleartasks.py
./tests/models/test_connection.py
./tests/models/test_dag.py
./tests/models/test_dagbag.py
./tests/models/test_dagrun.py
@ -672,13 +668,8 @@
./tests/test_utils/reset_warning_registry.py
./tests/ti_deps/deps/fake_models.py
./tests/ti_deps/deps/test_dagrun_exists_dep.py
./tests/ti_deps/deps/test_not_in_retry_period_dep.py
./tests/ti_deps/deps/test_not_running_dep.py
./tests/ti_deps/deps/test_prev_dagrun_dep.py
./tests/ti_deps/deps/test_ready_to_reschedule_dep.py
./tests/ti_deps/deps/test_runnable_exec_date_dep.py
./tests/ti_deps/deps/test_task_concurrency.py
./tests/ti_deps/deps/test_valid_state_dep.py
./tests/utils/log/elasticmock/fake_elasticsearch.py
./tests/utils/log/elasticmock/__init__.py
./tests/utils/log/test_es_task_handler.py
@ -695,7 +686,6 @@
./tests/utils/test_logging_mixin.py
./tests/utils/test_log_handlers.py
./tests/utils/test_module_loading.py
./tests/utils/test_operator_helpers.py
./tests/utils/test_tests.py
./tests/utils/test_timezone.py
./tests/www/api/experimental/test_endpoints.py

Просмотреть файл

@ -21,9 +21,9 @@
from six import StringIO
import sys
import unittest
from unittest.mock import patch, Mock, MagicMock
from datetime import datetime, timedelta, time
from unittest.mock import patch, Mock, MagicMock
from time import sleep
import psutil
import pytz

Просмотреть файл

@ -19,8 +19,8 @@
import json
import unittest
from collections import namedtuple
from unittest.mock import patch
from collections import namedtuple
from airflow import configuration
from airflow.models import Connection

Просмотреть файл

@ -19,10 +19,10 @@
#
import unittest
from unittest import mock
from typing import List
from google.auth.exceptions import GoogleAuthError
from unittest import mock
from googleapiclient.errors import HttpError
from airflow.contrib.hooks import bigquery_hook as hook

Просмотреть файл

@ -23,6 +23,8 @@ import unittest
from io import StringIO
from parameterized import parameterized
import google.auth
from google.auth.exceptions import GoogleAuthError
from google.api_core.exceptions import RetryError, AlreadyExists
from google.cloud.exceptions import MovedPermanently
@ -31,9 +33,6 @@ from googleapiclient.errors import HttpError
from airflow.contrib.hooks import gcp_api_base_hook as hook
import google.auth
from google.auth.exceptions import GoogleAuthError
from airflow.hooks.base_hook import BaseHook
from tests.compat import mock

Просмотреть файл

@ -19,11 +19,9 @@
#
import unittest
from unittest.mock import Mock, patch
import json
from unittest.mock import Mock
from unittest.mock import patch
from airflow import configuration
from airflow.hooks.jdbc_hook import JdbcHook
from airflow.models import Connection

Просмотреть файл

@ -20,9 +20,8 @@
import six
import unittest
from itertools import dropwhile
from unittest.mock import patch, call
from itertools import dropwhile
from airflow import configuration
from airflow.models import Connection

Просмотреть файл

@ -21,6 +21,8 @@
import datetime
import re
import unittest
from unittest.mock import MagicMock, Mock, patch
from typing import Dict
import time
@ -44,8 +46,6 @@ from tests.compat import mock
from copy import deepcopy
from unittest.mock import MagicMock, Mock
from unittest.mock import patch
TASK_ID = 'test-dataproc-operator'
CLUSTER_NAME = 'test-cluster-name'

Просмотреть файл

@ -18,9 +18,8 @@
# under the License.
import unittest
from datetime import timedelta
from unittest.mock import MagicMock, patch
from datetime import timedelta
from airflow import DAG, configuration
from airflow.contrib.operators.emr_add_steps_operator import EmrAddStepsOperator

Просмотреть файл

@ -19,9 +19,8 @@
#
import unittest
from datetime import timedelta
from unittest.mock import MagicMock, patch
from datetime import timedelta
from airflow import DAG, configuration
from airflow.contrib.operators.emr_create_job_flow_operator import EmrCreateJobFlowOperator

Просмотреть файл

@ -17,10 +17,10 @@
# specific language governing permissions and limitations
# under the License.
import os
from os.path import dirname
import random
import string
import unittest
from os.path import dirname
import time

Просмотреть файл

@ -22,11 +22,11 @@ import os
import subprocess
from googleapiclient._auth import default_credentials, with_scopes
from googleapiclient import discovery
from tests.contrib.utils.base_gcp_system_test_case import RetrieveVariables
from tests.contrib.utils.gcp_authenticator import GcpAuthenticator, GCP_GCS_TRANSFER_KEY
from tests.contrib.utils.logging_command_executor import LoggingCommandExecutor
from googleapiclient import discovery
retrieve_variables = RetrieveVariables()

Просмотреть файл

@ -20,9 +20,9 @@
import json
import unittest
from unittest import mock
import datetime
from unittest import mock
import pandas as pd
from airflow import configuration, DAG

Просмотреть файл

@ -18,9 +18,9 @@
# under the License.
import unittest
from unittest.mock import MagicMock, patch
import datetime
from dateutil.tz import tzlocal
from unittest.mock import MagicMock, patch
from airflow import configuration, AirflowException
from airflow.contrib.sensors.emr_job_flow_sensor import EmrJobFlowSensor

Просмотреть файл

@ -18,8 +18,8 @@
# under the License.
import unittest
from datetime import datetime
from unittest.mock import MagicMock, patch
from datetime import datetime
from dateutil.tz import tzlocal
from airflow import configuration, AirflowException

Просмотреть файл

@ -18,9 +18,9 @@
# under the License.
import unittest
from unittest.mock import MagicMock
from ftplib import error_perm
from unittest.mock import MagicMock
from airflow.contrib.hooks.ftp_hook import FTPHook
from airflow.contrib.sensors.ftp_sensor import FTPSensor

Просмотреть файл

@ -19,9 +19,9 @@
#
import unittest
from unittest.mock import patch
from datetime import datetime
from unittest.mock import patch
from airflow.contrib.sensors.qubole_sensor import QuboleFileSensor, QubolePartitionSensor
from airflow.exceptions import AirflowException

Просмотреть файл

@ -19,9 +19,9 @@
import json
import unittest
from unittest import mock
import doctest
from unittest import mock
import multiprocessing
import os
import pickle # type: ignore
@ -30,6 +30,7 @@ import signal
import sqlalchemy
import subprocess
import tempfile
from tempfile import NamedTemporaryFile
import warnings
from datetime import timedelta
from dateutil.relativedelta import relativedelta
@ -37,31 +38,26 @@ from email.mime.application import MIMEApplication
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from numpy.testing import assert_array_almost_equal
from tempfile import NamedTemporaryFile
from time import sleep
from airflow import configuration
from airflow import configuration, jobs, models, DAG, utils, macros, settings, exceptions
from airflow.bin import cli
from airflow.configuration import AirflowConfigException, run_command
from airflow.exceptions import AirflowException
from airflow.executors import SequentialExecutor
from airflow.models import Variable, TaskInstance
from airflow import jobs, models, DAG, utils, macros, settings, exceptions
from airflow.models import BaseOperator, Connection, TaskFail
from airflow.hooks.base_hook import BaseHook
from airflow.hooks.sqlite_hook import SqliteHook
from airflow.models import Variable, TaskInstance, BaseOperator, Connection, TaskFail
from airflow.operators.bash_operator import BashOperator
from airflow.operators.check_operator import CheckOperator, ValueCheckOperator
from airflow.operators.dagrun_operator import TriggerDagRunOperator
from airflow.operators.python_operator import PythonOperator
from airflow.operators.dummy_operator import DummyOperator
from airflow.hooks.base_hook import BaseHook
from airflow.hooks.sqlite_hook import SqliteHook
from airflow.bin import cli
from airflow.operators.python_operator import PythonOperator
from airflow.settings import Session
from airflow.utils import timezone
from airflow.utils.timezone import datetime
from airflow.utils.state import State
from airflow.utils.dates import days_ago, infer_time_unit, round_time, scale_time_units
from airflow.exceptions import AirflowException
from airflow.configuration import AirflowConfigException, run_command
from airflow.utils.state import State
from airflow.utils.timezone import datetime
from pendulum import utcnow
import six

Просмотреть файл

@ -19,10 +19,10 @@
import os
import sys
import unittest
from unittest import mock
import contextlib
from multiprocessing import Pool
from unittest import mock
from celery import Celery
from celery import states as celery_states
@ -37,7 +37,7 @@ from airflow import configuration
configuration.load_test_config()
# leave this it is used by the test worker
import celery.contrib.testing.tasks # noqa: F401
import celery.contrib.testing.tasks # noqa: F401 pylint: disable=ungrouped-imports
def _prepare_test_bodies():

Просмотреть файл

@ -23,9 +23,9 @@ import itertools
import os
import random
import unittest
from unittest import mock
from collections import OrderedDict
from unittest import mock
import pandas as pd
from hmsclient import HMSClient

Просмотреть файл

@ -17,10 +17,9 @@
# specific language governing permissions and limitations
# under the License.
#
import unittest
from unittest import mock
import tempfile
import unittest
from botocore.exceptions import NoCredentialsError

Просмотреть файл

@ -18,10 +18,10 @@
# under the License.
import unittest
from unittest.mock import patch
from collections import namedtuple
from cryptography.fernet import Fernet
from unittest.mock import patch
from parameterized import parameterized
from airflow.models import Connection, crypto

Просмотреть файл

@ -22,13 +22,13 @@ import logging
import os
import re
import unittest
from unittest.mock import patch
import uuid
from tempfile import NamedTemporaryFile
import jinja2
import pendulum
import six
from unittest.mock import patch
from airflow import models, settings, configuration
from airflow.exceptions import AirflowException, AirflowDagCycleException

Просмотреть файл

@ -23,9 +23,8 @@ import os
import shutil
import textwrap
import unittest
from tempfile import mkdtemp, NamedTemporaryFile
from unittest.mock import patch, ANY
from tempfile import mkdtemp, NamedTemporaryFile
from airflow import models, configuration
from airflow.models import DagModel, DagBag, TaskInstance as TI

Просмотреть файл

@ -20,11 +20,11 @@
import datetime
import time
import unittest
from unittest.mock import patch, mock_open
import urllib
from typing import Union, List
import pendulum
from freezegun import freeze_time
from unittest.mock import patch, mock_open
from parameterized import parameterized, param
from sqlalchemy.orm.session import Session
from airflow import models, settings, configuration

Просмотреть файл

@ -18,9 +18,9 @@
# under the License.
import unittest
from unittest.mock import patch
from collections import OrderedDict
from unittest.mock import patch
from airflow import AirflowException
from airflow.operators.hive_stats_operator import HiveStatsCollectionOperator

Просмотреть файл

@ -18,13 +18,13 @@
# under the License.
import unittest
from unittest.mock import patch, PropertyMock, Mock
from collections import OrderedDict
try:
import pymssql
except ImportError:
pymssql = None
from unittest.mock import patch, PropertyMock, Mock
from airflow.operators.mssql_to_hive import MsSqlToHiveTransfer

Просмотреть файл

@ -24,10 +24,11 @@ import os
import shutil
import sys
import unittest
from unittest import mock
from tempfile import mkdtemp
import boto3
from unittest import mock
from moto import mock_s3
from airflow.exceptions import AirflowException

Просмотреть файл

@ -16,11 +16,11 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
from unittest import mock
import os
import psutil
import time
import unittest
from unittest import mock
from airflow import models, settings
from airflow.jobs import LocalTaskJob

Просмотреть файл

@ -18,9 +18,9 @@
# under the License.
import unittest
from unittest.mock import Mock
from datetime import timedelta
from freezegun import freeze_time
from unittest.mock import Mock
from airflow.models import TaskInstance
from airflow.ti_deps.deps.not_in_retry_period_dep import NotInRetryPeriodDep

Просмотреть файл

@ -18,8 +18,8 @@
# under the License.
import unittest
from datetime import datetime
from unittest.mock import Mock
from datetime import datetime
from airflow.ti_deps.deps.not_running_dep import NotRunningDep
from airflow.utils.state import State

Просмотреть файл

@ -18,8 +18,8 @@
# under the License.
import unittest
from datetime import datetime
from unittest.mock import Mock
from datetime import datetime
from airflow.models import DAG, BaseOperator
from airflow.ti_deps.dep_context import DepContext

Просмотреть файл

@ -18,8 +18,8 @@
# under the License.
import unittest
from datetime import timedelta
from unittest.mock import Mock, patch
from datetime import timedelta
from airflow.models import DAG, TaskInstance, TaskReschedule
from airflow.ti_deps.dep_context import DepContext

Просмотреть файл

@ -18,8 +18,8 @@
# under the License.
import unittest
from datetime import datetime
from unittest.mock import Mock
from datetime import datetime
from airflow.models import DAG, BaseOperator
from airflow.ti_deps.dep_context import DepContext

Просмотреть файл

@ -18,8 +18,8 @@
# under the License.
import unittest
from datetime import datetime
from unittest.mock import Mock
from datetime import datetime
from airflow import AirflowException
from airflow.ti_deps.deps.valid_state_dep import ValidStateDep

Просмотреть файл

@ -23,9 +23,8 @@ import sys
import tempfile
import unittest
from unittest import mock
from datetime import timedelta
from unittest.mock import MagicMock
from datetime import timedelta
from airflow import configuration as conf
from airflow.jobs import DagFileProcessor

Просмотреть файл

@ -18,9 +18,8 @@
# under the License.
import unittest
from datetime import datetime
from unittest import mock
from datetime import datetime
from airflow.utils import operator_helpers

Просмотреть файл

@ -18,10 +18,10 @@
# under the License.
import json
import unittest
from unittest import mock
import os
import socket
import unittest
from datetime import datetime

Просмотреть файл

@ -18,8 +18,8 @@
# under the License.
import unittest
import logging
from unittest import mock
import logging
from flask import Flask
from flask_appbuilder import AppBuilder, SQLA, Model, has_access, expose

Просмотреть файл

@ -18,10 +18,10 @@
# under the License.
import unittest
from unittest import mock
from datetime import datetime
from urllib.parse import parse_qs
from unittest import mock
from bs4 import BeautifulSoup
from airflow.www import utils

Просмотреть файл

@ -26,11 +26,11 @@ import shutil
import sys
import tempfile
import unittest
import urllib
from datetime import timedelta
from urllib.parse import quote_plus
from unittest import mock
import urllib
from urllib.parse import quote_plus
from datetime import timedelta
import jinja2
from flask import Markup, url_for
from parameterized import parameterized