Ejemplo n.º 1
0
def get_arg_list():
	arg_list = []
	arg_dict = {}
	m = Manager()
	arr = m.get_xml_data()		
	for dados in arr:
		arg_dict['url'] = dados['url_xml']
		arg_dict['id_login'] = dados['id_login']
		arg_list.append(arg_dict)
		arg_dict = {}			
	return arg_list
Ejemplo n.º 2
0
def run_automat(config_file):
    """
    run automat:
    - listen for RFID tag signal
    - when a signal comes in, ask the manager to handle it
    """
    manager = Manager(config=config_file)
    reader = Reader(config=config_file)
    while True:
        setting = reader.get_input()
        manager.check_setting(setting)
Ejemplo n.º 3
0
    def Iniciar(self):
        argumentos = self.values
        data = argumentos[0] + "-" + argumentos[1] + "-" + argumentos[2]
        lista = []
        try:

            m = Manager(str(data))
            #Baixando todas as imagens referentes a data inserida
            key = m.download()
            #Reconhencendo todas as imagens presentes na pasta Analisar
            ra = Reconhecimento(argumentos[4], argumentos[3]).Reconhecer()
            #indice para percorrer a variavel de reconhecimento "ra"
            cont = 0
            #Inicializando a linha do excel na primeira
            row = 1
            #Inicializando a coluna do excel na 0
            column = 0
            #Permitindo o uso de acento...
            book = xlwt.Workbook(encoding="utf-8")
            #Gerando a panilha do execel
            sheet1 = book.add_sheet("Sheet 1", cell_overwrite_ok=True)

            #Percorrendo o nome de todas as imagens
            for valor in key:
                if (ra[cont] != "NA"):
                    #Buscando todas as informações das imagens reconhecidas
                    dados = m.dados(str(valor), str(ra[cont]),
                                    str(ra[cont + 1]))

                    #Inserindo dados dentro de uma planilha
                    sheet1.write(row, column, str(dados['ra']))
                    sheet1.write(row, column + 1, str(dados['nome']))
                    sheet1.write(row, column + 2, str(dados['hour']))
                    sheet1.write(row, column + 3, str(dados['min']))
                    sheet1.write(row, column + 4, str(dados['date']))
                    sheet1.write(row, column + 5, str(dados['longitude']))
                    sheet1.write(row, column + 6, str(dados['latitude']))

                    #pulando uma linha na planilha do excel
                    row = row + 1
                    #Registro().insertRegistro(dados['ra'],dados['nome'],dados['hour'],dados['min'], dados['sec'], dados['date'], dados['latitude'], dados['longitude'])

                cont = cont + 2

            #Salvando as informações inseridas na planilha
            book.save("users.xls")
            tela = ChamadaView()
            tela.Iniciar()
            #sg.popup(f"Enviado com sucesso")

        except:
            sg.popup(f"Erro ao enviar!")
Ejemplo n.º 4
0
def login(identity_int):
    # 学生注册
    global obj
    if identity_int == 3:
        return Student()

    identity_dict = {
        1: "Teacher",
        2: "Student",
        4: "Manager",
    }
    id_num = input("Please input " + identity_dict[identity_int] + " id: ")
    password = input("Please input " + identity_dict[identity_int] +
                     " password: "******"Wrong user name or password!")
Ejemplo n.º 5
0
    def on_manager(self, event=None):
        self._root.btn_manager.config(state='disable')
        self._root.manager = Manager(self._root, self.db)

        def quit_win():
            self._root.manager.manager.destroy()
            self._root.btn_manager.config(state='normal')

        self._root.manager.manager.protocol("WM_DELETE_WINDOW", quit_win)
Ejemplo n.º 6
0
def destaques(event, context):
    try:
        bucket = 'minhaloja.com'
        path = 'produto/destaques/'
        file_name = 'produtos_em_destaque.json'
        key = path + file_name
        config = Manager().config_db('s3files')

        s3 = boto3.client('s3',
                aws_access_key_id = config['key_id'],
                aws_secret_access_key = config['access_key']
            )
        content_object = s3.get_object(Bucket=bucket, Key=key)    
        file_content = content_object['Body'].read().decode('utf-8')
        json_content = json.loads(file_content)
        return json_content
    except:
        return error_message('src/home', 'FileError', 'Destaques não encontrado')
def youtube_video_process(link: str):
    manager = Manager()
    manager.prepare_processing(link)

    processor = VideoProcessor(manager.cfg)
    process_gen = processor.run(manager.video)

    file_name = manager.processed_file.split(".")[0]
    frames_count = manager.frames_count

    output_txt_path = f'data/results/{file_name}.txt'

    with open(output_txt_path, 'a') as output_txt:
        for frame_pos, (vis_frame,
                        predictions) in tqdm.tqdm(process_gen,
                                                  total=frames_count):
            manager.output_video.write(vis_frame)
            output_txt.write(make_log(frame_pos, predictions))

    manager.finish_processing()
