Unnecessary delete statement in a local scope PTC-W0043
Anti-pattern
Major
4 days ago2 years old
Unnecessary del statement in a local scope
 846                page = pywikibot.Page(self.site, 'Pywikibot nobots test')
 847                page.text = content
 848                self.assertFalse(page.botMayEdit())
 849                del page 850
 851
 852class TestPageHistory(DefaultSiteTestCase):
Unnecessary del statement in a local scope
 71        # create test methods for package messages processed by unittest
 72        site = pywikibot.Site(dct['code'], dct['family'])
 73        codes = site.family.codes
 74        del site 75        for package in PACKAGES:
 76            keys = i18n.twget_keys(package)
 77            for code in codes:
Unnecessary del statement in a local scope
 583
 584            # Join the whitelist words.
 585            self._whitelist = list_white + whitelist_default
 586            del list_white, whitelist_default 587
 588        with suppress(UnicodeEncodeError):
 589            for wname in self._whitelist:
Unnecessary del statement in a local scope
 561                self.show_status(Msg.WARN)
 562                pywikibot.info("The bad word page doesn't exist!")
 563            self._blacklist = elenco + elenco_others + list_loaded
 564            del elenco, elenco_others, list_loaded 565
 566        if not hasattr(self, '_whitelist') or force:
 567            # initialize whitelist
Unnecessary del statement in a local scope
1885                    loc = None
1886                    with suppress(KeyError):
1887                        tmpl, loc = moved_links[page.site.code]
1888                        del tmpl1889                    if loc is not None and loc in page.title():
1890                        pywikibot.info(
1891                            f'Skipping: {page.title()} is a templates subpage')