Unnecessary else / elif used after return PYL-R1705
Style
Major
4 days ago2 years old
Unnecessary "else" after "return", remove the "else" and de-indent the code inside it
224            return False
225
226        target_item = list(wd_data).pop()
227        try:228            item.mergeInto(target_item)
229        except APIError:
230            # warning already printed by the API
Unnecessary "else" after "return", remove the "else" and de-indent the code inside it
145        pywikibot.info(
146            f'Adding {coordinate.lat}, {coordinate.lon} to {item.title()}')
147        # todo: handle exceptions using self.user_add_claim
148        try:149            item.addClaim(newclaim)
150        except CoordinateGlobeUnknownError as e:
151            pywikibot.info(f'Skipping unsupported globe: {e.args}')
Unnecessary "else" after "return", remove the "else" and de-indent the code inside it
1147        if template in self.hiddentemplates:
1148            # if the whitetemplate is not in the images description, we don't
1149            # care
1150            try:1151                self.all_licenses.remove(template)
1152            except ValueError:
1153                return False
Unnecessary "else" after "return", remove the "else" and de-indent the code inside it
312        .. versionchanged:: 7.1
313           Previous implementation only checked for cached keys.
314        """
315        try:316            self[key]
317        except KeyError:
318            return False
Unnecessary "else" after "return", remove the "else" and de-indent the code inside it
299
300        .. versionadded:: 7.1
301        """
302        try:303            self._get_cached(key)
304        except KeyError:
305            return False