_deprecate.py 743 B

12345678910111213141516171819202122232425
  1. """
  2. Support similar deprecation of several reactors.
  3. """
  4. import warnings
  5. from incremental import Version, getVersionString
  6. from twisted.python.deprecate import DEPRECATION_WARNING_FORMAT
  7. def deprecatedGnomeReactor(name: str, version: Version) -> None:
  8. """
  9. Emit a deprecation warning about a gnome-related reactor.
  10. @param name: The name of the reactor. For example, C{"gtk2reactor"}.
  11. @param version: The version in which the deprecation was introduced.
  12. """
  13. stem = DEPRECATION_WARNING_FORMAT % {
  14. "fqpn": "twisted.internet." + name,
  15. "version": getVersionString(version),
  16. }
  17. msg = stem + ". Please use twisted.internet.gireactor instead."
  18. warnings.warn(msg, category=DeprecationWarning)