def _defservice(name, methods): hval = utils.hash(name.encode('ascii')) assert hval not in _hash_to_service attr = [] id_to_method = [] for m_name, m_id, req, resp in methods: m = ServiceMethod(m_id, m_name, req, resp) attr.append((m_name, m)) id_to_method.append((m_id, m)) attr.append(('methods', dict(id_to_method))) attr.append(('_hash_value_', hval)) attr.append(('name', name)) attr.append(('id', len(_hash_to_service) + 1)) t = type(name.split('.')[-1]+'Service', (), dict(attr)) _hash_to_service[hval] = t return t
def _defservice(name, methods): hval = utils.hash(name.encode('ascii')) assert hval not in _hash_to_service attr = [] id_to_method = [] for m_name, m_id, req, resp in methods: m = ServiceMethod(m_id, m_name, req, resp) attr.append((m_name, m)) id_to_method.append((m_id, m)) attr.append(('methods', dict(id_to_method))) attr.append(('_hash_value_', hval)) attr.append(('name', name)) attr.append(('id', len(_hash_to_service) + 1)) t = type(name.split('.')[-1] + 'Service', (), dict(attr)) _hash_to_service[hval] = t return t
def _defservice(name, methods): hval = utils.hash(name.encode("ascii")) assert hval not in _hash_to_service attr = [] id_to_method = [] for m_name, m_id, req, resp in methods: m = ServiceMethod(m_id, m_name, req, resp) attr.append((m_name, m)) id_to_method.append((m_id, m)) attr.append(("methods", dict(id_to_method))) attr.append(("_hash_value_", hval)) attr.append(("name", name)) attr.append(("id", len(_hash_to_service) + 1)) t = type(name.split(".")[-1] + "Service", (), dict(attr)) _hash_to_service[hval] = t return t
def __init__(self, name): self.name = name self.hval = utils.hash(name.encode('ascii')) self._id_to_method = {} self._method_by_name = {}