diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 331f2457..54b68020 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,7 +8,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - python-version: [3.7, 3.8, 3.9, '3.10'] + python-version: [3.7, 3.8, 3.9, '3.10', '3.11'] runs-on: ${{ matrix.os }} steps: - name: Clone Repository diff --git a/poetry.lock b/poetry.lock index 820daf72..2c4b7ba9 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1766,6 +1766,23 @@ files = [ lint = ["docutils-stubs", "flake8", "mypy"] test = ["pytest"] +[[package]] +name = "strenum" +version = "0.4.9" +description = "An Enum that inherits from str." +category = "main" +optional = false +python-versions = "*" +files = [ + {file = "StrEnum-0.4.9-py3-none-any.whl", hash = "sha256:c3df653030837b8077b2eb929738283481f01b07c7ef73ab4db368449830cc46"}, + {file = "StrEnum-0.4.9.tar.gz", hash = "sha256:1b15ccff9eb0e22e77b8f874366ea752754280adc9144e6e388705d14cc350e7"}, +] + +[package.extras] +docs = ["myst-parser[linkify]", "sphinx", "sphinx-rtd-theme"] +release = ["twine"] +test = ["pylint", "pytest", "pytest-black", "pytest-cov", "pytest-pylint"] + [[package]] name = "tomli" version = "2.0.1" @@ -2016,4 +2033,4 @@ testing = ["flake8 (<5)", "func-timeout", "jaraco.functools", "jaraco.itertools" [metadata] lock-version = "2.0" python-versions = "^3.7" -content-hash = "6fcc218c197f6b2fb4f52131919c658dc889bd15e3cd7168651391d3a8867777" +content-hash = "c79f81b084c8259a2b7f9cf135788418ec6766501e6def11de58a7e4be25c2b1" diff --git a/postgrest/types.py b/postgrest/types.py index 5c87f6ae..99863276 100644 --- a/postgrest/types.py +++ b/postgrest/types.py @@ -1,15 +1,20 @@ from __future__ import annotations -from enum import Enum +import sys +if sys.version_info >= (3, 11): + from enum import StrEnum +else: + from strenum import StrEnum -class CountMethod(str, Enum): + +class CountMethod(StrEnum): exact = "exact" planned = "planned" estimated = "estimated" -class Filters(str, Enum): +class Filters(StrEnum): NOT = "not" EQ = "eq" NEQ = "neq" @@ -35,7 +40,7 @@ class Filters(str, Enum): ADJ = "adj" -class RequestMethod(str, Enum): +class RequestMethod(StrEnum): GET = "GET" POST = "POST" PATCH = "PATCH" @@ -44,6 +49,6 @@ class RequestMethod(str, Enum): HEAD = "HEAD" -class ReturnMethod(str, Enum): +class ReturnMethod(StrEnum): minimal = "minimal" representation = "representation" diff --git a/pyproject.toml b/pyproject.toml index ae8ab415..b2a0b48d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -22,6 +22,7 @@ python = "^3.7" httpx = "^0.23.0" deprecation = "^2.1.0" pydantic = "^1.9.0" +strenum = "^0.4.9" [tool.poetry.dev-dependencies] pytest = "^7.1.3"