Skip to content
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

Sphinx - PEP 0 generation #1932

Merged
merged 37 commits into from
Jun 12, 2021
Merged
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
4a52b3c
Add PEP 0 parser
AA-Turner Apr 20, 2021
d3771d4
Add PEP 0 writer
AA-Turner Apr 20, 2021
c8268fb
Add PEP 0 generator and authors override
AA-Turner Apr 20, 2021
85ae140
Add/update build and run
AA-Turner Apr 20, 2021
835adfc
Simplify `create_index_file`
AA-Turner May 7, 2021
530ca9a
Special status handling
AA-Turner Jun 9, 2021
2578fe2
Add constants for PEP related magic strings
AA-Turner Jun 9, 2021
c839d51
Prefer checking on class
AA-Turner Jun 9, 2021
a9b0559
Add PEP.hide_status, use constants
AA-Turner Jun 9, 2021
77c5492
Remove comment from 2008 (current method works fine)
AA-Turner Jun 9, 2021
f6f7b65
Clarify intent of for-else loop
AA-Turner Jun 9, 2021
d0513e2
Hook in to Sphinx (oops, missed when splitting out this PR)
AA-Turner Jun 9, 2021
b8d9eff
Rename AUTHORS.csv for clarity
AA-Turner Jun 9, 2021
4b0d042
Sort and strip spaces
AA-Turner Jun 9, 2021
a993eed
Prefer `authors_overrides` name
AA-Turner Jun 9, 2021
92fe1fb
Add pep_0_errors.py
AA-Turner Jun 9, 2021
3f695ab
Move author_sort_by to writer
AA-Turner Jun 9, 2021
327fd1b
PEP init misc
AA-Turner Jun 9, 2021
403bff3
Split out Author
AA-Turner Jun 9, 2021
0d9bf61
Drop pep_0 prefix
AA-Turner Jun 9, 2021
dedb043
Pass title length as an argument
AA-Turner Jun 9, 2021
84518a3
Add constants.py to hold global type / status values
AA-Turner Jun 9, 2021
5164571
Capitalise constants
AA-Turner Jun 9, 2021
29738c5
Capitalise constants
AA-Turner Jun 9, 2021
918a4b9
Update PEP classification algorithm
AA-Turner Jun 9, 2021
70011e0
Extract static methods to module level
AA-Turner Jun 9, 2021
e72bed1
Add emit_text, emit_pep_row
AA-Turner Jun 9, 2021
32454c8
Use constants in writer.py
AA-Turner Jun 9, 2021
e42938a
Sort imports
AA-Turner Jun 9, 2021
d4447ab
Sort constants
AA-Turner Jun 9, 2021
5ebcb9d
Fix sorting in historical and dead PEPs
AA-Turner Jun 9, 2021
a4a4f50
Extract static methods to module level
AA-Turner Jun 9, 2021
1ec8438
Extract static methods to module level (parser.py
AA-Turner Jun 9, 2021
de9ab25
Make Author a NamedTuple
AA-Turner Jun 9, 2021
4cb6e8c
Fix author duplication bug with NamedTuples
AA-Turner Jun 9, 2021
1e62868
Revert to old PEP classification algorithm
AA-Turner Jun 10, 2021
48b72c2
Define PEP equality
AA-Turner Jun 10, 2021
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
Prev Previous commit
Next Next commit
Special status handling
AA-Turner committed Jun 9, 2021

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 530ca9a4a57a4e9f58c76ae38d08a49a56f323c2
10 changes: 6 additions & 4 deletions pep_sphinx_extensions/pep_zero_generator/pep_0_parser.py
Original file line number Diff line number Diff line change
@@ -164,6 +164,9 @@ class PEP:
"Accepted", "Provisional", "Rejected", "Withdrawn",
"Deferred", "Final", "Active", "Draft", "Superseded",
}
special_statuses = {
"April Fool!": "Rejected", # See PEP 401 :)
}

def raise_pep_error(self, msg: str, pep_num: bool = False) -> None:
pep_number = self.number if pep_num else None
@@ -205,11 +208,10 @@ def __init__(self, filename: Path, author_lookup: dict, title_length: int):

# Status
status = metadata["Status"]
if status in self.special_statuses:
status = self.special_statuses[status]
if status not in self.status_values:
AA-Turner marked this conversation as resolved.
Show resolved Hide resolved
if status == "April Fool!": # See PEP 401 :)
status = "Rejected"
else:
self.raise_pep_error(f"{status} is not a valid Status value", pep_num=True)
self.raise_pep_error(f"{status} is not a valid Status value", pep_num=True)

# Special case for Active PEPs.
if status == "Active" and self.pep_type not in {"Process", "Informational"}:
AA-Turner marked this conversation as resolved.
Show resolved Hide resolved