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
62be3387
Commit
62be3387
authored
Mar 24, 2019
by
Raymond Hettinger
Committed by
GitHub
Mar 24, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bpo-36401: Have help() show readonly properties separately (GH-12517)
parent
113d735e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
1 deletion
+9
-1
Lib/pydoc.py
Lib/pydoc.py
+6
-0
Lib/test/test_enum.py
Lib/test/test_enum.py
+1
-1
Misc/NEWS.d/next/Library/2019-03-23-10-25-07.bpo-36401.hYpVBS.rst
...S.d/next/Library/2019-03-23-10-25-07.bpo-36401.hYpVBS.rst
+2
-0
No files found.
Lib/pydoc.py
View file @
62be3387
...
...
@@ -203,6 +203,8 @@ def classify_class_attrs(object):
for
(
name
,
kind
,
cls
,
value
)
in
inspect
.
classify_class_attrs
(
object
):
if
inspect
.
isdatadescriptor
(
value
):
kind
=
'data descriptor'
if
isinstance
(
value
,
property
)
and
value
.
fset
is
None
:
kind
=
'readonly property'
results
.
append
((
name
,
kind
,
cls
,
value
))
return
results
...
...
@@ -884,6 +886,8 @@ class HTMLDoc(Doc):
lambda
t
:
t
[
1
]
==
'class method'
)
attrs
=
spill
(
'Static methods %s'
%
tag
,
attrs
,
lambda
t
:
t
[
1
]
==
'static method'
)
attrs
=
spilldescriptors
(
"Readonly properties %s:
\
n
"
%
tag
,
attrs
,
lambda
t
:
t
[
1
]
==
'readonly property'
)
attrs
=
spilldescriptors
(
'Data descriptors %s'
%
tag
,
attrs
,
lambda
t
:
t
[
1
]
==
'data descriptor'
)
attrs
=
spilldata
(
'Data and other attributes %s'
%
tag
,
attrs
,
...
...
@@ -1341,6 +1345,8 @@ location listed above.
lambda
t
:
t
[
1
]
==
'class method'
)
attrs
=
spill
(
"Static methods %s:
\
n
"
%
tag
,
attrs
,
lambda
t
:
t
[
1
]
==
'static method'
)
attrs
=
spilldescriptors
(
"Readonly properties %s:
\
n
"
%
tag
,
attrs
,
lambda
t
:
t
[
1
]
==
'readonly property'
)
attrs
=
spilldescriptors
(
"Data descriptors %s:
\
n
"
%
tag
,
attrs
,
lambda
t
:
t
[
1
]
==
'data descriptor'
)
attrs
=
spilldata
(
"Data and other attributes %s:
\
n
"
%
tag
,
attrs
,
...
...
Lib/test/test_enum.py
View file @
62be3387
...
...
@@ -2825,7 +2825,7 @@ class Color(enum.Enum)
| The value of the Enum member.
|
\
x20
\
x20
| ----------------------------------------------------------------------
|
Data descriptor
s inherited from enum.EnumMeta:
|
Readonly propertie
s inherited from enum.EnumMeta:
|
\
x20
\
x20
| __members__
| Returns a mapping of member name->value.
...
...
Misc/NEWS.d/next/Library/2019-03-23-10-25-07.bpo-36401.hYpVBS.rst
0 → 100644
View file @
62be3387
The class documentation created by pydoc now has a separate section for
readonly properties.
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