Debian Codegraph @

lib/ansible/module_utils/common/_collections_compat.py

raw
1 # Copyright (c), Sviatoslav Sydorenko <[email protected]> 2018
2 # Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
3 """Collections ABC import shim.
4
5 Use `collections.abc` instead.
6 This module exists only for backwards compatibility.
7 """
8
9 from __future__ import annotations
10
11 # Although this was originally intended for internal use only, it has wide adoption in collections.
12 # This is due in part to sanity tests previously recommending its use over `collections` imports.
13 from collections.abc import ( # pylint: disable=unused-import
14 MappingView,
15 ItemsView,
16 KeysView,
17 ValuesView,
18 Mapping, MutableMapping,
19 Sequence, MutableSequence,
20 Set, MutableSet,
21 Container,
22 Hashable,
23 Sized,
24 Callable,
25 Iterable,
26 Iterator,
27 )
28
29 from ansible.module_utils.common import warnings as _warnings
30
31
32 _warnings.deprecate(
33 msg="The `ansible.module_utils.common._collections_compat` module is deprecated.",
34 help_text="Use `collections.abc` from the Python standard library instead.",
35 version="2.24",
36 )