Skip to content

Commit b555e9a

Browse files
committed
Apply code formatting with Black formatter
Signed-off-by: Samuel Amen Ague <ague.samuel27@gmail.com>
1 parent cd3a26a commit b555e9a

33 files changed

Lines changed: 448 additions & 159 deletions

File tree

pycompiler_ark/Core/Locking/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,9 @@ def build_lock_payload(
307307
"project": _project_section(project, git_commit, git_branch),
308308
"workspace": {"exclude_patterns": exclude_patterns},
309309
"build": _build_section(build),
310-
"engine": _engine_section(engine_id, engine_version, workspace, resolved_command),
310+
"engine": _engine_section(
311+
engine_id, engine_version, workspace, resolved_command
312+
),
311313
"platform": _platform_section(python_version),
312314
"dependencies": _dependencies_section(dependencies),
313315
}

pycompiler_ark/Core/SystemDepsManager/processes.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,12 @@ def shell_run(
6565
proc.setProgram(cmd[0])
6666
proc.setArguments(cmd[1:])
6767
else:
68-
proc.setProgram("/bin/bash" if platform.system() != "Windows" else "cmd.exe")
69-
proc.setArguments(["-lc", cmd] if platform.system() != "Windows" else ["/c", cmd])
68+
proc.setProgram(
69+
"/bin/bash" if platform.system() != "Windows" else "cmd.exe"
70+
)
71+
proc.setArguments(
72+
["-lc", cmd] if platform.system() != "Windows" else ["/c", cmd]
73+
)
7074

7175
def _read_output():
7276
raw = proc.readAllStandardOutput().data().decode(errors="replace")
@@ -101,7 +105,9 @@ def run_elevated_shell(
101105
on_finished: Optional[Callable[[int, QProcess.ExitStatus], None]] = None,
102106
) -> Optional[QProcess]:
103107
if platform.system() == "Linux":
104-
return self.shell_run(f"pkexec bash -lc '{cmd_str}'", cwd, on_output, on_finished)
108+
return self.shell_run(
109+
f"pkexec bash -lc '{cmd_str}'", cwd, on_output, on_finished
110+
)
105111
if platform.system() == "Windows":
106112
return self.shell_run(cmd_str, cwd, on_output, on_finished)
107113
return None

pycompiler_ark/Core/Venv_Manager/Manager.py

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -781,7 +781,9 @@ def _prompt_recreate_invalid_venv(self, venv_root: str, reason: str) -> bool:
781781
try:
782782
from pycompiler_ark.Ui import output
783783

784-
output.info(f"[DELETE] Deleted invalid venv: {venv_root}", gui=self.parent)
784+
output.info(
785+
f"[DELETE] Deleted invalid venv: {venv_root}", gui=self.parent
786+
)
785787
except Exception:
786788
pass
787789
except Exception as e:
@@ -979,7 +981,9 @@ def _after_binding(ok_bind: bool):
979981
try:
980982
from pycompiler_ark.Ui import output
981983

982-
output.success("[OK] Outils systeme verifies.", gui=self.parent)
984+
output.success(
985+
"[OK] Outils systeme verifies.", gui=self.parent
986+
)
983987
except Exception:
984988
pass
985989

@@ -1459,7 +1463,9 @@ def select_best_venv(self, workspace_dir: str) -> str | None:
14591463
try:
14601464
from pycompiler_ark.Ui import output
14611465

1462-
output.success(f"[OK] Un seul venv trouve: {venvs[0]}", gui=self.parent)
1466+
output.success(
1467+
f"[OK] Un seul venv trouve: {venvs[0]}", gui=self.parent
1468+
)
14631469
except Exception:
14641470
pass
14651471
return venvs[0]
@@ -1587,7 +1593,9 @@ def create_venv_if_needed(self, path: str):
15871593
try:
15881594
from pycompiler_ark.Ui import output
15891595

1590-
output.info("[CONFIG] Aucun venv trouve, creation automatique...", gui=self.parent)
1596+
output.info(
1597+
"[CONFIG] Aucun venv trouve, creation automatique...", gui=self.parent
1598+
)
15911599
except Exception:
15921600
pass
15931601
try:
@@ -1761,7 +1769,9 @@ def _on_venv_created(self, process, code, status, venv_path):
17611769
try:
17621770
from pycompiler_ark.Ui import output
17631771

1764-
output.success("[OK] Environnement virtuel cree avec succes.", gui=self.parent)
1772+
output.success(
1773+
"[OK] Environnement virtuel cree avec succes.", gui=self.parent
1774+
)
17651775
except Exception:
17661776
pass
17671777
self._call_ui("update_progress_message", "venv_creation", "Venv cree.")
@@ -2260,7 +2270,9 @@ def _after_binding(ok_bind: bool):
22602270

22612271
return True
22622272
except Exception as e:
2263-
self._emit_output(f"[ERROR] Erreur lors de la configuration du workspace: {e}")
2273+
self._emit_output(
2274+
f"[ERROR] Erreur lors de la configuration du workspace: {e}"
2275+
)
22642276
return False
22652277

22662278
def get_manager_info(self, workspace_dir: str) -> dict:

pycompiler_ark/Core/engine/base.py

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,16 @@ def __post_init__(self) -> None:
5050
object.__setattr__(self, "id", nid)
5151
object.__setattr__(self, "name", nname)
5252
object.__setattr__(self, "version", nversion)
53-
object.__setattr__(self, "required_core_version", str(self.required_core_version or "1.0.0").strip() or "1.0.0")
54-
object.__setattr__(self, "required_sdk_version", str(self.required_sdk_version or "1.0.0").strip() or "1.0.0")
53+
object.__setattr__(
54+
self,
55+
"required_core_version",
56+
str(self.required_core_version or "1.0.0").strip() or "1.0.0",
57+
)
58+
object.__setattr__(
59+
self,
60+
"required_sdk_version",
61+
str(self.required_sdk_version or "1.0.0").strip() or "1.0.0",
62+
)
5563
object.__setattr__(self, "description", str(self.description or "").strip())
5664
object.__setattr__(self, "author", str(self.author or "").strip())
5765

@@ -66,8 +74,12 @@ def resolve_engine_meta(engine_or_cls: object) -> EngineMeta:
6674
if isinstance(meta, dict):
6775
return EngineMeta(
6876
id=str(meta.get("id") or getattr(engine_or_cls, "id", "") or "base"),
69-
name=str(meta.get("name") or getattr(engine_or_cls, "name", "") or "BaseEngine"),
70-
version=str(meta.get("version") or getattr(engine_or_cls, "version", "") or "1.0.0"),
77+
name=str(
78+
meta.get("name") or getattr(engine_or_cls, "name", "") or "BaseEngine"
79+
),
80+
version=str(
81+
meta.get("version") or getattr(engine_or_cls, "version", "") or "1.0.0"
82+
),
7183
required_core_version=str(
7284
meta.get("required_core_version")
7385
or getattr(engine_or_cls, "required_core_version", "1.0.0")
@@ -94,6 +106,7 @@ def resolve_engine_meta(engine_or_cls: object) -> EngineMeta:
94106
author=str(getattr(engine_or_cls, "author", "") or ""),
95107
)
96108

109+
97110
class CompilerEngine:
98111
"""
99112
Base class for a pluggable compilation engine.

pycompiler_ark/Core/engine/registry.py

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -200,30 +200,53 @@ def _apply_tab_text(obj: Any, key: str, default: str | None = None) -> None:
200200
chosen_key = "type_label"
201201
elif name == "console_label":
202202
chosen_key = "console_label"
203-
elif name in {"windowed_checkbox", "disable_console_checkbox", "debug_checkbox", "verbose_checkbox", "onefile_checkbox", "standalone_checkbox"}:
203+
elif name in {
204+
"windowed_checkbox",
205+
"disable_console_checkbox",
206+
"debug_checkbox",
207+
"verbose_checkbox",
208+
"onefile_checkbox",
209+
"standalone_checkbox",
210+
}:
204211
chosen_key = name
205212

206-
if system_key and system_attr and _is_system_value(getattr(root, str(system_attr), None)):
213+
if (
214+
system_key
215+
and system_attr
216+
and _is_system_value(getattr(root, str(system_attr), None))
217+
):
207218
chosen_key = str(system_key)
208219

209220
if format_attr:
210221
ctx = getattr(root, str(format_attr), None)
211222
if ctx:
212-
value = translate(engine_id, chosen_key, current if isinstance(current, str) else None)
223+
value = translate(
224+
engine_id,
225+
chosen_key,
226+
current if isinstance(current, str) else None,
227+
)
213228
if isinstance(value, str) and value:
214229
obj.setText(value.replace("{path}", str(ctx)))
215230
elif none_key:
216-
_apply_text(obj, str(none_key), current if isinstance(current, str) else None)
231+
_apply_text(
232+
obj,
233+
str(none_key),
234+
current if isinstance(current, str) else None,
235+
)
217236
continue
218237

219238
_apply_text(obj, chosen_key, current if isinstance(current, str) else None)
220239

221240
tooltip_key = _prop(obj, "i18n_tooltip_key") or _tooltip_for_name(name)
222241
if tooltip_key:
223242
current = obj.toolTip() if hasattr(obj, "toolTip") else None
224-
_apply_tooltip(obj, str(tooltip_key), current if isinstance(current, str) else None)
243+
_apply_tooltip(
244+
obj, str(tooltip_key), current if isinstance(current, str) else None
245+
)
225246

226-
placeholder_key = _prop(obj, "i18n_placeholder_key") or _placeholder_for_name(name)
247+
placeholder_key = _prop(obj, "i18n_placeholder_key") or _placeholder_for_name(
248+
name
249+
)
227250
if placeholder_key:
228251
current = obj.placeholderText() if hasattr(obj, "placeholderText") else None
229252
_apply_placeholder(
@@ -233,7 +256,9 @@ def _apply_tab_text(obj: Any, key: str, default: str | None = None) -> None:
233256
tab_key = _prop(obj, "i18n_tab_key")
234257
if tab_key:
235258
current = obj.text() if hasattr(obj, "text") else None
236-
_apply_tab_text(obj, str(tab_key), current if isinstance(current, str) else None)
259+
_apply_tab_text(
260+
obj, str(tab_key), current if isinstance(current, str) else None
261+
)
237262

238263

239264
def _refresh_live_engine_widgets(gui) -> None:
@@ -698,6 +723,7 @@ def load_engine_language_file(engine_package: str, code: str) -> dict:
698723
"""
699724
try:
700725
import importlib.resources as ilr
726+
701727
try:
702728
import yaml
703729
except ImportError: # pragma: no cover - PyYAML attendu dans le projet

pycompiler_ark/Core/engine/validator.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,9 @@ def validate_engines_compatibility(
178178
continue
179179

180180
# Check compatibility
181-
result = check_engine_compatibility(engine, core_version, engine_sdk_version)
181+
result = check_engine_compatibility(
182+
engine, core_version, engine_sdk_version
183+
)
182184

183185
if result.is_compatible:
184186
compatible_engines.append(engine)
Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,31 @@
11
# SPDX-License-Identifier: Apache-2.0
22
# Copyright 2026 Samuel Amen Ague
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
316
"""Core utilities shared across PyCompiler ARK."""
417

5-
from pycompiler_ark.Core.utils.ensure_tools import ToolsCheckResult, ensure_tools
18+
from .data import DependencyInfo, PythonFileInfo
19+
from .ensure_tools import ToolsCheckResult, ensure_tools
20+
from .executor import ExecutionResult, executor
621

7-
__all__ = ["ToolsCheckResult", "ensure_tools"]
22+
__all__ = [
23+
"ToolsCheckResult",
24+
"ensure_tools",
25+
"DependencyInfo",
26+
"PythonFileInfo",
27+
"VenvInfo",
28+
"GitInfo",
29+
"executor",
30+
"ExecutionResult",
31+
]

pycompiler_ark/Core/utils/data.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@
3636
from typing import Any, Dict, Iterator, List, Optional, Pattern, Set, Tuple, Union
3737

3838

39-
40-
4139
@dataclass
4240
class DependencyInfo:
4341
"""Information about project dependencies."""
@@ -86,4 +84,4 @@ class GitInfo:
8684
staged_files: List[str] = field(default_factory=list)
8785
modified_files: List[str] = field(default_factory=list)
8886
untracked_files: List[str] = field(default_factory=list)
89-
last_commit: Optional[str] = None
87+
last_commit: Optional[str] = None

0 commit comments

Comments
 (0)