128 target_title = prefix + page.title()
129 page = pywikibot.Page(fromsite, title)
130 else:
131 target_title = (prefix + title)132 targetpage = pywikibot.Page(tosite, target_title)
133 edithistpage = pywikibot.Page(tosite, target_title + '/edithistory')
134
1639 pywikibot.info(f'<<lightpurple>>Updating links on page {page}.')
1640 pywikibot.info(f'Changes to be made: {mods}')
1641 oldtext = page.get()
1642 template = (page.namespace() == 10)1643 newtext = textlib.replaceLanguageLinks(oldtext, new,
1644 site=page.site,
1645 template=template)
888 if dup_page.title(as_url=True) != self.image.title(
889 as_url=True) or self.timestamp is None:
890 try:
891 self.timestamp = (dup_page.latest_file_info.timestamp) 892 except PageRelatedError:
893 continue
894 data = self.timestamp.timetuple()
543 def attr2text(self) -> str:
544 """Return a template with archiver saveable attributes."""
545 return '{{%s\n%s\n}}' \
546 % (self.tpl.title(with_ns=(self.tpl.namespace() != 10)),547 '\n'.join(f'|{a} = {self.get_attr(a)}'
548 for a in self.saveables()))
549
410
411 if self.is_oauth_token_available():
412 if self.userinfo['name'] == self.username():
413 error_msg = (f'Logging in on {self} via OAuth failed') 414 elif self.username() is None:
415 error_msg = ('No username has been defined in your '
416 'user config file: you have to add in this '
Extra parentheses in code can be removed for improved readability.
In the examples below, the first example is more readable than the second one.
Preferred:
if len(some_variable) + 1 < 1:
...
Not preferred:
if (len(some_variable) + 1) < 1:
...