Skip to content

Commit c38bfef

Browse files
committed
Update translation from Transifex
1 parent 7cb55fc commit c38bfef

1 file changed

Lines changed: 131 additions & 78 deletions

File tree

howto/descriptor.po

Lines changed: 131 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ msgid ""
1313
msgstr ""
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"
7171
msgstr ""
7272

7373
msgid ""
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."
7676
msgstr ""
7777

7878
msgid "Simple example: A descriptor that returns a constant"
@@ -197,6 +197,12 @@ msgid ""
197197
"`__get__`, :meth:`__set__`, or :meth:`__delete__`."
198198
msgstr ""
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+
200206
msgid ""
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."
245251
msgstr ""
246252

247253
msgid ""
@@ -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`."
322328
msgstr ""
323329

324330
msgid ""
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."
333339
msgstr ""
334340

335341
msgid ""
@@ -389,76 +395,100 @@ msgid ""
389395
msgstr ""
390396

391397
msgid ""
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))``."
397414
msgstr ""
398415

399416
msgid ""
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."
401421
msgstr ""
402422

403423
msgid ""
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`."
411426
msgstr ""
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+
413437
msgid ""
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()`."
417440
msgstr ""
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)``."
420446
msgstr ""
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__`."
423451
msgstr ""
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`_."
426457
msgstr ""
427458

428459
msgid ""
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`."
431463
msgstr ""
432464

433-
msgid "data descriptors always override instance dictionaries."
465+
msgid "The important points to remember are:"
434466
msgstr ""
435467

436-
msgid "non-data descriptors may be overridden by instance dictionaries."
468+
msgid "Descriptors are invoked by the :meth:`__getattribute__` method."
437469
msgstr ""
438470

439471
msgid ""
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`."
447474
msgstr ""
448475

449476
msgid ""
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."
453479
msgstr ""
454480

455481
msgid ""
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."
462492
msgstr ""
463493

464494
msgid "Automatic Name Notification"
@@ -488,17 +518,32 @@ msgid "Descriptor Example"
488518
msgstr ""
489519

490520
msgid ""
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>`_."
495524
msgstr ""
496525

497526
msgid ""
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."
502547
msgstr ""
503548

504549
msgid "Properties"
@@ -542,51 +587,59 @@ msgid ""
542587
msgstr ""
543588

544589
msgid ""
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::"
551599
msgstr ""
552600

553601
msgid ""
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::"
558606
msgstr ""
559607

560608
msgid ""
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::"
563611
msgstr ""
564612

565613
msgid ""
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::"
568616
msgstr ""
569617

570618
msgid ""
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::"
573621
msgstr ""
574622

575623
msgid ""
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::"
578626
msgstr ""
579627

580628
msgid ""
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::"
583631
msgstr ""
584632

585633
msgid ""
586634
"Internally, the bound method stores the underlying function and the bound "
587635
"instance::"
588636
msgstr ""
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+
590643
msgid "Static Methods and Class Methods"
591644
msgstr ""
592645

@@ -660,7 +713,7 @@ msgid ""
660713
msgstr ""
661714

662715
msgid ""
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::"
665718
msgstr ""
666719

@@ -677,9 +730,9 @@ msgstr ""
677730

678731
msgid ""
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::"
684737
msgstr ""
685738

0 commit comments

Comments
 (0)