ghapi.pulls#

class ghapi.pulls.PullRequest(repo: Repository, pull_number: int, conn: Optional[Connection] = None)[source]#

Implements a Pull Request object

>>> from ghapi import Repository, PullRequest
>>> pr = PullRequest(Repository("frgfm", "torch-cam"), 187)
>>> pr.get_info()
Parameters
  • repo – the parent repository object

  • pull_number – the PR number

  • conn – connection object

get_info() Dict[str, Union[str, Dict[str, str]]][source]#

Parses high-level information from the Pull Request

get_diff() Dict[str, List[Dict[str, Any]]][source]#

Parses the PR diff

Returns

the start line, the end line, and the actuall diff string.

Return type

a dictionary where each key is a file path and each value is a list of dict. Each dict has three keys

list_comments(**kwargs: Any) List[Dict[str, Any]][source]#

List the comments of a Pull Request.

Parameters

kwargs – query parameters of List issue comments

Returns

list of comments

list_review_comments(**kwargs: Any) List[Dict[str, Any]][source]#

List the review comments of a Pull Request.

Parameters

kwargs – query parameters of List review comments

Returns

list of review comments

list_reviews(**kwargs: Any) List[Dict[str, Any]][source]#

List the reviews of a Pull Request.

Parameters

kwargs – query parameters of List reviews

Returns

list of reviews

list_files(**kwargs: Any) Dict[str, List[Dict[str, Any]]][source]#

List the files of a Pull Request and their corresponding diff.

Parameters

kwargs – query parameters of List pull requests files.

Returns

a dictionary with the file path as keys and the list of parsed diff as values