diff --git a/providers/opensearch/src/airflow/providers/opensearch/log/os_task_handler.py b/providers/opensearch/src/airflow/providers/opensearch/log/os_task_handler.py index 0b4ffc8680a87..4d567ab3340aa 100644 --- a/providers/opensearch/src/airflow/providers/opensearch/log/os_task_handler.py +++ b/providers/opensearch/src/airflow/providers/opensearch/log/os_task_handler.py @@ -52,7 +52,7 @@ OsLogMsgType = list[StructuredLogMessage] | str else: - OsLogMsgType = list[tuple[str, str]] # type: ignore[assignment,no-redef,misc] + OsLogMsgType = list[tuple[str, str]] # type: ignore[assignment,misc] USE_PER_RUN_LOG_ID = hasattr(DagRun, "get_log_template") @@ -186,7 +186,7 @@ def __init__( ) # client = OpenSearch(hosts=[{"host": host, "port": port}], http_auth=(username, password), use_ssl=True, verify_certs=True, ca_cert="/opt/airflow/root-ca.pem", ssl_assert_hostname = False, ssl_show_warn = False) self.formatter: logging.Formatter - self.handler: logging.FileHandler | logging.StreamHandler # type: ignore[assignment] + self.handler: logging.FileHandler | logging.StreamHandler self._doc_type_map: dict[Any, Any] = {} self._doc_type: list[Any] = [] @@ -255,7 +255,7 @@ def close(self) -> None: # Reopen the file stream, because FileHandler.close() would be called # first in logging.shutdown() and the stream in it would be set to None. - if self.handler.stream is None or self.handler.stream.closed: # type: ignore[attr-defined] + if self.handler.stream is None or self.handler.stream.closed: self.handler.stream = self.handler._open() # type: ignore[union-attr] # Mark the end of file using end of log mark, @@ -304,7 +304,7 @@ def _render_log_id(self, ti: TaskInstance | TaskInstanceKey, try_number: int) -> if TYPE_CHECKING: assert dag is not None # TODO: Task-SDK: Where should this function be? - data_interval = dag.get_run_data_interval(dag_run) # type: ignore[attr-defined,union-attr] + data_interval = dag.get_run_data_interval(dag_run) # type: ignore[attr-defined] if self.json_format: data_interval_start = self._clean_date(data_interval[0]) @@ -452,7 +452,7 @@ def _os_read(self, log_id: str, offset: int | str, ti: TaskInstance) -> Opensear } index_patterns = self._get_index_patterns(ti) try: - max_log_line = self.client.count(index=index_patterns, body=query)["count"] # type: ignore + max_log_line = self.client.count(index=index_patterns, body=query)["count"] except NotFoundError as e: self.log.exception("The target index pattern %s does not exist", index_patterns) raise e diff --git a/providers/opensearch/tests/unit/opensearch/operators/test_opensearch.py b/providers/opensearch/tests/unit/opensearch/operators/test_opensearch.py index 02eb9c2d68e71..9dc6651319293 100644 --- a/providers/opensearch/tests/unit/opensearch/operators/test_opensearch.py +++ b/providers/opensearch/tests/unit/opensearch/operators/test_opensearch.py @@ -37,7 +37,7 @@ class FakeDocument(Document): # TODO: FIXME - this Fake document has something tricky about typing - title = Text(fields={"raw": Keyword()}) # type: ignore[call-arg] + title = Text(fields={"raw": Keyword()}) author = Text() published = Text()