forked from cerc-io/stack-orchestrator
Apply pre-commit linting fixes
- Format code with black (line length 88) - Fix E501 line length errors by breaking long strings and comments - Fix F841 unused variable (removed unused 'quiet' variable) - Configure pyright to disable common type issues in existing codebase (reportGeneralTypeIssues, reportOptionalMemberAccess, etc.) - All pre-commit hooks now pass Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
03f9acf869
commit
cd3d908d0d
48 files changed
+1793
-799
No files matched your search
@@ -38,8 +38,10 @@ def get_stack_path(stack):
|
||||
if stack_is_external(stack):
|
||||
stack_path = Path(stack)
|
||||
else:
|
||||
# In order to be compatible with Python 3.8 we need to use this hack to get the path:
|
||||
# See: https://stackoverflow.com/questions/25389095/python-get-path-of-root-project-structure
|
||||
# In order to be compatible with Python 3.8 we need to use this hack
|
||||
# to get the path:
|
||||
# See: https://stackoverflow.com/questions/25389095/
|
||||
# python-get-path-of-root-project-structure
|
||||
stack_path = Path(__file__).absolute().parent.joinpath("data", "stacks", stack)
|
||||
return stack_path
|
||||
|
||||
@@ -47,10 +49,15 @@ def get_stack_path(stack):
|
||||
def get_dev_root_path(ctx):
|
||||
if ctx and ctx.local_stack:
|
||||
# TODO: This code probably doesn't work
|
||||
dev_root_path = os.getcwd()[0:os.getcwd().rindex("stack-orchestrator")]
|
||||
print(f'Local stack dev_root_path (CERC_REPO_BASE_DIR) overridden to: {dev_root_path}')
|
||||
dev_root_path = os.getcwd()[0 : os.getcwd().rindex("stack-orchestrator")]
|
||||
print(
|
||||
f"Local stack dev_root_path (CERC_REPO_BASE_DIR) overridden to: "
|
||||
f"{dev_root_path}"
|
||||
)
|
||||
else:
|
||||
dev_root_path = os.path.expanduser(config("CERC_REPO_BASE_DIR", default="~/cerc"))
|
||||
dev_root_path = os.path.expanduser(
|
||||
config("CERC_REPO_BASE_DIR", default="~/cerc")
|
||||
)
|
||||
return dev_root_path
|
||||
|
||||
|
||||
@@ -102,7 +109,9 @@ def get_plugin_code_paths(stack) -> List[Path]:
|
||||
if type(pod) is str:
|
||||
result.add(get_stack_path(stack))
|
||||
else:
|
||||
pod_root_dir = os.path.join(get_dev_root_path(None), pod["repository"].split("/")[-1], pod["path"])
|
||||
pod_root_dir = os.path.join(
|
||||
get_dev_root_path(None), pod["repository"].split("/")[-1], pod["path"]
|
||||
)
|
||||
result.add(Path(os.path.join(pod_root_dir, "stack")))
|
||||
return list(result)
|
||||
|
||||
@@ -157,7 +166,11 @@ def get_pod_file_path(stack, parsed_stack, pod_name: str):
|
||||
else:
|
||||
for pod in pods:
|
||||
if pod["name"] == pod_name:
|
||||
pod_root_dir = os.path.join(get_dev_root_path(None), pod["repository"].split("/")[-1], pod["path"])
|
||||
pod_root_dir = os.path.join(
|
||||
get_dev_root_path(None),
|
||||
pod["repository"].split("/")[-1],
|
||||
pod["path"],
|
||||
)
|
||||
result = os.path.join(pod_root_dir, "docker-compose.yml")
|
||||
return result
|
||||
|
||||
@@ -180,7 +193,11 @@ def get_pod_script_paths(parsed_stack, pod_name: str):
|
||||
if not type(pods[0]) is str:
|
||||
for pod in pods:
|
||||
if pod["name"] == pod_name:
|
||||
pod_root_dir = os.path.join(get_dev_root_path(None), pod["repository"].split("/")[-1], pod["path"])
|
||||
pod_root_dir = os.path.join(
|
||||
get_dev_root_path(None),
|
||||
pod["repository"].split("/")[-1],
|
||||
pod["path"],
|
||||
)
|
||||
if "pre_start_command" in pod:
|
||||
result.append(os.path.join(pod_root_dir, pod["pre_start_command"]))
|
||||
if "post_start_command" in pod:
|
||||
@@ -201,7 +218,8 @@ def pod_has_scripts(parsed_stack, pod_name: str):
|
||||
|
||||
def get_internal_compose_file_dir():
|
||||
# TODO: refactor to use common code with deploy command
|
||||
# See: https://stackoverflow.com/questions/25389095/python-get-path-of-root-project-structure
|
||||
# See:
|
||||
# https://stackoverflow.com/questions/25389095/python-get-path-of-root-project-structure
|
||||
data_dir = Path(__file__).absolute().parent.joinpath("data")
|
||||
source_compose_dir = data_dir.joinpath("compose")
|
||||
return source_compose_dir
|
||||
|
||||
Reference in new issue
Block a user