Skip to content

Commit

Permalink
chore: Update pyproject.toml (#4272)
Browse files Browse the repository at this point in the history
Allow ruff to add future annotations

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
cidrblock and pre-commit-ci[bot] authored Aug 9, 2024
1 parent 0b3789a commit 4eb556c
Show file tree
Hide file tree
Showing 105 changed files with 320 additions and 82 deletions.
2 changes: 0 additions & 2 deletions .config/pydoclint-baseline.txt
Original file line number Diff line number Diff line change
Expand Up @@ -327,8 +327,6 @@ src/molecule/driver/delegated.py
src/molecule/interpolation.py
DOC101: Method `InvalidInterpolation.__init__`: Docstring contains fewer arguments than in function signature.
DOC103: Method `InvalidInterpolation.__init__`: Docstring arguments are different from function arguments. (Or could be other formatting issues: https://jsh9.github.io/pydoclint/violation_codes.html#notes-on-doc103 ). Arguments in the function signature but not in the docstring: [place: Exception, string: str].
DOC101: Method `Interpolator.__init__`: Docstring contains fewer arguments than in function signature.
DOC103: Method `Interpolator.__init__`: Docstring arguments are different from function arguments. (Or could be other formatting issues: https://jsh9.github.io/pydoclint/violation_codes.html#notes-on-doc103 ). Arguments in the function signature but not in the docstring: [mapping: MutableMapping, templater: type['TemplateWithDefaults']].
DOC601: Class `TemplateWithDefaults`: Class docstring contains fewer class attributes than actual class attributes. (Please read https://jsh9.github.io/pydoclint/checking_class_attributes.html on how to correctly document class attributes.)
DOC603: Class `TemplateWithDefaults`: Class docstring attributes are different from actual class attributes. (Or could be other formatting issues: https://jsh9.github.io/pydoclint/violation_codes.html#notes-on-doc103 ). Attributes in the class definition but not in the docstring: [idpattern: ]. (Please read https://jsh9.github.io/pydoclint/checking_class_attributes.html on how to correctly document class attributes.)
--------------------
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@ parametrize-values-type = "tuple"
known-first-party = ["molecule"]
lines-after-imports = 2 # Ensures consistency for cases when there's variable vs function/class definitions after imports
lines-between-types = 1 # Separate import/from with 1 line
required-imports = ["from __future__ import annotations"]

[tool.ruff.lint.per-file-ignores]
"_version.py" = ["SIM108"]
Expand Down
3 changes: 3 additions & 0 deletions src/molecule/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
"""Molecule version information."""
from __future__ import annotations


try:
from ._version import ( # type: ignore[import-not-found, unused-ignore]
__version__,
Expand Down
1 change: 1 addition & 0 deletions src/molecule/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
"""Molecule CLI main entry point."""
from __future__ import annotations

from molecule.shell import main

Expand Down
2 changes: 2 additions & 0 deletions src/molecule/api.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
"""Molecule API Module."""

from __future__ import annotations

import logging
import traceback

Expand Down
2 changes: 2 additions & 0 deletions src/molecule/app.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
"""Molecule Application Module."""

from __future__ import annotations

from ansible_compat.runtime import Runtime


Expand Down
1 change: 1 addition & 0 deletions src/molecule/command/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
# NOTE(retr0h): Importing into the ``molecule.command`` namespace, to prevent
# collisions (e.g. ``list``). The CLI usage may conflict with reserved words
# or builtins.
from __future__ import annotations

from molecule.command import (
base, # noqa: F401
Expand Down
1 change: 1 addition & 0 deletions src/molecule/command/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
"""Check Command Module."""
from __future__ import annotations

import logging
import os
Expand Down
1 change: 1 addition & 0 deletions src/molecule/command/cleanup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
"""Cleanup Command Module."""
from __future__ import annotations

import logging

Expand Down
1 change: 1 addition & 0 deletions src/molecule/command/create.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
"""Create Command Module."""
from __future__ import annotations

import logging

Expand Down
1 change: 1 addition & 0 deletions src/molecule/command/dependency.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
"""Dependency Command Module."""
from __future__ import annotations

import logging

Expand Down
1 change: 1 addition & 0 deletions src/molecule/command/destroy.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
"""Destroy Command Module."""
from __future__ import annotations

import logging
import os
Expand Down
2 changes: 1 addition & 1 deletion src/molecule/command/drivers.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
"""Create Command Module."""

from __future__ import annotations

import logging

Expand Down
1 change: 1 addition & 0 deletions src/molecule/command/idempotence.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
"""Idempotence Command Module."""
from __future__ import annotations

import logging
import re
Expand Down
1 change: 1 addition & 0 deletions src/molecule/command/init/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
"""Base class used by init command."""
from __future__ import annotations

import abc
import logging
Expand Down
1 change: 1 addition & 0 deletions src/molecule/command/init/init.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
"""Base class used by init command."""
from __future__ import annotations

import logging

Expand Down
1 change: 1 addition & 0 deletions src/molecule/command/init/scenario.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
"""Base class used by init scenario command."""
from __future__ import annotations

import json
import logging
Expand Down
2 changes: 1 addition & 1 deletion src/molecule/command/list.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
"""List Command Module."""

from __future__ import annotations

import logging

Expand Down
1 change: 1 addition & 0 deletions src/molecule/command/login.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
"""Login Command Module."""
from __future__ import annotations

import logging
import os
Expand Down
1 change: 1 addition & 0 deletions src/molecule/command/matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
"""Matrix Command Module."""
from __future__ import annotations

import logging

Expand Down
1 change: 1 addition & 0 deletions src/molecule/command/prepare.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
"""Prepare Command Module."""
from __future__ import annotations

import logging

Expand Down
1 change: 1 addition & 0 deletions src/molecule/command/reset.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
"""Lint Command Module."""
from __future__ import annotations

import logging

Expand Down
1 change: 1 addition & 0 deletions src/molecule/command/side_effect.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
"""Side-effect Command Module."""
from __future__ import annotations

import logging

Expand Down
1 change: 1 addition & 0 deletions src/molecule/command/syntax.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
"""Syntax Command Module."""
from __future__ import annotations

import logging

Expand Down
1 change: 1 addition & 0 deletions src/molecule/command/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
"""Test Command Module."""
from __future__ import annotations

import logging
import os
Expand Down
1 change: 1 addition & 0 deletions src/molecule/command/verify.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
"""Verify Command Module."""
from __future__ import annotations

import logging

Expand Down
7 changes: 6 additions & 1 deletion src/molecule/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
"""Config Module."""
from __future__ import annotations

import copy
import logging
import os
import warnings

from collections.abc import MutableMapping
from pathlib import Path
from typing import TYPE_CHECKING
from uuid import uuid4

from ansible_compat.ports import cache, cached_property
Expand All @@ -40,6 +41,10 @@
from molecule.util import boolean


if TYPE_CHECKING:
from collections.abc import MutableMapping


LOG = logging.getLogger(__name__)
MOLECULE_DEBUG = boolean(os.environ.get("MOLECULE_DEBUG", "False"))
MOLECULE_VERBOSITY = int(os.environ.get("MOLECULE_VERBOSITY", 0))
Expand Down
2 changes: 2 additions & 0 deletions src/molecule/console.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
"""Console and terminal utilities."""

from __future__ import annotations

import os
import sys

Expand Down
3 changes: 3 additions & 0 deletions src/molecule/constants.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
"""Constants used by molecule."""

from __future__ import annotations


RC_SUCCESS = 0
RC_TIMEOUT = 3
RC_SETUP_ERROR = 4 # Broken setup, like missing Ansible
Expand Down
2 changes: 2 additions & 0 deletions src/molecule/dependency/ansible_galaxy/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
"""Base definition for Ansible Galaxy dependencies."""

from __future__ import annotations

from molecule import util
from molecule.dependency.ansible_galaxy.collections import Collections
from molecule.dependency.ansible_galaxy.roles import Roles
Expand Down
1 change: 1 addition & 0 deletions src/molecule/dependency/ansible_galaxy/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
"""Base Ansible Galaxy dependency module."""
from __future__ import annotations

import abc
import copy
Expand Down
2 changes: 2 additions & 0 deletions src/molecule/dependency/ansible_galaxy/collections.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
"""Ansible Galaxy dependencies for lists of collections."""

from __future__ import annotations

import logging
import os

Expand Down
2 changes: 2 additions & 0 deletions src/molecule/dependency/ansible_galaxy/roles.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
"""Ansible Galaxy dependencies for lists of roles."""

from __future__ import annotations

import logging
import os

Expand Down
1 change: 1 addition & 0 deletions src/molecule/dependency/shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
"""Shell Dependency Module."""
from __future__ import annotations

import logging

Expand Down
1 change: 1 addition & 0 deletions src/molecule/driver/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
"""Base Driver Module."""
from __future__ import annotations

import inspect
import os
Expand Down
1 change: 1 addition & 0 deletions src/molecule/driver/delegated.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
"""Delegated Driver Module."""
from __future__ import annotations

import logging
import os
Expand Down
16 changes: 13 additions & 3 deletions src/molecule/interpolation.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,15 @@
# Taken from Docker Compose:
# https://github.com/docker/compose/blob/master/compose/config/interpolation.py
"""Interpolation Module."""
from __future__ import annotations

import string

from collections.abc import MutableMapping
from typing import TYPE_CHECKING


if TYPE_CHECKING:
from collections.abc import MutableMapping


class InvalidInterpolation(Exception): # noqa: N818
Expand Down Expand Up @@ -77,10 +82,15 @@ class Interpolator:

def __init__(
self,
templater: type["TemplateWithDefaults"],
templater: type[TemplateWithDefaults],
mapping: MutableMapping, # type: ignore[type-arg]
) -> None:
"""Construct Interpolator."""
"""Construct Interpolator.
Args:
templater: A templater class.
mapping: A mapping object.
"""
self.templater = templater
self.mapping = mapping

Expand Down
7 changes: 6 additions & 1 deletion src/molecule/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
"""Logging Module."""
from __future__ import annotations

import logging
import os
import time

from collections.abc import Callable, Iterable
from functools import wraps
from typing import TYPE_CHECKING

from ansible_compat.ports import cache
from enrich.logging import RichHandler
Expand All @@ -33,6 +34,10 @@
from molecule.text import underscore


if TYPE_CHECKING:
from collections.abc import Callable, Iterable


LOG = logging.getLogger(__name__)

LOG_LEVEL_LUT = {
Expand Down
1 change: 1 addition & 0 deletions src/molecule/model/schema_v3.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
"""Schema v3 Validation Module."""
from __future__ import annotations

import json
import logging
Expand Down
1 change: 1 addition & 0 deletions src/molecule/platforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
"""PLatforms Module."""
from __future__ import annotations

import logging

Expand Down
1 change: 1 addition & 0 deletions src/molecule/provisioner/ansible_playbook.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
"""Ansible-Playbook Provisioner Module."""
from __future__ import annotations

import logging
import shlex
Expand Down
Loading

0 comments on commit 4eb556c

Please sign in to comment.