project-create generates an invalid class name when the project name starts with a digit
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- Meno di un'ora
- Idoneità per principianti
- 40/100
Direzione di ricerca
Find the code handling the project-create command in the lean-cli codebase, likely in a commands or templates directory. Look for the function that generates class names by removing non-alphanumeric characters from the project name. Add a check to prefix the result with an underscore when it starts with a digit or is empty, then add tests for project names like '2024 Momentum' and '123'.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Expected Behavior
lean project-create writes a main file that compiles, whatever the project name is.
Actual Behavior
The class name is the project name with non-alphanumeric characters removed. If the name starts with a digit, the generated class is not a valid identifier in Python or C#:
$ lean project-create --language python "2024 Momentum"
$ grep class "2024 Momentum/main.py"
class 2024Momentum(QCAlgorithm):
python -m py_compile on that file fails with SyntaxError: invalid decimal literal. A name with only digits (123) gives class 123(QCAlgorithm):. The command exits with code 0 in both cases, so the problem only shows up when the project is run.
Potential Solution
Prefix the class name with an underscore when it is empty or starts with a digit (_2024Momentum). I can open a PR with the fix and tests.
Reproducing the Problem
See the commands above.
System Information
lean-cli master at 20e58aa, Linux.
Checklist
- I have completely filled out this template
- I have confirmed that this issue exists on the current
masterbranch - I have confirmed that this is not a duplicate issue by searching issues
- Lingua principale
- Python
- Stelle
- 327
- Fork
- 170
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
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 QuantConnect/lean-cli
-
lean cloud live deploy --notify-webhooks fails when the address is a URLForse già presa @Amadeus-22 l’ha presa 2 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 48/100
QuantConnect/lean-cli#671 ·
-
Docker image with a registry port cannot be parsedForse già presa @Amadeus-22 l’ha presa 2 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 45/100
QuantConnect/lean-cli#669 ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 55/100
QuantConnect/lean-cli#661 · 1 commento ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
QuantConnect/lean-cli#619 ·
-
Implements AutocompleteForse di nuovo libera @shreejaykurhade l’ha presa 195 giorni fa e non c’è nessuna pull request aperta. Apertafeature
QuantConnect/lean-cli#602 · 6 commenti · 3 reazioni · 1 assegnatario ·
Tutte le issue di QuantConnect/lean-cli
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
UKGovernmentBEIS/inspect_ai#5781 ·
I maintainer di solito rispondono entro 2 giorni
-
Bump .cicd to wamp-cicd 4c2f9ac: `just land` refuses open A18 decisions, `just where` lists themAperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 82/100
crossbario/cfxdb#139 ·
-
Bump .cicd to wamp-cicd 4c2f9ac: `just land` refuses open A18 decisions, `just where` lists themAperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 84/100
crossbario/txaio#241 ·
-
UX
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
mediajunkie/piper-morgan-product#1963 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 64/100