Beispiel #1
0
	def testApp(self, n):
		a = App(0)
		urls = {}
		
		# Shorten n/2 URLS
		for url in range(0, n/2):
			short = a.get_short_url(url)
			assert type(short) == str
			assert short[0] == '0'
			urls[short] = url
	
		# Retrive n/2 long urls from short urls
		for shortUrl in urls.iterkeys():
			assert urls[shortUrl] == a.get_long_url(shortUrl)
			
		# Shorten n/2 URLS
		for url in range(n/2, n):
			short = a.get_short_url(url)
			assert type(short) == str
			assert short[0] == '0'
			urls[short] = url
	
		# Retrive n long urls from short urls
		for shortUrl in urls.iterkeys():
			assert urls[shortUrl] == a.get_long_url(shortUrl)
Beispiel #2
0
 def postUpdate(self):
     State.postUpdate(self)
     if self.finished():
         self.movie.stop()
         App.Screen.fill((255, 0, 0))
         pygame.mixer.init()
         App.switchState(self.nextState())
Beispiel #3
0
def main( *args ):
    pathstr_source = os.path.dirname( __file__ )
    pathstr_conf_d = os.path.join( pathstr_source, 'config.yaml' )
    conf_inst = config.Config.load_yaml( pathstr_conf_d, pathstr_source )

    parser = argparse2.ArgParser2( description='Password Manager' )
    parser.add_argument(
        '-s', '--store', type=argparse2.PathType( canonical=True, check_write=True ),
        default=conf_inst.path_store, help='Store file. Default: %s' % conf_inst.path_store )
    parser.add_argument(
        '-c', '--config', type=argparse2.PathType( canonical=True ),
        default=conf_inst.path_config, help='Configuration file. Default: %s' % conf_inst.path_config )
    parser.add_argument(
        '-i', '--ui', default=conf_inst.ui, choices=conf_inst.ui_choices,
        help='UI to be used. Default: %s' % conf_inst.ui )
    parser.add_argument(
        '-l', '--logging', type=argparse2.LogType(), choices=argparse2.LogType.choices,
        default=conf_inst.logging, help='Logging level. Default: %s' % conf_inst.logging )

    if args:
        args = parser.parse_args( args )
    else:
        args = parser.parse_args()

    conf_inst.update2(
        path_store=args.store,
        path_config=args.config,
        ui=args.ui,
        logging=args.logging )
    conf_inst.load_user_conf()
    conf_inst.save_user_conf()

    App.instance( conf_inst ).run()
Beispiel #4
0
def main():
    client = App()

    while client.running:
        client.run_app()

    client.close()
Beispiel #5
0
 def test_participation_logic(self):
     rep = self._register()
     now = datetime.now()
     participant = StudyParticipant.objects.create(
                             reporter=rep, start_date = now.date(),
                             notification_time=now.time(), state="0",
                             next_question_time=now, next_start_time=now)
     
     app = App("")
     participant = app.update_participant(participant)
     self.assertEqual("1", participant.state)
     date = now + timedelta(hours=1)
     next_date = now + timedelta(days=7)
     self.assertEqual(date, participant.next_question_time)
     self.assertEqual(next_date, participant.next_start_time)
     
     participant = app.update_participant(participant)
     self.assertEqual("2", participant.state)
     date = now + timedelta(days=1)
     self.assertEqual(date, participant.next_question_time)
     self.assertEqual(next_date, participant.next_start_time)
     
     participant = app.update_participant(participant)
     self.assertEqual("3", participant.state)
     date = now + timedelta(days=2)
     self.assertEqual(date, participant.next_question_time)
     self.assertEqual(next_date, participant.next_start_time)
     
     participant = app.update_participant(participant)
     self.assertEqual("0", participant.state)
     self.assertEqual(next_date, participant.next_question_time)
     self.assertEqual(next_date, participant.next_start_time)
