Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ What's New in astroid 4.1.0?
Release date: TBA


* Add ``HTTPMethod`` enum support to brain module for Python 3.11+.

Closes #4135


What's New in astroid 4.0.2?
============================
Expand Down
13 changes: 12 additions & 1 deletion astroid/brain/brain_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,21 @@
def _http_transform() -> nodes.Module:
code = textwrap.dedent(
"""
from enum import IntEnum
from enum import IntEnum, StrEnum
from collections import namedtuple
_HTTPStatus = namedtuple('_HTTPStatus', 'value phrase description')

class HTTPMethod(StrEnum):
GET = "GET"
POST = "POST"
PUT = "PUT"
DELETE = "DELETE"
HEAD = "HEAD"
OPTIONS = "OPTIONS"
PATCH = "PATCH"
TRACE = "TRACE"
CONNECT = "CONNECT"

class HTTPStatus(IntEnum):

@property
Expand Down
Loading