# Path: nbxmpp/const.py
# class TCPState(Enum):
#     DISCONNECTED = 'disconnected'
#     DISCONNECTING = 'disconnecting'
#     CONNECTING = 'connecting'
#     CONNECTED = 'connected'
# 
# Path: nbxmpp/util.py
# class Observable:
#     def __init__(self, log_: logging.Logger):
#         self._log = log_
#         self._frozen = False
#         self._callbacks: defaultdict[str, list[Callable[..., Any]]] = defaultdict(list)
# 
#     def remove_subscriptions(self):
#         self._callbacks = defaultdict(list)
# 
#     def subscribe(self, signal_name: str, func: Callable[..., Any]):
#         self._callbacks[signal_name].append(func)
# 
#     def notify(self, signal_name: str, *args: Any, **kwargs: dict[str, Any]):
#         if self._frozen:
#             self._frozen = False
#             return
# 
#         self._log.info('Signal: %s', signal_name)
#         callbacks = self._callbacks.get(signal_name, [])
#         for func in callbacks:
#             func(self, signal_name, *args, **kwargs)
# 
# Path: nbxmpp/util.py
# class LogAdapter(LoggerAdapter):
# 
#     def set_context(self, context):
#         self.extra['context'] = context
# 
#     def process(self, msg, kwargs):
#         return '(%s) %s' % (self.extra['context'], msg), kwargs


import logging
from gi.repository import Gio
from nbxmpp.const import TCPState
from nbxmpp.util import Observable
from nbxmpp.util import LogAdapter




log = logging.getLogger('nbxmpp.connection')


class Connection(Observable):
    '''
    Base Connection Class

    Signals:

        data-sent
        data-received
        bad-certificate
        certificate-set
        connection-failed
        disconnected
    '''
    def __init__(self,
                 log_context,
                 address,
                 accepted_certificates,
                 ignore_tls_errors,
                 ignored_tls_errors,
                 client_cert):

        self._log = LogAdapter(log, {'context': log_context})


# Path: nbxmpp/const.py
# class TCPState(Enum):
#     DISCONNECTED = 'disconnected'
#     DISCONNECTING = 'disconnecting'
#     CONNECTING = 'connecting'
#     CONNECTED = 'connected'
# 
# Path: nbxmpp/util.py
# class Observable:
#     def __init__(self, log_: logging.Logger):
#         self._log = log_
#         self._frozen = False
#         self._callbacks: defaultdict[str, list[Callable[..., Any]]] = defaultdict(list)
# 
#     def remove_subscriptions(self):
#         self._callbacks = defaultdict(list)
# 
#     def subscribe(self, signal_name: str, func: Callable[..., Any]):
#         self._callbacks[signal_name].append(func)
# 
#     def notify(self, signal_name: str, *args: Any, **kwargs: dict[str, Any]):
#         if self._frozen:
#             self._frozen = False
#             return
# 
#         self._log.info('Signal: %s', signal_name)
#         callbacks = self._callbacks.get(signal_name, [])
#         for func in callbacks:
#             func(self, signal_name, *args, **kwargs)
# 
# Path: nbxmpp/util.py
# class LogAdapter(LoggerAdapter):
# 
#     def set_context(self, context):
#         self.extra['context'] = context
# 
#     def process(self, msg, kwargs):
#         return '(%s) %s' % (self.extra['context'], msg), kwargs


# Path: nbxmpp/connection.py
import logging
from gi.repository import Gio
from nbxmpp.const import TCPState
from nbxmpp.util import Observable
from nbxmpp.util import LogAdapter





log = logging.getLogger('nbxmpp.connection')


class Connection(Observable):
    '''
    Base Connection Class

    Signals:

        data-sent
        data-received
        bad-certificate
        certificate-set
        connection-failed
        disconnected
    '''
    def __init__(self,
                 log_context,
                 address,
                 accepted_certificates,
                 ignore_tls_errors,
                 ignored_tls_errors,
                 client_cert):

        self._log = LogAdapter(log, {'context': log_context})


        Observable.__init__(self, self._log)