Beispiel #6
0
	def stage(self, stage_dir, bundle):
		App.stage(self, stage_dir, bundle=bundle)

		contents = self.get_contents_dir()
		self.env.log(u'Copying kboot to %s' % contents)
		self.executable_path = p.join(self.contents, self.name)
		effess.copy(p.join(self.sdk_dir, 'kboot'), self.executable_path)
Beispiel #7
0
def wsgi_factory():   # pragma: no cover
    morepath.autoscan()

    App.commit()
    setup_db()

    return App()
def main():
    args = docopt(__doc__)

    schema = Schema({
        '--help': bool,
        '--headless': bool,
        '--width': Use(int),
        '--height': Use(int),
        '<save_path>': str,
    })

    try:
        args = schema.validate(args)
    except SchemaError as e:
        exit(e)

    model_path = 'models'

    loadPrcFileData('', 'window-title Babble')
    loadPrcFileData('', 'win-size %d %d' % (args['--width'], args['--height']))
    loadPrcFileData('', 'audio-library-name null') # suppress warning
    loadPrcFileData('', 'model-path %s' % model_path)
    loadPrcFileData('', 'bullet-filter-algorithm groups-mask')

    if args['--headless']:
        loadPrcFileData('', 'window-type none')

    app = App(args)
    app.run()
Beispiel #9
0
class RtAgent(object):
    def __init__(self, conf):
        self.gb = GeneralBase(conf)
        self.app = App(conf)
        self.vod = Vod(conf)
        self.guide = Guide(conf)
        self.cat = Cat(conf)

    def interrupt(self):
        pass

    def accept(self, p, isnew = True):
        if p.get('_type') != 'normal':
            return

        if p.get('_device', '').lower() not in ['a11', 'a21', 'k72', 'k82', 'ud10a', 'ds70a', 'lx750a', 'lx755a', 'lx850a', 'lx960a', 'k91', 's31', 's51', 's61', 'e31', 'e62']:
            return

        if p.get('event') not in ['video_exit', 'app_start', 'launcher_vod_click', 'video_category_out']:
            return

        if isnew:
            if self.gb.run(p):
                self.app.run(p)
                self.vod.run(p)
                self.guide.run(p)
                self.cat.run(p)
        else:
            self.vod.run(p)
Beispiel #10
0
class AppTestCase(unittest.TestCase):
    def setUp(self):
        self.input = MagicMock()
        # swipe somewhere (south):
        self.input.getline = MagicMock(return_value='s')

        self.output = MagicMock()
        self.output.write = MagicMock()

        self.app = App(self.input, self.output)
        self.app.renderer = create_autospec(Renderer)  # type: MagicMock

    def test_runZeroTimesRendersOnce(self):
        self.app.run(max_prompts=0)
        count = len(self.app.renderer.mock_calls)
        self.assertEqual(
            1,
            count,
            "Method render on Renderer should be called one time."
        )

    def test_runOneTimeSwipingSouthRendersTwice(self):
        self.app.run(max_prompts=1)
        count = len(self.app.renderer.mock_calls)
        self.assertEqual(
            2,
            count,
            "Method render on Renderer should be called two times."
        )
Beispiel #11
0
 def test_json_output(self):
   expected_results = {'container_id': 'test',
     'username': '******', 'hostname': 'test001', 'cpu_shares': 100,
     'ram': 100, 'port_list': [], 'host_server': 'test_server', 
     'volumes': ['/mnt/vol/test_vol'], 'ssh_port': 22}
   a = App('test', 'joe_user', 'test001', 100, 100, 'test_server', 22, 
     ['/mnt/vol/test_vol'])
   self.assertEqual(expected_results, a.get_json())
Beispiel #12
0
 def should_ask_for_new_input(self):
     app = App('1,2,3', self.output, self.input)
     self.input.input = "1,2"
     app.getNextUserInput()
     self.assertEqual("another input please", self.output.output[len(self.output.output)-2])
     
     
 
     
Beispiel #13
0
def test_server(port):
    """Start a server to test against"""
    app = App(port=port)
    try:
        thread = threading.Thread(target=app.start)
        thread.daemon = True
        thread.start()
        yield app
    finally:
        app.stop()
