Skip to content

Commit d470e8b

Browse files
author
ChidcGithub
committed
Fix mypy type errors
- Add explicit Dict[str, Any] type for log_data in CognitiveLogger - Add cast() for QuantizationConfig.bits type safety - Add str() for description type safety
1 parent 2ff0dd5 commit d470e8b

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

codegnipy/observability.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ def _format_message(
168168
**kwargs
169169
) -> str:
170170
"""格式化日志消息"""
171-
log_data = {
171+
log_data: Dict[str, Any] = {
172172
"level": level.value,
173173
"logger": self.name,
174174
"message": message,

codegnipy/providers.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import asyncio
88
from abc import ABC, abstractmethod
99
from dataclasses import dataclass, field
10-
from typing import Optional, List, Dict, Any, AsyncIterator, Iterator, TYPE_CHECKING
10+
from typing import Optional, List, Dict, Any, AsyncIterator, Iterator, TYPE_CHECKING, cast
1111
from enum import Enum
1212
import json
1313

@@ -1378,8 +1378,8 @@ def __init__(
13781378
)
13791379

13801380
method_info = self.QUANTIZATION_METHODS[self.method]
1381-
self.bits = bits or method_info["bits"]
1382-
self.description = method_info["description"]
1381+
self.bits: int = bits if bits is not None else cast(int, method_info["bits"])
1382+
self.description = str(method_info["description"])
13831383
self.group_size = group_size
13841384
self.activation_bits = activation_bits
13851385

0 commit comments

Comments
 (0)