@@ -122,18 +122,18 @@ def perform_group_by(constraint_stream, package, group_by_args, *type_arguments)
122
122
created_collector = extract_collector (collector_info , * type_arguments )
123
123
actual_group_by_args .append (created_collector )
124
124
125
- if len (group_by_args ) == 1 :
125
+ if len (group_by_args ) is 1 :
126
126
return UniConstraintStream (constraint_stream .groupBy (* actual_group_by_args ), package ,
127
127
JClass ('java.lang.Object' ))
128
- elif len (group_by_args ) == 2 :
128
+ elif len (group_by_args ) is 2 :
129
129
return BiConstraintStream (constraint_stream .groupBy (* actual_group_by_args ), package ,
130
130
JClass ('java.lang.Object' ),
131
131
JClass ('java.lang.Object' ))
132
- elif len (group_by_args ) == 3 :
132
+ elif len (group_by_args ) is 3 :
133
133
return TriConstraintStream (constraint_stream .groupBy (* actual_group_by_args ), package ,
134
134
JClass ('java.lang.Object' ),
135
135
JClass ('java.lang.Object' ), JClass ('java.lang.Object' ))
136
- elif len (group_by_args ) == 4 :
136
+ elif len (group_by_args ) is 4 :
137
137
return QuadConstraintStream (constraint_stream .groupBy (* actual_group_by_args ), package ,
138
138
JClass ('java.lang.Object' ),
139
139
JClass ('java.lang.Object' ), JClass ('java.lang.Object' ),
@@ -1107,27 +1107,28 @@ def load_balance(balanced_item_function, load_function=None, initial_load_functi
1107
1107
1108
1108
Parameters
1109
1109
----------
1110
- balanced_item_function:
1110
+ balanced_item_function: Callable[[ParameterTypes, ...], Balanced_]
1111
1111
The function that returns the item which should be load-balanced.
1112
- load_function:
1112
+ load_function: Callable[[ParameterTypes, ...], int]
1113
1113
How much the item should count for in the formula.
1114
- initial_load_function:
1114
+ initial_load_function: Callable[[ParameterTypes, ...], int]
1115
1115
The initial value of the metric, allowing to provide initial state
1116
1116
without requiring the entire previous planning windows in the working memory.
1117
1117
If this function is provided, load_function must be provided as well.
1118
1118
"""
1119
- if None == load_function == initial_load_function :
1119
+ if load_function is None and initial_load_function is None :
1120
1120
return LoadBalanceCollector (ConstraintCollectors ._delegate ().loadBalance , balanced_item_function , None ,
1121
1121
None )
1122
- elif None == initial_load_function :
1122
+ elif initial_load_function is None :
1123
1123
return LoadBalanceCollector (ConstraintCollectors ._delegate ().loadBalance , balanced_item_function ,
1124
1124
load_function , None )
1125
- elif None == load_function :
1125
+ elif load_function is None :
1126
1126
raise ValueError ("load_function cannot be None if initial_load_function is not None" )
1127
1127
else :
1128
1128
return LoadBalanceCollector (ConstraintCollectors ._delegate ().loadBalance , balanced_item_function ,
1129
1129
load_function , initial_load_function )
1130
1130
1131
+
1131
1132
# Must be at the bottom, constraint_stream depends on this module
1132
1133
from ._constraint_stream import *
1133
1134
from ._function_translator import *
0 commit comments