def login(sno, spw, do): # 实现登录的代码 try: login_session = requests.session() # 需要一个登录的session,后期的操作都基于这个session get_text = login_session.get("http://210.30.208.126/", headers=headers_user_agent()) now_url = get_text.url[:49] get_soup, _ = return_soup(get_text) send_data = set_data(sno, spw, get_soup.find('input').get('value'), "学生", now_url, login_session) send_header = set_header(now_url) login_info = login_session.post(now_url + "default2.aspx", data=send_data, headers=send_header) login_soup, login_text = return_soup(login_info) login_success, err_info = jud_login(login_text) if login_success: # 当登录成功了进入路由,根据do进行进行下一步操作 return json.dumps(route(do, Student(sno, spw), login_session, now_url, login_soup, send_header, True, ""), ensure_ascii=False) else: # 若是错误为验证码不对,则重复这个函数,反之返回登录失败的json if err_info == "验证码不正确": return login(sno, spw, do) else: return json.dumps(route(do, Student("", ""), "", "", "", "", False, err_info), ensure_ascii=False) except Exception as err_info: return json.dumps(route(do, Student("", ""), "", "", "", "", False, str(err_info)), ensure_ascii=False)
def add_route(self, design, layers, coordinates): """Connects a routing path on given layer,coordinates,width. The layers are the (horizontal, via, vertical). add_wire assumes preferred direction routing whereas this includes layers in the coordinates. """ import route debug.info(4, "add route " + str(layers) + " " + str(coordinates)) # add an instance of our path that breaks down into rectangles and contacts route.route(obj=self, layer_stack=layers, path=coordinates)
def makePath_old(self, name, A, Z): assert(name not in self.path) node_A = self.query(A) node_Z = self.query(Z) first_route = route.route(data={'topo':self, 'nodeA':A}) if node_A==node_Z: return first_route potential_routes = [first_route] bestcost = 10000 bestroute = None while(len(potential_routes)>0): this_route = potential_routes[0] # whose cost is least if this_route.cost > bestcost: break if this_route.getZ() == Z: bestcost = this_route.cost bestroute = this_route potential_routes.extend(this_route.grow_old()) deleted_route = potential_routes.pop(0) deleted_route.destruct() del deleted_route potential_routes = sorted(potential_routes, key=lambda route:route.cost) if bestroute==None: return 1 self.path[name] = bestroute return 0
def index(): if request.method == 'POST': form = InputForm() post = Post(location=form.location.data, spot=form.spot.data) db.session.add(post) db.session.commit() flash(f'Your search is being actioned!', 'success') dog = doggo() location = Post.query.filter_by( location=form.location.data).first().location spot = Post.query.filter_by(spot=form.spot.data).first().spot distance, duration = route(location, spot) waves = swell(spot) pub = pub_parser(spot) return render_template('index.html', form=form, dog=dog, distance=distance, duration=duration, waves=waves, spot=spot, pub=pub, location=location) elif request.method == 'GET': form = InputForm() return render_template('index.html', form=form)
def test(function, filename=None): """ If filename has been provided, run queries in the file. Otherwise generate queries using function, and run them. """ cases = [] if filename is not None: with open(filename, newline='') as testfile: reader = csv.DictReader(filter(lambda rw: rw[0] != '#', testfile)) for row in reader: if row: # ignore blank lines. cases.append((row["PackageID"], row["From"], row["To"])) else: cases = function() for pid, stop1, stop2 in cases: # run shortest path to confirm that a path does exist. path = route.route(G, pid, stop1, stop2) if path is None: pass # dprint("path from %s to %s does not exist\n", (stop1, stop2)) else: # dprint(str(path), None) pass
def handle_request(self, msg) -> Response: # recieve all data from client request: Request = parse.parse_request(msg) if not request: return None logger.Logger.add_row(msg, self.client_address, request) response: Response = route.route(request) return response
def route_show(cmd, *args, **argv): """ """ context = argv["context"] """ from _route_auxiliary import getroute as show_route route_date = show_route() from _prettytable import PrettyTable route_t = PrettyTable(["Destination", "Gateway", "Genmask", "Flags", "Metric", "Ref", "Use", "Iface"]) for route_r in route_date: if route_r[0] == "0.0.0.0": route_r[0] = "default" if route_r[1] == "0.0.0.0": route_r[1] = "*" route_t.add_row(route_r) context.write("%s" % route_t) """ from route import route route("route", context=context)
def list(): sentence = request.form['search'] #print(sentence) sentence = sentence.lower() print(sentence) v = find(sentence) v = str(v) print(v) r = route(v) return render_template('list.html', r=r)
def add_route(self, routex): # not using this anymore. move to routes or points if (self.valid_order_routes.__contains__(routex)): print('already exists') if self.valid_order_routes: print('last value in list is', self.valid_order_routes[-1]) last_route = self.valid_order_routes[-1] if routex['start_xy'] != last_route['end_xy']: print('cant add it wont add it') else: self.valid_order_routes.append(routex) self.ordered_routes.append( route(pygame, screen, routex['routeName'], routex['start_xy'], routex['end_xy'])) else: self.valid_order_routes.append(routex) self.ordered_routes.append( route(pygame, screen, routex['routeName'], routex['start_xy'], routex['end_xy']))
def routing(request): form = RouteRequestForm(request.GET) if form.is_valid(): start_id = form.cleaned_data["start_id"] dest_id = form.cleaned_data["dest_id"] start_stop = bus_stop.objects.get(id=start_id) dest_stop = bus_stop.objects.get(id=dest_id) routing_result = route.route(start_stop, dest_stop) print routing_result return HttpResponse( form.cleaned_data["callback"] + "(" + json.dumps({"result": routing_result}) + ")", mimetype="text/json" ) return HttpResponse(form.cleaned_data["callback"] + "(" + json.dumps({"result": []}) + ")", mimetype="append/json")
def do_POST(self): content_len = int(self.headers.getheader('content-length', 0)) post_body = self.rfile.read(content_len) post_data = json.loads(post_body) rawStart = post_data.get(INPUT_START_FIELD) rawDests = post_data.get(INPUT_DESTINATION_FIELD) start = (float(rawStart.get("lat")), float(rawStart.get("long"))) destinations = [formatIO.Destination(dest.get("lat"), dest.get("long"), dest.get("id")) for dest in rawDests] order = route.route(start, destinations) out = [destination.id for destination in order] self.wfile.write(json.dumps(out))
def get_routes_from_file(self): with open(self.ROUTES_FILE, 'r') as fl: for data in fl: if len(data) > 1: data = data.replace('\n', '') split = data.split('|') group_name = split[0] if group_name not in self.groups.iterkeys(): self.groups[group_name] = (group( group_name, self.COOKIE_ROOT)) new_route = route(group_name, data, self.short) self.groups[group_name].routes.append(new_route)
def extract_route_metadata(route_number, route_dictionary, starting_location, end_location): new_route = route( route_number, route_dictionary['metadata']['name'].replace(",", "").encode('utf-8'), route_dictionary['metadata']['length'], # length in meters route_dictionary['metadata'] ['elevation_gain'], # elevation gain in meters route_dictionary['metadata']['route_type'], route_dictionary['metadata']['sub_type'], route_dictionary['route']['preferences']['popularity'], starting_location, end_location) return new_route
def routing(request): form = RouteRequestForm(request.GET) if form.is_valid(): start_id = form.cleaned_data['start_id'] dest_id = form.cleaned_data['dest_id'] start_stop = bus_stop.objects.get(id=start_id) dest_stop = bus_stop.objects.get(id=dest_id) routing_result = route.route(start_stop, dest_stop) print routing_result return HttpResponse(form.cleaned_data['callback'] + '(' + json.dumps({'result': routing_result}) + ')', mimetype='text/json') return HttpResponse(form.cleaned_data['callback'] + '(' + json.dumps({'result': []}) + ')', mimetype='append/json')
def add_route(self, layers, coordinates): """Connects a routing path on given layer,coordinates,width. The layers are the (horizontal, via, vertical). add_wire assumes preferred direction routing whereas this includes layers in the coordinates. """ import route debug.info(3, "add route " + str(layers) + " " + str(coordinates)) # add an instance of our path that breaks down into rectangles and contacts route = route.route(layer_stack=layers, path=coordinates) self.add_mod(route) self.add_inst(name=route.name, mod=route) # We don't model the logical connectivity of wires/paths self.connect_inst([]) return route
def run_sim(dat, n_hop, max_con, avg_con, n_sat, perimiter_only): current_file_path = Path(__file__).resolve() code_source_path = str(current_file_path.parents[0]) # Create directory for sim results results_path = f'{code_source_path}/results/{dat}' data_path = f'{results_path}/{dat}_data.csv' try: os.mkdir(results_path) except: pass print('________ ' + datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S') + ' ________') print(data_name) # initialize node positions pos_table = [] for i in range(n_sat): pos_table.append( [random.uniform(-1, 1) * 50, random.uniform(-1, 1) * 50]) # Provision at every time step. Returns results from routing time steps distable_linkdicts = provision(pos_table, nbr_hop=n_hop, max_conn=max_con, avg_conn=avg_con) # print links and distance table print_txt(distable_linkdicts, pos_table, results_path) # Perform routing route_data = route(n_node=n_sat, nbrhood_hop=n_hop, border=perimiter_only, linkdict=distable_linkdicts[1], distable=distable_linkdicts[0], results_path=results_path) # Write routing results to csv np_data = pd.DataFrame(route_data).T # initialize pd dataframe np_data.columns = ['n_node', 'n_hop', 'total', 'bad', 'loop', 'no_path'] np_data.to_csv(data_path, index=False) return
def test_switch_paths(self): path_a = [] pygame = None screen = None path_a.append( route(pygame, screen, route_set_2.route0['routeName'], route_set_2.route0['start_xy'], route_set_2.route0['end_xy'])) path_a.append( route(pygame, screen, route_set_2.route1['routeName'], route_set_2.route1['start_xy'], route_set_2.route1['end_xy'])) path_a.append( route(pygame, screen, route_set_2.route2['routeName'], route_set_2.route2['start_xy'], route_set_2.route2['end_xy'])) path_b = [] path_b.append( route(pygame, screen, route_set_3.route0['routeName'], route_set_3.route0['start_xy'], route_set_3.route0['end_xy'])) path_b.append( route(pygame, screen, route_set_3.route1['routeName'], route_set_3.route1['start_xy'], route_set_3.route1['end_xy'])) path_b.append( route(pygame, screen, route_set_3.route2['routeName'], route_set_3.route2['start_xy'], route_set_3.route2['end_xy'])) point1 = point() point1.add_paths(path_a) point1.add_paths(path_b) active_path = point1.get_active_path() # active route is the first route added self.assertEquals('route2', active_path[0].get_route_name()) # active route is now the second route added next_active_path = point1.switch_path() self.assertEquals('route3', next_active_path[0].get_route_name())
def send_pkt(): time.sleep(0.1) sys.stdout.flush() tokens = raw_input("What do you want to send: ").split() key = int(tokens[1]) if tokens[0] == "get": chain = route.get_chain(key) tail = "s" + str(chain[2]) ports = route.route(hostname, tail)[1:] + route.route(tail, hostname) p = NetChain(dest=chain[2], key=key) / ports sendp(p, iface="eth0") elif tokens[0] == "put": chain = route.get_chain(key) switches = ["s" + str(switch) for switch in chain] ports = route.route(hostname, switches[0])[1:] ports += route.route(switches[0], switches[1]) ports += route.route(switches[1], switches[2]) ports += route.route(switches[2], hostname) p = NetChain(mtype=1, dest=chain[0], key=key, value=int( tokens[2])) / ports sendp(p, iface="eth0") else: print("invalid input") send_pkt()
from response import Response from server import Server from route import route def hello_world(request): response = requests.get('http://worldclockapi.com/api/json/est/now') return Response(body=response.json()) def test_user(request): return Response( body={ 'username': '******', 'email': '*****@*****.**', 'location': 'The Dalles, Oregon' }) routes = [ route('/', hello_world), route('/user', test_user), ] if __name__ == '__main__': print('Initializing the server...') server_address = ('localhost', 8000) s = Server(server_address, routes) print(f'Duke running @ {server_address[0]}:{server_address[1]}...') s.run()
def test_traverse_paths_in_points_two_levels(self): pygame = None screen = None path_f = [] path_f.append(route(pygame, screen, route_set_6.route0['routeName'], route_set_6.route0['start_xy'], route_set_6.route0['end_xy'])) path_f.append(route(pygame, screen, route_set_6.route1['routeName'], route_set_6.route1['start_xy'], route_set_6.route1['end_xy'])) path_f.append(route(pygame, screen, route_set_6.route2['routeName'], route_set_6.route2['start_xy'], route_set_6.route2['end_xy'])) point3 = point() point3.add_paths(path_f) path_c = [] path_c.append(route(pygame, screen, route_set_4.route0['routeName'], route_set_4.route0['start_xy'], route_set_4.route0['end_xy'])) path_c.append(route(pygame, screen, route_set_4.route1['routeName'], route_set_4.route1['start_xy'], route_set_4.route1['end_xy'], point3)) path_c.append(route(pygame, screen, route_set_4.route2['routeName'], route_set_4.route2['start_xy'], route_set_4.route2['end_xy'])) path_d = [] path_d.append(route(pygame, screen, route_set_5.route0['routeName'], route_set_5.route0['start_xy'], route_set_5.route0['end_xy'])) path_d.append(route(pygame, screen, route_set_5.route1['routeName'], route_set_5.route1['start_xy'], route_set_5.route1['end_xy'])) path_d.append(route(pygame, screen, route_set_5.route2['routeName'], route_set_5.route2['start_xy'], route_set_5.route2['end_xy'])) point2 = point() point2.add_paths(path_c) point2.add_paths(path_d) path_a = [] path_a.append(route(pygame, screen, route_set_2.route0['routeName'], route_set_2.route0['start_xy'], route_set_2.route0['end_xy'])) path_a.append(route(pygame, screen, route_set_2.route1['routeName'], route_set_2.route1['start_xy'], route_set_2.route1['end_xy'])) path_a.append(route(pygame, screen, route_set_2.route2['routeName'], route_set_2.route2['start_xy'], route_set_2.route2['end_xy'])) path_b = [] path_b.append(route(pygame, screen, route_set_3.route0['routeName'], route_set_3.route0['start_xy'], route_set_3.route0['end_xy'])) path_b.append(route(pygame, screen, route_set_3.route1['routeName'], route_set_3.route1['start_xy'], route_set_3.route1['end_xy'])) path_b.append(route(pygame, screen, route_set_3.route2['routeName'], route_set_3.route2['start_xy'], route_set_3.route2['end_xy'], point2)) point1 = point() point1.add_paths(path_a) point1.add_paths(path_b) # active route is now the second route added next_active_path = point1.switch_path() self.assertEquals('route3', next_active_path[0].get_route_name()) print('associated point for route3 ', next_active_path[2].point) # point 2 was associated with one of the routes in the path of point 1 trav = traverse() traversed_routes = trav.traverse_journey(point1, []) self.assertIsNotNone(traversed_routes) self.assertEquals('route3', traversed_routes[0].get_route_name()) self.assertEquals('route3', traversed_routes[1].get_route_name()) self.assertEquals('route3', traversed_routes[2].get_route_name()) self.assertEquals('route4', traversed_routes[3].get_route_name()) self.assertEquals('route4', traversed_routes[4].get_route_name()) self.assertEquals('route6', traversed_routes[5].get_route_name()) self.assertEquals('route6', traversed_routes[6].get_route_name()) self.assertEquals('route6', traversed_routes[7].get_route_name())
map_1 = folium.Map(location=pt,zoom_start=12) # <- initialize a map #populate the map with the random points for i,row in df.iterrows(): map_1.simple_marker((row[0],row[1])) #create N tuples of the form (driver,rider,end) i = 0 while i<20: # <- create 10 tuples #get three point point1 = df.ix[i,0],df.ix[i,1] point2 = df.ix[i+1,0],df.ix[i+1,1] point3 = stops['stop_lat'][random.randrange(len(stops))],stops['stop_lon'][random.randrange(len(stops))] #draw lines from driver->end,rider->end r1 = route(point1,point3) r2 = route_waypoint(point1,point3,point2) result = (r1,r2,(r2-r1)) #build vectors and calculate angle in between v0 = np.array(point1)-np.array(point3) v1 = np.array(point2)-np.array(point3) angle = np.math.atan2(np.linalg.det([v0,v1]),np.dot(v0,v1)) #name the end point. In this case I show the angle # map_1.simple_marker(point3,popup=str(math.degrees(angle))) if result[-1] == 0: map_1.line((point1,point3),line_color='green') map_1.line((point2,point3),line_color='green') else: map_1.line((point1,point3),line_color='red') map_1.line((point2,point3),line_color='red') map_1.simple_marker(point3, popup=str(result))
#!/usr/bin/python2 from jinja2 import Environment, FileSystemLoader import os from route import route THIS_DIR = os.path.dirname(os.path.abspath(__file__)) j2_env = Environment(loader=FileSystemLoader(THIS_DIR),trim_blocks=True) SRX110 = route("10.1.3.254","root","password") print "Content-type: text/html\r\n\r\n" print j2_env.get_template('./html/index.tmpl').render(routes=SRX110.show())
from django.contrib import admin admin.autodiscover() urlpatterns = patterns( '', # Examples: # url(r'^$', 'eventex.views.home', name='home'), # url(r'^eventex/', include('eventex.foo.urls')), # Uncomment the admin/doc line below to enable admin documentation: # url(r'^admin/doc/', include('django.contrib.admindocs.urls')), # Uncomment the next line to enable the admin: url(r'^admin/', include(admin.site.urls)), #url(r'^$', 'core.views.homepage', {'template': 'base.html'}), #REFATORAÇÃO DA LINHA ACIMA USANDO O METODO ROUTE QUE DEFINE UMA VIEWS ESPECIFICA PARA GET ('new') # E OUTRA ESPECÍFICA PARA POST ('create') route(r'^$', GET='subscription.views.new', POST='subscription.views.create', name="subscribe"), url(r'^inscricao/', include('subscription.urls', namespace='subscription')), #url(r'time/$', current_datetime, name="dthr_atual"), #url(r'time/plus/(?P<offset>\d{1,2})/(?P<unit>\w+)/$', time_ahead), #passando parametros nomeados para a views ) urlpatterns += staticfiles_urlpatterns()
from django.conf.urls.defaults import patterns, url from route import route urlpatterns = patterns('subscription.views', route(r'^$', 'subscribe', name='subscribe'), url(r'^(\d+)/sucesso/$', 'success', name='success'), )
def test_traverse_paths_in_points_one_level(self): pygame = None screen = None path_c = [] path_c.append(route(pygame, screen, route_set_4.route0['routeName'], route_set_4.route0['start_xy'], route_set_4.route0['end_xy'])) path_c.append(route(pygame, screen, route_set_4.route1['routeName'], route_set_4.route1['start_xy'], route_set_4.route1['end_xy'])) path_c.append(route(pygame, screen, route_set_4.route2['routeName'], route_set_4.route2['start_xy'], route_set_4.route2['end_xy'])) path_d = [] path_d.append(route(pygame, screen, route_set_5.route0['routeName'], route_set_5.route0['start_xy'], route_set_5.route0['end_xy'])) path_d.append(route(pygame, screen, route_set_5.route1['routeName'], route_set_5.route1['start_xy'], route_set_5.route1['end_xy'])) path_d.append(route(pygame, screen, route_set_5.route2['routeName'], route_set_5.route2['start_xy'], route_set_5.route2['end_xy'])) point2 = point() point2.add_paths(path_c) point2.add_paths(path_d) path_a = [] path_a.append(route(pygame, screen, route_set_2.route0['routeName'], route_set_2.route0['start_xy'], route_set_2.route0['end_xy'])) path_a.append(route(pygame, screen, route_set_2.route1['routeName'], route_set_2.route1['start_xy'], route_set_2.route1['end_xy'])) path_a.append(route(pygame, screen, route_set_2.route2['routeName'], route_set_2.route2['start_xy'], route_set_2.route2['end_xy'])) path_b = [] path_b.append(route(pygame, screen, route_set_3.route0['routeName'], route_set_3.route0['start_xy'], route_set_3.route0['end_xy'])) path_b.append(route(pygame, screen, route_set_3.route1['routeName'], route_set_3.route1['start_xy'], route_set_3.route1['end_xy'])) path_b.append(route(pygame, screen, route_set_3.route2['routeName'], route_set_3.route2['start_xy'], route_set_3.route2['end_xy'], point2)) point1 = point() point1.add_paths(path_a) point1.add_paths(path_b) active_path = point1.get_active_path() # active route is now the second route added next_active_path = point1.switch_path() self.assertEquals('route3', next_active_path[0].get_route_name()) print('associated point for route3 ', next_active_path[2].point)
for point in points: point.draw(pygame, screen) if train.allow_move: if train.get_current_route().signal.colour != aspect.RED: train.step(screen) train.set_move_status(False) pygame.display.update() journey = journey() path_f = [] path_f.append( route(pygame, screen, route_set_6.route0['routeName'], route_set_6.route0['start_xy'], route_set_6.route0['end_xy'])) path_f.append( route(pygame, screen, route_set_6.route1['routeName'], route_set_6.route1['start_xy'], route_set_6.route1['end_xy'])) path_f.append( route(pygame, screen, route_set_6.route2['routeName'], route_set_6.route2['start_xy'], route_set_6.route2['end_xy'])) point3 = point() point3.add_paths(path_f) path_c = [] path_c.append( route(pygame, screen, route_set_4.route0['routeName'], route_set_4.route0['start_xy'], route_set_4.route0['end_xy'])) path_c.append(
from django.conf.urls.defaults import patterns, url from route import route from subscription.views import subscribe urlpatterns = patterns('subscription.views', route(r'^$', GET='new', POST='create', name='subscribe'), url(r'^(\d+)/sucesso/$', 'success', name='success'), )
from route import route with open("input.txt") as f: content = f.readlines() maze = [] for idx, line in enumerate(content): maze.append(list(line)) longest = 0 for idx, line in enumerate(maze): if (len(line) > len(maze[longest])): longest = idx for idx, line in enumerate(maze): if (line[len(line) - 1] == '\n'): line.pop() for idx, line, in enumerate(maze): if (len(line) < len(maze[longest])): i = 0 diff = len(maze[longest]) - len(line) while (i < diff): maze[idx].append(" ") i += 1 my_route = route(maze) print(my_route.send_packet())
from django.conf.urls.defaults import patterns, url from route import route urlpatterns = patterns( 'subscription.views', route(r'^$', GET='new', POST='create', name='subscribe'), url(r'^(\d+)/sucesso/$', 'success', name='success'), )
print '===load topo===' t.loadcfg(cfg.topo_data_dic) print '----- TEST 1 -------' print '===find path===' node_A = 'v1' node_Z = 'v2' planned_route = { 'topo':t, 'nodeA':node_A, 'nodeZ':node_Z, } r = route.route(data=planned_route) r.findPath() print 'cost=%d' % r.get('cost') t.showScript() num_err = t.distributeScript() if num_err==0: print "Success." else: print "{0} errors happened.".format(num_err) print '----- TEST 2 -------' (fib, cost) = ('f2', 5) print '{0}.cost <- {1}:'.format(fib, cost)
# -*- coding:utf-8 -*- from django.conf.urls.defaults import patterns, include, url from django.contrib.staticfiles.urls import staticfiles_urlpatterns from route import route from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', # Examples: # url(r'^$', 'eventex.views.home', name='home'), # url(r'^eventex/', include('eventex.foo.urls')), # Uncomment the admin/doc line below to enable admin documentation: # url(r'^admin/doc/', include('django.contrib.admindocs.urls')), # Uncomment the next line to enable the admin: url(r'^admin/', include(admin.site.urls)), #url(r'^$', 'core.views.homepage', {'template': 'base.html'}), #REFATORAÇÃO DA LINHA ACIMA USANDO O METODO ROUTE QUE DEFINE UMA VIEWS ESPECIFICA PARA GET ('new') # E OUTRA ESPECÍFICA PARA POST ('create') route(r'^$', GET='subscription.views.new', POST='subscription.views.create', name="subscribe"), url(r'^inscricao/', include('subscription.urls', namespace='subscription')), #url(r'time/$', current_datetime, name="dthr_atual"), #url(r'time/plus/(?P<offset>\d{1,2})/(?P<unit>\w+)/$', time_ahead), #passando parametros nomeados para a views ) urlpatterns += staticfiles_urlpatterns()
from route import route _app = route() if __name__ == "__main__": _app.app.run(debug=True)
import matplotlib.pyplot as plt import numpy as np import route import vehicle car = vehicle.vehicle(7, 10, 5, 3200, 4, 31.29, 9.8, 12, 12, 0.0, np.pi/4.0, \ [0, 0], [10, 20]) print car.pos car.getOnHighway(car.pos, np.array([50, 50]), 0.01) print car.vel print car.speed x = route.route(42.170350, -72.479596, 42.210243, -71.784453) plt.plot(x.coords[:, 0], x.coords[:, 1]) plt.scatter(x.coords[:, 0], x.coords[:, 1]) plt.show()
from flask import Flask from flask_restful import Api import route import env app = Flask(__name__) api = Api(app) route.route(api) if __name__ == '__main__': app.run(env.HOST, env.PORT, env.DEBUG)
def test_constructor(self): myroute = route("San Francisco","Atlanta",2536) self.assertTrue(myroute.distance == 2536) self.assertTrue(myroute.destination == "San Francisco") self.assertTrue(myroute.firsthop == "Atlanta")
import route route.route(289)