plasoscaffolder.common package¶
Submodules¶
plasoscaffolder.common.base_code_formatter module¶
Base code formatter.
plasoscaffolder.common.base_file_handler module¶
Base file handler.
-
class
plasoscaffolder.common.base_file_handler.BaseFileHandler[source]¶ Bases:
objectBase class representing the base class for the file handler.
-
AddContent(source: str, content: str) → str[source]¶ Add content to a file and create file if non existing.
Parameters: - source (str) – The path of the file to edit.
- content (str) – The content to append to the file.
Returns: the path of the edited file.
Return type: str
-
CopyFile(source: str, destination: str) → str[source]¶ Copies a file.
Parameters: - source (str) – path of the file to copy
- destination (str) – path to copy the file to.
Returns: the path of the copied file
Return type: str
-
CreateFile(directory_path: str, file_name: str, filename_suffix: str)[source]¶ Creates an empty file.
Parameters: - directory_path (str) – The path to the directory the file should be created.
- file_name (str) – the name of the new file.
- filename_suffix (str) – the suffix of the new file.
Returns: the path of the created file
Return type: str
-
CreateFileFromPath(file_path: str) → str[source]¶ Creates a empty file.
Parameters: file_path (str) – the path to the file. Returns: the path of the created file Return type: str
-
classmethod
CreateFilePath(path: str, name: str, suffix: str) → str[source]¶ Creates the file path out of the directory path, filename and suffix.
Parameters: - path (str) – the path to the file directory
- name (str) – the filename
- suffix (str) – the suffix
Returns: the joined path to the file
Return type: str
-
plasoscaffolder.common.base_output_handler module¶
base output handler
-
class
plasoscaffolder.common.base_output_handler.BaseOutputHandler[source]¶ Bases:
objectBase class representing the Base class for the output handler class
-
Confirm(text: str, default=True, abort=True)[source]¶ Ask for a confirmation, either yes or no to a question.
Parameters: - text (str) – prompts the user for a confirmation, with the given test as the question
- default (bool) – the default for the confirmation answer. If True the default is Y(es), if False the default is N(o)
- abort (bool) – if the program should abort if the user answer to the confirm prompt is no. The default is an abort.
Returns: False if the user entered no, True if the user entered yes
Return type: bool
-
PromptError(text: str) → str[source]¶ A prompt for errors.
Parameters: text (str) – the text to prompt Returns: the user input Return type: str
-
PromptInfo(text: str) → str[source]¶ A prompt for information.
Parameters: text (str) – the text to prompt Returns: the user input Return type: str
-
PromptInfoWithDefault(text: str, text_type: object, default: object) → str[source]¶ A prompt for information, with a default value and a required type.
Parameters: - text (str) – the text to prompt
- text_type (object) – the type of the input
- default (object) – the default value
Returns: the user input
Return type: str
-
plasoscaffolder.common.code_formatter module¶
To Format the code
-
class
plasoscaffolder.common.code_formatter.CodeFormatter(yapf_path: str)[source]¶ Bases:
plasoscaffolder.common.base_code_formatter.BaseCodeFormatterClass handles the code formation of files.
plasoscaffolder.common.file_handler module¶
The file handler.
-
class
plasoscaffolder.common.file_handler.FileHandler[source]¶ Bases:
plasoscaffolder.common.base_file_handler.BaseFileHandlerClass handles the creation of Files.
-
AddContent(source: str, content: str) → str[source]¶ Add content to a file and create file if non existing.
Parameters: - source (str) – The path of the file to edit.
- content (str) – The content to append to the file.
Returns: the path of the edited file.
Return type: str
-
CopyFile(source: str, destination: str) → str[source]¶ Copies a file.
Parameters: - source (str) – path of the file to copy
- destination (str) – path to copy the file to.
Returns: the path of the copied file
Return type: str
-
CreateFile(directory_path: str, file_name: str, filename_suffix: str)[source]¶ Creates a empty file.
Parameters: - directory_path (str) – The path to the directory the file should be created.
- file_name (str) – the name of the new file.
- filename_suffix (str) – the suffix of the new file.
Returns: the path of the created file
Return type: str
-
CreateFileFromPath(file_path: str) → str[source]¶ Creates a empty file.
Parameters: file_path (str) – the path to the file. Returns: the path of the created file Return type: str
-
classmethod
CreateFilePath(path: str, name: str, suffix: str) → str[source]¶ Creates the file path out of the directory path, filename and suffix.
Parameters: - path (str) – the path to the file directory
- name (str) – the filename
- suffix (str) – the suffix
Returns: the joined path to the file
Return type: str
-
plasoscaffolder.common.output_handler_click module¶
The output file handler for click
-
class
plasoscaffolder.common.output_handler_click.OutputHandlerClick[source]¶ Bases:
plasoscaffolder.common.base_output_handler.BaseOutputHandlerClass representing the output handler for click.
-
Confirm(text: str, default=True, abort=True)[source]¶ Ask for a confirmation, either yes or no to a question.
Parameters: - text (str) – prompts the user for a confirmation, with the given test as the question
- default (bool) – the default for the confirmation answer. If True the default is Y(es), if False the default is N(o)
- abort (bool) – if the program should abort if the user answer to the confirm prompt is no. The default is an abort.
Returns: False if the user entered no, True if the user entered yes
Return type: bool
-
PrintError(text: str)[source]¶ A echo for errors with click.
Parameters: text (str) – the text to print
-
PrintInfo(text: str)[source]¶ A echo for information with click.
Parameters: text (str) – the text to print
-
PromptError(text: str) → str[source]¶ A prompt for errors with click.
Parameters: text (str) – the text to prompt Returns: the user input Return type: str
-
PromptInfo(text: str) → str[source]¶ A prompt for information with click.
Parameters: text (str) – the text to prompt Returns: the user input Return type: str
-
PromptInfoWithDefault(text: str, text_type: object, default: object) → str[source]¶ A prompt for information, with a default value and a required type.
Parameters: - text (str) – the text to prompt
- text_type (object) – the type of the input
- default (object) – the default value
Returns: the user input
Return type: str
-
plasoscaffolder.common.type_mapper module¶
The mapper between SQL and python data types
-
class
plasoscaffolder.common.type_mapper.TypeMapperSQLitePython[source]¶ Bases:
objectThe mapper between SQLite and python data types
The mappings taken from the site: https://sqlite.org/datatype3.html
-
MAPPINGS= {'BIGINT': <class 'int'>, 'NCHAR': <class 'str'>, 'DOUBLE': <class 'float'>, 'NUMERIC': <class 'int'>, 'CHAR': <class 'str'>, 'CLOB': <class 'str'>, 'FLOAT': <class 'float'>, 'DATE': <class 'int'>, 'STRING': <class 'str'>, 'TINYINT': <class 'int'>, 'SMALLINT': <class 'int'>, 'BOOLEAN': <class 'bool'>, 'DECIMAL': <class 'int'>, 'INT': <class 'int'>, 'NATIVE CHARACTER': <class 'str'>, 'MEDIUMINT': <class 'int'>, 'BLOB': <class 'bytes'>, 'DOUBLE PRECISION': <class 'float'>, 'VARYING CHARACTER': <class 'str'>, 'DATETIME': <class 'int'>, 'REAL': <class 'float'>, 'INT8': <class 'int'>, 'INT2': <class 'int'>, 'INTEGER': <class 'int'>, 'CHARACTER': <class 'str'>, 'VARCHAR': <class 'str'>, 'UNSIGNED BIG INT': <class 'int'>, 'TEXT': <class 'str'>, 'NVARCHAR': <class 'str'>}¶
-