Skip to content

Commit

Permalink
Add docstings and type hints to base
Browse files Browse the repository at this point in the history
  • Loading branch information
Qalthos committed Nov 5, 2024
1 parent f3fb12e commit 5d67a96
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 22 deletions.
7 changes: 0 additions & 7 deletions .config/pydoclint-baseline.txt
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,6 @@ src/molecule/provisioner/ansible.py
DOC201: Method `Ansible._get_modules_directories` does not have a return section in docstring
DOC201: Method `Ansible._get_filter_plugins_directories` does not have a return section in docstring
--------------------
src/molecule/provisioner/base.py
DOC601: Class `Base`: 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 `Base`: 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: [__metaclass__: ]. (Please read https://jsh9.github.io/pydoclint/checking_class_attributes.html on how to correctly document class attributes.)
DOC106: Method `Base.__init__`: The option `--arg-type-hints-in-signature` is `True` but there are no argument type hints in the signature
DOC107: Method `Base.__init__`: The option `--arg-type-hints-in-signature` is `True` but not all args in the signature have type hints
DOC202: Method `Base.name` has a return section in docstring, but there are no return statements or annotations
--------------------
src/molecule/verifier/base.py
DOC601: Class `Verifier`: 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 `Verifier`: 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: [__metaclass__: ]. (Please read https://jsh9.github.io/pydoclint/checking_class_attributes.html on how to correctly document class attributes.)
Expand Down
34 changes: 19 additions & 15 deletions src/molecule/provisioner/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,17 @@

import abc

from typing import TYPE_CHECKING


if TYPE_CHECKING:
from molecule.config import Config

class Base:
"""Provisioner Base Class."""

__metaclass__ = abc.ABCMeta
class Base(abc.ABC):
"""Provisioner Base Class."""

def __init__(self, config) -> None: # type: ignore[no-untyped-def] # noqa: ANN001
def __init__(self, config: Config) -> None:
"""Initialize code for all :ref:`Provisioner` classes.
Args:
Expand All @@ -38,27 +42,27 @@ def __init__(self, config) -> None: # type: ignore[no-untyped-def] # noqa: ANN

@property
@abc.abstractmethod
def default_options(self): # type: ignore[no-untyped-def] # pragma: no cover # noqa: ANN201
"""Get default CLI arguments provided to ``cmd`` as a dict.
def default_options(self) -> dict[str, str]: # pragma: no cover
"""Get default CLI arguments provided to ``cmd``.
Return:
dict
Returns:
The default CLI arguments.
"""

@property
@abc.abstractmethod
def default_env(self): # type: ignore[no-untyped-def] # pragma: no cover # noqa: ANN201
"""Get default env variables provided to ``cmd`` as a dict.
def default_env(self) -> dict[str, str]: # pragma: no cover
"""Get default env variables provided to ``cmd``.
Return:
dict
Returns:
The default env variables.
"""

@property
@abc.abstractmethod
def name(self): # type: ignore[no-untyped-def] # pragma: no cover # noqa: ANN201
"""Name of the provisioner and returns a string.
def name(self) -> str: # pragma: no cover
"""Name of the provisioner.
Returns:
str
The provisioner's name.
"""

0 comments on commit 5d67a96

Please sign in to comment.