コード例 #1
0
    def itemContent(self, attributes='', splitAttribute='', newUsers=None, newObservationData=None, eval=False, similarItem=None):
        newItems = self._items.copy()
        if attributes:
            newItems = self._items[attributes]
        if splitAttribute:
            newItems = self._splitAttribute(newItems, splitAttribute)
        icr = gl.item_content_recommender.create(newItems, 'item_id', self._ratings, 'user_id', target='rating')
        recs = icr.recommend(users=newUsers, new_observation_data=newObservationData, k=10).join(self._items, on='item_id').sort('rank')
        print 'Recomendacoes por conteudo com base completa'
        print(recs)

        if similarItem:
            similarity = icr.get_similar_items(similarItem).join(self._items, on={'similar': 'item_id'}).sort('rank')
            print 'Recomendacoes por item'
            print(similarity)

        if eval:
            icrTrain = gl.item_content_recommender.create(newItems, 'item_id', self._train, 'user_id', target='rating')
            evalPrecisionRecall = icrTrain.evaluate_precision_recall(self._test)
            evalRMSE = icrTrain.evaluate_rmse(self._test, target='rating')
            eval = icrTrain.evaluate(self._test)
            print 'Avaliacao com grupos train e test'
            print(eval)
            print 'Valores de Precision e Recal'
            print(evalPrecisionRecall)
            print 'RMSE'
            print(evalRMSE)

        if newUsers:
            route = Route(recs['latitude'], recs['longitude'], recs['name'])
            route.map(newUsers[0])
コード例 #2
0
ファイル: road.py プロジェクト: rayramsay/roadcast
def make_result(directions_result, departure_time, departure_day):
    """Builds the initial result dictionary for jsonification."""

    result = {}

    # Prepare the directions result.
    directions_prepped = prep_directions(directions_result)

    # Instantiate route object.
    timed_route = Route(directions_prepped, departure_time, departure_day)

    # Make list of coordinates and datetimes.
    coords_time = timed_route.make_coords_time()

    # Get weather info for coords and times.
    marker_info = make_marker_info(coords_time)

    # Make weather report for trip.
    weather_report = make_weather_report(marker_info)

    # Convert datetimes to strings.
    formatted_ct = format_coords_time(coords_time)

    result["markerInfo"] = marker_info
    result["weatherReport"] = weather_report
    result["coordsTime"] = formatted_ct
    result["routeName"] = None

    return result
コード例 #3
0
    def itemSimilarity(self,
                       similarityType='jaccard',
                       newUsers=None,
                       newObservationData=None,
                       eval=False,
                       similarItem=None):
        print(self._ratings.dtype())
        isr = gl.item_similarity_recommender.create(
            self._ratings, target='rating', similarity_type=similarityType)
        recs = isr.recommend(users=newUsers,
                             new_observation_data=newObservationData).join(
                                 self._items, on='item_id').sort('rank')
        print(recs)

        if eval:
            isrTrain = gl.item_similarity_recommender.create(
                self._train, target='rating', similarity_type=similarityType)
            evalPrecisionRecall = isrTrain.evaluate_precision_recall(
                self._test)
            evalRMSE = isrTrain.evaluate_rmse(self._test, target='rating')
            eval = isrTrain.evaluate(self._test)
            print(eval)

        if similarItem:
            similarity = isr.get_similar_items(similarItem).join(
                self._items, on={
                    'similar': 'item_id'
                }).sort('rank')
            print(similarity)

        if newUsers and newObservationData:
            route = Route(recs['latitude'], recs['longitude'])
            route.map()
