# SOME DESCRIPTIVE TITLE.
# Copyright (C) 2001 Python Software Foundation
# This file is distributed under the same license as the Python package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
# Translators:
# python-doc bot, 2025
# Hengky Kurniawan, 2025
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: Python 3.15\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-11-11 20:58+0000\n"
"PO-Revision-Date: 2025-09-16 00:01+0000\n"
"Last-Translator: Hengky Kurniawan, 2025\n"
"Language-Team: Indonesian (https://app.transifex.com/python-doc/teams/5390/"
"id/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: id\n"
"Plural-Forms: nplurals=1; plural=0;\n"

msgid ""
":mod:`!functools` --- Higher-order functions and operations on callable "
"objects"
msgstr ""

msgid "**Source code:** :source:`Lib/functools.py`"
msgstr ""

msgid ""
"The :mod:`!functools` module is for higher-order functions: functions that "
"act on or return other functions. In general, any callable object can be "
"treated as a function for the purposes of this module."
msgstr ""

msgid "The :mod:`!functools` module defines the following functions:"
msgstr ""

msgid ""
"Simple lightweight unbounded function cache.  Sometimes called `\"memoize\" "
"<https://en.wikipedia.org/wiki/Memoization>`_."
msgstr ""

msgid ""
"Returns the same as ``lru_cache(maxsize=None)``, creating a thin wrapper "
"around a dictionary lookup for the function arguments.  Because it never "
"needs to evict old values, this is smaller and faster than :deco:`lru_cache` "
"with a size limit."
msgstr ""

msgid "For example::"
msgstr "Sebagai contoh::"

msgid ""
"@cache\n"
"def factorial(n):\n"
"    return n * factorial(n-1) if n else 1\n"
"\n"
">>> factorial(10)   # no previously cached result, makes 11 recursive calls\n"
"3628800\n"
">>> factorial(5)    # no new calls, just returns the cached result\n"
"120\n"
">>> factorial(12)   # two new recursive calls, factorial(10) is cached\n"
"479001600"
msgstr ""

msgid ""
"The cache is threadsafe so that the wrapped function can be used in multiple "
"threads.  This means that the underlying data structure will remain coherent "
"during concurrent updates."
msgstr ""

msgid ""
"It is possible for the wrapped function to be called more than once if "
"another thread makes an additional call before the initial call has been "
"completed and cached."
msgstr ""

msgid ""
"Call-once behavior is not guaranteed because locks are not held during the "
"function call. Potentially another call with the same arguments could occur "
"while the first call is still running."
msgstr ""

msgid ""
"Transform a method of a class into a property whose value is computed once "
"and then cached as a normal attribute for the life of the instance. Similar "
"to :deco:`property`, with the addition of caching. Useful for expensive "
"computed properties of instances that are otherwise effectively immutable."
msgstr ""

msgid "Example::"
msgstr "Contoh::"

msgid ""
"class DataSet:\n"
"\n"
"    def __init__(self, sequence_of_numbers):\n"
"        self._data = tuple(sequence_of_numbers)\n"
"\n"
"    @cached_property\n"
"    def stdev(self):\n"
"        return statistics.stdev(self._data)"
msgstr ""

msgid ""
"The mechanics of :deco:`cached_property` are somewhat different "
"from :deco:`property`.  A regular property blocks attribute writes unless a "
"setter is defined. In contrast, a *cached_property* allows writes."
msgstr ""

msgid ""
"The *cached_property* decorator only runs on lookups and only when an "
"attribute of the same name doesn't exist.  When it does run, the "
"*cached_property* writes to the attribute with the same name. Subsequent "
"attribute reads and writes take precedence over the *cached_property* method "
"and it works like a normal attribute."
msgstr ""

msgid ""
"The cached value can be cleared by deleting the attribute.  This allows the "
"*cached_property* method to run again."
msgstr ""

msgid ""
"The *cached_property* does not prevent a possible race condition in multi-"
"threaded usage. The getter function could run more than once on the same "
"instance, with the latest run setting the cached value. If the cached "
"property is idempotent or otherwise not harmful to run more than once on an "
"instance, this is fine. If synchronization is needed, implement the "
"necessary locking inside the decorated getter function or around the cached "
"property access."
msgstr ""