Ejemplo n.º 8
0
import pymssql
from src.manager import Manager
from src.abstract.storages import *
from src.exceptions import DataBaseError
from datetime import datetime, tzinfo, timedelta

mm = Manager()


class SaoPaulo(tzinfo):
    def utcoffset(self, dt):
        return timedelta(hours=-3)

    def dst(self, dt):
        return timedelta(0)

    def tzname(self, dt):
        return "American/Sao Paulo"


def getdate():
    return datetime.now(tz=SaoPaulo())


class StorageBase(AbstractStorageBase):
    db_connection = None
    db_cursor = None

    def __init__(self):
        try:
            config = mm.config_db('db_sql_server')
Ejemplo n.º 9
0
from src.control import Controler
from src.serial_port import SerialPort
from src.manager import Manager
from src.variable import gvar

# set up controler
control = Controler()

# set up serial port
serial_port = SerialPort()
# serial_port.thread_connection()

# set up manager
gvar.manager = Manager()
gvar.manager.serial = serial_port
gvar.manager.control = control
gvar.manager.thread_start()

# set up telnet
gvar.manager.listening_telnet()

if gvar.manager.connect_server():
    gvar.manager.regist_room()

gvar.manager.wait_keyboard_interrupt()
Ejemplo n.º 10
0
import sys
from utilities import log_helper, menu_strings
from src.manager import Manager
# Get Logger
log = log_helper.get_logger()

test = None

manager = Manager()


def main_menu():
    exit = False
    while (exit is False):
        print(menu_strings.main_menu)
        option = verify_input(input("> "), main_menu)
        if option == 0:
            print(f"Exiting program, thank you!")
            manager.stop_all_containers()
            sys.exit()
        elif option == 1:
            deploy_menu()
        elif option == 2:
            manager.list_containers()
        elif option == 4:
            get_server_info()
        else:
            print(f"You selected {option} which is not yet implemented")


def deploy_menu():
Ejemplo n.º 11
0
	def get_data(self, id_login):
		m = Manager()
		return m.get_xml_data_by_id(id_login)
Ejemplo n.º 12
0
from src import player
from src import enemy
from src.manager import Manager
import time
from colored import fg, bg, attr

###########ORIGINAL_DESIGN_ARCHITECTURE##############
#tree: ============ entity_class ====================
# ------ player_child -------- enemy_child ----------
# ----- attk / hp --------------- attk / hp ---------
# ===================================================

# renaming the manager class
gm = Manager()
# printing welcome screen
gm.print_screen(gm.welcome_screen)
#vVvVvVvVvVv MAIN GAME LOOP, GAME IS RUN HERE vVvVvVvV##
### gm.render_status, gm.player_take_turn, gm.enemy_take_turn are functions that live in Manager. ###
while gm.player_1.health > 0 and gm.enemy_ai.health > 0:
    gm.game_over = False

    gm.render_status()
    time.sleep(1)
    gm.player_take_turn()
    time.sleep(2)
    gm.enemy_take_turn()
    time.sleep(2)
gm.game_over = True

# game over logic, just figures out which loading screen to play   #
# everything that starts with gm is coming from the Manager class. #
Ejemplo n.º 13
0
from src.client import execute, show_error, show_message, show_warning
from src.manager import Manager
from src.parser.arg import ArgParser
import colorama

# Initialize Colorama.
colorama.init()

# Get the arguments.
arg_parser = ArgParser(description=None)
args = arg_parser.parse_args()

try:
    # Initialize the manager.
    manager = Manager(args.password, show_message, show_warning)

    # Execute the command.
    execute(manager, args)

except Exception as error:
    show_error(error)
Ejemplo n.º 14
0
from src.manager import Manager

TEMPLATE = '../template.xlsx'
INPUT = '../pages'

if __name__ == '__main__':
    manager = Manager(TEMPLATE, INPUT)
    manager.start()
Ejemplo n.º 15
0
import sys
import signal
import traceback

from src.manager import Manager
from src.backend.util.logger import log

if __name__ != '__main__':
    print('This file is supposed to be ran directly, not be imported!')
    sys.exit()

debug = True

manager = Manager(debug)

# Catch process end signals so we can do our cleanup
signal.signal(signal.SIGINT, manager.stop_signal)
signal.signal(signal.SIGTERM, manager.stop_signal)

try:
    manager.start()

    # keep main thread active
    while manager.active:
        pass
except Exception as e:
    track = traceback.format_exc()
    log.error('MAIN', e)
    print(track)

    manager.stop(True)
Ejemplo n.º 16
0
from src.developer import Developer
from src.employee import Employee
from src.manager import Manager

dev_1 = Developer('Jianwei', 'Zhang', 40000, 'Python')
mgr_1 = Manager('BJ', 'Lee', 100000, [dev_1])
dev_2 = Employee('First', "Last", 10000)

print(isinstance(mgr_1, Employee))