Parameter values shared across Python class instances
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 45/100
Direzione di ricerca
Start by locating the Python code generator and its tests for generated parameter classes; the issue does not name specific files. Check how the generated Param class declares parameter values and how instances are tested. Done means each new instance starts with independent parameter values, with a test covering that behavior.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
I’m trying to create tests to verify the interaction of my software with the generate_parameter_library. I want to save the parameters to a file when they are updated in both Python and C++. The testes for the C++ version worked correctly, but in Python, I noticed an odd behaviour. The parameter values are shared across multiple instances. This resulted in the tests failing due to an inconsistent initial value. I expected a reset to parameter values when a new instance is created.
Looking at the generated code, I noticed the Param class doesn’t have an __init__(self) function and declares the parameters directly in the class body. This causes the parameters to be shared between instances. Is this the desired behaviour?
Adding the __init__(self) function and selfto the variables solved this. As a quick fix, I reloaded the entire module between each test.
If this is not intended, I can provide a pull request to solve this issue.
Auto generated code:
Expected generated code:
- Lingua principale
- Python
- Stelle
- 385
- Fork
- 81
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di PickNikRobotics/generate_parameter_library
-
Feature: Enum supportAperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 45/100
PickNikRobotics/generate_parameter_library#392 · 2 commenti ·
-
GCC 15 emits -Wfree-nonheap-object for generated string one_of validationForse già presa @tylerjw l’ha presa 18 giorni fa. Aperta
PickNikRobotics/generate_parameter_library#389 · 1 commento · 1 assegnatario ·
-
Feature request: math in the yamlForse già presa @tylerjw l’ha presa 18 giorni fa. Aperta
PickNikRobotics/generate_parameter_library#381 · 2 commenti · 1 reazione · 1 assegnatario ·
-
Validator reference (bounds<>/element_bounds<> etc.) is hard to find inside the READMEForse già presa @tylerjw l’ha presa 18 giorni fa. Aperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
PickNikRobotics/generate_parameter_library#377 · 1 commento ·
-
`.inf` not within floating point rangeForse già presa @christianrauch l’ha presa 68 giorni fa. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 30/100
PickNikRobotics/generate_parameter_library#376 · 3 commenti ·
Tutte le issue di PickNikRobotics/generate_parameter_library
Issue simili
-
docs: the dev-setup table and AGENTS.md name the reviewed_by guard that CI's Changelog job runsApertaarea: tools documentation good first issue ready for a contributor
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
eyalgolan/statecraft-israel#873 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Add cover art to song rowsApertaenhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 5 giorni
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
bug good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno