Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __init__(self, parent):
super(wx.richtext.RichTextCtrl, self).__init__(parent, -1, "", style=wx.richtext.RE_MULTILINE | wx.richtext.RE_READONLY)
self.regex_urls=re.compile(r'\b((?:file://|https?://|mailto:)[^][\s<>|]*)')
self.url_colour = wx.Colour(0,0,255)
self.esc = colored.style.ESC
self.end = colored.style.END
self.noop = lambda *args, **kwargs: None
self.actionsMap = {
colored.style.BOLD: self.BeginBold,
colored.style.RES_BOLD: self.EndBold,
colored.style.UNDERLINED: self.BeginUnderline,
colored.style.RES_UNDERLINED: self.EndUnderline,
colored.style.RESET: self.EndAllStyles,
}
# Actions for coloring text
for index, hex in enumerate(kColorList):
escSeq = '{}{}{}'.format(colored.fore.ESC, index, colored.fore.END)
wxcolor = wx.Colour(int(hex[1:3],16), int(hex[3:5],16), int(hex[5:],16), alpha=wx.ALPHA_OPAQUE)
# NB : we use a default parameter to force the evaluation of the binding
self.actionsMap[escSeq] = lambda bindedColor=wxcolor: self.BeginTextColour(bindedColor)
def command_develop(args):
off = args.off
microservice_name = args.microservice_name
volume = args.volume
if off:
path = get_armada_develop_env_file_path()
if os.path.exists(path):
os.unlink(path)
return
current_dir_name = os.path.basename(os.getcwd())
if current_dir_name != microservice_name:
print(style.BOLD + fore.YELLOW
+ 'WARNING: Current working directory name "{}" does not match '
'microservice name "{}".'.format(current_dir_name, microservice_name)
+ style.RESET)
save_dev_env_vars(microservice_name, volume)
# -*- coding: utf-8 -*-
import re
import os
import logging
from colored import fore, back, style
STY_DESC = fore.LIGHT_GREEN + back.BLACK
STY_DESC_DEBUG = fore.SKY_BLUE_1 + back.BLACK + style.DIM
STY_USER = style.RESET + fore.WHITE + back.BLACK
STY_CURSOR = fore.LIGHT_GOLDENROD_2B + back.BLACK + style.BOLD
STY_RESP = fore.WHITE + back.MEDIUM_VIOLET_RED + style.BOLD
STY_RECIPIENT = fore.WHITE + back.DODGER_BLUE_2 + style.BOLD
# STY_RESP = fore.WHITE + back.GREY_11 + style.BOLD #+ style.NORMAL
STY_EMAIL = fore.WHITE + back.GREY_11 + style.BOLD
def setup_custom_logger(name):
formatter = logging.Formatter(
STY_DESC_DEBUG + '%(asctime)s - %(module)s - %(levelname)8s - %(message)s' +
style.RESET, datefmt='%Y-%b-%d %H:%M:%S')
handler = logging.StreamHandler()
handler.setFormatter(formatter)
logger = logging.getLogger(name)
logger.setLevel(logging.WARN)
logger.addHandler(handler)
return logger
def notify_about_detected_dev_environment(image_name):
if is_armada_develop_on() and os.environ.get('MICROSERVICE_NAME') == image_name:
print(style.BOLD + fore.GREEN
+ 'INFO: Detected development environment for microservice "{}".'.format(image_name)
+ style.RESET)