Skip to content

Commit 1737973

Browse files
committed
Various formatting changes in library/annotationlib.rst docs
1 parent a70a647 commit 1737973

File tree

1 file changed

+14
-19
lines changed

1 file changed

+14
-19
lines changed

Doc/library/annotationlib.rst

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -544,30 +544,24 @@ following attributes:
544544
.. code-block:: python
545545
546546
class Annotate:
547-
called_formats = []
547+
called_formats = []
548548
549-
def __call__(self, format=None, /, *, _self=None):
550-
# When called with fake globals, `_self` will be the
551-
# actual self value, and `self` will be the format.
552-
if _self is not None:
553-
self, format = _self, self
549+
def __call__(self, format=None, /, *, _self=None):
550+
# When called with fake globals, `_self` will be the
551+
# actual self value, and `self` will be the format.
552+
if _self is not None:
553+
self, format = _self, self
554554
555-
self.called_formats.append(format)
556-
if format <= 2: # VALUE or VALUE_WITH_FAKE_GLOBALS
557-
return {"x": MyType}
558-
raise NotImplementedError
555+
self.called_formats.append(format)
556+
if format <= 2: # VALUE or VALUE_WITH_FAKE_GLOBALS
557+
return {"x": MyType}
558+
raise NotImplementedError
559559
560-
@property
561-
def __defaults__(self):
562-
return (None,)
560+
__defaults__ = (None,)
563561
564-
@property
565-
def __kwdefaults__(self):
566-
return {"_self": self}
562+
__kwdefaults__ = property(lambda self: dict(_self=self))
567563
568-
@property
569-
def __code__(self):
570-
return self.__call__.__code__
564+
__code__ = property(lambda self: self.__call__.__code__)
571565
572566
This can then be called with:
573567

@@ -588,6 +582,7 @@ Or used as the annotate function for an object:
588582
>>> get_annotations(Annotate(), format=Format.STRING)
589583
{'x': 'MyType'}
590584
585+
591586
Limitations of the ``STRING`` format
592587
------------------------------------
593588

0 commit comments

Comments
 (0)