Skip to content

Commit 2f619d3

Browse files
committed
feat: reformating
1 parent 583d1ea commit 2f619d3

47 files changed

Lines changed: 752 additions & 409 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Core/AdvancedConfigEditor.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,9 @@ def validate_ark_payload(data: Any) -> tuple[list[str], list[str]]:
117117
errs.append(f"build.data[{idx}] missing 'source'.")
118118
m_type = item.get("type")
119119
if m_type is not None and m_type not in ("file", "dir"):
120-
errs.append(f"build.data[{idx}].type must be 'file' or 'dir'.")
120+
errs.append(
121+
f"build.data[{idx}].type must be 'file' or 'dir'."
122+
)
121123

122124
# plugins
123125
plugins = data.get("plugins")

Core/Auto_Command_Builder/auto_build.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -363,12 +363,14 @@ def _builder(
363363
if val is None:
364364
continue
365365
tmpl_import = pkg_to_import.get(pkg, pkg)
366-
366+
367367
tokens: list[str] = []
368368
if isinstance(val, str):
369369
tokens.append(val.replace("{import_name}", tmpl_import))
370370
elif isinstance(val, list):
371-
tokens.extend([str(x).replace("{import_name}", tmpl_import) for x in val])
371+
tokens.extend(
372+
[str(x).replace("{import_name}", tmpl_import) for x in val]
373+
)
372374
elif isinstance(val, dict):
373375
a = val.get("args") or val.get("flags")
374376
if isinstance(a, list):
@@ -377,7 +379,7 @@ def _builder(
377379
)
378380
elif isinstance(a, str):
379381
tokens.append(str(a).replace("{import_name}", tmpl_import))
380-
382+
381383
if tokens:
382384
# de-dup at the action level (sequence of tokens) while preserving order
383385
action_key = tuple(tokens)
@@ -660,7 +662,9 @@ def _load_engine_package_mapping(
660662

661663
engine_cls = get_engine(engine_id)
662664
pkg_name = (
663-
_engine_package_for_class(engine_cls) if engine_cls else f"engines.{engine_id}"
665+
_engine_package_for_class(engine_cls)
666+
if engine_cls
667+
else f"engines.{engine_id}"
664668
)
665669
pkg = importlib.import_module(pkg_name)
666670
with ilr.as_file(ilr.files(pkg).joinpath("mapping.json")) as p:

Core/Compiler/engine_runner.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,9 @@ def resolve_engine_command(
100100
program, args = resolved
101101

102102
# Integrated Auto-mapping: apply engine-specific flags from detected imports
103-
if gui and str(os.environ.get("PYCOMPILER_DISABLE_AUTO_BUILDER", "0")).lower() not in (
103+
if gui and str(
104+
os.environ.get("PYCOMPILER_DISABLE_AUTO_BUILDER", "0")
105+
).lower() not in (
104106
"1",
105107
"true",
106108
"yes",
@@ -125,10 +127,10 @@ def resolve_engine_command(
125127

126128
if target_idx != -1:
127129
# Insert before target_idx
128-
# We don't check "if a not in args" because some flags like
130+
# We don't check "if a not in args" because some flags like
129131
# --collect-all or --hidden-import can be repeated with different values.
130132
# However, we avoid adding the EXACT same pair twice if possible.
131-
133+
132134
# To be safe and simple, we just insert all auto_args at target_idx
133135
# and rely on the engine or auto-builder to have filtered exact duplicates.
134136
for a in reversed(auto_args):
@@ -249,9 +251,7 @@ def run_engine_compile_streaming(
249251
# -- 2. Resolve (program, args, env) from engine --------------------------
250252
try:
251253
if on_stdout:
252-
on_stdout(
253-
"Etape 1/3 : Verification et installation des outils requis..."
254-
)
254+
on_stdout("Etape 1/3 : Verification et installation des outils requis...")
255255

256256
import Core.engine as engines_loader
257257

@@ -266,7 +266,7 @@ def _log(fr, en):
266266
bridge = gui
267267
else:
268268
from PySide6.QtCore import QObject
269-
269+
270270
# We pass a dummy 'gui' object that supports log_i18n_level-like logging
271271
class LogBridge(QObject):
272272
def __init__(self, log_cb, workspace_path: Path, verbose: bool = False):
@@ -301,7 +301,9 @@ def venv_manager(self):
301301
# Automatically load workspace preferences if available
302302
if hasattr(self, "workspace_dir") and self.workspace_dir:
303303
try:
304-
self._venv_manager.apply_workspace_pref(self.workspace_dir)
304+
self._venv_manager.apply_workspace_pref(
305+
self.workspace_dir
306+
)
305307
except Exception:
306308
pass
307309
return self._venv_manager
@@ -336,7 +338,7 @@ def sys_deps_manager(self):
336338
env_display = f"Venv ({vpath})"
337339
except Exception:
338340
pass
339-
341+
340342
if on_stdout:
341343
on_stdout(f"⚙️ Environnement : {env_display}")
342344

@@ -470,7 +472,6 @@ def _read_stream(stream, callback):
470472
}
471473

472474

473-
474475
# -- helpers ------------------------------------------------------------------
475476

476477

Core/Compiler/utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,7 @@ def check_module_available(module_name: str, python_path: Optional[str] = None)
485485
except Exception:
486486
return False
487487

488+
488489
def check_internet_connection(timeout: float = 3.0, retries: int = 0) -> bool:
489490
"""
490491
Check if internet connection is available with high certainty.

Core/Configs/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,9 @@ def _normalize_list(values: Any) -> list[Any]:
178178

179179

180180
def _normalize_build_exclude(values: Any) -> list[str]:
181-
return list(dict.fromkeys(pattern for pattern in _normalize_list(values) if pattern))
181+
return list(
182+
dict.fromkeys(pattern for pattern in _normalize_list(values) if pattern)
183+
)
182184

183185

184186
def _normalize_workspace_exclude(values: Any) -> list[str]:

Core/Locking/__init__.py

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -83,23 +83,26 @@ def included_workspace_files(
8383
"""
8484
included: list[Path] = []
8585
ws_str = str(workspace.resolve())
86-
86+
8787
# Prune list for os.walk
8888
prune_dirs = {".git", ".ark", "__pycache__", "venv", ".venv", "build", "dist"}
89-
89+
9090
import os
91+
9192
for root, dirs, files in os.walk(ws_str):
9293
# 1. Early pruning of common heavy/system directories
9394
dirs[:] = [d for d in dirs if d not in prune_dirs]
94-
95+
9596
# 2. Apply custom exclude patterns to directories
9697
rel_root = os.path.relpath(root, ws_str)
9798
if rel_root == ".":
9899
rel_root = ""
99-
100+
100101
if rel_root:
101-
if any(_matches_exclude_pattern(rel_root + "/", p) for p in exclude_patterns):
102-
dirs[:] = [] # Stop recursion here
102+
if any(
103+
_matches_exclude_pattern(rel_root + "/", p) for p in exclude_patterns
104+
):
105+
dirs[:] = [] # Stop recursion here
103106
continue
104107

105108
# 3. Process files
@@ -108,7 +111,7 @@ def included_workspace_files(
108111
if any(_matches_exclude_pattern(rel_path, p) for p in exclude_patterns):
109112
continue
110113
included.append(Path(root) / f)
111-
114+
112115
return sorted(included)
113116

114117

@@ -131,13 +134,14 @@ def get_git_commit_hash(workspace: Path) -> str | None:
131134
"""Return the current Git commit hash of the workspace if available."""
132135
try:
133136
import subprocess
137+
134138
result = subprocess.run(
135139
["git", "rev-parse", "HEAD"],
136140
cwd=str(workspace),
137141
capture_output=True,
138142
text=True,
139143
timeout=5,
140-
check=True
144+
check=True,
141145
)
142146
return result.stdout.strip()
143147
except Exception:
@@ -148,13 +152,14 @@ def get_git_branch(workspace: Path) -> str | None:
148152
"""Return the current Git branch of the workspace if available."""
149153
try:
150154
import subprocess
155+
151156
result = subprocess.run(
152157
["git", "rev-parse", "--abbrev-ref", "HEAD"],
153158
cwd=str(workspace),
154159
capture_output=True,
155160
text=True,
156161
timeout=5,
157-
check=True
162+
check=True,
158163
)
159164
return result.stdout.strip()
160165
except Exception:
@@ -163,6 +168,7 @@ def get_git_branch(workspace: Path) -> str | None:
163168

164169
def next_build_id(lock_dir: Path) -> str:
165170
from datetime import UTC
171+
166172
today = datetime.now(UTC).strftime("%Y_%m_%d")
167173
prefix = f"ARK_{today}_"
168174
seq = 1
@@ -193,7 +199,7 @@ def build_lock_payload(
193199
build_id = next_build_id(lock_dir)
194200
git_commit = get_git_commit_hash(workspace)
195201
git_branch = get_git_branch(workspace)
196-
202+
197203
return {
198204
"build_id": build_id,
199205
"project": {
@@ -279,7 +285,7 @@ def build_context_from_lock(lock_payload: dict[str, Any]) -> BuildContext:
279285
project = lock_payload.get("project") or {}
280286
build = lock_payload.get("build") or {}
281287
workspace_cfg = lock_payload.get("workspace") or {}
282-
288+
283289
# Check build.exclude (new) then workspace.exclude_patterns (legacy)
284290
exclude_patterns = list(build.get("exclude") or [])
285291
if not exclude_patterns:

Core/SysDependencyManager.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ def _cancel_task(
116116
try:
117117
if proc is not None and proc.state() != QProcess.NotRunning:
118118
from Core.process_killer import kill_process_tree
119+
119120
kill_process_tree(proc.processId())
120121
except Exception:
121122
pass
@@ -383,6 +384,7 @@ def _on_timeout():
383384
try:
384385
self._dbg(f"sudo shell timeout after {timeout_s}s; killing")
385386
from Core.process_killer import kill_process_tree
387+
386388
kill_process_tree(proc.processId())
387389
except Exception:
388390
pass

0 commit comments

Comments
 (0)