uranusjr commented on code in PR #28569:
URL: https://github.com/apache/airflow/pull/28569#discussion_r1060301335


##########
airflow/providers/slack/notifications/slack_notifier.py:
##########
@@ -0,0 +1,89 @@
+# 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.
+
+from __future__ import annotations
+
+import json
+
+from airflow.compat.functools import cached_property
+from airflow.exceptions import AirflowOptionalProviderFeatureException
+
+try:
+    from airflow.notifications.basenotifier import BaseNotifier
+except ImportError:
+    raise AirflowOptionalProviderFeatureException(
+        "Failed to import BaseNotifier. This feature is only available in 
Airflow versions >= 2.6.0"
+    )
+
+from airflow.providers.slack.hooks.slack import SlackHook
+
+
+class SlackNotifier(BaseNotifier):
+    """
+    Slack BaseNotifier
+
+    :param slack_conn_id: Slack API token (https://api.slack.com/web).
+    :param text: The content of the message
+    :param channel: The channel to send the message to. Optional
+    :param username: The username to send the message as. Optional
+    :param icon_url: The icon to use for the message. Optional
+    :param attachments: A list of attachments to send with the message. 
Optional
+    :param blocks: A list of blocks to send with the message. Optional
+    """
+
+    template_fields = ("text", "channel", "username", "attachments", "blocks")
+
+    def __init__(
+        self,
+        *,
+        slack_conn_id: str = "slack_api_default",
+        text: str = "This is a default message",
+        channel: str = "#general",
+        username: str = "Airflow",
+        icon_url: str = "https://raw.githubusercontent.com/apache/";
+        "airflow/main/airflow/www/static/pin_100.png",
+        attachments: list | None = None,

Review Comment:
   Instead of `list | None = None`, we can use `Sequence = ()`, which allows 
use to eliminate the awkward `or []` below. We’re not going to support 
modifying these values dynamically anyway.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to