-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
working on values - product and permutations
- Loading branch information
Showing
4 changed files
with
84 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import itertools | ||
from value import Value | ||
|
||
class Values: | ||
@staticmethod | ||
def And(*value_groups): | ||
""" | ||
Combines arrays of Value objects to generate new Value objects for all combinations. | ||
Args: | ||
value_groups: Lists of Value objects to combine. | ||
Returns: | ||
A list of Value objects representing all combinations. | ||
""" | ||
|
||
combinations = itertools.product(*value_groups) | ||
|
||
result = [] | ||
for combo in combinations: | ||
permutations = itertools.permutations(combo) | ||
|
||
for perm in permutations: | ||
combined_name = [] | ||
for value in perm: | ||
combined_name.append(value.generate_name) | ||
|
||
print(combined_name) | ||
|
||
print(combo) | ||
combined_value = Value() | ||
combined_value.set_generate_name(" ".join(combined_name)) | ||
|
||
print(combined_value.generate_name) | ||
result.append(combined_value) | ||
|
||
return result |