query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Terminate the connection between the specified analytic and the video source. Does not terminate the service, so the service will still accept new configuration requests.
def kill(ctx, analytic_host, analytic_port): client = aceclient.ConfigClient(host=analytic_host, port=analytic_port) client.kill()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stop_advertising(self):\n self._periph.stop_advertising()", "def __del__(self):\n try:\n self.api.transport.session.close()\n except Exception as e:\n log.debug(f\"Failed to close VSO API connection with: {e}\")", "def terminate(self):\r\n for call in self....
[ "0.605665", "0.5903019", "0.5880774", "0.587189", "0.5814706", "0.56979114", "0.5695248", "0.56684774", "0.56481856", "0.56481856", "0.56199515", "0.55669135", "0.5565821", "0.5560698", "0.55319697", "0.54918116", "0.5473794", "0.5461876", "0.5455388", "0.54313624", "0.542883...
0.6198811
0
Applies the specified filter(s) to the stream processed by the StreamFilter at the host and port specified.
def filter(ctx, fil, filter_host, filter_port): if not fil: raise ValueError("Must specify at least one filtering operaion (of the form '<filter>=<value>'") client = aceclient.FilterClient(host=filter_host, port=filter_port) filters = {} for f in fil: filters.update(parse_tag(f)) cli...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def streamfilter(ctx, grpc, grpc_port, port, filter_port, analytic_addr, verbose):\n frame_filter = FrameFilter()\n client = aceclient.AnalyticClient(addr=analytic_addr)\n\n def degrade_grpc(handler):\n orig_frame = handler.get_frame()\n frame = frame_filter.filter(orig_frame, handler)\n ...
[ "0.58591235", "0.57476157", "0.5415524", "0.5403649", "0.53767914", "0.5333647", "0.5264466", "0.526356", "0.523075", "0.5219469", "0.5203964", "0.5161386", "0.50555325", "0.50518113", "0.50470275", "0.50247675", "0.50084955", "0.49869052", "0.4960493", "0.49510267", "0.49438...
0.6422648
0
Subcommnad for serving video for use by ACE components.
def serve(ctx, host, port): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def video():\n return Response(gen(Camera()),\n mimetype='multipart/x-mixed-replace; boundary=frame')", "def play_video(self):\n raise NotImplementedError(\n \"This method needs to be implemented by a derived class\"\n )", "def allow_video(self, video_id):\n ...
[ "0.6652976", "0.64133793", "0.63865376", "0.63865376", "0.63865376", "0.63865376", "0.6371279", "0.63503027", "0.63447744", "0.6301942", "0.6296815", "0.628532", "0.628532", "0.628532", "0.628532", "0.628532", "0.628532", "0.628532", "0.628532", "0.628532", "0.628532", "0.6...
0.0
-1
Starts a GStreamer Server using the source provided (can be connected camera or external RTSP stream) on the specified endpoint.
def rtsp(ctx, src, endpoint, verbose): import gi gi.require_version('Gst', '1.0') gi.require_version('GstRtspServer', '1.0') from gi.repository import Gst, GstRtspServer, GObject from ace.rtspserver import GstServer GObject.threads_init() Gst.init(None) if src.isdigit(): src = i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_destination_server(cls) -> None:\n\n def socket_handler(listener: socket.socket) -> None:\n sock = listener.accept()[0]\n try:\n with cls.server_context.wrap_socket(sock, server_side=True) as ssock:\n request = consume_socket(ssock)\n ...
[ "0.5576396", "0.55203706", "0.55177844", "0.5503346", "0.5464674", "0.53272074", "0.5271236", "0.5249388", "0.5188421", "0.5176306", "0.50517493", "0.5045307", "0.50389475", "0.5033822", "0.5014496", "0.5000804", "0.49984616", "0.49983224", "0.49781457", "0.497796", "0.496118...
0.670236
0
Starts a proxy server which connects to an RTSP stream and forwards frames to an analytic or StreamFilter using the gRPC service library.
def proxy(ctx, port, analytic_addr): proxy_svc = StreamingProxy( name=__name__, port=port, analytic_addr=analytic_addr) sys.exit(proxy_svc.Run())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_server():\n host = 'localhost'\n port = 8080\n listener = socket.socket(socket.AF_INET)\n listener.bind((host, port))\n print 'Serving on {0}:{1}.'.format(host, port)\n listener.listen(0)\n while 1:\n connection, address = listener.accept()\n print 'Got connection from ...
[ "0.66444004", "0.6616895", "0.63477296", "0.63469976", "0.6210936", "0.61613953", "0.6109927", "0.60843766", "0.602113", "0.59966487", "0.5965995", "0.59460896", "0.58812755", "0.5859297", "0.5854287", "0.58431673", "0.5763432", "0.57516414", "0.5739765", "0.5739765", "0.5719...
0.6486845
2
Start up a 'StreamFilter' server which can be used to modify indivdual frames en route to an analytic. The endpoint running on the 'filter_port' can be used to change the types and magnitudes of the filters applied to each frame.
def streamfilter(ctx, grpc, grpc_port, port, filter_port, analytic_addr, verbose): frame_filter = FrameFilter() client = aceclient.AnalyticClient(addr=analytic_addr) def degrade_grpc(handler): orig_frame = handler.get_frame() frame = frame_filter.filter(orig_frame, handler) resp = c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n import time\n import argparse\n\n from bcipy.acquisition.datastream.generator import file_data, random_data\n\n default_channels = ['ch' + str(i + 1) for i in range(16)]\n\n parser = argparse.ArgumentParser()\n parser.add_argument('-f', '--filename', default=None,\n ...
[ "0.6144526", "0.60026515", "0.5819685", "0.5770632", "0.5730651", "0.57251036", "0.56445503", "0.561699", "0.5590339", "0.5556246", "0.55507064", "0.55386966", "0.55055994", "0.54861856", "0.5485871", "0.5485389", "0.5480771", "0.54794383", "0.544749", "0.54197615", "0.540285...
0.67184466
0
Subcommand for directly streaming video (frame by frame) to an analytic running the gRPC service
def stream(ctx, db_addr): ctx.ensure_object(Context) ctx.obj.db = None if db_addr: addr_list = db_addr.split(":") if len(addr_list) != 2: raise ValueError("Address must be of the form <host>:<port>") logging.info("Connecting to database. Host: {!s} Port: {!s}".format( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def video(ctx, video_file, analytic_addr):\n if not analytic_addr:\n analytic_addr = [\"localhost:50051\"]\n db = ctx.obj.db\n client = aceclient.AnalyticMultiClient()\n classes = {}\n cap = cv2.VideoCapture(video_file)\n window_names = []\n f_req = analytic_pb2.FrameRequest()\n for ...
[ "0.7390834", "0.7308014", "0.68512917", "0.67945987", "0.67533576", "0.6733717", "0.6714709", "0.6714709", "0.6714709", "0.6714709", "0.6714709", "0.6714709", "0.6714709", "0.6714709", "0.6714709", "0.6714709", "0.6714709", "0.6714709", "0.6714709", "0.6714709", "0.65394", ...
0.0
-1
Stream the contents of a video file to an analytic
def video(ctx, video_file, analytic_addr): if not analytic_addr: analytic_addr = ["localhost:50051"] db = ctx.obj.db client = aceclient.AnalyticMultiClient() classes = {} cap = cv2.VideoCapture(video_file) window_names = [] f_req = analytic_pb2.FrameRequest() for a in analytic_ad...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_video(lane, fname, output):\n\tclip = VideoFileClip(fname)\n\toutput_name = output\n\toutput_clip = clip.fl_image(lane.pipeline)\n\toutput_clip.write_videofile(output_name, audio=False)\n\tprint ('Video processed successfully')", "def stream_frames(video_capture):", "def download_video(video_stream...
[ "0.64831686", "0.6376277", "0.62132955", "0.6193396", "0.6193396", "0.6170949", "0.61002314", "0.6097967", "0.6081561", "0.6028888", "0.60048175", "0.5942202", "0.58900416", "0.58833396", "0.58557004", "0.5845093", "0.5844236", "0.5843379", "0.58407396", "0.5829075", "0.58132...
0.6725892
0
Stream the live camera feed from "cam_id" to an analytic
def camera(ctx, cam_id, analytic_addr, width, height): if not analytic_addr: analytic_addr = ["localhost:50051"] db = ctx.obj.db client = aceclient.AnalyticMultiClient() cap = cv2.VideoCapture(int(cam_id)) cap.set(cv2.CAP_PROP_FRAME_WIDTH, int(width)) cap.set(cv2.CAP_PROP_FRAME_HEIGHT, i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def camera(ctx, cam_id, verbose):\n client = ctx.obj.client\n cap = cv2.VideoCapture(cam_id)\n frame_num = 1\n classes = {}\n try:\n while True:\n ret, frame = cap.read()\n if not ret:\n print(\"Stream unavailable. Exiting.\")\n break\n ...
[ "0.7227691", "0.713534", "0.69134116", "0.64956707", "0.63762933", "0.63613963", "0.6343071", "0.6322753", "0.6301483", "0.629849", "0.628022", "0.61975694", "0.61477214", "0.61269814", "0.6083638", "0.607301", "0.6060582", "0.60284513", "0.60261554", "0.5961615", "0.5950819"...
0.69182837
2
Perform simple functionality tests to ensure that the system is configured properly
def test(ctx): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_install(self):\n pass", "def test_config():\n assert not sample.create_app().testing\n assert sample.create_app({\"TESTING\": True}).testing", "def test_app_is_testing(self):\n self.assertFalse(app.config['SECRET_KEY'] == 'my_precious')\n self.assertTrue(app.config['DEBUG'])...
[ "0.7055271", "0.702202", "0.6939147", "0.6931929", "0.69250816", "0.6919438", "0.69178534", "0.6881238", "0.6869164", "0.6847837", "0.6846867", "0.6846867", "0.6830115", "0.6827181", "0.68153316", "0.67974293", "0.67901355", "0.67901355", "0.67901355", "0.67901355", "0.679013...
0.0
-1
Process a stream using an ACE analytic and display the output (with any bounding boxes) to the user. The verbose flag can be used to output the analytic output data to the terminal
def analytic(ctx, src, analytic_addr, verbose): client = TestClient(src, analytic_addr=analytic_addr, verbose=False) client.run()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def analyze(self):\n self.grayscale = (input(\"[G]rayscale or [C]olor? \").lower()[0] == \"g\")\n for i in range(1, 6):\n for j in range(1, 10):\n network_name = \"acas_%d_%d\" % (i, j)\n try:\n distance_classified = self.read_artifact(\n ...
[ "0.5656191", "0.5636248", "0.56261665", "0.54153246", "0.53705555", "0.536345", "0.52996397", "0.52642", "0.5260546", "0.52508795", "0.51687396", "0.5168123", "0.5126289", "0.50971055", "0.50721025", "0.50595313", "0.50377643", "0.49874163", "0.49852732", "0.49790943", "0.497...
0.4930898
23
Test that the client is able to access the camera. Displays live feed from specified camera
def camera(ctx, cam_id, verbose): client = ctx.obj.client cap = cv2.VideoCapture(cam_id) frame_num = 1 classes = {} try: while True: ret, frame = cap.read() if not ret: print("Stream unavailable. Exiting.") break if verbose:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_camera(self, camera):\n dev = list()\n for room in self.rooms:\n for device in room[\"devices\"]:\n dev.append(device)\n return Response(self.gen_testcamera(dev[int(camera)]),\n mimetype='multipart/x-mixed-replace; boundary=frame')", ...
[ "0.7307055", "0.7262512", "0.6928262", "0.665956", "0.6501058", "0.6427823", "0.64117384", "0.63747364", "0.6353283", "0.6336064", "0.631288", "0.62939954", "0.6278044", "0.62734544", "0.6264801", "0.6230447", "0.618928", "0.6164959", "0.616307", "0.61456573", "0.61455125", ...
0.70439965
2
La funcion g calcula el costo exacto de la distancia recorrida desde el nodo inicial a la posicion actual.
def g(inicio,pos): return (pos.costo-inicio.costo)*distancia_nodos(inicio,pos)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cost(self):\n\t\treturn self.g + self.h", "def cost(self) -> float:", "def get_cost(self) -> float:\n return math.e / self.fitness", "def _compute_gasto_subtotal(self):\n beneficio = ingreso_subtotal - gasto_subtotal_comercial", "def get_expected_cost(self):", "def cost(self, dgvel):\n ...
[ "0.72515666", "0.69171375", "0.6674879", "0.6629221", "0.6358477", "0.63319737", "0.6319985", "0.6062444", "0.6057181", "0.6047067", "0.6013731", "0.597569", "0.59598047", "0.5950799", "0.59440684", "0.5940004", "0.58869034", "0.588622", "0.58777", "0.58748436", "0.5863089", ...
0.83096606
0
La funcion h es el calculo heuristico del paso de la posicion actual al objetivo.
def h(pos,obj): return D(pos)*(distancia_nodos(pos,obj))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def f(inicio,obj):\n return g(inicio,obj)+h(inicio,obj)", "def update_H(self):", "def mezclar_bolsa(self):", "def h_o(self):\n return self._h_o", "def lin_o_func(self):\n return self.hx", "def get_lengte(self):", "def h(self) -> float:\n return self._h", "def h_a(self):\n retu...
[ "0.5981592", "0.595853", "0.59185004", "0.58909196", "0.57945514", "0.57156384", "0.56727326", "0.56553644", "0.5640878", "0.558471", "0.5576271", "0.5562072", "0.55479944", "0.5541887", "0.55355984", "0.54809904", "0.54614645", "0.5390539", "0.5376353", "0.53762066", "0.5350...
0.62713224
0
La funcion f calcula el peso dado por la distancia (taxicab) de la posicion inicial a la posicion actual, dada por g y el costo heuristico desde la posicion al objetivo.
def f(inicio,obj): return g(inicio,obj)+h(inicio,obj)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def g(inicio,pos):\n return (pos.costo-inicio.costo)*distancia_nodos(inicio,pos)", "def calculo(self):\n return self.peso / (self.altura * self.altura)", "def ptpresionagua(self,prof_pt): #getter que halla la presion de poros en un punto\r\n p_agua=0.0\r\n if prof_pt<self.n_fret:\r\n ...
[ "0.73236585", "0.624474", "0.61952597", "0.6147825", "0.6109165", "0.60839826", "0.60772496", "0.5981555", "0.5937706", "0.5905682", "0.59043586", "0.58423716", "0.5838365", "0.58342457", "0.5790276", "0.5779031", "0.573206", "0.57034564", "0.57034564", "0.570261", "0.5698166...
0.0
-1
El algoritmo Aestrella es una forma sencilla de buscar rutas de bajo costo. En nuestro caso necesitamos que los agentes puedan reconocer elterreno, es decir leer mapas y trazar rutas. El algoritmo consiste en preguntar en la vecindad por cual nodo es menos costoso pasar
def aestrella(inicio,obj): nodos_abiertos=[inicio] nodos_cerrados=[] lista1=[] for cel in nodos_abiertos: lista1.append(cel.costo) m=min(lista1) for j in nodos_abiertos: j.set_gscore(g(inicio,j)) j.set_hscore(h(j,obj)) j.set_fscore(f(inicio,obj)) if j.fsco...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solicita_adelanto(self, sistema, operacion, medio_de_almacenamiento):\r\n\r\n primeros_cola_r_a = operacion.recurso.cola[0:operacion.recurso.capacity]\r\n primeros_cola_m_a = medio_de_almacenamiento.cola[0:medio_de_almacenamiento.espacios_de_atencion]\r\n\r\n primeros_cola_r_a_disponen_p_e...
[ "0.6223166", "0.6146199", "0.59754634", "0.5939359", "0.587318", "0.58306193", "0.5719471", "0.567403", "0.56605613", "0.5658244", "0.56132317", "0.5610766", "0.5568773", "0.555221", "0.554586", "0.55454296", "0.5514347", "0.5512615", "0.5502946", "0.5490798", "0.54768187", ...
0.5597646
12
Init function should not do any heavy lifting, but must initialize how many items are available in this data set.
def __init__(self, image_root, label_root, img_x, img_y): self.images_path = image_root self.labels_path = label_root self.data_len = 0 self.images = [] self.labels = open(self.labels_path, "r").readlines() self.transform = transforms.Compose([ transforms.Resi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_items(self):\r\n raise NotImplementedError()", "def __init__(self):\n self._data = PositionalList() # list of _Item instances", "def __init__(self):\n self._data = PositionalList() # list of Item instances", "def __init__(self):\r\n ...
[ "0.75463796", "0.7354425", "0.73105705", "0.7297417", "0.7243528", "0.7046796", "0.7046796", "0.6979095", "0.6949831", "0.6856075", "0.683049", "0.683049", "0.683049", "0.683049", "0.683049", "0.683049", "0.6786381", "0.6765407", "0.67283547", "0.67283547", "0.67283547", "0...
0.0
-1
return number of points in our dataset
def __len__(self): return(self.data_len)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def n_points(self):\n\n if self.data_reduced:\n return len(self.data_reduced[0])\n else:\n return 0", "def count_data(self):\n try:\n ndata = len(self.x)\n logger.info(\"Number of data points: {0}\".format(ndata))\n except AttributeError:\n ...
[ "0.8528253", "0.8478975", "0.83396226", "0.822552", "0.81187886", "0.80476034", "0.795443", "0.78886676", "0.7853177", "0.7740569", "0.75927436", "0.7589284", "0.7454286", "0.74426425", "0.7436194", "0.7334058", "0.7319647", "0.7311435", "0.72897756", "0.72344553", "0.7192672...
0.0
-1
Here we have to return the item requested by `idx` The PyTorch DataLoader class will use this method to make an iterable for our training or validation loop.
def __getitem__(self, idx): img = self.images[idx] label = self.labels[idx].split(" ")[-1] img = Image.open(img) img = img.convert('RGB') img = self.transform(img) return(img, label[:-1])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __getitem__(self, index):\r\n\r\n # Generate indexes of the batch\r\n indexes = self.indexes[index * self.batch_size:(index + 1) * self.batch_size]\r\n\r\n # Find list of IDs\r\n list_ids_temp = [self.list_IDs[k] for k in indexes]\r\n\r\n # Calls function to load batch of dat...
[ "0.74892426", "0.73380893", "0.7252037", "0.7252037", "0.7225515", "0.7225515", "0.72105503", "0.7205475", "0.71967584", "0.7196699", "0.7186608", "0.7160526", "0.70343167", "0.70343167", "0.69605625", "0.695354", "0.69118977", "0.6877463", "0.6862981", "0.6838847", "0.683674...
0.0
-1
Sanitize predictions in input file and write to output file
def sanitize(inp_fpath: str, out_fpath: str) -> None: assert os.path.isfile(inp_fpath) df = pd.read_csv(inp_fpath, sep='\t', encoding='utf-8', na_filter=False, header=None) for col_idx in [0, 5, 6]: col = df[col_idx].to_list() sanitized_col = [] num_changed = 0 for label in c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sanitize_file(infilename, outfilename):\n fout = codecs.open(outfilename, encoding=\"utf-8\", mode=\"w\")\n for line in codecs.open(infilename, encoding=\"utf-8\"):\n fout.write(sanitize(line))", "def truncate(submission_file_name, out_file_name):\n with open(submission_file_name, \"r\") as f...
[ "0.6553437", "0.5972334", "0.5955566", "0.5945562", "0.5936", "0.59171015", "0.5881446", "0.5879218", "0.5854257", "0.5794127", "0.5787619", "0.5775372", "0.5725004", "0.55731237", "0.5570035", "0.5564517", "0.55452144", "0.55412513", "0.552277", "0.5519092", "0.55042213", ...
0.56495786
13
This function creates new platforms from content provided by searching for urls (except those given in blacklisted_domains).
def _do_import_from_content(content, opr, to_save, blacklisted_domains=BLACKLISTED_DOMAINS): if not content: log.warn('No content, doing nothing') return urls = contentfiltering.find_all_urls(content) log.info('Found %d urls: %r', len(urls), urls) platforms = [] for url in urls: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _filter_platforms_by_platform_type(self, desired_platform):\n if desired_platform == constants.ANY:\n all_platforms = {}\n for platform in self.platforms.keys():\n all_platforms.update(self._filter_platforms_by_platform_type(platform))\n return all_platfor...
[ "0.5678516", "0.56009096", "0.5501956", "0.5429828", "0.53810084", "0.5377172", "0.53250057", "0.52782", "0.5211375", "0.5185266", "0.5103017", "0.5075978", "0.4974731", "0.49613166", "0.49106747", "0.48921102", "0.4882513", "0.4880354", "0.48738012", "0.48594186", "0.4853128...
0.5897081
0
takes an integer of ndigits and returns a string where each nonzero digit is followed by as many zeros as its position in the integer (modulo 10)
def expanded_form(num): #The main challenges here is going to be that integers are not iterables # Normally, I would try iterating on something of the likes of the second suggestion here: https://stackoverflow.com/questions/974952/split-an-integer-into-digits-to-compute-an-isbn-checksum #But since the end output ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GenZeroStr(n):\n\n return \"\".join([\"0\"] * n)", "def transforme(n):\n if n<10 :\n return '0'+str(n)\n else :\n return str(n)", "def padding_zeroes(number, length_string):\n return str(number).zfill(length_string)", "def bitstr(n, width=None):\n result = list()\n while n:\...
[ "0.8059423", "0.74179727", "0.7414134", "0.741023", "0.7345168", "0.73082465", "0.724796", "0.71996766", "0.71849144", "0.7167155", "0.71418536", "0.7116603", "0.6984494", "0.6975325", "0.6971761", "0.689837", "0.6848227", "0.68346655", "0.6809205", "0.67809224", "0.67392343"...
0.6010981
82
Identifies red lights in the incoming camera image and publishes the index of the waypoint closest to the red light's stop line to /traffic_waypoint
def image_cb(self, msg): # incoming image self.has_image = True self.camera_image = msg
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_traffic_lights(self):\n light = None\n\n #some plausability checks before starting the processing\n if None is self.waypoints:\n return -1, TrafficLight.UNKNOWN\n if None is self.pose:\n return -1, TrafficLight.UNKNOWN\n if len( self.stopLineIndex) =...
[ "0.7072442", "0.70443374", "0.6970527", "0.68192345", "0.67568463", "0.6680403", "0.6676714", "0.6627117", "0.66037834", "0.64927554", "0.6464087", "0.6399433", "0.62281346", "0.61064774", "0.6083708", "0.59954786", "0.59131277", "0.57420075", "0.56280065", "0.5617074", "0.56...
0.0
-1
Identifies the closest path waypoint to the given position
def get_closest_waypoint(self, x, y): closest_idx = self.waypoint_tree.query([x, y])[1] # ckd tree (1st closest, idx) # Check if closest waypoint is ahead or behind vehicle closest_coord = self.waypoints_2d[closest_idx] prev_coord = self.waypoints_2d[closest_idx - 1] # Equa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_closest_waypoint(self, pose):\n #TODO implement - Done\n # Iterate the base_waypoints' x value with current position's x value and find the closest\n # match, and pick that waypoint location index. \n min_idx = 0\n min_dist = None\n cur_x = pose.position.x\n ...
[ "0.7640383", "0.718817", "0.7167996", "0.7131444", "0.7131107", "0.70338064", "0.7031135", "0.7023831", "0.70102865", "0.6980016", "0.69242376", "0.6840171", "0.67727935", "0.67419153", "0.67397225", "0.6639293", "0.6608368", "0.66068965", "0.65030026", "0.6495123", "0.648817...
0.68167746
12
Determines the current color of the traffic light
def get_light_state(self, light): if self.use_classifier: if(not self.has_image): return None cv_image = self.bridge.imgmsg_to_cv2(self.camera_image, "bgr8") #Get classification return self.light_classifier.get_classification(cv_image) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def light_color(self):\n return self._spots[constants.CROSSING_LOCATION - 1].light_color()", "def get_color(self):\n return self.color", "def lightness(self):\n min_component = min(self.red, self.green, self.blue)\n max_component = max(self.red, self.green, self.blue)\n avg =...
[ "0.7547378", "0.7183761", "0.71226096", "0.70371854", "0.7024114", "0.6996206", "0.6986204", "0.69836944", "0.6954334", "0.6954334", "0.6954334", "0.6954334", "0.6916853", "0.69021523", "0.6894722", "0.68905926", "0.68905926", "0.68546325", "0.68390936", "0.68202007", "0.6815...
0.0
-1
Finds closest visible traffic light, if one exists, and determines its location and color
def process_traffic_lights(self): closest_light = None line_wp_index = None # We want to find the smallest "diff". Initialize to the maximum possible value: total number of waypoints diff = len(self.base_waypoints.waypoints) # List of positions that correspond to the line to st...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_traffic_lights(self):\n #DONE find the closest visible traffic light (if one exists within LOOKAHEAD_WPS)\n if self.init:\n state = self.get_light_state(0)\n return -1, TrafficLight.UNKNOWN\n elif self.ntlwp:\n state = self.get_light_state(self.ntlw...
[ "0.70687", "0.6820108", "0.6765558", "0.6732309", "0.67009866", "0.6546096", "0.6458472", "0.64289075", "0.6398164", "0.62806374", "0.6242503", "0.620407", "0.60887104", "0.6075117", "0.60638815", "0.60356575", "0.6026577", "0.59824544", "0.5972425", "0.5906958", "0.5895115",...
0.70480263
1
Wrap a json response in a callback, and set the mimetype (ContentType) header accordingly (will wrap in text/javascript if there is a callback). If the "callback" or "jsonp" paramters are provided, will wrap the json output in callback({thejson})
def jsonp(f): from functools import wraps @wraps(f) def jsonp_wrapper(request, *args, **kwargs): resp = f(request, *args, **kwargs) if resp.status_code != 200: return resp callback = None if 'callback' in request.GET: callback = request.GET['callback...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def json_response(func):\n\t@wraps(func)\n\tdef decorated_view(*args, **kwargs):\n\t\tdata = func(*args, **kwargs)\n\t\tdata = json.dumps(data)\n\t\tresponse = make_response(data)\n\t\tresponse.headers['Content-Type'] = 'application/json'\n\t\treturn response\n\treturn decorated_view", "def json_response(func):\...
[ "0.65858775", "0.6534242", "0.6499524", "0.6449976", "0.64485675", "0.641055", "0.63922215", "0.63778245", "0.6375532", "0.6343512", "0.6340406", "0.6339296", "0.62446254", "0.62269115", "0.61363995", "0.6099785", "0.6097405", "0.6084017", "0.601347", "0.5959195", "0.592825",...
0.6092643
17
Move a node up
def _perc_up(self, cur_idx): while (cur_idx - 1) // 2 >= 0: parent_idx = (cur_idx - 1) // 2 if self._heap[cur_idx] < self._heap[parent_idx]: self._heap[cur_idx], self._heap[parent_idx] = ( self._heap[parent_idx], self._heap[cur_idx]...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_up(self):\n nodes = self.object.nodes or []\n nodes_count = len(nodes)\n\n # no nodes => can't go up\n if not nodes_count:\n raise ParseError(\"Cannot move up, no nodes found\")\n\n if nodes_count == 1: # root node => 'reset' the traversal\n self.o...
[ "0.8100364", "0.7917121", "0.7733776", "0.7650849", "0.75412625", "0.7513898", "0.75024796", "0.7495849", "0.7486269", "0.74397695", "0.7439224", "0.73785347", "0.7378507", "0.7375916", "0.73394054", "0.7311383", "0.7306384", "0.7299114", "0.7294623", "0.7212428", "0.71405524...
0.0
-1
Move a node down
def _perc_down(self, cur_idx): while 2 * cur_idx + 1 < len(self._heap): min_child_idx = self._get_min_child(cur_idx) if self._heap[cur_idx] > self._heap[min_child_idx]: self._heap[cur_idx], self._heap[min_child_idx] = ( self._heap[min_child_idx], ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_down():\n return __maze.move_down()", "def down(self):\n self.move(0,-1)", "def move_down(self):\n\n next_sibling = self.get_next_sibling()\n if next_sibling!=None: \n self.move_to(next_sibling,'right')\n self.save()", "def moveDown(self, edge):\n ...
[ "0.752281", "0.7340999", "0.7319647", "0.72105455", "0.71751803", "0.7170278", "0.7130873", "0.71059376", "0.7028592", "0.6970656", "0.69368225", "0.6916893", "0.68666863", "0.6849871", "0.68016446", "0.67921793", "0.6735161", "0.6733919", "0.67137176", "0.67111045", "0.66943...
0.0
-1
Get a smaller child
def _get_min_child(self, parent_idx): if 2 * parent_idx + 2 > len(self._heap) - 1: return 2 * parent_idx + 1 if self._heap[2 * parent_idx + 1] < self._heap[2 * parent_idx + 2]: return 2 * parent_idx + 1 return 2 * parent_idx + 2
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def min_child(self, index):\n if self.empty():\n return None\n if self._has_left(index):\n left = self._left(index)\n small_child = left\n if self._has_right(index):\n right = self._right(index)\n if self._data[right] < self._d...
[ "0.6891468", "0.6252703", "0.62101245", "0.6169312", "0.6134797", "0.61254615", "0.6122612", "0.60844123", "0.6057117", "0.60174835", "0.5999285", "0.5983017", "0.59734476", "0.59734476", "0.59320736", "0.5912668", "0.5885431", "0.587658", "0.5871534", "0.58636266", "0.585351...
0.6443669
1
Build a heap from any list
def heapify(self, not_a_heap, show_details=False): self._heap = not_a_heap[:] cur_idx = len(self._heap) // 2 - 1 while cur_idx >= 0: self._perc_down(cur_idx) cur_idx = cur_idx - 1 if show_details: print(self._heap)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_max_heap(self, list_to_be_heap):\n self.heaplist = self.heaplist + list_to_be_heap\n self.currentsize = len(list_to_be_heap)\n\n # as it follow properties of complete binary tree, non leaf nodes will end to total size / 2\n index = self.currentsize // 2\n\n # > 0 : to i...
[ "0.76261926", "0.7623257", "0.76100385", "0.75984156", "0.7476745", "0.7468826", "0.7464773", "0.74451417", "0.7419377", "0.7419377", "0.73608005", "0.7357161", "0.72729564", "0.7228793", "0.7202468", "0.71796215", "0.7140627", "0.700787", "0.6988573", "0.69858456", "0.694692...
0.0
-1
Add a new item
def insert(self, item): self._heap.append(item) self._perc_up(len(self._heap) - 1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add(self, item):", "def add_item(self, item):\n self.items.append(item)", "def add_item(self):\n item = models.Item(item_name=self.test_item,\n list_id=1,\n description=self.test_item_desc)\n item.add()", "def addItem(*args):", "d...
[ "0.860725", "0.82178724", "0.8176239", "0.817479", "0.817479", "0.817479", "0.812104", "0.80380076", "0.7910487", "0.7796559", "0.7685025", "0.76805025", "0.76562726", "0.76233417", "0.7596508", "0.7553294", "0.7548143", "0.7535154", "0.74885714", "0.74885714", "0.74885714", ...
0.0
-1
Check if the heap is empty
def is_empty(self): return not bool(self._heap)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def empty(heap):\n return size(heap) == 0", "def is_empty(self):\n return self.heap_size <= 0", "def is_empty(self):\n return len(self.__heap) == 0", "def is_empty(self) -> bool:\n return self.heap.length() == 0", "def is_empty(self) -> bool:\n return self.heap.length() == 0"...
[ "0.89677113", "0.86562514", "0.8594386", "0.8568348", "0.8568348", "0.8433863", "0.821349", "0.8005304", "0.74631864", "0.741278", "0.73871535", "0.7380325", "0.7369274", "0.73584104", "0.732917", "0.73005736", "0.72706765", "0.7252926", "0.7218856", "0.72033215", "0.71874195...
0.8304523
6
Heap as a string
def __str__(self): return str(self._heap)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self) -> str:\n return 'HEAP ' + str(self.heap)", "def __str__(self) -> str:\n return 'HEAP ' + str(self.heap)", "def __repr__(self):\n return \"heap:[\" + ','.join(map(str, self.ar[:self.n])) + \"]\"", "def __str__(self):\n\n string = \"[\"\n for i in range(1, ...
[ "0.8182915", "0.8182915", "0.76799554", "0.74971116", "0.665363", "0.6551035", "0.64787817", "0.6275183", "0.6160656", "0.6074545", "0.6016981", "0.59387195", "0.59387195", "0.5925933", "0.5848498", "0.58074236", "0.57755023", "0.5775258", "0.57692087", "0.57590175", "0.57478...
0.8424552
0
Takes in http request, renders the main page.
def index(request): featured_collections = Collection.objects.order_by('creation_date') template = loader.get_template('movies/index.html') context = { 'featured_collections': featured_collections, } return HttpResponse(template.render(context, request))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def renderHTTP(req):", "def renderHTTP(ctx):", "def main_page():\n return render_template(\"main_page.html\")", "def get(self):\n self.response.write(view_utils.render('base.html', {}))", "def main():\n page = get_page_arg()\n\n items = load_data(page)\n total_pages = get_total_pages()\n...
[ "0.7316299", "0.7298251", "0.7117526", "0.7052434", "0.705099", "0.69702905", "0.69521195", "0.6928551", "0.6918779", "0.68295616", "0.67523545", "0.67523545", "0.6739653", "0.6650384", "0.6645214", "0.66133827", "0.6577868", "0.6574723", "0.65542704", "0.65487957", "0.652363...
0.0
-1
This function is used by the solve_ivp to calculate the solution for the differential equation.
def derivative_func(t, x, Approx_func): return x.dot(Approx_func)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solve(self):\n \n # getting the time values\n self.days_list = np.linspace(self.tbeg,self.tend,self.npoints)\n\n # calling the odeint method to solve the diff. equations\n self.x = odeint(self.diff_eq,self.x0,self.days_list,args = (self.par,))\n '''\n Its import...
[ "0.73856497", "0.7261106", "0.7230059", "0.6906474", "0.6906474", "0.6727829", "0.6727829", "0.66970307", "0.66324747", "0.6596081", "0.642912", "0.64055574", "0.6342833", "0.63409066", "0.63271123", "0.6277929", "0.6275606", "0.62751216", "0.62505245", "0.62459767", "0.61906...
0.0
-1
This method approximates the values of X1 in data sets, plots the initial points, and then calculates the approximated values using linear function and then calculates the mean squared error.
def approximate_nonlinear_vector_field(dataset_path): file_X0 = "nonlinear_vectorfield_data_x0.txt" names_X0 = ['X0_x', 'X0_y'] data_X0 = pd.read_csv(dataset_path / file_X0, sep=' ', names=names_X0).to_numpy() plt.scatter(data_X0[:, 0], data_X0[:, 1]) names_X1 = ['X1_x', 'X1_y'] file_X1 = "non...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mean_squared_error(x0, x1):\n return MeanSquaredError()(x0, x1)", "def _plot(self):\n # Read results\n path = self.openmc_dir / f'statepoint.{self._batches}.h5'\n x1, y1, _ = read_results('openmc', path)\n if self.code == 'serpent':\n path = self.other_dir / 'input_d...
[ "0.59211594", "0.5758438", "0.5758084", "0.5704672", "0.5646937", "0.56217843", "0.56202835", "0.5618603", "0.56165546", "0.55866367", "0.5572233", "0.55657125", "0.55620223", "0.5555506", "0.5529162", "0.5529162", "0.5529162", "0.5525268", "0.55182874", "0.5503791", "0.54922...
0.0
-1
This method approximates the values of X1 in data sets, plots the initial points, and then calculates the approximated values using linear function and then calculates the mean squared error.
def approximate_nonlinear_vector_field_radial(dataset_path, L, epsilon): file_X0 = "nonlinear_vectorfield_data_x0.txt" names_X0 = ['X0_x', 'X0_y'] data_X0 = pd.read_csv(dataset_path / file_X0, sep=' ', names=names_X0).to_numpy() names_X1 = ['X1_x', 'X1_y'] file_X1 = "nonlinear_vectorfield_data_x1....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mean_squared_error(x0, x1):\n return MeanSquaredError()(x0, x1)", "def _plot(self):\n # Read results\n path = self.openmc_dir / f'statepoint.{self._batches}.h5'\n x1, y1, _ = read_results('openmc', path)\n if self.code == 'serpent':\n path = self.other_dir / 'input_d...
[ "0.5921011", "0.57600206", "0.5759351", "0.5704207", "0.56440187", "0.56222993", "0.56220543", "0.5619588", "0.56174195", "0.55844516", "0.5573606", "0.5562344", "0.5561779", "0.55604315", "0.55276805", "0.55276805", "0.55276805", "0.55260867", "0.5519615", "0.5501571", "0.54...
0.0
-1
Constructor for the range of reading scores.
def __init__(self, low_score=0, high_score=0): self.low_score = low_score self.high_score = high_score
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, seq_name, first, last, score):\n self.sequence_name = seq_name\n self.first = int(first)\n self.last = int(last)\n self.score = int(score)", "def __init__(self, name, number):\n self._name = name\n self._scores = []", "def __init__(self,L,R) :\n s...
[ "0.7073958", "0.66551566", "0.66546947", "0.66058695", "0.65958124", "0.6486821", "0.6471238", "0.6436775", "0.64144105", "0.6298782", "0.62763983", "0.6253294", "0.62456226", "0.6206915", "0.6193982", "0.6193982", "0.6193982", "0.6193982", "0.6168166", "0.6165295", "0.614989...
0.7093341
0
Download a PDF from a URL and return its contents. This function makes sure the PDF is not downloaded too often. This function is a last resort for PDF files where we are uncertain if
def get_pdf_from_url(url: str, name: str) -> bytes: if url.startswith("file://"): with open(url[7:].replace("\\", "/"), "rb") as fp: return fp.read() cache_dir = os.path.join(os.path.dirname(__file__), "pdf_cache") if not os.path.exists(cache_dir): os.mkdir(cache_dir) cache_p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetch_pdf(url, browser):\n\tpass\n\n\t# grab link page\n\n\t# search soup for pdf file\n\n\t# grab pdf file and return it", "def download_pdf( url, filename = None ):\n r = urlopen( Request( url ) )\n try:\n if filename is None:\n filename = give_filename( url )\n with open( fi...
[ "0.79823667", "0.7873831", "0.7694076", "0.74173254", "0.7309697", "0.7211861", "0.6784274", "0.67698056", "0.67568994", "0.67434", "0.6735738", "0.6688149", "0.66874224", "0.6682531", "0.6673487", "0.66299", "0.6571205", "0.65289897", "0.65161073", "0.6511533", "0.6503311", ...
0.74782306
3
Remove the location information. The message
def _strip_position(line: str) -> str: line = ".py".join(line.split(".py:")[1:]) line = " ".join(line.split(" ")[1:]) return line
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_scrub_geo(self, notice):\n log.debug(\"Received location deletion notice: %s\", notice)", "def location(self):\n del self._location", "def remove_location(self, **kwargs):\n \n self.options.update(kwargs)\n self.options['action'] = 'locator.location.remove'\n re...
[ "0.6925312", "0.6885651", "0.65714896", "0.648358", "0.61747277", "0.6093786", "0.5991966", "0.59052926", "0.5810752", "0.5781817", "0.5781817", "0.5781817", "0.5781817", "0.5781817", "0.5781817", "0.5781817", "0.57539165", "0.57420665", "0.5690148", "0.56775045", "0.56451577...
0.0
-1
Python 2.4 compatible memoize decorator. It creates a cache that has a maximum size. If the cache exceeds the max, it is thrown out and a new one made. With such behavior, it is wise to set the cache just a little larger that the maximum expected need.
def _memoizeArgsOnly (max_cache_size=1000): def wrapper (f): def fn (*args): try: return fn.cache[args] except KeyError: if fn.count >= max_cache_size: fn.cache = {} fn.count = 0 fn.cache[args] = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def memoize(maxsize=None, *args, **kwargs):\n return _coconut.functools.lru_cache(maxsize, *args, **kwargs)", "def dp_memoize_instance(f):\n \n memoize = memoize_limited(max_size=None, max_mem_MB=25)\n return memoize(f)", "def memoize(func=None, maxsize=2):\n\n def decorator(func):\n\n c...
[ "0.86837596", "0.77518624", "0.77445376", "0.7480871", "0.7404599", "0.7029063", "0.6863209", "0.6858599", "0.68207705", "0.67655516", "0.6756709", "0.6755227", "0.67310643", "0.6706278", "0.66977113", "0.66910946", "0.6685077", "0.66842085", "0.66525626", "0.66350687", "0.65...
0.760004
3
given a string, this function converts to an int
def _str_to_int(x): if x == None or x == '': return 0 return int(x)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _str_to_int(in_str):\n if in_str == '':\n return 0\n return int(in_str, 10)", "def dec2int(r: str) -> int:", "def toint(s):\n try:\n n = int(s)\n except ValueError:\n n = 0\n return n if n >= 0 else 0", "def string_to_int(s):\n ...
[ "0.8268869", "0.80456454", "0.80006987", "0.7976272", "0.79584867", "0.7878227", "0.783963", "0.7765979", "0.7739183", "0.77137554", "0.75536174", "0.7534721", "0.7497411", "0.7481837", "0.7470874", "0.74415624", "0.74215794", "0.74074167", "0.7394648", "0.73788667", "0.73699...
0.7462829
15
given a string, this funtion converts the special values '' and None to the special value 'zzzzzz'. This is used to insure empty values have a high sort order
def _str_to_high_str(x): if x == None or x == '': return _padding_high_string return x
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def changenonetoNone(s):\r\n if s=='None':\r\n return None\r\n else:\r\n return s", "def s2s(s):\n if (s is None): return \"\"\n else: return s", "def _coerce_str_unless_none(value):\n return str(value) if value is not None else None", "def _nullify(self, value):\n if not ...
[ "0.6364643", "0.6197485", "0.6093793", "0.6086106", "0.6080981", "0.60672665", "0.59263766", "0.59082025", "0.58887494", "0.5856734", "0.58464897", "0.5757918", "0.5755265", "0.5729947", "0.5695476", "0.56843674", "0.56622386", "0.56446385", "0.5642412", "0.56323874", "0.5624...
0.5814106
11
turn a string representing a version into a normalized version list. Version lists are directly comparable using standard operators such as >, <, ==, etc.
def normalize(version_string, max_version_parts=4): version_list = [] for part_count, version_part in enumerate(version_string.split('.')): try: groups = _version_part_re.match(version_part).groups() except Exception, x: raise NotAVersionException(version_string) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize_version(v):\n rv = []\n for x in v.split(\".\"):\n try:\n rv.append(int(x))\n except ValueError:\n for y in re.split(\"([0-9]+)\", x):\n try:\n if y != '':\n rv.append(int(y))\n except Va...
[ "0.6967106", "0.68657637", "0.6816986", "0.66744596", "0.65733165", "0.64145917", "0.6347782", "0.6190191", "0.6107062", "0.604065", "0.6039773", "0.60347754", "0.6015595", "0.601328", "0.59556323", "0.58249134", "0.5719705", "0.5712309", "0.5694737", "0.5679233", "0.56733465...
0.6900444
1
separate action function to allow for the memoize decorator. Lists, the most common thing passed in to the 'denormalize' below are not hashable.
def _do_denormalize (version_tuple): version_parts_list = [] for parts_tuple in itertools.imap(None,*([iter(version_tuple)]*4)): version_part = ''.join(fn(x) for fn, x in zip(_denormalize_fn_list, parts_tuple)) if version_part: version_parts_list.append...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __call__(self, *args):\n if args not in self.memo:\n self.memo[args] = self.f(*args)\n return self.memo[args]", "def memoize(decorated, memo):\n key = convert_to_hashable(decorated.args, decorated.kwargs)\n if key in memo:\n return memo[key]\n res = decorated(*decorated.args, **dec...
[ "0.57638687", "0.57144815", "0.56248283", "0.5603877", "0.55691427", "0.55400336", "0.5512491", "0.5474179", "0.54587", "0.5418684", "0.5393187", "0.5375345", "0.5361772", "0.53064597", "0.52818835", "0.52818835", "0.52818835", "0.52808714", "0.52605444", "0.5248947", "0.5231...
0.0
-1
the opposite of the normalize function. Given a tuple representing a normalized version, return a single minimal length string equivalent. Because of the ambiguities of zero valued numeric parts, this function may return a string shorter than the one that was originally normalized.
def denormalize (version_list): return _do_denormalize (tuple(version_list))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize_tuple(tuple_to_normalize, total = 1):\n if total == 0:\n return False\n\n# if tuple includes negative values, remove them by subtracting the largest\n# negative value\n if min(tuple_to_normalize) < 0:\n tuple_to_normalize = [element - min(tuple_to_normalize) \n for elem...
[ "0.5742666", "0.57337517", "0.57038116", "0.5656831", "0.56049097", "0.5589575", "0.55644554", "0.54623365", "0.53709704", "0.53354794", "0.5291055", "0.52828896", "0.5255587", "0.52498394", "0.5197289", "0.5155814", "0.51076", "0.5106874", "0.51068497", "0.51065683", "0.5080...
0.0
-1
old style __cmp__ function returning 1, 0, 1
def compare (v1, v2): v1_norm = normalize(v1) v2_norm = normalize(v2) if v1_norm < v2_norm: return -1 if v1_norm > v2_norm: return 1 return 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _cmp(a, b): # pylint: disable=invalid-name\n return (a > b) - (a < b)", "def cmp(a, b):\n return (a > b) - (a < b)", "def compare(self) -> int:", "def cmp(x, y):\n return (x > y) - (x < y)", "def __cmp__(self, x):\n if self.score < x.score: return -1\n elif self.score == x.score:...
[ "0.80462754", "0.76650536", "0.75463134", "0.7500016", "0.7451602", "0.74375534", "0.7383747", "0.7339009", "0.7268435", "0.7261175", "0.71515733", "0.7095084", "0.70138276", "0.6881012", "0.6839449", "0.68333995", "0.68279094", "0.67767686", "0.6772438", "0.6763244", "0.6753...
0.61690724
94
Adjust prediction == input ==
def adjust_scale_prediction(y_pred, cell_grid, ANCHORS): BOX = int(len(ANCHORS)/2) ## cell_grid is of the shape of ### adjust x and y # the bounding box bx and by are rescaled to range between 0 and 1 for given gird. # Since there are BOX x BOX grids, we rescale each bx and by to range...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_predict(prediction, threshold):\n\n prediction[prediction < threshold] = 0\n prediction[prediction >= threshold] = 1\n \n return prediction", "def predict_and_update(self, z):", "def predict(self, _input_data):\n yhat_probs = (self.merged_model).predict(_input_data, verbose=0)\n\n ret...
[ "0.6634796", "0.647535", "0.6442718", "0.6429675", "0.629399", "0.629399", "0.62851876", "0.62760603", "0.6245491", "0.6242185", "0.62356806", "0.61875427", "0.6181383", "0.61585355", "0.61176175", "0.61081445", "0.6101631", "0.60913736", "0.60604334", "0.6016413", "0.599675"...
0.0
-1
Calculate and returns PCA of a set of images
def compute_pca(image_set): # Check for valid input assert(image_set[0].dtype == np.uint8) # Reshape data into single array reshaped_data = np.concatenate([image for pixels in image_set for image in pixels]) # Convert to floa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def performPCA(dataSet, numShapesInDataset, numPointsInShapes, num_components):\n\tdataMat = np.array(dataSet).reshape((numShapesInDataset, numPointsInShapes*2))\n\t\n\t\"\"\"Creating the covariance matrix\"\"\"\n\tcovarMat = np.cov(dataMat.T)\n\t\t\n\t\"\"\"Generating the eigen vectors and eigen values\"\"\"\n\te...
[ "0.7266325", "0.72300565", "0.7203943", "0.71658593", "0.7117749", "0.707815", "0.70040804", "0.694592", "0.68563604", "0.68533", "0.68456936", "0.6804869", "0.6677491", "0.6675038", "0.6665909", "0.6647357", "0.6598367", "0.6597939", "0.6594284", "0.65899503", "0.65850514", ...
0.7844498
0
Adds a multiple of the principle components, with magnitude from a Gaussian distribution with mean 0 and stdev 0.1
def add_pca_jitter(img_data, pca): # Check for valid input assert (img_data.dtype == np.uint8) # Make a copy of the image data new_img_data = np.copy(img_data).astype(np.float32) / 255.0 # Calculate noise by multiplying pca with magnitude, # then sum horizontally since eigenvectors are in col...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gaussian(amp, fwhm, mean, x):\n return amp * np.exp(-4. * np.log(2) * (x-mean)**2 / fwhm**2)", "def gaus(x, A, mu, sigma):\n return A * np.exp(-(x - mu) ** 2 / (2. * sigma ** 2))", "def gaussian(amp, fwhm, mean):\n return lambda x: amp * np.exp(-4. * np.log(2) * (x-mean)**2 / fwhm**2)", "def _FS...
[ "0.6508104", "0.63912535", "0.6374636", "0.635378", "0.63246095", "0.6242195", "0.62282217", "0.62220865", "0.6216115", "0.6200471", "0.6200296", "0.61429113", "0.6127847", "0.6125505", "0.611872", "0.6084683", "0.60714245", "0.60698384", "0.6055774", "0.6053971", "0.6047955"...
0.0
-1
Flips an object label along x
def flip_label(obj_label, im_size): flipped_label = copy.deepcopy(obj_label) # Flip in 2D x1 = flipped_label.x1 x2 = flipped_label.x2 half_width = im_size[0] / 2.0 diff = x1 - half_width # width of bounding box width_bb = x2 - x1 if x1 < half_width: new_x2 = half_width ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flip_image(image, label):\n # Flip the image\n cv2.flip(image, 1, image)\n\n # Flip the label\n label[1] = image.shape[1] - label[1]", "def flip(self, x, y):\n self.pieces[x + (y * self.width)].flip()", "def flip(self):", "def set_flipped(self, x, y):\n self.pieces[x + (y * self...
[ "0.65310675", "0.6329189", "0.63237107", "0.6162113", "0.6015734", "0.59960526", "0.59187305", "0.58995", "0.57680875", "0.5705692", "0.561192", "0.5600841", "0.5592621", "0.5592621", "0.5592621", "0.5592621", "0.5592621", "0.5592464", "0.5582927", "0.55639255", "0.55598253",...
0.7102782
0
Flips 2D image from left to right. The image is flipped using OpenCV's flip matrix function. The flipped 2D label is then calculated by splitting the image in half and deciding which split it belongs and adding the offset to align the bounding box.
def flip_2d_image_and_label(image, label): image_flipped = cv2.flip(image, 1) # Flip the label width = image.shape[1] half_width = width / 2 flipped_label = np.copy(label) x1 = label[0] x2 = label[2] diff = x1 - half_width # width of bounding box width_bb = x2 - x1 assert...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flip_image(image, label):\n # Flip the image\n cv2.flip(image, 1, image)\n\n # Flip the label\n label[1] = image.shape[1] - label[1]", "def flip_image_vertical(image):\n return cv.flip(image, 1)", "def flip_image_horizontal(image):\n return cv.flip(image, 0)", "def flip_image(image, bbo...
[ "0.7331265", "0.6832804", "0.64910865", "0.64310265", "0.6410109", "0.63891745", "0.63586336", "0.6356196", "0.6341496", "0.6339521", "0.63043123", "0.629815", "0.62607116", "0.62452435", "0.6236246", "0.6231211", "0.62308", "0.6210027", "0.6149166", "0.6148453", "0.61456317"...
0.7709797
0
Flips 3D point cloud and bounding box. This is a mirror effect. For point cloud, we flip along the xaxis. For the label, everything stays the same (l, w, h etc) the only thing that changes is the centroid and orientation. For that, we just need to flip the signs to create the mirror effect.
def flip_3d_point_and_label(label, points=None): # flip the label flipped_label = deepcopy(label) # flip the rotation (mirror effect) # the angle pointing into the camera is pi/2 half_pi = math.pi / 2 ry_diff = half_pi - label.ry flipped_label.ry = half_pi + ry_diff # flip the t.x sign,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flip_label(obj_label, im_size):\n\n flipped_label = copy.deepcopy(obj_label)\n\n # Flip in 2D\n x1 = flipped_label.x1\n x2 = flipped_label.x2\n\n half_width = im_size[0] / 2.0\n\n diff = x1 - half_width\n\n # width of bounding box\n width_bb = x2 - x1\n\n if x1 < half_width:\n ...
[ "0.68126345", "0.64173627", "0.6359249", "0.62982565", "0.624868", "0.6203889", "0.616801", "0.61408794", "0.6132925", "0.61160064", "0.60567635", "0.5990163", "0.5950275", "0.5926716", "0.5922353", "0.58914006", "0.5883534", "0.58835", "0.58758867", "0.5873768", "0.5871233",...
0.6320548
3
Generates negative 2D bounding boxes. This is computed in a semibrute force fashion. For any given bounding box, we first try to calculate the desired shift based on the selected IoU. If this failes, we just randomly shift the centroid and generate new bounding boxes. If it lies within the desired IoU threshold bound, ...
def calculate_negative_2d_bb(obj_label, boxes2d, iou_threshold_min, iou_threshold_max, samples, rand_sampl=False): x1 = obj_label.x1 y1 = obj_label.y1 x2 = obj_la...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_negative_3d_bb(obj_label,\n boxes3d,\n iou_threshold_min,\n iou_threshold_max,\n samples):\n box_corners = od.compute_box_corners_3d(obj_label)\n # make sure this is not empty\n assert(...
[ "0.69121605", "0.6865389", "0.6467625", "0.6369781", "0.62754124", "0.6056862", "0.6002797", "0.5892907", "0.5846243", "0.5825292", "0.5823235", "0.580352", "0.5802652", "0.5774881", "0.57701665", "0.5769676", "0.5751968", "0.5746477", "0.5703305", "0.5696509", "0.56963754", ...
0.7597889
0
Helper function to construct a new object label and prepare arguments to calculate IoU. Used inside generate_negative_2d_bb
def _construct_new_2d_object(new_xp, half_w, new_yp, half_l): new_x1 = float(new_xp - half_w) new_x2 = float(new_xp + half_w) new_y1 = float(new_yp - half_l) new_y2 = float(new_yp + half_l) new_obj = od.ObjectLa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, label):\n self.label = label", "def getLabel2(*args):", "def getLabel2(*args):", "def __init__(self, label: str):\n pass", "def generate_negative_2d_bb(obj_label,\n boxes2d,\n iou_threshold_min,\n ...
[ "0.62323165", "0.61818236", "0.61818236", "0.60819584", "0.60184616", "0.5947093", "0.5936901", "0.5913868", "0.59110516", "0.59110516", "0.59110516", "0.58521247", "0.5817964", "0.5817073", "0.58134526", "0.5795016", "0.57860434", "0.5752108", "0.5750563", "0.5749629", "0.57...
0.0
-1
Generates negative 2D bounding boxes. This is computed in a brute force fashion. For any given bounding box, we randomly shift the centroid and generate new bounding boxes and if it lies within the desired IoU threshold bound, we will keep it. Otherwise it is thrown out and this is repeated until number of valid sample...
def generate_negative_2d_bb(obj_label, boxes2d, iou_threshold_min, iou_threshold_max, samples): x1 = obj_label.x1 y1 = obj_label.y1 x2 = obj_label.x2 y2 = obj_label.y2 diff_x = (x2 - x1)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_negative_2d_bb(obj_label,\n boxes2d,\n iou_threshold_min,\n iou_threshold_max,\n samples,\n rand_sampl=False):\n\n x1 = obj_label.x1\n y1 = obj_label.y1\n ...
[ "0.7722662", "0.71809816", "0.674753", "0.64723235", "0.6354109", "0.6349555", "0.634271", "0.63150364", "0.6310376", "0.6043694", "0.60284215", "0.6015984", "0.6009575", "0.5999829", "0.59859705", "0.59692276", "0.59401596", "0.59201664", "0.5919447", "0.59148026", "0.589876...
0.7171472
2
Generates negative 3D bounding boxes. This is the 3D version of generate_negative_3d_bb.
def generate_negative_3d_bb(obj_label, boxes3d, iou_threshold_min, iou_threshold_max, samples): box_corners = od.compute_box_corners_3d(obj_label) # make sure this is not empty assert(len(box_corn...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_negative_2d_bb(obj_label,\n boxes2d,\n iou_threshold_min,\n iou_threshold_max,\n samples,\n rand_sampl=False):\n\n x1 = obj_label.x1\n y1 = obj_label.y1\n ...
[ "0.6293331", "0.6009182", "0.5801561", "0.5799778", "0.5769917", "0.57271326", "0.5657494", "0.5643734", "0.5588344", "0.5588344", "0.5566045", "0.55655116", "0.55625165", "0.55415875", "0.55285263", "0.54892945", "0.5468024", "0.5447369", "0.5443272", "0.54351157", "0.542643...
0.7253786
0
Add the amount of Water to the reserve
def findWater(self, found): self.amount = max(0, self.amount + found)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def useWater(self, used):\n self.amount = max(0, self.amount - used)", "def with_water(self, water):\n self.ingredients.append(water)\n return self", "def add_to_water_level(self, amount):\n self.water_level += amount\n if self.water_level < 0:\n self.water_level =...
[ "0.678656", "0.64859027", "0.64751625", "0.636471", "0.63474596", "0.6072444", "0.6055405", "0.60548395", "0.60482985", "0.59617096", "0.59285605", "0.58456117", "0.5789698", "0.57580453", "0.57145965", "0.5689935", "0.56603473", "0.56373537", "0.5628167", "0.55672455", "0.55...
0.63367224
5
Remove the amount of Water to the reserve
def useWater(self, used): self.amount = max(0, self.amount - used)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def purge(self):\n self.remaining = 0", "def take(self):\n print(\"You fill the kettle with water.\")\n inventory.remove('kettle')\n collect('filled kettle')", "def total_mass_above_sea(self):\n del self._total_mass_above_sea", "def reserve(self, reserve):\n \n ...
[ "0.6256969", "0.6184789", "0.5923078", "0.5892838", "0.5775151", "0.57341087", "0.5725877", "0.5659378", "0.56568617", "0.56459993", "0.5637632", "0.5615796", "0.5587769", "0.55730987", "0.55355954", "0.55175316", "0.55123353", "0.54984534", "0.54881275", "0.5482089", "0.5462...
0.6786882
0
Return True if the reserve is empty
def isEmpty(self): return self.amount <= 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _is_empty(self):\n if self.allocated_spaces == 0:\n return True\n else:\n return False", "def _is_full(self):\n if self.allocated_spaces == self.capacity:\n return True\n elif self.allocated_spaces < self.capacity:\n return False", "de...
[ "0.7745383", "0.7525927", "0.7378327", "0.73715854", "0.73642385", "0.73504555", "0.7321061", "0.73176295", "0.73164034", "0.72771734", "0.7260306", "0.7249706", "0.72366", "0.7235849", "0.7235849", "0.7235849", "0.7235849", "0.7235849", "0.7207459", "0.7200678", "0.7195226",...
0.0
-1
Let the people drink water
def drinkWater(self, people): for person in people: amount_to_drink = person.drinks self.amount = max(0, self.amount - amount_to_drink) person.drinkWater()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def the_drinking(self):\n self.log.info('The drinking starts')\n self.hide_give_buttons()\n self.show_people()\n\n #\n state = 'day-{0}'.format(self.end_of_day)\n conversation_item = self.conversation.getNext(situation='drinking', state=state)\n if conversation_item...
[ "0.6789464", "0.66233134", "0.6290141", "0.6263882", "0.61978054", "0.59505296", "0.5919984", "0.58950466", "0.58649296", "0.58483756", "0.5819375", "0.578152", "0.5749425", "0.57342714", "0.57231146", "0.57219404", "0.5716021", "0.5685382", "0.56706995", "0.56598645", "0.564...
0.73621035
0
To be called after all CodeObjects are added
def finalize(self): # first resolve all base classes so we can fetch cpp annotation from bases self._resolve_base_classes() # remove all objects from export who aren't annotated self.functions = self._clear_unused(self.functions) self.classes = self._clear_unused(self.classes) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def afterInit(self):", "def _afterInit(self):\n pass", "def _on_finalize(self):\n pass", "def finalise(self):", "def post_init(self):\n\t\tpass", "def postRun(self):\n pass", "def afterLoadSceneObject(self):\n\t\tpass", "def _post_init(self):\n pass", "def finalize(self)...
[ "0.6796183", "0.67928696", "0.663327", "0.6585481", "0.65723914", "0.6453328", "0.6420762", "0.6398504", "0.63911235", "0.63911235", "0.638779", "0.6357663", "0.6357663", "0.6357663", "0.6357663", "0.6357663", "0.6357663", "0.63340825", "0.6307862", "0.6307862", "0.6267333", ...
0.5905202
48
Returns the value for a template tag '$tag(the_args)'
def get_template_arg(self, tag, the_args, for_class): if the_args: args = the_args.split(",") args = [x.strip() for x in args] else: args = [] class_name = "" if for_class: class_name = for_class.name bad_arg = False tag ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tag(self, *arguments, **kwargs):\n return self.get_output('tag', *arguments, **kwargs)", "def getValue(tree, tag):\n try:\n return tree.find(tag).text\n except AttributeError:\n return None", "def getAttrValue(self, *args):\n return _libsbml.XMLToken_getAttrValue(self, *ar...
[ "0.5939105", "0.59040326", "0.5888939", "0.57253265", "0.569288", "0.5689616", "0.5591041", "0.5585122", "0.55828136", "0.55512434", "0.549272", "0.541498", "0.5410943", "0.53874797", "0.5374467", "0.53448373", "0.5341634", "0.53073204", "0.5247413", "0.52419", "0.5231348", ...
0.5962127
0
Stops the running node.
def stop(self) -> str: return self.rpc_call("stop")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stopped(self, exitCode):\r\n self._protocol = None\r\n\r\n if self._call:\r\n self._call.cancel()\r\n\r\n if exitCode:\r\n log.msg('Node ({0}) terminated with exit code: '\r\n '{1}'.format(self._name, exitCode))\r\n\r\n if self._owner:\r\n ...
[ "0.743267", "0.74148524", "0.7139009", "0.7111026", "0.70502067", "0.7003915", "0.6874512", "0.6828544", "0.6770172", "0.676242", "0.6725336", "0.66907173", "0.66657436", "0.6656761", "0.66499627", "0.6638323", "0.6638323", "0.66301686", "0.66109836", "0.6609338", "0.6609338"...
0.67777646
8
Changes network time (This is consensuscritical)
def setmocktime(self, timestamp: int) -> None: assert type(timestamp) == int return self.rpc_call("setmocktime", timestamp)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_time(self):\n pass # Do nothing", "def round_trip_time(self):\n ...", "def time(self):\n return _cantera.reactornet_time(self.__reactornet_id)", "def update_isolation(self, time: int):", "def nodes_time(self):\n return self._nodes_time", "def time(self):\n r...
[ "0.6884026", "0.65908855", "0.6458584", "0.63741255", "0.63455373", "0.631259", "0.6284918", "0.62143433", "0.6174829", "0.61314", "0.6081607", "0.60561967", "0.6049199", "0.6028185", "0.6024596", "0.6018718", "0.5993897", "0.59834015", "0.5964616", "0.59390295", "0.5918662",...
0.0
-1
Prunes the blockchain, it will keep blocks specified in Network Configurations
def pruneblockchain(self) -> None: return self.rpc_call("pruneblockchain")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prune(self):\n if len(self.cluster_status) >= 10000000:\n self.logger.debug(\"pruning memory\")\n for ip in [status.ip for status in self.cluster_status]:\n states = self.cluster_status[ip]\n previous_status = None\n prune_list = []\n ...
[ "0.56570435", "0.56035006", "0.5549241", "0.54996735", "0.5419818", "0.5373546", "0.53532416", "0.53341347", "0.52986115", "0.527793", "0.52240676", "0.5194452", "0.51836324", "0.5181773", "0.5151856", "0.51303744", "0.5052686", "0.5022346", "0.5009624", "0.5000603", "0.49971...
0.50211436
18
Invalidates the block in the chain. It will rewind network to blockhash and invalidate it.
def invalidateblock(self, block_hash: str) -> None: return self.rpc_call("invalidateblock", block_hash)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def invalidate(self):\n self._compute_merkle_tree()\n self.block_header.merkle_root_hash = self.merkle_tree.hash", "def invalidate_coinbase(self):\n self._invalidate_coinbase()", "def invalidate(self):\n self._valid = False", "def invalidate(self):\n self.valid = False", ...
[ "0.70624876", "0.6787744", "0.61735356", "0.6151557", "0.6120644", "0.59164333", "0.5888105", "0.5814211", "0.5808877", "0.5800096", "0.5723538", "0.5618082", "0.5498331", "0.5486071", "0.54791224", "0.54429746", "0.54033184", "0.5396211", "0.5395508", "0.538714", "0.53777325...
0.7681075
0
This rpc command will remove block from invalid block set.
def reconsiderblock(self, block_hash: str) -> None: return self.rpc_call("reconsiderblock", block_hash)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_block(self, block):\n raise NotImplementedError()", "def removeBlock(self, block: ghidra.program.model.mem.MemoryBlock, monitor: ghidra.util.task.TaskMonitor) -> None:\n ...", "async def remove_block(\n self,\n position: typing.Union[\n typing.Tuple[int, int, i...
[ "0.74918705", "0.7250436", "0.72068524", "0.6992121", "0.6933683", "0.6933527", "0.6776471", "0.6589181", "0.6578908", "0.6459173", "0.6412156", "0.6359652", "0.6305474", "0.6283912", "0.6231538", "0.6136246", "0.6067332", "0.60496384", "0.6043377", "0.6008817", "0.599013", ...
0.6250576
14
Creates raw, unsigned transaction without any formal verification.
def createrawtransaction( self, outpoints: List[Dict[str, Any]], send_to: Dict[str, float], locktime: Optional[int] = None, ) -> str: assert type(outpoints) == list assert type(send_to) == dict assert locktime is None or type(locktime) == int return se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_raw_transaction(amount, network_fee, from_address, to_address):\n tx_total = amount + network_fee\n tx_inputs = []\n input_total = 0\n unspent = list_unspent(from_address)\n\n # Are there enough funds in one block to cover the amount\n for block in unspent:\n if float(block[\"am...
[ "0.6524496", "0.6377507", "0.61649716", "0.61350334", "0.6055906", "0.5993551", "0.59610885", "0.5841967", "0.58150464", "0.5796263", "0.57654834", "0.5764628", "0.57342273", "0.57271934", "0.57214445", "0.57153535", "0.5713805", "0.57035524", "0.5679672", "0.5663116", "0.564...
0.0
-1
Returns hashing work to be solved by miner. Or submits solved block.
def getwork(self, data: Optional[str] = None) -> Dict[str, Any]: assert data is None or type(data) == str return self.rpc_call("getwork", data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def proof_of_work(block):\n block.nonce = 0\n\n computed_hash = block.compute_hash()\n while not computed_hash.startswith('0' * Blockchain.difficulty):\n block.nonce += 1\n computed_hash = block.compute_hash()\n\n return computed_hash", "def proof_of_work(self, b...
[ "0.67385536", "0.6728514", "0.6702973", "0.6539236", "0.64523786", "0.64214236", "0.6146412", "0.58632433", "0.57666385", "0.56642693", "0.56642693", "0.5649116", "0.56473726", "0.55874753", "0.55744624", "0.55078006", "0.55041385", "0.54821414", "0.54816407", "0.54702836", "...
0.0
-1
returns block template or proposal for use with mining. Also validates proposal if mode is specified as proposal.
def getblocktemplate(self, json_obj: Dict[str, Any]) -> Dict[str, Any]: assert type(json_obj) == dict return self.rpc_call("getblocktemplate", json_obj)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_proposal(self, id: bytes, current_block_height: int) -> dict:\n if not self._check_registered_proposal(id):\n revert(\"No registered proposal\")\n\n proposal_info = ProposalInfo.from_bytes(self._proposal_list[id])\n\n if proposal_info.end_block_height < current_block_height:...
[ "0.5524687", "0.51102275", "0.5010194", "0.4996207", "0.49690902", "0.49591985", "0.49088427", "0.48955157", "0.4894133", "0.48570698", "0.4841162", "0.48283577", "0.482567", "0.48170802", "0.47760049", "0.47697702", "0.47612295", "0.47442064", "0.4711913", "0.46875033", "0.4...
0.4798424
14
Will start the mining on CPU.
def setgenerate(self, mining: int, proc_limit: int) -> bool: assert mining in [0, 1] assert type(proc_limit) == int return self.rpc_call("setgenerate", mining, proc_limit)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_cpu(self):\n cpu_worker = CPUCmdRunner(self.host, 'cpu')\n self.cpu_workers.append(cpu_worker)\n cpu_worker.start()\n self.log.info('CPU worker added')", "def start_processing(self):", "def cpu(self):\n self.share = self.share.cpu()\n return self", "def start...
[ "0.66011065", "0.6413211", "0.61283654", "0.60697705", "0.6047807", "0.60159326", "0.5979322", "0.59358627", "0.5917178", "0.5858697", "0.58502954", "0.58241147", "0.5809314", "0.58012635", "0.5781998", "0.57793605", "0.57652485", "0.5764825", "0.5757989", "0.57298404", "0.57...
0.0
-1
Adds or removes peers in Host List.
def addnode(self, ip_addr: str, cmd: str) -> None: assert type(ip_addr) == str assert cmd in COMMANDS return self.rpc_call("addnode", ip_addr, cmd)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_hosts(self, hosts):\n for host in hosts:\n if host not in self.__hosts__:\n self.__hosts__.append(KnownHostsHost(host))", "def create_host_list(self):\n # Get first network address and add to list\n net_address = input('What is a network address you want to ...
[ "0.67621404", "0.59220874", "0.5904665", "0.58481115", "0.57883763", "0.57053787", "0.5660157", "0.5584603", "0.55732554", "0.5554046", "0.5539123", "0.5528418", "0.55176175", "0.5471474", "0.54644775", "0.5435636", "0.53941834", "0.53925055", "0.5392073", "0.53888917", "0.53...
0.0
-1
The result depends on the port.
def getnames(self) -> List[Dict[str, Any]]: # NOTE: warning this does not yet support pagination return self.rpc_call("getnames")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def port(self) -> int:", "def Port(self) -> int:", "def port():", "def get_res_port():\n return get_port() + 1", "def _get_port(self):\n return self.__port", "def mod_func(port):\n\n print(port)\n return port", "def port(self) -> pulumi.Output[int]:\n return pulumi.get(self, \"port\"...
[ "0.7556096", "0.7507754", "0.7496288", "0.6615496", "0.65084225", "0.6438838", "0.6390549", "0.6390549", "0.6390549", "0.638574", "0.61280435", "0.6122704", "0.6076165", "0.60625386", "0.60158384", "0.5964362", "0.59217316", "0.5919379", "0.5903879", "0.5903879", "0.5894576",...
0.0
-1
Grind a rolledout available name.
def grindname(self, length: int) -> None: assert type(length) == int return self.rpc_call("grindname")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def roll_up(self) -> str:\n return pulumi.get(self, \"roll_up\")", "def roll_over(self):\r\n print(self.name.title() + \" rolled over!\")", "def roll_over(self):\n print(self.name.title() + \" rolled over!\")", "def roll_over(self):\n print(self.name.title() + \" rolled over!\")",...
[ "0.56831753", "0.566355", "0.56505835", "0.56505835", "0.56505835", "0.5599969", "0.5499877", "0.54804903", "0.54402614", "0.54391605", "0.5424174", "0.5417952", "0.5404264", "0.53994334", "0.5375019", "0.53712213", "0.5369289", "0.53555566", "0.5338421", "0.5331339", "0.5295...
0.50524414
42
Show form for a searching a student
def get_student_form(): return render_template("student_search.html")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search():\n student_to_find=request.args.get(\"student\", None)\n print(f\"A buscar: {student_to_find}\")\n student_list=search_student(student_to_find)\n return render_template(\"search.html\",student_list_result=student_list)", "def get_student_form():\n\n return render_template(\"students_s...
[ "0.8163025", "0.80676556", "0.7954074", "0.7744924", "0.75075215", "0.7449278", "0.73587847", "0.722461", "0.7070502", "0.6900358", "0.6702686", "0.6519095", "0.64290625", "0.6425001", "0.6412709", "0.64099073", "0.6298393", "0.62906665", "0.6271193", "0.62621844", "0.6241801...
0.8045033
9
Show information about a student.
def get_student(): github = request.args.get('github') first, last, github = hackbright.get_student_by_github(github) rows = hackbright.get_grades_by_github(github) return render_template("student_info.html", first=first, last=last, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display_student(s_info):\n print('')\n print('Your information:')\n print(f'{s_info.student_id} - {s_info.first_name} {s_info.last_name}')", "def get_student():\n\n github = request.args.get('github')\n\n first, last, github = hackbright.get_student_by_github(github)\n title_grade_list = ha...
[ "0.8460236", "0.79822403", "0.7815986", "0.7746899", "0.769621", "0.7655982", "0.75156194", "0.7380441", "0.72558177", "0.7237431", "0.7198424", "0.7062714", "0.7019957", "0.7001486", "0.690486", "0.6744599", "0.6641368", "0.661062", "0.6505768", "0.65041435", "0.6459485", ...
0.771672
4
Creates name mapping between full name and short name. Arguments
def create_name_mappings( config: Dict[str, Dict[str, Union[str, List]]], map_full_to_short: bool = True ) -> Dict: csv_to_excel = {} for name, params in config.items(): try: csv_to_excel[name] = params["short_name"] except KeyError: if len(name) > 31: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def short_name(self) -> str:\r\n\t\treturn f'{self.last_name} {self.first_name}'", "def get_short_name(self):\n return f\"{self.first_name} {self.last_name[:1]}\" if self.first_name else self.username", "def short_name(self):\n return self.get(\"short_name\", decode=True)", "def get_short_name(...
[ "0.7328505", "0.67762285", "0.6690539", "0.668534", "0.6669694", "0.66632986", "0.6593074", "0.65809256", "0.65777487", "0.65742993", "0.6567646", "0.65578294", "0.6544194", "0.6471516", "0.6468412", "0.6460872", "0.64032215", "0.64032215", "0.64032215", "0.64032215", "0.6403...
0.0
-1
Validates user input data Arguments
def validate_config(config: Dict) -> None: # For validating with pydantic config_flattened = format_config_for_validation(config) user_defined_sets = get_all_sets(config) errors = [] for input_data in config_flattened: try: if "type" not in input_data: UserDefin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_input(self, *args):\n return", "def validate_arguments(self,args):\n\t\tif args.org == None:\n\t\t\tprint('Please specify Organization name. Exiting.')\n\t\t\tsys.exit(0)\n\t\tif args.repo == None:\n\t\t\tprint('Please specify Repositories name. Exiting.')\n\t\t\tsys.exit(0)\n\t\tif args.even...
[ "0.8096912", "0.7787771", "0.7720827", "0.7338837", "0.7314207", "0.72946495", "0.7289245", "0.728194", "0.7244525", "0.72029835", "0.7200052", "0.7197602", "0.71822685", "0.7171523", "0.7159358", "0.71555275", "0.7123606", "0.71153796", "0.7106247", "0.7080681", "0.703592", ...
0.0
-1
Formats config for validation function. Flattens dictionary to a list Arguments
def format_config_for_validation(config_in: Dict) -> List: config_out = [] for name, data in config_in.items(): flattened_data = {"name": name, **data} config_out.append(flattened_data) return config_out
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate(self, config=None):\n for k, v in config.items():\n assert (\n k in self.arguments\n ), f\"\"\"{k} is not a valid argument. Support arguments are {self.format_arguments()}.\"\"\"\n\n if self.arguments[k].type is not None:\n try:\n ...
[ "0.6824246", "0.6166993", "0.59597707", "0.59384215", "0.59027624", "0.58222824", "0.57885796", "0.5741923", "0.57236814", "0.57227635", "0.5674388", "0.5634317", "0.5419856", "0.53901297", "0.53687", "0.5358603", "0.5355951", "0.53520787", "0.53442454", "0.53175116", "0.5267...
0.68767613
0
Checks filepath for CSVs if a datapackage is provided Arguments
def read_deprecated_datapackage(datapackage: str) -> str: input_csvs = os.path.join(os.path.dirname(datapackage), "data") if os.path.exists(input_csvs): return input_csvs else: raise OtooleDeprecationError( resource="datapackage.json", message="datapackage format no ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_args(self):\n assert os.path.isfile(self.params.csv_input_file), \\\n \"Input CSV file %s not found\" % self.params.csv_input_file", "def prepare_csv(self, filename, *args, **kwargs):\n x_possible = getattr(settings, 'IMPORT_CSV_X_FIELDS', ['Lon*', 'x', 'lon*'])\n y_possible...
[ "0.65962964", "0.590816", "0.584911", "0.5827476", "0.58210975", "0.56837845", "0.5668356", "0.56587094", "0.557906", "0.55667055", "0.5525728", "0.5525388", "0.5519638", "0.55063343", "0.5502625", "0.54932433", "0.5467126", "0.546608", "0.5456776", "0.54059654", "0.540211", ...
0.5182609
43
Gets input parameter data and formats it as a dictionary Arguments
def get_packaged_resource( input_data: Dict[str, pd.DataFrame], param: str ) -> List[Dict[str, Any]]: return input_data[param].reset_index().to_dict(orient="records")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parameters(self) -> Dict[str, Any]:\n return self.data[\"args\"].get(\"parameters\", {})", "def get_args():\n\n params = {}\n\n if len(argv) == 1:\n\n input_file = input('Please enter the path to the parameter file: ')\n\n else:\n\n input_file = argv[1]\n\n if path.isfile(inp...
[ "0.6816154", "0.670513", "0.6580996", "0.65558064", "0.6441505", "0.6393012", "0.6367946", "0.6313341", "0.625883", "0.6169967", "0.6118147", "0.6103047", "0.6070604", "0.60332125", "0.5959055", "0.5947317", "0.59411955", "0.5927886", "0.5918116", "0.5910326", "0.5897897", ...
0.0
-1
Extracts user defined sets
def get_all_sets(config: Dict) -> List: return [x for x, y in config.items() if y["type"] == "set"]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getSets():", "def getSets(unique_name=None):", "def getSet(unique_name):", "def getSet(unique_name):", "def lego_sets():\n # you must replace this line and return your own list\n return lego_sets_list", "def lego_sets():\n # you must replace this line and return your own list\n return []"...
[ "0.7991591", "0.79206663", "0.74233705", "0.74233705", "0.6695486", "0.66308486", "0.6499675", "0.638944", "0.63714296", "0.63516915", "0.63240945", "0.6288791", "0.6243505", "0.62390786", "0.6181275", "0.61761636", "0.6115123", "0.61013323", "0.6096934", "0.608999", "0.60817...
0.647541
7
initialize your data structure here.
def __init__(self): self.max = None self.st = []
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _init_empty(self):\n self._data = []", "def __init__(self):\n self.data = []\n self.record = {}", "def __init__(self):\n self.structure = {}", "def __init__(self):\n self._data = []", "def __init__(self):\n self._data = []", "def __init__(self):\n self...
[ "0.7761502", "0.76093274", "0.75547695", "0.7549942", "0.7549942", "0.7549942", "0.7549942", "0.7549942", "0.7549942", "0.75293565", "0.7447436", "0.7447436", "0.7447436", "0.7447436", "0.7447436", "0.74347997", "0.74347997", "0.7408015", "0.7386423", "0.7380991", "0.7380991"...
0.0
-1
Test that if an invalid state is set to correct map, the state does not update at all.
def test_set_none_state(self): invalid_list = [None, "", False, 0] for invalid in invalid_list: self.cmap.set_dict(invalid) assert self.cmap.get_dict() == {}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_has_location_with_states_with_invalid_locations():\n state = State(\n \"hello.world\", \"invalid\", {ATTR_LATITUDE: \"no number\", ATTR_LONGITUDE: 123.12}\n )\n assert not location.has_location(state)", "def checkMap(self):\n return True", "def state_failsafe_validate(cfg, app, ...
[ "0.680259", "0.6651317", "0.6358816", "0.63505447", "0.6348836", "0.6337155", "0.62867904", "0.628228", "0.6227333", "0.6178898", "0.6178635", "0.61377215", "0.61201054", "0.611849", "0.60914856", "0.6072236", "0.60572577", "0.60542274", "0.60497314", "0.6037945", "0.60309803...
0.6971147
0
draws the axes for the coordinate system
def drawAxes(t): t.speed(0) t.pd() t.forward(500) t.back(500)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw_coordinate_axes(self):\n scale = 5.0\n glPushMatrix()\n\n glScalef(scale, scale, scale)\n origin = [0, 0, 0]\n\n xaxis = [1, 0, 0]\n yaxis = [0, 1, 0]\n zaxis = [0, 0, 1]\n\n glLineWidth(3.0)\n\n glBegin(GL_LINES)\n glColor3f(1, 0, 0)\n...
[ "0.79826456", "0.787967", "0.7138921", "0.7110343", "0.7001061", "0.7001061", "0.6961433", "0.6779791", "0.64533174", "0.6426998", "0.6350816", "0.63389623", "0.63379484", "0.6332454", "0.6332454", "0.6328691", "0.63272405", "0.6324839", "0.6324839", "0.6324839", "0.6323084",...
0.6314693
22
initial coordinates for the turtle/ coordinates considered as origin
def initialCoordinates(): return (-250,-250)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def origin(self):\r\n\r\n return self.ox, self.oy, self.oz", "def _set_origin(self):\n self += helper.circle(cx=self.__dict__['x'], cy=self.__dict__['y'], r=2, fill=\"black\", stroke=\"black\", style=\"fill-opacity: 50%\")\n self += helper.text(\"(0,0)\", x=self.__dict__['x']+5, y=se...
[ "0.70708233", "0.6914195", "0.67080975", "0.6461778", "0.64485896", "0.64254487", "0.64135253", "0.6347302", "0.62941587", "0.6288959", "0.6265186", "0.6216833", "0.6177759", "0.6177411", "0.6084805", "0.6083994", "0.60724795", "0.6063167", "0.6054364", "0.6032474", "0.603247...
0.7647754
0
makes turtle go to origin
def setTurtle(t): t.pu() t.goto(initialCoordinates())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def repositionTurtle(t, x, y):\n t.up()\n t.goto(x, y)\n t.down()", "def goto(x, y):\n turtleTmp.setposition(x, y)", "def moveturtle(x,y,t):\n t.penup()\n t.goto(x,y)\n t.pendown()", "def move_turtle(self):\n self.forward(self.move_speed)", "def gohome(turtle):\n turtle.penup()...
[ "0.7475702", "0.736905", "0.73032737", "0.7127415", "0.6943668", "0.6722828", "0.66932464", "0.66498077", "0.65949625", "0.6371422", "0.62884873", "0.6270913", "0.6056042", "0.60459065", "0.6020364", "0.6002092", "0.59924483", "0.5959679", "0.59550107", "0.58771145", "0.58325...
0.741809
1
draws an appropriate coordinate plane for the first graph
def drawCoordinatePlane_income(): turtle = t.Screen() turtle.title("Life Expectancy versus Income Category") t2.speed(0) t3.speed(0) setTurtle(t0) setTurtle(t1) setTurtle(t2) setTurtle(t3) drawAxes(t0) t1.left(90) drawAxes(t1) t0.pu() t0.fd(-80) t0.l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def drawCoordinatePlane_region():\r\n turtle2 = t.Screen()\r\n turtle2.title(\"Life Expectancy versus Region\")\r\n t2.speed(0)\r\n t3.speed(0)\r\n setTurtle(t0)\r\n setTurtle(t1)\r\n setTurtle(t2)\r\n setTurtle(t3)\r\n drawAxes(t0)\r\n t1.left(90)\r\n drawAxes(t1)\r\n t0.pu()\r...
[ "0.66490805", "0.63432705", "0.62373793", "0.6199884", "0.6068703", "0.6065697", "0.60353047", "0.5993301", "0.59508896", "0.5927441", "0.59041065", "0.5883764", "0.5868702", "0.58631253", "0.5818924", "0.580754", "0.57972467", "0.57846", "0.57245266", "0.57064277", "0.570055...
0.6807993
0
draws an appropriate coordinate plane for the second graph(expectancy vs region)
def drawCoordinatePlane_region(): turtle2 = t.Screen() turtle2.title("Life Expectancy versus Region") t2.speed(0) t3.speed(0) setTurtle(t0) setTurtle(t1) setTurtle(t2) setTurtle(t3) drawAxes(t0) t1.left(90) drawAxes(t1) t0.pu() t0.fd(-80) t0.lt(90) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_scenario(self, ax):\n ax.set_xlim((0,10))\n ax.set_ylim((0,10))\n\n # Unpack region's sizes and positions\n obs_x = self.obstacle_vert[0]\n obs_y = self.obstacle_vert[2]\n obs_w = self.obstacle_vert[1]-obs_x\n obs_h = self.obstacle_vert[3]-obs_y\n\n ...
[ "0.65499073", "0.6496035", "0.60228455", "0.590703", "0.5733049", "0.5705189", "0.5698288", "0.56977296", "0.56819504", "0.566494", "0.5626235", "0.5581443", "0.5571868", "0.5522218", "0.5506964", "0.55012393", "0.5491306", "0.54904056", "0.5480986", "0.5471765", "0.54591614"...
0.7263626
0
draws the labels for coordinate axes
def drawlabels(t, t1): t.fd(250) t.pd() t.write("Life", font=("Arial", 10, "bold")) t.pu() t.back(12) t.pd() t.write("Exp.", font=("Arial", 10, "bold")) t.pu() t.back(238) t.right(90) t.fd(80) t1.pu() t1.back(50) t1.rt(90) t1.fd(250) t1.pd(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_labels(self, labels):\n for i, axis in enumerate(self.bottom):\n self.grid[axis].set_xlabel(labels[i])\n\n for i, axis in enumerate(np.array(self.left)[-1::-1]):\n if axis == self.upperleft:\n continue\n\n self.grid[axis].set_ylabel(labels[i]) ...
[ "0.74469244", "0.7321837", "0.71329755", "0.6982967", "0.69237155", "0.6871938", "0.68706954", "0.6775638", "0.6770592", "0.6700989", "0.66515356", "0.65972894", "0.65836906", "0.6577489", "0.65749097", "0.65650004", "0.6554174", "0.64688015", "0.64659935", "0.6461271", "0.64...
0.6578481
13
draws x and y coordinates on axes
def drawPoints(t, t1): t.pu() t.back(20) t.left(90) t.pd() for idx in range(0, 10): t.write(idx*10, font = ("Arial", 10, "bold")) t.pu() t.fd(55) idx += 1 t.pu() t.back(550) t.rt(90) t.fd(20) t1.pu() t1.back(20) t1.right(90)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw_coordinate_axes(self):\n scale = 5.0\n glPushMatrix()\n\n glScalef(scale, scale, scale)\n origin = [0, 0, 0]\n\n xaxis = [1, 0, 0]\n yaxis = [0, 1, 0]\n zaxis = [0, 0, 1]\n\n glLineWidth(3.0)\n\n glBegin(GL_LINES)\n glColor3f(1, 0, 0)\n...
[ "0.7462337", "0.74149925", "0.70037955", "0.6740668", "0.6733239", "0.66263473", "0.66040045", "0.65666825", "0.65639985", "0.6563444", "0.65386814", "0.64765435", "0.6462639", "0.639198", "0.6355535", "0.6331006", "0.63136154", "0.63136154", "0.6299943", "0.6281847", "0.6235...
0.0
-1
writes the index line labels
def drawIndex_income(t0, t1, t2, t3): get_pos0(t0) t0.pd() t0.pencolor("blue") t0.write("Low income", font=("Arial", 10, "bold")) get_pos1(t1) t1.pd() t1.pencolor("red") t1.write("Upper middle income", font=("Arial", 10, "bold")) get_pos2(t2) t2.pd() t2.pencolor("g...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_labels():\n with open('../data/labels.txt', 'w') as labels_file:\n labels = generate_labels()\n labels_file.write('\\n'.join(labels))", "def write_index(self):\n self.Lock = True\n self.file_out.seek(self.index_offset)\n for identifier, offset in self.index.items()...
[ "0.6173543", "0.6039088", "0.5964762", "0.59042156", "0.59042156", "0.58296734", "0.5817695", "0.5804702", "0.57668585", "0.57584053", "0.57584053", "0.56768316", "0.5659284", "0.5642189", "0.5604426", "0.5596976", "0.5569017", "0.5562557", "0.5541356", "0.55324304", "0.55284...
0.5222694
69
draws the reference color lines for the graph
def drawLines_income(t0, t1, t2, t3): t0.pd() t1.pd() t2.pd() t3.pd() t0.pencolor("blue") t0.pensize(3) t1.pensize(3) t2.pensize(3) t3.pensize(3) t1.pencolor("red") t2.pencolor("green") t3.pencolor("gold") t0.rt(90) t1.rt(90) t2.rt(90) t3.r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connect_rug(self):\n for index, value in self.df.loc[\n self.df[f\"highlight_{self.y}\"] == 1\n ].iterrows():\n color = (\n self.fgcolors[0]\n if self.df.loc[index, self.obs] == 0\n else self.fgcolors[1]\n )\n ...
[ "0.64555866", "0.63504744", "0.6338793", "0.6313018", "0.62794095", "0.6252993", "0.6154617", "0.6021198", "0.59559184", "0.5909137", "0.58783704", "0.58506924", "0.5837566", "0.5821018", "0.580766", "0.58066195", "0.5804894", "0.5793253", "0.57698154", "0.5764883", "0.575289...
0.0
-1
draws the reference color lines for the graph
def drawIndexLines_income(t0, t1, t2, t3): t0.pu() t1.pu() t2.pu() t3.pu() t0.rt(90) t0.fd(240) t0.left(90) t0.fd(590) t1.rt(90) t1.fd(240) t1.left(90) t1.fd(570) t2.rt(90) t2.fd(240) t2.left(90) t2.fd(550) t3.rt(90) t3.fd...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connect_rug(self):\n for index, value in self.df.loc[\n self.df[f\"highlight_{self.y}\"] == 1\n ].iterrows():\n color = (\n self.fgcolors[0]\n if self.df.loc[index, self.obs] == 0\n else self.fgcolors[1]\n )\n ...
[ "0.64555866", "0.63504744", "0.6338793", "0.6313018", "0.62794095", "0.6252993", "0.6154617", "0.6021198", "0.59559184", "0.5909137", "0.58783704", "0.58506924", "0.5837566", "0.5821018", "0.580766", "0.58066195", "0.5804894", "0.5793253", "0.57698154", "0.5764883", "0.575289...
0.0
-1
filters data of a country based on income category and prints the information
def filter_income_graph(data, income): MetaDct = data[1] f_MetaDct = {} for idx in MetaDct: if idx != ',': if MetaDct[idx].income == income: f_MetaDct[idx] = MetaDct[idx].country return f_MetaDct
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_filters():\n print(\"Welcome to bikeshare data! \\n\")\n\n # Taksk0.1: Users choose a city, create a list with length=CITY_DATA , \n #in future, it other cities are added codes will updated automatically\n all_cities=list(CITY_DATA)\n for i in range(len(all_cities)):\n message = (\"F...
[ "0.62728596", "0.6063862", "0.6025754", "0.60016996", "0.5907398", "0.5881463", "0.5825462", "0.5820133", "0.58178806", "0.5791944", "0.57916397", "0.5762069", "0.5724475", "0.5720681", "0.5717021", "0.57140505", "0.5703483", "0.5701911", "0.5672757", "0.5659006", "0.56552374...
0.68259215
0
filters data of a country based on region and prints the information
def filter_region_graph(data, region): MetaDct = data[1] f_MetaDct = {} for idx in MetaDct: if idx != ',': if MetaDct[idx].region == region: f_MetaDct[idx] = MetaDct[idx].country return f_MetaDct
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter_plants_by_region_id(region_id, year, host='localhost', area=0.5):\n\n state_dict = {\n 'Alabama':'AL',\n 'Alaska':'AK',\n 'Arizona':'AZ',\n 'Arkansas':'AR',\n 'California':'CA',\n 'Colorado':'CO',\n 'Connecticut':'CT',\n 'Delaware':'DE',\n ...
[ "0.6658499", "0.6410955", "0.6067802", "0.60592765", "0.59279484", "0.58684576", "0.5755931", "0.5714607", "0.5701636", "0.5700606", "0.5656649", "0.56488043", "0.5646425", "0.56458735", "0.56219095", "0.5610873", "0.55914587", "0.5582464", "0.55497396", "0.55327725", "0.5530...
0.7006411
0
returns life expectancy for a particular country
def life_expectancy_graph(country_name): dat = read_data(pre_file_name()) MainDct = dat[0] # MetaDct = dat[1] f_life_expectancy = {} for idx in MainDct: if idx == country_name or MainDct[idx].country_code == country_name: for idx1 in MainDct[idx].values: i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def country(name):\n return location_db().find(name=name)[\"country\"]", "def get_country(self, country):\n if country == \"United Kingdom\": return \"en\"\n if country == \"Portugal\": return \"pt\"\n\n result = self.session.get(\"https://en.ogame.gameforge.com\")\n soup = Beautif...
[ "0.63355774", "0.6262677", "0.62415963", "0.6105801", "0.61056256", "0.5965774", "0.5924412", "0.588456", "0.5835843", "0.58215404", "0.5820278", "0.5803385", "0.5791575", "0.57809955", "0.57630855", "0.57585454", "0.5653031", "0.56394273", "0.5637285", "0.5637285", "0.561691...
0.6759451
0
returns median of a list
def median(thelist): sorted_list = sorted(thelist) length = len(sorted_list) center = length // 2 if length == 1: return sorted_list[0] elif length % 2 == 0: return sum(sorted_list[center - 1: center + 1]) / 2.0 else: return sorted_list[center]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_median(numlist):\n return np.median(numlist)", "def median(input_list):\n input_list_len = len(input_list)\n input_list_sorted = sorted(input_list)\n return (sum(input_list_sorted[input_list_len // 2 - 1:input_list_len // 2 + 1]) / 2.0,\n input_list_sorted[input_list_len // 2])[inp...
[ "0.8717529", "0.8621615", "0.85284036", "0.83887964", "0.82633245", "0.8196827", "0.81896406", "0.8164721", "0.8148955", "0.81398255", "0.8067371", "0.7926967", "0.78812456", "0.78736067", "0.787278", "0.7864398", "0.7838401", "0.7792227", "0.7776677", "0.7775314", "0.7747026...
0.8567872
2