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
32635b7d
Commit
32635b7d
authored
Feb 07, 2002
by
Andreas Jung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
replace string module calls by string methods
parent
ae630f47
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
11 deletions
+11
-11
lib/python/Interface/pprint.py
lib/python/Interface/pprint.py
+11
-11
No files found.
lib/python/Interface/pprint.py
View file @
32635b7d
import
string
""" Pretty-Print an Interface object as structured text (Yum) """
import
string
def
trim_doc_string
(
text
):
"""
Trims a doc string to make it format
correctly with structured text.
"""
text
=
string
.
strip
(
text
)
text
=
string
.
replace
(
text
,
'
\
r
\
n
'
,
'
\
n
'
)
lines
=
string
.
split
(
text
,
'
\
n
'
)
text
=
text
.
strip
(
)
text
=
text
.
replace
(
'
\
r
\
n
'
,
'
\
n
'
)
lines
=
text
.
split
(
'
\
n
'
)
nlines
=
[
lines
[
0
]]
if
len
(
lines
)
>
1
:
min_indent
=
None
for
line
in
lines
[
1
:]:
indent
=
len
(
line
)
-
len
(
string
.
lstrip
(
line
))
indent
=
len
(
line
)
-
len
(
line
.
lstrip
(
))
if
indent
<
min_indent
or
min_indent
is
None
:
min_indent
=
indent
for
line
in
lines
[
1
:]:
nlines
.
append
(
line
[
min_indent
:])
return
string
.
join
(
nlines
,
'
\
n
'
)
return
'
\
n
'
.
join
(
nlines
,
'
\
n
'
)
...
...
@@ -31,25 +31,25 @@ def justify_and_indent(text, level, munge=0, width=72):
if
munge
:
line
=
" "
*
level
text
=
string
.
split
(
string
.
strip
(
string
.
translate
(
text
,
string
.
maketrans
(
"
\
r
\
n
"
,
" "
)))
)
text
=
(
string
.
translate
(
text
,
string
.
maketrans
(
"
\
r
\
n
"
,
" "
))).
strip
.
split
(
)
for
word
in
text
:
line
=
string
.
join
([
line
,
word
])
line
=
''
.
join
([
line
,
word
])
if
len
(
line
)
>
width
:
lines
.
append
(
line
)
line
=
" "
*
level
else
:
lines
.
append
(
line
)
return
string
.
join
(
lines
,
"
\
n
"
)
return
'
\
n
'
.
join
(
lines
)
else
:
text
=
string
.
split
(
string
.
replace
(
text
,
"
\
r
\
n
"
,
"
\
n
"
),
"
\
n
"
)
text
=
text
.
replace
(
"
\
r
\
n
"
,
"
\
n
"
).
split
(
"
\
n
"
)
for
line
in
text
:
lines
.
append
(
(
" "
*
level
)
+
line
)
return
string
.
join
(
lines
,
"
\
n
"
)
return
'
\
n
'
.
join
(
lines
)
def
interface_as_stx
(
I
,
munge
=
0
):
...
...
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