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
733d20c6
Commit
733d20c6
authored
Feb 09, 2001
by
Eric S. Raymond
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
String method conversion.
parent
39bcca1b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
+8
-8
Lib/ConfigParser.py
Lib/ConfigParser.py
+8
-8
No files found.
Lib/ConfigParser.py
View file @
733d20c6
...
@@ -293,7 +293,7 @@ class ConfigParser:
...
@@ -293,7 +293,7 @@ class ConfigParser:
depth
=
0
depth
=
0
while
depth
<
10
:
# Loop through this until it's done
while
depth
<
10
:
# Loop through this until it's done
depth
=
depth
+
1
depth
=
depth
+
1
if
string
.
find
(
value
,
"%("
)
>=
0
:
if
value
.
find
(
"%("
)
>=
0
:
try
:
try
:
value
=
value
%
d
value
=
value
%
d
except
KeyError
,
key
:
except
KeyError
,
key
:
...
@@ -315,13 +315,13 @@ class ConfigParser:
...
@@ -315,13 +315,13 @@ class ConfigParser:
def
getboolean
(
self
,
section
,
option
):
def
getboolean
(
self
,
section
,
option
):
v
=
self
.
get
(
section
,
option
)
v
=
self
.
get
(
section
,
option
)
val
=
string
.
atoi
(
v
)
val
=
v
.
atoi
(
)
if
val
not
in
(
0
,
1
):
if
val
not
in
(
0
,
1
):
raise
ValueError
,
'Not a boolean: %s'
%
v
raise
ValueError
,
'Not a boolean: %s'
%
v
return
val
return
val
def
optionxform
(
self
,
optionstr
):
def
optionxform
(
self
,
optionstr
):
return
string
.
lower
(
optionstr
)
return
optionstr
.
lower
(
)
def
has_option
(
self
,
section
,
option
):
def
has_option
(
self
,
section
,
option
):
"""Check for the existence of a given option in a given section."""
"""Check for the existence of a given option in a given section."""
...
@@ -419,14 +419,14 @@ class ConfigParser:
...
@@ -419,14 +419,14 @@ class ConfigParser:
break
break
lineno = lineno + 1
lineno = lineno + 1
# comment or blank line?
# comment or blank line?
if
string.strip(line
) == '' or line[0] in '#;':
if
line.strip(
) == '' or line[0] in '#;':
continue
continue
if
string.lower(string.split(line)[0]
) == 'rem'
\
if
line.split()[0].lower(
) == 'rem'
\
and line[0] in "rR": # no leading whitespace
and line[0] in "rR": # no leading whitespace
continue
continue
# continuation line?
# continuation line?
if line[0] in '
\
t
' and cursect is not None and optname:
if line[0] in '
\
t
' and cursect is not None and optname:
value =
string.strip(line
)
value =
line.strip(
)
if value:
if value:
cursect[optname] = cursect[optname] + '
\
n
' + value
cursect[optname] = cursect[optname] + '
\
n
' + value
# a section header or option header?
# a section header or option header?
...
@@ -455,10 +455,10 @@ class ConfigParser:
...
@@ -455,10 +455,10 @@ class ConfigParser:
if vi in ('=', ':') and ';' in optval:
if vi in ('=', ':') and ';' in optval:
# ';' is a comment delimiter only if it follows
# ';' is a comment delimiter only if it follows
# a spacing character
# a spacing character
pos =
string.find(optval,
';')
pos =
optval.find(
';')
if pos and optval[pos-1] in string.whitespace:
if pos and optval[pos-1] in string.whitespace:
optval = optval[:pos]
optval = optval[:pos]
optval =
string.strip(optval
)
optval =
optval.strip(
)
# allow empty values
# allow empty values
if optval == '""':
if optval == '""':
optval = ''
optval = ''
...
...
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