Skip to content

Commit cee9efc

Browse files
committed
Use classmethod for a class method
1 parent 16fed35 commit cee9efc

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

CHANGES.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ Release 8.0.2 (in development)
44
Bugs fixed
55
----------
66

7+
* Fix the ``pygments.Formatter.__class_getitem__`` patch.
8+
Patch by Adam Turner.
79

810
Release 8.0.1 (released Jul 30, 2024)
911
=====================================

sphinx/highlighting.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
if tuple(map(int, pygments.__version__.split('.')))[:2] < (2, 18):
3535
from pygments.formatter import Formatter # NoQA: F811
3636

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

3939
logger = logging.getLogger(__name__)
4040

tests/test_highlighting.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

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

1616

1717
class MyLexer(RegexLexer):

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy