feat: referentiel projets dynamique + validation nommage by design
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é.
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
from functools import partial
|
||||
|
||||
from dask.callbacks import Callback
|
||||
|
||||
from .auto import tqdm as tqdm_auto
|
||||
|
||||
__author__ = {"github.com/": ["casperdcl"]}
|
||||
__all__ = ['TqdmCallback']
|
||||
|
||||
|
||||
class TqdmCallback(Callback):
|
||||
"""Dask callback for task progress."""
|
||||
def __init__(self, start=None, pretask=None, tqdm_class=tqdm_auto,
|
||||
**tqdm_kwargs):
|
||||
"""
|
||||
Parameters
|
||||
----------
|
||||
tqdm_class : optional
|
||||
`tqdm` class to use for bars [default: `tqdm.auto.tqdm`].
|
||||
tqdm_kwargs : optional
|
||||
Any other arguments used for all bars.
|
||||
"""
|
||||
super().__init__(start=start, pretask=pretask)
|
||||
if tqdm_kwargs:
|
||||
tqdm_class = partial(tqdm_class, **tqdm_kwargs)
|
||||
self.tqdm_class = tqdm_class
|
||||
|
||||
def _start_state(self, _, state):
|
||||
self.pbar = self.tqdm_class(total=sum(
|
||||
len(state[k]) for k in ['ready', 'waiting', 'running', 'finished']))
|
||||
|
||||
def _posttask(self, *_, **__):
|
||||
self.pbar.update()
|
||||
|
||||
def _finish(self, *_, **__):
|
||||
self.pbar.close()
|
||||
|
||||
def display(self):
|
||||
"""Displays in the current cell in Notebooks."""
|
||||
container = getattr(self.bar, 'container', None)
|
||||
if container is None:
|
||||
return
|
||||
from .notebook import display
|
||||
display(container)
|
||||
Reference in New Issue
Block a user