msgid ""
"Note, this decorator interferes with the operation of :pep:`412` key-sharing "
"dictionaries.  This means that instance dictionaries can take more space "
"than usual."
msgstr ""

msgid ""
"Also, this decorator requires that the ``__dict__`` attribute on each "
"instance be a mutable mapping. This means it will not work with some types, "
"such as metaclasses (since the ``__dict__`` attributes on type instances are "
"read-only proxies for the class namespace), and those that specify "
"``__slots__`` without including ``__dict__`` as one of the defined slots (as "
"such classes don't provide a ``__dict__`` attribute at all)."
msgstr ""

msgid ""
"If a mutable mapping is not available or if space-efficient key sharing is "
"desired, an effect similar to :deco:`cached_property` can also be achieved "
"by stacking :deco:`property` on top of :deco:`lru_cache`. See :ref:`faq-"
"cache-method-calls` for more details on how this differs "
"from :deco:`cached_property`."
msgstr ""

msgid ""
"Prior to Python 3.12, :deco:`!cached_property` included an undocumented lock "
"to ensure that in multi-threaded usage the getter function was guaranteed to "
"run only once per instance. However, the lock was per-property, not per-"
"instance, which could result in unacceptably high lock contention. In Python "
"3.12+ this locking is removed."
msgstr ""

msgid ""
"Transform an old-style comparison function to a :term:`key function`.  Used "
"with tools that accept key functions (such "
"as :func:`sorted`, :func:`min`, :func:`max`, :func:`heapq.nlargest`, :func:`heapq.nsmallest`, :func:`itertools.groupby`).  "
"This function is primarily used as a transition tool for programs being "
"converted from Python 2 which supported the use of comparison functions."
msgstr ""

msgid ""
"A comparison function is any callable that accepts two arguments, compares "
"them, and returns a negative number for less-than, zero for equality, or a "
"positive number for greater-than.  A key function is a callable that accepts "
"one argument and returns another value to be used as the sort key."
msgstr ""

msgid ""
"sorted(iterable, key=cmp_to_key(locale.strcoll))  # locale-aware sort order"
msgstr ""

msgid ""
"For sorting examples and a brief sorting tutorial, see :ref:`sortinghowto`."
msgstr ""
"Untuk contoh pengurutan dan tutorial singkat pengurutan, "
"lihat :ref:`sortinghowto`."

msgid ""
"Decorator to wrap a function with a memoizing callable that saves up to the "
"*maxsize* most recent calls.  It can save time when an expensive or I/O "
"bound function is periodically called with the same arguments."
msgstr ""

msgid ""
"Since a dictionary is used to cache results, the positional and keyword "
"arguments to the function must be :term:`hashable`."
msgstr ""

msgid ""
"Distinct argument patterns may be considered to be distinct calls with "
"separate cache entries.  For example, ``f(a=1, b=2)`` and ``f(b=2, a=1)`` "
"differ in their keyword argument order and may have two separate cache "
"entries."
msgstr ""

msgid ""
"If *user_function* is specified, it must be a callable. This allows the "
"*lru_cache* decorator to be applied directly to a user function, leaving the "
"*maxsize* at its default value of 128::"
msgstr ""

msgid ""
"@lru_cache\n"
"def count_vowels(word):\n"
"    return sum(word.count(vowel) for vowel in 'AEIOUaeiou')"
msgstr ""

msgid ""
"If *maxsize* is set to ``None``, the LRU feature is disabled and the cache "
"can grow without bound."
msgstr ""

msgid ""
"If *typed* is set to true, function arguments of different types will be "
"cached separately.  If *typed* is false, the implementation will usually "
"regard them as equivalent calls and only cache a single result. (Some types "
"such as *str* and *int* may be cached separately even when *typed* is false.)"
msgstr ""

msgid ""
"Note, type specificity applies only to the function's immediate arguments "
"rather than their contents.  The scalar arguments, ``Decimal(42)`` and "
"``Fraction(42)`` are treated as distinct calls with distinct results. In "
"contrast, the tuple arguments ``('answer', Decimal(42))`` and ``('answer', "
"Fraction(42))`` are treated as equivalent."
msgstr ""

