Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

At most two positional arguments in the public API; the rest keyword-only

Aperta
#734 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à
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
35/100
Tipo di issue
Refactoring
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
python

Direzione di ricerca

Start by reading the public APIs named in the issue: metrics, Comparer and ComparerCollection, SkillTable, Quantity, DummyModelResult, and the plotting entry points. Check their existing signatures and call sites to understand the scope of positional argument changes and whether compatibility warnings are needed. Done means the listed APIs enforce the positional argument policy, with the chosen compatibility approach applied consistently.

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

Descrizione

Public functions should take at most two positional arguments; everything after is keyword-only. scikit-learn does this for its metrics, e.g. mean_squared_error(y_true, y_pred, *, sample_weight=None, ...). A keyword call says what each value means, and a misplaced positional value then fails at the call instead of being used for the wrong thing.

The constructors, match() and from_matched() already do this. These do not:

function positional parameters
metrics.rmse, mae, urmse, cc, c_rmse, c_mae, c_urmse and their long-name aliases obs, model, weights (rmse: also unbiased)
metrics.hit_ratio, lin_slope, peak_ratio/pr obs, model, a / reg_method / inter_event_level, AAP, inter_event_time
metrics.metric (decorator) best, has_units, display_name
Quantity name, unit, is_directional
DummyModelResult name, data, strategy; also the only model result where data is not first
*.trim start_time, end_time, buffer, no_overlap
Comparer.sel, ComparerCollection.sel model, (observation, quantity,) start, end, time, area, z
Comparer.gridded_skill, ComparerCollection.gridded_skill bins, binsize, by, metrics, n_min
ComparerCollection.skill by, metrics, observed
SkillTable.style decimals, metrics, cmap, show_best
Comparer.from_matched_data 14 parameters
cmp.plot.kde, residual_hist; cc.plot.residual_hist, spatial_overview, temporal_coverage; SkillArray.plot.grid ax, title, figsize, …
ms.plotting.spatial_overview, taylor_diagram, TaylorPoint 5–7 each

skill() deserves keyword-only from the start, even though it has two parameters: cmp.skill("rmse") passes "rmse" as by and fails with KeyError: 'rmse'. The same goes for sel(), where only model is an obvious first argument.

Positional calls past the second argument will break. Either do it in the next major release, or first emit a FutureWarning for one minor release when a positional argument is passed where the keyword will be required.

Lingua principale
Python
Stelle
58
Fork
10
Merge medio
28m
PR unite (30g)
1

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

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 DHI/modelskill

Tutte le issue di DHI/modelskill

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.