Provides detailed info about function/method calls.

I provide text (picklable) info about a call. Construct me with a function object and any args and keywords if you want the info to include that particular function call, or you can set it (and change it) later with setCall.

Method __init__ Info(remember=False, whichThread=False)
Method setCall Sets my current f-args-kw tuple, returning a reference to myself to allow easy method chaining.
Method ID Returns a unique ID for my current callable.
Method forgetID Use this whenever info won't be needed anymore for the specified call ID, to avoid memory leaks.
Method context Context manager for setting and getting call info.
Method getInfo Provides info about a call.
Method saveInfo Undocumented
Method nn Namespace-name parser.
Method aboutCall Returns an informative string describing my current function call or a previous one identified by ID.
Method aboutException Returns an informative string describing an exception raised from my function call or a previous one identified by ID, or one you supply (as an instance, not a class).
Method aboutFailure Returns an informative string describing a Twisted failure raised from my function call or a previous one identified by ID. You can use this as an errback.
Method _divider Undocumented
Method _formatList Undocumented
Method _funcText Undocumented
def __init__(self, remember=False, whichThread=False):

Info(remember=False, whichThread=False)

def setCall(self, *metaArgs, **kw):

Sets my current f-args-kw tuple, returning a reference to myself to allow easy method chaining.

The function f must be an actual callable object if you want to use nn. Otherwise it can also be a string depicting a callable.

You can specify args with a second argument (as a list or tuple), and kw with a third argument (as a dict). If you are only specifying a single arg, you can just provide it as your second argument to this method call without wrapping it in a list or tuple. I try to be flexible.

If you've set a function name and want to add a sequence of args or a dict of keywords, you can do it by supplying the args or kw keywords. You can also set a class instance at that time with the instance keyword.

To sum up, here are the numbers of arguments you can provide:

  1. A single argument with a callable object or string depicting a callable.
  2. Two arguments: the callable f plus a single argument or list of arguments to f.
  3. Three arguments: f, args, and a dict of keywords for the callable.
ParametersmetaArgs1-3 arguments as specified above.
argsA sequence of arguments for the callable f or one previously set.
kwA dict of keywords for the callable f or one previously set.
instanceAn instance of a class of which the callable f is a method.
@property
def ID(self):

Returns a unique ID for my current callable.

def forgetID(self, ID):

Use this whenever info won't be needed anymore for the specified call ID, to avoid memory leaks.

@contextmanager
def context(self, *metaArgs, **kw):

Context manager for setting and getting call info.

Call this context manager method with info about a particular call (same format as setCall uses) and it yields an InfoHolder object keyed to that call. It lets you get info about the call inside the context, without worrying about the ID or calling forgetID, even after I have been used for other calls outside the context.

def getInfo(self, ID, name, nowForget=False):

Provides info about a call.

If the supplied name is 'callDict', returns the f-args-kw-instance dict for my current callable. The value of ID is ignored in such case. Otherwise, returns the named information attribute for the previous call identified with the supplied ID.

ParametersIDID of a previous call, ignored if name is 'callDict'
nameThe name of the particular type of info requested. (type: str)
nowForgetSet True to remove any reference to this ID or callDict after the info is obtained.
def saveInfo(self, name, x, ID=None):
Undocumented
def nn(self, ID=None, raw=False):

Namespace-name parser.

For my current callable or a previous one identified by ID, returns a 2-tuple suitable for sending to a process worker via pickle.

The first element: If the callable is a method, a pickled or fully qualified name (FQN) version of its parent object. This is None if the callable is a standalone function.

The second element: If the callable is a method, the callable's name as an attribute of the parent object. If it's a standalone function, the pickled or FQN version. If nothing works, this element will be None along with the first one.

ParametersIDPrevious callable (type: int)
rawSet True to return the raw parent (or function) object instead of a pickle or FQN. All the type checking and round-trip testing still will be done.
def aboutCall(self, ID=None, nowForget=False):

Returns an informative string describing my current function call or a previous one identified by ID.

def aboutException(self, ID=None, exception=None, nowForget=False):

Returns an informative string describing an exception raised from my function call or a previous one identified by ID, or one you supply (as an instance, not a class).

def aboutFailure(self, failureObj, ID=None, nowForget=False):

Returns an informative string describing a Twisted failure raised from my function call or a previous one identified by ID. You can use this as an errback.

def _divider(self, lineList):
Undocumented
def _formatList(self, lineList):
Undocumented
def _funcText(self, func):
Undocumented
API Documentation for AsynQueue, generated by pydoctor at 2022-11-17 13:13:24.