Exemple #1
0
    def __init__(self, init_cfg: dict, path: dict, die_in):
        self._die_in = die_in
        self.reload = False

        self._cfg = ConfigHandler(cfg=init_cfg, path=path)
        self._logger = Logger(self._cfg['log'])
        self._cfg.configure(self._logger.add('CFG'))

        proxy.add_logger(self._logger.add('Proxy'))

        self._tts = stts.TextToSpeech(cfg=self._cfg, log=self._logger.add('TTS')).tts

        self._play = Player(cfg=self._cfg, log=self._logger.add('Player'), tts=self._tts)

        self._mpd = MPDControl(cfg=self._cfg['mpd'], log=self._logger.add('MPD'), play=self._play)

        self._stt = stts.SpeechToText(cfg=self._cfg, play_=self._play, log=self._logger.add('STT'), tts=self._tts)

        self._mm = ModuleManager(
            log=self._logger.add_plus('MM'), cfg=self._cfg, die_in=self.die_in, say=self._play.say
        )

        self._terminal = MDTerminal(
            cfg=self._cfg, play_=self._play, stt=self._stt,
            log=self._logger.add('Terminal'), handler=self._mm.tester
        )

        self._server = MDTServer(
            cfg=self._cfg, log=self._logger.add('Server'),
            play=self._play, terminal_call=self._terminal.call, die_in=self.die_in
        )
Exemple #2
0
async def update_cfg(ctx, *args):
    handler = ConfigHandler(ctx, args)
    await handler.handle()
Exemple #3
0
def main():
    # Program happens here
    cfg_handler = ConfigHandler()
    password = get_password()

    # Main program loop, ends by selecting mode 4
    while True:
        print('Select desired mode:')
        print('''    1: Report bugs
    2: Batch report
    3: Change config
    4: Exit
        ''')

        # Selects a valid use mode and breaks
        use_mode = ask_use_mode()

        if use_mode == 4:  # Quit use_mode
            print("Ending")
            break

        elif use_mode == 3:  # Edit configuration use_mode
            cfg_handler.config_edit()

        elif use_mode in [1, 2]:  # Report bugs use_mode

            # This section validates the edited pictures directory from config.cfg
            images_folder = validate_cfg_images()
            if images_folder == "":
                continue

            mantis_username = read_config("mantis username")
            if mantis_username == "":
                print("Mantis username not found in config.cfg")
                continue

            # If password was not entered successfully this session, it happens here
            if password == "":
                password = log_into_tsreporter(mantis_username, read_config("preferred browser"))
                if password == "":
                    continue

            doc_path = read_config("documents location")  # Path to documents

            # Here,the user selects which project to report into
            # This is important because it determines which game's files and versions will be accessed
            chosen_project = ver.get_project_from_user()
            if chosen_project == 'Return to menu':
                continue
            if chosen_project[0] == 'A':
                game_path = doc_path + "/American Truck Simulator"
            else:
                game_path = doc_path + "/Euro Truck Simulator 2"

            bug_lines = read_bugs_file(game_path)  # bugs.txt is found and read into bug_lines
            if not bug_lines:  # read_bugs_file() returns none if there is a problem
                continue

            version = ver.find_version(chosen_project[0], cfg_handler)  # Returns -1 if it cant read version
            if version == -1:  # Version is not found, would result in invalid report
                continue
            print(f"Reporting in project [{chosen_project}] at version {version}")

            all_bugs = read_bug_lines(bug_lines)
            # Reporting occurs here
            if use_mode == 1:  # Standard reporting use_mode
                while len(all_bugs) > 0:
                    current_bug = all_bugs.popleft()
                    if current_bug[0][0] not in ['!', ';']:
                        assign_to = find_assign_to(current_bug[0], chosen_project[0])
                        keep_reporting = report_bug(chosen_project, current_bug, version, images_folder, assign_to,
                                                    mantis_username, password, read_config("preferred browser"))
                        if not keep_reporting:
                            break
                    archive_bug(current_bug, game_path)

            elif use_mode == 2:  # Batch reporting use_mode
                # Here, all bugs in bugs.txt are read and put into a list of stack of individual report lines
                format_is_correct = check_batch_formats(bug_lines)
                if not format_is_correct:
                    continue

                image_check = check_batch_images(all_bugs, images_folder)
                if image_check:
                    continue

                reported = batch_report_bugs(
                    chosen_project, all_bugs, version, images_folder,
                    mantis_username, password, read_config("preferred browser")
                )
                if not reported:
                    continue
                with open(game_path + "/bugs_archive.txt", "a") as archive:
                    archive.writelines(bug_lines)
                with open(game_path + "/bugs.txt", "w"):
                    pass
Exemple #4
0
from emails import EmailHandler
from config import ConfigHandler
from logger_ import MyLogger, Debug
from urls import URLHandler
from report import Report, Partition

from datetime import datetime as dt
from sys import _getframe as gf
from os import _exit

