Skip to content

Add typing, guards, and refactors across models & routers#1017

Merged
YoshihitoAso merged 8 commits intodev-26.6from
pyright-1004
Apr 6, 2026
Merged

Add typing, guards, and refactors across models & routers#1017
YoshihitoAso merged 8 commits intodev-26.6from
pyright-1004

Conversation

@YoshihitoAso
Copy link
Copy Markdown
Member

@YoshihitoAso YoshihitoAso commented Apr 3, 2026

This pull request introduces several improvements and refactorings across the database models and contract interaction logic, focusing on type safety, error handling, and code clarity.

📌 Description

✅ Related Issues

🔄 Changes

Type Annotations and Type Safety Improvements:

  • Added or improved type annotations in many methods and class attributes, such as specifying return types and parameter types for async contract methods in personal_info.py and freeze_log.py.

Error Handling and Assertions:

  • Introduced assertions and explicit error checks for required cryptographic keys and passwords before performing sensitive operations, such as decrypting keyfiles or encrypting personal information. This ensures that missing or misconfigured secrets are caught early with clear error messages.

Refactoring and Code Clarity:

  • Used cast() from the typing module to clarify expected types when dealing with dynamic data (e.g., keyfiles, KMS results, and contract call returns), improving code readability and reducing runtime errors.
  • Improved constructor logic in models such as IDXPersonalInfo to better handle initialization with optional arguments.
  • Updated import statements for clarity and to use correct modules, such as importing decode_keyfile_json from eth_keyfile.keyfile.

📌 Checklist

  • I have added tests where necessary.
  • I have updated the documentation where necessary.

Add type annotations, runtime guards and small refactors across the codebase to improve safety and typing.
@github-actions github-actions Bot requested a review from purplesmoke05 April 3, 2026 14:02
@YoshihitoAso YoshihitoAso marked this pull request as ready for review April 3, 2026 14:15
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 3, 2026

Coverage

Tests Skipped Failures Errors Time
2500 0 💤 0 ❌ 0 🔥 14m 46s ⏱️

Replace bulk SemaphoreTaskGroup.run(...) tuple-based calls with an explicit async with SemaphoreTaskGroup and individual create_task calls for each contract function in app/model/ibet/token.py.
Remove the custom __init__ that popped a 'personal_info' kwarg and assigned it to self.personal_info.
@YoshihitoAso YoshihitoAso merged commit d50e4e3 into dev-26.6 Apr 6, 2026
8 checks passed
@YoshihitoAso YoshihitoAso deleted the pyright-1004 branch April 6, 2026 00:50
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.

[Pyright] Fix type errors in contract models and issuer core support modules

2 participants