Skip to content

Commit

Permalink
REvert git_base
Browse files Browse the repository at this point in the history
  • Loading branch information
cidrblock committed Oct 6, 2023
1 parent e20bb71 commit bf9362a
Showing 1 changed file with 14 additions and 18 deletions.
32 changes: 14 additions & 18 deletions plugins/plugin_utils/git_base.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""A base class for the git action plugins."""
from __future__ import absolute_import, annotations, division, print_function
from __future__ import absolute_import, division, print_function


# pylint: disable=invalid-name
Expand All @@ -10,22 +10,18 @@
import subprocess

from dataclasses import dataclass, field, fields
from typing import TYPE_CHECKING, Dict, List, TypeVar, Union
from types import ModuleType
from typing import Dict, List, Tuple, TypeVar, Union

from ansible.parsing.dataloader import DataLoader
from ansible.playbook.play_context import PlayContext
from ansible.playbook.task import Task
from ansible.plugins import loader as plugin_loader
from ansible.plugins.action import ActionBase
from ansible.plugins.connection.local import Connection
from ansible.template import Templar


if TYPE_CHECKING:
from types import ModuleType

from ansible.parsing.dataloader import DataLoader
from ansible.playbook.play_context import PlayContext
from ansible.playbook.task import Task
from ansible.plugins import loader as plugin_loader
from ansible.plugins.connection.local import Connection
from ansible.template import Templar

from .command import Command
from .command import Command


JSONTypes = Union[bool, int, str, Dict, List]
Expand All @@ -47,7 +43,7 @@ class ActionInit:
@property
def asdict(
self: T,
) -> dict[str, Connection | DataLoader | PlayContext | ModuleType | Task | Templar]:
) -> Dict[str, Union[Connection, DataLoader, PlayContext, ModuleType, Task, Templar]]:
"""Create a dictionary, avoiding the deepcopy with dataclass.asdict.
:return: A dictionary of the keyword arguments.
Expand All @@ -56,13 +52,13 @@ def asdict(


@dataclass(frozen=False)
class ResultBase:
class ResultBase: # pylint: disable=too-many-instance-attributes
"""Data structure for the task result."""

changed: bool = True
failed: bool = False
msg: str = ""
output: list[dict[str, int | dict[str, str] | list[str] | str]] = field(
output: List[Dict[str, Union[int, Dict[str, str], List[str], str]]] = field(
default_factory=list,
)

Expand All @@ -83,7 +79,7 @@ def __init__(self: U, action_init: ActionInit) -> None:
self._timeout: int

@staticmethod
def _git_auth_header(token: str) -> tuple[str, list[str]]:
def _git_auth_header(token: str) -> Tuple[str, List[str]]:
"""Create the authorization header.
helpful: https://github.com/actions/checkout/blob/main/src/git-auth-helper.ts#L56
Expand Down

0 comments on commit bf9362a

Please sign in to comment.