-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathnumpy_filters.yml
64 lines (55 loc) · 1.22 KB
/
numpy_filters.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
---
# Test filter_plugins/numpy_filters
- name: numpy_filters
hosts: localhost
gather_facts: false
vars:
arr1:
- [1, 2, 3]
- [4, 5, 6]
- [7, 8, 9]
arr2:
- [1, 4, 7]
- [2, 5, 8]
- [3, 6, 9]
arr3: [a, b, c, d, e]
idx: [1, 3, 4]
tasks:
# numpy_transpose
- block:
- debug:
var: arr1|to_yaml
when: debug|d(false)|bool
- debug:
var: arr|to_yaml
when: debug|d(false)|bool
- name: numpy_transpose
assert:
that: arr == result
vars:
arr: "{{ arr1|numpy_transpose }}"
result:
- [1, 4, 7]
- [2, 5, 8]
- [3, 6, 9]
tags: numpy_transpose
# numpy_array_by_idx
- block:
- debug:
var: arr3|to_yaml
when: debug|d(false)|bool
- debug:
var: idx|to_yaml
when: debug|d(false)|bool
- debug:
var: arr|to_yaml
when: debug|d(false)|bool
- name: numpy_array_by_idx
assert:
that: arr == result
vars:
arr: "{{ arr3|numpy_array_by_idx(idx) }}"
result: [b, d, e]
tags: numpy_array_by_idx
# EOF
...