Exemplo n.º 1
0
def main():
    print("Starting Viber webhook...")
    if len(sys.argv) > 1:
        appConfig = config.load(sys.argv[1])
    else:
        appConfig = config.load('config.yml')

    vw = ViberWebhook(appConfig)
    vw.Run()
def read_configuration():
    """This function will read the complete configuration file"""
    logger = get_logger()
    try:
        cfg = config.load(CONFIG_FILE)
        return cfg
    except Exception as e:
        logger.error("Not able to parse the configuration file: %s", e)
Exemplo n.º 3
0
def test_show_grid():
    class DummyGrid:
        def set_data(self, data):
            pass

    cfg = config.load("config.yaml")
    allow(grid).init_and_play_board.and_return(None)
    grid.show_grid(cfg)
Exemplo n.º 4
0
def main():
    """
    Get configs and invoke view.
    """
    cfg = config.load("config.yaml")
    size = cfg.getProperty("grid.size")
    cells = cfg.getProperty("grid.initial_cells")
    print(f"Initializing grid of size {size} with {cells} cells")
    grid.show_grid(cfg)
    input("Press Enter to continue...")
Exemplo n.º 5
0
 def testFacebookPub(self):
     try:
         appConfig = config.load('config.test.yml')
         pub = FacebookPub(appConfig, 'fb_db.json')
         src = ElektrodistribucijaSrc(
             appConfig,
             'http://www.elektrovojvodina.rs/sl/mediji/ED-Zrenjanin123')
         msgs = src.AcquireMessages()
         for msg in msgs:
             txt = pub.FormatMessage(msg.message)
             self.assertTrue(
                 type(txt).__name__ == 'str'
                 or type(txt).__name__ == 'unicode')
     except:
         self.assertTrue(False)
Exemplo n.º 6
0
import config_with_yaml as config
import requests
cfg = config.load("config.yml")

BACKEND_IP = "%s:%s" % (cfg.getProperty("backend.ip"),
                        cfg.getProperty("backend.service.port"))

reqs = requests.get("http://" + BACKEND_IP + "/movility/stops/").json()

for req in reqs:
    requests.delete("http://" + BACKEND_IP + "/movility/stops/%i" % req["id"])
    print("virtual stop %i: DELETED" % req["id"])
Exemplo n.º 7
0
            cprint.ok("\t\t  Mom found")
            cprint.ok(str(self.mom_coords))
            #[xmin, ymin, xmax, ymax] = self.mom_coords
            #cv2.rectangle(img2show, (xmin, ymax), (xmax, ymin), (0,255,0), 5)
        else:
            cprint.warn("\t\t  Looking for mom...")

        return img2show


signal.signal(signal.SIGINT, signal.SIG_DFL)

if __name__ == '__main__':

    if len(sys.argv) > 1:
        cfg = config.load(sys.argv[1])
    else:
        cfg = config.load("follow_person.yml")

    camera_id = int(cfg.getPropertyWithDefault("Camera", 0))

    network_model = cfg.getPropertyWithDefault(
        "Network.Model", 'ssdlite_mobilenet_v2_coco_2018_05_09_trt.pb')
    siamese_model = cfg.getPropertyWithDefault("Network.SiameseModel",
                                               'siamese_model.pb')
    mom_path = cfg.getPropertyWithDefault('Mom.ImagePath',
                                          'mom_img/sample_img.jpg')

    # # The camera does not need a dedicated thread, the callbacks have their owns.
    cam = Camera(camera_id)
    network = TrackingNetwork(network_model)
Exemplo n.º 8
0
# CMD line option to feed in YAML configuration file
global args
parser = argparse.ArgumentParser(description="Preprocessing script")
parser.add_argument("-c",
                    "--config_file",
                    dest="config_file",
                    default='config/config.yml',
                    help="Path to YAML configuration file")
args = parser.parse_args()

# Path to configuration file
cfg_file = args.config_file

#load in config file
cfg = config.load(cfg_file)

# Grab path to requested files of requested file extension
data_dir = cfg.getPropertyWithDefault("data_file_path", "data")
file_ext = cfg.getProperty("file_type")

# Grab list of files
data_files = glob.glob(os.path.join(data_dir, "*." + file_ext))
num_files = len(list(data_files))

# Grab output filtered file name
filtered_fname = cfg.getPropertyWithDefault("filtered_fname",
                                            "filtered_example.csv")

if __name__ == "__main__":
    #language detection experiments
Exemplo n.º 9
0
# -*- coding: utf-8 -*-
__author__ = 'aitormf'

import sys

import config_with_yaml as config

cfg = config.load(sys.argv[1])

print (cfg.getProperty("Demo.Motors.Server"))
print (cfg.getPropertyWithDefault("Demo.Motors.Server2", "Server2"))
print (cfg)

Exemplo n.º 10
0
from publishers.FacebookPubMod import FacebookPub
from publishers.TelegramPubMod import TelegramPub
from publishers.ViberPubMod import ViberPub
from sources.ElektrodistribucijaMod import ElektrodistribucijaSrc
from sources.FileInputMod import FileInputSrc
import config_with_yaml as config
import sys

def PublishMessage(entry, publisher):
    publisher.Publish(entry)

if len(sys.argv) > 1:
    appConfig = config.load(sys.argv[1])
else:
    appConfig = config.load('config.yml')

allPublishers = []
if len(appConfig.getPropertyWithDefault('Publishers.Facebook', '')) > 0:
    allPublishers.append(FacebookPub(appConfig, 'fb_db.json'))
    
if len(appConfig.getPropertyWithDefault('Publishers.Telegram', '')) > 0:
    allPublishers.append(TelegramPub(appConfig, 'tg_db.json'))
    
if len(appConfig.getPropertyWithDefault('Publishers.Viber', '')) > 0:
    allPublishers.append(ViberPub(appConfig, 'vb_db.json'))

allSources = []
allSources.append(ElektrodistribucijaSrc(appConfig, 'http://www.elektrovojvodina.rs/sl/mediji/ED-Zrenjanin123'))
allSources.append(FileInputSrc(appConfig))
Exemplo n.º 11
0
# https://github.com/RoboticsLabURJC/2017-tfg-nacho_condes

import sys
import signal

import config_with_yaml as config

from camera.camera import Camera
from networks import TrackingNetwork
import cv2
import numpy as np
from datetime import datetime

if __name__ == '__main__':
    if len(sys.argv) > 1:
        cfg = config.load(sys.argv[1])
    else:
        cfg = config.load("person_detector.yml")

    camera_id = int(cfg.getPropertyWithDefault("Camera", 0))

    network_model = cfg.getPropertyWithDefault(
        "Network.Model", 'ssdlite_mobilenet_v2_coco_2018_05_09_trt.pb')

    # # The camera does not need a dedicated thread, the callbacks have their owns.
    cam = Camera(camera_id)
    network = TrackingNetwork(network_model)
    network.setCamera(cam)
    display_imgs = True

    while True: