partis.utils.mem module#

obj_referrer_chains(obj, depth=10, fmt=False, width=70, ignore=None, _depth=None, _chain=None)[source]#

Gets all referrer chains to a given object

Parameters:
  • obj (object) –

  • depth (int) – Maximum length of chain to return, starting at object

  • fmt (bool) – Whether to format the results as strings. If False, returns referrer objects.

  • ignore (set<int>) – Objects to ignore, and internal book-keeping of already visited objects. Will be updated in-place with all visited objects.

  • _depth (int) – Internal book-keeping of current depth

  • _chain (list<object>) – Internal book-keeping of current working chain

Returns:

chains (list< list< object > >) – Each list is one possible referrer chain, starting at the given object. Circular references stop before repeating. Once a referrer appears in a chain, it will not be repeated in subsequent chains. Chains terminate at module-level objects.