~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/util/configobj/configobj.py

  • Committer: Robey Pointer
  • Date: 2006-08-29 20:47:02 UTC
  • mto: (1711.9.9 jam-integration)
  • mto: This revision was merged to the branch mainline in revision 1975.
  • Revision ID: robey@lag.net-20060829204702-6d40ae7a33ec62c7
remove usage of has_key()

Show diffs side-by-side

added added

removed removed

Lines of Context:
353
353
        if not isinstance(key, StringTypes):
354
354
            raise ValueError, 'The key "%s" is not a string.' % key
355
355
        # add the comment
356
 
        if not self.comments.has_key(key):
 
356
        if key not in self.comments:
357
357
            self.comments[key] = []
358
358
            self.inline_comments[key] = ''
359
359
        # remove the entry from defaults
361
361
            self.defaults.remove(key)
362
362
        #
363
363
        if isinstance(value, Section):
364
 
            if not self.has_key(key):
 
364
            if key not in self:
365
365
                self.sections.append(key)
366
366
            dict.__setitem__(self, key, value)
367
367
        elif isinstance(value, dict):
368
368
            # First create the new depth level,
369
369
            # then create the section
370
 
            if not self.has_key(key):
 
370
            if key not in self:
371
371
                self.sections.append(key)
372
372
            new_depth = self.depth + 1
373
373
            dict.__setitem__(
380
380
                    indict=value,
381
381
                    name=key))
382
382
        else:
383
 
            if not self.has_key(key):
 
383
            if key not in self:
384
384
                self.scalars.append(key)
385
385
            if not self.main.stringify:
386
386
                if isinstance(value, StringTypes):
1344
1344
                        NestingError, infile, cur_index)
1345
1345
                #
1346
1346
                sect_name = self._unquote(sect_name)
1347
 
                if parent.has_key(sect_name):
 
1347
                if sect_name in parent:
1348
1348
##                    print >> sys.stderr, sect_name
1349
1349
                    self._handle_error(
1350
1350
                        'Duplicate section name at line %s.',
1394
1394
                #
1395
1395
##                print >> sys.stderr, sline
1396
1396
                key = self._unquote(key)
1397
 
                if this_section.has_key(key):
 
1397
                if key in this_section:
1398
1398
                    self._handle_error(
1399
1399
                        'Duplicate keyword name at line %s.',
1400
1400
                        DuplicateError, infile, cur_index)
1745
1745
        for entry in configspec.sections:
1746
1746
            if entry == '__many__':
1747
1747
                continue
1748
 
            if not section.has_key(entry):
 
1748
            if entry not in section:
1749
1749
                section[entry] = {}
1750
1750
            self._set_configspec_value(configspec[entry], section[entry])
1751
1751
 
1776
1776
        #
1777
1777
        section.configspec = scalars
1778
1778
        for entry in sections:
1779
 
            if not section.has_key(entry):
 
1779
            if entry not in section:
1780
1780
                section[entry] = {}
1781
1781
            self._handle_repeat(section[entry], sections[entry])
1782
1782