Make CacheManager a deprecated subclass of FileCache

Aperta
#147 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
72/100
Tipo di issue
Refactoring
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
python
Ambito
backend

Direzione di ricerca

Read lettucedetect/detectors/cache.py and the FileCache implementation, then check how llm.py imports and uses CacheManager. Run the two listed pytest files first to see the existing behavior. Done means CacheManager inherits the file cache behavior, warns as specified, and the existing tests pass with only the intended golden fixture updates.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

ready-for-agent

Parent: #144 · Epic: #126 · Blocked by: #146, #135
Branch from stateless_core; open the PR against it.

Problem

CacheManager and FileCache would otherwise be two implementations of the same file format that can drift apart.

Current behavior

  • lettucedetect/detectors/cache.py:12-47 is a standalone class: get, set, delete, _hash (static), path. It is imported by llm.py:12.

Steps

  1. Rewrite CacheManager(file_path) as a subclass of FileCache keeping get, set, delete, _hash and path. It inherits aget, aset and adelete from FileCache and adds no override; the async pairs are new names, so they don't warn on their own.
  2. Mark it deprecated with the helper from #135, naming FileCache. Calls from inside lettucedetect (including llm.py) don't warn.
  3. Update the CacheManager golden fixtures from #131 only where the directory is no longer created by the constructor (an intended change; say so in the PR).

Acceptance criteria

  • isinstance(CacheManager(p), FileCache); constructing from a test module warns LettuceDetectDeprecationWarning naming FileCache.
  • CacheManager has working aget, aset and adelete equal to get, set and delete (a value set with set reads via aget); calling them emits no extra warning beyond the one from construction.
  • _hash still returns the recorded strings; get/set/delete/path behave as before.
  • Docstring has the .. deprecated:: note.
  • Existing tests pass.

Start here

uv run --extra dev pytest tests/test_golden_factory_cache_pytest.py tests/test_llm_detector_pytest.py -q
Lingua principale
Python
Stelle
615
Fork
60
Merge medio
1g 8h
PR unite (30g)
10

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di KRLabsOrg/LettuceDetect

Tutte le issue di KRLabsOrg/LettuceDetect

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.