Skip to content

Commit

Permalink
Use classmethod for a class method
Browse files Browse the repository at this point in the history
  • Loading branch information
AA-Turner committed Jul 30, 2024
1 parent 16fed35 commit cee9efc
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ Release 8.0.2 (in development)
Bugs fixed
----------

* Fix the ``pygments.Formatter.__class_getitem__`` patch.
Patch by Adam Turner.

Release 8.0.1 (released Jul 30, 2024)
=====================================
Expand Down
2 changes: 1 addition & 1 deletion sphinx/highlighting.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
if tuple(map(int, pygments.__version__.split('.')))[:2] < (2, 18):
from pygments.formatter import Formatter # NoQA: F811

Formatter.__class_getitem__ = lambda cls, name: cls # type: ignore[attr-defined]
Formatter.__class_getitem__ = classmethod(lambda cls, name: cls) # type: ignore[attr-defined]

logger = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion tests/test_highlighting.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

if tuple(map(int, pygments.__version__.split('.')))[:2] < (2, 18):
from pygments.formatter import Formatter
Formatter.__class_getitem__ = lambda cls, name: cls # type: ignore[attr-defined]
Formatter.__class_getitem__ = classmethod(lambda cls, name: cls) # type: ignore[attr-defined]


class MyLexer(RegexLexer):
Expand Down

0 comments on commit cee9efc

Please sign in to comment.