Services#
Submodules#
Git#
- class GitService(**kwargs: Any)[source]#
Bases:
traitlets.config.configurable.Configurable- check_remote_status(origin: str, branch: str) grader_labextension.services.git.RemoteStatus[source]#
- clone(origin: str, force=False)[source]#
Clones the repository
- Args:
origin (str): the remote force (bool, optional): states if the operation should be forced. Defaults to False.
- commit(m='2022-05-25 11:06:35.424568')[source]#
Commits the staged changes
- Args:
m (str, optional): the commit message. Defaults to str(datetime.now()).
- copy_repo_contents(src: str)[source]#
copies repo contents from src to the git path
- Args:
src (str): path where the to be copied files reside
- delete_repo_contents(include_git=False)[source]#
Deletes the contents of the git service
- Args:
include_git (bool, optional): states if the .git directory should also be deleted. Defaults to False.
- get_log(history_count=10) List[Dict[str, str]][source]#
Execute git log command & return the result.
- git_access_token#
A trait for unicode strings.
- git_service_url#
A trait for unicode strings.
- property git_version#
Return the git version
- Returns:
tuple: the git version
- init(force=False)[source]#
Initiates a local repository
- Args:
force (bool, optional): states if the operation should be forced. Defaults to False.
- is_git()[source]#
Checks if the directory is a local repository
- Returns:
bool: states if the directory is a repository
- pull(origin: str, branch='main', force=False)[source]#
Pulls a repository
- Args:
origin (str): the remote branch (str, optional): the branch name. Defaults to “main”. force (bool, optional): states if the operation should be forced. Defaults to False.
- push(origin: str, force=False)[source]#
Pushes commits on the remote
- Args:
origin (str): the remote force (bool, optional): states if the operation should be forced. Defaults to False.
Request#
- class RequestService(**kwargs: Any)[source]#
Bases:
traitlets.config.configurable.LoggingConfigurable- async request(method: str, endpoint: str, body: Optional[Union[dict, str]] = None, header: Optional[Dict[str, str]] = None, decode_response: bool = True) Union[dict, list, tornado.httpclient.HTTPResponse][source]#
- url#
A trait for unicode strings.