Beispiel #14
0
 def loadAPP(app_path):
     app = App(app_path)
     try:
         app.load()
     # except (yaml.scanner.ScannerError, yaml.parser.ParserError) as e:
     except Exception as e:
         print app_path
         print e
     app.shell_path = os.path.basename(os.path.dirname(app_path))
     return app
Beispiel #15
0
def handle_command():
    try:
        command = sys.argv[1]
        if command in ['runserver', 'initdb']:
            if command == 'runserver':
                App.run()
            elif command == 'initdb':
                db_utils.init_db('./schema.sql')
        else:
            print("Command Not Found, Avaliable commands [runserver, initdb]")
    except IndexError:
        print("Available commands are:\n\trunserver\n\tinitdb")
Beispiel #16
0
    def stage(self, stage_dir, bundle, no_install, js_obfuscate):
        App.stage(self, stage_dir, bundle=bundle, no_install=no_install, js_obfuscate=js_obfuscate)

        contents = self.get_contents_dir()
        self.env.log(u'Copying kboot.exe to %s' % contents);
        self.executable_path = p.join(contents, '%s.exe' % self.name)
        effess.copy(p.join(self.sdk_dir, 'kboot.exe'), self.executable_path)

        # The .installed file for Windows should always exist,
        # since we only ever install via the MSI installer.
        open(p.join(contents, '.installed'), 'a').close()

        self.set_executable_icon()
def main():
    model_path = 'models'
    width = 640
    height = 640

    loadPrcFileData('', 'window-title Babble')
    loadPrcFileData('', 'win-size %d %d' % (width, height))
    loadPrcFileData('', 'audio-library-name null') # suppress warning
    loadPrcFileData('', 'model-path %s' % model_path)
    loadPrcFileData('', 'bullet-filter-algorithm groups-mask')

    app = App(width, height)
    app.run()
def main():
    width = 640
    height = 640

    loadPrcFileData('', 'window-title Animate')
    loadPrcFileData('', 'win-size %d %d' % (width, height))
    loadPrcFileData('', 'audio-library-name null') # suppress warning
    loadPrcFileData('', 'model-path %s' % '.')

    model_path = sys.argv[1]
    animation_path = sys.argv[2] if len(sys.argv) > 2 else None

    app = App(width, height, model_path, animation_path)
    app.run()
Beispiel #19
0
def doit(expo=None):
    XPin = 'X1'   # x axis pin - ADC required
    YPin = 'X2'   # y axis pin - ADC required
    for i in range(1,5):
        LED(i).off()
        
    app = App(XPin,YPin,expo) if expo else App(XPin,YPin)

    try:
        app.loop()
    except KeyboardInterrupt:
        print('exiting...')
        return
    except Exception as e:
        print (e)
Beispiel #20
0
 def setUp(self):
     self.app = App()
     with open(input_file) as fp:
         for line in fp.readlines():
             if line.startswith(Pattern.ADD):
                 in_line = line[len(Pattern.ADD):]
                 print self.app.addToFamily(in_line.strip())
Beispiel #21
0
    def __init__(self, id, name=None, watch_daemon=True):
        """
        Create a new lyric source instance. 

        Arguments:

        - `id`: The unique ID of the lyric source plugin. The full bus
          name of the plugin will be `org.osdlyrics.LyricSourcePlugin.id`
        - `name`: (optional) The name of the plugin, which should be properly
          localized. If `name` is missing, the plugin will take `id` as its
          name.
        - `watch_daemon`: Whether to watch daemon bus.
        """
        self._id = id
        self._app = App('LyricSourcePlugin.' + id,
                        watch_daemon=watch_daemon)
        DBusObject.__init__(self,
                            conn=self._app.connection,
                            object_path=LYRIC_SOURCE_PLUGIN_OBJECT_PATH_PREFIX + self._id)
        self._search_count = 0
        self._download_count = 0
        self._search_tasks = {}
        self._download_tasks = {}
        self._name = name if name is not None else id
        self._config = None
