Beispiel #1
0
 def get_existed_data(self):
     result = self.sheet_service.spreadsheets().values().get(
         spreadsheetId=config.spreadsheet_id, range=config.range).execute()
     logger.debug(f"Sheet data : {result}")
     rows = result.get('values', [])[1:]
     logger.info('{0} rows retrieved.'.format(len(rows)))
     return rows
Beispiel #2
0
def create_ticket():
    logger.info("Create ticket received !")

    data = request.form.to_dict()

    logger.debug(f"Create ticket form : {data}")
    text = data.get("text")
    trigger_id = data.get("trigger_id")
    logger.debug(f"Trigger ID : {trigger_id}")
    return open_dialog(text, trigger_id)
Beispiel #3
0
def interactive():
    logger.info("Interactive received !")
    data = request.form.to_dict()
    logger.debug(f"Request form : {data}")
    payload = json.loads(data.get("payload"))
    logger.debug(f"Payload : {payload}")
    submission = payload.get("submission")
    type_ = payload.get("type")
    logger.debug(f"Type {type_}")
    if type_ != "dialog_submission":
        return "something goes wrong"
    if not validators.email(submission.get("email")):
        return "Invalid e-mail ! Please correct your data !"

    thread = Thread(target=send_create_ticket_request, kwargs=submission)
    thread.start()
    return ""
Beispiel #4
0
def break_func():
    result = ""
    try:
        logger.info("Break received !")
        data = request.form.to_dict()
        logger.debug(f"Break data : {data}")
        username = data.get("user_name")
        params = data.get("text")
        sub_command = params.split(" ")[0]
        if sub_command.isdigit():
            raise NotImplementedError
        try:
            result = break_sub_command_list[sub_command](username, params)
        except KeyError as unexpected_command:
            result = "Unrecognized command received : {} . Use /break help for information".format(sub_command)
    except Exception as e:
        logger.error(e, exc_info=True)
        result = "Unexpected error. Please contact the admin."
    finally:
        return result
import os, sys
sys.path.append('./src')

from FileProcesses import FileParser
from EventProcesses import EventTerminal
from ImageProcesses import ImageParser

import variables_in as var
from main_logger import logger

if __name__ == "__main__":
    logger.info(var.file_location)

    # logger.info('Starting image processing')
    # img_rd_prsr = ImageParser(var.file_location,show_detect_jpg=False)
    # pre_processed = img_rd_prsr.pre_process_image(img_rd_prsr.img, var.pre_file, morph_size=(16, 16))
    # text_boxes = img_rd_prsr.find_text_boxes(pre_processed, 6, 52)
    # cells = img_rd_prsr.find_table_in_boxes(text_boxes, 10, 2)
    # hor_lines, ver_lines = img_rd_prsr.build_lines(cells)
    # img_rd_prsr.output_detection(img_rd_prsr.img, text_boxes, hor_lines, ver_lines, var.out_file) # Output the bounds before parsing the image
    # img_rd_prsr.image_processor(img_rd_prsr.img, hor_lines, ver_lines, cells, limit_col=4)
    # logger.info('Finishing image processing')

    logger.info('Starting file parser')
    fl_prsr = FileParser(var.file_location, from_file=var.from_file)
    # lines_of_data = fl_prsr.parse_file()
    fl_prsr.parse_dataframe()
    # fl_prsr._output_df()
    logger.info('Finishing file parser')

    df = fl_prsr.df  #.dropna(axis=0)
Beispiel #6
0
def slack():
    logger.info("Event received !")
    logger.debug(f"Event data : {request.data}")
    data = request.json
    return data.get("challenge")
Beispiel #7
0
def back():
    logger.info("Back")
    return "Welcome back !"
Beispiel #8
0
def end():
    logger.info("End")
    return "Good bye !"
Beispiel #9
0
def brb():
    logger.info("Brb")
    return "Yes. Have a break."
Beispiel #10
0
def lunch():
    logger.info("Lunch")
    return "Have a good lunch!"
Beispiel #11
0
def clock_out():
    logger.info("Clock out")
    return "Have a good rest!"
Beispiel #12
0
def clock_in():
    logger.info("Clock in")
    return "Have a good day!"
Beispiel #13
0
def main():
    primary_file = HashesFile(args.primary)
    other_files = [HashesFile(path) for path in args.files]

    SPLIT_BETWEEN_MSG_SIGN = "##############################\n\n\n"
    for another_file in other_files:
        comparing_details = primary_file.compare(another_file)

        logger.info("Changes between file {} and file {}".format(
            primary_file.path, another_file.path))
        logger.info(SPLIT_BETWEEN_MSG_SIGN)

        logger.info("NOT EQUAL HASHES:")
        logger.info(comparing_details["not_equal_hashes"])

        logger.info(SPLIT_BETWEEN_MSG_SIGN)

        logger.info("PATHS ONLY IN SELF:")
        logger.info(comparing_details["paths_only_in_self"])
        logger.info(SPLIT_BETWEEN_MSG_SIGN)

        logger.info("PATHS ONLY IN OTHER:")
        logger.info(comparing_details["paths_only_in_other"])
        logger.info(SPLIT_BETWEEN_MSG_SIGN)

        logger.info("EQUAL HASHES:")
        logger.info(comparing_details["equal_hashes"])
        logger.info(SPLIT_BETWEEN_MSG_SIGN)

        logger.info("Summary: ")
        logger.info("Number of files that they hashes is not equal: {}".format(
            len(comparing_details["not_equal_hashes"])))
        logger.info("Number of files that they hashes is equal: {}".format(
            len(comparing_details["equal_hashes"])))
        logger.info(
            "Number of files that found only in primary file is: {}".format(
                len(comparing_details["paths_only_in_self"])))
        logger.info(
            "Number of files that found only in second file is: {}".format(
                len(comparing_details["paths_only_in_other"])))