Skip to content

Commit 0bcefab

Browse files
For-Sunnyclaude
andcommitted
Fix CI: resolve mypy type errors in config.py and server.py
- config.py: Add default empty string to os.getenv calls used with Path() - server.py: Add Optional[] to threshold, min_val, max_val parameters - server.py: Add _decay_engine type hint to HebbianMindDatabase.__init__ - server.py: Add Dict type annotation to by_category variable Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 7028dce commit 0bcefab

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

src/hebbian_mind/config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ class Config:
8282
RAM_DISK_ENABLED: bool = os.getenv("HEBBIAN_MIND_RAM_DISK", "false").lower() == "true"
8383
RAM_DATA_DIR: Optional[Path] = (
8484
(
85-
Path(os.getenv("HEBBIAN_MIND_RAM_DIR"))
85+
Path(os.getenv("HEBBIAN_MIND_RAM_DIR", ""))
8686
if os.getenv("HEBBIAN_MIND_RAM_DIR")
8787
else _get_default_ram_dir()
8888
)
@@ -99,7 +99,7 @@ class Config:
9999
# PRECOG concept extractor integration (optional)
100100
PRECOG_ENABLED: bool = os.getenv("HEBBIAN_MIND_PRECOG_ENABLED", "false").lower() == "true"
101101
PRECOG_PATH: Optional[Path] = (
102-
Path(os.getenv("HEBBIAN_MIND_PRECOG_PATH"))
102+
Path(os.getenv("HEBBIAN_MIND_PRECOG_PATH", ""))
103103
if os.getenv("HEBBIAN_MIND_PRECOG_PATH")
104104
else None
105105
)

src/hebbian_mind/server.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ def __init__(self):
9595
self._in_transaction = False
9696
self._coactivation_count = 0
9797
self._lock = threading.RLock() # Serialize all DB access across threads
98+
self._decay_engine: Optional[HebbianDecayEngine] = None
9899

99100
self._init_connections()
100101
self._init_schema()
@@ -500,7 +501,7 @@ def get_node_by_name(self, name: str) -> Optional[Dict]:
500501
row = cursor.fetchone()
501502
return dict(row) if row else None
502503

503-
def analyze_content(self, content: str, threshold: float = None) -> List[Dict]:
504+
def analyze_content(self, content: str, threshold: Optional[float] = None) -> List[Dict]:
504505
"""Analyze content and return activated nodes.
505506
506507
Enhanced with PRECOG ConceptExtractor (optional):
@@ -1124,7 +1125,9 @@ def _validate_string(value: Any, name: str, max_length: int = 100000) -> str:
11241125
return value
11251126

11261127

1127-
def _validate_number(value: Any, name: str, min_val: float = None, max_val: float = None) -> float:
1128+
def _validate_number(
1129+
value: Any, name: str, min_val: Optional[float] = None, max_val: Optional[float] = None
1130+
) -> float:
11281131
"""Validate and return a numeric parameter."""
11291132
if not isinstance(value, (int, float)):
11301133
raise ValueError(f"{name} must be a number, got {type(value).__name__}")
@@ -1420,7 +1423,7 @@ async def call_tool(name: str, arguments: Dict) -> List[types.TextContent]:
14201423
if category:
14211424
nodes = [n for n in nodes if n["category"] == category]
14221425

1423-
by_category = {}
1426+
by_category: Dict[str, List[Dict[str, Any]]] = {}
14241427
for node in nodes:
14251428
cat = node["category"]
14261429
if cat not in by_category:

0 commit comments

Comments
 (0)