Skip to content

Commit

Permalink
Use a list of authors in peps.json
Browse files Browse the repository at this point in the history
  • Loading branch information
AA-Turner committed Jan 24, 2025
1 parent 41a1c11 commit e99d6ef
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions pep_sphinx_extensions/pep_zero_generator/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from __future__ import annotations

import dataclasses
from collections.abc import Iterable, Sequence
from email.parser import HeaderParser
from pathlib import Path

Expand Down Expand Up @@ -121,6 +122,11 @@ def __lt__(self, other: PEP) -> bool:
def __eq__(self, other):
return self.number == other.number

@property
def _author_names(self) -> Iterable[str]:
"""An iterator of the authors' full names."""
return (author.full_name for author in self.authors)

@property
def shorthand(self) -> str:
"""Return reStructuredText tooltip for the PEP type and status."""
Expand All @@ -139,18 +145,18 @@ def details(self) -> dict[str, str | int]:
# a tooltip representing the type and status
"shorthand": self.shorthand,
# the author list as a comma-separated with only last names
"authors": ", ".join(author.full_name for author in self.authors),
"authors": ", ".join(self._author_names),
# The targeted Python-Version (if present) or the empty string
"python_version": self.python_version or "",
}

@property
def full_details(self) -> dict[str, str | int]:
def full_details(self) -> dict[str, str | int | Sequence[str]]:
"""Returns all headers of the PEP as a dict."""
return {
"number": self.number,
"title": self.title,
"authors": ", ".join(author.full_name for author in self.authors),
"authors": tuple(self._author_names),
"discussions_to": self.discussions_to,
"status": self.status,
"type": self.pep_type,
Expand Down

0 comments on commit e99d6ef

Please sign in to comment.