You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Check whether the element is None or a callable.
570
+
ifitemisNone:
573
571
pass
572
+
elifitemandcallable(item):
573
+
ifitem.__code__.co_argcount==1:
574
+
# Every callable is valid if it receives a single argument.
575
+
# This argument represents the solution.
576
+
pass
577
+
else:
578
+
self.valid_parameters=False
579
+
raiseValueError(f"Every callable inside the gene_constraint parameter must accept a single argument representing the solution/chromosome. But the callable at index {constraint_idx} named '{item.__code__.co_name}' accepts {item.__code__.co_argcount} argument(s).")
574
580
else:
575
581
self.valid_parameters=False
576
-
raiseValueError(f"Every callable inside the gene_constraint parameter must accept a single argument representing the solution/chromosome. But the callable at index {constraint_idx}named '{item.__code__.co_name}' accepts {item.__code__.co_argcount} argument(s).")
577
-
else:
578
-
self.valid_parameters=False
579
-
raiseTypeError(f"The expected type of an element in the 'gene_constraint' parameter is None or a callable (e.g. function). But {item} at index {constraint_idx}of type {type(item)} found.")
582
+
raiseTypeError(f"The expected type of an element in the 'gene_constraint' parameter is None or a callable (e.g. function). But {item}at index {constraint_idx}of type {type(item)} found.")
583
+
else:
584
+
self.valid_parameters=False
585
+
raiseValueError(f"The number of constrains ({len(gene_constraint)}) in the 'gene_constraint' parameter must be equal to the number of genes ({self.num_genes}).")
580
586
else:
581
587
self.valid_parameters=False
582
-
raiseTypeError(f"The expected type of the 'gene_constraint' parameter is either list or tuple. But the value {gene_constraint} of type {type(gene_constraint)} found.")
588
+
raiseTypeError(f"The expected type of the 'gene_constraint' parameter is either a list or tuple. But the value {gene_constraint} of type {type(gene_constraint)} found.")
0 commit comments