msgid ""
"The wrapped function is instrumented with a :func:`!cache_parameters` "
"function that returns a new :class:`dict` showing the values for *maxsize* "
"and *typed*.  This is for information purposes only.  Mutating the values "
"has no effect."
msgstr ""

msgid ""
"To help measure the effectiveness of the cache and tune the *maxsize* "
"parameter, the wrapped function is instrumented with a :func:`!cache_info` "
"function that returns a :term:`named tuple` showing *hits*, *misses*, "
"*maxsize* and *currsize*."
msgstr ""

msgid ""
"The decorator also provides a :func:`!cache_clear` function for clearing or "
"invalidating the cache."
msgstr ""

msgid ""
"The original underlying function is accessible through "
"the :attr:`__wrapped__` attribute.  This is useful for introspection, for "
"bypassing the cache, or for rewrapping the function with a different cache."
msgstr ""

msgid ""
"The cache keeps references to the arguments and return values until they age "
"out of the cache or until the cache is cleared."
msgstr ""

msgid ""
"If a method is cached, the ``self`` instance argument is included in the "
"cache.  See :ref:`faq-cache-method-calls`"
msgstr ""

msgid ""
"An `LRU (least recently used) cache <https://en.wikipedia.org/wiki/"
"Cache_replacement_policies#Least_Recently_Used_(LRU)>`_ works best when the "
"most recent calls are the best predictors of upcoming calls (for example, "
"the most popular articles on a news server tend to change each day).  The "
"cache's size limit assures that the cache does not grow without bound on "
"long-running processes such as web servers."
msgstr ""

msgid ""
"In general, the LRU cache should only be used when you want to reuse "
"previously computed values.  Accordingly, it doesn't make sense to cache "
"functions with side-effects, functions that need to create distinct mutable "
"objects on each call (such as generators and async functions), or impure "
"functions such as time() or random()."
msgstr ""

msgid "Example of an LRU cache for static web content::"
msgstr ""

msgid ""
"@lru_cache(maxsize=32)\n"
"def get_pep(num):\n"
"    'Retrieve text of a Python Enhancement Proposal'\n"
"    resource = f'https://peps.python.org/pep-{num:04d}'\n"
"    try:\n"
"        with urllib.request.urlopen(resource) as s:\n"
"            return s.read()\n"
"    except urllib.error.HTTPError:\n"
"        return 'Not Found'\n"
"\n"
">>> for n in 8, 290, 308, 320, 8, 218, 320, 279, 289, 320, 9991:\n"
"...     pep = get_pep(n)\n"
"...     print(n, len(pep))\n"
"\n"
">>> get_pep.cache_info()\n"
"CacheInfo(hits=3, misses=8, maxsize=32, currsize=8)"
msgstr ""

msgid ""
"Example of efficiently computing `Fibonacci numbers <https://"
"en.wikipedia.org/wiki/Fibonacci_number>`_ using a cache to implement a "
"`dynamic programming <https://en.wikipedia.org/wiki/Dynamic_programming>`_ "
"technique::"
msgstr ""

msgid ""
"@lru_cache(maxsize=None)\n"
"def fib(n):\n"
"    if n < 2:\n"
"        return n\n"
"    return fib(n-1) + fib(n-2)\n"
"\n"
">>> [fib(n) for n in range(16)]\n"
"[0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610]\n"
"\n"
">>> fib.cache_info()\n"
"CacheInfo(hits=28, misses=16, maxsize=None, currsize=16)"
msgstr ""

msgid "Added the *typed* option."
msgstr ""

msgid "Added the *user_function* option."
msgstr ""

msgid "Added the function :func:`!cache_parameters`"
msgstr ""

msgid ""
"Given a class defining one or more rich comparison ordering methods, this "
"class decorator supplies the rest.  This simplifies the effort involved in "
"specifying all of the possible rich comparison operations:"
msgstr ""

msgid ""
"The class must define one "
"of :meth:`~object.__lt__`, :meth:`~object.__le__`, :meth:`~object.__gt__`, "
"or :meth:`~object.__ge__`. In addition, the class should supply "
"an :meth:`~object.__eq__` method."
msgstr ""

