-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
DOC: Updating capitalization of doc/source/development #33121
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 30 commits
194d5a7
3d1960c
9da1e8a
55587f7
048fb78
d1ae9ea
83280b7
4314d3c
937b5df
589b0fe
f09689c
e71cffd
dc839c5
f354797
62d5164
f8b496c
5d01189
1685076
06dc1cd
a11dc2b
e55064d
fc1009d
eba0d13
726bd4c
0beeda1
f48b2dd
5ba464c
7c09610
940109d
35b1a37
5f0512e
7767d3c
888aa10
5fc4dcc
0ad8143
3ea43a5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,11 +10,11 @@ | |
|
||
""" | ||
import argparse | ||
import sys | ||
import re | ||
import os | ||
from typing import Tuple, Generator, List | ||
import glob | ||
import os | ||
import re | ||
import sys | ||
from typing import Generator, List, Tuple | ||
|
||
|
||
CAPITALIZATION_EXCEPTIONS = { | ||
|
@@ -46,6 +46,60 @@ | |
"NumFOCUS", | ||
"sklearn", | ||
"Docker", | ||
"PeriodIndex", | ||
"NA", | ||
"NaN", | ||
"ValueError", | ||
"BooleanArray", | ||
"KeyError", | ||
"API", | ||
"FAQ", | ||
"IO", | ||
"TimedeltaIndex", | ||
"DatetimeIndex", | ||
"IntervalIndex", | ||
"CategoricalIndex", | ||
"GroupBy", | ||
"SPSS", | ||
"ORC", | ||
"R", | ||
"HDF5", | ||
"HDFStore", | ||
"CDay", | ||
"CBMonthBegin", | ||
"CBMonthEnd", | ||
"BMonthBegin", | ||
"BMonthEnd", | ||
"BDay", | ||
"FY5253Quarter", | ||
"FY5253", | ||
"YearBegin", | ||
"YearEnd", | ||
"BYearBegin", | ||
"BYearEnd", | ||
"YearOffset", | ||
"QuarterBegin", | ||
"QuarterEnd", | ||
"BQuarterBegin", | ||
"BQuarterEnd", | ||
"QuarterOffset", | ||
"LastWeekOfMonth", | ||
"WeekOfMonth", | ||
"SemiMonthBegin", | ||
"SemiMonthEnd", | ||
"SemiMonthOffset", | ||
"CustomBusinessMonthBegin", | ||
"CustomBusinessMonthEnd", | ||
"BusinessMonthBegin", | ||
"BusinessMonthEnd", | ||
"MonthBegin", | ||
"MonthEnd", | ||
"MonthOffset", | ||
"CustomBusinessHour", | ||
"CustomBusinessDay", | ||
"BusinessHour", | ||
"BusinessDay", | ||
"DateOffset", | ||
} | ||
|
||
CAP_EXCEPTIONS_DICT = {word.lower(): word for word in CAPITALIZATION_EXCEPTIONS} | ||
|
@@ -121,6 +175,7 @@ def find_titles(rst_file: str) -> Generator[Tuple[str, int], None, None]: | |
len(line_chars) == 1 | ||
and line_chars.pop() in symbols | ||
and len(line) == len(previous_line) | ||
and previous_line[0] != ":" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, I think I suggested this approach myself, but I see a problem now. This will skip the whole line from validation, and I see we use a mix of these Instead of skipping the line here, I think we should update the condition in line 139. So, we check that What do you think? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The problem is that:
By the way, code in line 180 causes problems because it also removes "_" which is present in documentation like > code_style.rst line 21
So what I suggest is to modify in script "validate_rst_title_capitalization.py" from line 180 on: NB: I replace "`" by {backtick} as it causes trouble to display it as code
to:
in order to keep the "`" if title begins by a ":"
So that if title begins by ":" it considers title to be valid no matter what. Or to simply add in "validate_rst_title_capitalization.py" line 126:
for the same reason. Note that there is still a problem with:
That doesn't keep "_" in the titles |
||
): | ||
yield re.sub(r"[`\*_]", "", previous_line), i | ||
previous_line = line | ||
|
@@ -177,6 +232,8 @@ def main(source_paths: List[str], output_format: str) -> bool: | |
|
||
for filename in find_rst_files(source_paths): | ||
for title, line_number in find_titles(filename): | ||
if ":class" in title: | ||
print(title) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this should be: if ":class:" in title:
continue There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Horrible... I forgot to remove it. Correcting it right away! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm Im not so much used to git yet.. Apart from that mistake, I didn't roll back previous changes that I made, I thought it will be ok. I don't know if the changes i didn't remove will fail There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Or if it conflicts with previous PR or something |
||
if title != correct_title_capitalization(title): | ||
print( | ||
f"""{filename}:{line_number}:{err_msg} "{title}" to "{ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If everything in
development/
is fixed, can you change this in a new PR, so the whole directory is validated in the CI? Thanks!There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure!