Beispiel #1
0
 def __init__(self, master=None):
     super().__init__(master)
     self.master = master
     self.master.title(CONST_APP_TITLE)
     self.master.geometry('600x400+400+100')
     self.master.resizable(0, 0)
     self.config(width=500, height=500)
     self.place(x=50, y=0)
     self.application_widgets()
     self.processor = Processor()
Beispiel #2
0
    def __init__(self, config):
        self.executor = ReadFactory(config).get_executor()
        self.processor = Processor(config)
        self.writer = WriterFactory().instance_writer(config, self.processor.aggregation_output_struct,
                                                      self.processor.enumerate_output_aggregation_field)
        self._isAnalysis = False

        if ("analysis" in config.content.keys()):
            self._isAnalysis = True
            self.analysis = AnalysisFactory(config,
                                            self.processor.aggregation_output_struct,
                                            self.processor.enumerate_output_aggregation_field)
Beispiel #3
0
    def show_solution(self):
        top = tk.Toplevel(self)
        top.geometry('500x400+400+100')
        top.title(RESULT_TITLE)
        scroll = tk.Scrollbar(top)
        c = tk.Canvas(top, yscrollcommand=scroll.set)

        scroll.config(command=c.yview)
        scroll.pack(side='right', fill='y')

        top_frame = tk.Frame(c)
        top_frame.config(width=500)
        c.pack(side='left', fill='both', expand=True)
        c.create_window(0, 0, window=top_frame, anchor='nw')
        top.update()
        c.config(scrollregion=c.bbox('all'))

        response = self.run_data()
        self.processor = Processor()

        tk.Label(top_frame, text=CONST_TOPIC_NAME).grid(padx=(70, 80),
                                                        pady=(5, 30),
                                                        row=0,
                                                        column=0)
        tk.Label(top_frame, text=CONST_RESULT_PAGES).grid(padx=(70, 80),
                                                          pady=(5, 30),
                                                          row=0,
                                                          column=1)

        for i in range(len(response[TOPICS_RESPONSE])):
            if response[INCLUDE_RESPONSE][i] == 'true':
                tk.Label(top_frame,
                         text=response[TOPICS_RESPONSE][i]).grid(padx=(70, 80),
                                                                 pady=(5, 30),
                                                                 row=i + 1,
                                                                 column=0)
                tk.Label(top_frame,
                         text=response[PAGES_RESPONSE][i]).grid(padx=(70, 80),
                                                                pady=(5, 30),
                                                                row=i + 1,
                                                                column=1)

        tk.Label(top_frame, text=CONST_READERS).grid(
            padx=(70, 80),
            pady=(5, 30),
            row=len(response[TOPICS_RESPONSE]) + 1,
            column=0)
        tk.Label(top_frame, text=response[READERS_RESPONSE]).grid(
            padx=(70, 80),
            pady=(5, 30),
            row=len(response[TOPICS_RESPONSE]) + 1,
            column=1)
Beispiel #4
0
def main():
    """
    Usage:
        python3 app.py input.txt' or 'python3 < input.txt'
    """
    log.info('Begin processing...')
    t = process_time()
    processor = Processor()

    # Accept input from two types of sources:
    # a filename passed in command line arguments or STDIN.
    with open(sys.argv[1], 'r') if len(sys.argv) > 1 else sys.stdin as f:
        for line in f:
            processor.parse_event(line)

    log.info('Finished processing in {0:.3f} seconds'.format(process_time() - t))
    summary = processor.generate_summary()
    processor.write_output(summary)
Beispiel #5
0
import sys

import torch
from torch.backends import cudnn

from processor.processor import Processor

torch.backends.cudnn.deterministic = False
cudnn.benchmark = True  # https://discuss.pytorch.org/t/what-does-torch-backends-cudnn-benchmark-do/5936
torch.cuda.empty_cache()  # release cache

if __name__ == '__main__':
    proc = Processor(sys.argv[1:])
    proc.start()
Beispiel #6
0
 def run_processor():
     self.processor = Processor(get_projectdb(), self.in_queue,
                                self.status_queue, self.newtask_queue,
                                self.result_queue)
     self.processor.CHECK_PROJECTS_INTERVAL = 0.1
     self.processor.run()
Beispiel #7
0
 def setUp(self):
     self.processor = Processor()
Beispiel #8
0
import os
from processor.processor import Processor

if __name__ == "__main__":
    current_path = os.path.dirname(os.path.abspath(__file__))
    data_path = os.path.join(current_path, "data")
    resource_path = os.path.join(data_path, "resources")
    input_path = os.path.join(data_path, "inputs", "1984.txt")
    output_path = os.path.join(data_path, "outputs")
    processor = Processor(resource_path=resource_path, config={})
    processor.process(input_path=input_path, output_path=output_path)
Beispiel #9
0
    parser.add_argument('--num_of_vertices',
                        type=int,
                        default=358,
                        help='The number of vertices')
    parser.add_argument('--gen_config_args',
                        type=dict,
                        default=dict(),
                        help='The config of data generate')
    return parser


if __name__ == '__main__':
    parser = get_parser()

    # load arg form config file
    p = parser.parse_args()
    if p.config is not None:
        with open(p.config, 'r') as f:
            default_arg = yaml.load(f)
        key = vars(p).keys()
        for k in default_arg.keys():
            if k not in key:
                print('WRONG ARG: {}'.format(k))
                assert (k in key)
        parser.set_defaults(**default_arg)

    arg = parser.parse_args()
    init_seed(0)
    processor = Processor(arg)
    processor.start()
Beispiel #10
0
 def test__number__(self):
     config = Config(CONFIG_PATH_NUM)
     p = Processor(config)
     self.assertIsInstance(
         p.transformation, types.LambdaType,
         "Processor#transformation should be a lambda object")