msgid ""
"@total_ordering\n"
"class Student:\n"
"    def _is_valid_operand(self, other):\n"
"        return (hasattr(other, \"lastname\") and\n"
"                hasattr(other, \"firstname\"))\n"
"    def __eq__(self, other):\n"
"        if not self._is_valid_operand(other):\n"
"            return NotImplemented\n"
"        return ((self.lastname.lower(), self.firstname.lower()) ==\n"
"                (other.lastname.lower(), other.firstname.lower()))\n"
"    def __lt__(self, other):\n"
"        if not self._is_valid_operand(other):\n"
"            return NotImplemented\n"
"        return ((self.lastname.lower(), self.firstname.lower()) <\n"
"                (other.lastname.lower(), other.firstname.lower()))"
msgstr ""

msgid ""
"While this decorator makes it easy to create well behaved totally ordered "
"types, it *does* come at the cost of slower execution and more complex stack "
"traces for the derived comparison methods. If performance benchmarking "
"indicates this is a bottleneck for a given application, implementing all six "
"rich comparison methods instead is likely to provide an easy speed boost."
msgstr ""

msgid ""
"This decorator makes no attempt to override methods that have been declared "
"in the class *or its superclasses*. Meaning that if a superclass defines a "
"comparison operator, *total_ordering* will not implement it again, even if "
"the original method is abstract."
msgstr ""

msgid ""
"Returning ``NotImplemented`` from the underlying comparison function for "
"unrecognised types is now supported."
msgstr ""

msgid ""
"A singleton object used as a sentinel to reserve a place for positional "
"arguments when calling :func:`partial` and :func:`partialmethod`."
msgstr ""

msgid ""
"Return a new :ref:`partial object<partial-objects>` which when called will "
"behave like *func* called with the positional arguments *args* and keyword "
"arguments *keywords*. If more arguments are supplied to the call, they are "
"appended to *args*. If additional keyword arguments are supplied, they "
"extend and override *keywords*. Roughly equivalent to::"
msgstr ""

msgid ""
"def partial(func, /, *args, **keywords):\n"
"    def newfunc(*more_args, **more_keywords):\n"
"        return func(*args, *more_args, **(keywords | more_keywords))\n"
"    newfunc.func = func\n"
"    newfunc.args = args\n"
"    newfunc.keywords = keywords\n"
"    return newfunc"
msgstr ""

msgid ""
"The :func:`!partial` function is used for partial function application which "
"\"freezes\" some portion of a function's arguments and/or keywords resulting "
"in a new object with a simplified signature.  For example, :func:`partial` "
"can be used to create a callable that behaves like the :func:`int` function "
"where the *base* argument defaults to ``2``:"
msgstr ""

msgid ""
">>> basetwo = partial(int, base=2)\n"
">>> basetwo.__doc__ = 'Convert base 2 string to an int.'\n"
">>> basetwo('10010')\n"
"18"
msgstr ""

msgid ""
"If :data:`Placeholder` sentinels are present in *args*, they will be filled "
"first when :func:`!partial` is called. This makes it possible to pre-fill "
"any positional argument with a call to :func:`!partial`; without :data:`!"
"Placeholder`, only the chosen number of leading positional arguments can be "
"pre-filled."
msgstr ""

msgid ""
"If any :data:`!Placeholder` sentinels are present, all must be filled at "
"call time:"
msgstr ""

msgid ""
">>> say_to_world = partial(print, Placeholder, Placeholder, \"world!\")\n"
">>> say_to_world('Hello', 'dear')\n"
"Hello dear world!"
msgstr ""

msgid ""
"Calling ``say_to_world('Hello')`` raises a :exc:`TypeError`, because only "
"one positional argument is provided, but there are two placeholders that "
"must be filled in."
msgstr ""

msgid ""
"If :func:`!partial` is applied to an existing :ref:`partial object <partial-"
"objects>`, :data:`!Placeholder` sentinels of the input object are filled in "
"with new positional arguments. A placeholder can be retained by inserting a "
"new :data:`!Placeholder` sentinel to the place held by a previous :data:`!"
"Placeholder`:"
msgstr ""

