b2sdk: create_file prioritization should accept an enum, not a string

未關閉
#602 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

還沒有人認領這個 Issue。

評估

難度
5/5
預估耗時
一週以上
新手友好度
22/100
Issue 類型
功能
描述清晰度
基本清楚
活躍度
冷清
技術堆疊
python
領域
api

研究方向

Start with Bucket.create_file and Bucket.create_file_stream in the b2sdk bucket module, and the .. TODO:: note in doc/source/advanced.rst that describes the current string values local, remote and local_verification. The design choices are open: the enum's member names, how strings stay accepted for backwards compatibility, and what an unknown value should raise. Settle those with a maintainer before coding. Done means both methods take the enum, the string values still work, and the typo case in the reproduction fails at the call site.

由索引模型根據 Issue 內容生成。

描述

Description

Bucket.create_file and Bucket.create_file_stream accept source prioritization as a string, with the supported values being local, remote and local_verification. An enum would make the valid values discoverable through the type system and turn a typo into an immediate error rather than a silently different plan.

This was recorded as a .. TODO:: directive in doc/source/advanced.rst, where it was invisible in published builds and carried no owner or acceptance criteria. It is tracked here instead, as part of #601.

Note that this is an API design change rather than a documentation change, so it is filed separately from the documentation work in #601.

Steps to reproduce

bucket.create_file(input_sources, remote_name, file_info, prioritize='local')
bucket.create_file(input_sources, remote_name, file_info, prioritize='locol')  # typo, not rejected at the call site

Expected behavior

Prioritization should be expressed as an enum, with the string values continuing to be accepted for backwards compatibility within the current interface version.

Actual behavior

Only strings are accepted, and an unrecognised value is not caught at the call site.

Environment

  • Python version: Any supported version
  • b2sdk version: master at f3ab7b71
  • OS: Any
主要語言
Python
星號
214
分支
68
平均合併
51 分鐘
30 天內合併 PR
6

環境準備

  • 沒有 Dockerfile 或 Docker Compose 檔案
  • 沒有 Pull Request 範本
  • 閱讀貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

Backblaze/b2-sdk-python 的其他 Issue

查看 Backblaze/b2-sdk-python 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。