Skip to content

Commit

Permalink
Add more dependencies (draft)
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanvogel committed Feb 7, 2025
1 parent cd86605 commit eb1b090
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 12 deletions.
53 changes: 53 additions & 0 deletions src/pyProfileMgr/print_type.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
""" The different print msg types
(error, warning, info).
"""

# BSD 3-Clause License
#
# Copyright (c) 2024 - 2025, NewTec GmbH
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

################################################################################
# Imports
################################################################################
from enum import IntEnum
################################################################################
# Variables
################################################################################

################################################################################
# Classes
################################################################################
class PrintType(IntEnum):
""" Different Printer Information Types.
"""
ERROR = 0
WARNING = 1
INFO = 2
################################################################################
# Functions
################################################################################
24 changes: 13 additions & 11 deletions src/pyProfileMgr/printer.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,28 +36,30 @@
################################################################################
from colorama import Fore, Style

from pyJiraCli.print_type import PrintType
from pyJiraCli.ret import Ret, Warnings
from pyProfileMgr.print_type import PrintType
from pyProfileMgr.ret import Ret, Warnings

################################################################################
# Variables
################################################################################
COLOR = {
PrintType.ERROR : Fore.RED,
PrintType.WARNING : Fore.YELLOW,
PrintType.INFO : Fore.WHITE
PrintType.ERROR: Fore.RED,
PrintType.WARNING: Fore.YELLOW,
PrintType.INFO: Fore.WHITE
}

TYPE = {
PrintType.ERROR : "Error",
PrintType.WARNING : "Warning",
PrintType.INFO : "Info"
PrintType.ERROR: "Error",
PrintType.WARNING: "Warning",
PrintType.INFO: "Info"
}

INFO_TAB = " "
################################################################################
# Classes
################################################################################


class Printer:
""" The printer class.
Prints errors, warnings and infos.
Expand All @@ -76,7 +78,7 @@ def set_verbose(cls):

def print_error(self, err_type: PrintType, error: Ret = Ret.CODE.RET_OK) -> None:
""" Print the exit error.
Args:
type (PrintType) The type of the msg (Error, Warning or Info).
error (Ret): The return code for which an error shall be printed.
Expand All @@ -90,9 +92,9 @@ def print_error(self, err_type: PrintType, error: Ret = Ret.CODE.RET_OK) -> None
print(COLOR[err_type] + TYPE[err_type] + ": " +
Style.RESET_ALL + Ret.MSG[error])

def print_info(self, *args:str) -> None:
def print_info(self, *args: str) -> None:
""" Print the information to the console.
Args:
args (*str): The information that will be printed.
"""
Expand Down
2 changes: 1 addition & 1 deletion src/pyProfileMgr/profile_mgr.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def __init__(self):
self._profile_password = None
self._profile_cert = None

# pylint: disable=R0912, R0913
# pylint: disable=R0912, R0913, R0917
def add(self,
profile_name: str,
profile_type: ProfileType,
Expand Down

0 comments on commit eb1b090

Please sign in to comment.