Hub Python Library documentation
ディスカッションとプルリクエストとのやり取り
ディスカッションとプルリクエストとのやり取り
Hub での Pull Request および Discussion とのやり取りを可能にするメソッドの参考情報については、HfApi のドキュメントページを確認してください。
- get_repo_discussions()
- get_discussion_details()
- create_discussion()
- create_pull_request()
- rename_discussion()
- comment_discussion()
- edit_discussion_comment()
- change_discussion_status()
- merge_pull_request()
データ構造
クラス huggingface_hub.Discussion
< source >( title: strstatus: typing.Literal['open', 'closed', 'merged', 'draft']num: intrepo_id: strrepo_type: strauthor: stris_pull_request: boolcreated_at: datetimeendpoint: str )
パラメータ
- title (
str) — Discussion / Pull Request のタイトル - status (
str) — Discussion / Pull Request のステータスです。 以下のいずれかである必要があります:"open""closed""merged"(Pull Requests のみ)"draft"(Pull Request のみ)
- num (
int) — Discussion / Pull Request の番号です。 - repo_id (
str) — Discussion / Pull Request がオープンされていたリポジトリの ID ("{namespace}/{repo_name}")。 - repo_type (
str) — Discussion / Pull Request がオープンされていたリポジトリの種類。 取り得る値は:"model"、"dataset"、"space"。 - author (
str) — Discussion / Pull Request の作成者のユーザー名です。 ユーザーがその後削除されている場合は、"deleted"になる可能性があります。 - is_pull_request (
bool) — Pull Request かどうかを示します。 - created_at (
datetime) — Discussion / Pull Request が作成された時刻のdatetimeです。 - endpoint (
str) — Hub のエンドポイントです。デフォルトは https://huggingface.co です。 - git_reference (
str, 省略可) — (property) これが Pull Request の場合、変更をプッシュできる Git リファレンス。それ以外の場合はNone。 - url (
str) — プロパティ。Hub 上のディスカッションの URL。
Hub でのディスカッションまたは Pull Request。
このデータクラスは、直接インスタンス化することを意図していません。
クラス huggingface_hub.DiscussionWithDetails
< source >( title: strstatus: typing.Literal['open', 'closed', 'merged', 'draft']num: intrepo_id: strrepo_type: strauthor: stris_pull_request: boolcreated_at: datetimeendpoint: strevents: listconflicting_files: list[str] | bool | Nonetarget_branch: str | Nonemerge_commit_oid: str | Nonediff: str | None )
パラメータ
- title (
str) — Discussion / Pull Request のタイトル - status (
str) — Discussion / Pull Request のステータス。以下のいずれかになります:"open""closed""merged"(Pull Requests のみ)"draft"(Pull Request のみ)
- num (
int) — Discussion / Pull Request の番号です。 - repo_id (
str) — Discussion / Pull Request がオープンされていたリポジトリの ID ("{namespace}/{repo_name}")。 - repo_type (
str) — Discussion / Pull Request がオープンされていたリポジトリの種類。 取り得る値は:"model"、"dataset"、"space"。 - author (
str) — Discussion / Pull Request の作成者のユーザー名です。 ユーザーがその後削除されている場合は、"deleted"になる可能性があります。 - is_pull_request (
bool) — Pull Request かどうかを示します。 - created_at (
datetime) — Discussion / Pull Request が作成された時刻のdatetimeです。 - events (
listof DiscussionEvent) — この Discussion または Pull Request に含まれるDiscussionEventsのリストです。 - conflicting_files (
Union[list[str], bool, None], 省略可) — Pull Request の場合、競合するファイルのリストです。self.is_pull_requestがFalseの場合はNoneです。 競合するファイルが存在するが、リストを取得できない場合はTrueです。 - target_branch (
str, 省略可) — Pull Request の場合、変更がマージされるブランチ。self.is_pull_requestがFalseの場合はNone。 - merge_commit_oid (
str, 任意) — マージされた Pull Request の場合、マージコミットの OID / SHA が設定され、それ以外の場合はNoneになります。 - diff (
str, optional) — Pull Request の場合は git diff、それ以外はNone。 - endpoint (
str) — Hub のエンドポイントです。デフォルトは https://huggingface.co です。 - git_reference (
str, 省略可) — (property) これが Pull Request の場合、変更をプッシュできる Git リファレンス。それ以外の場合はNone。 - url (
str) — プロパティ。Hub 上のディスカッションの URL。
Discussionのサブクラスです。
クラス huggingface_hub.DiscussionEvent
< source >( id: strtype: strcreated_at: datetimeauthor: str_event: dict )
パラメータ
- id (
str) — イベントのIDです。16進数文字列です。 - type (
str) — イベントの種類。 - created_at (
datetime) — イベントの作成タイムスタンプを保持するdatetimeオブジェクト。 - author (
str) — Discussion / Pull Request の作成者のユーザー名です。 ユーザーがその後削除されている場合は、"deleted"になる可能性があります。
DiscussionまたはPull Request内のイベント。
具体的なクラスを使用します:
クラス huggingface_hub.DiscussionComment
< source >( id: strtype: strcreated_at: datetimeauthor: str_event: dictcontent: stredited: boolhidden: bool )
パラメータ
- id (
str) — イベントのIDです。16進数文字列です。 - type (
str) — イベントの種類。 - created_at (
datetime) — イベントの作成タイムスタンプを保持するdatetimeオブジェクト。 - author (
str) — Discussion / Pull Request の作成者のユーザー名です。 ユーザーがその後削除されている場合は、"deleted"になる可能性があります。 - content (
str) — コメントの生の Markdown 内容です。メンション、リンク、画像はレンダリングされません。 - edited (
bool) — このコメントが編集されたかどうかを示します。 - hidden (
bool) — このコメントが非表示かどうかを示します。
Discussion / Pull Request 内のコメント。
DiscussionEventのサブクラスです。
クラス huggingface_hub.DiscussionStatusChange
< source >( id: strtype: strcreated_at: datetimeauthor: str_event: dictnew_status: str )
パラメータ
- id (
str) — イベントのIDです。16進数文字列です。 - type (
str) — イベントの種類。 - created_at (
datetime) — イベントの作成タイムスタンプを保持するdatetimeオブジェクト。 - author (
str) — Discussion / Pull Request の作成者のユーザー名です。 ユーザーがその後削除されている場合は、"deleted"になる可能性があります。 - new_status (
str) — 変更後の Discussion / Pull Request のステータスです。以下のいずれかになります:"open""closed""merged"(Pull Requests のみ)
Discussion / Pull Request におけるステータスの変更。
DiscussionEventのサブクラスです。
クラス huggingface_hub.DiscussionCommit
< source >( id: strtype: strcreated_at: datetimeauthor: str_event: dictsummary: stroid: str )
パラメータ
- id (
str) — イベントのIDです。16進数文字列です。 - type (
str) — イベントの種類。 - created_at (
datetime) — イベントの作成タイムスタンプを保持するdatetimeオブジェクト。 - author (
str) — Discussion / Pull Request の作成者のユーザー名です。 ユーザーがその後削除されている場合は、"deleted"になる可能性があります。 - summary (
str) — コミットの概要です。 - oid (
str) — コミットの OID / SHA を16進数文字列として表したものです。
Pull Request 内のコミット。
DiscussionEventのサブクラスです。
class huggingface_hub.DiscussionTitleChange
< source >( id: strtype: strcreated_at: datetimeauthor: str_event: dictold_title: strnew_title: str )
パラメータ
- id (
str) — イベントのIDです。16進数文字列です。 - type (
str) — イベントの種類。 - created_at (
datetime) — イベントの作成タイムスタンプを保持するdatetimeオブジェクト。 - author (
str) — Discussion / Pull Request の作成者のユーザー名です。 ユーザーがその後削除されている場合は、"deleted"になる可能性があります。 - old_title (
str) — Discussion / Pull Request の以前のタイトルです。 - new_title (
str) — 新しいタイトル。
Discussion / Pull Request における名前変更イベント。
DiscussionEventのサブクラスです。