This reverts commit 99a6627c60
.
* ci_complete
This commit is contained in:
parent
88d6a72178
commit
af7f3fc266
4 changed files with 0 additions and 26 deletions
|
@ -1,3 +0,0 @@
|
|||
minor_changes:
|
||||
- add filter duplicated that will return duplicate items from a list.
|
||||
(https://github.com/ansible/ansible/pull/72729/)
|
|
@ -978,14 +978,6 @@ To get the symmetric difference of 2 lists (items exclusive to each list)::
|
|||
{{ list1 | symmetric_difference(list2) }}
|
||||
# => [10, 11, 99]
|
||||
|
||||
To get the duplicate values from a list (the resulting list contains unique duplicates)::
|
||||
|
||||
.. versionadded:: 2.11
|
||||
|
||||
# list1: [1, 2, 5, 1, 3, 4, 10, 'a', 'z', 'a']
|
||||
{{ list1 | duplicated }}
|
||||
# => [1, 'a']
|
||||
|
||||
.. _math_stuff:
|
||||
|
||||
Calculating numbers (math)
|
||||
|
|
|
@ -26,7 +26,6 @@ __metaclass__ = type
|
|||
import itertools
|
||||
import math
|
||||
|
||||
from collections import Counter
|
||||
from jinja2.filters import environmentfilter
|
||||
|
||||
from ansible.errors import AnsibleFilterError, AnsibleFilterTypeError
|
||||
|
@ -87,11 +86,6 @@ def unique(environment, a, case_sensitive=False, attribute=None):
|
|||
return c
|
||||
|
||||
|
||||
@environmentfilter
|
||||
def duplicated(environment, a):
|
||||
return [k for k, v in Counter(a).items() if v > 1]
|
||||
|
||||
|
||||
@environmentfilter
|
||||
def intersect(environment, a, b):
|
||||
if isinstance(a, Hashable) and isinstance(b, Hashable):
|
||||
|
@ -263,7 +257,6 @@ class FilterModule(object):
|
|||
|
||||
# set theory
|
||||
'unique': unique,
|
||||
'duplicated': duplicated,
|
||||
'intersect': intersect,
|
||||
'difference': difference,
|
||||
'symmetric_difference': symmetric_difference,
|
||||
|
|
|
@ -180,11 +180,3 @@ class TestRekeyOnMember():
|
|||
list_original = ({'proto': 'eigrp', 'id': 1}, {'proto': 'ospf', 'id': 2}, {'proto': 'eigrp', 'id': 3})
|
||||
expected = {'eigrp': {'proto': 'eigrp', 'id': 3}, 'ospf': {'proto': 'ospf', 'id': 2}}
|
||||
assert ms.rekey_on_member(list_original, 'proto', duplicates='overwrite') == expected
|
||||
|
||||
|
||||
class TestDuplicated:
|
||||
def test_empty(self):
|
||||
assert ms.duplicated(env, []) == []
|
||||
|
||||
def test_numbers(self):
|
||||
assert ms.duplicated(env, [1, 3, 5, 5]) == [5]
|
||||
|
|
Loading…
Reference in a new issue