Consistent interface to get text and bytes
オープン
まだ誰も着手していません。
- 主要言語
- Python
- スター
- 1.7k
- フォーク
- 408
- 平均マージ
- 2日 57分
- マージ済み PR(30日)
- 7
説明
Follow up from #610 #790 and #893
General policy:
- Do not implement
str() - To get unicode string use
.text - In
.textuse UTF-8 and replace (the rationale for replace is explained in https://github.com/libgit2/pygit2/pull/790#issuecomment-385906316) - To get the byte string use
.dataor.raw(this is to be decided) - For attributes the name of the attribute returns text, prefix with
raw_to get bytes. For instanceSignature.nameandSignature.raw_name - Implement the buffer protocol,
bytes(..)where appropriate
Open for discussion.
TODO:
- Replace
TreeEntry._nameby.raw_name - Replace
DiffLine.contentby.text - Inventory all the places where we get bytes, text, or the buffer protocol
- Settle on
.dataor.raw - Replace
DiffLine.raw_contentby.dataor.raw - Replace
Object.read_raw()by.data(or.raw), then removeBlob.data(it will inherit fromObject) - Settle on
str()bytes()and the buffer protocol
The case of Oid, what we've now:
oid.rawreturns the byte string (that's good, unless we decide to settle on.data)str(oid)andoid.hexboth return the hex representation, always<str>(bytes in Python 2 and text in Python 3)- Oid is the only place where we implement
str(...) Object.hexandTreeEntry.hexbehave the same, they return always<str>. Apparently these are the only places where we always return<str>.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず関連付けられた issue #610、#790、#893 を確認し、続いてここで説明されている現在の Oid、Object、TreeEntry、DiffLine インターフェースを洗い出します。完了とするには、text/bytes の命名および変換ポリシーを確定し、列挙された TODO をすべての bindings で一貫して解決する必要があります。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- git, python
- 領域
- api, backend-api-design, tooling
- issue の種類
- リファクタリング
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 活発さ
- 停滞
- 明瞭さ
- 説明が足りない
- 初心者へのやさしさ
- 20/100