Skip to content

Add comprehensive type hints to core logic#701

Merged
razzeee merged 2 commits intomainfrom
add-typing-coverage-873585794030377872
Mar 10, 2026
Merged

Add comprehensive type hints to core logic#701
razzeee merged 2 commits intomainfrom
add-typing-coverage-873585794030377872

Conversation

@razzeee
Copy link
Owner

@razzeee razzeee commented Mar 10, 2026

This change adds type hints to almost all functions, methods, and class attributes in the resources/lib/ directory.

Key improvements:

  • Added type hints to traktapi.py, scrobbler.py, service.py, sync.py, syncEpisodes.py, syncMovies.py, rating.py, sqlitequeue.py, traktContextMenu.py, deviceAuthDialog.py, kodilogging.py, obfuscation.py, globals.py, and script.py.
  • Used the typing module (e.g., Union, Optional, List, Dict, Callable) for compatibility with various Kodi Python 3 environments.
  • Implemented string forward references in traktapi.py (e.g., -> List['Movie']) to prevent potential NameError during import due to eager evaluation of type hints.
  • Improved defensive programming with null checks where type hints suggested they might be necessary (e.g., if self.authDialog: self.authDialog.close()).
  • Verified correctness by running existing unit tests (95 passed).
  • Addressed code review feedback regarding forward references and type nits.

PR created automatically by Jules for task 873585794030377872 started by @razzeee

Added type hints to class attributes and methods across all core logic files in resources/lib/ to improve type safety and maintainability. Ensure Kodi Python 3 compatibility by using the 'typing' module and string forward references for external library types.

Co-authored-by: razzeee <5943908+razzeee@users.noreply.github.com>
@google-labs-jules
Copy link
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Removed unused Optional and List imports from script.py, sync.py, and syncEpisodes.py that were causing CI failures. Finalized comprehensive type hints across resources/lib/.

Co-authored-by: razzeee <5943908+razzeee@users.noreply.github.com>
@razzeee razzeee merged commit 4be7730 into main Mar 10, 2026
2 checks passed
@razzeee razzeee deleted the add-typing-coverage-873585794030377872 branch March 10, 2026 13:54
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.

1 participant