<commit_before>"""
Aqara Protocol

Provide protocol level support for Aqara, feature including
- Join multicast group
- Receive / Send messages
- Encoding / Decoding messages
- Utility to unicast / broadcast messages
"""

import json
import logging
import socket
import struct

from aqara.const import (MCAST_ADDR, MCAST_PORT, GATEWAY_PORT)

_LOGGER = logging.getLogger(__name__)

class AqaraProtocol(object):
    """Base aqara client protocol."""

    def __init__(self):
        self.transport = None

    def connection_made(self, transport):
        """Implementation when connection is made."""
        self.transport = transport
        self._add_membership()

    def datagram_received(self, data, addr):<commit_msg>added connection_lost implementation in client<commit_after>"""
Aqara Protocol

Provide protocol level support for Aqara, feature including
- Join multicast group
- Receive / Send messages
- Encoding / Decoding messages
- Utility to unicast / broadcast messages
"""

import json
import logging
import socket
import struct

from aqara.const import (MCAST_ADDR, MCAST_PORT, GATEWAY_PORT)

_LOGGER = logging.getLogger(__name__)

class AqaraProtocol(object):
    """Base aqara client protocol."""

    def __init__(self):
        self.transport = None

    def connection_made(self, transport):
        """Implementation when connection is made."""
        self.transport = transport
        self._add_membership()

    def connection_lost(self, err):
        """Implementation when connection is lost."""
        _LOGGER.warn("Disconnected")

    def datagram_received(self, data, addr):
{'fraction_non_alphanumeric': 0.08711885500933417, 'fraction_numerical': 0.0, 'mean_word_length': 3.8875379939209727, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '4777510', 'n_tokens_mistral': 452, 'n_tokens_neox': 441, 'n_words': 144}