コード例 #4
0
    def itemSimilarity(self, similarityType='jaccard', newUsers=None, newObservationData=None, eval=False, similarItem=None):
        # print(self._ratings.dtype())
        ratings_without_recommend = self._ratings.filter_by(newUsers, 'user_id', exclude=True)
        isr = gl.recommender.ranking_factorization_recommender.create(ratings_without_recommend, target='rating')
        recs = isr.recommend(users=newUsers, new_observation_data=newObservationData).join(self._items, on='item_id').sort('rank')
        print 'Recomendacoes por similaridade com base completa'
        print(recs)

        if eval:
            print 'Recomendacoes EVAAL'
            # Executa o treinamento e teste com os grupos previamente criados
            isrTrain = gl.recommender.ranking_factorization_recommender.create(self._train, target='rating')
            # Retorna o precision e o recall
            evalPrecisionRecall = isrTrain.evaluate_precision_recall(self._test)
            # Avaliação do erro Root Mean Square Error
            evalRMSE = isrTrain.evaluate_rmse(self._test, target='rating')
            eval = isrTrain.evaluate(self._test)
            print 'Avaliacao com grupos train e test'
            print(eval)
            print 'Valores de Precision e Recal'
            print(evalPrecisionRecall)
            print 'RMSE'
            print(evalRMSE)

        #import pdb; pdb.set_trace()
        # Recomendação feita baseada em item
        if similarItem:
            similarity = isr.get_similar_items(similarItem).join(self._items, on={'similar': 'item_id'}).sort('rank')
            print 'Recomendacoes por item'
            print(similarity)

        # Escreve as rotas para serem utilizadas no web
        if newUsers and newObservationData:
            route = Route(recs['latitude'], recs['longitude'], recs['name'])
            route.map()
コード例 #5
0
ファイル: test_routes.py プロジェクト: rayramsay/roadcast
    def test_Route_pick_middle(self):
        result = Route(prep_directions(DIRECTIONS_RESULT_899), "03:01", "tomorrow")
        coords_time = result.make_coords_time()

        # Check that it has the correct number of coords.
        self.assertEqual(len(coords_time), 3)

        # Check that the correct middle coord was picked.
        self.assertIn((1, 115), coords_time[1])

        # Check that the correct time was paired with the middle coord.
        self.assertEqual(coords_time[0][1].add(seconds=550), coords_time[1][1])
コード例 #6
0
ファイル: test_routes.py プロジェクト: rayramsay/roadcast
    def test_Route_get_interval_size(self):

        # Check for overall duration of one hour (i.e., less than two hours).
        result = Route.get_interval_size(3600)
        self.assertEqual(result, 900)

        # Check for overall duration of three hours (i.e., more than two but less than eight hours).
        result = Route.get_interval_size(10800)
        self.assertEqual(result, 1800)

        # Check for overall duration of nine hours (i.e., more than eight hours).
        result = Route.get_interval_size(32400)
        self.assertEqual(result, 3600)
コード例 #7
0
ファイル: urls.py プロジェクト: spatz0r/SickChill
    def __init__(self, **options):
        self.options = options

        self.urls = [
            url(r'{0}/favicon.ico'.format(self.options['web_root']),
                StaticFileHandler, {
                    "path":
                    ek(os.path.join, self.options['data_root'],
                       'images/ico/favicon.ico')
                },
                name='favicon'),
            url(r'{0}/images/(.*)'.format(self.options['web_root']),
                StaticFileHandler, {
                    "path": ek(os.path.join, self.options['data_root'],
                               'images')
                },
                name='images'),
            url(r'{0}/cache/images/(.*)'.format(self.options['web_root']),
                StaticFileHandler,
                {"path": ek(os.path.join, sickbeard.CACHE_DIR, 'images')},
                name='image_cache'),
            url(r'{0}/css/(.*)'.format(self.options['web_root']),
                StaticFileHandler,
                {"path": ek(os.path.join, self.options['data_root'], 'css')},
                name='css'),
            url(r'{0}/js/(.*)'.format(self.options['web_root']),
                StaticFileHandler,
                {"path": ek(os.path.join, self.options['data_root'], 'js')},
                name='js'),
            url(r'{0}/fonts/(.*)'.format(self.options['web_root']),
                StaticFileHandler,
                {"path": ek(os.path.join, self.options['data_root'], 'fonts')},
                name='fonts'),

            # TODO: WTF is this?
            # url(r'{0}/videos/(.*)'.format(self.options['web_root']), StaticFileHandler,
            #     {"path": self.video_root}, name='videos'),
            url(r'{0}(/?.*)'.format(self.options['api_root']),
                ApiHandler,
                name='api'),
            url(r'{0}/getkey(/?.*)'.format(self.options['web_root']),
                KeyHandler,
                name='get_api_key'),
            url(r'{0}/api/builder'.format(self.options['web_root']),
                RedirectHandler,
                {"url": self.options['web_root'] + '/apibuilder/'},
                name='apibuilder'),
            url(r'{0}/login(/?)'.format(self.options['web_root']),
                LoginHandler,
                name='login'),
            url(r'{0}/logout(/?)'.format(self.options['web_root']),
                LogoutHandler,
                name='logout'),
            url(r'{0}/calendar/?'.format(self.options['web_root']),
                CalendarHandler,
                name='calendar')

            # routes added by @route decorator
            # Plus naked index with missing web_root prefix
        ] + Route.get_routes(self.options['web_root'])
コード例 #8
0
	def __init__(self, altitude_change = False):
		super(BSEnv, self).__init__()
		bs.init("sim-detached")
		#bs.net.connect()
		
		self.initial_number_of_planes = bs.traf.ntraf
		self.update_interval = 25	#[s] time between each timestep from the reinforcement learing model
		self.max_heading = 359 #[º] Max. relative degree heading. Used later to scale the state space.
		self.max_distance = bs.settings.asas_pzr * nm * 5 #[m] Maximum distance between planes that gets passed in the states
													  # Not sure if this has any effect.
		"""
		if altitude_change:
			self.n_actions = 7 #Taking changes of vertical speed as possible actions
		else:
			self.n_actions = 5 #Just horizontal heading changes
		"""

		#self.action_space = np.arange(self.n_actions)	#Vector that will containt the possible options
		self.observation_space = np.array([])	#Vector that will contain the state space.
		self.number_of_planes = 5	#Number of surrounding planes that each agent takes into account when calculating individual states.
		self.time_step = 5	#[s] time between each timestep for the rl model.
		self.agents_id_idx = {bs.traf.id[i]: i for i in range(bs.traf.ntraf)}
		self.routes = {}
		for i in range(bs.traf.ntraf):
			self.routes[bs.traf.id[i]] = Route(np.append(bs.traf.lat[i],bs.traf.ap.route[i].wplat), 
			np.append(bs.traf.lon[i],bs.traf.ap.route[i].wplon),
			np.append(bs.traf.alt[i],bs.traf.ap.route[i].wpalt), bs.traf.id[i])

		self.traffic = None
		self.simulation = None 
		self.screen = None
		self.net = None
コード例 #9
0
	def reset(self, episode):
		tic = time.time()
		print("resetting...")
		bs.sim.reset()
		"""
		if episode%5 == 0:
			bs.sim.reset()
			self.traffic = copy.deepcopy(bs.traf)
			self.simulation = copy.deepcopy(bs.sim)
			self.screen = copy.deepcopy(bs.scr)
			self.net = copy.deepcopy(bs.net)
		else:
			print(bs.sim.simt, self.simulation.simt)
			print(id(bs.sim), id(bs.sim.simt), id(self.simulation), id(self.simulation.simt))
			bs.traf = self.traffic
			bs.sim = self.simulation
			bs.scr = self.screen
			bs.net = self.net
			print(bs.sim.simt)
		"""
		self.agents_id_idx = {bs.traf.id[i]: i for i in range(bs.traf.ntraf)}
		self.routes = {}
		for i in range(bs.traf.ntraf):
			self.routes[bs.traf.id[i]] = Route(np.append(bs.traf.lat[i],bs.traf.ap.route[i].wplat), 
			np.append(bs.traf.lon[i],bs.traf.ap.route[i].wplon),
			np.append(bs.traf.alt[i],bs.traf.ap.route[i].wpalt), bs.traf.id[i])
		#bs.net.connect()
		states = self.calculate_states()
		state = self.calculate_general_state()
		tac = time.time()
		print("Resetting took ",(tac-tic)," seconds")
		return state, states
コード例 #10
0
ファイル: test_routes.py プロジェクト: rayramsay/roadcast
    def test_Route_get_next_coords_time(self):
        result = Route(prep_directions(DIRECTIONS_RESULT_1999), "03:01", "tomorrow")
        coords_time = result.make_coords_time()

        # Check that it has the correct number of coords.
        self.assertEqual(len(coords_time), 4)

        # Check that the correct middle coords were picked.
        self.assertIn((1, 111), coords_time[1])
        self.assertIn((1, 120), coords_time[2])

        # Check that the second datetime is fifteen minutes past the first datetime.
        self.assertEqual(coords_time[0][1].add(minutes=15), coords_time[1][1])

        # Check that that third datetime is fifteen minutes past the second datetime.
        self.assertEqual(coords_time[1][1].add(minutes=15), coords_time[2][1])
