style(memory): apply ruff formatting and linting fixes
Auto-fixed linting errors and formatting issues: - Removed unused imports (F401): pytest, Any, AnalysisType, MemoryType, OutcomeType - Removed unused variable (F841): hooks variable in test - Applied consistent formatting across memory service and test files 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -153,8 +153,7 @@ class TestPatternDetection:
|
||||
|
||||
# Should find recurring success pattern for 'build' task
|
||||
success_patterns = [
|
||||
p for p in patterns
|
||||
if p.pattern_type == PatternType.RECURRING_SUCCESS
|
||||
p for p in patterns if p.pattern_type == PatternType.RECURRING_SUCCESS
|
||||
]
|
||||
assert len(success_patterns) >= 1
|
||||
assert any(p.name.find("build") >= 0 for p in success_patterns)
|
||||
@@ -193,8 +192,7 @@ class TestPatternDetection:
|
||||
patterns = await reflection.analyze_patterns(project_id, time_range)
|
||||
|
||||
failure_patterns = [
|
||||
p for p in patterns
|
||||
if p.pattern_type == PatternType.RECURRING_FAILURE
|
||||
p for p in patterns if p.pattern_type == PatternType.RECURRING_FAILURE
|
||||
]
|
||||
assert len(failure_patterns) >= 1
|
||||
|
||||
@@ -229,8 +227,7 @@ class TestPatternDetection:
|
||||
patterns = await reflection.analyze_patterns(project_id, time_range)
|
||||
|
||||
action_patterns = [
|
||||
p for p in patterns
|
||||
if p.pattern_type == PatternType.ACTION_SEQUENCE
|
||||
p for p in patterns if p.pattern_type == PatternType.ACTION_SEQUENCE
|
||||
]
|
||||
assert len(action_patterns) >= 1
|
||||
|
||||
@@ -438,8 +435,7 @@ class TestAnomalyDetection:
|
||||
anomalies = await reflection.detect_anomalies(project_id, baseline_days=30)
|
||||
|
||||
duration_anomalies = [
|
||||
a for a in anomalies
|
||||
if a.anomaly_type == AnomalyType.UNUSUAL_DURATION
|
||||
a for a in anomalies if a.anomaly_type == AnomalyType.UNUSUAL_DURATION
|
||||
]
|
||||
assert len(duration_anomalies) >= 1
|
||||
|
||||
@@ -475,8 +471,7 @@ class TestAnomalyDetection:
|
||||
anomalies = await reflection.detect_anomalies(project_id, baseline_days=30)
|
||||
|
||||
outcome_anomalies = [
|
||||
a for a in anomalies
|
||||
if a.anomaly_type == AnomalyType.UNEXPECTED_OUTCOME
|
||||
a for a in anomalies if a.anomaly_type == AnomalyType.UNEXPECTED_OUTCOME
|
||||
]
|
||||
assert len(outcome_anomalies) >= 1
|
||||
|
||||
@@ -510,8 +505,7 @@ class TestAnomalyDetection:
|
||||
anomalies = await reflection.detect_anomalies(project_id, baseline_days=30)
|
||||
|
||||
token_anomalies = [
|
||||
a for a in anomalies
|
||||
if a.anomaly_type == AnomalyType.UNUSUAL_TOKEN_USAGE
|
||||
a for a in anomalies if a.anomaly_type == AnomalyType.UNUSUAL_TOKEN_USAGE
|
||||
]
|
||||
assert len(token_anomalies) >= 1
|
||||
|
||||
@@ -650,9 +644,7 @@ class TestInsightGeneration:
|
||||
|
||||
insights = await reflection.generate_insights(project_id)
|
||||
|
||||
trend_insights = [
|
||||
i for i in insights if i.insight_type == InsightType.TREND
|
||||
]
|
||||
trend_insights = [i for i in insights if i.insight_type == InsightType.TREND]
|
||||
assert len(trend_insights) >= 1
|
||||
|
||||
async def test_insights_sorted_by_priority(
|
||||
@@ -662,10 +654,7 @@ class TestInsightGeneration:
|
||||
"""Should sort insights by priority."""
|
||||
project_id = uuid4()
|
||||
|
||||
episodes = [
|
||||
create_mock_episode(outcome=Outcome.SUCCESS)
|
||||
for _ in range(10)
|
||||
]
|
||||
episodes = [create_mock_episode(outcome=Outcome.SUCCESS) for _ in range(10)]
|
||||
|
||||
mock_episodic = MagicMock()
|
||||
mock_episodic.get_recent = AsyncMock(return_value=episodes)
|
||||
|
||||
Reference in New Issue
Block a user