Skip to content

Commit aa37aeb

Browse files
chore: auto fixes from pre-commit.com hooks
1 parent 0a70b58 commit aa37aeb

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

src/ansible_creator/config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ class Config:
3636
output: Output
3737
subcommand: str
3838
type: str = ""
39-
resource_type :str = ""
40-
path :str = ""
39+
resource_type: str = ""
40+
path: str = ""
4141
collection: str = ""
4242
force: bool = False
4343
overwrite: bool = False

src/ansible_creator/subcommands/add.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,24 @@
88
from ansible_creator.exceptions import CreatorError
99
from ansible_creator.templar import Templar
1010
from ansible_creator.types import TemplateData
11-
from ansible_creator.utils import Walker, Copier, ask_yes_no
11+
from ansible_creator.utils import Copier, Walker, ask_yes_no
1212

1313

1414
if TYPE_CHECKING:
1515
from ansible_creator.config import Config
1616
from ansible_creator.output import Output
1717

18+
1819
class Add:
1920
"""Class to handle the add subcommand."""
2021

2122
common_resources = ("common.devfile",)
22-
23-
23+
2424
def __init__(
2525
self: Add,
2626
config: Config,
2727
) -> None:
28-
28+
2929
self._resource_type: str = config.resource_type
3030
self._add_path: Path = Path(config.path)
3131
self._force = config.force
@@ -35,7 +35,7 @@ def __init__(
3535
self._project = config.project
3636
self.output: Output = config.output
3737
self.templar = Templar()
38-
38+
3939
def run(self) -> None:
4040
"""Start scaffolding the resource file."""
4141
self._check_add_path()
@@ -46,7 +46,9 @@ def run(self) -> None:
4646
def _check_add_path(self) -> None:
4747
"""Validate the provided add path."""
4848
if not self._add_path.exists():
49-
raise CreatorError(f"The path {self._add_path} does not exist. Please provide an existing directory.")
49+
raise CreatorError(
50+
f"The path {self._add_path} does not exist. Please provide an existing directory.",
51+
)
5052

5153
def _scaffold(self) -> None:
5254
"""Scaffold the specified resource file."""
@@ -59,8 +61,7 @@ def _scaffold(self) -> None:
5961
)
6062

6163
# Initialize Walker and Copier for file operations
62-
63-
64+
6465
walker = Walker(
6566
resources=self.common_resources,
6667
resource_id="common.devfile",
@@ -71,28 +72,27 @@ def _scaffold(self) -> None:
7172
)
7273
paths = walker.collect_paths()
7374
copier = Copier(output=self.output)
74-
75+
7576
if self._no_overwrite:
7677
if paths.has_conflicts():
7778
raise CreatorError(
7879
"The destination directory contains files that may be overwritten. "
79-
"Please re-run ansible-creator with --overwrite to proceed."
80+
"Please re-run ansible-creator with --overwrite to proceed.",
8081
)
8182

8283
if not paths.has_conflicts() or self._force or self._overwrite:
8384
copier.copy_containers(paths)
8485
self.output.note(f"Resource added to {self._add_path}")
8586
return
8687

87-
8888
if not self._overwrite:
8989
question = "Some files in the destination directory may be overwritten. Do you want to proceed?"
9090
if ask_yes_no(question):
9191
copier.copy_containers(paths)
9292
else:
9393
raise CreatorError(
9494
"The destination contains files that could be overwritten. "
95-
"Please re-run ansible-creator with --overwrite to continue."
95+
"Please re-run ansible-creator with --overwrite to continue.",
9696
)
9797

98-
self.output.note(f"Resource added to {self._add_path}")
98+
self.output.note(f"Resource added to {self._add_path}")

0 commit comments

Comments
 (0)