{
    "content": [
        {
            "type": "text",
            "text": "# functools (pydoc)\n\n## NAME\n\nfunctools - functools.py - Tools for working with functions and callable objects\n\n## Sections\n\n- **NAME**\n- **MODULE REFERENCE**\n- **CLASSES** (4 subsections)\n- **FUNCTIONS** (8 subsections)\n- **DATA**\n- **FILE**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "functools",
        "section": "",
        "mode": "pydoc",
        "summary": "functools - functools.py - Tools for working with functions and callable objects",
        "synopsis": null,
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "MODULE REFERENCE",
                "lines": 8,
                "subsections": []
            },
            {
                "name": "CLASSES",
                "lines": 6,
                "subsections": [
                    {
                        "name": "class cached_property",
                        "lines": 28
                    },
                    {
                        "name": "class partial",
                        "lines": 53
                    },
                    {
                        "name": "class partialmethod",
                        "lines": 40
                    },
                    {
                        "name": "class singledispatchmethod",
                        "lines": 33
                    }
                ]
            },
            {
                "name": "FUNCTIONS",
                "lines": 1,
                "subsections": [
                    {
                        "name": "cache",
                        "lines": 2
                    },
                    {
                        "name": "cmp_to_key",
                        "lines": 5
                    },
                    {
                        "name": "lru_cache",
                        "lines": 17
                    },
                    {
                        "name": "reduce",
                        "lines": 9
                    },
                    {
                        "name": "singledispatch",
                        "lines": 8
                    },
                    {
                        "name": "total_ordering",
                        "lines": 2
                    },
                    {
                        "name": "update_wrapper",
                        "lines": 11
                    },
                    {
                        "name": "wraps",
                        "lines": 8
                    }
                ]
            },
            {
                "name": "DATA",
                "lines": 4,
                "subsections": []
            },
            {
                "name": "FILE",
                "lines": 3,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "functools - functools.py - Tools for working with functions and callable objects\n",
                "subsections": []
            },
            "MODULE REFERENCE": {
                "content": "https://docs.python.org/3.12/library/functools.html\n\nThe following documentation is automatically generated from the Python\nsource files.  It may be incomplete, incorrect or include features that\nare considered implementation detail and may vary between Python\nimplementations.  When in doubt, consult the module reference at the\nlocation listed above.\n",
                "subsections": []
            },
            "CLASSES": {
                "content": "builtins.object\ncachedproperty\npartial\npartialmethod\nsingledispatchmethod\n",
                "subsections": [
                    {
                        "name": "class cached_property",
                        "content": "|  cachedproperty(func)\n|\n|  Methods defined here:\n|\n|  get(self, instance, owner=None)\n|\n|  init(self, func)\n|      Initialize self.  See help(type(self)) for accurate signature.\n|\n|  setname(self, owner, name)\n|\n|  ----------------------------------------------------------------------\n|  Class methods defined here:\n|\n|  classgetitem = GenericAlias(...)\n|      Represent a PEP 585 generic type\n|\n|      E.g. for t = list[int], t.origin is list and t.args is (int,).\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors defined here:\n|\n|  dict\n|      dictionary for instance variables\n|\n|  weakref\n|      list of weak references to the object\n"
                    },
                    {
                        "name": "class partial",
                        "content": "|  partial(func, *args, keywords) - new function with partial application\n|  of the given arguments and keywords.\n|\n|  Methods defined here:\n|\n|  call(self, /, *args, kwargs)\n|      Call self as a function.\n|\n|  delattr(self, name, /)\n|      Implement delattr(self, name).\n|\n|  getattribute(self, name, /)\n|      Return getattr(self, name).\n|\n|  reduce(...)\n|      Helper for pickle.\n|\n|  repr(self, /)\n|      Return repr(self).\n|\n|  setattr(self, name, value, /)\n|      Implement setattr(self, name, value).\n|\n|  setstate(...)\n|\n|  ----------------------------------------------------------------------\n|  Class methods defined here:\n|\n|  classgetitem(...)\n|      See PEP 585\n|\n|  ----------------------------------------------------------------------\n|  Static methods defined here:\n|\n|  new(*args, kwargs)\n|      Create and return a new object.  See help(type) for accurate signature.\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors defined here:\n|\n|  dict\n|\n|  vectorcalloffset\n|\n|  args\n|      tuple of arguments to future partial calls\n|\n|  func\n|      function object to use in future partial calls\n|\n|  keywords\n|      dictionary of keyword arguments to future partial calls\n"
                    },
                    {
                        "name": "class partialmethod",
                        "content": "|  partialmethod(func, /, *args, keywords)\n|\n|  Method descriptor with partial application of the given arguments\n|  and keywords.\n|\n|  Supports wrapping existing descriptors and handles non-descriptor\n|  callables as instance methods.\n|\n|  Methods defined here:\n|\n|  get(self, obj, cls=None)\n|\n|  init(self, func, /, *args, keywords)\n|      Initialize self.  See help(type(self)) for accurate signature.\n|\n|  repr(self)\n|      Return repr(self).\n|\n|  ----------------------------------------------------------------------\n|  Class methods defined here:\n|\n|  classgetitem = GenericAlias(...)\n|      Represent a PEP 585 generic type\n|\n|      E.g. for t = list[int], t.origin is list and t.args is (int,).\n|\n|  ----------------------------------------------------------------------\n|  Readonly properties defined here:\n|\n|  isabstractmethod\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors defined here:\n|\n|  dict\n|      dictionary for instance variables\n|\n|  weakref\n|      list of weak references to the object\n"
                    },
                    {
                        "name": "class singledispatchmethod",
                        "content": "|  singledispatchmethod(func)\n|\n|  Single-dispatch generic method descriptor.\n|\n|  Supports wrapping existing descriptors and handles non-descriptor\n|  callables as instance methods.\n|\n|  Methods defined here:\n|\n|  get(self, obj, cls=None)\n|\n|  init(self, func)\n|      Initialize self.  See help(type(self)) for accurate signature.\n|\n|  register(self, cls, method=None)\n|      genericmethod.register(cls, func) -> func\n|\n|      Registers a new implementation for the given *cls* on a *genericmethod*.\n|\n|  ----------------------------------------------------------------------\n|  Readonly properties defined here:\n|\n|  isabstractmethod\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors defined here:\n|\n|  dict\n|      dictionary for instance variables\n|\n|  weakref\n|      list of weak references to the object\n"
                    }
                ]
            },
            "FUNCTIONS": {
                "content": "",
                "subsections": [
                    {
                        "name": "cache",
                        "content": "Simple lightweight unbounded cache.  Sometimes called \"memoize\".\n"
                    },
                    {
                        "name": "cmp_to_key",
                        "content": "Convert a cmp= function into a key= function.\n\nmycmp\nFunction that compares two objects.\n"
                    },
                    {
                        "name": "lru_cache",
                        "content": "Least-recently-used cache decorator.\n\nIf *maxsize* is set to None, the LRU features are disabled and the cache\ncan grow without bound.\n\nIf *typed* is True, arguments of different types will be cached separately.\nFor example, f(3.0) and f(3) will be treated as distinct calls with\ndistinct results.\n\nArguments to the cached function must be hashable.\n\nView the cache statistics named tuple (hits, misses, maxsize, currsize)\nwith f.cacheinfo().  Clear the cache and statistics with f.cacheclear().\nAccess the underlying function with f.wrapped.\n\nSee:  https://en.wikipedia.org/wiki/Cachereplacementpolicies#Leastrecentlyused(LRU)\n"
                    },
                    {
                        "name": "reduce",
                        "content": "reduce(function, iterable[, initial]) -> value\n\nApply a function of two arguments cumulatively to the items of a sequence\nor iterable, from left to right, so as to reduce the iterable to a single\nvalue.  For example, reduce(lambda x, y: x+y, [1, 2, 3, 4, 5]) calculates\n((((1+2)+3)+4)+5).  If initial is present, it is placed before the items\nof the iterable in the calculation, and serves as a default when the\niterable is empty.\n"
                    },
                    {
                        "name": "singledispatch",
                        "content": "Single-dispatch generic function decorator.\n\nTransforms a function into a generic function, which can have different\nbehaviours depending upon the type of its first argument. The decorated\nfunction acts as the default implementation, and additional\nimplementations can be registered using the register() attribute of the\ngeneric function.\n"
                    },
                    {
                        "name": "total_ordering",
                        "content": "Class decorator that fills in missing ordering methods\n"
                    },
                    {
                        "name": "update_wrapper",
                        "content": "Update a wrapper function to look like the wrapped function\n\nwrapper is the function to be updated\nwrapped is the original function\nassigned is a tuple naming the attributes assigned directly\nfrom the wrapped function to the wrapper function (defaults to\nfunctools.WRAPPERASSIGNMENTS)\nupdated is a tuple naming the attributes of the wrapper that\nare updated with the corresponding attribute from the wrapped\nfunction (defaults to functools.WRAPPERUPDATES)\n"
                    },
                    {
                        "name": "wraps",
                        "content": "Decorator factory to apply updatewrapper() to a wrapper function\n\nReturns a decorator that invokes updatewrapper() with the decorated\nfunction as the wrapper argument and the arguments to wraps() as the\nremaining arguments. Default arguments are as for updatewrapper().\nThis is a convenience function to simplify applying partial() to\nupdatewrapper().\n"
                    }
                ]
            },
            "DATA": {
                "content": "WRAPPERASSIGNMENTS = ('module', 'name', 'qualname', 'do...\nWRAPPERUPDATES = ('dict',)\nall = ['updatewrapper', 'wraps', 'WRAPPERASSIGNMENTS', 'WRAPPER...\n",
                "subsections": []
            },
            "FILE": {
                "content": "/usr/lib/python3.12/functools.py\n\n",
                "subsections": []
            }
        }
    }
}