# Path: zorro/util.py
# class priorityqueue(object):
# 
#     def __init__(self):
#         self.heap = []
#         self.counter = 0
# 
#     def add(self, pri, task):
#         self.counter += 1
#         item = [pri, self.counter, task]
#         heappush(self.heap, item)
#         def remover(*a):
#             item[2] = None
#         return remover
# 
#     def min(self):
#         while self.heap and self.heap[0][2] is None:
#             heappop(self.heap)
#         if self.heap:
#             return self.heap[0][0]
#         return None
# 
#     def pop(self, value):
#         val = self.min()
#         if val is not None and val <= value:
#             return self.heap[0][2]
#         return None
# 
#     def __bool__(self):
#         return bool(self.heap)
# 
# class orderedset(object):
# 
#     def __init__(self):
#         self.deque = deque()
# 
#     def add(self, *val):
#         self.deque.append(val)
#         def remover(*a):
#             self.deque.remove(val)
#         return remover
# 
#     def update(self, value):
#         self.deque.extend(value)
# 
#     def first(self):
#         if self.deque:
#             return self.deque[0]
#         return None
# 
#     def remove(self, value):
#         self.deque.remove(value)
# 
#     def __bool__(self):
#         return bool(self.deque)
# 
# def socket_pair():
#     a, b = socketpair()
#     a.setblocking(0)
#     b.setblocking(0)
#     return a, b
# 
# class marker_object(object):
#     __slots__ = ('name',)
# 
#     def __init__(self, name):
#         self.name = name
# 
#     def __repr__(self):
#         return '<{}>'.format(self.name)


import heapq
import time
import threading
import select
import weakref
import logging
import errno
import greenlet
from collections import deque, defaultdict
from functools import partial
from operator import methodcaller
from math import ceil
from .util import priorityqueue, orderedset, socket_pair, marker_object



__all__ = [
    'Zorrolet',
    'Hub',
    'gethub',
    'Future',
    'Condition',
    'Lock',
    ]


# Path: zorro/util.py
# class priorityqueue(object):
# 
#     def __init__(self):
#         self.heap = []
#         self.counter = 0
# 
#     def add(self, pri, task):
#         self.counter += 1
#         item = [pri, self.counter, task]
#         heappush(self.heap, item)
#         def remover(*a):
#             item[2] = None
#         return remover
# 
#     def min(self):
#         while self.heap and self.heap[0][2] is None:
#             heappop(self.heap)
#         if self.heap:
#             return self.heap[0][0]
#         return None
# 
#     def pop(self, value):
#         val = self.min()
#         if val is not None and val <= value:
#             return self.heap[0][2]
#         return None
# 
#     def __bool__(self):
#         return bool(self.heap)
# 
# class orderedset(object):
# 
#     def __init__(self):
#         self.deque = deque()
# 
#     def add(self, *val):
#         self.deque.append(val)
#         def remover(*a):
#             self.deque.remove(val)
#         return remover
# 
#     def update(self, value):
#         self.deque.extend(value)
# 
#     def first(self):
#         if self.deque:
#             return self.deque[0]
#         return None
# 
#     def remove(self, value):
#         self.deque.remove(value)
# 
#     def __bool__(self):
#         return bool(self.deque)
# 
# def socket_pair():
#     a, b = socketpair()
#     a.setblocking(0)
#     b.setblocking(0)
#     return a, b
# 
# class marker_object(object):
#     __slots__ = ('name',)
# 
#     def __init__(self, name):
#         self.name = name
# 
#     def __repr__(self):
#         return '<{}>'.format(self.name)


# Path: zorro/core.py
import heapq
import time
import threading
import select
import weakref
import logging
import errno
import greenlet
from collections import deque, defaultdict
from functools import partial
from operator import methodcaller
from math import ceil
from .util import priorityqueue, orderedset, socket_pair, marker_object




__all__ = [
    'Zorrolet',
    'Hub',
    'gethub',
    'Future',
    'Condition',
    'Lock',
    ]


FUTURE_EXCEPTION = marker_object('FUTURE_EXCEPTION')