python / python/cpython

_wave_parameters in wave.py should be public

オープン
#94,991 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

stdlib type-feature
主要言語
Python
スター
77.2k
フォーク
36k
平均マージ
1日 9時間
マージ済み PR(30日)
558

説明

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

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

Lib/wave.py の 89 行目にある named tuple と Wave_write.setparams のエントリポイント周辺を読みます。issue にあるタプル名の 2 つの表記を解決し、その結果得られる公開名をユーザーが構築して setparams に渡せること、またそのパラメーターの意味が変わらないことを確認します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python
領域
api
issue の種類
機能追加
難易度
2/5
見積もり時間
1〜3時間
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
42/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。