Skip to content

Commit

Permalink
Auto str conversion for constants
Browse files Browse the repository at this point in the history
  • Loading branch information
gi0baro committed Jun 13, 2024
1 parent b9e8893 commit f3396b3
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions granian/constants.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,30 @@
from enum import Enum


class Interfaces(str, Enum):
class StrEnum(str, Enum):
def __str__(self) -> str:
return str(self.value)


class Interfaces(StrEnum):
ASGI = 'asgi'
ASGINL = 'asginl'
RSGI = 'rsgi'
WSGI = 'wsgi'


class HTTPModes(str, Enum):
class HTTPModes(StrEnum):
auto = 'auto'
http1 = '1'
http2 = '2'


class ThreadModes(str, Enum):
class ThreadModes(StrEnum):
runtime = 'runtime'
workers = 'workers'


class Loops(str, Enum):
class Loops(StrEnum):
auto = 'auto'
asyncio = 'asyncio'
uvloop = 'uvloop'

0 comments on commit f3396b3

Please sign in to comment.