From 680f27fd2f01e6327578f7f21d752cc380c5f78f Mon Sep 17 00:00:00 2001 From: Harshal Sheth Date: Tue, 26 Jul 2022 15:31:51 -0700 Subject: [PATCH 1/2] fix(ingest): cleanup unused flake8 noqa statements In the future, we can discover these using `flake8-noqa`. --- .../src/datahub/ingestion/source/looker_common.py | 2 +- .../src/datahub/ingestion/source/sql/oracle.py | 2 +- .../src/datahub/ingestion/source/sql/redshift.py | 2 +- .../src/datahub/ingestion/source/sql/sql_common.py | 2 +- .../src/datahub/ingestion/source/sql/trino.py | 2 +- metadata-ingestion/src/datahub/telemetry/stats.py | 6 +++--- metadata-ingestion/tests/integration/lookml/test_lookml.py | 4 ++-- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/metadata-ingestion/src/datahub/ingestion/source/looker_common.py b/metadata-ingestion/src/datahub/ingestion/source/looker_common.py index 34b64242221f1..8bfa0498ed0c0 100644 --- a/metadata-ingestion/src/datahub/ingestion/source/looker_common.py +++ b/metadata-ingestion/src/datahub/ingestion/source/looker_common.py @@ -552,7 +552,7 @@ def from_dict(cls, model_name: str, dict: Dict) -> "LookerExplore": joins=joins, ) - @classmethod # noqa: C901 + @classmethod def from_api( # noqa: C901 cls, model: str, diff --git a/metadata-ingestion/src/datahub/ingestion/source/sql/oracle.py b/metadata-ingestion/src/datahub/ingestion/source/sql/oracle.py index 611f2f4b39a40..e69589a15f3b6 100644 --- a/metadata-ingestion/src/datahub/ingestion/source/sql/oracle.py +++ b/metadata-ingestion/src/datahub/ingestion/source/sql/oracle.py @@ -2,7 +2,7 @@ from unittest.mock import patch # This import verifies that the dependencies are available. -import cx_Oracle # noqa: F401 +import cx_Oracle import pydantic from pydantic.fields import Field from sqlalchemy import event diff --git a/metadata-ingestion/src/datahub/ingestion/source/sql/redshift.py b/metadata-ingestion/src/datahub/ingestion/source/sql/redshift.py index 51b7a821becc4..c9edeb1555946 100644 --- a/metadata-ingestion/src/datahub/ingestion/source/sql/redshift.py +++ b/metadata-ingestion/src/datahub/ingestion/source/sql/redshift.py @@ -7,7 +7,7 @@ # These imports verify that the dependencies are available. import psycopg2 # noqa: F401 -import pydantic # noqa: F401 +import pydantic import sqlalchemy import sqlalchemy_redshift # noqa: F401 from pydantic.fields import Field diff --git a/metadata-ingestion/src/datahub/ingestion/source/sql/sql_common.py b/metadata-ingestion/src/datahub/ingestion/source/sql/sql_common.py index 3a5d91b101ca0..7cd99608b95af 100644 --- a/metadata-ingestion/src/datahub/ingestion/source/sql/sql_common.py +++ b/metadata-ingestion/src/datahub/ingestion/source/sql/sql_common.py @@ -837,7 +837,7 @@ def _get_domain_wu( entity_urn: str, entity_type: str, sql_config: SQLAlchemyConfig, - ) -> Iterable[Union[MetadataWorkUnit]]: + ) -> Iterable[MetadataWorkUnit]: domain_urn = self._gen_domain_urn(dataset_name) if domain_urn: diff --git a/metadata-ingestion/src/datahub/ingestion/source/sql/trino.py b/metadata-ingestion/src/datahub/ingestion/source/sql/trino.py index f11fbeb8356be..ca174ff22bc3a 100644 --- a/metadata-ingestion/src/datahub/ingestion/source/sql/trino.py +++ b/metadata-ingestion/src/datahub/ingestion/source/sql/trino.py @@ -13,7 +13,7 @@ from sqlalchemy.engine.reflection import Inspector from sqlalchemy.sql import sqltypes from sqlalchemy.sql.type_api import TypeEngine -from trino.exceptions import TrinoQueryError # noqa +from trino.exceptions import TrinoQueryError from trino.sqlalchemy import datatype, error from trino.sqlalchemy.dialect import TrinoDialect diff --git a/metadata-ingestion/src/datahub/telemetry/stats.py b/metadata-ingestion/src/datahub/telemetry/stats.py index e76580d677588..bf98bd72b574c 100644 --- a/metadata-ingestion/src/datahub/telemetry/stats.py +++ b/metadata-ingestion/src/datahub/telemetry/stats.py @@ -9,12 +9,12 @@ def __lt__(self, __other: Any) -> Any: ... -SupportsComparisonT = TypeVar("SupportsComparisonT", bound=SupportsLT) # noqa: Y001 +_SupportsComparisonT = TypeVar("_SupportsComparisonT", bound=SupportsLT) def calculate_percentiles( - data: List[SupportsComparisonT], percentiles: List[int] -) -> Dict[int, SupportsComparisonT]: + data: List[_SupportsComparisonT], percentiles: List[int] +) -> Dict[int, _SupportsComparisonT]: size = len(data) if size == 0: diff --git a/metadata-ingestion/tests/integration/lookml/test_lookml.py b/metadata-ingestion/tests/integration/lookml/test_lookml.py index b9a53614e4778..b4b352d5771b6 100644 --- a/metadata-ingestion/tests/integration/lookml/test_lookml.py +++ b/metadata-ingestion/tests/integration/lookml/test_lookml.py @@ -10,7 +10,7 @@ from datahub.configuration.common import PipelineExecutionError from datahub.ingestion.run.pipeline import Pipeline -from tests.test_helpers import mce_helpers # noqa: F401 +from tests.test_helpers import mce_helpers logging.getLogger("lkml").setLevel(logging.INFO) @@ -229,7 +229,7 @@ def ingestion_test( tmp_path: pathlib.Path, mock_time: int, mock_connection: DBConnection, -) -> None: # noqa : No need for type annotations here +) -> None: test_resources_dir = pytestconfig.rootpath / "tests/integration/lookml" mce_out_file = f"lookml_mces_api_{mock_connection.dialect_name}.json" mocked_client = mock.MagicMock() From 7dd4a061d480da7fc6989ecdf6deade485c41d72 Mon Sep 17 00:00:00 2001 From: Harshal Sheth Date: Tue, 26 Jul 2022 16:11:26 -0700 Subject: [PATCH 2/2] add back c901 --- .../src/datahub/ingestion/source/looker_common.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata-ingestion/src/datahub/ingestion/source/looker_common.py b/metadata-ingestion/src/datahub/ingestion/source/looker_common.py index 8bfa0498ed0c0..34b64242221f1 100644 --- a/metadata-ingestion/src/datahub/ingestion/source/looker_common.py +++ b/metadata-ingestion/src/datahub/ingestion/source/looker_common.py @@ -552,7 +552,7 @@ def from_dict(cls, model_name: str, dict: Dict) -> "LookerExplore": joins=joins, ) - @classmethod + @classmethod # noqa: C901 def from_api( # noqa: C901 cls, model: str,