python-docs-fr/library/functools.po

413 lines
15 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# SOME DESCRIPTIVE TITLE.
# Copyright (C) 2001-2016, Python Software Foundation
# This file is distributed under the same license as the Python package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: Python 3.6\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-04-02 22:11+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: ../Doc/library/functools.rst:2
msgid ""
":mod:`functools` --- Higher-order functions and operations on callable "
"objects"
msgstr ""
#: ../Doc/library/functools.rst:13
msgid "**Source code:** :source:`Lib/functools.py`"
msgstr "**Code source :** :source:`Lib/functools.py`"
#: ../Doc/library/functools.rst:17
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 ""
#: ../Doc/library/functools.rst:21
msgid "The :mod:`functools` module defines the following functions:"
msgstr ""
#: ../Doc/library/functools.rst:25
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 ""
#: ../Doc/library/functools.rst:32
msgid ""
"A comparison function is any callable that accept 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 ""
#: ../Doc/library/functools.rst:37 ../Doc/library/functools.rst:220
msgid "Example::"
msgstr "Exemples ::"
#: ../Doc/library/functools.rst:41
msgid ""
"For sorting examples and a brief sorting tutorial, see :ref:`sortinghowto`."
msgstr ""
"Pour des exemple de tris et un bref tutoriel, consultez :ref:`sortinghowto`."
#: ../Doc/library/functools.rst:48
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 ""
#: ../Doc/library/functools.rst:52
msgid ""
"Since a dictionary is used to cache results, the positional and keyword "
"arguments to the function must be hashable."
msgstr ""
#: ../Doc/library/functools.rst:55
msgid ""
"If *maxsize* is set to ``None``, the LRU feature is disabled and the cache "
"can grow without bound. The LRU feature performs best when *maxsize* is a "
"power-of-two."
msgstr ""
#: ../Doc/library/functools.rst:59
msgid ""
"If *typed* is set to true, function arguments of different types will be "
"cached separately. For example, ``f(3)`` and ``f(3.0)`` will be treated as "
"distinct calls with distinct results."
msgstr ""
#: ../Doc/library/functools.rst:63
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*. In a multi-threaded environment, the hits and "
"misses are approximate."
msgstr ""
#: ../Doc/library/functools.rst:69
msgid ""
"The decorator also provides a :func:`cache_clear` function for clearing or "
"invalidating the cache."
msgstr ""
#: ../Doc/library/functools.rst:72
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 ""
#: ../Doc/library/functools.rst:76
msgid ""
"An `LRU (least recently used) cache <https://en.wikipedia.org/wiki/"
"Cache_algorithms#Examples>`_ 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 ""
#: ../Doc/library/functools.rst:83
msgid "Example of an LRU cache for static web content::"
msgstr ""
#: ../Doc/library/functools.rst:102
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 ""
#: ../Doc/library/functools.rst:122
msgid "Added the *typed* option."
msgstr ""
#: ../Doc/library/functools.rst:127
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 ""
#: ../Doc/library/functools.rst:131
msgid ""
"The class must define one of :meth:`__lt__`, :meth:`__le__`, :meth:`__gt__`, "
"or :meth:`__ge__`. In addition, the class should supply an :meth:`__eq__` "
"method."
msgstr ""
#: ../Doc/library/functools.rst:135
msgid "For example::"
msgstr "Par exemple : ::"
#: ../Doc/library/functools.rst:155
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 ""
#: ../Doc/library/functools.rst:164
msgid ""
"Returning NotImplemented from the underlying comparison function for "
"unrecognised types is now supported."
msgstr ""
#: ../Doc/library/functools.rst:170
msgid ""
"Return a new :class:`partial` object 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 ""
#: ../Doc/library/functools.rst:186
msgid ""
"The :func:`partial` 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 two:"
msgstr ""
#: ../Doc/library/functools.rst:201
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 ""
#: ../Doc/library/functools.rst:205
msgid ""
"*func* must be a :term:`descriptor` or a callable (objects which are both, "
"like normal functions, are handled as descriptors)."
msgstr ""
#: ../Doc/library/functools.rst:208
msgid ""
"When *func* is a descriptor (such as a normal Python function, :func:"
"`classmethod`, :func:`staticmethod`, :func:`abstractmethod` or another "
"instance of :class:`partialmethod`), calls to ``__get__`` are delegated to "
"the underlying descriptor, and an appropriate :class:`partial` object "
"returned as the result."
msgstr ""
#: ../Doc/library/functools.rst:214
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 ""
#: ../Doc/library/functools.rst:245
msgid ""
"Apply *function* of two arguments cumulatively to the items of *sequence*, "
"from left to right, so as to reduce the sequence 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 *sequence*. If the "
"optional *initializer* is present, it is placed before the items of the "
"sequence in the calculation, and serves as a default when the sequence is "
"empty. If *initializer* is not given and *sequence* contains only one item, "
"the first item is returned."
msgstr ""
#: ../Doc/library/functools.rst:254
msgid "Roughly equivalent to::"
msgstr ""
#: ../Doc/library/functools.rst:269
msgid ""
"Transforms a function into a :term:`single-dispatch <single dispatch>` :term:"
"`generic function`."
msgstr ""
#: ../Doc/library/functools.rst:272
msgid ""
"To define a generic function, decorate it with the ``@singledispatch`` "
"decorator. Note that the dispatch happens on the type of the first argument, "
"create your function accordingly::"
msgstr ""
#: ../Doc/library/functools.rst:283
msgid ""
"To add overloaded implementations to the function, use the :func:`register` "
"attribute of the generic function. It is a decorator, taking a type "
"parameter and decorating a function implementing the operation for that "
"type::"
msgstr ""
#: ../Doc/library/functools.rst:301
msgid ""
"To enable registering lambdas and pre-existing functions, the :func:"
"`register` attribute can be used in a functional form::"
msgstr ""
#: ../Doc/library/functools.rst:309
msgid ""
"The :func:`register` attribute returns the undecorated function which "
"enables decorator stacking, pickling, as well as creating unit tests for "
"each variant independently::"
msgstr ""
#: ../Doc/library/functools.rst:323
msgid ""
"When called, the generic function dispatches on the type of the first "
"argument::"
msgstr ""
#: ../Doc/library/functools.rst:343
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 "
"``object`` type, which means it is used if no better implementation is found."
msgstr ""
#: ../Doc/library/functools.rst:349
msgid ""
"To check which implementation will the generic function choose for a given "
"type, use the ``dispatch()`` attribute::"
msgstr ""
#: ../Doc/library/functools.rst:357
msgid ""
"To access all registered implementations, use the read-only ``registry`` "
"attribute::"
msgstr ""
#: ../Doc/library/functools.rst:374
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 ``__module__``, ``__name__``, "
"``__qualname__``, ``__annotations__`` and ``__doc__``, the documentation "
"string) and ``WRAPPER_UPDATES`` (which updates the wrapper function's "
"``__dict__``, i.e. the instance dictionary)."
msgstr ""
#: ../Doc/library/functools.rst:384
msgid ""
"To allow access to the original function for introspection and other "
"purposes (e.g. bypassing a caching decorator such as :func:`lru_cache`), "
"this function automatically adds a ``__wrapped__`` attribute to the wrapper "
"that refers to the function being wrapped."
msgstr ""
#: ../Doc/library/functools.rst:389
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 ""
#: ../Doc/library/functools.rst:395
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 ""
#: ../Doc/library/functools.rst:401
msgid "Automatic addition of the ``__wrapped__`` attribute."
msgstr ""
#: ../Doc/library/functools.rst:404
msgid "Copying of the ``__annotations__`` attribute by default."
msgstr ""
#: ../Doc/library/functools.rst:407
msgid "Missing attributes no longer trigger an :exc:`AttributeError`."
msgstr ""
#: ../Doc/library/functools.rst:410
msgid ""
"The ``__wrapped__`` attribute now always refers to the wrapped function, "
"even if that function defined a ``__wrapped__`` attribute. (see :issue:"
"`17482`)"
msgstr ""
#: ../Doc/library/functools.rst:418
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 ""
#: ../Doc/library/functools.rst:444
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 ""
#: ../Doc/library/functools.rst:452
msgid ":class:`partial` Objects"
msgstr ""
#: ../Doc/library/functools.rst:454
msgid ""
":class:`partial` objects are callable objects created by :func:`partial`. "
"They have three read-only attributes:"
msgstr ""
#: ../Doc/library/functools.rst:460
msgid ""
"A callable object or function. Calls to the :class:`partial` object will be "
"forwarded to :attr:`func` with new arguments and keywords."
msgstr ""
#: ../Doc/library/functools.rst:466
msgid ""
"The leftmost positional arguments that will be prepended to the positional "
"arguments provided to a :class:`partial` object call."
msgstr ""
#: ../Doc/library/functools.rst:472
msgid ""
"The keyword arguments that will be supplied when the :class:`partial` object "
"is called."
msgstr ""
#: ../Doc/library/functools.rst:475
msgid ""
":class:`partial` objects are like :class:`function` objects in that they are "
"callable, weak referencable, and can have attributes. There are some "
"important differences. For instance, the :attr:`~definition.__name__` and :"
"attr:`__doc__` attributes are not created automatically. Also, :class:"
"`partial` objects defined in classes behave like static methods and do not "
"transform into bound methods during instance attribute look-up."
msgstr ""