odc-cli crashes with "'staticmethod' object is not callable" on Python 3.8 and 3.9, which it claims to support
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 78/100
Direzione di ricerca
Inizia da cli/odc-cli:58-68 e dai decoratori dei gestori intorno a cli/odc-cli:300-302; cli/AGENTS.md indica la versione di Python supportata e l’assenza di un harness di test. Controlla come vengono applicati i decoratori nelle classi dei comandi, quindi verifica setup get-state, auth login e instruments list con Python 3.8, 3.9 e una versione attuale. Il lavoro è completato quando questi comandi non generano più il TypeError segnalato negli interpreti supportati.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
On Python 3.8 and 3.9, odc-cli crashes with TypeError: 'staticmethod' object is not callable on every command that talks to the API. Each command handler is declared as @require_url (and often @require_token) stacked on @staticmethod. The decorators are applied in order, so require_url receives the staticmethod object itself, and its wrapper later calls fn(*args, **kwargs) on that object. A staticmethod object only became callable in Python 3.10 (bpo-43682). The script states that it targets Python 3.8: cli/AGENTS.md says so, and the file only hard-exits below 3.8. On the interpreters an administrator is most likely to have on a server or laptop, including macOS's /usr/bin/python3 (3.9.6), Debian 11 (3.9) and Ubuntu 20.04 (3.8), nothing works except config and the local auth logout and auth status. That includes auth login, setup, subjects, instrument-records and instruments.
Where
cli/odc-cli:58-68:
def require_url(fn: Callable[..., Any]) -> Callable[..., Any]:
def wrapper(*args: Any, **kwargs: Any) -> None:
# ...
fn(*args, **kwargs)
return wrapper
cli/odc-cli:300-302 (the same pattern is on every handler in AuthCommands, InstrumentRecordsCommands, SubjectCommands, InstrumentsCommands and SetupCommands):
class AuthCommands:
@require_url
@staticmethod
def login(username: str, password: str) -> None:
Reproduce
- With Python 3.9 (for example macOS
/usr/bin/python3), runpython3 cli/odc-cli config set-url http://127.0.0.1:5500. - Run
python3 cli/odc-cli setup get-state.
Actual:
File "cli/odc-cli", line 68, in wrapper
fn(*args, **kwargs)
TypeError: 'staticmethod' object is not callable
Expected: the request is sent, as it is on Python 3.10 and later, where the same command prints the setup state or a network-error JSON.
Tests
cli/ has no test harness and nothing in CI runs it (cli/AGENTS.md). Verify the fix by running setup get-state, auth login and instruments list under Python 3.8, 3.9 and the current release, for example with uv run --python 3.8 cli/odc-cli setup get-state.
Suggested fix
Put @staticmethod outermost: write @staticmethod above @require_url and @require_token, so the auth decorators wrap the plain function. Alternatively, keep the order and unwrap inside the decorators with fn = fn.__func__ if isinstance(fn, staticmethod) else fn.
- Lingua principale
- TypeScript
- Stelle
- 119
- Fork
- 19
- Merge medio
- 1g 2h
- PR unite (30g)
- 56
Preparare l'ambiente
- Include un Dockerfile o un 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 DouglasNeuroInformatics/OpenDataCapture
-
Area: Playground Bug Difficulty: Low Good First Issue Priority: Low
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
DouglasNeuroInformatics/OpenDataCapture#1805 ·
I maintainer di solito rispondono entro 1 giorno
-
Area: Instruments Bug Difficulty: Low Priority: Low
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
DouglasNeuroInformatics/OpenDataCapture#1801 ·
I maintainer di solito rispondono entro 1 giorno
-
Area: Instruments Bug Difficulty: Low Good First Issue Priority: Low
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
DouglasNeuroInformatics/OpenDataCapture#1800 ·
I maintainer di solito rispondono entro 1 giorno
-
Area: Instruments Bug Difficulty: Low Good First Issue Priority: Low
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
DouglasNeuroInformatics/OpenDataCapture#1799 ·
I maintainer di solito rispondono entro 1 giorno
-
Area: Instruments Bug Difficulty: Low Performance Priority: Medium
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
DouglasNeuroInformatics/OpenDataCapture#1795 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di DouglasNeuroInformatics/OpenDataCapture
Issue simili
-
Mondriaan
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
knaw-huc/textannoviz#709 ·
I maintainer di solito rispondono entro 1 giorno
-
Add: YRF Music NepalApertastreams:add
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 62/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
walletbeat/walletbeat#1558 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
hawk-digital-environments/HAWKI#438 ·
I maintainer di solito rispondono entro 1 giorno
-
good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
OktoLabsAI/okto-pulse#114 ·
I maintainer di solito rispondono entro 1 giorno