| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -248,6 +248,7 @@ | |||
| 248 | 248 | # Attributes/methods/etc. that definitely should be documented better, | |
| 249 | 249 | # but are deferred for now: | |
| 250 | 250 | ('py:attr', '__annotations__'), | |
| 251 | + ('py:meth', '__missing__'), | ||
| 251 | 252 | ('py:attr', '__wrapped__'), | |
| 252 | 253 | ('py:meth', 'index'), # list.index, tuple.index, etc. | |
| 253 | 254 | ] | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1985,7 +1985,8 @@ Examples of working with a :class:`.time` object:: | |||
| 1985 | 1985 | American EST and EDT. | |
| 1986 | 1986 | ||
| 1987 | 1987 | Special requirement for pickling: A :class:`tzinfo` subclass must have an | |
| 1988 | - :meth:`__init__` method that can be called with no arguments, otherwise it can be | ||
| 1988 | + :meth:`~object.__init__` method that can be called with no arguments, | ||
| 1989 | + otherwise it can be | ||
| 1989 | 1990 | pickled but possibly not unpickled again. This is a technical requirement that | |
| 1990 | 1991 | may be relaxed in the future. | |
| 1991 | 1992 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1009,9 +1009,9 @@ their subgroups based on the types of the contained exceptions. | |||
| 1009 | 1009 | True | |
| 1010 | 1010 | ||
| 1011 | 1011 | ||
| 1012 | - Note that :exc:`BaseExceptionGroup` defines :meth:`__new__`, so | ||
| 1012 | + Note that :exc:`BaseExceptionGroup` defines :meth:`~object.__new__`, so | ||
| 1013 | 1013 | subclasses that need a different constructor signature need to | |
| 1014 | - override that rather than :meth:`__init__`. For example, the following | ||
| 1014 | + override that rather than :meth:`~object.__init__`. For example, the following | ||
| 1015 | 1015 | defines an exception group subclass which accepts an exit_code and | |
| 1016 | 1016 | and constructs the group's message from it. :: | |
| 1017 | 1017 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1408,7 +1408,8 @@ The :mod:`test.support.os_helper` module provides support for os tests. | |||
| 1408 | 1408 | ||
| 1409 | 1409 | .. class:: FakePath(path) | |
| 1410 | 1410 | ||
| 1411 | - Simple :term:`path-like object`. It implements the :meth:`__fspath__` | ||
| 1411 | + Simple :term:`path-like object`. It implements the | ||
| 1412 | + :meth:`~os.PathLike.__fspath__` | ||
| 1412 | 1413 | method which just returns the *path* argument. If *path* is an exception, | |
| 1413 | 1414 | it will be raised in :meth:`!__fspath__`. | |
| 1414 | 1415 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -824,8 +824,9 @@ apply to method calls on the mock object. | |||
| 824 | 824 | ||
| 825 | 825 | .. class:: PropertyMock(*args, **kwargs) | |
| 826 | 826 | ||
| 827 | - A mock intended to be used as a property, or other descriptor, on a class. | ||
| 828 | - :class:`PropertyMock` provides :meth:`__get__` and :meth:`__set__` methods | ||
| 827 | + A mock intended to be used as a :class:`property`, or other | ||
| 828 | + :term:`descriptor`, on a class. :class:`PropertyMock` provides | ||
| 829 | + :meth:`~object.__get__` and :meth:`~object.__set__` methods | ||
| 829 | 830 | so you can specify a return value when it is fetched. | |
| 830 | 831 | ||
| 831 | 832 | Fetching a :class:`PropertyMock` instance from an object calls the mock, with | |
@@ -1707,8 +1708,9 @@ Keywords can be used in the :func:`patch.dict` call to set values in the diction | |||
| 1707 | 1708 | :func:`patch.dict` can be used with dictionary like objects that aren't actually | |
| 1708 | 1709 | dictionaries. At the very minimum they must support item getting, setting, | |
| 1709 | 1710 | deleting and either iteration or membership test. This corresponds to the | |
| 1710 | - magic methods :meth:`~object.__getitem__`, :meth:`__setitem__`, :meth:`__delitem__` and either | ||
| 1711 | - :meth:`__iter__` or :meth:`__contains__`. | ||
| 1711 | + magic methods :meth:`~object.__getitem__`, :meth:`~object.__setitem__`, | ||
| 1712 | + :meth:`~object.__delitem__` and either :meth:`~container.__iter__` or | ||
| 1713 | + :meth:`~object.__contains__`. | ||
| 1712 | 1714 | ||
| 1713 | 1715 | >>> class Container: | |
| 1714 | 1716 | ... def __init__(self): | |
@@ -2171,7 +2173,7 @@ For example: | |||
| 2171 | 2173 | >>> object() in mock | |
| 2172 | 2174 | False | |
| 2173 | 2175 | ||
| 2174 | - The two equality methods, :meth:`__eq__` and :meth:`__ne__`, are special. | ||
| 2176 | + The two equality methods, :meth:`!__eq__` and :meth:`!__ne__`, are special. | ||
| 2175 | 2177 | They do the default equality comparison on identity, using the | |
| 2176 | 2178 | :attr:`~Mock.side_effect` attribute, unless you change their return value to | |
| 2177 | 2179 | return something else:: | |
@@ -2521,8 +2523,8 @@ mock_open | |||
| 2521 | 2523 | *read_data* is now reset on each call to the *mock*. | |
| 2522 | 2524 | ||
| 2523 | 2525 | .. versionchanged:: 3.8 | |
| 2524 | - Added :meth:`__iter__` to implementation so that iteration (such as in for | ||
| 2525 | - loops) correctly consumes *read_data*. | ||
| 2526 | + Added :meth:`~container.__iter__` to implementation so that iteration | ||
| 2527 | + (such as in for loops) correctly consumes *read_data*. | ||
| 2526 | 2528 | ||
| 2527 | 2529 | Using :func:`open` as a context manager is a great way to ensure your file handles | |
| 2528 | 2530 | are closed properly and is becoming common:: | |
@@ -2704,7 +2706,7 @@ able to use autospec. On the other hand it is much better to design your | |||
| 2704 | 2706 | objects so that introspection is safe [#]_. | |
| 2705 | 2707 | ||
| 2706 | 2708 | A more serious problem is that it is common for instance attributes to be | |
| 2707 | - created in the :meth:`__init__` method and not to exist on the class at all. | ||
| 2709 | + created in the :meth:`~object.__init__` method and not to exist on the class at all. | ||
| 2708 | 2710 | *autospec* can't know about any dynamically created attributes and restricts | |
| 2709 | 2711 | the api to visible attributes. :: | |
| 2710 | 2712 | ||
@@ -2745,8 +2747,9 @@ this particular scenario: | |||
| 2745 | 2747 | AttributeError: Mock object has no attribute 'a' | |
| 2746 | 2748 | ||
| 2747 | 2749 | Probably the best way of solving the problem is to add class attributes as | |
| 2748 | - default values for instance members initialised in :meth:`__init__`. Note that if | ||
| 2749 | - you are only setting default attributes in :meth:`__init__` then providing them via | ||
| 2750 | + default values for instance members initialised in :meth:`~object.__init__`. | ||
| 2751 | + Note that if | ||
| 2752 | + you are only setting default attributes in :meth:`!__init__` then providing them via | ||
| 2750 | 2753 | class attributes (shared between instances of course) is faster too. e.g. | |
| 2751 | 2754 | ||
| 2752 | 2755 | .. code-block:: python | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1733,7 +1733,7 @@ Grouping tests | |||
| 1733 | 1733 | .. method:: __iter__() | |
| 1734 | 1734 | ||
| 1735 | 1735 | Tests grouped by a :class:`TestSuite` are always accessed by iteration. | |
| 1736 | - Subclasses can lazily provide tests by overriding :meth:`__iter__`. Note | ||
| 1736 | + Subclasses can lazily provide tests by overriding :meth:`!__iter__`. Note | ||
| 1737 | 1737 | that this method may be called several times on a single suite (for | |
| 1738 | 1738 | example when counting tests or comparing for equality) so the tests | |
| 1739 | 1739 | returned by repeated iterations before :meth:`TestSuite.run` must be the | |
@@ -1744,7 +1744,7 @@ Grouping tests | |||
| 1744 | 1744 | ||
| 1745 | 1745 | .. versionchanged:: 3.2 | |
| 1746 | 1746 | In earlier versions the :class:`TestSuite` accessed tests directly rather | |
| 1747 | - than through iteration, so overriding :meth:`__iter__` wasn't sufficient | ||
| 1747 | + than through iteration, so overriding :meth:`!__iter__` wasn't sufficient | ||
| 1748 | 1748 | for providing tests. | |
| 1749 | 1749 | ||
| 1750 | 1750 | .. versionchanged:: 3.4 | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -201,8 +201,9 @@ manipulation of WSGI response headers using a mapping-like interface. | |||
| 201 | 201 | an empty list. | |
| 202 | 202 | ||
| 203 | 203 | :class:`Headers` objects support typical mapping operations including | |
| 204 | - :meth:`~object.__getitem__`, :meth:`get`, :meth:`__setitem__`, :meth:`setdefault`, | ||
| 205 | - :meth:`__delitem__` and :meth:`__contains__`. For each of | ||
| 204 | + :meth:`~object.__getitem__`, :meth:`~dict.get`, :meth:`~object.__setitem__`, | ||
| 205 | + :meth:`~dict.setdefault`, | ||
| 206 | + :meth:`~object.__delitem__` and :meth:`~object.__contains__`. For each of | ||
| 206 | 207 | these methods, the key is the header name (treated case-insensitively), and the | |
| 207 | 208 | value is the first value associated with that header name. Setting a header | |
| 208 | 209 | deletes any existing values for that header, then adds a new value at the end of | |
@@ -520,8 +521,10 @@ input, output, and error streams. | |||
| 520 | 521 | want to subclass this instead of :class:`BaseCGIHandler`. | |
| 521 | 522 | ||
| 522 | 523 | This class is a subclass of :class:`BaseHandler`. It overrides the | |
| 523 | - :meth:`__init__`, :meth:`get_stdin`, :meth:`get_stderr`, :meth:`add_cgi_vars`, | ||
| 524 | - :meth:`_write`, and :meth:`_flush` methods to support explicitly setting the | ||
| 524 | + :meth:`!__init__`, :meth:`~BaseHandler.get_stdin`, | ||
| 525 | + :meth:`~BaseHandler.get_stderr`, :meth:`~BaseHandler.add_cgi_vars`, | ||
| 526 | + :meth:`~BaseHandler._write`, and :meth:`~BaseHandler._flush` methods to | ||
| 527 | + support explicitly setting the | ||
| 525 | 528 | environment and streams via the constructor. The supplied environment and | |
| 526 | 529 | streams are stored in the :attr:`stdin`, :attr:`stdout`, :attr:`stderr`, and | |
| 527 | 530 | :attr:`environ` attributes. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -269,8 +269,9 @@ DateTime Objects | |||
| 269 | 269 | Write the XML-RPC encoding of this :class:`DateTime` item to the *out* stream | |
| 270 | 270 | object. | |
| 271 | 271 | ||
| 272 | - It also supports certain of Python's built-in operators through rich comparison | ||
| 273 | - and :meth:`__repr__` methods. | ||
| 272 | + It also supports certain of Python's built-in operators through | ||
| 273 | + :meth:`rich comparison <object.__lt__>` and :meth:`~object.__repr__` | ||
| 274 | + methods. | ||
| 274 | 275 | ||
| 275 | 276 | A working example follows. The server code:: | |
| 276 | 277 | ||
@@ -334,8 +335,8 @@ Binary Objects | |||
| 334 | 335 | which was the de facto standard base64 specification when the | |
| 335 | 336 | XML-RPC spec was written. | |
| 336 | 337 | ||
| 337 | - It also supports certain of Python's built-in operators through :meth:`__eq__` | ||
| 338 | - and :meth:`__ne__` methods. | ||
| 338 | + It also supports certain of Python's built-in operators through | ||
| 339 | + :meth:`~object.__eq__` and :meth:`~object.__ne__` methods. | ||
| 339 | 340 | ||
| 340 | 341 | Example usage of the binary objects. We're going to transfer an image over | |
| 341 | 342 | XMLRPC:: | |
| Back | FazBrowse Home | New Git URL |
0 commit comments