blob: 4b91ff2a60d5a3c0c04d6aa64cd31dc9fd276fe7 [file]
from functools import update_wrapper
from .wrap import CanCustomize
class BoundCallable(CanCustomize, object):
def __init__(self, executor, fn):
self.__executor = executor
self.__fn = fn
try:
update_wrapper(self, fn)
except AttributeError:
# Update wrapper if we can, but not fatal if we can't
pass
def __call__(self, *args, **kwargs):
return self.__executor.submit(self.__fn, *args, **kwargs)