Skip to content

Commit

Permalink
fix: 3.9 compat
Browse files Browse the repository at this point in the history
  • Loading branch information
Ravencentric committed Jun 25, 2024
1 parent 8f444c4 commit 69d0645
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,19 @@
</p>
</p>

<p align="center">
<div align="center">

<a href="https://pypi.org/project/pynyaa/"><img src="https://img.shields.io/pypi/v/pynyaa" alt="PyPI - Version" ></a>
<img src="https://img.shields.io/pypi/pyversions/pynyaa" alt="PyPI - Python Version">
<img src="https://img.shields.io/github/actions/workflow/status/Ravencentric/pynyaa/release.yml?" alt="GitHub Workflow Status">
<img src="https://img.shields.io/github/actions/workflow/status/Ravencentric/pynyaa/test.yml?label=tests" alt="GitHub Workflow Status">
<img src="https://img.shields.io/github/license/Ravencentric/pynyaa" alt="License">
<img src="https://www.mypy-lang.org/static/mypy_badge.svg" alt="Checked with mypy">
<img src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json" alt="Ruff">
</p>

<img src="https://img.shields.io/github/actions/workflow/status/Ravencentric/pynyaa/release.yml?" alt="GitHub Workflow Status">
<img src="https://img.shields.io/github/actions/workflow/status/Ravencentric/pynyaa/test.yml?label=tests" alt="GitHub Workflow Status">
<a href="https://codecov.io/gh/Ravencentric/pynyaa"><img src="https://codecov.io/gh/Ravencentric/pynyaa/graph/badge.svg?token=9LZ2I4LDYT"/></a>

</div>

## Table Of Contents

Expand Down
12 changes: 9 additions & 3 deletions src/pynyaa/_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,21 @@

import sys

if sys.version_info >= (3, 11):
from enum import StrEnum
if sys.version_info >= (3, 9):
from enum import IntEnum, StrEnum
else:
from enum import IntEnum as IntEnumBase

from strenum import StrEnum

class IntEnum(IntEnumBase):
def __str__(self) -> str:
return str(self.value)


if sys.version_info >= (3, 10):
from importlib import metadata
else:
import importlib_metadata as metadata

__all__ = ("metadata", "StrEnum")
__all__ = ("metadata", "StrEnum", "IntEnum")
4 changes: 1 addition & 3 deletions src/pynyaa/_enums.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
from enum import IntEnum

from ._compat import StrEnum
from ._compat import IntEnum, StrEnum


class NyaaCategory(StrEnum):
Expand Down

0 comments on commit 69d0645

Please sign in to comment.