Skip to content

TYP: Fixed type annotaions in scripts/validate_rst_title_capitalization #33268

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

Merged
merged 3 commits into from
Apr 4, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions scripts/validate_rst_title_capitalization.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import os
import re
import sys
from typing import Generator, List, Tuple
from typing import Iterator, List, Tuple

CAPITALIZATION_EXCEPTIONS = {
"pandas",
Expand Down Expand Up @@ -148,7 +148,7 @@ def correct_title_capitalization(title: str) -> str:
return correct_title


def find_titles(rst_file: str) -> Generator[Tuple[str, int], None, None]:
def find_titles(rst_file: str) -> Iterator[Tuple[str, int]]:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Think we've been using Iterable in these cases - @simonjayhawkins ring a bell?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes you are 100% correct!

"""
Algorithm to identify particular text that should be considered headings in an
RST file.
Expand Down Expand Up @@ -184,7 +184,7 @@ def find_titles(rst_file: str) -> Generator[Tuple[str, int], None, None]:
previous_line = line


def find_rst_files(source_paths: List[str]) -> Generator[str, None, None]:
def find_rst_files(source_paths: List[str]) -> Iterator[str]:
"""
Given the command line arguments of directory paths, this method
yields the strings of the .rst file directories that these paths contain.
Expand Down Expand Up @@ -214,7 +214,7 @@ def find_rst_files(source_paths: List[str]) -> Generator[str, None, None]:
yield filename


def main(source_paths: List[str], output_format: str) -> bool:
def main(source_paths: List[str], output_format: str) -> int:
"""
The main method to print all headings with incorrect capitalization.

Expand Down