msgid ""
">>> from functools import partial, Placeholder as _\n"
">>> remove = partial(str.replace, _, _, '')\n"
">>> message = 'Hello, dear dear world!'\n"
">>> remove(message, ' dear')\n"
"'Hello, world!'\n"
">>> remove_dear = partial(remove, _, ' dear')\n"
">>> remove_dear(message)\n"
"'Hello, world!'\n"
">>> remove_first_dear = partial(remove_dear, _, 1)\n"
">>> remove_first_dear(message)\n"
"'Hello, dear world!'"
msgstr ""

msgid ""
":data:`!Placeholder` cannot be passed to :func:`!partial` as a keyword "
"argument."
msgstr ""

msgid "Added support for :data:`Placeholder` in positional arguments."
msgstr ""

msgid ""
"Return a new :class:`partialmethod` descriptor which behaves "
"like :class:`partial` except that it is designed to be used as a method "
"definition rather than being directly callable."
msgstr ""

msgid ""
"*func* must be a :term:`descriptor` or a callable (objects which are both, "
"like normal functions, are handled as descriptors)."
msgstr ""

msgid ""
"When *func* is a descriptor (such as a normal Python "
"function, :func:`classmethod`, :func:`staticmethod`, :func:`~abc.abstractmethod` "
"or another instance of :class:`partialmethod`), calls to ``__get__`` are "
"delegated to the underlying descriptor, and an appropriate :ref:`partial "
"object<partial-objects>` returned as the result."
msgstr ""

msgid ""
"When *func* is a non-descriptor callable, an appropriate bound method is "
"created dynamically. This behaves like a normal Python function when used as "
"a method: the *self* argument will be inserted as the first positional "
"argument, even before the *args* and *keywords* supplied to "
"the :class:`partialmethod` constructor."
msgstr ""

msgid ""
">>> class Cell:\n"
"...     def __init__(self):\n"
"...         self._alive = False\n"
"...     @property\n"
"...     def alive(self):\n"
"...         return self._alive\n"
"...     def set_state(self, state):\n"
"...         self._alive = bool(state)\n"
"...     set_alive = partialmethod(set_state, True)\n"
"...     set_dead = partialmethod(set_state, False)\n"
"...\n"
">>> c = Cell()\n"
">>> c.alive\n"
"False\n"
">>> c.set_alive()\n"
">>> c.alive\n"
"True"
msgstr ""

msgid ""
"Apply *function* of two arguments cumulatively to the items of *iterable*, "
"from left to right, so as to reduce the iterable to a single value.  For "
"example, ``reduce(lambda x, y: x+y, [1, 2, 3, 4, 5])`` calculates "
"``((((1+2)+3)+4)+5)``. The left argument, *x*, is the accumulated value and "
"the right argument, *y*, is the update value from the *iterable*.  If the "
"optional *initial* is present, it is placed before the items of the iterable "
"in the calculation, and serves as a default when the iterable is empty.  If "
"*initial* is not given and *iterable* contains only one item, the first item "
"is returned."
msgstr ""

msgid "Roughly equivalent to::"
msgstr ""

msgid ""
"initial_missing = sentinel('initial_missing')\n"
"\n"
"def reduce(function, iterable, /, initial=initial_missing):\n"
"    it = iter(iterable)\n"
"    if initial is initial_missing:\n"
"        value = next(it)\n"
"    else:\n"
"        value = initial\n"
"    for element in it:\n"
"        value = function(value, element)\n"
"    return value"
msgstr ""

msgid ""
"See :func:`itertools.accumulate` for an iterator that yields all "
"intermediate values."
msgstr ""

msgid "*initial* is now supported as a keyword argument."
msgstr ""

msgid ""
"Transform a function into a :term:`single-dispatch <single "
"dispatch>` :term:`generic function`."
msgstr ""

msgid ""
"To define a generic function, decorate it with the ``@singledispatch`` "
"decorator. When defining a function using ``@singledispatch``, note that the "
"dispatch happens on the type of the first argument::"
msgstr ""

msgid ""
">>> from functools import singledispatch\n"
">>> @singledispatch\n"
"... def fun(arg, verbose=False):\n"
"...     if verbose:\n"
"...         print(\"Let me just say,\", end=\" \")\n"
"...     print(arg)"
msgstr ""

msgid ""
"To add overloaded implementations to the function, use the :func:`!register` "
"attribute of the generic function, which can be used as a decorator.  For "
"functions annotated with types, the decorator will infer the type of the "
"first argument automatically::"
msgstr ""

msgid ""
">>> @fun.register\n"
"... def _(arg: int, verbose=False):\n"
"...     if verbose:\n"
"...         print(\"Strength in numbers, eh?\", end=\" \")\n"
"...     print(arg)\n"
"...\n"
">>> @fun.register\n"
"... def _(arg: list, verbose=False):\n"
"...     if verbose:\n"
"...         print(\"Enumerate this:\")\n"
"...     for i, elem in enumerate(arg):\n"
"...         print(i, elem)"
msgstr ""

msgid ":class:`typing.Union` can also be used::"
msgstr ""

msgid ""
">>> @fun.register\n"
"... def _(arg: int | float, verbose=False):\n"
"...     if verbose:\n"
"...         print(\"Strength in numbers, eh?\", end=\" \")\n"
"...     print(arg)\n"
"...\n"
">>> from typing import Union\n"
">>> @fun.register\n"
"... def _(arg: Union[list, set], verbose=False):\n"
"...     if verbose:\n"
"...         print(\"Enumerate this:\")\n"
"...     for i, elem in enumerate(arg):\n"
"...         print(i, elem)\n"
"..."
msgstr ""

msgid ""
"For code which doesn't use type annotations, the appropriate type argument "
"can be passed explicitly to the decorator itself::"
msgstr ""

msgid ""
">>> @fun.register(complex)\n"
"... def _(arg, verbose=False):\n"
"...     if verbose:\n"
"...         print(\"Better than complicated.\", end=\" \")\n"
"...     print(arg.real, arg.imag)\n"
"..."
msgstr ""

msgid ""
"For code that dispatches on a collections type (e.g., ``list``), but wants "
"to typehint the items of the collection (e.g., ``list[int]``), the dispatch "
"type should be passed explicitly to the decorator itself with the typehint "
"going into the function definition::"
msgstr ""

msgid ""
">>> @fun.register(list)\n"
"... def _(arg: list[int], verbose=False):\n"
"...     if verbose:\n"
"...         print(\"Enumerate this:\")\n"
"...     for i, elem in enumerate(arg):\n"
"...         print(i, elem)"
msgstr ""

msgid ""
"At runtime the function will dispatch on an instance of a list regardless of "
"the type contained within the list i.e. ``[1,2,3]`` will be dispatched the "
"same as ``[\"foo\", \"bar\", \"baz\"]``. The annotation provided in this "
"example is for static type checkers only and has no runtime impact."
msgstr ""

msgid ""
"To enable registering :term:`lambdas<lambda>` and pre-existing functions, "
"the :func:`~singledispatch.register` attribute can also be used in a "
"functional form::"
msgstr ""

msgid ""
">>> def nothing(arg, verbose=False):\n"
"...     print(\"Nothing.\")\n"
"...\n"
">>> fun.register(type(None), nothing)"
msgstr ""

msgid ""
"The :func:`~singledispatch.register` attribute returns the undecorated "
"function. This enables decorator stacking, :mod:`pickling<pickle>`, and the "
"creation of unit tests for each variant independently::"
msgstr ""

msgid ""
">>> @fun.register(float)\n"
"... @fun.register(Decimal)\n"
"... def fun_num(arg, verbose=False):\n"
"...     if verbose:\n"
"...         print(\"Half of your number:\", end=\" \")\n"
"...     print(arg / 2)\n"
"...\n"
">>> fun_num is fun\n"
"False"
msgstr ""

msgid ""
"When called, the generic function dispatches on the type of the first "
"argument::"
msgstr ""

msgid ""
">>> fun(\"Hello, world.\")\n"
"Hello, world.\n"
">>> fun(\"test.\", verbose=True)\n"
"Let me just say, test.\n"
">>> fun(42, verbose=True)\n"
"Strength in numbers, eh? 42\n"
">>> fun(['spam', 'spam', 'eggs', 'spam'], verbose=True)\n"
"Enumerate this:\n"
"0 spam\n"
"1 spam\n"
"2 eggs\n"
"3 spam\n"
">>> fun(None)\n"
"Nothing.\n"
">>> fun(1.23)\n"
"0.615"
msgstr ""

