jayvdb created this task. jayvdb added a subscriber: jayvdb. jayvdb added a project: pywikibot-core. Herald added subscribers: pywikibot-bugs-list, StudiesWorld, Aklapper.
TASK DESCRIPTION pep257 has introduced D403 "First word of first line [of docstring] should be properly capitalized" https://github.com/GreenSteam/pep257/pull/165 The #pywikibot-core codebase has many failures of this new rule. To be ready for the next release of pep257, we need to address the following (and report bugs #upstream): (for brevity, I have trimmed the DEPRECATED: entries) ``` $ pep257 -s --select=D403 . ./pywikibot/logentries.py:87 in public method `title`: D403: First word of the first line should be properly capitalized ('Deprecated:', not 'DEPRECATED:') ./pywikibot/logentries.py:258 in public method `page`: D403: First word of the first line should be properly capitalized ('Filepage', not 'FilePage') 258: def page(self): 259: """ 260: FilePage on which action was performed. 261: 262: Note: title may be missing in data dict e.g. by oversight action to 263: hide the title. In that case a KeyError exception will raise 264: ... ./pywikibot/family.py:947 in public method `iwkeys`: D403: First word of the first line should be properly capitalized ('Deprecated:', not 'DEPRECATED:') ./pywikibot/family.py:954 in public method `get_known_families`: D403: First word of the first line should be properly capitalized ('Deprecated:', not 'DEPRECATED:') ./pywikibot/family.py:1012 in public method `category_redirects`: D403: First word of the first line should be properly capitalized ('Deprecated:', not 'DEPRECATED:') ./pywikibot/family.py:1017 in public method `get_cr_templates`: D403: First word of the first line should be properly capitalized ('Deprecated:', not 'DEPRECATED:') ./pywikibot/family.py:1021 in public method `disambig`: D403: First word of the first line should be properly capitalized ('"return', not '"Return') 1021: def disambig(self, code, fallback='_default'): 1022: """"Return list of disambiguation templates.""" 1023: if code in self.disambiguationTemplates: 1024: return self.disambiguationTemplates[code] 1025: elif fallback: 1026: return self.disambiguationTemplates[fallback] 1027: else: ... ./pywikibot/family.py:1122 in public method `nicepath`: D403: First word of the first line should be properly capitalized ('Deprecated:', not 'DEPRECATED:') ./pywikibot/family.py:1136 in public method `nice_get_address`: D403: First word of the first line should be properly capitalized ('Deprecated:', not 'DEPRECATED:') ./pywikibot/family.py:1266 in public method `versionnumber`: D403: First word of the first line should be properly capitalized ('Deprecated,', not 'DEPRECATED,') ./pywikibot/family.py:1339 in public method `server_time`: D403: First word of the first line should be properly capitalized ('Deprecated,', not 'DEPRECATED,') ./pywikibot/bot.py:960 in public function `handleArgs`: D403: First word of the first line should be properly capitalized ('Deprecated.', not 'DEPRECATED.') ./pywikibot/site.py:991 in public method `getNamespaceIndex`: D403: First word of the first line should be properly capitalized ('Deprecated:', not 'DEPRECATED:') ./pywikibot/site.py:1083 in public method `linkto`: D403: First word of the first line should be properly capitalized ('Deprecated.', not 'DEPRECATED.') ./pywikibot/site.py:1216 in public method `urlEncode`: D403: First word of the first line should be properly capitalized ('Deprecated.', not 'DEPRECATED.') ./pywikibot/site.py:1223 in public method `getUrl`: D403: First word of the first line should be properly capitalized ('Deprecated.', not 'DEPRECATED.') ./pywikibot/site.py:1242 in public method `postForm`: D403: First word of the first line should be properly capitalized ('Deprecated.', not 'DEPRECATED.') ./pywikibot/site.py:1247 in public method `postData`: D403: First word of the first line should be properly capitalized ('Deprecated.', not 'DEPRECATED.') ./pywikibot/site.py:1253 in public method `checkCharset`: D403: First word of the first line should be properly capitalized ('Deprecated.', not 'DEPRECATED.') ./pywikibot/site.py:1258 in public method `cookies`: D403: First word of the first line should be properly capitalized ('Deprecated.', not 'DEPRECATED.') ./pywikibot/site.py:1263 in public method `updateCookies`: D403: First word of the first line should be properly capitalized ('Deprecated.', not 'DEPRECATED.') ./pywikibot/site.py:1268 in public method `solveCaptcha`: D403: First word of the first line should be properly capitalized ('Deprecated.', not 'DEPRECATED.') ./pywikibot/site.py:1654 in public method `__call__`: D403: First word of the first line should be properly capitalized ('Deprecated:', not 'DEPRECATED:') ./pywikibot/site.py:3251 in public method `getToken`: D403: First word of the first line should be properly capitalized ('Deprecated:', not 'DEPRECATED:') ./pywikibot/site.py:3267 in public method `getPatrolToken`: D403: First word of the first line should be properly capitalized ('Deprecated:', not 'DEPRECATED:') ./pywikibot/site.py:3979 in public method `categories`: D403: First word of the first line should be properly capitalized ('Deprecated.', not 'DEPRECATED.') ./pywikibot/site.py:4568 in public method `randompage`: D403: First word of the first line should be properly capitalized ('Deprecated.', not 'DEPRECATED.') ./pywikibot/site.py:4578 in public method `randomredirectpage`: D403: First word of the first line should be properly capitalized ('Deprecated:', not 'DEPRECATED:') ./pywikibot/site.py:5123 in public method `protect`: D403: First word of the first line should be properly capitalized ('(un)protect', not '(Un)protect') 5123: def protect(self, page, protections, reason, expiry=None, **kwargs): 5124: """(Un)protect a wiki page. Requires administrator status. 5125: 5126: @param protections: A dict mapping type of protection to protection 5127: level of that type. Valid types of protection are 'edit', 'move', 5128: 'create', and 'upload'. Valid protection levels (in MediaWiki 1.12) 5129: are '' (equivalent to 'none'), 'autoconfirmed', and 'sysop'. ... ./pywikibot/site.py:6926 in public method `editSource`: D403: First word of the first line should be properly capitalized ('Create/edit', not 'Create/Edit') 6926: def editSource(self, claim, source, new=False, bot=True, **kwargs): 6927: """ 6928: Create/Edit a source. 6929: 6930: @param claim: A Claim object to add the source to 6931: @type claim: Claim 6932: @param source: A Claim object to be used as a source ... ./pywikibot/site.py:6982 in public method `editQualifier`: D403: First word of the first line should be properly capitalized ('Create/edit', not 'Create/Edit') 6982: def editQualifier(self, claim, qualifier, new=False, bot=True, **kwargs): 6983: """ 6984: Create/Edit a qualifier. 6985: 6986: @param claim: A Claim object to add the qualifier to 6987: @type claim: Claim 6988: @param qualifier: A Claim object to be used as a qualifier ... ./pywikibot/page.py:1363 in public method `getTemplates`: D403: First word of the first line should be properly capitalized ('Deprecated.', not 'DEPRECATED.') ./pywikibot/page.py:1794 in public method `protect`: D403: First word of the first line should be properly capitalized ('(un)protect', not '(Un)protect') 1794: def protect(self, edit=False, move=False, create=None, upload=None, 1795: unprotect=False, reason=None, prompt=None, protections=None, 1796: **kwargs): 1797: """(Un)protect a wiki page. Requires administrator status. 1798: 1799: Valid protection levels (in MediaWiki 1.12) are '' (equivalent to 1800: 'none'), 'autoconfirmed', and 'sysop'. If None is given, however, ... ./pywikibot/page.py:1955 in public method `isFlowPage`: D403: First word of the first line should be properly capitalized ('Deprecated:', not 'DEPRECATED:') ./pywikibot/page.py:1970 in public method `encoding`: D403: First word of the first line should be properly capitalized ('Deprecated:', not 'DEPRECATED:') ./pywikibot/page.py:1975 in public method `titleWithoutNamespace`: D403: First word of the first line should be properly capitalized ('Deprecated:', not 'DEPRECATED:') ./pywikibot/page.py:1981 in public method `titleForFilename`: D403: First word of the first line should be properly capitalized ('Deprecated:', not 'DEPRECATED:') ./pywikibot/page.py:1986 in public method `sectionFreeTitle`: D403: First word of the first line should be properly capitalized ('Deprecated:', not 'DEPRECATED:') ./pywikibot/page.py:1991 in public method `aslink`: D403: First word of the first line should be properly capitalized ('Deprecated:', not 'DEPRECATED:') ./pywikibot/page.py:2006 in public method `getRestrictions`: D403: First word of the first line should be properly capitalized ('Deprecated.', not 'DEPRECATED.') ./pywikibot/page.py:2230 in public method `fileIsOnCommons`: D403: First word of the first line should be properly capitalized ('Deprecated.', not 'DEPRECATED.') ./pywikibot/page.py:2708 in public method `subcategoriesList`: D403: First word of the first line should be properly capitalized ('Deprecated:', not 'DEPRECATED:') ./pywikibot/page.py:2713 in public method `articlesList`: D403: First word of the first line should be properly capitalized ('Deprecated:', not 'DEPRECATED:') ./pywikibot/page.py:2718 in public method `supercategories`: D403: First word of the first line should be properly capitalized ('Deprecated:', not 'DEPRECATED:') ./pywikibot/page.py:2723 in public method `supercategoriesList`: D403: First word of the first line should be properly capitalized ('Deprecated:', not 'DEPRECATED:') ./pywikibot/page.py:2824 in public method `registrationTime`: D403: First word of the first line should be properly capitalized ('Deprecated.', not 'DEPRECATED.') ./pywikibot/page.py:3030 in public method `editedPages`: D403: First word of the first line should be properly capitalized ('Deprecated.', not 'DEPRECATED.') ./pywikibot/bot_choice.py:204 in public method `minimum`: D403: First word of the first line should be properly capitalized ('Return', not 'return') ./pywikibot/bot_choice.py:209 in public method `maximum`: D403: First word of the first line should be properly capitalized ('Return', not 'return') 209: def maximum(self): 210: """return the maximum value.""" 211: return self._max ./pywikibot/bot_choice.py:303 in public method `maximum`: D403: First word of the first line should be properly capitalized ('Return', not 'return') 303: def maximum(self): 304: """return the maximum value.""" 305: return len(self._list) ./pywikibot/login.py:388 in public method `consumer_token`: D403: First word of the first line should be properly capitalized ('Oauth', not 'OAuth') 388: def consumer_token(self): 389: """ 390: OAuth consumer key token and secret token. 391: 392: @rtype: tuple of two str 393: """ 394: return self._consumer_token ... ./pywikibot/login.py:397 in public method `access_token`: D403: First word of the first line should be properly capitalized ('Oauth', not 'OAuth') 397: def access_token(self): 398: """ 399: OAuth access key token and secret token. 400: 401: @rtype: tuple of two str 402: """ 403: return self._access_token ... ./pywikibot/i18n.py:661 in public function `twntranslate`: D403: First word of the first line should be properly capitalized ('Deprecated:', not 'DEPRECATED:') ./pywikibot/date.py:505 in public function `MakeParameter`: D403: First word of the first line should be properly capitalized ('Deprecated.', not 'DEPRECATED.') ./pywikibot/comms/rcstream.py:149 in public function `rc_listener`: D403: First word of the first line should be properly capitalized ('Rc', not 'RC') 149: def rc_listener(wikihost, rchost, rcport=80, rcpath='/rc', total=None): 150: """RC Changes Generator. Yields changes received from RCstream. 151: 152: @param wikihost: the hostname of the wiki we want to get changes for. This 153: is passed to rcstream using a 'subscribe' command. Pass 154: '*' to listen to all wikis for a given rc host. 155: @param rchost: the recent changes stream host to connect to. For Wikimedia ... ./pywikibot/comms/rcstream.py:197 in public function `site_rc_listener`: D403: First word of the first line should be properly capitalized ('Rc', not 'RC') 197: def site_rc_listener(site, total=None): 198: """RC Changes Generator. Yields changes received from RCstream. 199: 200: @param site: the Pywikibot.Site object to yield live recent changes for 201: @type site: Pywikibot.BaseSite 202: @param total: the maximum number of changes to return 203: @type total: int ... ./pywikibot/comms/threadedhttp.py:108 in public method `status`: D403: First word of the first line should be properly capitalized ('Http', not 'HTTP') 108: def status(self): 109: """HTTP response status. 110: 111: @rtype: int 112: """ 113: if not self.exception: 114: return self.data.status_code ... ./pywikibot/tools/__init__.py:1576 in public function `open_compressed`: D403: First word of the first line should be properly capitalized ('Deprecated:', not 'DEPRECATED:') ./tests/djvu_tests.py:35 in public method `setUpClass`: D403: First word of the first line should be properly capitalized ('Setup', not 'SetUp') 35: def setUpClass(cls): 36: """SetUp tests.""" ... ./tests/file_tests.py:138 in public method `test_file_info_with_no_page`: D403: First word of the first line should be properly capitalized ('Filepage:latest_file_info', not 'FilePage:latest_file_info') 138: def test_file_info_with_no_page(self): 139: """FilePage:latest_file_info raises NoPage for non existing pages.""" ... ./tests/file_tests.py:146 in public method `test_file_info_with_no_file`: D403: First word of the first line should be properly capitalized ('Filepage:latest_file_info', not 'FilePage:latest_file_info') 146: def test_file_info_with_no_file(self): 147: """FilePage:latest_file_info raises PagerelatedError if no file is present.""" ... ./tests/ui_tests.py:201 in public function `unpatch`: D403: First word of the first line should be properly capitalized ('Un-patch', not 'un-patch') 201: def unpatch(): 202: """un-patch standard terminal files.""" 203: ui._print = org_print 204: ui._raw_input = org_input ./tests/textlib_tests.py:526 in public method `test_regexes`: D403: First word of the first line should be properly capitalized ('_etp_regex,', not '_ETP_REGEX,') 526: def test_regexes(self): 527: """_ETP_REGEX, NESTED_TEMPLATE_REGEX and TEMP_REGEX tests.""" 528: func = textlib._ETP_REGEX.search 529: 530: self.assertIsNotNone(func('{{{1}}}')) 531: self.assertIsNotNone(func('{{a|b={{{1}}} }}')) 532: self.assertIsNotNone(func('{{a|b={{c}} }}')) ... ./tests/utils.py:206 in private nested function `detailed_show_warning`: D403: First word of the first line should be properly capitalized ('Warnings.showwarning', not 'warnings.showwarning') 206: def detailed_show_warning(*args, **kwargs): 207: """warnings.showwarning replacement handler.""" 208: entry = warnings.WarningMessage(*args, **kwargs) 209: 210: skip_lines = 0 211: entry_line_found = False 212: ... ./scripts/featured.py:546 in private nested function `compile_link`: D403: First word of the first line should be properly capitalized ('Compile', not 'compile') 546: def compile_link(site, templates): 547: """compile one link template list.""" 548: findtemplate = '(%s)' % '|'.join(templates) 549: return re.compile(r"\{\{%s\|%s\}\}" 550: % (findtemplate.replace(u' ', u'[ _]'), 551: site.code), re.IGNORECASE) ./scripts/data_ingestion.py:147 in public function `CSVReader`: D403: First word of the first line should be properly capitalized ('Csv', not 'CSV') 147: def CSVReader(fileobj, urlcolumn, site=None, *args, **kwargs): 148: """CSV reader.""" 149: reader = csv.DictReader(fileobj, *args, **kwargs) 150: for line in reader: 151: yield Photo(line[urlcolumn], line, site=site) ./scripts/replicate_wiki.py:61 in public function `namespaces`: D403: First word of the first line should be properly capitalized ('Dict', not 'dict') 61: def namespaces(site): 62: """dict from namespace number to prefix.""" 63: return dict((n.id, n.custom_name) for n in site.namespaces) ``` TASK DETAIL https://phabricator.wikimedia.org/T121365 EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/ To: jayvdb Cc: Aklapper, StudiesWorld, jayvdb, pywikibot-bugs-list _______________________________________________ pywikibot-bugs mailing list pywikibot-bugs@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/pywikibot-bugs