# Path: xpaw/eventbus.py
# class EventBus:
#     def __init__(self):
#         self._refs = {}
# 
#     def subscribe(self, receiver, event):
#         if event not in self._refs:
#             self._refs[event] = {}
#         if not hasattr(receiver, '__func__') or not hasattr(receiver, '__self__'):
#             raise ValueError("Failed to subscribe, {} has no attribute '__func__' or '__self__'".format(receiver))
#         i = self._calc_id(receiver)
#         if i in self._refs[event]:
#             f = self._refs[event][i]()
#             if f is not None:
#                 return
#         self._refs[event][i] = weakref.WeakMethod(receiver)
# 
#     def unsubscribe(self, receiver, event):
#         if event in self._refs:
#             i = self._calc_id(receiver)
#             if i in self._refs[event]:
#                 del self._refs[event][i]
# 
#     async def send(self, event, **kwargs):
#         if event not in self._refs:
#             return
#         del_list = []
#         for i in self._refs[event]:
#             f = self._refs[event][i]()
#             if f is None:
#                 del_list.append(i)
#             else:
#                 try:
#                     res = f(**kwargs)
#                     if inspect.iscoroutine(res):
#                         await res
#                 except CancelledError:
#                     raise
#                 except Exception:
#                     log.warning("Failed to send the event", exc_info=True)
#         for i in del_list:
#             del self._refs[event][i]
#         del del_list
# 
#     def _calc_id(self, receiver):
#         return hash((id(receiver.__func__), id(receiver.__self__)))


import pytest
from xpaw.eventbus import EventBus
        """
        method
        """

    @staticmethod
    def staticmethod():
        """
        static method
        """

    def method1(self):
        self.count1 += 1

    @pytest.mark.asyncio
    async def method2(self):
        self.count2 += 1

    def method_set_value(self, value):
        self.value = value

    def method_raise_error(self):
        raise RuntimeError('not an error actually')


def test_raise_value_error():
    def func():
        """
        function
        """


# Path: xpaw/eventbus.py
# class EventBus:
#     def __init__(self):
#         self._refs = {}
# 
#     def subscribe(self, receiver, event):
#         if event not in self._refs:
#             self._refs[event] = {}
#         if not hasattr(receiver, '__func__') or not hasattr(receiver, '__self__'):
#             raise ValueError("Failed to subscribe, {} has no attribute '__func__' or '__self__'".format(receiver))
#         i = self._calc_id(receiver)
#         if i in self._refs[event]:
#             f = self._refs[event][i]()
#             if f is not None:
#                 return
#         self._refs[event][i] = weakref.WeakMethod(receiver)
# 
#     def unsubscribe(self, receiver, event):
#         if event in self._refs:
#             i = self._calc_id(receiver)
#             if i in self._refs[event]:
#                 del self._refs[event][i]
# 
#     async def send(self, event, **kwargs):
#         if event not in self._refs:
#             return
#         del_list = []
#         for i in self._refs[event]:
#             f = self._refs[event][i]()
#             if f is None:
#                 del_list.append(i)
#             else:
#                 try:
#                     res = f(**kwargs)
#                     if inspect.iscoroutine(res):
#                         await res
#                 except CancelledError:
#                     raise
#                 except Exception:
#                     log.warning("Failed to send the event", exc_info=True)
#         for i in del_list:
#             del self._refs[event][i]
#         del del_list
# 
#     def _calc_id(self, receiver):
#         return hash((id(receiver.__func__), id(receiver.__self__)))


# Path: tests/test_eventbus.py
import pytest
from xpaw.eventbus import EventBus

        """
        method
        """

    @staticmethod
    def staticmethod():
        """
        static method
        """

    def method1(self):
        self.count1 += 1

    @pytest.mark.asyncio
    async def method2(self):
        self.count2 += 1

    def method_set_value(self, value):
        self.value = value

    def method_raise_error(self):
        raise RuntimeError('not an error actually')


def test_raise_value_error():
    def func():
        """
        function
        """


    eventbus = EventBus()