msgid ""
"Where there is no registered implementation for a specific type, its method "
"resolution order is used to find a more generic implementation. The original "
"function decorated with ``@singledispatch`` is registered for the "
"base :class:`object` type, which means it is used if no better "
"implementation is found."
msgstr ""

msgid ""
"If an implementation is registered to an :term:`abstract base class`, "
"virtual subclasses of the base class will be dispatched to that "
"implementation::"
msgstr ""

msgid ""
">>> from collections.abc import Mapping\n"
">>> @fun.register\n"
"... def _(arg: Mapping, verbose=False):\n"
"...     if verbose:\n"
"...         print(\"Keys & Values\")\n"
"...     for key, value in arg.items():\n"
"...         print(key, \"=>\", value)\n"
"...\n"
">>> fun({\"a\": \"b\"})\n"
"a => b"
msgstr ""

msgid ""
"To check which implementation the generic function will choose for a given "
"type, use the ``dispatch()`` attribute::"
msgstr ""

msgid ""
">>> fun.dispatch(float)\n"
"<function fun_num at 0x1035a2840>\n"
">>> fun.dispatch(dict)    # note: default implementation\n"
"<function fun at 0x103fe0000>"
msgstr ""

msgid ""
"To access all registered implementations, use the read-only ``registry`` "
"attribute::"
msgstr ""

msgid ""
">>> fun.registry.keys()\n"
"dict_keys([<class 'NoneType'>, <class 'int'>, <class 'object'>,\n"
"          <class 'decimal.Decimal'>, <class 'list'>,\n"
"          <class 'float'>])\n"
">>> fun.registry[float]\n"
"<function fun_num at 0x1035a2840>\n"
">>> fun.registry[object]\n"
"<function fun at 0x103fe0000>"
msgstr ""

msgid ""
"The :func:`~singledispatch.register` attribute now supports using type "
"annotations."
msgstr ""

msgid ""
"The :func:`~singledispatch.register` attribute now "
"supports :class:`typing.Union` as a type annotation."
msgstr ""

msgid ""
"Transform a method into a :term:`single-dispatch <single "
"dispatch>` :term:`generic function`."
msgstr ""

msgid ""
"To define a generic method, decorate it with the ``@singledispatchmethod`` "
"decorator. When defining a method using ``@singledispatchmethod``, note that "
"the dispatch happens on the type of the first non-*self* or non-*cls* "
"argument::"
msgstr ""

msgid ""
"class Negator:\n"
"    @singledispatchmethod\n"
"    def neg(self, arg):\n"
"        raise NotImplementedError(\"Cannot negate a\")\n"
"\n"
"    @neg.register\n"
"    def _(self, arg: int):\n"
"        return -arg\n"
"\n"
"    @neg.register\n"
"    def _(self, arg: bool):\n"
"        return not arg"
msgstr ""

msgid ""
"``@singledispatchmethod`` supports nesting with other decorators such "
"as :deco:`classmethod`. Note that to allow for ``dispatcher.register``, "
"``singledispatchmethod`` must be the *outer most* decorator. Here is the "
"``Negator`` class with the ``neg`` methods bound to the class, rather than "
"an instance of the class::"
msgstr ""

msgid ""
"class Negator:\n"
"    @singledispatchmethod\n"
"    @classmethod\n"
"    def neg(cls, arg):\n"
"        raise NotImplementedError(\"Cannot negate a\")\n"
"\n"
"    @neg.register\n"
"    @classmethod\n"
"    def _(cls, arg: int):\n"
"        return -arg\n"
"\n"
"    @neg.register\n"
"    @classmethod\n"
"    def _(cls, arg: bool):\n"
"        return not arg"
msgstr ""

msgid ""
"The same pattern can be used for other similar "
"decorators: :deco:`staticmethod`, :deco:`~abc.abstractmethod`, and others."
msgstr ""

msgid "Added support of non-:term:`descriptor` callables."
msgstr ""

