l2tscaffolder.helpers package

Submodules

l2tscaffolder.helpers.cli module

Helper for command line functions.

class l2tscaffolder.helpers.cli.CLIHelper(mock_responses=None)[source]

Bases: object

Command line interface (CLI) helper.

mock_responses

mappings of commands to responses.

Type:dict[str, str]
preferred_encoding

preferred encoding of output.

Type:str
RunCommand(command: str)[source]

Runs a command.

Parameters:command (str) – command to run.
Returns:
exit code, output that was written to stdout
and stderr.
Return type:tuple[int, str, str]
Raises:AttributeError – if the command is not recognized.

l2tscaffolder.helpers.git module

Git helper for the scaffolder project.

This file provides a class to assist with git operations.

class l2tscaffolder.helpers.git.GitHelper(project_path: str)[source]

Bases: l2tscaffolder.helpers.cli.CLIHelper

Helper class for git operations.

project_path

path to the git project folder.

AddFileToTrack(file_path: str)[source]

Add a file to those that are tracked by the git repo.

Parameters:file_path (str) – path to the file to be added to tracked files by this git repo.
Raises:errors.UnableToConfigure – when the tool is not able to add newly added files to the git repo.
CreateBranch(branch: str) → int[source]

Creates a git branch and returns the exit code of the command.

Parameters:branch (str) – the name of the git branch.
Returns:the exit code from the git command.
Return type:int
GenerateBranchName(module_name: str) → str[source]

Generates a git branch name.

Parameters:module_name (str) – module name to generate a git branch name from.
Returns:git branch name.
Return type:str
GetActiveBranch() → str[source]

Determines the active branch of the git project.

Returns:the active branch of the git project.
Return type:str
Raises:errors.UnableToConfigure – when the tool is not able to get the active branch of the git project.
HasBranch(branch_name: str) → bool[source]

Tests for the existence of a specific branch.

Parameters:branch_name (str) – the name of the branch to test for.
Returns:True if the branch exists.
Return type:bool
RunCommand(command: str) → Tuple[int, str, str][source]

Runs a command.

Parameters:command (str) – command to run.
Returns:
exit code, output that was written to stdout
and stderr.
Return type:tuple[int, str, str]
SwitchToBranch(branch: str) → int[source]

Switches the git branch and returns the exit code of the command.

Parameters:branch (str) – the name of the git branch.
Returns:the exit code from the git command.
Return type:int

Module contents