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
b65ecbc8
Commit
b65ecbc8
authored
Nov 28, 2000
by
Michel Pelletier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
details and flag not to munge docstrings
parent
eefef3ed
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
13 deletions
+30
-13
lib/python/Interface/iclass.py
lib/python/Interface/iclass.py
+1
-0
lib/python/Interface/pprint.py
lib/python/Interface/pprint.py
+29
-13
No files found.
lib/python/Interface/iclass.py
View file @
b65ecbc8
...
...
@@ -166,6 +166,7 @@ class Class(Named):
# Note that we don't use a function definition here, because
# we don't want to specify a signature!
__call__
=
Method
(
"Instantiate instances of the class"
)
__bases__
=
Attribute
(
"A sequence of base classes"
)
...
...
lib/python/Interface/pprint.py
View file @
b65ecbc8
...
...
@@ -2,24 +2,34 @@ import string
""" Pretty-Print an Interface object as structured text (Yum) """
def
justify_and_indent
(
text
,
level
,
width
=
72
):
def
justify_and_indent
(
text
,
level
,
munge
=
0
,
width
=
72
):
""" strip newlines, indent and justify text """
lines
=
[]
line
=
" "
*
level
text
=
string
.
split
(
string
.
strip
(
string
.
translate
(
text
,
string
.
maketrans
(
"
\
r
\
n
"
,
" "
))))
if
munge
:
line
=
" "
*
level
for
word
in
text
:
line
=
string
.
join
([
line
,
word
])
if
len
(
line
)
>
width
:
text
=
string
.
split
(
string
.
strip
(
string
.
translate
(
text
,
string
.
maketrans
(
"
\
r
\
n
"
,
" "
))))
for
word
in
text
:
line
=
string
.
join
([
line
,
word
])
if
len
(
line
)
>
width
:
lines
.
append
(
line
)
line
=
" "
*
level
else
:
lines
.
append
(
line
)
line
=
" "
*
level
return
string
.
join
(
lines
,
"
\
n
"
)
else
:
lines
.
append
(
line
)
text
=
string
.
split
(
string
.
replace
(
text
,
"
\
r
\
n
"
,
"
\
n
"
),
"
\
n
"
)
return
string
.
join
(
lines
,
"
\
n
"
)
for
line
in
text
:
lines
.
append
(
(
" "
*
level
)
+
line
)
return
string
.
join
(
lines
,
"
\
n
"
)
def
build_signature
(
meth
):
""" this is a lot of work just to build a signature... """
...
...
@@ -41,7 +51,9 @@ def build_signature(meth):
sig
=
sig
+
")"
return
sig
def
interface_as_stx
(
I
):
def
interface_as_stx
(
I
,
munge
=
0
):
""" Output structured text format. Note, this will wack any existing
'structured' format of the text. """
outp
=
"%s
\
n
\
n
"
%
I
.
__name__
level
=
1
...
...
@@ -54,15 +66,19 @@ def interface_as_stx(I):
level
=
level
+
1
for
b
in
I
.
__bases__
:
item
=
"o %s"
%
b
.
__name__
outp
=
outp
+
justify_and_indent
(
item
,
level
)
+
"
\
n
\
n
"
outp
=
outp
+
justify_and_indent
(
item
,
level
,
munge
)
+
"
\
n
\
n
"
level
=
level
-
1
level
=
level
+
1
for
name
,
desc
in
I
.
namesAndDescriptions
():
item
=
"%s%s -- %s"
%
(
name
,
build_signature
(
desc
),
desc
.
__doc__
)
outp
=
outp
+
justify_and_indent
(
item
,
level
)
+
"
\
n
\
n
"
outp
=
outp
+
justify_and_indent
(
item
,
level
,
munge
)
+
"
\
n
\
n
"
return
outp
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