Skip to content

Commit

Permalink
Fix Py3.9-3.10 incompatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
dvolodin7 committed Nov 23, 2023
1 parent 5004036 commit 2597d77
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/gufo/thor/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def handle_up(self: "Cli", ns: argparse.Namespace) -> ExitCode:
return ExitCode.ERR
return ExitCode.OK

def handle_down(self: "Cli", ns: argparse.Namespace) -> ExitCode:
def handle_stop(self: "Cli", ns: argparse.Namespace) -> ExitCode:
"""Stop NOC."""
try:
subprocess.check_call(["docker", "compose", "stop"])
Expand Down
5 changes: 4 additions & 1 deletion src/gufo/thor/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,11 @@ def get_sample(name: str) -> str:
Returns:
A string containinng sample code.
"""
# Warning: joinpath() accepts only one
# parameter on Py3.9 and Py3.10
return (
resources.files("gufo.thor")
.joinpath("samples", f"{name}.yml")
.joinpath("samples")
.joinpath(f"{name}.yml")
.read_text()
)
6 changes: 5 additions & 1 deletion src/gufo/thor/services/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -534,9 +534,13 @@ def render_file(
kwargs: Template context
"""
# Load template
# Warning: joinpath() accepts only one
# parameter on Py3.9 and Py3.10
data = (
resources.files("gufo.thor")
.joinpath("templates", cls.name, tpl)
.joinpath("templates")
.joinpath(cls.name)
.joinpath(tpl)
.read_text()
)
for k, v in kwargs.items():
Expand Down

0 comments on commit 2597d77

Please sign in to comment.