mirror of
https://github.com/Alishahryar1/free-claude-code.git
synced 2026-05-04 22:30:38 +00:00
ci: enhance type checking in workflow and improve test coverage
- Added a step to fail the CI if any '# type: ignore' comments are found in Python files. - Refactored tests to use mocking for better isolation and reliability. - Updated type hints and casting in several files to improve type safety.
This commit is contained in:
parent
97217debfa
commit
0d292cd578
6 changed files with 41 additions and 12 deletions
|
|
@ -5,7 +5,7 @@ Contains token counting for API requests.
|
|||
|
||||
import json
|
||||
import logging
|
||||
from typing import Any, List, Optional, Union
|
||||
from typing import Any, List, Optional, Union, cast
|
||||
|
||||
import tiktoken
|
||||
|
||||
|
|
@ -18,7 +18,7 @@ __all__ = ["get_token_count"]
|
|||
def _get_block_attr(block: object, key: str, default: Any = "") -> Any:
|
||||
"""Get attribute from block (object or dict)."""
|
||||
if isinstance(block, dict):
|
||||
return block.get(key, default) # type: ignore[no-matching-overload]
|
||||
return cast(dict[str, Any], block).get(key, default)
|
||||
return getattr(block, key, default)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue