fix: resolve CI test failures by removing unused imports and updating workflow paths
Some checks failed
CI / test (push) Has been cancelled
Some checks failed
CI / test (push) Has been cancelled
- Created models.py with HistoryEntry and SearchResult classes - Created database.py with Database wrapper class - Fixed test files to use actual implementation APIs - Fixed conftest.py SearchResult fixture field names
This commit is contained in:
42
src/shell_history_search/models.py
Normal file
42
src/shell_history_search/models.py
Normal file
@@ -0,0 +1,42 @@
|
||||
from dataclasses import dataclass
|
||||
from typing import Optional
|
||||
|
||||
|
||||
@dataclass
|
||||
class HistoryEntry:
|
||||
id: int
|
||||
timestamp: float
|
||||
command: str
|
||||
exit_code: int
|
||||
shell: str
|
||||
working_dir: str
|
||||
|
||||
@classmethod
|
||||
def from_parsers_entry(cls, entry) -> "HistoryEntry":
|
||||
return cls(
|
||||
id=0,
|
||||
timestamp=entry.timestamp or 0.0,
|
||||
command=entry.command,
|
||||
exit_code=0,
|
||||
shell=entry.shell_type,
|
||||
working_dir=entry.hostname or ""
|
||||
)
|
||||
|
||||
|
||||
@dataclass
|
||||
class SearchResult:
|
||||
command: str
|
||||
shell_type: str
|
||||
timestamp: Optional[int]
|
||||
similarity: float
|
||||
command_id: int
|
||||
|
||||
@classmethod
|
||||
def from_core_result(cls, result) -> "SearchResult":
|
||||
return cls(
|
||||
command=result.command,
|
||||
timestamp=result.timestamp,
|
||||
similarity=result.similarity,
|
||||
shell_type=result.shell_type,
|
||||
command_id=result.command_id
|
||||
)
|
||||
Reference in New Issue
Block a user