Beispiel #22
0
 def apps(self):
     return [
         app for app in App.search(self._client, pagesize=5000)
         if self.SmartGroupID in (
             smart_group['Id'] for smart_group in app.SmartGroups
         )
     ]
Beispiel #23
0
def doit():
    XPin = 'X11'   # x axis pin - ADC required
    YPin = 'X12'   # y axis pin - ADC required
    PPin = 'X10'   # pushbutton pin - external interrupt required
    led = LED(2)   # green LED
    for i in range(1,5):
        LED(i).off()
        
    app = App(XPin,YPin,PPin,led)

    try:
        app.loop()
    except KeyboardInterrupt:
        print('exiting...')
        return
    except Exception as e:
        print (e)
Beispiel #24
0
	def stage(self, stage_dir, bundle, no_install, js_obfuscate):
		if not stage_dir.endswith('.app'):
			stage_dir += '.app'

		App.stage(self, stage_dir, bundle=bundle, no_install=no_install, js_obfuscate=js_obfuscate)

		defaults_exec = "defaults write " + self.id + " WebKitDeveloperExtras -bool true";
		os.system(defaults_exec);

		self.env.log(u'Copying kboot to %s' % self.contents)
		self.executable_path = p.join(self.contents, 'MacOS', self.name)
		effess.copy(p.join(self.sdk_dir, 'kboot'), self.executable_path)

		self.env.log(u'Copying Mac resources to %s' % self.contents)
		# Copy Info.plist to Contents
		plist_file = p.join(self.contents, 'Info.plist')
		effess.copy(p.join(self.sdk_dir, 'Info.plist'), plist_file)
		effess.replace_vars(plist_file, {
			'APPEXE': self.name,
			'APPNAME': self.name,
			'APPICON': 'titanium.icns',
			'APPID': self.id,
			'APPNIB': 'MainMenu',
			'APPVER': self.version,
			'APPVERSHORT': self.version
		})

		lproj_dir = p.join(self.contents, 'Resources', 'English.lproj')
		effess.copy_to_dir(p.join(self.sdk_dir, 'MainMenu.nib'), lproj_dir)

		# If there is an icon defined, create a custom titanium.icns file
		if hasattr(self, 'image'):
			self.env.run([
				p.join(self.sdk_dir, 'makeicns'),
				'-in', p.join(self.contents, 'Resources', self.image),
				'-out', p.join(lproj_dir, 'titanium.icns')
			])
		else:
			effess.copy_to_dir(p.join(self.sdk_dir, 'titanium.icns'), lproj_dir)

		# The installer also needs to have the application icon as well.
		if no_install is False:
			effess.copy_to_dir(p.join(lproj_dir, 'titanium.icns'),
				p.join(self.contents, 'installer',' Installer App.app', 'Contents',
					'Resources', 'English.lproj'))
Beispiel #25
0
def scrape_and_diff(target_urls):
    """
    Create a task that Celery can run to scrape and update all the things.

    """
    # debug, if desired
    logging.debug('Running scraper task...')
    logging.debug('Using config file %s' % offline.celeryconfig.__name__)

    # fire up app, and run the scraper
    app = App()
    task_message = []
    for target_url, target_element in target_urls:
        target_message, target_diff = app.run_scraper(target_url, target_element)
        task_message.append("%s: %s" % (target_url, target_message))

    logging.debug('task complete!')

    return task_message
Beispiel #26
0
def main():
    signal.signal(signal.SIGINT, signal.SIG_DFL)

    aboutData = KAboutData(
        "deveba-kde", # appName
        "", # catalogName
        ki18n("Deveba"), # programName
        "1.0")
    aboutData.setLicense(KAboutData.License_GPL_V3)
    aboutData.setShortDescription(ki18n("Distributed Versionized Backup"))
    aboutData.setCopyrightStatement(ki18n("(c) 2012 Aurélien Gâteau"))
    aboutData.setProgramIconName("kde")

    KCmdLineArgs.init(sys.argv, aboutData)

    KCmdLineArgs.addCmdLineOptions(App.options())

    app = App()
    return app.exec_()
