reperes 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
reperes/__init__.py ADDED
@@ -0,0 +1,36 @@
1
+ """REPERES : SDK Python et CLI de l'API REPERES (champ social et médico-social).
2
+
3
+ Contexte documentaire sourcé, information ponctuelle vérifiée, valeurs de référence datées et
4
+ sourcées, simulateurs (rémunération conventionnelle, ESAT, trajectoire, APA à domicile) et réponses
5
+ rédigées. Documentation : https://reperes.bmse.fr/docs
6
+ """
7
+ from __future__ import annotations
8
+
9
+ __version__ = "0.1.0"
10
+
11
+ from .client import URL_PAR_DEFAUT, Reperes, Resultat
12
+ from .erreurs import (
13
+ CreditsEpuises,
14
+ DebitDepasse,
15
+ ErreurAuthentification,
16
+ ErreurConfiguration,
17
+ ErreurDroit,
18
+ ErreurReperes,
19
+ ErreurRequete,
20
+ ServiceIndisponible,
21
+ )
22
+
23
+ __all__ = [
24
+ "Reperes",
25
+ "Resultat",
26
+ "URL_PAR_DEFAUT",
27
+ "ErreurReperes",
28
+ "ErreurConfiguration",
29
+ "ErreurRequete",
30
+ "ErreurAuthentification",
31
+ "ErreurDroit",
32
+ "CreditsEpuises",
33
+ "DebitDepasse",
34
+ "ServiceIndisponible",
35
+ "__version__",
36
+ ]
reperes/__main__.py ADDED
@@ -0,0 +1,3 @@
1
+ from .cli import main
2
+
3
+ raise SystemExit(main())
reperes/_http.py ADDED
@@ -0,0 +1,166 @@
1
+ """Transport HTTP du client : bibliothèque standard seule, HTTPS exigé hors de la machine locale, aucune
2
+ redirection suivie (la clé ne quitte jamais l'origine), nouvelles tentatives sur un débit dépassé."""
3
+ from __future__ import annotations
4
+
5
+ import json
6
+ import math
7
+ import time
8
+ from dataclasses import dataclass
9
+ from typing import Any, Callable
10
+ from urllib.error import HTTPError, URLError
11
+ from urllib.parse import urlsplit
12
+ from urllib.request import HTTPRedirectHandler, Request, build_opener
13
+
14
+ from .erreurs import (
15
+ CreditsEpuises,
16
+ DebitDepasse,
17
+ ErreurAuthentification,
18
+ ErreurConfiguration,
19
+ ErreurDroit,
20
+ ErreurReperes,
21
+ ErreurRequete,
22
+ ServiceIndisponible,
23
+ )
24
+
25
+ LOCALES = {"localhost", "127.0.0.1", "::1"}
26
+ ATTENTE_MAX = 30
27
+
28
+
29
+ class _SansRedirection(HTTPRedirectHandler):
30
+ def redirect_request(self, req, fp, code, msg, headers, newurl): # noqa: D401
31
+ return None
32
+
33
+
34
+ def verifier_url(base_url: str) -> str:
35
+ """Origine HTTP(S) sans identifiants, requête ni fragment ; HTTPS hors de la machine locale."""
36
+ try:
37
+ url = urlsplit(base_url)
38
+ valide = url.scheme in {"http", "https"} and bool(url.hostname) and url.port != 0
39
+ except ValueError:
40
+ valide = False
41
+ if not valide or url.username or url.password or url.query or url.fragment:
42
+ raise ErreurConfiguration("URL invalide : origine HTTP(S) attendue, sans identifiants, requête ni fragment.")
43
+ if url.scheme == "http" and url.hostname not in LOCALES:
44
+ raise ErreurConfiguration("HTTPS requis hors de la machine locale.")
45
+ return base_url.rstrip("/")
46
+
47
+
48
+ def verifier_cle(cle: str) -> str:
49
+ if not cle or any(ord(c) < 33 or ord(c) > 126 for c in cle):
50
+ raise ErreurConfiguration("Clé API invalide.")
51
+ return cle
52
+
53
+
54
+ @dataclass
55
+ class Reponse:
56
+ statut: int
57
+ entetes: dict[str, str]
58
+ corps: Any
59
+
60
+
61
+ INDICES = {
62
+ 401: "clé absente ou invalide (REPERES_API_KEY)",
63
+ 402: "franchise du mois atteinte, crédits insuffisants",
64
+ 403: "opération hors de votre droit",
65
+ }
66
+
67
+
68
+ def _entier(v: Any) -> int | None:
69
+ return v if isinstance(v, int) and not isinstance(v, bool) else None
70
+
71
+
72
+ def erreur_http(statut: int, corps: Any, entetes: dict[str, str]) -> ErreurReperes:
73
+ """Erreur typée depuis une réponse HTTP en échec ; message sans secret ni contenu."""
74
+ c = corps if isinstance(corps, dict) else {}
75
+ morceaux = [f"HTTP {statut}"]
76
+ for cle in ("error", "detail", "credits_required", "credits_balance", "upgrade_url", "retry_after_seconds"):
77
+ v = c.get(cle)
78
+ if isinstance(v, (str, int)) and not isinstance(v, bool):
79
+ morceaux.append(f"{cle}={v}")
80
+ if isinstance(c.get("error"), dict) and isinstance(c["error"].get("code"), str):
81
+ morceaux.append(f"code={c['error']['code']}")
82
+ if statut in INDICES:
83
+ morceaux.append(f"— {INDICES[statut]}")
84
+ message = " ".join(morceaux)
85
+ kw = dict(
86
+ statut_http=statut,
87
+ code=c.get("error") if isinstance(c.get("error"), str) else None,
88
+ detail=c.get("detail") if isinstance(c.get("detail"), str) else None,
89
+ upgrade_url=c.get("upgrade_url") if isinstance(c.get("upgrade_url"), str) else None,
90
+ )
91
+ if statut == 401:
92
+ return ErreurAuthentification(message, **kw)
93
+ if statut == 402:
94
+ return CreditsEpuises(message, credits_requis=_entier(c.get("credits_required")), solde=_entier(c.get("credits_balance")), **kw)
95
+ if statut == 403:
96
+ return ErreurDroit(message, **kw)
97
+ if statut == 429:
98
+ attente = _entier(c.get("retry_after_seconds"))
99
+ if attente is None and (entetes.get("retry-after") or "").isdigit():
100
+ attente = int(entetes["retry-after"])
101
+ return DebitDepasse(message, attente=attente, **kw)
102
+ if statut >= 500:
103
+ return ServiceIndisponible(message, **kw)
104
+ return ErreurRequete(message, **kw)
105
+
106
+
107
+ class Transport:
108
+ def __init__(self, base_url: str, *, cle: str | None, timeout: float, tentatives: int,
109
+ agent: str, dormir: Callable[[float], None] = time.sleep):
110
+ self.base = verifier_url(base_url)
111
+ if not math.isfinite(timeout) or timeout <= 0:
112
+ raise ErreurConfiguration("Le délai doit être un nombre positif.")
113
+ self.cle = verifier_cle(cle) if cle else None
114
+ self.timeout = timeout
115
+ self.tentatives = max(0, tentatives)
116
+ self.agent = agent
117
+ self._dormir = dormir
118
+ self._ouvreur = build_opener(_SansRedirection())
119
+
120
+ def appeler(self, methode: str, chemin: str, corps: Any = None, *, authentifie: bool = True,
121
+ statuts_resultat: frozenset[int] = frozenset()) -> Reponse:
122
+ """Appel JSON. Un code de `statuts_resultat` (422 d'une simulation non couverte) rend son corps
123
+ comme résultat ; les autres échecs lèvent une `ErreurReperes` typée."""
124
+ if authentifie and not self.cle:
125
+ raise ErreurConfiguration("REPERES_API_KEY absente : créez une clé sur la page de connexion MCP de REPERES.")
126
+ entetes = {"Accept": "application/json", "User-Agent": self.agent}
127
+ if authentifie and self.cle:
128
+ entetes["Authorization"] = f"Bearer {self.cle}"
129
+ donnees = None
130
+ if corps is not None:
131
+ entetes["Content-Type"] = "application/json"
132
+ donnees = json.dumps(corps, ensure_ascii=False).encode("utf-8")
133
+ essai = 0
134
+ while True:
135
+ req = Request(self.base + chemin, data=donnees, headers=entetes, method=methode)
136
+ try:
137
+ with self._ouvreur.open(req, timeout=self.timeout) as r:
138
+ return Reponse(r.status, {k.lower(): v for k, v in r.headers.items()}, _json(r.read()))
139
+ except HTTPError as exc:
140
+ statut = exc.code
141
+ entetes_r = {k.lower(): v for k, v in (exc.headers or {}).items()}
142
+ try:
143
+ brut = exc.read()
144
+ finally:
145
+ exc.close()
146
+ try:
147
+ corps_r = json.loads(brut.decode("utf-8")) if brut else None
148
+ except (ValueError, UnicodeError):
149
+ corps_r = None
150
+ if statut in statuts_resultat and isinstance(corps_r, dict):
151
+ return Reponse(statut, entetes_r, corps_r)
152
+ erreur = erreur_http(statut, corps_r, entetes_r)
153
+ if isinstance(erreur, DebitDepasse) and essai < self.tentatives:
154
+ essai += 1
155
+ self._dormir(min(ATTENTE_MAX, erreur.attente or 2 ** essai))
156
+ continue
157
+ raise erreur from None
158
+ except (URLError, OSError, TimeoutError):
159
+ raise ServiceIndisponible("Service injoignable ou délai dépassé.") from None
160
+
161
+
162
+ def _json(brut: bytes) -> Any:
163
+ try:
164
+ return json.loads(brut.decode("utf-8"))
165
+ except (ValueError, UnicodeError):
166
+ raise ServiceIndisponible("Réponse JSON invalide.") from None
reperes/cli.py ADDED
@@ -0,0 +1,289 @@
1
+ """Commande `reperes` : l'API REPERES en ligne de commande, au-dessus du SDK.
2
+
3
+ export REPERES_API_KEY=rpr_sk_…
4
+ reperes context "Quels repères pour construire un projet de service ?" --exploration
5
+ reperes precision "Quelle est la durée maximale d'un CPOM ?"
6
+ printf '%s' 'Ma question' | reperes context -
7
+ reperes valeur smic.horaire --date 2025-03-01
8
+ reperes valeur apa.domicile.plafond --coord gir=1
9
+ reperes valeur "plafond APA GIR 1" (question : valeur du paramètre retenu)
10
+ reperes valeur point.ccn66 --historique
11
+ reperes valeurs --q "valeur du point" (paramètres candidats) ; --famille cotisations
12
+ reperes remuneration ccn66 educateur_specialise --anciennete 10 --etablissement mecs --oui surclassement_internat
13
+ reperes remuneration --modeles (conventions, emplois, types d'établissement)
14
+ reperes trajectoire ccn66 moniteur_educateur --etablissement ime --lecture carriere --debut 2016
15
+ reperes esat --part 30
16
+ reperes autonomie scenario.json --prix 32 (démonstrateur APA ; un cas de référence est accepté)
17
+ reperes source <id> --content (public)
18
+ reperes contrats ; reperes schema calcul.esat.v1 ; reperes openapi (publics)
19
+
20
+ Sortie : le JSON reçu sur stdout ; les erreurs sur stderr, avec le code HTTP et le code d'erreur de
21
+ l'API, jamais la clé. Codes de sortie : 0 succès (y compris un statut métier : `not_found`,
22
+ contexte vide) ; 1 erreur HTTP ou réseau, clé absente, ou livraison dégradée (recherche
23
+ `unavailable`, précision `error`, valeur `technical_error`, simulation `erreur`) ; 2 arguments
24
+ invalides.
25
+ """
26
+ from __future__ import annotations
27
+
28
+ import argparse
29
+ import json
30
+ import os
31
+ import re
32
+ import sys
33
+ from typing import Any
34
+
35
+ from . import __version__
36
+ from .client import URL_PAR_DEFAUT, Reperes
37
+ from .erreurs import ErreurConfiguration, ErreurReperes
38
+
39
+ PARAMETRE_RE = re.compile(r"^[a-z0-9_]+(\.[a-z0-9_]+)*$")
40
+
41
+
42
+ def degrade(resultat: Any) -> bool:
43
+ """Livraison à ne pas confondre avec un succès : recherche en panne, statut d'erreur."""
44
+ if not isinstance(resultat, dict):
45
+ return False
46
+ recherche = (resultat.get("metadata") or {}).get("retrieval") or {}
47
+ return (recherche.get("status") == "unavailable" or resultat.get("status") in {"error", "technical_error"}
48
+ or resultat.get("statut") == "erreur")
49
+
50
+
51
+ def coordonnees(paires: list[str]) -> dict[str, str]:
52
+ out: dict[str, str] = {}
53
+ for c in paires:
54
+ k, sep, v = c.partition("=")
55
+ if not sep or not k or not v:
56
+ raise ErreurConfiguration(f"Coordonnée invalide : {c} (dimension=valeur attendu).")
57
+ out[k] = v
58
+ return out
59
+
60
+
61
+ def profil_remuneration(args: argparse.Namespace) -> dict:
62
+ """Profil `calcul.remuneration.v1` depuis les options (un fichier `--profil` sert de base)."""
63
+ profil: dict = {}
64
+ if args.profil:
65
+ try:
66
+ with open(args.profil, encoding="utf-8") as f:
67
+ profil = json.load(f)
68
+ except (OSError, ValueError):
69
+ raise ErreurConfiguration(f"Profil illisible : {args.profil}.") from None
70
+ if not isinstance(profil, dict):
71
+ raise ErreurConfiguration("Profil : objet JSON attendu.")
72
+ for cle, valeur in (("convention", args.convention), ("emploi", args.emploi), ("date", args.date),
73
+ ("anciennete_ans", args.anciennete), ("temps_travail", args.temps),
74
+ ("type_etablissement", args.etablissement), ("territoire", args.territoire),
75
+ ("classement", args.classement)):
76
+ if valeur is not None:
77
+ profil[cle] = valeur
78
+ for noms, oui in ((args.oui, True), (args.non, False)):
79
+ for ident in noms:
80
+ profil.setdefault("reponses", {})[ident] = oui
81
+ for q in args.quantite:
82
+ k, sep, v = q.partition("=")
83
+ if not sep or not k or not v:
84
+ raise ErreurConfiguration(f"Quantité invalide : {q} (identifiant=nombre attendu).")
85
+ profil.setdefault("quantites", {})[k] = v
86
+ employeur = profil.setdefault("employeur", {})
87
+ if args.effectif is not None:
88
+ employeur["effectif"] = args.effectif
89
+ if args.taux_atmp is not None:
90
+ employeur["taux_atmp"] = args.taux_atmp
91
+ if not employeur:
92
+ del profil["employeur"]
93
+ if not profil.get("convention") or not profil.get("emploi"):
94
+ raise ErreurConfiguration("Convention et emploi requis (voir `reperes remuneration --modeles`).")
95
+ return profil
96
+
97
+
98
+ def demande_trajectoire(args: argparse.Namespace) -> dict:
99
+ """Demande `calcul.trajectoire.v1` : profil des options (sans date), période, lecture, mois de
100
+ référence des prix."""
101
+ profil = profil_remuneration(args)
102
+ profil.pop("date", None)
103
+ demande: dict = {"profil": profil}
104
+ for cle, valeur in (("debut", args.debut), ("fin", args.fin), ("lecture", args.lecture), ("reference", args.reference)):
105
+ if valeur is not None:
106
+ demande[cle] = valeur
107
+ return demande
108
+
109
+
110
+ def demande_esat(args: argparse.Namespace) -> dict:
111
+ """Demande `calcul.esat.v1` : part de l'ESAT en % du SMIC ou en euros du mois."""
112
+ if (args.part is None) == (args.euros is None):
113
+ raise ErreurConfiguration("Part de l'ESAT : --part (en % du SMIC) ou --euros (par mois), l'un des deux.")
114
+ d: dict = {"part_esat": {"pct_smic": args.part} if args.part is not None else {"mensuelle": args.euros}}
115
+ if args.date:
116
+ d["date"] = args.date
117
+ if args.temps is not None:
118
+ d["temps_travail"] = args.temps
119
+ if args.effectif is not None:
120
+ d["effectif"] = args.effectif
121
+ couverture = {k: v for k, v in (("sante_esat", args.sante_esat), ("sante_travailleur", args.sante_travailleur),
122
+ ("prevoyance_esat", args.prevoyance)) if v is not None}
123
+ if couverture:
124
+ d["couverture"] = couverture
125
+ return d
126
+
127
+
128
+ def scenario_autonomie(args: argparse.Namespace) -> dict:
129
+ """Scénario `calcul.autonomie.v1` lu dans un fichier (ou `-` : entrée standard) ; les options
130
+ modifient une hypothèse pour un rejeu."""
131
+ try:
132
+ if args.scenario == "-":
133
+ sc = json.loads(sys.stdin.read())
134
+ else:
135
+ with open(args.scenario, encoding="utf-8") as f:
136
+ sc = json.load(f)
137
+ except (OSError, ValueError):
138
+ raise ErreurConfiguration(f"Scénario illisible : {args.scenario}.") from None
139
+ if isinstance(sc, dict) and isinstance(sc.get("entree"), dict):
140
+ sc = sc["entree"] # cas de référence : son entrée
141
+ if not isinstance(sc, dict):
142
+ raise ErreurConfiguration("Scénario : objet JSON attendu.")
143
+ if args.date:
144
+ sc["date"] = args.date
145
+ if args.prix is not None:
146
+ sc.setdefault("realise", {})["prix_horaire"] = args.prix
147
+ if args.taux is not None:
148
+ sc.setdefault("plan", {})["taux_participation"] = args.taux
149
+ return sc
150
+
151
+
152
+ AIDE = {
153
+ "context": "contexte sourcé, sans rédaction",
154
+ "precision": "information ponctuelle et citation vérifiée",
155
+ "answer": "réponse rédigée (option Génération ou crédits)",
156
+ "valeur": "valeur de référence datée et sourcée (identifiant ou question)",
157
+ "valeurs": "recherche ou catalogue des valeurs de référence",
158
+ "remuneration": "simulation de rémunération conventionnelle (brut, net, coût employeur)",
159
+ "trajectoire": "trajectoire d'une rémunération conventionnelle en euros courants et constants",
160
+ "esat": "rémunération garantie d'un travailleur d'ESAT : part de l'ESAT et aide au poste",
161
+ "autonomie": "démonstrateur APA à domicile : plan d'aide et reste à charge d'un mois",
162
+ "source": "passeport de preuve d'un document (public)",
163
+ "contrats": "contrats de réponse publiés (public)",
164
+ "schema": "schéma JSON d'un contrat (public)",
165
+ "openapi": "description OpenAPI de l'API (public)",
166
+ }
167
+
168
+
169
+ def analyseur() -> argparse.ArgumentParser:
170
+ parser = argparse.ArgumentParser(prog="reperes", description="L'API REPERES en ligne de commande.")
171
+ parser.add_argument("--version", action="version", version=f"reperes {__version__}")
172
+ sub = parser.add_subparsers(dest="commande", required=True)
173
+ for commande, aide in AIDE.items():
174
+ p = sub.add_parser(commande, help=aide)
175
+ if commande in {"context", "precision", "answer"}:
176
+ p.add_argument("query", help="question, ou - pour la lire sur l'entrée standard")
177
+ if commande == "context":
178
+ p.add_argument("--exploration", action="store_true", help="balayage documentaire élargi")
179
+ elif commande == "source":
180
+ p.add_argument("id", help="identifiant `sources[].id`")
181
+ p.add_argument("--content", action="store_true", help="avec le texte du document")
182
+ elif commande == "schema":
183
+ p.add_argument("contrat", help="nom du contrat, ex. calcul.esat.v1")
184
+ elif commande == "valeur":
185
+ p.add_argument("cible", help="identifiant (ex. smic.horaire) ou question en français")
186
+ p.add_argument("--date", help="date de lecture AAAA-MM-JJ (défaut : aujourd'hui)")
187
+ p.add_argument("--territoire", help="nat_FR (défaut), dep_976, dep_2A…")
188
+ p.add_argument("--coord", action="append", default=[], help="coordonnée dimension=valeur (répétable)")
189
+ p.add_argument("--historique", action="store_true", help="toutes les valeurs successives")
190
+ elif commande == "valeurs":
191
+ p.add_argument("--q", help="valeur cherchée, en français")
192
+ p.add_argument("--famille", help="famille de paramètres (catalogue)")
193
+ elif commande in {"remuneration", "trajectoire"}:
194
+ p.add_argument("convention", nargs="?", help="ccn66, ccn51")
195
+ p.add_argument("emploi", nargs="?", help="identifiant d'emploi (voir `reperes remuneration --modeles`)")
196
+ p.add_argument("--profil", help="profil JSON complet (les options le complètent)")
197
+ if commande == "remuneration":
198
+ p.add_argument("--modeles", action="store_true", help="conventions, emplois et types d'établissement")
199
+ p.add_argument("--date", help="date AAAA-MM-JJ (défaut : aujourd'hui)")
200
+ p.add_argument("--anciennete", help="ancienneté retenue dans l'emploi, en années")
201
+ else:
202
+ p.set_defaults(date=None)
203
+ p.add_argument("--anciennete", help="ancienneté la première année, en années")
204
+ p.add_argument("--debut", type=int, help="première année (défaut 2014)")
205
+ p.add_argument("--fin", type=int, help="dernière année (défaut : dernier IPC publié)")
206
+ p.add_argument("--lecture", choices=["poste_constant", "carriere"], help="poste constant (défaut) ou carrière")
207
+ p.add_argument("--reference", help="mois de référence des euros constants AAAA-MM")
208
+ p.add_argument("--temps", help="part d'un temps plein (défaut 1)")
209
+ p.add_argument("--etablissement", help="type d'établissement (ehpad, mecs, ime…)")
210
+ p.add_argument("--territoire", help="nat_FR (défaut), dep_971…")
211
+ p.add_argument("--classement", help="emploi de classement d'un emploi d'usage")
212
+ p.add_argument("--oui", action="append", default=[], help="question à laquelle répondre oui (répétable)")
213
+ p.add_argument("--non", action="append", default=[], help="question à laquelle répondre non (répétable)")
214
+ p.add_argument("--quantite", action="append", default=[], help="élément variable identifiant=nombre (répétable)")
215
+ p.add_argument("--effectif", type=int, help="effectif de l'entreprise")
216
+ p.add_argument("--taux-atmp", dest="taux_atmp", help="taux AT/MP notifié (%%)")
217
+ elif commande == "esat":
218
+ p.add_argument("--part", help="part financée par l'ESAT, en %% du SMIC")
219
+ p.add_argument("--euros", help="part financée par l'ESAT, en euros du mois")
220
+ p.add_argument("--temps", help="part d'un temps plein (défaut 1)")
221
+ p.add_argument("--date", help="date AAAA-MM-JJ (défaut : aujourd'hui)")
222
+ p.add_argument("--effectif", type=int, help="effectif de l'organisme gestionnaire (FNAL)")
223
+ p.add_argument("--sante-esat", dest="sante_esat", help="complémentaire santé, part de l'ESAT (€ par mois)")
224
+ p.add_argument("--sante-travailleur", dest="sante_travailleur", help="complémentaire santé, part du travailleur (€ par mois)")
225
+ p.add_argument("--prevoyance", help="prévoyance, cotisation de l'ESAT (€ par mois)")
226
+ elif commande == "autonomie":
227
+ p.add_argument("scenario", help="scénario JSON (ou cas de référence), - pour l'entrée standard")
228
+ p.add_argument("--date", help="date de lecture des barèmes AAAA-MM-JJ")
229
+ p.add_argument("--prix", help="tarif horaire facturé par le service")
230
+ p.add_argument("--taux", help="taux de participation notifié (%%)")
231
+ p.add_argument("--base-url", default=os.getenv("REPERES_API_URL") or URL_PAR_DEFAUT)
232
+ p.add_argument("--timeout", type=float, default=180, help="secondes (défaut 180)")
233
+ p.add_argument("--pretty", action="store_true", help="JSON indenté")
234
+ return parser
235
+
236
+
237
+ def executer(client: Reperes, args: argparse.Namespace, parser: argparse.ArgumentParser) -> Any:
238
+ c = args.commande
239
+ if c in {"context", "precision", "answer"}:
240
+ question = (sys.stdin.read() if args.query == "-" else args.query).strip()
241
+ if not question:
242
+ parser.error("La question est vide.")
243
+ if c == "context":
244
+ return client.context(question, exploration=args.exploration)
245
+ return client.precision(question) if c == "precision" else client.answer(question)
246
+ if c == "valeur":
247
+ cible = args.cible.strip()
248
+ if not cible:
249
+ parser.error("Identifiant ou question vide.")
250
+ coords = coordonnees(args.coord)
251
+ if PARAMETRE_RE.match(cible):
252
+ if args.historique:
253
+ return client.historique(cible, territoire=args.territoire, coordonnees=coords)
254
+ return client.valeur(cible, date=args.date, territoire=args.territoire, coordonnees=coords)
255
+ if args.historique:
256
+ raise ErreurConfiguration("--historique exige un identifiant de paramètre (voir `reperes valeurs --q`).")
257
+ return client.resoudre(cible, date=args.date, territoire=args.territoire, coordonnees=coords)
258
+ if c == "valeurs":
259
+ return client.rechercher(args.q, famille=args.famille)
260
+ if c == "remuneration":
261
+ return client.modeles() if args.modeles else client.remuneration(profil_remuneration(args))
262
+ if c == "trajectoire":
263
+ return client.trajectoire(demande_trajectoire(args))
264
+ if c == "esat":
265
+ return client.esat(demande_esat(args))
266
+ if c == "autonomie":
267
+ return client.autonomie(scenario_autonomie(args))
268
+ if c == "source":
269
+ if not args.id.strip():
270
+ parser.error("Identifiant vide.")
271
+ return client.source(args.id, contenu=args.content)
272
+ if c == "contrats":
273
+ return client.contrats()
274
+ if c == "schema":
275
+ return client.schema(args.contrat)
276
+ return client.openapi()
277
+
278
+
279
+ def main(argv: list[str] | None = None) -> int:
280
+ parser = analyseur()
281
+ args = parser.parse_args(argv)
282
+ try:
283
+ client = Reperes(base_url=args.base_url, timeout=args.timeout)
284
+ resultat = executer(client, args, parser)
285
+ except ErreurReperes as exc:
286
+ print(str(exc), file=sys.stderr)
287
+ return 1
288
+ print(json.dumps(resultat, ensure_ascii=False, indent=2 if args.pretty else None))
289
+ return 1 if degrade(resultat) else 0
reperes/client.py ADDED
@@ -0,0 +1,203 @@
1
+ """Client de l'API REPERES.
2
+
3
+ from reperes import Reperes
4
+
5
+ client = Reperes() # clé lue dans REPERES_API_KEY
6
+ smic = client.valeur("smic.horaire", date="2026-03-01")
7
+ print(smic["valeurs"][0]["valeur"], smic.operation_id)
8
+
9
+ Chaque méthode rend un `Resultat` : le JSON de la réponse (un `dict`, au contrat déclaré dans
10
+ `schema_version`), avec l'identifiant de l'opération comptée et, si elle a été payée en crédits, le
11
+ nombre de crédits débités et le solde. Contrats : https://reperes.bmse.fr/docs/contrats
12
+ """
13
+ from __future__ import annotations
14
+
15
+ import os
16
+ from typing import Any, Mapping
17
+ from urllib.parse import quote, urlencode
18
+
19
+ from ._http import Reponse, Transport
20
+ from .erreurs import ErreurConfiguration
21
+
22
+ URL_PAR_DEFAUT = "https://mcp.reperes.bmse.fr"
23
+ NON_COUVERT = frozenset({422})
24
+
25
+
26
+ class Resultat(dict):
27
+ """Réponse JSON de l'API, avec les métadonnées de l'opération.
28
+
29
+ `operation_id` : identifiant de l'opération comptée, à communiquer au support ;
30
+ `credits_debites`, `credits_restants` : quand l'opération dépasse la franchise du mois ;
31
+ `statut_http` : 200, ou 422 pour une simulation non couverte (le résultat dit pourquoi).
32
+ """
33
+
34
+ operation_id: str | None
35
+ credits_debites: int | None
36
+ credits_restants: int | None
37
+ statut_http: int
38
+
39
+ @classmethod
40
+ def depuis(cls, r: Reponse) -> "Resultat":
41
+ corps = r.corps if isinstance(r.corps, dict) else {"donnees": r.corps}
42
+ res = cls(corps)
43
+ res.statut_http = r.statut
44
+ res.operation_id = r.entetes.get("x-reperes-operation-id")
45
+ res.credits_debites = _entier(r.entetes.get("x-reperes-credits-charged"))
46
+ res.credits_restants = _entier(r.entetes.get("x-reperes-credits-remaining"))
47
+ return res
48
+
49
+ @property
50
+ def contrat(self) -> str | None:
51
+ """Contrat de la réponse (`schema_version`), ex. `calcul.esat.v1`."""
52
+ v = self.get("schema_version")
53
+ return v if isinstance(v, str) else None
54
+
55
+
56
+ def _entier(v: str | None) -> int | None:
57
+ return int(v) if v and v.isdigit() else None
58
+
59
+
60
+ def _requete(params: list[tuple[str, str]]) -> str:
61
+ return "?" + urlencode(params) if params else ""
62
+
63
+
64
+ def _coordonnees(date: str | None, territoire: str | None, coordonnees: Mapping[str, Any] | None) -> list[tuple[str, str]]:
65
+ p: list[tuple[str, str]] = []
66
+ if date:
67
+ p.append(("date", date))
68
+ if territoire:
69
+ p.append(("territoire", territoire))
70
+ for k, v in (coordonnees or {}).items():
71
+ p.append((str(k), str(v)))
72
+ return p
73
+
74
+
75
+ class Reperes:
76
+ """Client de l'API REPERES.
77
+
78
+ `api_key` : clé `rpr_sk_…` (défaut : variable `REPERES_API_KEY`), créée sur la page de connexion
79
+ MCP de REPERES ; `base_url` (défaut : `REPERES_API_URL`, puis l'API publique) ; `timeout` en
80
+ secondes ; `tentatives` : nouvelles tentatives sur un débit dépassé (429), en respectant
81
+ `Retry-After`.
82
+ """
83
+
84
+ def __init__(self, api_key: str | None = None, *, base_url: str | None = None, timeout: float = 180,
85
+ tentatives: int = 2):
86
+ from . import __version__
87
+
88
+ cle = (api_key if api_key is not None else os.getenv("REPERES_API_KEY", "")).strip() or None
89
+ self._t = Transport(
90
+ base_url or os.getenv("REPERES_API_URL") or URL_PAR_DEFAUT,
91
+ cle=cle, timeout=timeout, tentatives=tentatives, agent=f"reperes-python/{__version__}",
92
+ )
93
+
94
+ # Contexte et réponses -------------------------------------------------------------------
95
+
96
+ def context(self, question: str, *, exploration: bool = False) -> Resultat:
97
+ """Contexte sourcé (doctrine, actualité, preuves, statistiques) d'une question ; l'appelant rédige."""
98
+ corps: dict[str, Any] = {"query": _question(question)}
99
+ if exploration:
100
+ corps["exploration"] = True
101
+ return self._post("/api/v1/context", corps)
102
+
103
+ def precision(self, question: str) -> Resultat:
104
+ """Information ponctuelle et citation vérifiée, ou statut `not_found`, `depends`, `out_of_scope`."""
105
+ return self._post("/api/v1/precision", {"query": _question(question)})
106
+
107
+ def answer(self, question: str) -> Resultat:
108
+ """Réponse rédigée par REPERES, avec ses sources (option Génération ou crédits)."""
109
+ return self._post("/api/v1/answer", {"query": _question(question)})
110
+
111
+ # Valeurs de référence --------------------------------------------------------------------
112
+
113
+ def valeur(self, parametre: str, *, date: str | None = None, territoire: str | None = None,
114
+ coordonnees: Mapping[str, Any] | None = None) -> Resultat:
115
+ """Valeur applicable d'un paramètre (`smic.horaire`, `apa.domicile.plafond` avec `{"gir": 1}`…)."""
116
+ chemin = "/api/v1/valeurs/" + quote(_identifiant(parametre), safe="")
117
+ return self._get(chemin + _requete(_coordonnees(date, territoire, coordonnees)))
118
+
119
+ def historique(self, parametre: str, *, territoire: str | None = None,
120
+ coordonnees: Mapping[str, Any] | None = None) -> Resultat:
121
+ """Valeurs successives d'un paramètre (`territoire="*"` : tous les territoires)."""
122
+ chemin = "/api/v1/valeurs/" + quote(_identifiant(parametre), safe="") + "/historique"
123
+ return self._get(chemin + _requete(_coordonnees(None, territoire, coordonnees)))
124
+
125
+ def resoudre(self, question: str, *, date: str | None = None, territoire: str | None = None,
126
+ coordonnees: Mapping[str, Any] | None = None) -> Resultat:
127
+ """Valeur du paramètre qui répond à une question en français (`ambiguous` et candidats sinon)."""
128
+ params = [("q", _question(question)), ("resoudre", "1"), *_coordonnees(date, territoire, coordonnees)]
129
+ return self._get("/api/v1/valeurs" + _requete(params))
130
+
131
+ def rechercher(self, q: str | None = None, *, famille: str | None = None) -> Resultat:
132
+ """Paramètres candidats (recherche `q`) ou catalogue d'une famille, sans valeur."""
133
+ params = [(k, v) for k, v in (("q", q), ("famille", famille)) if v]
134
+ return self._get("/api/v1/valeurs" + _requete(params))
135
+
136
+ # Simulateurs -----------------------------------------------------------------------------
137
+
138
+ def remuneration(self, profil: Mapping[str, Any]) -> Resultat:
139
+ """Simulation de rémunération CCN 66 ou CCN 51 (`calcul.remuneration.v1`)."""
140
+ return self._post("/api/v1/calcul/remuneration", dict(profil), statuts_resultat=NON_COUVERT)
141
+
142
+ def modeles(self) -> Resultat:
143
+ """Conventions, emplois, éléments variables et types d'établissement (`calcul.modeles.v1`)."""
144
+ return self._get("/api/v1/calcul/modeles")
145
+
146
+ def trajectoire(self, demande: Mapping[str, Any]) -> Resultat:
147
+ """Trajectoire d'une rémunération en euros courants et constants (`calcul.trajectoire.v1`)."""
148
+ return self._post("/api/v1/calcul/trajectoire", dict(demande), statuts_resultat=NON_COUVERT)
149
+
150
+ def esat(self, demande: Mapping[str, Any]) -> Resultat:
151
+ """Rémunération garantie d'un travailleur d'ESAT (`calcul.esat.v1`)."""
152
+ return self._post("/api/v1/calcul/esat", dict(demande), statuts_resultat=NON_COUVERT)
153
+
154
+ def autonomie(self, scenario: Mapping[str, Any]) -> Resultat:
155
+ """Démonstrateur APA à domicile : plan d'aide et reste à charge d'un mois (`calcul.autonomie.v1`).
156
+
157
+ Accepte un cas de référence (`{"entree": {...}}`) : son entrée est envoyée."""
158
+ sc = scenario.get("entree") if isinstance(scenario.get("entree"), Mapping) else scenario
159
+ return self._post("/api/v1/calcul/autonomie", dict(sc), statuts_resultat=NON_COUVERT)
160
+
161
+ # Publics : sources, contrats, description de l'API ---------------------------------------
162
+
163
+ def source(self, identifiant: str, *, contenu: bool = False) -> Resultat:
164
+ """Passeport de preuve d'un document cité (`sources[].id`), avec son texte si `contenu`."""
165
+ if not identifiant.strip():
166
+ raise ErreurConfiguration("Identifiant de source vide.")
167
+ chemin = "/sources/" + quote(identifiant.strip(), safe="") + ("/content" if contenu else "")
168
+ return self._get(chemin, authentifie=False)
169
+
170
+ def openapi(self) -> Resultat:
171
+ """Description OpenAPI de l'API."""
172
+ return self._get("/api/v1/openapi.json", authentifie=False)
173
+
174
+ def contrats(self) -> list[dict[str, Any]]:
175
+ """Contrats de réponse publiés : nom, titre, description, adresse du schéma."""
176
+ r = self._t.appeler("GET", "/api/v1/schemas", authentifie=False)
177
+ return list(r.corps) if isinstance(r.corps, list) else []
178
+
179
+ def schema(self, contrat: str) -> Resultat:
180
+ """Schéma JSON d'un contrat (`calcul.esat.v1`…)."""
181
+ return self._get(f"/api/v1/schemas/{quote(_identifiant(contrat), safe='')}.json", authentifie=False)
182
+
183
+ # -----------------------------------------------------------------------------------------
184
+
185
+ def _get(self, chemin: str, *, authentifie: bool = True) -> Resultat:
186
+ return Resultat.depuis(self._t.appeler("GET", chemin, authentifie=authentifie))
187
+
188
+ def _post(self, chemin: str, corps: dict[str, Any], *, statuts_resultat: frozenset[int] = frozenset()) -> Resultat:
189
+ return Resultat.depuis(self._t.appeler("POST", chemin, corps, statuts_resultat=statuts_resultat))
190
+
191
+
192
+ def _question(q: str) -> str:
193
+ q = (q or "").strip()
194
+ if not q:
195
+ raise ErreurConfiguration("La question est vide.")
196
+ return q
197
+
198
+
199
+ def _identifiant(v: str) -> str:
200
+ v = (v or "").strip()
201
+ if not v:
202
+ raise ErreurConfiguration("Identifiant vide.")
203
+ return v
reperes/erreurs.py ADDED
@@ -0,0 +1,62 @@
1
+ """Erreurs du client REPERES.
2
+
3
+ Une erreur ne contient jamais la clé API, la question posée ni le texte d'une réponse : seulement le
4
+ code HTTP et le code d'erreur public de l'API (`error`, `detail`, `upgrade_url`…).
5
+ """
6
+ from __future__ import annotations
7
+
8
+
9
+ class ErreurReperes(Exception):
10
+ """Erreur de l'API ou du client.
11
+
12
+ Attributs : `statut_http` (code HTTP, `None` hors réponse HTTP), `code` (champ `error` de l'API),
13
+ `detail`, `upgrade_url` (page des tarifs ou de souscription, quand l'API la donne).
14
+ """
15
+
16
+ def __init__(self, message: str, *, statut_http: int | None = None, code: str | None = None,
17
+ detail: str | None = None, upgrade_url: str | None = None):
18
+ super().__init__(message)
19
+ self.statut_http = statut_http
20
+ self.code = code
21
+ self.detail = detail
22
+ self.upgrade_url = upgrade_url
23
+
24
+
25
+ class ErreurConfiguration(ErreurReperes):
26
+ """Clé absente ou invalide, adresse de l'API invalide : rien n'a été envoyé."""
27
+
28
+
29
+ class ErreurRequete(ErreurReperes):
30
+ """Corps ou paramètre refusé par l'API (400, 404, 413) ; `detail` dit lequel."""
31
+
32
+
33
+ class ErreurAuthentification(ErreurReperes):
34
+ """Clé ou jeton absent, invalide ou révoqué (401)."""
35
+
36
+
37
+ class ErreurDroit(ErreurReperes):
38
+ """Opération hors du droit du compte (403) ; `upgrade_url` mène à la page des tarifs."""
39
+
40
+
41
+ class CreditsEpuises(ErreurReperes):
42
+ """Franchise du mois atteinte et crédits insuffisants (402).
43
+
44
+ `credits_requis` : coût de l'opération ; `solde` : crédits disponibles.
45
+ """
46
+
47
+ def __init__(self, message: str, *, credits_requis: int | None = None, solde: int | None = None, **kw):
48
+ super().__init__(message, **kw)
49
+ self.credits_requis = credits_requis
50
+ self.solde = solde
51
+
52
+
53
+ class DebitDepasse(ErreurReperes):
54
+ """Débit dépassé (429) après les nouvelles tentatives ; `attente` : secondes conseillées."""
55
+
56
+ def __init__(self, message: str, *, attente: int | None = None, **kw):
57
+ super().__init__(message, **kw)
58
+ self.attente = attente
59
+
60
+
61
+ class ServiceIndisponible(ErreurReperes):
62
+ """API injoignable, délai dépassé ou moteur indisponible (502, 503) ; l'opération n'est pas comptée."""
reperes/py.typed ADDED
File without changes
@@ -0,0 +1,133 @@
1
+ Metadata-Version: 2.4
2
+ Name: reperes
3
+ Version: 0.1.0
4
+ Summary: SDK Python et CLI de l'API REPERES : contexte documentaire sourcé, valeurs de référence et simulateurs du champ social et médico-social
5
+ Author: BMSE
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Documentation, https://reperes.bmse.fr/docs
8
+ Project-URL: Source, https://github.com/confidensia-lab/reperes-kit
9
+ Keywords: REPERES,ESSMS,médico-social,API,MCP,valeurs de référence,simulateur
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Natural Language :: French
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3 :: Only
16
+ Classifier: Typing :: Typed
17
+ Requires-Python: >=3.10
18
+ Description-Content-Type: text/markdown
19
+ License-File: LICENSE
20
+ Dynamic: license-file
21
+
22
+ # REPERES — kit de développement
23
+
24
+ SDK Python et CLI de l'API [REPERES](https://reperes.bmse.fr), l'outil d'expertise du champ social
25
+ et médico-social de BMSE : contexte documentaire sourcé, information ponctuelle vérifiée, valeurs de
26
+ référence datées et sourcées, simulateurs (rémunération conventionnelle CCN 66 et CCN 51, ESAT,
27
+ trajectoire en euros constants, APA à domicile) et réponses rédigées.
28
+
29
+ Python 3.10 ou plus, aucune dépendance. Licence Apache 2.0.
30
+
31
+ ```bash
32
+ pip install reperes
33
+ export REPERES_API_KEY=rpr_sk_…
34
+ ```
35
+
36
+ La clé se crée sur la [page de connexion MCP](https://reperes.bmse.fr/connecter/mcp) de REPERES,
37
+ rubrique « Clés API » ; un compte identifié suffit, l'usage est gratuit dans la franchise mensuelle
38
+ ([tarifs](https://reperes.bmse.fr/tarifs#api)).
39
+
40
+ ## SDK
41
+
42
+ ```python
43
+ from reperes import Reperes, CreditsEpuises
44
+
45
+ client = Reperes() # clé lue dans REPERES_API_KEY
46
+
47
+ smic = client.valeur("smic.horaire", date="2026-03-01")
48
+ print(smic["valeurs"][0]["valeur"], smic["valeurs"][0]["source"]["titre"])
49
+
50
+ plafond = client.valeur("apa.domicile.plafond", coordonnees={"gir": 1})
51
+
52
+ contexte = client.context("Quels repères pour construire un projet de service ?")
53
+ for s in contexte["sources"]:
54
+ print(s["title"], s["url"])
55
+
56
+ simulation = client.remuneration({
57
+ "convention": "ccn66",
58
+ "emploi": "educateur_specialise",
59
+ "anciennete_ans": 10,
60
+ "type_etablissement": "mecs",
61
+ })
62
+ print(simulation["statut"], simulation.operation_id)
63
+ ```
64
+
65
+ Chaque méthode rend un `Resultat` : le JSON de la réponse, au contrat déclaré dans `schema_version`,
66
+ avec `operation_id` (à communiquer au support) et, quand l'opération dépasse la franchise,
67
+ `credits_debites` et `credits_restants`.
68
+
69
+ | Méthode | Route | Contrat |
70
+ |---|---|---|
71
+ | `context(question, exploration=False)` | `POST /api/v1/context` | contexte sourcé |
72
+ | `precision(question)` | `POST /api/v1/precision` | information ponctuelle |
73
+ | `answer(question)` | `POST /api/v1/answer` | réponse rédigée |
74
+ | `valeur(id, date=, territoire=, coordonnees=)` | `GET /api/v1/valeurs/{id}` | `etalon.result.v1` |
75
+ | `historique(id)`, `resoudre(question)`, `rechercher(q, famille=)` | `GET /api/v1/valeurs…` | `etalon.result.v1` |
76
+ | `remuneration(profil)`, `modeles()` | `/api/v1/calcul/remuneration`, `/modeles` | `calcul.remuneration.v1` |
77
+ | `trajectoire(demande)` | `POST /api/v1/calcul/trajectoire` | `calcul.trajectoire.v1` |
78
+ | `esat(demande)` | `POST /api/v1/calcul/esat` | `calcul.esat.v1` |
79
+ | `autonomie(scenario)` | `POST /api/v1/calcul/autonomie` | `calcul.autonomie.v1` |
80
+ | `source(id, contenu=False)`, `contrats()`, `schema(nom)`, `openapi()` | publics | |
81
+
82
+ Une simulation non couverte (emploi inconnu, date hors période) rend son résultat avec
83
+ `statut: "erreur"` et `statut_http == 422`. Les autres échecs lèvent une erreur typée, sans jamais la
84
+ clé ni le texte de la question :
85
+
86
+ | Erreur | Cas |
87
+ |---|---|
88
+ | `ErreurConfiguration` | clé absente ou invalide, adresse invalide : rien n'est envoyé |
89
+ | `ErreurRequete` | corps ou paramètre refusé (`detail` dit lequel) |
90
+ | `ErreurAuthentification` | clé invalide ou révoquée (401) |
91
+ | `ErreurDroit` | opération hors du droit du compte (403, `upgrade_url`) |
92
+ | `CreditsEpuises` | franchise du mois atteinte, crédits insuffisants (402, `credits_requis`, `solde`) |
93
+ | `DebitDepasse` | débit dépassé après les nouvelles tentatives (429, `attente`) |
94
+ | `ServiceIndisponible` | API injoignable ou moteur indisponible (non compté) |
95
+
96
+ Toutes dérivent de `ErreurReperes`. Un débit dépassé est retenté deux fois par défaut, en respectant
97
+ `Retry-After` (`Reperes(tentatives=0)` pour s'en passer).
98
+
99
+ ## CLI
100
+
101
+ ```bash
102
+ reperes context "Quels repères pour construire un projet de service ?" --exploration
103
+ reperes precision "Quelle est la durée maximale d'un CPOM ?"
104
+ reperes valeur smic.horaire --date 2026-03-01
105
+ reperes valeur apa.domicile.plafond --coord gir=1
106
+ reperes valeur "plafond APA GIR 1"
107
+ reperes valeur point.ccn66 --historique
108
+ reperes remuneration ccn66 educateur_specialise --anciennete 10 --etablissement mecs --oui surclassement_internat
109
+ reperes remuneration --modeles
110
+ reperes trajectoire ccn66 moniteur_educateur --etablissement ime --lecture carriere --debut 2016
111
+ reperes esat --part 35 --effectif 30
112
+ reperes autonomie scenario.json --prix 32
113
+ reperes contrats
114
+ printf '%s' 'Ma question' | reperes context -
115
+ ```
116
+
117
+ Le JSON reçu sort sur stdout (`--pretty` pour l'indenter) ; les erreurs sur stderr, avec le code HTTP
118
+ et le code d'erreur de l'API. Codes de sortie : 0 succès, y compris un statut métier (`not_found`,
119
+ contexte vide) ; 1 erreur HTTP ou réseau, clé absente, ou livraison dégradée (recherche
120
+ indisponible, statut d'erreur) ; 2 arguments invalides. Options communes : `--base-url` (sinon
121
+ `REPERES_API_URL`), `--timeout` (180 secondes).
122
+
123
+ ## Documentation
124
+
125
+ - [Démarrage](https://reperes.bmse.fr/docs/demarrage), [référence de l'API](https://reperes.bmse.fr/docs/api)
126
+ - [Contrats](https://reperes.bmse.fr/docs/contrats) : le schéma JSON de chaque réponse, champ par champ
127
+ - [Connecteur MCP](https://reperes.bmse.fr/docs/mcp) : les mêmes opérations pour un assistant
128
+
129
+ ## Développement
130
+
131
+ ```bash
132
+ PYTHONPATH=src:tests python -m unittest discover -s tests -t tests
133
+ ```
@@ -0,0 +1,13 @@
1
+ reperes/__init__.py,sha256=czSve6k14YAMqUUoOTTNvdsmfzyeHJAR0Ww6Js6xmKM,932
2
+ reperes/__main__.py,sha256=k1ocEWawweo1qCJWNFAAvyxz3tcY13dzvCenHszij30,48
3
+ reperes/_http.py,sha256=h2voJLRGtl_FVF04PBWMr49EEpInw4E87DAXYIWlsqA,6966
4
+ reperes/cli.py,sha256=TjkjRwcd-tMmJyzzheRzGk1DOzPWu-IUoshwP6NQgys,15774
5
+ reperes/client.py,sha256=hVdHlPjzjbNwdSjxK_PRX4Mr9hSQ9p8CcWs1PRttvgQ,9615
6
+ reperes/erreurs.py,sha256=08HPIT-sK60yxqNb5TilxxDOTNEaIlr57RVpT_KCkHU,2225
7
+ reperes/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
+ reperes-0.1.0.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
9
+ reperes-0.1.0.dist-info/METADATA,sha256=MjqvKEqOhksNDZaKE6r7y6xmYhei-YIOA3n8m3_KCtE,6126
10
+ reperes-0.1.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
11
+ reperes-0.1.0.dist-info/entry_points.txt,sha256=ZBfiw1Zv3d7ZrukRLPXfamHU6EZ17mrd75ef91kiZ54,45
12
+ reperes-0.1.0.dist-info/top_level.txt,sha256=Vb5XWq6zR6uctJyZ-EG1XT-2DVi9XT5f_XJrj9h8gxE,8
13
+ reperes-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.2.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ reperes = reperes.cli:main
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1 @@
1
+ reperes