# Path: pq/decorators.py
# class job(object):
# 
#     def __init__(self, queue, connection='default', timeout=None,
#             result_ttl=PQ_DEFAULT_RESULT_TTL):
#         """A decorator that adds a ``delay`` method to the decorated function,
#         which in turn creates a RQ job when called. Accepts a required
#         ``queue`` argument that can be either a ``Queue`` instance or a string
#         denoting the queue name.  For example:
# 
#             @job(queue='default')
#             def simple_add(x, y):
#                 return x + y
# 
#             simple_add.delay(1, 2) # Puts simple_add function into queue
#         """
#         self.queue = queue
#         self.connection = connection
#         self.timeout = timeout
#         self.result_ttl = result_ttl
# 
#     def __call__(self, f):
#         @wraps(f)
#         def delay(*args, **kwargs):
#             if isinstance(self.queue, string_types):
#                 queue = Queue.create(name=self.queue, connection=self.connection)
#             else:
#                 queue = self.queue
#             return queue.enqueue_call(f, args=args, kwargs=kwargs,
#                     timeout=self.timeout, result_ttl=self.result_ttl)
#         f.delay = delay
#         return f


import time
from pq.decorators import job
    """
    return x * y / z


def create_file(path):
    """Creates a file at the given path.  Actually, leaves evidence that the
    job ran."""
    with open(path, 'w') as f:
        f.write('Just a sentinel.')


def create_file_after_timeout(path, timeout):
    time.sleep(timeout)
    create_file(path)


#def access_self():
#    job = get_current_job()
#    return job.id


class Calculator(object):
    """Test instance methods."""
    def __init__(self, denominator):
        self.denominator = denominator

    def calculate(self, x, y):
        return x * y / self.denominator



# Path: pq/decorators.py
# class job(object):
# 
#     def __init__(self, queue, connection='default', timeout=None,
#             result_ttl=PQ_DEFAULT_RESULT_TTL):
#         """A decorator that adds a ``delay`` method to the decorated function,
#         which in turn creates a RQ job when called. Accepts a required
#         ``queue`` argument that can be either a ``Queue`` instance or a string
#         denoting the queue name.  For example:
# 
#             @job(queue='default')
#             def simple_add(x, y):
#                 return x + y
# 
#             simple_add.delay(1, 2) # Puts simple_add function into queue
#         """
#         self.queue = queue
#         self.connection = connection
#         self.timeout = timeout
#         self.result_ttl = result_ttl
# 
#     def __call__(self, f):
#         @wraps(f)
#         def delay(*args, **kwargs):
#             if isinstance(self.queue, string_types):
#                 queue = Queue.create(name=self.queue, connection=self.connection)
#             else:
#                 queue = self.queue
#             return queue.enqueue_call(f, args=args, kwargs=kwargs,
#                     timeout=self.timeout, result_ttl=self.result_ttl)
#         f.delay = delay
#         return f


# Path: test_pq/fixtures.py
import time
from pq.decorators import job

    """
    return x * y / z


def create_file(path):
    """Creates a file at the given path.  Actually, leaves evidence that the
    job ran."""
    with open(path, 'w') as f:
        f.write('Just a sentinel.')


def create_file_after_timeout(path, timeout):
    time.sleep(timeout)
    create_file(path)


#def access_self():
#    job = get_current_job()
#    return job.id


class Calculator(object):
    """Test instance methods."""
    def __init__(self, denominator):
        self.denominator = denominator

    def calculate(self, x, y):
        return x * y / self.denominator



@job(queue='default')