Esempio n. 1
0
  def test_endtoend(self):
    output_file = None
    try:
      speakers = [
        "Brandon (LordNerevar76)",
        "Andrew (tamantayoshi)",
        "Alex (somedoinks)"
      ]
      curr_dir = os.path.dirname(os.path.realpath(__file__))
      main.run(speakers, curr_dir, "test_transcript.txt")
      output_file = curr_dir + os.path.sep + \
        self._get_filename_starting_with(curr_dir, "smoothed")

      if output_file is None:
        raise Exception("Smoothed file never created")

      expected_output_file = curr_dir + os.path.sep + "test_smoothed.txt"

      self.assertTrue(filecmp.cmp(
        expected_output_file, 
        output_file, 
        shallow=False
      ))
    finally:
      if output_file is not None:
        os.remove(output_file)
Esempio n. 2
0
def test_main_runs_etl(mock_extract, mock_transform, mock_load):
    mock_extract.return_value = None
    mock_transform.return_value = None
    mock_load.return_value = None

    main.run()

    mock_extract.assert_called_once()
    mock_transform.assert_called_once()
    mock_load.assert_called_once()
def lambda_handler(request, context):
    logger.info('Request is ' + json.dumps(request))
    event = Event(event=request)
    try:
        return run(event)
    except Exception as e:
        import traceback
        info = traceback.format_exc()
        logger.error(info)
        return send_server_error(event.req_id())
Esempio n. 4
0
def extract(event, context):
    """Background Cloud Function to be triggered by Pub/Sub.

    Docstrings take from: https://cloud.google.com/functions/docs/calling/pubsub

    :param event: The dictionary with data specific to this type of event.
                  The `data` field contains the PubsubMessage message. The
                  `attributes` field will contain custom attributes if there
                  are any.
    :param context: The Cloud Functions event metadata. The `event_id` field
                    contains the Pub/Sub message ID. The `timestamp` field
                    contains the publish time.
    :return: None
    """
    asyncio.get_event_loop().run_until_complete(main.run())
Esempio n. 5
0
import os

import sentry_sdk
import sys

from sentry_sdk.integrations.aiohttp import AioHttpIntegration

if __name__ == '__main__':
    cmd = sys.argv[1]

    if cmd == 'run':
        SENTRY_HOST = os.getenv("SENTRY_HOST")
        if SENTRY_HOST:
            sentry_sdk.init(SENTRY_HOST, integrations=[AioHttpIntegration()])
        from app.main import run
        run()
Esempio n. 6
0
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import sys
import os
from app import main

if __name__ == '__main__':
    os.chdir((os.path.dirname(os.path.realpath(__file__))))
    sys.exit(main.run())
Esempio n. 7
0
import argparse

from app import main, utils

if __name__ == '__main__':
    parser = argparse.ArgumentParser()
    parser.add_argument('--rows_number', type=int, default=4)
    parser.add_argument('--cols_number', type=int, default=4)
    parser.add_argument('--debug', type=utils.str2bool, default=True)
    args = parser.parse_args()
    main.run(args)
Esempio n. 8
0
def extract(context):
    asyncio.get_event_loop().run_until_complete(main.run())
Esempio n. 9
0
import os
import argparse
from app import main as application

parser = argparse.ArgumentParser(
    description='Command line interface to interact with the application')
parser.add_argument(
    'main_command',
    help='Main command, list: run, createmigrations, or migrate')
parser.add_argument('-m', '--comment', help='Migrations script comment')

args = parser.parse_args()

if __name__ == '__main__':
    try:
        if args.main_command == 'runserver':
            application.run()
        elif args.main_command == 'createmigrations':
            os.system(f'alembic revision --autogenerate -m "{args.comment}"')
        elif args.main_command == 'migrate':
            os.system('alembic upgrade head')
        else:
            raise ValueError('The command must be either run or admin')
    except:
        raise Exception('Cannot run input command')
Esempio n. 10
0
from app import main
import argparse

# Command line parser
parser = argparse.ArgumentParser()

parser.add_argument("--file_path",
                    '-f',
                    required=True,
                    help="File location to log file")
parser.add_argument("--data_type",
                    '-d',
                    required=True,
                    help="Data type of logs")

parser.add_argument("--module",
                    choices=['abuse_c2', 'abuse_ssl', 'abuse_ransomware'])
args = parser.parse_args()

print("[+] Module: {0}".format(args.module))

if __name__ == "__main__":
    main.run(args.file_path, args.data_type, args.module)
Esempio n. 11
0
#!/usr/bin/env python3
import sys
from app import main

if __name__ == "__main__":
    sys.exit(main.run(sys.argv[1:]) or 0)
Esempio n. 12
0
#!/usr/bin/env python
from app import main

main.run(debug=True, host="0.0.0.0")
Esempio n. 13
0
def test_main_foo(foo):
    assert run() == foo
Esempio n. 14
0
import asyncio

from app import main

if __name__ == "__main__":
    asyncio.get_event_loop().run_until_complete(main.run())
Esempio n. 15
0
from app import main as manager

if __name__ == '__main__':
    manager.run()
Esempio n. 16
0
from app.main import run

run()
Esempio n. 17
0
from app import main

import logging
import sys
logging.basicConfig(stream=sys.stdout, level=logging.DEBUG)

if __name__ == "__main__":
    main.run()