Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
9bceb284
Commit
9bceb284
authored
Jan 10, 2001
by
Shane Hathaway
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Made available the names of the varargs and kwargs parameters.
parent
3fc37661
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
4 deletions
+17
-4
lib/python/Interface/Method.py
lib/python/Interface/Method.py
+17
-4
No files found.
lib/python/Interface/Method.py
View file @
9bceb284
...
...
@@ -5,6 +5,9 @@ from Attr import Attribute
sig_traits
=
[
'positional'
,
'required'
,
'optional'
,
'varargs'
,
'kwargs'
]
CO_VARARGS
=
4
CO_VARKEYWORDS
=
8
class
MethodClass
:
def
fromFunction
(
self
,
func
,
interface
=
''
):
...
...
@@ -25,8 +28,18 @@ class MethodClass:
m
.
positional
=
names
[
1
:
na
]
m
.
required
=
names
[
1
:
nr
]
m
.
optional
=
d
m
.
varargs
=
not
not
(
c
.
co_flags
&
4
)
m
.
kwargs
=
not
not
(
c
.
co_flags
&
8
)
argno
=
na
if
c
.
co_flags
&
CO_VARARGS
:
m
.
varargs
=
names
[
argno
]
argno
=
argno
+
1
else
:
m
.
varargs
=
None
if
c
.
co_flags
&
CO_VARKEYWORDS
:
m
.
kwargs
=
names
[
argno
]
else
:
m
.
kwargs
=
None
m
.
interface
=
interface
return
m
...
...
@@ -69,9 +82,9 @@ class Method(Attribute):
sig
=
sig
+
"=%s"
%
`self.optional[v]`
sig
=
sig
+
", "
if
self
.
varargs
:
sig
=
sig
+
"*args, "
sig
=
sig
+
(
"*%s, "
%
self
.
varargs
)
if
self
.
kwargs
:
sig
=
sig
+
"**kws, "
sig
=
sig
+
(
"**%s, "
%
self
.
kwargs
)
# slice off the last comma and space
if
self
.
positional
or
self
.
varargs
or
self
.
kwargs
:
...
...
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