Skip to content

Conversation

@Dprof-in-tech
Copy link

closes #110

This pull request primarily improves type annotation clarity and code maintainability by updating or refining type ignore comments throughout the codebase. It also expands the AgentPerformanceMetrics model with additional attributes and clarifies fallback patterns for optional dependencies. The changes help future maintainers understand the reasons behind type ignores and improve the robustness of model definitions.

Type annotation and ignore comment improvements:

  • Updated type: ignore comments across many files to specify the reason (e.g., missing/incomplete type stubs for libraries like fitz, dulwich, slack_sdk, tweepy, or dynamic model creation in Pydantic), making the codebase easier to maintain and debug. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11]

Model and data structure enhancements:

  • Expanded the AgentPerformanceMetrics model to include new fields such as accuracy_history, confidence_calibration, specialization_score, collaboration_rating, bias_indicators, and domain_expertise, providing a more comprehensive view of agent performance.
  • Updated docstrings and class comments for models using fallback patterns for optional dependencies, clarifying intent and usage. [1] [2] [3] [4] [5] [6] [7]

Bug fixes and code simplification:

  • Removed unnecessary or incorrect type ignores in agent and coordinator classes, and simplified property return types for clarity. [1] [2] [3]
  • Fixed logic in consensus resolution to avoid unnecessary type ignores and ensure correct selection of values and agents. [1] [2]

Other improvements:

  • Added a missing check for account address configuration in the on-chain contract poster, improving error handling.
  • Updated dynamic Pydantic model creation to clarify the reason for type ignores.

List of Remaining Suppressions with Reasons
All 31 type suppressions are now properly categorized and justified:

Missing Type Stubs (External Libraries)
7 suppressions for fitz (PyMuPDF) - [reportMissingTypeStubs] and [attr-defined]
3 suppressions for tweepy - [reportMissingTypeStubs], [arg-type], [attr-defined]
2 suppressions for slack_sdk - [attr-defined]
1 suppression for dulwich - [attr-defined]
1 suppression for pytesseract - [reportMissingTypeStubs]
1 suppression for google-genai client - [arg-type]

Optional Dependencies
2 suppressions for pydantic_ai - [import-untyped] (optional AI framework)

Framework Patterns
8 suppressions for BaseModel fallback patterns - [misc] (pydantic optional dependency pattern)
1 suppression for Pydantic dynamic model creation - [call-arg]
1 suppression for ADK decorator unwrapping - [attr-defined]

@dineshpinto
Copy link
Member

Hi @Dprof-in-tech , can you fix the pyright errors in CI

@Dprof-in-tech
Copy link
Author

alright let me take a look at that

@Dprof-in-tech
Copy link
Author

@dineshpinto, fixed it

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.

[QA] Replace blanket type: ignore with precise typing (or real types)

2 participants