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

Single source the datatype for measurement inputs/outputs

Aperta
#198 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
25/100
Tipo di issue
Refactoring
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
python

Direzione di ricerca

Inizia con la example measure function e i relativi decoratori measurement_service descritti nell’issue, quindi esamina come vengono attualmente interpretati i type hints e gli argomenti datatype/default dei decoratori. Il lavoro è completo quando sarà stata stabilita un’unica fonte per i tipi di dati di input e output e sarà stato determinato se è possibile rimuovere i defaults o i decoratori stessi.

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

Descrizione

tech debt

Tech Debt

In the examples, the measure function is decorated with the inputs and outputs for the measurement. One input to the decorator is the datatype of the inputs/outputs. However, the datatype is also specified as part of type hints for the measure function. So this data is duplicated and could easily get out of sync if a datatype changed. We should explore if there is a way for the decorator to infer the datatype from the type hints so that we can single source that information. We might even be able to avoid having to specify a default value by putting that in the function signature as well. Maybe we can get rid of the decorators altogether. :) Below is a simple before/after (note that syntax might not be exactly right):

Before:

@measurement_service.register_measurement
@measurement_service.configuration("string_input", nims.DataType.String, "default_value")
@measurement_service.output("string_output", nims.DataType.String)
def measure(string_input: str) -> Tuple:
    return ""

After:

@measurement_service.register_measurement
@measurement_service.configuration("string_input", "default_value")
@measurement_service.output("string_output")
def measure(string_input: str) -> Tuple[str, ]:
    return ""

AB#2267350

Lingua principale
Python
Stelle
21
Fork
20
Merge medio
1g 19h
PR unite (30g)
2

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 ni/measurement-plugin-python

Tutte le issue di ni/measurement-plugin-python

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.