debug.py 899 B

1234567891011121314151617181920212223242526272829
  1. """Module containing the logic for our debugging logic."""
  2. import platform
  3. from typing import Any
  4. from typing import Dict
  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. }