Hub Python 函式庫文件

與討論及合併請求互動

Hugging Face's logo
加入 Hugging Face 社群

並獲得增強的文件體驗

開始使用

與討論及合併請求互動

請參閱 HfApi 文件頁面,了解如何與 Hub 上的合併請求(Pull Requests)及討論(Discussions)進行互動的方法參考。

資料結構

class huggingface_hub.Discussion

< >

( title: str status: typing.Literal['open', 'closed', 'merged', 'draft'] num: int repo_id: str repo_type: str author: str is_pull_request: bool created_at: datetime endpoint: str )

參數

  • title (str) — 討論或合併請求的標題。
  • status (str) — 討論或合併請求的狀態。必須為以下之一:
    • "open"
    • "closed"
    • "merged"(僅適用於合併請求)
    • "draft"(僅適用於合併請求)
  • num (int) — 討論或合併請求的編號。
  • repo_id (str) — 開啟該討論或合併請求之儲存庫的 ID("{namespace}/{repo_name}")。
  • repo_type (str) — 開啟該討論或合併請求之儲存庫的類型。可能的值為:"model""dataset""space"
  • author (str) — 討論或合併請求作者的使用者名稱。若該使用者後來被刪除,則可能顯示為 "deleted"
  • is_pull_request (bool) — 這是否為合併請求。
  • created_at (datetime) — 討論或合併請求建立的 datetime 物件。
  • endpoint (str) — Hub 的端點。預設為 https://huggingface.co
  • git_reference (str, 選填) — (屬性) 若此為合併請求,此處為可推入變更的 Git 參照(reference);否則為 None
  • url (str) — (屬性) 該討論在 Hub 上的 URL。

Hub 上的討論或合併請求。

此資料類別(dataclass)不應直接進行實例化。

class huggingface_hub.DiscussionWithDetails

< >

( title: str status: typing.Literal['open', 'closed', 'merged', 'draft'] num: int repo_id: str repo_type: str author: str is_pull_request: bool created_at: datetime endpoint: str events: list conflicting_files: list[str] | bool | None target_branch: str | None merge_commit_oid: str | None diff: str | None )

參數

  • title (str) — 討論或合併請求的標題。
  • status (str) — 討論或合併請求的狀態。可以為以下之一:
    • "open"
    • "closed"
    • "merged"(僅適用於合併請求)
    • "draft"(僅適用於合併請求)
  • num (int) — 討論或合併請求的編號。
  • repo_id (str) — 開啟該討論或合併請求之儲存庫的 ID("{namespace}/{repo_name}")。
  • repo_type (str) — 開啟該討論或合併請求之儲存庫的類型。可能的值為:"model""dataset""space"
  • author (str) — 討論或合併請求作者的使用者名稱。若該使用者後來被刪除,則可能顯示為 "deleted"
  • is_pull_request (bool) — 這是否為合併請求。
  • created_at (datetime) — 討論或合併請求建立的 datetime 物件。
  • events (list of DiscussionEvent) — 此討論或合併請求中的 DiscussionEvents 列表。
  • conflicting_files (Union[list[str], bool, None], 選填) — 若此為合併請求,則為衝突檔案列表。若 self.is_pull_requestFalse,則為 None。若存在衝突檔案但無法擷取列表,則為 True
  • target_branch (str, 選填) — 若此為合併請求,則為要合併變更進去的目標分支。若 self.is_pull_requestFalse,則為 None
  • merge_commit_oid (str, 選填) — 若此為已合併的合併請求,則設為合併提交(merge commit)的 OID / SHA;否則為 None
  • diff (str, 選填) — 若此為合併請求,則為 git diff 內容;否則為 None
  • endpoint (str) — Hub 的端點。預設為 https://huggingface.co
  • git_reference (str, 選填) — (屬性) 若此為合併請求,此處為可推入變更的 Git 參照;否則為 None
  • url (str) — (屬性) 該討論在 Hub 上的 URL。

Discussion 的子類別。

class huggingface_hub.DiscussionEvent

< >

( id: str type: str created_at: datetime author: str _event: dict )

參數

  • id (str) — 事件的 ID,為十六進位字串。
  • type (str) — 事件的類型。
  • created_at (datetime) — 包含事件建立時間戳記的 datetime 物件。
  • author (str) — 討論或合併請求作者的使用者名稱。若該使用者後來被刪除,則可能顯示為 "deleted"

討論或合併請求中的一個事件。

使用具體類別

class huggingface_hub.DiscussionComment

< >

( id: str type: str created_at: datetime author: str _event: dict content: str edited: bool hidden: bool )

參數

  • id (str) — 事件的 ID,為十六進位字串。
  • type (str) — 事件的類型。
  • created_at (datetime) — 包含事件建立時間戳記的 datetime 物件。
  • author (str) — 討論或合併請求作者的使用者名稱。若該使用者後來被刪除,則可能顯示為 "deleted"
  • content (str) — 評論的原始 Markdown 內容。提及(Mentions)、連結和圖片不會被渲染。
  • edited (bool) — 此評論是否已被編輯。
  • hidden (bool) — 此評論是否已被隱藏。

討論或合併請求中的評論。

DiscussionEvent 的子類別。

class huggingface_hub.DiscussionStatusChange

< >

( id: str type: str created_at: datetime author: str _event: dict new_status: str )

參數

  • id (str) — 事件的 ID,為十六進位字串。
  • type (str) — 事件的類型。
  • created_at (datetime) — 包含事件建立時間戳記的 datetime 物件。
  • author (str) — 討論或合併請求作者的使用者名稱。若該使用者後來被刪除,則可能顯示為 "deleted"
  • new_status (str) — 變更後的討論或合併請求狀態。可以為以下之一:
    • "open"
    • "closed"
    • "merged"(僅適用於合併請求)

討論或合併請求中的狀態變更。

DiscussionEvent 的子類別。

class huggingface_hub.DiscussionCommit

< >

( id: str type: str created_at: datetime author: str _event: dict summary: str oid: str )

參數

  • id (str) — 事件的 ID,為十六進位字串。
  • type (str) — 事件的類型。
  • created_at (datetime) — 包含事件建立時間戳記的 datetime 物件。
  • author (str) — 討論或合併請求作者的使用者名稱。若該使用者後來被刪除,則可能顯示為 "deleted"
  • summary (str) — 提交(commit)的摘要。
  • oid (str) — 提交的 OID / SHA,以十六進位字串表示。

合併請求(Pull Request)中的一筆提交。

DiscussionEvent 的子類別。

class huggingface_hub.DiscussionTitleChange

< >

( id: str type: str created_at: datetime author: str _event: dict old_title: str new_title: str )

參數

  • id (str) — 事件的 ID,為一十六進位字串。
  • type (str) — 事件類型。
  • created_at (datetime) — 一個包含事件建立時間戳記的 datetime 物件。
  • author (str) — 討論(Discussion)或合併請求(Pull Request)作者的使用者名稱。若使用者事後被刪除,則可能顯示為 "deleted"
  • old_title (str) — 討論或合併請求更改前的標題。
  • new_title (str) — 新的標題。

討論或合併請求中的重新命名事件。

DiscussionEvent 的子類別。

在 GitHub 上更新

© . This site is unofficial and not affiliated with Hugging Face, Inc.