@@ -721,7 +721,7 @@ def new_int_var_series(
721721 if not isinstance (index , pd .Index ):
722722 raise TypeError ("Non-index object is used as index" )
723723 if not name .isidentifier ():
724- raise ValueError (f"name={ name } is not a valid identifier" )
724+ raise ValueError (f"name={ name !r } is not a valid identifier" )
725725 if (
726726 isinstance (lower_bounds , IntegralTypes )
727727 and isinstance (upper_bounds , IntegralTypes )
@@ -775,7 +775,7 @@ def new_bool_var_series(
775775 if not isinstance (index , pd .Index ):
776776 raise TypeError ("Non-index object is used as index" )
777777 if not name .isidentifier ():
778- raise ValueError (f"name={ name } is not a valid identifier" )
778+ raise ValueError (f"name={ name !r } is not a valid identifier" )
779779 return pd .Series (
780780 index = index ,
781781 data = [
@@ -824,17 +824,9 @@ def add_linear_expression_in_domain(
824824 else :
825825 return self .add_bool_and ([]) # Evaluate to true.
826826 raise TypeError (
827- "not supported: CpModel.add_linear_expression_in_domain("
828- + str (linear_expr )
829- + " "
830- + str (type (linear_expr ))
831- + " "
832- + str (linear_expr .is_integer ())
833- + " "
834- + str (domain )
835- + " "
836- + str (type (domain ))
837- + ")"
827+ f"not supported: CpModel.add_linear_expression_in_domain({ linear_expr } "
828+ f" { type (linear_expr )} { linear_expr .is_integer ()} { domain } "
829+ f"{ type (domain )} "
838830 )
839831
840832 def add (self , ct : Union [BoundedLinearExpression , bool , np .bool_ ]) -> Constraint :
@@ -1642,7 +1634,7 @@ def new_interval_var_series(
16421634 if not isinstance (index , pd .Index ):
16431635 raise TypeError ("Non-index object is used as index" )
16441636 if not name .isidentifier ():
1645- raise ValueError (f"name={ name } is not a valid identifier" )
1637+ raise ValueError (f"name={ name !r } is not a valid identifier" )
16461638
16471639 starts = _convert_to_linear_expr_series_and_validate_index (starts , index )
16481640 sizes = _convert_to_linear_expr_series_and_validate_index (sizes , index )
@@ -1715,7 +1707,7 @@ def new_fixed_size_interval_var_series(
17151707 if not isinstance (index , pd .Index ):
17161708 raise TypeError ("Non-index object is used as index" )
17171709 if not name .isidentifier ():
1718- raise ValueError (f"name={ name } is not a valid identifier" )
1710+ raise ValueError (f"name={ name !r } is not a valid identifier" )
17191711
17201712 starts = _convert_to_linear_expr_series_and_validate_index (starts , index )
17211713 sizes = _convert_to_integral_series_and_validate_index (sizes , index )
@@ -1819,7 +1811,7 @@ def new_optional_interval_var_series(
18191811 if not isinstance (index , pd .Index ):
18201812 raise TypeError ("Non-index object is used as index" )
18211813 if not name .isidentifier ():
1822- raise ValueError (f"name={ name } is not a valid identifier" )
1814+ raise ValueError (f"name={ name !r } is not a valid identifier" )
18231815
18241816 starts = _convert_to_linear_expr_series_and_validate_index (starts , index )
18251817 sizes = _convert_to_linear_expr_series_and_validate_index (sizes , index )
@@ -1913,7 +1905,7 @@ def new_optional_fixed_size_interval_var_series(
19131905 if not isinstance (index , pd .Index ):
19141906 raise TypeError ("Non-index object is used as index" )
19151907 if not name .isidentifier ():
1916- raise ValueError (f"name={ name } is not a valid identifier" )
1908+ raise ValueError (f"name={ name !r } is not a valid identifier" )
19171909
19181910 starts = _convert_to_linear_expr_series_and_validate_index (starts , index )
19191911 sizes = _convert_to_integral_series_and_validate_index (sizes , index )
@@ -2857,7 +2849,8 @@ def on_solution_callback(self) -> None:
28572849 obj = self .objective_value
28582850 print (
28592851 f"Solution { self .__solution_count } , time ="
2860- f" { current_time - self .__start_time :0.2f} s, objective = { obj } "
2852+ f" { current_time - self .__start_time :0.2f} s, objective = { obj } " ,
2853+ flush = True ,
28612854 )
28622855 self .__solution_count += 1
28632856
@@ -2885,7 +2878,7 @@ def on_solution_callback(self) -> None:
28852878 )
28862879 for v in self .__variables :
28872880 print (f" { v } = { self .value (v )} " , end = " " )
2888- print ()
2881+ print (flush = True )
28892882 self .__solution_count += 1
28902883
28912884 @property
@@ -2912,7 +2905,7 @@ def on_solution_callback(self) -> None:
29122905 )
29132906 for v in self .__variables :
29142907 print (f" { v } = { self .value (v )} " , end = " " )
2915- print ()
2908+ print (flush = True )
29162909 self .__solution_count += 1
29172910
29182911 @property
0 commit comments