コード例 #11
0
    def itemContent(self,
                    attributes='',
                    splitAttribute='',
                    newUsers=None,
                    newObservationData=None,
                    eval=False,
                    similarItem=None):
        newItems = self._items.copy()
        if attributes:
            newItems = self._items[attributes]
        if splitAttribute:
            newItems = self._splitAttribute(newItems, splitAttribute)
        icr = gl.item_content_recommender.create(newItems,
                                                 'item_id',
                                                 self._ratings,
                                                 'user_id',
                                                 target='rating')
        recs = icr.recommend(users=newUsers,
                             new_observation_data=newObservationData).join(
                                 self._items, on='item_id').sort('rank')
        print(recs)

        if similarItem:
            similarity = icr.get_similar_items(similarItem).join(
                self._items, on={
                    'similar': 'item_id'
                }).sort('rank')
            print(similarity)

        if eval:
            icrTrain = gl.item_content_recommender.create(newItems,
                                                          'item_id',
                                                          self._train,
                                                          'user_id',
                                                          target='rating')
            evalPrecisionRecall = icrTrain.evaluate_precision_recall(
                self._test)
            evalRMSE = icrTrain.evaluate_rmse(self._test, target='rating')
            eval = icrTrain.evaluate(self._test)
            print(eval)

        if newUsers and newObservationData:
            route = Route(recs['latitude'], recs['longitude'])
            route.map()
コード例 #12
0
def init_plugin():

    # Addtional initilisation code
    global actor, routes, number_of_planes
    actor = Actor(18, 1)
    load_model(actor)
    routes = {
        bs.traf.id[i]:
        Route(np.append(bs.traf.lat[i], bs.traf.ap.route[i].wplat),
              np.append(bs.traf.lon[i], bs.traf.ap.route[i].wplon),
              np.append(bs.traf.alt[i], bs.traf.ap.route[i].wpalt),
              bs.traf.id[i])
        for i in range(bs.traf.ntraf)
    }
    number_of_planes = 5
    # Configuration parameters
    config = {
        # The name of your plugin
        'plugin_name': 'TEST_MODELS',

        # The type of this plugin. For now, only simulation plugins are possible.
        'plugin_type': 'sim',

        # Update interval in seconds. By default, your plugin's update function(s)
        # are called every timestep of the simulation. If your plugin needs less
        # frequent updates provide an update interval.
        'update_interval': 5.0,
        'update': update,
        'preupdate': preupdate,

        # If your plugin has a state, you will probably need a reset function to
        # clear the state in between simulations.
        'reset': reset
    }

    stackfunctions = {

        # The command name for your function
        'MLSTEP': [
            # A short usage string. This will be printed if you type HELP <name> in the BlueSky console
            'MLSTEP',

            # A list of the argument types your function accepts. For a description of this, see ...
            '',

            # The name of your function in this plugin
            mlstep,

            # a longer help text of your function.
            'Simulate one MLCONTROL time interval.'
        ]
    }

    # init_plugin() should always return these two dicts.
    return config, stackfunctions
コード例 #13
0
    def is_completed(self, owned_routes: List[Route]) -> List[Route]:
        # Are both of the cities actually in the set?
        has_city0 = any([r.has_city(self.cities[0]) for r in owned_routes])
        has_city1 = any([r.has_city(self.cities[1]) for r in owned_routes])

        if not (has_city0 and has_city1):
            return False

        return self.search(
            path=[Route([self.cities[0], self.cities[0]], None)],
            visited=[],
            goal=self.cities[1],
            routes_to_check=owned_routes)
コード例 #14
0
ファイル: test_routes.py プロジェクト: rayramsay/roadcast
    def test_Route_slice_step(self):
        result = Route.slice_step(prep_directions(DIRECTIONS_RESULT_1999)["steps"][1], 0.1)

        # Check that the new duration is correct.
        self.assertEqual(result["duration"]["value"], 900)

        # Check that the correct number of paths are left.
        self.assertEqual(len(result["path"]), 9)

        # Check that the slice was made at the correct point.
        self.assertEqual(result["path"][0], {u'lat': 1, u'lng': 112})

        # Check that it still has the end location.
        self.assertEqual(result["end_location"], prep_directions(DIRECTIONS_RESULT_1999)["steps"][1]["end_location"])
コード例 #15
0
ファイル: test_routes.py プロジェクト: rayramsay/roadcast
    def test_Route_format_time(self):
        result = Route.format_time((37.7886794, -122.4115369), "21:01", "tomorrow")

        # Check that it's an instance of a Pendulum object.
        self.assertIsInstance(result, pendulum.pendulum.Pendulum)

        # Check that it has the correct timezone.
        self.assertTrue(result.timezone_name, 'America/Los_Angeles')

        # Check that departure_day (``tomorrow``) has been set correctly.
        self.assertTrue(result.is_tomorrow())

        # Check that it has the correct hour and minutes.
        self.assertEqual(result.hour, 21)
        self.assertEqual(result.minute, 1)
