from logging import Logger from typing import Union from colorama import init as initColorama, Style, Fore from git_guardrails.cli.logging import create_cli_logger from git_guardrails.errors import NonApplicableSituationException, UnhandledSituationException, UserBypassException from git_guardrails.errors import UserBypassableWarning initColorama() def generate_welcome_banner(): return ''.join([ Style.DIM, "|===|===|===|==", Style.RESET_ALL, Fore.LIGHTCYAN_EX, " Git Guardrails ", Fore.RESET, Style.DIM, "==|===|===|===|", Style.RESET_ALL ]) class CLIUX: def __init__(self, supports_color: bool, supports_tty: bool, log_level: int, logger: Logger = None): self.log_level = log_level self.supports_color = supports_color self.supports_tty = supports_tty self.logger = logger or create_cli_logger(log_level=log_level) def info(self, msg, *args, **kwargs): self.logger.info(msg, *args, **kwargs)
def __init__(self): """This function is the constructor. It initializes the colorama class.""" initColorama()
from colorama import Fore, Back, Style, init as initColorama from state import ObjectState, CellState initColorama() class Actor(object): DESCRIPTION = "unknown" SYMBOL = '?' COLOR = "WHITE" STYLE = "NORMAL" CALORIES = 0 PRIORITY = 0 id_count = 0 def __init__(self, world, x, y): self.x = x self.y = y self.world = world self.size = 1 self.age = 0 self.id = "%s-%i" % (self.DESCRIPTION, self.id_count) self.__class__.id_count += 1 def move(self, x, y): self.world.move(self, x, y) @property def state(self): return ObjectState(self) def iterate(self):