From 94fccca97030ee59d89f302a98137b17e7b01a33 Mon Sep 17 00:00:00 2001 From: Felix Uellendall Date: Tue, 4 Feb 2020 09:44:35 +0100 Subject: [PATCH] [AIRFLOW-XXXX] Add pre-commit check for utf-8 file encoding (#7347) Note: From Python 3.x onwards the explicit utf-8 header is no longer required. It is utf-8 encoded by default. --- .pre-commit-config.yaml | 4 ++++ airflow/providers/amazon/aws/hooks/cloud_formation.py | 1 - airflow/providers/amazon/aws/operators/cloud_formation.py | 1 - airflow/providers/amazon/aws/sensors/cloud_formation.py | 1 - airflow/providers/mysql/operators/presto_to_mysql.py | 1 - tests/operators/test_generic_transfer.py | 1 - tests/providers/amazon/aws/hooks/test_cloud_formation.py | 1 - tests/providers/amazon/aws/operators/test_cloud_formation.py | 1 - tests/providers/amazon/aws/sensors/test_cloud_formation.py | 1 - tests/providers/apache/cassandra/sensors/record.py | 1 - tests/providers/microsoft/msqql/__init__.py | 1 - tests/providers/mysql/operators/test_mysql.py | 1 - tests/providers/postgres/operators/__init__.py | 1 - tests/providers/postgres/operators/test_postgres.py | 1 - 14 files changed, 4 insertions(+), 13 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9a552749d9d7b..52bc2ff682983 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -150,6 +150,10 @@ repos: - id: check-executables-have-shebangs - id: check-xml - id: trailing-whitespace + - id: fix-encoding-pragma + args: + - --remove + exclude: ^airflow/_vendor/.*$ - repo: https://github.com/pre-commit/pygrep-hooks rev: v1.4.4 hooks: diff --git a/airflow/providers/amazon/aws/hooks/cloud_formation.py b/airflow/providers/amazon/aws/hooks/cloud_formation.py index 062fc184524ce..08d8ec91ec5ea 100644 --- a/airflow/providers/amazon/aws/hooks/cloud_formation.py +++ b/airflow/providers/amazon/aws/hooks/cloud_formation.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file diff --git a/airflow/providers/amazon/aws/operators/cloud_formation.py b/airflow/providers/amazon/aws/operators/cloud_formation.py index a3bce702a6cf3..f6eadae9ec298 100644 --- a/airflow/providers/amazon/aws/operators/cloud_formation.py +++ b/airflow/providers/amazon/aws/operators/cloud_formation.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file diff --git a/airflow/providers/amazon/aws/sensors/cloud_formation.py b/airflow/providers/amazon/aws/sensors/cloud_formation.py index 7f99b1b6e82d4..9b286b03e7bf1 100644 --- a/airflow/providers/amazon/aws/sensors/cloud_formation.py +++ b/airflow/providers/amazon/aws/sensors/cloud_formation.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file diff --git a/airflow/providers/mysql/operators/presto_to_mysql.py b/airflow/providers/mysql/operators/presto_to_mysql.py index 59f291d437ec3..787ed29c82da5 100644 --- a/airflow/providers/mysql/operators/presto_to_mysql.py +++ b/airflow/providers/mysql/operators/presto_to_mysql.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file diff --git a/tests/operators/test_generic_transfer.py b/tests/operators/test_generic_transfer.py index f1d813e19b54d..daed443b43321 100644 --- a/tests/operators/test_generic_transfer.py +++ b/tests/operators/test_generic_transfer.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file diff --git a/tests/providers/amazon/aws/hooks/test_cloud_formation.py b/tests/providers/amazon/aws/hooks/test_cloud_formation.py index ae7c45aac8567..ca992ba4a6bda 100644 --- a/tests/providers/amazon/aws/hooks/test_cloud_formation.py +++ b/tests/providers/amazon/aws/hooks/test_cloud_formation.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file diff --git a/tests/providers/amazon/aws/operators/test_cloud_formation.py b/tests/providers/amazon/aws/operators/test_cloud_formation.py index abc8c333bf9a8..1b60b7211e330 100644 --- a/tests/providers/amazon/aws/operators/test_cloud_formation.py +++ b/tests/providers/amazon/aws/operators/test_cloud_formation.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file diff --git a/tests/providers/amazon/aws/sensors/test_cloud_formation.py b/tests/providers/amazon/aws/sensors/test_cloud_formation.py index 7d93a601fd263..0df98da0e24b6 100644 --- a/tests/providers/amazon/aws/sensors/test_cloud_formation.py +++ b/tests/providers/amazon/aws/sensors/test_cloud_formation.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file diff --git a/tests/providers/apache/cassandra/sensors/record.py b/tests/providers/apache/cassandra/sensors/record.py index b6cea1e648728..b3375f195d15b 100644 --- a/tests/providers/apache/cassandra/sensors/record.py +++ b/tests/providers/apache/cassandra/sensors/record.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file diff --git a/tests/providers/microsoft/msqql/__init__.py b/tests/providers/microsoft/msqql/__init__.py index 114d189da14ab..217e5db960782 100644 --- a/tests/providers/microsoft/msqql/__init__.py +++ b/tests/providers/microsoft/msqql/__init__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file diff --git a/tests/providers/mysql/operators/test_mysql.py b/tests/providers/mysql/operators/test_mysql.py index cfd7cb03f39a6..f86245951eceb 100644 --- a/tests/providers/mysql/operators/test_mysql.py +++ b/tests/providers/mysql/operators/test_mysql.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file diff --git a/tests/providers/postgres/operators/__init__.py b/tests/providers/postgres/operators/__init__.py index 114d189da14ab..217e5db960782 100644 --- a/tests/providers/postgres/operators/__init__.py +++ b/tests/providers/postgres/operators/__init__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file diff --git a/tests/providers/postgres/operators/test_postgres.py b/tests/providers/postgres/operators/test_postgres.py index 23f5dd8d62b48..f1757363f1872 100644 --- a/tests/providers/postgres/operators/test_postgres.py +++ b/tests/providers/postgres/operators/test_postgres.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file