msgid ""
"Update a *wrapper* function to look like the *wrapped* function. The "
"optional arguments are tuples to specify which attributes of the original "
"function are assigned directly to the matching attributes on the wrapper "
"function and which attributes of the wrapper function are updated with the "
"corresponding attributes from the original function. The default values for "
"these arguments are the module level constants ``WRAPPER_ASSIGNMENTS`` "
"(which assigns to the wrapper "
"function's :attr:`~function.__module__`, :attr:`~function.__name__`, :attr:`~function.__qualname__`, :attr:`~function.__annotations__`, :attr:`~function.__type_params__`, "
"and :attr:`~function.__doc__`, the documentation string) and "
"``WRAPPER_UPDATES`` (which updates the wrapper "
"function's :attr:`~function.__dict__`, i.e. the instance dictionary)."
msgstr ""

msgid ""
"To allow access to the original function for introspection and other "
"purposes (e.g. bypassing a caching decorator such as :deco:`lru_cache`), "
"this function automatically adds a ``__wrapped__`` attribute to the wrapper "
"that refers to the function being wrapped."
msgstr ""

msgid ""
"The main intended use for this function is in :term:`decorator` functions "
"which wrap the decorated function and return the wrapper. If the wrapper "
"function is not updated, the metadata of the returned function will reflect "
"the wrapper definition rather than the original function definition, which "
"is typically less than helpful."
msgstr ""

msgid ""
":func:`update_wrapper` may be used with callables other than functions. Any "
"attributes named in *assigned* or *updated* that are missing from the object "
"being wrapped are ignored (i.e. this function will not attempt to set them "
"on the wrapper function). :exc:`AttributeError` is still raised if the "
"wrapper function itself is missing any attributes named in *updated*."
msgstr ""

msgid ""
"The ``__wrapped__`` attribute is now automatically added. "
"The :attr:`~function.__annotations__` attribute is now copied by default. "
"Missing attributes no longer trigger an :exc:`AttributeError`."
msgstr ""

msgid ""
"The ``__wrapped__`` attribute now always refers to the wrapped function, "
"even if that function defined a ``__wrapped__`` attribute. "
"(see :issue:`17482`)"
msgstr ""

msgid ""
"The :attr:`~function.__type_params__` attribute is now copied by default."
msgstr ""

msgid ""
"This is a convenience function for invoking :func:`update_wrapper` as a "
"function decorator when defining a wrapper function.  It is equivalent to "
"``partial(update_wrapper, wrapped=wrapped, assigned=assigned, "
"updated=updated)``. For example::"
msgstr ""

msgid ""
">>> from functools import wraps\n"
">>> def my_decorator(f):\n"
"...     @wraps(f)\n"
"...     def wrapper(*args, **kwds):\n"
"...         print('Calling decorated function')\n"
"...         return f(*args, **kwds)\n"
"...     return wrapper\n"
"...\n"
">>> @my_decorator\n"
"... def example():\n"
"...     \"\"\"Docstring\"\"\"\n"
"...     print('Called example function')\n"
"...\n"
">>> example()\n"
"Calling decorated function\n"
"Called example function\n"
">>> example.__name__\n"
"'example'\n"
">>> example.__doc__\n"
"'Docstring'"
msgstr ""

msgid ""
"Without the use of this decorator factory, the name of the example function "
"would have been ``'wrapper'``, and the docstring of the original :func:`!"
"example` would have been lost."
msgstr ""

msgid ":class:`partial` Objects"
msgstr ""

msgid ""
":class:`partial` objects are callable objects created by :func:`partial`. "
"They have three read-only attributes:"
msgstr ""

msgid ""
"A callable object or function.  Calls to the :class:`partial` object will be "
"forwarded to :attr:`func` with new arguments and keywords."
msgstr ""

msgid ""
"The leftmost positional arguments that will be prepended to the positional "
"arguments provided to a :class:`partial` object call."
msgstr ""

msgid ""
"The keyword arguments that will be supplied when the :class:`partial` object "
"is called."
msgstr ""

msgid ""
":class:`partial` objects are like :ref:`function objects <user-defined-"
"funcs>` in that they are callable, weak referenceable, and can have "
"attributes.  There are some important differences.  For instance, "
"the :attr:`~definition.__name__` and :attr:`~definition.__doc__` attributes "
"are not created automatically."
msgstr ""
