[PR #9535/3af793c2 backport][stable-10] plugins (become, callback, filter): style adjustments (#9545)

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

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

* remove inventory plugins from PR

* adjustments from review

* typo

(cherry picked from commit 3af793c2c1)

Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
This commit is contained in:
patchback[bot]
2025-01-07 18:45:39 +01:00
committed by GitHub
parent 75f649648e
commit 39a66a3196
22 changed files with 696 additions and 699 deletions

View File

@@ -6,34 +6,35 @@
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
DOCUMENTATION = '''
name: counter
short_description: Counts hashable elements in a sequence
version_added: 4.3.0
author: Rémy Keil (@keilr)
description:
- Counts hashable elements in a sequence.
options:
_input:
description: A sequence.
type: list
elements: any
required: true
'''
DOCUMENTATION = r"""
name: counter
short_description: Counts hashable elements in a sequence
version_added: 4.3.0
author: Rémy Keil (@keilr)
description:
- Counts hashable elements in a sequence.
options:
_input:
description: A sequence.
type: list
elements: any
required: true
"""
EXAMPLES = '''
EXAMPLES = r"""
- name: Count occurrences
ansible.builtin.debug:
msg: >-
{{ [1, 'a', 2, 2, 'a', 'b', 'a'] | community.general.counter }}
# Produces: {1: 1, 'a': 3, 2: 2, 'b': 1}
'''
"""
RETURN = '''
_value:
description: A dictionary with the elements of the sequence as keys, and their number of occurrences in the sequence as values.
type: dictionary
'''
RETURN = r"""
_value:
description: A dictionary with the elements of the sequence as keys, and their number of occurrences in the sequence as
values.
type: dictionary
"""
from ansible.errors import AnsibleFilterError
from ansible.module_utils.common._collections_compat import Sequence