Beispiel #27
0
    def setUp(self):
        self.input = MagicMock()
        # swipe somewhere (south):
        self.input.getline = MagicMock(return_value='s')

        self.output = MagicMock()
        self.output.write = MagicMock()

        self.app = App(self.input, self.output)
        self.app.renderer = create_autospec(Renderer)  # type: MagicMock
Beispiel #28
0
    def test_init_results(self):
        """Make sure _init_results does what is expected"""

        config = Config()
        config.monitors = {
            "http://test/": {},
            "http://test2/": {}
        }

        result = App._init_results(config)

        assert result["http://test/"] is None
        assert result["http://test2/"] is None
Beispiel #29
0
	def stage(self, stage_dir, bundle):
		if not stage_dir.endswith('.app'):
			stage_dir += '.app'

		App.stage(self, stage_dir, bundle=bundle)

		self.env.log(u'Copying kboot to %s' % self.contents)
		effess.copy(p.join(self.sdk_dir, 'kboot'),
			p.join(self.contents, 'MacOS', self.name))

		self.env.log(u'Copying Mac resources to %s' % self.contents)
		# Copy Info.plist to Contents
		plist_file = p.join(self.contents, 'Info.plist')
		effess.copy(p.join(self.sdk_dir, 'Info.plist'), plist_file)
		effess.replace_vars(plist_file, {
			'APPEXE': self.name,
			'APPNAME': self.name,
			'APPICON': 'titanium.icns',
			'APPID': self.id,
			'APPNIB': 'MainMenu',
			'APPVER': self.version
		})

		lproj_dir = p.join(self.contents, 'Resources', 'English.lproj')
		effess.copy_to_dir(p.join(self.sdk_dir, 'MainMenu.nib'), lproj_dir)

		# If there is an icon defined, create a custom titanium.icns file
		if hasattr(self, 'image'):
			self.env.run('"%s" -in "%s" -out "%s"' % (
				p.join(self.sdk_dir, 'makeicns'),
				p.join(self.contents, 'Resources', self.image),
				p.join(lproj_dir, 'titanium.icns')))
		else:
			effess.copy_to_dir(p.join(self.sdk_dir, 'titanium.icns'), lproj_dir)

		# The installer also needs to have the application icon as well.
		effess.copy_to_dir(p.join(lproj_dir, 'titanium.icns'),
			p.join(self.contents, 'installer',' Installer App.app', 'Contents',
				'Resources', 'English.lproj'))
 def test(self):
     app = App()
     if os.environ.get("run") == "all":
         self.failIf(app.multiply(2,3) != 6)
         self.failIf(app.sum(1,1) != 2)
         self.failIf(app.diff(1,1) != 0)
         self.failIf(app.divide(1,1) != 1)
     else:
         self.failIf(app.sum(1,1) != 2)
Beispiel #31
0
#!/usr/bin/env python
#
# Copyright 2018 ip.sx
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

from app import App
from gui import IPSXFrame

if __name__ == "__main__":
    App.register(IPSXFrame).init().run()
Beispiel #32
0
        else:
            exceed_count = 0
            for i, row in datafetch_apis_frame.iterrows():
                datafetch_api_id = row['id']
                write_idle_seconds = row['write_idle_seconds']
                result_frequency_seconds = row['result_frequency_seconds']
                if write_idle_seconds > result_frequency_seconds:
                    exceed_count += 1
                    idle_time_str = Timespan.from_seconds(
                        write_idle_seconds).as_string()
                    warn_message = 'datafetch api id {} has exceeded its {} second limit (idle time {})'.format(
                        datafetch_api_id, result_frequency_seconds,
                        idle_time_str)
                    Log.w(warn_message)
            Log.d('watch check done, exceed count: {}', exceed_count)