if __name__ == "__main__":

    today = dt.now().strftime("%b %d")
    cfg = ConfigHandler().load()
    d = Debug(enable=cfg['debug_enabled'])

    d.write("Line {} - Entered main routine \n".format(gf().f_lineno), "w+")
    d.write("Line {} - Before loading logger \n".format(gf().f_lineno), "a")
    log = MyLogger()
    d.write("Line {} - After loading logger \n".format(gf().f_lineno), "a")
    d.write("Line {} - Checking for balcklist \n".format(gf().f_lineno), "a")
    # to track current day and check against black list
    if today in cfg['blacklist_days']:
        d.write("Line {} - entered blacklist routine \n".format(gf().f_lineno),
                "a")
        log._switch_to_blacklist()
        log.header("blacklist", 65, "w+")
        log.write([
            " >>\n",
            " >> This date '{0}' is listed on the blacklist, which means:\n".
            format(today), "   >> No data has been gathered.\n",
Exemple #5
0
from data_structure.query import Query
from components.stanford_parser import StanfordParser
from components.node_mapper import NodeMapper
from components.entity_resolution import entity_resolute
from components.tree_structure_adjustor import TreeStructureAdjustor
from components.explainer import explain
from components.sql_translator import translate

from misc.process_command import CommandProcessor

from config import ConfigHandler
from config import get_logger

database = '' if len(sys.argv) < 2 else sys.argv[1]
print(database)
config = ConfigHandler(database=database,reset=True)
logger = get_logger(__name__)

token_path = '/'.join(os.getcwd().split('/')[:-1] + ['zfiles', 'tokens.xml'])

command_processor = CommandProcessor()
tokens = et.parse(token_path)
print("load")
rdbms = RDBMS(config.connection)
print("loaded")
if config.defaultImplementation:
	logger.debug('entering data')


query_line='#query return me the publications of "H. V. Jagadish".'
print(query_line)
from components.node_mapper import NodeMapper
from components.entity_resolution import entity_resolute
from components.tree_structure_adjustor import TreeStructureAdjustor
from components.explainer import explain
from components.sql_translator import translate
from misc.similarity import load_model
from misc.process_command import CommandProcessor
from copy import deepcopy
from data_structure.parse_tree import ParseTree
from inverted_index import LateCandidateMapper

from config import ConfigHandler
from config import get_logger

logger = get_logger(__file__)
config = ConfigHandler()

if len(sys.argv) != 3:
    print('usage python {0} <process_file> <output_file>'.format(sys.argv[0]))
    sys.exit()

query_file = sys.argv[1]
rel_file = sys.argv[2]
if not os.path.isfile(query_file):
    print('Please type a valid file')
    sys.exit()

token_path = '/'.join(os.getcwd().split('/')[:-1] + ['zfiles', 'tokens.xml'])

tokens = et.parse(token_path)
rdbms = RDBMS(config.connection)
Exemple #7
0
 def config(self):
     return ConfigHandler(self.beets)
Exemple #8
0
    def __init__(self, init_cfg: dict, init_state: dict, path: dict,
                 sig: SignalHandlerDummy):
        self._sig = sig
        self.reload = False
        self._restore_filename = None
        self._lock = threading.Lock()
        self._stts_lock = threading.Lock()
        self._join_lock = threading.Lock()

        self._pub = PubSub()
        self._sig.set_wakeup_callback(
            lambda: self.sub_call('default', 'terminal_stop', True))

        self._logger = logger.Logger(self)
        proxies.add_logger(self._logger.add('Proxy'))

        self._cfg = ConfigHandler(cfg=init_cfg,
                                  state=init_state,
                                  path=path,
                                  log=self._logger.add('CFG'),
                                  owner=self)
        self._logger.init(cfg=self._cfg, owner=self)
        self._log = self._logger.add('SYSTEM')

        self._listen = Listener(cfg=self._cfg,
                                log=self._logger.add('REC'),
                                owner=self)
        self._notifier = MajordomoNotifier(cfg=self._cfg,
                                           log=self._logger.add('Notifier'),
                                           owner=self)
        self._tts = stts.TextToSpeech(cfg=self._cfg,
                                      log=self._logger.add('TTS'))
        self._play = Player(cfg=self._cfg,
                            log=self._logger.add('Player'),
                            owner=self)
        self._music = music_constructor(cfg=self._cfg,
                                        logger=self._logger,
                                        owner=self)
        self._stt = stts.SpeechToText(cfg=self._cfg,
                                      log=self._logger.add('STT'),
                                      owner=self)
        self._mm = ModuleManager(cfg=self._cfg,
                                 log=self._logger.add('MM'),
                                 owner=self)
        self._updater = Updater(cfg=self._cfg,
                                log=self._logger.add('Updater'),
                                owner=self)
        self._backup = Backup(cfg=self._cfg,
                              log=self._logger.add('Backup'),
                              owner=self)
        self._terminal = MDTerminal(cfg=self._cfg,
                                    log=self._logger.add('Terminal'),
                                    owner=self)
        self._server = server_constructor(cfg=self._cfg,
                                          logger=self._logger,
                                          owner=self)
        self._plugins = Plugins(cfg=self._cfg,
                                log=self._logger.add('Plugins'),
                                owner=self)
        self._duplex_pool = DuplexPool(cfg=self._cfg,
                                       log=self._logger.add('DP'),
                                       owner=self)

        self._discovery = DiscoveryServer(cfg=self._cfg,
                                          log=self._logger.add('Discovery'))