_wave_parameters in wave.py should be public

Aperta
#94,991 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
42/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
python
Ambito
api

Direzione di ricerca

Leggere Lib/wave.py intorno alla named tuple alla riga 89 e all’entry point Wave_write.setparams. Risolvere le due grafie del nome della tupla presenti nell’issue, quindi verificare che il nome pubblico risultante possa essere costruito dagli utenti e passato a setparams senza modificare il significato dei suoi parametri.

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

Descrizione

stdlib type-feature

Feature or enhancement

Make the named tuple _wave_parameters public. This nameed tuple defines the inputs to Wave_write.setparams which is a public method that users would want to call. To best create an input to setparams one would ideally first make a _wave_parameters named tuple.

This is especially true in a typed environment (see https://github.com/python/typeshed/issues/8322) but I feel it would be useful for all users of the wave module.

Pitch

Currently if one wants to call setparams in a typed setting, the only option is to use the private type:

import wave
with wave.open("test.wav", "wb") as wav_file:
    params = wave._wave_params(
        nchannels=1, sampwidth=2, framerate=16_000, nframes=0, comptype="NONE", compname="NONE",
    )
    wav_file.setparams(params)

There is no way to call setparams in a typed environment without using the wave._wave_params. If instead it was made public, all users could use the readable version of the parameters above, rather than pass in a tuple without kowing which numbers meant waht.

Previous discussion

see https://github.com/python/typeshed/issues/8322

Lingua principale
Python
Stelle
77.2k
Fork
36k
Merge medio
1g 9h
PR unite (30g)
558

Guida per i contributori

Apri la guida per i contributori

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 python/cpython

Tutte le issue di python/cpython

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.