<commit_before>"""GNTP (aka Growl) notification service."""
import logging
import os

import gntp.errors
import gntp.notifier
import voluptuous as vol

from homeassistant.components.notify import (
    ATTR_TITLE,
    ATTR_TITLE_DEFAULT,
    PLATFORM_SCHEMA,
    BaseNotificationService,
)
from homeassistant.const import CONF_PASSWORD, CONF_PORT
import homeassistant.helpers.config_validation as cv

_LOGGER = logging.getLogger(__name__)

CONF_APP_NAME = "app_name"
CONF_APP_ICON = "app_icon"
CONF_HOSTNAME = "hostname"

DEFAULT_APP_NAME = "HomeAssistant"
DEFAULT_HOST = "localhost"
DEFAULT_PORT = 23053

PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
    {
        vol.Optional(CONF_APP_NAME, default=DEFAULT_APP_NAME): cv.string,
        vol.Optional(CONF_APP_ICON): vol.Url,
        vol.Optional(CONF_HOSTNAME, default=DEFAULT_HOST): cv.string,
        vol.Optional(CONF_PASSWORD): cv.string,
        vol.Optional(CONF_PORT, default=DEFAULT_PORT): cv.port,
    }
)


def get_service(hass, config, discovery_info=None):
    """Get the GNTP notification service."""
    logging.getLogger("gntp").setLevel(logging.ERROR)

    if config.get(CONF_APP_ICON) is None:
        icon_file = os.path.join(
            os.path.dirname(__file__),
            "..",
            "frontend",
            "www_static",
            "icons",
            "favicon-192x192.png",
        )
        with open(icon_file, "rb") as file:
            app_icon = file.read()
    else:
        app_icon = config.get(CONF_APP_ICON)
<commit_msg>Deprecate GNTP (Growl) integration (#49273)<commit_after>"""GNTP (aka Growl) notification service."""
import logging
import os

import gntp.errors
import gntp.notifier
import voluptuous as vol

from homeassistant.components.notify import (
    ATTR_TITLE,
    ATTR_TITLE_DEFAULT,
    PLATFORM_SCHEMA,
    BaseNotificationService,
)
from homeassistant.const import CONF_PASSWORD, CONF_PORT
import homeassistant.helpers.config_validation as cv

_LOGGER = logging.getLogger(__name__)

CONF_APP_NAME = "app_name"
CONF_APP_ICON = "app_icon"
CONF_HOSTNAME = "hostname"

DEFAULT_APP_NAME = "HomeAssistant"
DEFAULT_HOST = "localhost"
DEFAULT_PORT = 23053

PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
    {
        vol.Optional(CONF_APP_NAME, default=DEFAULT_APP_NAME): cv.string,
        vol.Optional(CONF_APP_ICON): vol.Url,
        vol.Optional(CONF_HOSTNAME, default=DEFAULT_HOST): cv.string,
        vol.Optional(CONF_PASSWORD): cv.string,
        vol.Optional(CONF_PORT, default=DEFAULT_PORT): cv.port,
    }
)


def get_service(hass, config, discovery_info=None):
    """Get the GNTP notification service."""
    _LOGGER.warning(
        "The GNTP (Growl) integration has been deprecated and is going to be "
        "removed in Home Assistant Core 2021.6. The Growl project has retired"
    )

    logging.getLogger("gntp").setLevel(logging.ERROR)

    if config.get(CONF_APP_ICON) is None:
        icon_file = os.path.join(
            os.path.dirname(__file__),
            "..",
            "frontend",
            "www_static",
            "icons",
            "favicon-192x192.png",
        )
        with open(icon_file, "rb") as file:
            app_icon = file.read()
    else:
        app_icon = config.get(CONF_APP_ICON)

{'fraction_non_alphanumeric': 0.10240592227020358, 'fraction_numerical': 0.00987045033929673, 'mean_word_length': 3.26149802890933, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7136005', 'n_tokens_mistral': 1104, 'n_tokens_neox': 1070, 'n_words': 214}