Skip to content

Commit

Permalink
Move HasConfig out of if TYPE_CHECKING
Browse files Browse the repository at this point in the history
Forgot I was using this in cast
  • Loading branch information
Qalthos committed Oct 21, 2024
1 parent 9a641ac commit 84ee23b
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions src/molecule/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import time

from functools import wraps
from typing import TYPE_CHECKING, cast
from typing import TYPE_CHECKING, Protocol, cast

from ansible_compat.ports import cache
from enrich.logging import RichHandler
Expand All @@ -36,24 +36,13 @@

if TYPE_CHECKING:
from collections.abc import Callable, Iterable
from typing import Any, ParamSpec, Protocol, TypeVar
from typing import Any, ParamSpec, TypeVar

from molecule.config import Config

P = ParamSpec("P")
R = TypeVar("R")

class HasConfig(Protocol):
"""A class with a _config attribute.
There are a few such classes in Molecule. We just care that it's one of them.
Attributes:
_config: A Config instance.
"""

_config: Config


LOG = logging.getLogger(__name__)

Expand All @@ -63,6 +52,18 @@ class HasConfig(Protocol):
}


class HasConfig(Protocol):
"""A class with a _config attribute.
There are a few such classes in Molecule. We just care that it's one of them.
Attributes:
_config: A Config instance.
"""

_config: Config


def configure() -> None:
"""Configure a molecule root logger.
Expand Down

0 comments on commit 84ee23b

Please sign in to comment.