def save(self):
     config = ConfigManager()
     config.writeConfig(
         "EVENT", {
             "Name":
             self.eventconfig.getName(),
             "Description":
             self.eventconfig.getDesc(),
             "StartTime":
             self.eventconfig.getStart().strftime("%Y-%m-%dT%H:%M:%SZ"),
             "EndTime":
             self.eventconfig.getEnd().strftime("%Y-%m-%dT%H:%M:%SZ"),
             "Lead":
             self.eventconfig.getLead(),
             "LeadIp":
             self.eventconfig.getLeadIp(),
             "Connections":
             self.eventconfig.getConnections(),
             "Root":
             self.eventconfig.getRootDir(),
             "Red":
             self.eventconfig.getRed(),
             "Blue":
             self.eventconfig.getBlue(),
             "White":
             self.eventconfig.getWhite()
         })
    def restore(self):
        config = ConfigManager()
        result = config.getConfig("EVENT")

        self.eventconfig.setName(result["Name"])
        self.eventconfig.setDesc(result["Description"])
        self.eventconfig.setStart(result["StartTime"])
        self.eventconfig.setEnd(result["EndTime"])

        self.eventconfig.setLead(result["Lead"])
        self.eventconfig.setLeadIp(result["LeadIp"])
        self.eventconfig.setConnections(result["Connection"])

        self.eventconfig.setRootDir(result["Root"])
        self.eventconfig.setRed(result["Red"])
        self.eventconfig.setBlue(result["Blue"])
        self.eventconfig.setWhite(result["White"])
Ejemplo n.º 3
0
 def connect(self):
     splunkconfig = ConfigManager().getConfig("SPLUNK")
     try:
         self.service = client.connect(host=splunkconfig["Host"],
                                       port=splunkconfig["Port"],
                                       username=splunkconfig["Username"],
                                       password=splunkconfig["Password"])
     except Exception as e:
         # TODO: Handle this case
         print(str(e))
Ejemplo n.º 4
0
    else:
        lprint('Testing {} with ckpt {}'.format(config.network, config.ckpt),
               log)
        # Data loading
        test_set = dataset_handler.get_test_split()
        test_loader = DataLoader(test_set,
                                 batch_size=config.batch,
                                 shuffle=False)

        # Initialize network
        net = DGCNNCls(num_classes=num_classes, K=config.K, device=device)
        if config.ckpt is not None and os.path.isfile(config.ckpt):
            ckpt = torch.load(config.ckpt, map_location=map_location)
            net.resume_(ckpt['state_dict'],
                        ckpt['optimizer'],
                        ckpt['lr_scheduler'],
                        training=False)
        start_time = time.time()
        test_acc = test_epoch_detailed(net, test_loader, get_label_fn,
                                       categories)
        lprint(
            'Accuracy: {:.4f} time {:.4f}s\n\n'.format(
                test_acc,
                time.time() - start_time), log)
    log.close()


if __name__ == '__main__':
    cm = ConfigManager()
    config = cm.parse()
    main(config)
Ejemplo n.º 5
0
 def __init__(self):
      config_obj = ConfigManager.get_instance()
      self.config = config_obj.dataMap
      self.plivo_block = self.config.get(PLIVO_CONFIG,{})
Ejemplo n.º 6
0
from .VolumeParser import Vanilla as volume_parser
from scanners.vanilla import Vanilla as library_scanner
from pathlib import Path
from tqdm.auto import tqdm

from utils.config import ConfigManager
from comicvine import ComicVineClient

manager = ConfigManager()

class Vanilla:
    def __init__(self, library_path):
        self.library_path = Path(library_path).resolve()
        self.n_comics = None
        self.n_volumes = None
        self.folder_paths = []
        self.library_dict = {}
        self.api_key = manager.read_api_key()

    def library_watchdog(self):
        pass

    def scan_root_folder(self):
        #folders = list({each.parent for each_ext in ['*.cbr', '*.cbz'] for each in self.library_path.rglob(each_ext)})
        scanner = library_scanner(library_path=self.library_path)
        self.library_dict = scanner.scan()

    def volumify(self):
        for each in self.library_dict:
             for each_type in self.library_dict[each]:
                self.library_dict[each][each_type]['parser'] = volume_parser(name=each, volume_type=each_type, path=self.library_dict[each][each_type]['path'], paths_in_folder=self.library_dict[each][each_type]['paths_in_folder'])
Ejemplo n.º 7
0
 def __init__(self):
     config_obj = ConfigManager.get_instance()
     self.config = config_obj.dataMap
     self.plivo_block = self.config.get(PLIVO_CONFIG, {})