Skip to content

Commit

Permalink
style: improve naming and typing
Browse files Browse the repository at this point in the history
  • Loading branch information
sujuka99 committed Sep 26, 2023
1 parent 914207e commit db01331
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions hooks/gen_docs/__init__.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
"""Documentation generation."""

from collections.abc import Generator
from collections.abc import Iterator
from enum import Enum
from typing import Any


class StrEnum(str, Enum):
class IterableStrEnum(str, Enum):
"""Temporary replacement for StrEnum while we suppport python3.10"""

@classmethod
def items(cls) -> Generator[tuple[Any, str], None, None]:
def items(cls) -> Iterator[tuple[str, str]]:
"""Return all item names and values in tuples."""
return ((e.name, e.value) for e in cls)

@classmethod
def keys(cls) -> Generator[str, None, None]:
def keys(cls) -> Iterator[str]:
"""Return all item names."""
return (e.name for e in cls)

@classmethod
def values(cls) -> Generator[Any, None, None]:
def values(cls) -> Iterator[str]:
"""Return all item values."""
return (e.value for e in cls)

0 comments on commit db01331

Please sign in to comment.