Skip to content

Commit

Permalink
[AIRFLOW-5251] add missing typing-extensions dep for py37
Browse files Browse the repository at this point in the history
  • Loading branch information
Qingping Hou committed Aug 21, 2019
1 parent cd4ab7b commit ff3f502
Show file tree
Hide file tree
Showing 11 changed files with 40 additions and 10 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ jobs:
env: BACKEND=sqlite ENV=docker
python: "3.5"
stage: test
- name: "Tests mysql python 3.6"
- name: "Tests mysql python 3.7"
env: BACKEND=mysql ENV=docker
python: "3.6"
python: "3.7"
stage: test
- name: "Tests postgres kubernetes python 3.6 (persistent)"
env: BACKEND=postgres ENV=kubernetes KUBERNETES_VERSION=v1.13.0 KUBERNETES_MODE=persistent_mode
Expand Down
2 changes: 1 addition & 1 deletion airflow/api/auth/backend/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"""Default authentication backend - everything is allowed"""
from typing import Optional
from functools import wraps
from typing_extensions import Protocol
from airflow.typing import Protocol


class ClientAuthProtocol(Protocol):
Expand Down
2 changes: 1 addition & 1 deletion airflow/contrib/operators/awsbatch_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# under the License.
#
from typing import Optional
from typing_extensions import Protocol
from airflow.typing import Protocol
import sys

from math import pow
Expand Down
2 changes: 1 addition & 1 deletion airflow/contrib/operators/ecs_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# specific language governing permissions and limitations
# under the License.
from typing import Optional
from typing_extensions import Protocol
from airflow.typing import Protocol
import sys
import re

Expand Down
2 changes: 1 addition & 1 deletion airflow/hooks/dbapi_hook.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# under the License.

from typing import Optional
from typing_extensions import Protocol
from airflow.typing import Protocol
from datetime import datetime
from contextlib import closing

Expand Down
2 changes: 1 addition & 1 deletion airflow/models/crypto.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# specific language governing permissions and limitations
# under the License.

from typing_extensions import Protocol
from airflow.typing import Protocol
from typing import Optional
from airflow import configuration
from airflow.exceptions import AirflowException
Expand Down
30 changes: 30 additions & 0 deletions airflow/typing.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

"""
This module provides helper code to make type annotation within Airflow
codebase easier.
"""

try:
# Protocol is only added to typing module starting from python 3.8
# we can safely remove this shim import after Airflow drops support for
# <3.8
from typing import Protocol # noqa # pylint: disable=unused-import
except ImportError:
from typing_extensions import Protocol # type: ignore # noqa
1 change: 0 additions & 1 deletion airflow/utils/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

import errno

import psutil
Expand Down
1 change: 1 addition & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@
'_api/airflow/index.rst',
'_api/airflow/jobs',
'_api/airflow/lineage',
'_api/airflow/typing',
'_api/airflow/logging_config',
'_api/airflow/macros',
'_api/airflow/migrations',
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ def do_setup():
'tzlocal>=1.4,<2.0.0',
'unicodecsv>=0.14.1',
'zope.deprecation>=4.0, <5.0',
'typing-extensions>=3.7.4;python_version<"3.7"',
'typing-extensions>=3.7.4;python_version<"3.8"',
],
setup_requires=[
'docutils>=0.14, <1.0',
Expand Down
2 changes: 1 addition & 1 deletion tests/gcp/hooks/test_cloud_storage_transfer_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ def test_wait_for_transfer_job(self, get_conn, mock_sleep):
{FILTER_PROJECT_ID: TEST_PROJECT_ID, FILTER_JOB_NAMES: ["transferJobs/test-job"]},
)

mock_sleep.assert_called_once_with(TIME_TO_SLEEP_IN_SECONDS)
mock_sleep.assert_called_with(TIME_TO_SLEEP_IN_SECONDS)

@mock.patch('time.sleep')
@mock.patch('airflow.gcp.hooks.cloud_storage_transfer_service.GCPTransferServiceHook.get_conn')
Expand Down

0 comments on commit ff3f502

Please sign in to comment.