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é.
42 lines
1.3 KiB
Python
42 lines
1.3 KiB
Python
from typing import Any, Union
|
|
|
|
from .core import decode, encode
|
|
|
|
|
|
def ToASCII(label: str) -> bytes:
|
|
"""Compatibility shim for :rfc:`3490` ``ToASCII``.
|
|
|
|
Delegates to :func:`idna.encode` (IDNA 2008). Provided to ease porting
|
|
of code written against the legacy :mod:`encodings.idna` API; new code
|
|
should call :func:`idna.encode` directly.
|
|
|
|
:param label: The label or domain to encode.
|
|
:returns: The encoded form as ASCII :class:`bytes`.
|
|
"""
|
|
return encode(label)
|
|
|
|
|
|
def ToUnicode(label: Union[bytes, bytearray]) -> str:
|
|
"""Compatibility shim for :rfc:`3490` ``ToUnicode``.
|
|
|
|
Delegates to :func:`idna.decode` (IDNA 2008). Provided to ease porting
|
|
of code written against the legacy :mod:`encodings.idna` API; new code
|
|
should call :func:`idna.decode` directly.
|
|
|
|
:param label: The label or domain to decode.
|
|
:returns: The decoded Unicode form.
|
|
"""
|
|
return decode(label)
|
|
|
|
|
|
def nameprep(s: Any) -> None:
|
|
"""Stub for :rfc:`3491` Nameprep, which is not used by IDNA 2008.
|
|
|
|
IDNA 2008 (:rfc:`5891`) replaces Nameprep with the per-codepoint
|
|
validity classes from :rfc:`5892`; this function exists only to
|
|
return a clear error if legacy code attempts to call it.
|
|
|
|
:raises NotImplementedError: Always.
|
|
"""
|
|
raise NotImplementedError("IDNA 2008 does not utilise nameprep protocol")
|