if __name__ == '__main__':
    file_dirpath = OsExpert.path_backstep(__file__)
    parent_dirpath = OsExpert.path_backstep(file_dirpath)
    App.initialize_in_dirs(logconfig_dirpath=file_dirpath,
                           appconfig_dirpath=parent_dirpath)
    try:
        WatchApp().watch_continuously(watch_interval_seconds=15)
    except KeyboardInterrupt:
        print('\n\nKeyboardInterrupt\n')
    except Exception as e:
        Log.c('app failed: {}', e)
        stacktrace = OsExpert.stacktrace()
        Log.d('stacktrace:\n{}', stacktrace)
Beispiel #33
0
def account(current_account):
    user = App().mongo.db.user
    result = user.find_one({'name': current_account})
    return render_template('accounts.html', account=result)
Beispiel #34
0
#! /usr/bin/python3

import pygame

from app import App

if __name__ == "__main__":
    pygame.init()
    a = App()
    a.on_mainloop()
    pygame.quit()
Beispiel #35
0
 def test(self):
     app = App()
     app.calculate()
     self.failIf(app.retrieve() != 62)
Beispiel #36
0
 def test8(self):
     app = App()
     app.calculate8()
     self.failIf(app.retrieve8() != 49)
Beispiel #37
0
 def test6(self):
     app = App()
     app.calculate6()
     self.failIf(app.retrieve6() != 120)
Beispiel #38
0
def main():
    # Initialization of the application with settings passed as parameter.
    app = App()
    # Creating the main user interface of the application.
    initialize_interface(app)
from wsgiref.simple_server import make_server
from app import App, Response

app = App()


@app.route('^/$', 'GET')
def hello(request):
    return Response('Hello World')


@app.route('^/user/$', 'POST')
def create_user(request):
    return Response('User Created', status=201)


@app.route('^/user/(?P<name>\w+)$', 'GET')
def user_detail(request, name):
    return Response('Hello {name}'.format(name=name))


if __name__ == '__main__':
    httpd = make_server('', 8000, app)
    httpd.serve_forever()
from app import App

if __name__ == '__main__':
    App()
Beispiel #41
0
 def __init__(self, app):
     self.app = App(app)
Beispiel #42
0
import sys
from PyQt5.QtWidgets import QApplication
from app import App

application = QApplication(sys.argv)
app = App()

app.show()
application.exec_()
Beispiel #43
0
def run_app():
    from app import App
    App().run()
def slm_single_image():
    root.destroy()
    new_root = tk.Tk()
    app = SLM_Single_Image(new_root)
    app.root.mainloop()


root = tk.Tk()
configs = {
    'Window Title': 'Hologram Creator -- ' +
    'Copyright 2019, Luke Kurlandski and Matthew Van Soelen, all rights reserved',
    'Window Width': 300,
    'Window Height': 300
}
chooser = App(root, configs)
tk.Label(chooser.root, text='Select an Experiment').pack()
button_singleimage = tk.Button(chooser.root,
                               text='Single Image',
                               command=single_image)
button_singleimage.pack()

button_slm_image = tk.Button(chooser.root,
                             text='SLM Merge Image',
                             command=slm_image)
button_slm_image.pack(pady=20)

button_slm_image = tk.Button(chooser.root,
                             text='SLM Single Image',
                             command=slm_single_image)
button_slm_image.pack()
Beispiel #45
0
 def test7(self):
     app = App()
     app.calculate7()
     self.failIf(app.retrieve7() != 88)
from bottle import Bottle, run, request, response, static_file
from app import App

bottle_app = Bottle()
dataApp = App()


@bottle_app.hook('before_request')
def strip_path():
    request.environ['PATH_INFO'] = request.environ['PATH_INFO'].rstrip('/')


@bottle_app.hook('after_request')
def enable_cors():
    response.headers['Access-Control-Allow-Origin'] = '*'
    response.headers['Access-Control-Allow-Methods'] = 'GET'
    response.headers[
        'Access-Control-Allow-Headers'] = 'Origin, Accept, Content-Type, X-Requested-With, X-CSRF-Token'


@bottle_app.route('/iss/api')
def server_static(filename='index.html'):
    return static_file(filename, root='.')


