debug.py 911 B

123456789101112131415161718192021222324252627282930
  1. """Module containing the logic for our debugging logic."""
  2. from __future__ import annotations
  3. import platform
  4. from typing import Any
  5. from flake8.plugins.finder import Plugins
  6. def information(version: str, plugins: Plugins) -> dict[str, Any]:
  7. """Generate the information to be printed for the bug report."""
  8. versions = sorted(
  9. {
  10. (loaded.plugin.package, loaded.plugin.version)
  11. for loaded in plugins.all_plugins()
  12. if loaded.plugin.package not in {"flake8", "local"}
  13. }
  14. )
  15. return {
  16. "version": version,
  17. "plugins": [
  18. {"plugin": plugin, "version": version}
  19. for plugin, version in versions
  20. ],
  21. "platform": {
  22. "python_implementation": platform.python_implementation(),
  23. "python_version": platform.python_version(),
  24. "system": platform.system(),
  25. },
  26. }