This is an automated email from the ASF dual-hosted git repository.
potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new bfdeb270c7 Fix microsoft conftest mypy errors (#39821)
bfdeb270c7 is described below
commit bfdeb270c7773a057da19178cc4dbd4d4cffb46e
Author: Jarek Potiuk <[email protected]>
AuthorDate: Fri May 24 21:30:11 2024 +0200
Fix microsoft conftest mypy errors (#39821)
Detected as part of #39815
---
tests/providers/microsoft/conftest.py | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/tests/providers/microsoft/conftest.py
b/tests/providers/microsoft/conftest.py
index aa3c48c5d7..b2db8c44ba 100644
--- a/tests/providers/microsoft/conftest.py
+++ b/tests/providers/microsoft/conftest.py
@@ -116,7 +116,7 @@ def mock_context(task) -> Context:
from airflow.utils.state import TaskInstanceState
from airflow.utils.xcom import XCOM_RETURN_KEY
- values = {}
+ values: dict[str, Any] = {}
class MockedTaskInstance(TaskInstance):
def __init__(
@@ -130,7 +130,7 @@ def mock_context(task) -> Context:
super().__init__(
task=task, execution_date=execution_date, run_id=run_id,
state=state, map_index=map_index
)
- self.values = {}
+ self.values: dict[str, Any] = {}
def xcom_pull(
self,
@@ -156,16 +156,17 @@ def mock_context(task) -> Context:
values["ti"] = MockedTaskInstance(task=task)
- return Context(values)
+ # See https://github.com/python/mypy/issues/8890 - mypy does not support
passing typed dict to TypedDict
+ return Context(values) # type: ignore[misc]
-def load_json(*locations: Iterable[str]):
- with open(join(dirname(__file__), "azure", join(*locations)),
encoding="utf-8") as file:
+def load_json(*args: str):
+ with open(join(dirname(__file__), "azure", join(*args)), encoding="utf-8")
as file:
return json.load(file)
-def load_file(*locations: Iterable[str], mode="r", encoding="utf-8"):
- with open(join(dirname(__file__), "azure", join(*locations)), mode=mode,
encoding=encoding) as file:
+def load_file(*args: str, mode="r", encoding="utf-8"):
+ with open(join(dirname(__file__), "azure", join(*args)), mode=mode,
encoding=encoding) as file:
return file.read()
@@ -174,7 +175,7 @@ def get_airflow_connection(
login: str = "client_id",
password: str = "client_secret",
tenant_id: str = "tenant-id",
- proxies: (dict, None) = None,
+ proxies: dict | None = None,
api_version: APIVersion = APIVersion.v1,
):
from airflow.models import Connection
@@ -184,7 +185,7 @@ def get_airflow_connection(
conn_id=conn_id,
conn_type="http",
host="graph.microsoft.com",
- port="80",
+ port=80,
login=login,
password=password,
extra={"tenant_id": tenant_id, "api_version": api_version.value,
"proxies": proxies or {}},