mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix asset class string interface membership testing
This commit is contained in:
parent
8512855776
commit
49dc0dd399
3
CHANGES
3
CHANGES
@ -4,6 +4,9 @@ Release 7.2.2 (in development)
|
||||
Bugs fixed
|
||||
----------
|
||||
|
||||
* Fixed membership testing (``in``) for the :py:class:`str` interface
|
||||
of the asset classes (``_CascadingStyleSheet`` and ``_JavaScript``),
|
||||
which several extensions relied upon.
|
||||
|
||||
Release 7.2.1 (released Aug 17, 2023)
|
||||
=====================================
|
||||
|
@ -36,6 +36,10 @@ class _CascadingStyleSheet:
|
||||
f'{attr})')
|
||||
|
||||
def __eq__(self, other):
|
||||
if isinstance(other, str):
|
||||
warnings.warn('The str interface for _CascadingStyleSheet objects is deprecated. '
|
||||
'Use css.filename instead.', RemovedInSphinx90Warning, stacklevel=2)
|
||||
return self.filename == other
|
||||
if not isinstance(other, _CascadingStyleSheet):
|
||||
return NotImplemented
|
||||
return (self.filename == other.filename
|
||||
@ -88,6 +92,10 @@ class _JavaScript:
|
||||
f'{attr})')
|
||||
|
||||
def __eq__(self, other):
|
||||
if isinstance(other, str):
|
||||
warnings.warn('The str interface for _JavaScript objects is deprecated. '
|
||||
'Use js.filename instead.', RemovedInSphinx90Warning, stacklevel=2)
|
||||
return self.filename == other
|
||||
if not isinstance(other, _JavaScript):
|
||||
return NotImplemented
|
||||
return (self.filename == other.filename
|
||||
|
Loading…
Reference in New Issue
Block a user