コード例 #16
0
def main():
	# Route dictionary: key = route color, val = num buses on route
	rdict = {'blue': 2, 'green': 4, 'red': 5}

	# Initialize date dict and get current date
	ddict = {}
	now = datetime.today()

	# Associate appropriate route info with each date for next 10 days
	for i in range(10):
	    d = now+timedelta(days = i)
	    d = d.strftime("%B/%d/%Y")
	    ddict[d] = {}
	    for color, num in rdict.items():
	        ddict[d][color] = Route(color, num)

	# Initialize seller
	s = Seller(ddict)
	c = Control(s)
	c.control()
コード例 #17
0
ファイル: web.py プロジェクト: zgh-yuanshang/python-flask-mvc
from routes import Route

Route.get('/', 'IndexController@index')
Route.get('/test', 'IndexController@test')
コード例 #18
0
ファイル: server_settings.py プロジェクト: spatz0r/SickChill
    def __init__(self, options=None):
        threading.Thread.__init__(self)
        self.daemon = True
        self.alive = True
        self.name = "TORNADO"
        self.io_loop = IOLoop.current()

        self.options = options or {}
        self.options.setdefault('port', 8081)
        self.options.setdefault('host', '0.0.0.0')
        self.options.setdefault('log_dir', None)
        self.options.setdefault('username', '')
        self.options.setdefault('password', '')
        self.options.setdefault('web_root', '/')

        assert isinstance(self.options['port'], int)
        assert 'data_root' in self.options

        self.server = None

        # video root
        if sickbeard.ROOT_DIRS:
            root_dirs = sickbeard.ROOT_DIRS.split('|')
            self.video_root = root_dirs[int(root_dirs[0]) + 1]
        else:
            self.video_root = None

        # web root
        if self.options['web_root']:
            sickbeard.WEB_ROOT = self.options['web_root'] = (
                '/' + self.options['web_root'].lstrip('/').strip('/'))

        # api root
        if not sickbeard.API_KEY:
            sickbeard.API_KEY = generateApiKey()
        self.options['api_root'] = r'{0}/api/{1}'.format(
            sickbeard.WEB_ROOT, sickbeard.API_KEY)

        # tornado setup
        self.enable_https = self.options['enable_https']
        self.https_cert = self.options['https_cert']
        self.https_key = self.options['https_key']

        if self.enable_https:
            # If either the HTTPS certificate or key do not exist, make some self-signed ones.
            if not (self.https_cert
                    and ek(os.path.exists, self.https_cert)) or not (
                        self.https_key and ek(os.path.exists, self.https_key)):
                if not create_https_certificates(self.https_cert,
                                                 self.https_key):
                    logger.log(
                        "Unable to create CERT/KEY files, disabling HTTPS")
                    sickbeard.ENABLE_HTTPS = False
                    self.enable_https = False

            if not (ek(os.path.exists, self.https_cert)
                    and ek(os.path.exists, self.https_key)):
                logger.log(
                    "Disabled HTTPS because of missing CERT and KEY files",
                    logger.WARNING)
                sickbeard.ENABLE_HTTPS = False
                self.enable_https = False

        # Load the app
        self.app = Application(
            [],
            debug=
            False,  # enables autoreload, compiled_template_cache, static_hash_cache, serve_traceback - This fixes the 404 page and fixes autoreload for
            #  devs. We could now update without restart possibly if we check DB version hasnt changed!
            autoreload=False,
            gzip=sickbeard.WEB_USE_GZIP,
            cookie_secret=sickbeard.WEB_COOKIE_SECRET,
            login_url='{0}/login/'.format(self.options['web_root']),
            static_path=self.options['data_root'],
            static_url_prefix='{0}/'.format(self.options['web_root'])
            # default_handler_class=Custom404Handler
        )

        # Static File Handlers
        self.app.add_handlers(
            ".*$",
            [
                url(r'{0}/favicon.ico'.format(self.options['web_root']),
                    StaticFileHandler, {
                        "path":
                        ek(os.path.join, self.options['data_root'],
                           'images/ico/favicon.ico')
                    },
                    name='favicon'),
                url(r'{0}/images/(.*)'.format(self.options['web_root']),
                    StaticFileHandler, {
                        "path":
                        ek(os.path.join, self.options['data_root'], 'images')
                    },
                    name='images'),
                url(r'{0}/cache/images/(.*)'.format(self.options['web_root']),
                    StaticFileHandler,
                    {"path": ek(os.path.join, sickbeard.CACHE_DIR, 'images')},
                    name='image_cache'),
                url(r'{0}/css/(.*)'.format(self.options['web_root']),
                    StaticFileHandler, {
                        "path": ek(os.path.join, self.options['data_root'],
                                   'css')
                    },
                    name='css'),
                url(r'{0}/js/(.*)'.format(self.options['web_root']),
                    StaticFileHandler, {
                        "path": ek(os.path.join, self.options['data_root'],
                                   'js')
                    },
                    name='js'),
                url(r'{0}/fonts/(.*)'.format(self.options['web_root']),
                    StaticFileHandler, {
                        "path":
                        ek(os.path.join, self.options['data_root'], 'fonts')
                    },
                    name='fonts')

                # TODO: WTF is this?
                # url(r'{0}/videos/(.*)'.format(self.options['web_root']), StaticFileHandler,
                #     {"path": self.video_root}, name='videos')
            ])

        # Main Handlers
        self.app.add_handlers(
            '.*$',
            [
                url(r'{0}(/?.*)'.format(self.options['api_root']),
                    ApiHandler,
                    name='api'),
                url(r'{0}/getkey(/?.*)'.format(self.options['web_root']),
                    KeyHandler,
                    name='get_api_key'),
                url(r'{0}/api/builder'.format(self.options['web_root']),
                    RedirectHandler,
                    {"url": self.options['web_root'] + '/apibuilder/'},
                    name='apibuilder'),
                url(r'{0}/login(/?)'.format(self.options['web_root']),
                    LoginHandler,
                    name='login'),
                url(r'{0}/logout(/?)'.format(self.options['web_root']),
                    LogoutHandler,
                    name='logout'),
                url(r'{0}/calendar/?'.format(self.options['web_root']),
                    CalendarHandler,
                    name='calendar'),

                # routes added by @route decorator
                # Plus naked index with missing web_root prefix
            ] + Route.get_routes(self.options['web_root']))
コード例 #19
0
 def get_cheapest_route(self) -> Route:
     return Route(min(self.all_routes, key=lambda route: route['price']))
コード例 #20
0
def print_end():
    print(
        "\n\n*****************************\n",
        "\tYOU DIED :(\n",
        "*****************************\n",
    )
    return


if __name__ == "__main__":
    #
    # Main
    #
    # starting the world map up and getting all of the routes for movement set up.
    world_map = Route()
    room = world_map.room

    # init a main character and have them start outside
    mainoc = Player(room["outside"], "Generic Playername")
    bag = PlayerBag(20, mainoc)

    # tring to make dry code since i know im going to need this
    # everytime i change a room
    def print_room():
        print("{} is in room {}, {}\n\n".format(mainoc.name, mainoc.room.name,
                                                mainoc.room.description))
        return

    # add a weapon
    great_sword = Weapon(10000.00)
コード例 #21
0
def init_app(config):
    app = web.Application()
    Route.init_routes(app)
    return app
コード例 #22
0
ファイル: app.py プロジェクト: joberthrogers18/FSE_2021
from flask import Flask
from flask_cors import CORS
from flask_socketio import SocketIO
from routes import Route
import logging

app = Flask(__name__)
app.config['SECRET_KEY'] = 'secret_pi2!'
socketio = SocketIO(app,
                    cors_allowed_origins="*",
                    max_queue=None,
                    max_size=None,
                    ping_timeout=5,
                    ping_interval=10)
routes_inst = Route(app, socketio)
logging.basicConfig(level=logging.DEBUG)

cors = CORS(app, resources={r"*": {"origins": "*"}})
routes_inst.routes()

if __name__ == '__main__':
    socketio.run(app, debug=True, host='0.0.0.0', port=3333)
コード例 #23
0
ファイル: test_routes.py プロジェクト: rayramsay/roadcast
    def test_Route_make_coords_time(self):
        result = Route(prep_directions(DIRECTIONS_RESULT_899), "03:01", "tomorrow")
        coords_time = result.make_coords_time()

        # Check that the ending location coords are in coords_time.
        self.assertIn((1, 129), coords_time[-1])