parent
9acd289915
commit
9668f26a26
|
@ -1,5 +1,11 @@
|
|||
---
|
||||
repos:
|
||||
- repo: https://github.com/ansible-network/collection_prep
|
||||
rev: 1.1.0
|
||||
hooks:
|
||||
- id: autoversion
|
||||
- id: update-docs
|
||||
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v4.4.0
|
||||
hooks:
|
||||
|
@ -7,7 +13,6 @@ repos:
|
|||
- id: debug-statements
|
||||
- id: end-of-file-fixer
|
||||
- id: no-commit-to-branch
|
||||
args: [--branch, main]
|
||||
- id: trailing-whitespace
|
||||
|
||||
- repo: https://github.com/asottile/add-trailing-comma
|
||||
|
@ -16,26 +21,9 @@ repos:
|
|||
- id: add-trailing-comma
|
||||
|
||||
- repo: https://github.com/pre-commit/mirrors-prettier
|
||||
rev: "v3.0.0-alpha.4"
|
||||
rev: "v3.0.0-alpha.6"
|
||||
hooks:
|
||||
- id: prettier
|
||||
# Original hook implementation is flaky due to *several* bugs described
|
||||
# in https://github.com/prettier/prettier/issues/12364
|
||||
# a) CI=1 needed to avoid incomplete output
|
||||
# b) two executions are needed because --list-different works correctly
|
||||
# only when run with --check as with --write the output will also
|
||||
# include other entries and logging level cannot be used to keep only
|
||||
# modified files listed (any file is listed using the log level, regardless if
|
||||
# is modified or not).
|
||||
# c) We avoid letting pre-commit pass each filename in order to avoid
|
||||
# running multiple instances in parallel. This also ensures that running
|
||||
# prettier from the command line behaves identically with the pre-commit
|
||||
# one. No real performance downsides.
|
||||
# d) exit with the return code from list-different (0=none, 1=some)
|
||||
# rather than the write (0=successfully rewrote files). pre-commit.ci
|
||||
entry: env CI=1 bash -c "prettier --list-different . || ec=$? && prettier --loglevel=error --write . && exit $ec"
|
||||
pass_filenames: false
|
||||
args: []
|
||||
additional_dependencies:
|
||||
- prettier
|
||||
- prettier-plugin-toml
|
||||
|
@ -45,13 +33,9 @@ repos:
|
|||
hooks:
|
||||
- id: isort
|
||||
name: Sort import statements using isort
|
||||
args: ["--filter-files"]
|
||||
|
||||
- repo: https://github.com/psf/black
|
||||
rev: 22.12.0
|
||||
rev: 23.3.0
|
||||
hooks:
|
||||
- id: black
|
||||
|
||||
- repo: https://github.com/ansible-network/collection_prep
|
||||
rev: 1.0.1
|
||||
hooks:
|
||||
- id: update-docs
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
trivial:
|
||||
- Update pre-commit config to add autoversion hook
|
|
@ -4,11 +4,13 @@ authors:
|
|||
license_file: LICENSE
|
||||
name: utils
|
||||
namespace: ansible
|
||||
description: Ansible Collection with utilities to ease the management, manipulation, and validation of data within a playbook
|
||||
description:
|
||||
Ansible Collection with utilities to ease the management, manipulation,
|
||||
and validation of data within a playbook
|
||||
readme: README.md
|
||||
repository: https://github.com/ansible-collections/ansible.utils
|
||||
issues: https://github.com/ansible-collections/ansible.utils/issues
|
||||
tags: [linux, networking, security, cloud, utilities, data, validation, utils]
|
||||
# NOTE(pabelanger): We create an empty version key to keep ansible-galaxy
|
||||
# happy. We dynamically inject version info based on git information.
|
||||
version: null
|
||||
version: 2.9.1-dev
|
||||
|
|
|
@ -1480,6 +1480,5 @@ class FilterModule(object):
|
|||
"""Consolidate"""
|
||||
|
||||
def filters(self):
|
||||
|
||||
"""A mapping of filter names to functions"""
|
||||
return {"consolidate": _consolidate}
|
||||
|
|
|
@ -143,6 +143,5 @@ class FilterModule(object):
|
|||
"""from_xml"""
|
||||
|
||||
def filters(self):
|
||||
|
||||
"""a mapping of filter names to functions"""
|
||||
return {"from_xml": _from_xml}
|
||||
|
|
|
@ -325,6 +325,5 @@ class FilterModule(object):
|
|||
"""keep_keys"""
|
||||
|
||||
def filters(self):
|
||||
|
||||
"""a mapping of filter names to functions"""
|
||||
return {"keep_keys": _keep_keys}
|
||||
|
|
|
@ -342,6 +342,5 @@ class FilterModule(object):
|
|||
"""remove_keys"""
|
||||
|
||||
def filters(self):
|
||||
|
||||
"""a mapping of filter names to functions"""
|
||||
return {"remove_keys": _remove_keys}
|
||||
|
|
|
@ -319,6 +319,5 @@ class FilterModule(object):
|
|||
"""replace_keys"""
|
||||
|
||||
def filters(self):
|
||||
|
||||
"""a mapping of filter names to functions"""
|
||||
return {"replace_keys": _replace_keys}
|
||||
|
|
|
@ -181,6 +181,5 @@ class FilterModule(object):
|
|||
"""usable_range"""
|
||||
|
||||
def filters(self):
|
||||
|
||||
"""a mapping of filter names to functions"""
|
||||
return {"usable_range": _usable_range}
|
||||
|
|
|
@ -468,7 +468,6 @@ def ipaddr(value, query="", version=False, alias="ipaddr"):
|
|||
|
||||
# Check if value is a number and convert it to an IP address
|
||||
elif str(value).isdigit():
|
||||
|
||||
# We don't know what IP version to assume, so let's check IPv4 first,
|
||||
# then IPv6
|
||||
try:
|
||||
|
|
|
@ -75,7 +75,6 @@ class ValidateBase(object):
|
|||
return None
|
||||
|
||||
for option_name, option_value in iteritems(options):
|
||||
|
||||
option_var_name_list = option_value.get("vars", [])
|
||||
option_env_name_list = option_value.get("env", [])
|
||||
|
||||
|
|
|
@ -159,7 +159,6 @@ def index_of(
|
|||
res.append(idx)
|
||||
|
||||
elif isinstance(key, (string_types, integer_types, bool)):
|
||||
|
||||
if not all(isinstance(entry, dict) for entry in data):
|
||||
all_tipes = [type(_to_well_known_type(entry)).__name__ for entry in data]
|
||||
msg = (
|
||||
|
|
|
@ -1,35 +0,0 @@
|
|||
# (c) 2014, Toshio Kuratomi <tkuratomi@ansible.com>
|
||||
#
|
||||
# This file is part of Ansible
|
||||
#
|
||||
# Ansible is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# Ansible is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Make coding more python3-ish
|
||||
from __future__ import absolute_import, division, print_function
|
||||
|
||||
|
||||
__metaclass__ = type
|
||||
|
||||
#
|
||||
# Compat for python2.7
|
||||
#
|
||||
|
||||
# One unittest needs to import builtins via __import__() so we need to have
|
||||
# the string that represents it
|
||||
try:
|
||||
import __builtin__ # pyright: ignore[reportMissingImports] # noqa F401
|
||||
except ImportError:
|
||||
BUILTINS = "builtins"
|
||||
else:
|
||||
BUILTINS = "__builtin__"
|
|
@ -104,7 +104,6 @@ if sys.version_info >= (3,) and sys.version_info < (3, 4, 4):
|
|||
|
||||
global file_spec
|
||||
if file_spec is None:
|
||||
|
||||
file_spec = list(set(dir(_io.TextIOWrapper)).union(set(dir(_io.BytesIO))))
|
||||
|
||||
if mock is None:
|
||||
|
|
Loading…
Reference in New Issue