@bottle_app.route('/iss/api/swagger.yaml')
def server_swagger_yaml(filename='swagger.yaml'):
    return static_file(filename, root='.')


@bottle_app.route('/iss/api/swagger/<filepath:path>')
Beispiel #47
0
 def test9(self):
     app = App()
     app.calculate9()
     self.failIf(app.retrieve9() != 222)
Beispiel #48
0
import sys; 
sys.path.append('../../src/fetch')
sys.path.append('../../src/python')
from app import App
import unittest
from core import OsExpert
from db import DatabaseGateway

class TestCase(unittest.TestCase):
	def setUp(self):
		self.db = DatabaseGateway()
		pass
	def test_watch_triggers_alert(self):
		raise NotImplementedError()
if __name__ == '__main__':
	parent_dirpath = OsExpert.path_backstep(__file__, backsteps=2) 
	App.initialize_in_dir(parent_dirpath)
	unittest.main()
    
def get_data(url):
    print("Url : {}".format(url))
    app = App(url)
    return app.data()
Beispiel #50
0
from TaxRate import tax_rates
from app import App
import sys


def help_menu():
    print("Help Menu")
    print('-------------')
    print('-h', "\t", 'afficher ce menu')
    print('\n')
    print('Tax Rates')
    print('-------------')
    for key in tax_rates:
        print(key + "\t" + str(tax_rates[key]))


for arg in sys.argv:
    if arg == "-h":
        help_menu()
        exit(0)

App.run()
Beispiel #51
0
def delete(current_account):
    user = App().mongo.db.user
    result = user.find_one({'name': current_account})
    user.delete_one(result)
    return redirect('/login')
Beispiel #52
0
if __name__ == '__main__':
    parser = argparse.ArgumentParser()

    parser.add_argument("num_empires",
                        help="number of empires to have in the simulation",
                        type=int)
    parser.add_argument("size", help="height of the square map", type=int)

    args = parser.parse_args()

    root = Tk()

    grid = Map(args.size)

    app = App(root, grid)

    Empire.APP = app

    names = None
    script_dir = os.path.dirname(__file__)  # <-- absolute dir the script is in
    rel_path = "empire_names.txt"
    abs_file_path = os.path.join(script_dir, rel_path)
    with open(abs_file_path) as f_name:
        names = f_name.read().split("\n")

    num_empires = args.num_empires
    for _ in range(num_empires):
        app.add_empire(Empire(random.choice(names), grid.rand_select()))

    while True:
Beispiel #53
0
from app import App

if __name__ == '__main__':
    App.run(debug=True)
Beispiel #54
0
 def test2(self):
     app = App()
     app.calculate2()
     self.failIf(app.retrieve2() != 61)
Beispiel #55
0
def main():
    App().start()
Beispiel #56
0
 def test3(self):
     app = App()
     app.calculate3()
     self.failIf(app.retrieve3() != 48)
Beispiel #57
0
 def test4(self):
     app = App()
     app.calculate4()
     self.failIf(app.retrieve4() != 29)
Beispiel #58
0
 def test5(self):
     app = App()
     app.calculate5()
     self.failIf(app.retrieve5() != 70)
Beispiel #59
0
 def __init__(self):
     App.__init__(self, "rr", "com.zhongduomei.rrmj.society",
                  ".function.launch.activity.LaunchActivity", 950, 1850)
     self.set_sigin(180, 380)
Beispiel #60
0
import os
import logging
import traceback
import argparse

from app import App

# Set logging level=DEBUG
logging.basicConfig(level=0)

# How to use argparse:
# https://www.pyimagesearch.com/2018/03/12/python-argparse-command-line-arguments/
ap = argparse.ArgumentParser()
ap.add_argument("-f", "--file", required=True, help="Path to video file")
ap.add_argument("-b",
                "--style",
                action='store_true',
                help="ON/OFF blur filter")
args = vars(ap.parse_args())

file_name = os.path.abspath(args['file'])
if not os.path.isfile(file_name):
    raise ValueError('File {} not exists'.format(file_name))

style = args['style']

app = App({"filename": file_name})
app.start()