diff --git a/ChangeLog b/ChangeLog index 6c662b9bd..37c4366eb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -23,6 +23,10 @@ Release date: TBA Refs #2860 +* Add ``HTTPMethod`` enum support to brain module for Python 3.11+. + + Closes #4135 + What's New in astroid 4.0.2? ============================ diff --git a/astroid/brain/brain_http.py b/astroid/brain/brain_http.py index e4b6bca63..9802c0f7e 100644 --- a/astroid/brain/brain_http.py +++ b/astroid/brain/brain_http.py @@ -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