Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
03b9537d
Commit
03b9537d
authored
Oct 12, 2017
by
Éric Araujo
Committed by
GitHub
Oct 12, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bpo-31567: more decorator markup fixes in docs (GH-3959) (#3966)
parent
cba9a0c6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
7 deletions
+16
-7
Doc/library/functions.rst
Doc/library/functions.rst
+11
-2
Doc/library/typing.rst
Doc/library/typing.rst
+3
-3
Lib/test/test_typing.py
Lib/test/test_typing.py
+2
-2
No files found.
Doc/library/functions.rst
View file @
03b9537d
...
...
@@ -1419,12 +1419,21 @@ are always available. They are listed here in alphabetical order.
:func:`classmethod` for a variant that is useful for creating alternate class
constructors.
Like all decorators, it is also possible to call ``staticmethod`` as
a regular function and do something with its result. This is needed
in some cases where you need a reference to a function from a class
body and you want to avoid the automatic transformation to instance
method. For these cases, use this idiom:
class C:
builtin_open = staticmethod(open)
For more information on static methods, consult the documentation on the
standard type hierarchy in :ref:`types`.
.. index::
single: string; str() (built-in function)
.. index::
single: string; str() (built-in function)
.. _func-str:
.. class:: str(object='')
...
...
Doc/library/typing.rst
View file @
03b9537d
...
...
@@ -897,17 +897,17 @@ The module defines the following classes, functions and decorators:
See :pep:`484` for details and comparison with other typing semantics.
.. decorator:: no_type_check
(arg)
.. decorator:: no_type_check
Decorator to indicate that annotations are not type hints.
Th
e argument must be a class or function; if it is
a class, it
Th
is works as class or function :term:`decorator`. With
a class, it
applies recursively to all methods defined in that class (but not
to methods defined in its superclasses or subclasses).
This mutates the function(s) in place.
.. decorator:: no_type_check_decorator
(decorator)
.. decorator:: no_type_check_decorator
Decorator to give another decorator the :func:`no_type_check` effect.
...
...
Lib/test/test_typing.py
View file @
03b9537d
...
...
@@ -1471,8 +1471,8 @@ class ForwardRefTests(BaseTestCase):
def
test_meta_no_type_check
(
self
):
@
no_type_check_decorator
def
magic_decorator
(
deco
):
return
deco
def
magic_decorator
(
func
):
return
func
self
.
assertEqual
(
magic_decorator
.
__name__
,
'magic_decorator'
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment