NCAS-CMS / NCAS-CMS/cf-python

Rehome `_numpy_allclose` so it can be decorated

Offen
#86 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

code tidy
Vorherrschende Sprache
Python
Sterne
150
Forks
23
Ø Merge
1 T. 11 Std.
Gemergte PRs (30 T.)
2

Beschreibung

I would like to decorate the function _numpy_allclose() with _manage_log_level_via_verbosity as a standard & consistent way to manage the output of the log messages there with overriding by the verbose kwarg.

But as-is this cannot be done because _numpy_isclose() lives in the functions module & importing the decorator would lead to a circular dependency on imports, as per the comment I added there:
https://github.com/NCAS-CMS/cf-python/blob/7fed0abf184093024eb35d17036a08dc812c8f47/cf/functions.py#L1067-L1070

We tentatively agreed we should move the function to another module. It is internal so the location is not user-facing but we should try to collect it into the most sensible module as a new home.

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne in functions.py beim verknüpften Kommentar in den Zeilen 1067–1070 und verfolge _numpy_allclose(), _numpy_isclose() und _manage_log_level_via_verbosity. Identifiziere ein Modul, das den zirkulären Import vermeidet, verschiebe die interne Funktion dorthin und verifiziere, dass der Decorator angewendet werden kann, ohne Imports oder bestehendes Verhalten zu beeinträchtigen.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
python
Bereich
backend
Issue-Typ
Refactoring
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
45/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.