Skip to content

Conversation

@shbhmexe
Copy link
Contributor

@shbhmexe shbhmexe commented Dec 1, 2025

Summary

This PR fixes Python 2 to Python 3 compatibility issues by replacing all remaining instances of the deprecated dict.iteritems() method with dict.items() and updating related print statements to use Python 3's print() function.

Changes Made

Fixed iteritems() deprecation in 3 files:

  1. src/csvdump.py (line 56): Replaced patch.filetypes.iteritems() with patch.filetypes.items()
  2. src/database.py (line 151): Replaced patch.files.iteritems() with patch.files.items()
  3. src/reports.py (lines 545, 561, 569, 576): Replaced 4 instances of iteritems() with items() in the ReportByFileType function

Updated print statements in src/reports.py:

  • Converted Python 2 print statements to Python 3 print() function calls (5 occurrences in lines 560, 562, 570, 572, 577)

Rationale

The iteritems() method was removed in Python 3. Using items() ensures:

  • Python 3 compatibility: Code runs without errors on Python 3.x
  • Python 2.7+ compatibility: items() is available in Python 2.7+
  • Future-proofing: Prepares codebase for Python 2 EOL

Testing

✅ Syntax validation passed for all modified files using python -m py_compile
✅ No functional changes - only syntax updates

Impact

  • Breaking changes: None
  • Functional changes: None
  • Compatibility: Improves Python 3 support without breaking Python 2.7 compatibility

Checklist:

  • Synced with latest upstream/master
  • No merge conflicts with recent changes
  • Syntax validated on all modified files
  • DCO sign-off included in commit message
  • Changes maintain existing functionality

…mpatibility

Replace all instances of the deprecated dict.iteritems() method with
dict.items() for Python 3 compatibility across core data processing files.
Also update print statements to print() functions in affected code sections.

Files modified:
- src/csvdump.py: Replace iteritems() with items() in patch file type iteration
- src/database.py: Replace iteritems() with items() in file data iteration
- src/reports.py: Replace iteritems() with items() and update print statements
  in ReportByFileType function (4 occurrences)

This change ensures the codebase is fully compatible with Python 3 while
maintaining backward compatibility. The iteritems() method was removed in
Python 3 and items() provides equivalent functionality in both Python 2.7+
and Python 3.x.

Impact: No functional changes, only syntax updates for Python 3 compatibility.
All existing functionality remains intact.

Signed-off-by: shbhmexe <[email protected]>
Copy link
Contributor

@TerryHowe TerryHowe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants