raise ValueError("Provide token or tokens returned by ignore_deprecations_from")
new_filters = []
+ endswith = tuple(rf"(?#support{id(token)})" for token in tokens)
for action, message, category, module, lineno in warnings.filters:
if action == "ignore" and category is DeprecationWarning:
if isinstance(message, re.Pattern):
- message = message.pattern
- if tokens:
- endswith = tuple(rf"(?#support{id(token)})" for token in tokens)
- if message.endswith(endswith):
+ msg = message.pattern
+ else:
+ msg = message or ""
+ if msg.endswith(endswith):
continue
new_filters.append((action, message, category, module, lineno))
if warnings.filters != new_filters: