Insufficient combination when filter function is specified?
See original GitHub issueHello, thank you for providing a great library! I tried to use filter function to cut invalid combination, but it seems generated combinations are insufficient.
# Generate combinations of every supported Python + NumPy version combination.
from allpairspy import AllPairs
numpy = ['1.9', '1.10', '1.11', '1.12', '1.13', '1.14']
python = ['2.7', '3.4', '3.5', '3.6']
def _validate(numpy, python):
valid = []
if numpy == '1.9':
valid = ['2.7', '3.4']
elif numpy == '1.10':
valid = ['2.7', '3.4']
elif numpy == '1.11':
valid = ['2.7', '3.4', '3.5']
elif numpy == '1.12':
valid = ['2.7', '3.4', '3.5', '3.6']
elif numpy == '1.13':
valid = ['2.7', '3.4', '3.5', '3.6']
elif numpy == '1.14':
valid = ['2.7', '3.4', '3.5', '3.6']
return python in valid
def _filter_func(row):
if len(row) == 2:
stat = _validate(*row)
#print('Valid? ', row, ' -> ', stat)
return stat
return True
if __name__ == '__main__':
for i, pairs in enumerate(AllPairs([numpy, python], filter_func=_filter_func)):
print(i, ':', pairs)
I got:
0 : ['1.9', '2.7']
1 : ['1.10', '2.7']
2 : ['1.11', '2.7']
3 : ['1.12', '2.7']
4 : ['1.13', '2.7']
5 : ['1.14', '2.7']
6 : ['1.14', '3.4']
7 : ['1.13', '3.4']
8 : ['1.12', '3.4']
9 : ['1.11', '3.4']
10 : ['1.10', '3.4']
11 : ['1.9', '3.4']
It seems Python 3.5/3.6 variations are totally ignored. Am I missing something? Any suggestions are welcome. Thanks in advance!
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:10 (4 by maintainers)
Top Results From Across the Web
Excel FILTER function with formula examples - Ablebits
The FILTER function in Excel is used to filter a range of data based on the criteria that you specify. The function belongs...
Read more >Filter by using advanced criteria - Microsoft Support
If the data you want to filter requires complex criteria (such as Type = "Produce" OR Salesperson = "Davolio"), you can use the...
Read more >Python's filter(): Extract Values From Iterables
Combining filter () With Other Functional Tools ... With filter() , you can apply a filtering function to an iterable and produce a...
Read more >Elegant way to combine multiple filtering functions in Haskell
Applicative (liftA2) -- given f1 etc. filtered = filter (f1 <&&> f2 ... It's unfortunate that you need to unwrap the combined predicates ......
Read more >Filtration Efficiency - an overview | ScienceDirect Topics
Filtration efficiency is usually stated in terms of the percentage of particles of a certain size that would be stopped and retained by...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@kmaehashi Thank you for your comment. That is unexpected behavior. I will check into it.
Code:
Desired Output:
Actual Output: