Skip to content

Commit

Permalink
Update pre-commit hook versions
Browse files Browse the repository at this point in the history
  • Loading branch information
s0undt3ch committed Feb 29, 2024
1 parent c920ba4 commit f454911
Show file tree
Hide file tree
Showing 1,867 changed files with 10,506 additions and 11,419 deletions.
27 changes: 14 additions & 13 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ exclude: ^(doc/_static/.*|doc/_themes/.*)$
repos:

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.5.0
hooks:
- id: check-merge-conflict # Check for files that contain merge conflict strings.
- id: trailing-whitespace # Trims trailing whitespace.
Expand Down Expand Up @@ -1397,7 +1397,7 @@ repos:

# ----- Code Formatting ------------------------------------------------------------------------------------------->
- repo: https://github.com/asottile/pyupgrade
rev: v2.37.2
rev: v3.15.1
hooks:
- id: pyupgrade
name: Upgrade code for Py3.8+
Expand Down Expand Up @@ -1437,7 +1437,7 @@ repos:
args: [--silent, -E, fix_asserts, -E, fix_docstrings, -E, fix_tornado_imports]

- repo: https://github.com/timothycrosley/isort
rev: 5.12.0
rev: 5.13.2
hooks:
- id: isort
additional_dependencies: ['toml']
Expand All @@ -1450,31 +1450,32 @@ repos:
)$
- repo: https://github.com/psf/black
rev: 22.6.0
rev: 24.2.0
hooks:
- id: black
# This tells pre-commit not to pass files to black.
# This should be kept in sync with pyproject.toml
exclude: >
(?x)^(
salt/client/ssh/ssh_py_shim\.py|
templates/.*|
salt/ext/.*|
)$
- repo: https://github.com/asottile/blacken-docs
rev: v1.12.1
rev: 1.16.0
hooks:
- id: blacken-docs
args: [--skip-errors]
files: ^doc/.*\.rst
additional_dependencies:
- black==22.6.0
- black==24.2.0

# <---- Code Formatting --------------------------------------------------------------------------------------------

# ----- Security -------------------------------------------------------------------------------------------------->
- repo: https://github.com/PyCQA/bandit
rev: "1.7.4"
rev: "1.7.7"
hooks:
- id: bandit
alias: bandit-salt
Expand All @@ -1488,7 +1489,7 @@ repos:
)$
additional_dependencies: ['importlib_metadata<5']
- repo: https://github.com/PyCQA/bandit
rev: "1.7.4"
rev: "1.7.7"
hooks:
- id: bandit
alias: bandit-tests
Expand All @@ -1501,7 +1502,7 @@ repos:

# ----- Pre-Commit ------------------------------------------------------------------------------------------------>
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.3.0
rev: v1.8.0
hooks:
- id: mypy
alias: mypy-tools
Expand All @@ -1518,15 +1519,15 @@ repos:
- types-attrs
- types-pyyaml
- types-requests
- python-tools-scripts>=0.18.6
- python-tools-scripts==0.18.6

- repo: https://github.com/saltstack/mirrors-nox
rev: v2021.6.12
rev: v2022.11.21
hooks:
- id: nox
alias: lint-salt
name: Lint Salt
files: ^((setup|noxfile)|(salt|tasks|tools)/.*)\.py$
files: ^((setup|noxfile)|(salt|tools)/.*)\.py$
exclude: >
(?x)^(
templates/.*|
Expand All @@ -1541,7 +1542,7 @@ repos:
- pip>=20.2.4,<21.2

- repo: https://github.com/saltstack/mirrors-nox
rev: v2021.6.12
rev: v2022.11.21
hooks:
- id: nox
alias: lint-tests
Expand Down
12 changes: 6 additions & 6 deletions doc/_ext/saltdomain.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def parse_lit(self, lines):
comment; False designates code.
"""
comment_char = "#" # TODO: move this into a directive option
comment = re.compile(r"^\s*{}[ \n]".format(comment_char))
comment = re.compile(rf"^\s*{comment_char}[ \n]")
section_test = lambda val: bool(comment.match(val))

sections = []
Expand Down Expand Up @@ -136,7 +136,7 @@ def parse_file(self, sls_path):
formulas_dirs = config.formulas_dirs
fpath = sls_path.replace(".", "/")

name_options = ("{}.sls".format(fpath), os.path.join(fpath, "init.sls"))
name_options = (f"{fpath}.sls", os.path.join(fpath, "init.sls"))

paths = [
os.path.join(fdir, fname)
Expand All @@ -151,7 +151,7 @@ def parse_file(self, sls_path):
except OSError:
pass

raise OSError("Could not find sls file '{}'".format(sls_path))
raise OSError(f"Could not find sls file '{sls_path}'")


class CurrentFormula(Directive):
Expand Down Expand Up @@ -196,7 +196,7 @@ def run(self):
targetnode = nodes.target("", "", ids=["module-" + formname], ismod=True)
self.state.document.note_explicit_target(targetnode)

indextext = "{}-formula)".format(formname)
indextext = f"{formname}-formula)"
inode = addnodes.index(
entries=[("single", indextext, "module-" + formname, "")]
)
Expand All @@ -221,9 +221,9 @@ def run(self):

formula = env.temp_data.get("salt:formula")

indextext = "{1} ({0}-formula)".format(formula, statename)
indextext = f"{statename} ({formula}-formula)"
inode = addnodes.index(
entries=[("single", indextext, "module-{}".format(statename), "")]
entries=[("single", indextext, f"module-{statename}", "")]
)

return [targetnode, inode]
Expand Down
3 changes: 1 addition & 2 deletions doc/ref/executors/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@ the ``execute`` function with the following signature:

.. code-block:: python
def execute(opts, data, func, args, kwargs):
...
def execute(opts, data, func, args, kwargs): ...
Where the args are:

Expand Down
1 change: 1 addition & 0 deletions doc/ref/modules/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@ the case when the dependency is unavailable.
"""
Cheese execution (or returner/beacon/etc.) module
"""
try:
import enzymes
Expand Down
3 changes: 1 addition & 2 deletions doc/topics/development/tests/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -364,8 +364,7 @@ the actual testing, such as functions containing assertions, must start with

.. code-block:: python
def test_user_present(self):
...
def test_user_present(self): ...
When functions in test files are not prepended with ``test_``, the function
acts as a normal, helper function and is not run as a test by the test suite.
Expand Down
2 changes: 0 additions & 2 deletions doc/topics/proxyminion/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,6 @@ and status; "package" installation, and a ping.
def uptodate(name):
"""
Call the REST endpoint to see if the packages on the "server" are up to date.
"""
Expand All @@ -592,7 +591,6 @@ and status; "package" installation, and a ping.
def package_remove(name):
"""
Remove a "package" on the REST server
"""
Expand Down
15 changes: 5 additions & 10 deletions doc/topics/releases/2016.11.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -551,15 +551,13 @@ General Deprecations

.. code-block:: python
def fcn(msg="", env="base", refresh=True, saltenv="base", **kwargs):
...
def fcn(msg="", env="base", refresh=True, saltenv="base", **kwargs): ...
has been changed to

.. code-block:: python
def fcn(msg="", refresh=True, saltenv="base", **kwargs):
...
def fcn(msg="", refresh=True, saltenv="base", **kwargs): ...
- If ``env`` (or ``__env__``) is supplied as a keyword argument to a function
that also accepts arbitrary keyword arguments, then a new warning informs the
Expand All @@ -568,8 +566,7 @@ General Deprecations

.. code-block:: python
def fcn(msg="", refresh=True, saltenv="base", **kwargs):
...
def fcn(msg="", refresh=True, saltenv="base", **kwargs): ...
.. code-block:: python
Expand All @@ -582,8 +579,7 @@ General Deprecations

.. code-block:: python
def fcn(msg="", refresh=True, saltenv="base"):
...
def fcn(msg="", refresh=True, saltenv="base"): ...
.. code-block:: python
Expand All @@ -597,8 +593,7 @@ General Deprecations

.. code-block:: python
def fcn(msg="", refresh=True, saltenv="base"):
...
def fcn(msg="", refresh=True, saltenv="base"): ...
.. code-block:: python
Expand Down
3 changes: 2 additions & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
Nox configuration script
"""

# pylint: disable=resource-leakage,3rd-party-module-not-gated

import contextlib
Expand Down Expand Up @@ -1787,7 +1788,7 @@ def recompress(self, targz):
d_targz = tempd.joinpath(targz.name)
with tarfile.open(d_tar, "w|") as wfile:
with tarfile.open(targz, "r:gz") as rfile:
rfile.extractall(d_src)
rfile.extractall(d_src) # nosec
extracted_dir = next(pathlib.Path(d_src).iterdir())
for name in sorted(extracted_dir.rglob("*")):
wfile.add(
Expand Down
6 changes: 0 additions & 6 deletions salt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,6 @@
if sys.platform.startswith("win"):
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())

if sys.version_info < (3,): # pragma: no cover
sys.stderr.write(
"\n\nAfter the Sodium release, 3001, Salt no longer supports Python 2. Exiting.\n\n"
)
sys.stderr.flush()


class NaclImporter:
"""
Expand Down
1 change: 1 addition & 0 deletions salt/_compat.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Salt compatibility code
"""

# pylint: disable=unused-import
import sys

Expand Down
1 change: 1 addition & 0 deletions salt/_logging/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
The ``salt._logging`` package should be imported as soon as possible since salt tweaks
the python's logging system.
"""

from salt._logging.impl import (
DFLT_LOG_DATEFMT,
DFLT_LOG_DATEFMT_LOGFILE,
Expand Down
3 changes: 1 addition & 2 deletions salt/auth/django.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ class SaltExternalAuthModel(models.Model):
'SaltExternalAuthModel'.
"""


import logging
import os
import sys
Expand Down Expand Up @@ -112,7 +111,7 @@ def __django_auth_setup():
django_module_name, globals(), locals(), "SaltExternalAuthModel"
)
# pylint: enable=possibly-unused-variable
DJANGO_AUTH_CLASS_str = "django_auth_module.{}".format(django_model_name)
DJANGO_AUTH_CLASS_str = f"django_auth_module.{django_model_name}"
DJANGO_AUTH_CLASS = eval(DJANGO_AUTH_CLASS_str) # pylint: disable=W0123


Expand Down
1 change: 0 additions & 1 deletion salt/auth/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@
"""


import logging
import os

Expand Down
1 change: 0 additions & 1 deletion salt/auth/keystone.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
:depends: - keystoneclient Python module
"""


try:
from keystoneclient.exceptions import AuthorizationFailure, Unauthorized
from keystoneclient.v2_0 import client
Expand Down
13 changes: 7 additions & 6 deletions salt/auth/ldap.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
:depends: - ldap Python module
"""

import itertools
import logging

Expand Down Expand Up @@ -53,15 +54,15 @@ def _config(key, mandatory=True, opts=None):
"""
try:
if opts:
value = opts["auth.ldap.{}".format(key)]
value = opts[f"auth.ldap.{key}"]
else:
value = __opts__["auth.ldap.{}".format(key)]
value = __opts__[f"auth.ldap.{key}"]
except KeyError:
try:
value = __defopts__["auth.ldap.{}".format(key)]
value = __defopts__[f"auth.ldap.{key}"]
except KeyError:
if mandatory:
msg = "missing auth.ldap.{} in master config".format(key)
msg = f"missing auth.ldap.{key} in master config"
raise SaltInvocationError(msg)
return False
return value
Expand Down Expand Up @@ -119,13 +120,13 @@ def __init__(

schema = "ldaps" if tls else "ldap"
if self.uri == "":
self.uri = "{}://{}:{}".format(schema, self.server, self.port)
self.uri = f"{schema}://{self.server}:{self.port}"

try:
if no_verify:
ldap.set_option(ldap.OPT_X_TLS_REQUIRE_CERT, ldap.OPT_X_TLS_NEVER)

self.ldap = ldap.initialize("{}".format(self.uri))
self.ldap = ldap.initialize(f"{self.uri}")
self.ldap.protocol_version = 3 # ldap.VERSION3
self.ldap.set_option(ldap.OPT_REFERRALS, 0) # Needed for AD

Expand Down
1 change: 0 additions & 1 deletion salt/auth/mysql.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
:depends: - MySQL-python Python module
"""


import logging

log = logging.getLogger(__name__)
Expand Down
1 change: 0 additions & 1 deletion salt/auth/rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
"""


import logging

import salt.utils.http
Expand Down
1 change: 0 additions & 1 deletion salt/auth/yubico.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
"""


import logging

log = logging.getLogger(__name__)
Expand Down
Loading

0 comments on commit f454911

Please sign in to comment.