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
eda02db8
Commit
eda02db8
authored
Sep 03, 2001
by
Neil Schemenauer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't use dir() to find instance attribute names.
parent
0c2cf362
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
3 deletions
+7
-3
Lib/distutils/dist.py
Lib/distutils/dist.py
+7
-3
No files found.
Lib/distutils/dist.py
View file @
eda02db8
...
...
@@ -122,9 +122,7 @@ class Distribution:
# worth it. Also delegate 'get_XXX()' methods to the 'metadata'
# object in a sneaky and underhanded (but efficient!) way.
self
.
metadata
=
DistributionMetadata
()
method_basenames
=
dir
(
self
.
metadata
)
+
\
[
'fullname'
,
'contact'
,
'contact_email'
]
for
basename
in
method_basenames
:
for
basename
in
self
.
metadata
.
_METHOD_BASENAMES
:
method_name
=
"get_"
+
basename
setattr
(
self
,
method_name
,
getattr
(
self
.
metadata
,
method_name
))
...
...
@@ -962,6 +960,12 @@ class DistributionMetadata:
author, and so forth.
"""
_METHOD_BASENAMES
=
(
"name"
,
"version"
,
"author"
,
"author_email"
,
"maintainer"
,
"maintainer_email"
,
"url"
,
"license"
,
"description"
,
"long_description"
,
"keywords"
,
"platforms"
,
"fullname"
,
"contact"
,
"contact_email"
,
"licence"
)
def
__init__
(
self
):
self
.
name
=
None
self
.
version
=
None
...
...
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