graviti.manager.commit
#
The implementation of the Commit and CommitManager.
Module Contents#
Classes#
This class defines the structure of a commit. |
|
This class defines the structure of a named commit. |
|
This class defines the operations on the commit in Graviti. |
- class graviti.manager.commit.Commit(dataset, commit_id)[source]#
Bases:
graviti.manager.sheets.Sheets
This class defines the structure of a commit.
- Parameters
dataset (graviti.manager.dataset.Dataset) – Class
Dataset
instance.commit_id (Optional[str]) – The commit id.
- classmethod from_response(cls, dataset, contents)[source]#
Create a
Commit
instance from python dict.- Parameters
dataset (graviti.manager.dataset.Dataset) – The dataset of the commit.
contents (Dict[str, Any]) –
A python dict containing all the information of the commit:
{ "commit_id": <str> "parent_commit_id": <Optional[str]> "title": <str> "description": <str> "committer": <str> "committed_at": <str> }
cls (Type[_C]) –
- Returns
A
Commit
instance created from the input python dict.- Return type
_C
- property parent(self)[source]#
Return the parent of the commit.
- Returns
The parent of the commit.
- Return type
Optional[Commit]
- property title(self)[source]#
Return the title of the commit.
- Returns
The title of the commit.
- Return type
str
- property description(self)[source]#
Return the description of the commit.
- Returns
The description of the commit.
- Return type
str
- property committer(self)[source]#
Return the committer of the commit.
- Returns
The committer of the commit.
- Return type
str
- property committed_at(self)[source]#
Return the time when the draft is committed.
- Returns
The time when the draft is committed.
- Return type
datetime.datetime
- search(self, sheet, criteria, schema=None)[source]#
Create a search.
- Parameters
sheet (str) – The sheet name.
criteria (Dict[str, Any]) – The criteria of search.
schema (Optional[graviti.portex.PortexRecordBase]) – The schema of the search result DataFrame.
- Raises
NoCommitsError – When there is no commit on the current branch.
- Returns
The created
DataFrame
instance.- Return type
graviti.dataframe.DataFrame
- class graviti.manager.commit.NamedCommit(dataset, name, commit_id)[source]#
Bases:
Commit
This class defines the structure of a named commit.
NamedCommit
is the base class ofBranch
andTag
.- Parameters
dataset (graviti.manager.dataset.Dataset) – Class
Dataset
instance.name (str) – The name of the named commit.
commit_id (Optional[str]) – The commit id.
- classmethod from_response(cls, dataset, contents)[source]#
Create a
NamedCommit
instance from python dict.- Parameters
dataset (graviti.manager.dataset.Dataset) – The dataset of the NamedCommit.
contents (Dict[str, Any]) –
A python dict containing all the information of the NamedCommit:
{ "name": <str> "commit_id": <Optional[str]> "parent_commit_id": <Optional[str]> "title": <str> "description": <str> "committer": <str> "committed_at": <str> }
cls (Type[_NC]) –
- Returns
A
NamedCommit
instance created from the input python dict.- Return type
_NC
- class graviti.manager.commit.CommitManager(dataset)[source]#
This class defines the operations on the commit in Graviti.
- Parameters
dataset (graviti.manager.dataset.Dataset) –
Dataset
instance.
- get(self, revision=CURRENT_COMMIT)[source]#
Get the certain commit with the given revision.
- Parameters
revision (str) – The information to locate the specific commit, which can be the commit id, the branch name, or the tag name. The default value is the current commit of the dataset.
- Raises
NoCommitsError – When revision is not given and the commit id of current dataset is None, or when the given branch has no commit history yet.
- Returns
The
Commit
instance with the given revision.- Return type
- list(self, revision=CURRENT_COMMIT)[source]#
List the commits.
- Parameters
revision (str) – The information to locate the specific commit, which can be the commit id, the branch name, or the tag name. If it is given, list the commits before the given commit. If it is not given, list the commits before the current commit.
- Returns
The LazyPagingList of
commits
instances.- Return type
Union[graviti.manager.lazy.LazyPagingList[Commit], List[Optional[Commit]]]