# Path: xudd/tools.py
# def split_id(actor_id):
#     """
#     Split an actor id into ("actor-id", "hive-id")
# 
#     If no hive-id, it will be None.
#     """
#     components = actor_id.split(u"@", 1)
#     if len(components) == 1:
#         components.append(None)
# 
#     return components


import asyncio
import logging
from types import GeneratorType
from functools import wraps
from xudd.tools import split_id

def autoreply(func):
    """
    Automatically reply to a message if not handled in a handle_message
    method.  Replies in the most minimal way possible.
    """
    @wraps(func)
    def wrapper(self, message):
        result = func(self, message)

        if message.needs_reply():
            message.reply()

        return result

    return wrapper


####################
# Main actor classes
####################


class Actor(object):
    """
    Basic XUDD actor.
    """
    def __init__(self, hive, id):
        self.hive = hive
        self.id = id

# Path: xudd/tools.py
# def split_id(actor_id):
#     """
#     Split an actor id into ("actor-id", "hive-id")
# 
#     If no hive-id, it will be None.
#     """
#     components = actor_id.split(u"@", 1)
#     if len(components) == 1:
#         components.append(None)
# 
#     return components


# Path: xudd/actor.py
import asyncio
import logging
from types import GeneratorType
from functools import wraps
from xudd.tools import split_id


def autoreply(func):
    """
    Automatically reply to a message if not handled in a handle_message
    method.  Replies in the most minimal way possible.
    """
    @wraps(func)
    def wrapper(self, message):
        result = func(self, message)

        if message.needs_reply():
            message.reply()

        return result

    return wrapper


####################
# Main actor classes
####################


class Actor(object):
    """
    Basic XUDD actor.
    """
    def __init__(self, hive, id):
        self.hive = hive
        self.id = id

        self.local_id = split_id(id)[0]