plugins (become, callback, filter): style adjustments (#9535)

* plugins (become, callback, filter, inventory): style adjustments

* remove inventory plugins from PR

* adjustments from review

* typo
This commit is contained in:
Alexei Znamensky 2025-01-07 18:33:28 +13:00 committed by GitHub
commit 3af793c2c1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
22 changed files with 696 additions and 699 deletions

View file

@ -2,43 +2,44 @@
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later
DOCUMENTATION = '''
name: accumulate
short_description: Produce a list of accumulated sums of the input list contents
version_added: 10.1.0
author: Max Gautier (@VannTen)
description:
- Passthrough to the L(Python itertools.accumulate function,https://docs.python.org/3/library/itertools.html#itertools.accumulate).
- Transforms an input list into the cumulative list of results from applying addition to the elements of the input list.
- Addition means the default Python implementation of C(+) for input list elements type.
options:
_input:
description: A list.
type: list
elements: any
required: true
'''
RETURN = '''
_value:
description: A list of cumulated sums of the elements of the input list.
DOCUMENTATION = r"""
name: accumulate
short_description: Produce a list of accumulated sums of the input list contents
version_added: 10.1.0
author: Max Gautier (@VannTen)
description:
- Passthrough to the L(Python itertools.accumulate function,https://docs.python.org/3/library/itertools.html#itertools.accumulate).
- Transforms an input list into the cumulative list of results from applying addition to the elements of the input list.
- Addition means the default Python implementation of C(+) for input list elements type.
options:
_input:
description: A list.
type: list
elements: any
'''
required: true
"""
EXAMPLES = '''
RETURN = r"""
_value:
description: A list of cumulated sums of the elements of the input list.
type: list
elements: any
"""
EXAMPLES = r"""
- name: Enumerate parent directories of some path
ansible.builtin.debug:
var: >
"/some/path/to/my/file"
| split('/') | map('split', '/')
| community.general.accumulate | map('join', '/')
"/some/path/to/my/file"
| split('/') | map('split', '/')
| community.general.accumulate | map('join', '/')
# Produces: ['', '/some', '/some/path', '/some/path/to', '/some/path/to/my', '/some/path/to/my/file']
- name: Growing string
ansible.builtin.debug:
var: "'abc' | community.general.accumulate"
# Produces ['a', 'ab', 'abc']
'''
"""
from itertools import accumulate
from collections.abc import Sequence