Skip to content
This repository was archived by the owner on Jul 17, 2024. It is now read-only.

Commit 1f742fe

Browse files
committed
fix: address PR comments
1 parent 358d7f5 commit 1f742fe

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

tests/test_solution_manager.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ def assert_score_analysis(problem: Solution, score_analysis: ScoreAnalysis):
141141

142142

143143
def assert_score_analysis_summary(score_analysis: ScoreAnalysis):
144-
summary = score_analysis.summarize()
144+
summary = score_analysis.summary
145145
assert "Explanation of score (3):" in summary
146146
assert "Constraint matches:" in summary
147147
assert "3: constraint (Maximize Value) has 3 matches:" in summary
@@ -151,7 +151,7 @@ def assert_score_analysis_summary(score_analysis: ScoreAnalysis):
151151
assert summary == summary_str
152152

153153
match = score_analysis.constraint_analyses[0]
154-
match_summary = match.summarize()
154+
match_summary = match.summary
155155
assert "Explanation of score (3):" in match_summary
156156
assert "Constraint matches:" in match_summary
157157
assert "3: constraint (Maximize Value) has 3 matches:" in match_summary

timefold-solver-python-core/src/main/python/score/_score_analysis.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ class ConstraintAnalysis(Generic[Score_]):
462462
but still non-zero constraint weight; non-empty if constraint has matches.
463463
This is a list to simplify access to individual elements,
464464
but it contains no duplicates just like `set` wouldn't.
465-
summarize : str
465+
summary : str
466466
Returns a diagnostic text
467467
that explains part of the score quality through the ConstraintAnalysis API.
468468
match_count : int
@@ -475,7 +475,7 @@ def __init__(self, delegate: '_JavaConstraintAnalysis[Score_]'):
475475
delegate.constraintRef()
476476

477477
def __str__(self):
478-
return self.summarize()
478+
return self.summary
479479

480480
@property
481481
def constraint_ref(self) -> ConstraintRef:
@@ -507,7 +507,8 @@ def match_count(self) -> int:
507507
def score(self) -> Score_:
508508
return to_python_score(self._delegate.score())
509509

510-
def summarize(self) -> str:
510+
@property
511+
def summary(self) -> str:
511512
return self._delegate.summarize()
512513

513514

@@ -541,7 +542,7 @@ class ScoreAnalysis:
541542
constraint_analyses : list[ConstraintAnalysis]
542543
Individual ConstraintAnalysis instances that make up this ScoreAnalysis.
543544
544-
summarize : str
545+
summary : str
545546
Returns a diagnostic text that explains the solution through the `ConstraintAnalysis` API to identify which
546547
Constraints cause that score quality.
547548
The string is built fresh every time the method is called.
@@ -566,7 +567,7 @@ def __init__(self, delegate: '_JavaScoreAnalysis'):
566567
self._delegate = delegate
567568

568569
def __str__(self):
569-
return self.summarize()
570+
return self.summary
570571

571572
def __sub__(self, other):
572573
return self.diff(other)
@@ -621,7 +622,8 @@ def constraint_analysis(self, *args) -> ConstraintAnalysis:
621622
else:
622623
return ConstraintAnalysis(self._delegate.getConstraintAnalysis(args[0], args[1]))
623624

624-
def summarize(self) -> str:
625+
@property
626+
def summary(self) -> str:
625627
return self._delegate.summarize()
626628

627629
@property

0 commit comments

Comments
 (0)