@@ -13,7 +13,7 @@ msgid ""
1313msgstr ""
1414"Project-Id-Version : Python 3.9\n "
1515"Report-Msgid-Bugs-To : \n "
16- "POT-Creation-Date : 2020-10-24 04:26+0000\n "
16+ "POT-Creation-Date : 2020-10-25 04:26+0000\n "
1717"PO-Revision-Date : 2017-02-16 17:44+0000\n "
1818"Last-Translator : m_aciek <maciej.olko@gmail.com>, 2020\n "
1919"Language-Team : Polish (https://www.transifex.com/python-doc/teams/5390/pl/)\n "
@@ -71,8 +71,8 @@ msgid "Primer"
7171msgstr ""
7272
7373msgid ""
74- "In this primer, we start with most basic possible example and then we'll add "
75- "new capabilities one by one."
74+ "In this primer, we start with the most basic possible example and then we'll "
75+ "add new capabilities one by one."
7676msgstr ""
7777
7878msgid "Simple example: A descriptor that returns a constant"
@@ -197,6 +197,12 @@ msgid ""
197197"`__get__`, :meth:`__set__`, or :meth:`__delete__`."
198198msgstr ""
199199
200+ msgid ""
201+ "Optionally, descriptors can have a :meth:`__set_name__` method. This is "
202+ "only used in cases where a descriptor needs to know either the class where "
203+ "it is created or the name of class variable it was assigned to."
204+ msgstr ""
205+
200206msgid ""
201207"Descriptors get invoked by the dot operator during attribute lookup. If a "
202208"descriptor is accessed indirectly with ``vars(some_class)"
@@ -241,7 +247,7 @@ msgid ""
241247"A validator is a descriptor for managed attribute access. Prior to storing "
242248"any data, it verifies that the new value meets various type and range "
243249"restrictions. If those restrictions aren't met, it raises an exception to "
244- "prevents data corruption at its source."
250+ "prevent data corruption at its source."
245251msgstr ""
246252
247253msgid ""
@@ -318,18 +324,18 @@ msgid ""
318324"one whose attribute access has been overridden by methods in the descriptor "
319325"protocol. Those methods are :meth:`__get__`, :meth:`__set__`, and :meth:"
320326"`__delete__`. If any of those methods are defined for an object, it is said "
321- "to be a descriptor."
327+ "to be a :term:` descriptor` ."
322328msgstr ""
323329
324330msgid ""
325331"The default behavior for attribute access is to get, set, or delete the "
326332"attribute from an object's dictionary. For instance, ``a.x`` has a lookup "
327333"chain starting with ``a.__dict__['x']``, then ``type(a).__dict__['x']``, and "
328- "continuing through the base classes of ``type(a)`` excluding metaclasses . If "
329- "the looked-up value is an object defining one of the descriptor methods, "
330- "then Python may override the default behavior and invoke the descriptor "
331- "method instead. Where this occurs in the precedence chain depends on which "
332- "descriptor methods were defined."
334+ "continuing through the base classes of ``type(a)``. If the looked-up value "
335+ "is an object defining one of the descriptor methods, then Python may "
336+ "override the default behavior and invoke the descriptor method instead. "
337+ "Where this occurs in the precedence chain depends on which descriptor "
338+ "methods were defined."
333339msgstr ""
334340
335341msgid ""
@@ -389,76 +395,100 @@ msgid ""
389395msgstr ""
390396
391397msgid ""
392- "Alternatively, it is more common for a descriptor to be invoked "
393- "automatically upon attribute access. For example, ``obj.d`` looks up ``d`` "
394- "in the dictionary of ``obj``. If ``d`` defines the method :meth:`__get__`, "
395- "then ``d.__get__(obj)`` is invoked according to the precedence rules listed "
396- "below."
398+ "But it is more common for a descriptor to be invoked automatically from "
399+ "attribute access. The expression ``obj.d`` looks up ``d`` in the dictionary "
400+ "of ``obj``. If ``d`` defines the method :meth:`__get__`, then ``d."
401+ "__get__(obj)`` is invoked according to the precedence rules listed below."
402+ msgstr ""
403+
404+ msgid ""
405+ "The details of invocation depend on whether ``obj`` is an object, class, or "
406+ "instance of super."
407+ msgstr ""
408+
409+ msgid "**Objects**: The machinery is in :meth:`object.__getattribute__`."
410+ msgstr ""
411+
412+ msgid ""
413+ "It transforms ``b.x`` into ``type(b).__dict__['x'].__get__(b, type(b))``."
397414msgstr ""
398415
399416msgid ""
400- "The details of invocation depend on whether ``obj`` is an object or a class."
417+ "The implementation works through a precedence chain that gives data "
418+ "descriptors priority over instance variables, instance variables priority "
419+ "over non-data descriptors, and assigns lowest priority to :meth:"
420+ "`__getattr__` if provided."
401421msgstr ""
402422
403423msgid ""
404- "For objects, the machinery is in :meth:`object.__getattribute__` which "
405- "transforms ``b.x`` into ``type(b).__dict__['x'].__get__(b, type(b))``. The "
406- "implementation works through a precedence chain that gives data descriptors "
407- "priority over instance variables, instance variables priority over non-data "
408- "descriptors, and assigns lowest priority to :meth:`__getattr__` if provided. "
409424"The full C implementation can be found in :c:func:"
410425"`PyObject_GenericGetAttr()` in :source:`Objects/object.c`."
411426msgstr ""
412427
428+ msgid "**Classes**: The machinery is in :meth:`type.__getattribute__`."
429+ msgstr ""
430+
431+ msgid "It transforms ``A.x`` into ``A.__dict__['x'].__get__(None, A)``."
432+ msgstr ""
433+
434+ msgid "In pure Python, it looks like this::"
435+ msgstr ""
436+
413437msgid ""
414- "For classes, the machinery is in :meth:`type.__getattribute__` which "
415- "transforms ``B.x`` into ``B.__dict__['x'].__get__(None, B)``. In pure "
416- "Python, it looks like::"
438+ "**Super**: The machinery is in the custom :meth:`__getattribute__` method "
439+ "for object returned by :class:`super()`."
417440msgstr ""
418441
419- msgid "The important points to remember are:"
442+ msgid ""
443+ "The attribute lookup ``super(A, obj).m`` searches ``obj.__class__.__mro__`` "
444+ "for the base class ``B`` immediately following ``A`` and then returns ``B."
445+ "__dict__['m'].__get__(obj, A)``."
420446msgstr ""
421447
422- msgid "descriptors are invoked by the :meth:`__getattribute__` method"
448+ msgid ""
449+ "If not a descriptor, ``m`` is returned unchanged. If not in the dictionary, "
450+ "``m`` reverts to a search using :meth:`object.__getattribute__`."
423451msgstr ""
424452
425- msgid "overriding :meth:`__getattribute__` prevents automatic descriptor calls"
453+ msgid ""
454+ "The implementation details are in :c:func:`super_getattro()` in :source:"
455+ "`Objects/typeobject.c`. A pure Python equivalent can be found in `Guido's "
456+ "Tutorial`_."
426457msgstr ""
427458
428459msgid ""
429- ":meth:`object.__getattribute__` and :meth:`type.__getattribute__` make "
430- "different calls to :meth:`__get__`."
460+ "**Summary**: The details listed above show that the mechanism for "
461+ "descriptors is embedded in the :meth:`__getattribute__()` methods for :class:"
462+ "`object`, :class:`type`, and :func:`super`."
431463msgstr ""
432464
433- msgid "data descriptors always override instance dictionaries. "
465+ msgid "The important points to remember are: "
434466msgstr ""
435467
436- msgid "non-data descriptors may be overridden by instance dictionaries ."
468+ msgid "Descriptors are invoked by the :meth:`__getattribute__` method ."
437469msgstr ""
438470
439471msgid ""
440- "The object returned by ``super()`` also has a custom :meth:"
441- "`__getattribute__` method for invoking descriptors. The attribute lookup "
442- "``super(B, obj).m`` searches ``obj.__class__.__mro__`` for the base class "
443- "``A`` immediately following ``B`` and then returns ``A.__dict__['m']."
444- "__get__(obj, B)``. If not a descriptor, ``m`` is returned unchanged. If "
445- "not in the dictionary, ``m`` reverts to a search using :meth:`object."
446- "__getattribute__`."
472+ "Classes inherit this machinery from :class:`object`, :class:`type`, or :func:"
473+ "`super`."
447474msgstr ""
448475
449476msgid ""
450- "The implementation details are in :c:func:`super_getattro()` in :source:"
451- "`Objects/typeobject.c`. and a pure Python equivalent can be found in "
452- "`Guido's Tutorial`_."
477+ "Overriding :meth:`__getattribute__` prevents automatic descriptor calls "
478+ "because all the descriptor logic is in that method."
453479msgstr ""
454480
455481msgid ""
456- "The details above show that the mechanism for descriptors is embedded in "
457- "the :meth:`__getattribute__()` methods for :class:`object`, :class:`type`, "
458- "and :func:`super`. Classes inherit this machinery when they derive from :"
459- "class:`object` or if they have a metaclass providing similar functionality. "
460- "Likewise, classes can turn-off descriptor invocation by overriding :meth:"
461- "`__getattribute__()`."
482+ ":meth:`object.__getattribute__` and :meth:`type.__getattribute__` make "
483+ "different calls to :meth:`__get__`. The first includes the instance and may "
484+ "include the class. The second puts in ``None`` for the instance and always "
485+ "includes the class."
486+ msgstr ""
487+
488+ msgid "Data descriptors always override instance dictionaries."
489+ msgstr ""
490+
491+ msgid "Non-data descriptors may be overridden by instance dictionaries."
462492msgstr ""
463493
464494msgid "Automatic Name Notification"
@@ -488,17 +518,32 @@ msgid "Descriptor Example"
488518msgstr ""
489519
490520msgid ""
491- "The following code creates a class whose objects are data descriptors which "
492- "print a message for each get or set. Overriding :meth:`__getattribute__` is "
493- "alternate approach that could do this for every attribute. However, this "
494- "descriptor is useful for monitoring just a few chosen attributes::"
521+ "The following code is simplified skeleton showing how data descriptors could "
522+ "be used to implement an `object relational mapping <https://en.wikipedia.org/"
523+ "wiki/Object%E2%80%93relational_mapping>`_."
495524msgstr ""
496525
497526msgid ""
498- "The protocol is simple and offers exciting possibilities. Several use cases "
499- "are so common that they have been packaged into individual function calls. "
500- "Properties, bound methods, static methods, and class methods are all based "
501- "on the descriptor protocol."
527+ "The essential idea is that instances only hold keys to a database table. "
528+ "The actual data is stored in an external table that is being dynamically "
529+ "updated::"
530+ msgstr ""
531+
532+ msgid ""
533+ "We can use the :class:`Field` to define \" models\" that describe the schema "
534+ "for each table in a database::"
535+ msgstr ""
536+
537+ msgid ""
538+ "An interactive session shows how data is retrieved from the database and how "
539+ "it can be updated::"
540+ msgstr ""
541+
542+ msgid ""
543+ "The descriptor protocol is simple and offers exciting possibilities. "
544+ "Several use cases are so common that they have been packaged into individual "
545+ "function calls. Properties, bound methods, static methods, and class "
546+ "methods are all based on the descriptor protocol."
502547msgstr ""
503548
504549msgid "Properties"
@@ -542,51 +587,59 @@ msgid ""
542587msgstr ""
543588
544589msgid ""
545- "Class dictionaries store methods as functions. In a class definition, "
546- "methods are written using :keyword:`def` or :keyword:`lambda`, the usual "
547- "tools for creating functions. Methods only differ from regular functions in "
548- "that the first argument is reserved for the object instance. By Python "
549- "convention, the instance reference is called *self* but may be called *this* "
550- "or any other variable name."
590+ "Functions stored in class dictionaries get turned into methods when invoked. "
591+ "Methods only differ from regular functions in that the object instance is "
592+ "prepended to the other arguments. By convention, the instance is called "
593+ "*self* but could be called *this* or any other variable name."
594+ msgstr ""
595+
596+ msgid ""
597+ "Methods can be created manually with :class:`types.MethodType` which is "
598+ "roughly equivalent to::"
551599msgstr ""
552600
553601msgid ""
554- "To support method calls , functions include the :meth:`__get__` method for "
555- "binding methods during attribute access. This means that all functions are "
556- "non-data descriptors which return bound methods when they are invoked from "
557- "an object . In pure Python, it works like this ::"
602+ "To support automatic creation of methods , functions include the :meth:"
603+ "`__get__` method for binding methods during attribute access. This means "
604+ "that functions are non-data descriptors which return bound methods during "
605+ "dotted lookup from an instance . Here's how it works::"
558606msgstr ""
559607
560608msgid ""
561- "Running the following in class in the interpreter shows how the function "
609+ "Running the following class in the interpreter shows how the function "
562610"descriptor works in practice::"
563611msgstr ""
564612
565613msgid ""
566- "Access through the class dictionary does not invoke :meth:`__get__`. "
567- "Instead, it just returns the underlying function object ::"
614+ "The function has a :term:`qualified name` attribute to support "
615+ "introspection ::"
568616msgstr ""
569617
570618msgid ""
571- "Dotted access from a class calls :meth:`__get__` which just returns the "
572- "underlying function unchanged ::"
619+ "Accessing the function through the class dictionary does not invoke :meth: "
620+ "`__get__`. Instead, it just returns the underlying function object ::"
573621msgstr ""
574622
575623msgid ""
576- "The function has a :term:`qualified name` attribute to support "
577- "introspection ::"
624+ "Dotted access from a class calls :meth:`__get__` which just returns the "
625+ "underlying function unchanged ::"
578626msgstr ""
579627
580628msgid ""
581- "Dotted access from an instance calls :meth:`__get__` which returns a bound "
582- "method object::"
629+ "The interesting behavior occurs during dotted access from an instance. The "
630+ "dotted lookup calls :meth:`__get__` which returns a bound method object::"
583631msgstr ""
584632
585633msgid ""
586634"Internally, the bound method stores the underlying function and the bound "
587635"instance::"
588636msgstr ""
589637
638+ msgid ""
639+ "If you have ever wondered where *self* comes from in regular methods or "
640+ "where *cls* comes from in class methods, this is it!"
641+ msgstr ""
642+
590643msgid "Static Methods and Class Methods"
591644msgstr ""
592645
@@ -660,7 +713,7 @@ msgid ""
660713msgstr ""
661714
662715msgid ""
663- "Since staticmethods return the underlying function with no changes, the "
716+ "Since static methods return the underlying function with no changes, the "
664717"example calls are unexciting::"
665718msgstr ""
666719
@@ -677,9 +730,9 @@ msgstr ""
677730
678731msgid ""
679732"This behavior is useful whenever the function only needs to have a class "
680- "reference and does not care about any underlying data. One use for "
681- "classmethods is to create alternate class constructors. The classmethod :"
682- "func: `dict.fromkeys` creates a new dictionary from a list of keys. The pure "
733+ "reference and does not care about any underlying data. One use for class "
734+ "methods is to create alternate class constructors. The classmethod :func :"
735+ "`dict.fromkeys` creates a new dictionary from a list of keys. The pure "
683736"Python equivalent is::"
684737msgstr ""
685738
0 commit comments