943acbc573
Durcit la convention de nommage des projets (dérive constatée : 'Sliding Automation', 'code_versioning'... au lieu des formes canoniques). - trilium_api.py : projets_canoniques() lit le référentiel = valeurs du label projet sur les notes de type=projet (source unique, pas de constante en dur). Note-projet CodeVersioning créée (manquait). - mcp_server.py : _valider_projet() branché dans les 6 tools de création (add_decision/history/backlog, new_conversation, create_entite, add_skill). Refuse un projet non canonique (suggestion si faute) ou inconnu (renvoi au processus de création de projet). Ne verrouille pas si référentiel illisible. - lint_audit.py : VAL-nommage aligné sur le référentiel (attrape casse, espace ET snake_case ; l'ancien 'contient un espace' ratait code_versioning). - Données : 79 notes ré-étiquetées vers les 3 formes canoniques. Quality by design : l'erreur de nommage devient impossible à l'écriture, le Lint n'est plus que le filet de sécurité.
80 lines
2.0 KiB
Python
80 lines
2.0 KiB
Python
from __future__ import annotations
|
|
|
|
from abc import abstractmethod
|
|
from signal import Signals
|
|
|
|
from ._resources import AsyncResource
|
|
from ._streams import ByteReceiveStream, ByteSendStream
|
|
|
|
|
|
class Process(AsyncResource):
|
|
"""An asynchronous version of :class:`subprocess.Popen`."""
|
|
|
|
@abstractmethod
|
|
async def wait(self) -> int:
|
|
"""
|
|
Wait until the process exits.
|
|
|
|
:return: the exit code of the process
|
|
"""
|
|
|
|
@abstractmethod
|
|
def terminate(self) -> None:
|
|
"""
|
|
Terminates the process, gracefully if possible.
|
|
|
|
On Windows, this calls ``TerminateProcess()``.
|
|
On POSIX systems, this sends ``SIGTERM`` to the process.
|
|
|
|
.. seealso:: :meth:`subprocess.Popen.terminate`
|
|
"""
|
|
|
|
@abstractmethod
|
|
def kill(self) -> None:
|
|
"""
|
|
Kills the process.
|
|
|
|
On Windows, this calls ``TerminateProcess()``.
|
|
On POSIX systems, this sends ``SIGKILL`` to the process.
|
|
|
|
.. seealso:: :meth:`subprocess.Popen.kill`
|
|
"""
|
|
|
|
@abstractmethod
|
|
def send_signal(self, signal: Signals) -> None:
|
|
"""
|
|
Send a signal to the subprocess.
|
|
|
|
.. seealso:: :meth:`subprocess.Popen.send_signal`
|
|
|
|
:param signal: the signal number (e.g. :data:`signal.SIGHUP`)
|
|
"""
|
|
|
|
@property
|
|
@abstractmethod
|
|
def pid(self) -> int:
|
|
"""The process ID of the process."""
|
|
|
|
@property
|
|
@abstractmethod
|
|
def returncode(self) -> int | None:
|
|
"""
|
|
The return code of the process. If the process has not yet terminated, this will
|
|
be ``None``.
|
|
"""
|
|
|
|
@property
|
|
@abstractmethod
|
|
def stdin(self) -> ByteSendStream | None:
|
|
"""The stream for the standard input of the process."""
|
|
|
|
@property
|
|
@abstractmethod
|
|
def stdout(self) -> ByteReceiveStream | None:
|
|
"""The stream for the standard output of the process."""
|
|
|
|
@property
|
|
@abstractmethod
|
|
def stderr(self) -> ByteReceiveStream | None:
|
|
"""The stream for the standard error output of the process."""
|