Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f680cc4

Browse files
committed
Update doc for getboolean() to match code (ie, returning True/False)
Convert remaining uses of 1/0 to True/False
1 parent 212b43f commit f680cc4

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

Lib/ConfigParser.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
The filename defaults to fp.name; it is only used in error
5353
messages (if fp has no `name' attribute, the string `<???>' is used).
5454
55-
get(section, option, raw=0, vars=None)
55+
get(section, option, raw=False, vars=None)
5656
return a string value for the named option. All % interpolations are
5757
expanded in the return values, based on the defaults passed into the
5858
constructor and the DEFAULT section. Additional substitutions may be
@@ -67,10 +67,10 @@
6767
6868
getboolean(section, options)
6969
like get(), but convert value to a boolean (currently case
70-
insensitively defined as 0, false, no, off for 0, and 1, true,
71-
yes, on for 1). Returns 0 or 1.
70+
insensitively defined as 0, false, no, off for False, and 1, true,
71+
yes, on for True). Returns False or True.
7272
73-
items(section, raw=0, vars=None)
73+
items(section, raw=False, vars=None)
7474
return a list of tuples with (name, value) for each option
7575
in the section.
7676
@@ -308,7 +308,7 @@ def has_option(self, section, option):
308308
option = self.optionxform(option)
309309
return option in self._defaults
310310
elif section not in self._sections:
311-
return 0
311+
return False
312312
else:
313313
option = self.optionxform(option)
314314
return (option in self._sections[section]
@@ -393,7 +393,7 @@ def _read(self, fp, fpname):
393393
optname = None
394394
lineno = 0
395395
e = None # None, or an exception
396-
while 1:
396+
while True:
397397
line = fp.readline()
398398
if not line:
399399
break
@@ -459,7 +459,7 @@ def _read(self, fp, fpname):
459459

460460
class ConfigParser(RawConfigParser):
461461

462-
def get(self, section, option, raw=0, vars=None):
462+
def get(self, section, option, raw=False, vars=None):
463463
"""Get an option value for a given section.
464464
465465
All % interpolations are expanded in the return values, based on the
@@ -490,7 +490,7 @@ def get(self, section, option, raw=0, vars=None):
490490
else:
491491
return self._interpolate(section, option, value, d)
492492

493-
def items(self, section, raw=0, vars=None):
493+
def items(self, section, raw=False, vars=None):
494494
"""Return a list of tuples with (name, value) for each option
495495
in the section.
496496

0 commit comments

Comments
 (0)