query
stringlengths
9
9.05k
document
stringlengths
10
222k
metadata
dict
negatives
listlengths
30
30
negative_scores
listlengths
30
30
document_score
stringlengths
4
10
document_rank
stringclasses
2 values
Kills a process in the specified container by its pid.
def kill_process_by_pid(duthost, container_name, program_name, program_pid): kill_cmd_result = duthost.shell("docker exec {} kill -SIGKILL {}".format(container_name, program_pid)) # Get the exit code of 'kill' command exit_code = kill_cmd_result["rc"] pytest_assert(exit_code == 0, "Failed to stop progr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def kill(proc_pid: int) -> None:\n\n if not psutil.pid_exists(proc_pid):\n return\n\n process = psutil.Process(proc_pid)\n\n for proc in process.children(recursive=True):\n proc.kill()\n\n process.kill()", "def kill(pid):\n p = psutil.Process(pid)\n\n try:\n p.kill()\n e...
[ "0.7594235", "0.73883384", "0.7273879", "0.7170751", "0.6983642", "0.6978751", "0.67972946", "0.67153394", "0.6704816", "0.670191", "0.66622496", "0.6658885", "0.6534012", "0.6507593", "0.63962173", "0.6331046", "0.627985", "0.6279848", "0.6258508", "0.61772615", "0.6149164",...
0.8116964
0
Gets critical processes of each running container and then stops them from running.
def stop_critical_processes(duthost, containers_in_namespaces): for container_name in containers_in_namespaces.keys(): critical_group_list, critical_process_list, succeeded = duthost.get_critical_group_and_process_lists(container_name) pytest_assert(succeeded, "Failed to get critical group and proce...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stop_containers(self):\n status = []\n for key, container in self.containers.items():\n result = container.stop()\n status.append(result)\n return status", "def multikill(jobs):\n while True:\n container = jobs.get()\n print 'Stopping: {}'.format(co...
[ "0.66603863", "0.6631634", "0.6573061", "0.65001374", "0.63275206", "0.62741464", "0.6124435", "0.60829645", "0.60742784", "0.60734946", "0.6055144", "0.60044444", "0.59588575", "0.59472495", "0.5930051", "0.59020495", "0.58482015", "0.58409953", "0.58220583", "0.58009225", "...
0.7541283
0
Checks the running status of a critical process and starts it if it was not running.
def ensure_process_is_running(duthost, container_name, critical_process): logger.info("Checking whether process '{}' in container '{}' is running...".format(critical_process, container_name)) program_status, program_pid = get_program_info(duthost, container_name, critical_process) if program_status == "RUNN...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_started(f):\n def inner(self, *args, **kwargs):\n if self._proc is None:\n raise ProcessIsNotStartedError('Call start() first to run the process.')\n return f(self, *args, **kwargs)\n\n return inner", "def sanity_check_process(self):\n assert_equals(self.proc.retu...
[ "0.64914674", "0.6290049", "0.6137152", "0.61156064", "0.6086824", "0.6080544", "0.6062005", "0.60556245", "0.6036971", "0.60252786", "0.60154724", "0.5985656", "0.59732026", "0.5906591", "0.5881364", "0.57705176", "0.5750794", "0.5725564", "0.57041353", "0.5658484", "0.56557...
0.6703246
0
Tests the feature of monitoring critical processes with Supervisord. This function will check whether names of critical processes will appear in the syslog if the autorestart were disabled and these critical processes were stopped.
def test_monitoring_critical_processes(duthosts, rand_one_dut_hostname, tbinfo): duthost = duthosts[rand_one_dut_hostname] loganalyzer = LogAnalyzer(ansible_host=duthost, marker_prefix="monitoring_critical_processes") loganalyzer.expect_regex = [] bgp_neighbors = duthost.get_bgp_neighbors() up_bgp_n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_all_critical_processes_running(duthost):\n processes_status = duthost.all_critical_process_status()\n for container_name, processes in processes_status.items():\n if processes[\"status\"] is False or len(processes[\"exited_critical_process\"]) > 0:\n return False\n\n return Tru...
[ "0.60050315", "0.58707285", "0.5794645", "0.5700848", "0.5646718", "0.56395674", "0.56373096", "0.56300026", "0.55925137", "0.5559717", "0.5526887", "0.5450342", "0.54355013", "0.5409043", "0.53710836", "0.5365447", "0.53433454", "0.5327712", "0.53218555", "0.5309269", "0.530...
0.7066844
0
Handles an event from Google Chat.
def on_event(): event = request.get_json() if event['type'] == 'ADDED_TO_SPACE' and not event['space']['singleUserBotDm']: text = 'Thanks for adding me to "%s"!' % (event['space']['displayName'] if event['space']['displayName'] else 'this chat') elif event['type'] == 'MESSAGE': text = 'You said: `%s`' % s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _handle_message(self, msg):\n self.event('message', msg)", "async def chat_message(self, event):\n await self.send_json(\n return_value(\n ACTION_MESSAGE,\n event['label'],\n event['username'],\n MSG_MESSAGE,\n ...
[ "0.6817644", "0.6785778", "0.67772347", "0.66637164", "0.6652283", "0.6635108", "0.6629878", "0.6596984", "0.6595725", "0.65894586", "0.65697", "0.6505295", "0.6475127", "0.6468761", "0.6268854", "0.6266439", "0.6265551", "0.61811304", "0.61544275", "0.6144723", "0.6127072", ...
0.69863856
0
crawl version detail page
def crawl_version(self, response ): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def crawl_version(self, response ):\n hxs = HtmlXPathSelector(response)\n l = ApkcrawlItem()\n l['site'] = self.DOMAIN\n l['is_entry'] = False\n l['entry_url'] = response.url\n l['referer_url'] = response.meta['Referer']\n dw_url = hxs....
[ "0.63782614", "0.60242355", "0.59993327", "0.5960707", "0.59242433", "0.5753812", "0.5729174", "0.57164186", "0.57113385", "0.57076025", "0.5670998", "0.5646596", "0.5636298", "0.56174517", "0.5585795", "0.55813396", "0.5580731", "0.5567092", "0.5563563", "0.5562742", "0.5560...
0.7178498
0
to setup the serial
def serial_configure(): global ser, serial_port, baud_rate ser = serial.Serial(port=serial_port, baudrate=baud_rate)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def configure(self):\n\n # instantiate Serial\n self.serial = serial.Serial()\n\n # set port_path, e.g. '/dev/ttyUSBx' or 'COMx'\n self.serial.port = self.port.device\n\n # set baudrate\n self.serial.baudrate = 115200", "def startSerial(self):\n self.ser.setPort(s...
[ "0.7502032", "0.7475382", "0.73985994", "0.72944075", "0.7272693", "0.7265069", "0.72644913", "0.7252628", "0.72118574", "0.7204738", "0.70823693", "0.7036151", "0.701351", "0.6968142", "0.6956051", "0.6953637", "0.6945648", "0.6918095", "0.68944246", "0.6857792", "0.68575484...
0.755187
0
write data to the serial port
def serial_write(data): global ser if ser.writable(): ser.write(data) else: print 'The serial', ser.portstr, 'cannot be written.'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write(self, data):\n try:\n self.ser.write(data)\n except SerialException as se:\n log.debug('Serial connection write error: {}'.format(se))", "def callback_serial_write(data):\n serial_write(data.data)", "def s_write(self, data):\n self.s.flushOutput()\n\n ...
[ "0.81630594", "0.80540615", "0.7881029", "0.7824442", "0.7810376", "0.751648", "0.74973196", "0.7310529", "0.7077435", "0.7037915", "0.70268804", "0.69697285", "0.6952746", "0.69276315", "0.69109565", "0.68837446", "0.6879014", "0.6873164", "0.68674266", "0.68569225", "0.6817...
0.83398604
0
callback the data from other nodes to send the data to the serial port
def callback_serial_write(data): serial_write(data.data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_to_port(self):\r\n time.sleep(2)\r\n # ser.write(\"R\".encode())\r\n ser.flush()\r\n ser.write(\"{},{},{},{},{}\".format(self.x_Pos, self.y_Pos, self.t_Tap, self.U_on, self.u_off).encode())\r\n # ser.flush()\r\n # while (1 == 1):\r\n # mydata = ser.read...
[ "0.6939543", "0.6795807", "0.64241874", "0.63476616", "0.6309272", "0.63086575", "0.62675285", "0.6225042", "0.62194127", "0.6210827", "0.61637396", "0.6115734", "0.61109614", "0.60984665", "0.6097785", "0.60923123", "0.6089627", "0.60788935", "0.60438436", "0.60179657", "0.5...
0.77764124
0
Setup models using a yaml file.
def _parse_model_yaml(filename: str, cache_path: str = "./", only_models: list = []): model_classes = { "ModelPointResult": ModelPointResult, "E3SMResult": E3SMResult, "ModelResult": ModelResult, } models = [] with open(filename, encoding="utf-8") as fin: yml = yaml.safe_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_models(self):\n pass", "def from_yaml(cls, model: nn.Module, yaml_path: str) -> pl.LightningModule:\n with open(yaml_path, \"r\") as stream:\n kwargs = yaml.full_load(stream)\n\n return cls(model, **kwargs)", "async def parse_files(file):\n data = yaml.full_load(fil...
[ "0.6504775", "0.62138647", "0.6060397", "0.5953606", "0.593114", "0.5856888", "0.58431095", "0.5793045", "0.57484037", "0.5745031", "0.57418203", "0.5699283", "0.5697488", "0.5678073", "0.565447", "0.5651132", "0.56447786", "0.5638887", "0.56302154", "0.56278104", "0.562506",...
0.6557022
0
Initialize regions from a list of files. If the file is a netCDF4 file, see documentation in ILAMB.Regions.addRegionNetCDF4 for details on the required format. If the file defines regions by latitude/longitude bounds,
def InitializeRegions(filenames): r = Regions() for filename in filenames: try: r.addRegionNetCDF4(filename) except IOError: for line in open(filename): line = line.strip() if line.startswith("#"): continue ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def regions(self, regions):\n self._regions = regions", "def regions_json(self, filename):\n with open(filename) as f:\n return json.load(f)", "def region_sets(self,listA,listB):\n self.setA = GenomicRegionSet('for Unit Test')\n for i in range(len(listA)):\n s...
[ "0.54368967", "0.53201807", "0.5301353", "0.52812773", "0.52472156", "0.5246766", "0.52234083", "0.5199782", "0.51561546", "0.5147067", "0.51182", "0.5094066", "0.5069232", "0.50500077", "0.50438225", "0.50415534", "0.5031607", "0.50041217", "0.4959583", "0.4860921", "0.48386...
0.8397926
0
Match relationship strings to confrontation longnames We allow for relationships to be studied by specifying the confrontation longname in the configure file. This routine loops over all defined relationships and finds the matching
def MatchRelationshipConfrontation(C): for c in C: if c.relationships is None: continue for i, longname in enumerate(c.relationships): found = False for cor in C: if longname.lower() == cor.longname.lower(): c.relationships[i] =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def aliases():\n fetch(\"PropertyValueAliases.txt\")\n longforms = {}\n shortforms = {}\n re1 = re.compile(r\"^ *sc *; *(\\w+) *; *(\\w+)\")\n for line in fileinput.input(os.path.basename(\"PropertyValueAliases.txt\")):\n m = re1.match(line)\n if m:\n l = m.group(2).strip()\...
[ "0.5251251", "0.51409334", "0.5118547", "0.5037175", "0.48835567", "0.48792756", "0.48496848", "0.48371544", "0.48145798", "0.47993568", "0.47886267", "0.478121", "0.477545", "0.47701767", "0.47669485", "0.47644505", "0.47253665", "0.47043443", "0.46920362", "0.46716207", "0....
0.6658877
0
Filter the confrontation list Filter the confrontation list by requiring that at least one string in the input list is found in the longname in the confrontation.
def FilterConfrontationList(C, match_list): if len(match_list) == 0: return C Cf = [] for c in C: for match in match_list: if match in c.longname: Cf.append(c) return Cf
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filterOptions(self, phrases,columnlist):\n filtered=[]\n for col in columnlist:\n outerFlag = False\n for phrase in phrases:\n innerFlag = True\n for word in phrase:\n if word.lower() not in col.lower(): innerFlag = False #Req...
[ "0.55624855", "0.5556644", "0.5488531", "0.5487332", "0.5396422", "0.53796864", "0.5376475", "0.5344204", "0.53110975", "0.5307276", "0.5284656", "0.5221346", "0.5193259", "0.51646155", "0.51581734", "0.51564103", "0.515474", "0.5128293", "0.5125139", "0.51216435", "0.5115838...
0.71710867
0
Build the local work list We enumerate a list of work by taking combinations of model results and confrontations. This list is partitioned evenly among processes preferring to cluster as many confrontations with the same name together. While the work of the modelconfrontation pair is local, some postprocessing operatio...
def BuildLocalWorkList(M, C, skip_cache=False): # Evenly divide up the work among processes W = [] for c in C: for m in M: if skip_cache: # if we want to skip we have to check that it is complete fname = os.path.join(c.output_path, "%s_%s.nc" % (c.name, m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_jobs(self):\n transfer_args = [\"analysis_type\", \"perturbation\", \"num_permutations\", \"permutation_test_statistic\", \"loss_function\",\n \"importance_significance_level\", \"window_search_algorithm\", \"window_effect_size_threshold\"]\n jobs = [None] * self.num...
[ "0.65056163", "0.59641254", "0.58698577", "0.5781452", "0.57523876", "0.5686134", "0.5646858", "0.5626994", "0.55809736", "0.55707514", "0.5558195", "0.5529818", "0.5523977", "0.54760325", "0.54511636", "0.544978", "0.54483527", "0.5433698", "0.541245", "0.5412281", "0.541018...
0.7125748
0
Performs the confrontation analysis For each modelconfrontation pair (m,c) in the input work list, this routine will call c.confront(m) and keep track of the time required as well as any exceptions which are thrown.
def WorkConfront(W, verbose=False, clean=False): maxCL = 45 maxML = 20 # Run analysis on your local work model-confrontation pairs for i, w in enumerate(W): m, c = w # if the results file exists, skip this confrontation unless we want to clean if ( os.path.isfile(os...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def race_configs(self, set_of_conf, incumbent, time_left):\n try:\n # Run all in parallel for list of instances\n if \"+LIST\" in self.parallel_options:\n pass\n # Run all in parallel for each instance\n elif \"+EACH\" in self.parallel_options:\n ...
[ "0.5344905", "0.5245108", "0.52268183", "0.5123037", "0.5115325", "0.5104528", "0.5103892", "0.5072254", "0.50613457", "0.5026565", "0.49517033", "0.49497744", "0.49165016", "0.49134296", "0.4913298", "0.49074945", "0.49008757", "0.48872444", "0.48869216", "0.48838073", "0.48...
0.705819
0
Load topics in each document
def load_doc_topics(sentences, doc_topic_file, threshold): articles = [] with open(doc_topic_file) as tfin: for _ in sentences: topic_line = tfin.readline() if not topic_line: break topics = topic_line.strip().split()[2:] topics = set([i fo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_topics():\n\n print \"Importing topics...\"\n\n # Delete all rows in table, so if we need to run this a second time,\n # we won't be trying to add duplicate retailers\n Topic.query.delete()\n\n # Read CSV file\n with open(\"seed_data/topics.csv\") as source_file:\n example_data = ...
[ "0.6795146", "0.6510889", "0.6472034", "0.6415948", "0.6380835", "0.62490463", "0.6152057", "0.61102784", "0.60619843", "0.6046038", "0.6037848", "0.59983027", "0.59766936", "0.59064144", "0.5905826", "0.5894721", "0.58725166", "0.58426875", "0.5809639", "0.58071446", "0.5799...
0.6549768
1
Test case for get_signatures_by_participant_id Find signatures for a given participant
def test_get_signatures_by_participant_id(self): response = self.client.open( "/api/signatures/participantId/{participantId}".format(participantId=789), method="GET", ) self.assert200(response, "Response body is : " + response.data.decode("utf-8"))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_signatures_by_treaty_id(self):\n response = self.client.open(\n \"/api/signatures/treatyId/{treatyId}\".format(treatyId=789), method=\"GET\"\n )\n self.assert200(response, \"Response body is : \" + response.data.decode(\"utf-8\"))", "def test_signature_verification(se...
[ "0.5992688", "0.5418688", "0.5128045", "0.5111674", "0.5020625", "0.5005059", "0.49926904", "0.49825138", "0.49738473", "0.4910678", "0.48967054", "0.48573738", "0.48436248", "0.4799817", "0.479758", "0.47545576", "0.4748388", "0.4745907", "0.47286522", "0.4721382", "0.471772...
0.8612407
0
Test case for get_signatures_by_treaty_id Find signatures for a given treaty
def test_get_signatures_by_treaty_id(self): response = self.client.open( "/api/signatures/treatyId/{treatyId}".format(treatyId=789), method="GET" ) self.assert200(response, "Response body is : " + response.data.decode("utf-8"))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_signatures_by_participant_id(self):\n response = self.client.open(\n \"/api/signatures/participantId/{participantId}\".format(participantId=789),\n method=\"GET\",\n )\n self.assert200(response, \"Response body is : \" + response.data.decode(\"utf-8\"))", "...
[ "0.5862309", "0.52423036", "0.5200505", "0.4969078", "0.49575937", "0.49160743", "0.49044752", "0.48648363", "0.4849643", "0.48465517", "0.48183337", "0.48122507", "0.48097304", "0.48035914", "0.47879618", "0.4747751", "0.47464305", "0.4670562", "0.46660918", "0.46653792", "0...
0.8535999
0
Return a mido MidiFile object as a Music object.
def from_mido(midi: MidiFile, duplicate_note_mode: str = "fifo") -> Music: if duplicate_note_mode.lower() not in ("fifo", "lifo", "close_all"): raise ValueError( "`duplicate_note_mode` must be one of 'fifo', 'lifo' and " "'close_all'." ) def _get_active_track(t_idx, prog...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_midi_mido(\n path: Union[str, Path], duplicate_note_mode: str = \"fifo\"\n) -> Music:\n midi = MidiFile(filename=str(path))\n music = from_mido(midi, duplicate_note_mode=duplicate_note_mode)\n music.metadata.source_filename = Path(path).name\n return music", "def read_midi_pretty_midi(pat...
[ "0.71867836", "0.6908285", "0.6661709", "0.65007734", "0.642033", "0.6383624", "0.6325471", "0.61490107", "0.5922265", "0.5872954", "0.58643275", "0.58064187", "0.5774881", "0.56978434", "0.56695217", "0.5636424", "0.56210345", "0.5599215", "0.55763835", "0.557248", "0.556155...
0.7055736
1
Return the active track.
def _get_active_track(t_idx, program, channel): key = (program, channel) if key in tracks[t_idx]: return tracks[t_idx][key] tracks[t_idx][key] = Track(program, _is_drum(channel)) return tracks[t_idx][key]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def track(self):\n return self._track", "def track(self):\r\n\t\treturn self._track", "def get_active(self):\n return self._active", "def current_track():\n track = sonos.get_current_track_info()\n track[\"title\"] = track[\"title\"][:30]\n track[\"artist\"] = track[\"artist\"][:30]\n ...
[ "0.7342291", "0.7312559", "0.6865959", "0.6812659", "0.6757633", "0.6757633", "0.6757633", "0.6757633", "0.6561503", "0.64777946", "0.64161944", "0.6393138", "0.6377567", "0.6377567", "0.63317627", "0.6324405", "0.62764555", "0.6223306", "0.62065953", "0.6198751", "0.6164824"...
0.7382982
0
Read a MIDI file into a Music object using mido backend.
def read_midi_mido( path: Union[str, Path], duplicate_note_mode: str = "fifo" ) -> Music: midi = MidiFile(filename=str(path)) music = from_mido(midi, duplicate_note_mode=duplicate_note_mode) music.metadata.source_filename = Path(path).name return music
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def readMidi(filename):\n\n global offset, midifile, beatDivision, istart, iend, firstNote, ignorePC\n\n try:\n inpath = file(filename, \"rb\")\n except:\n error(\"Unable to open MIDI file %s for reading\" % filename)\n\n midifile=inpath.read()\n inpath.close()\n\n # Create our stor...
[ "0.72007763", "0.7110877", "0.6797657", "0.66953194", "0.64060044", "0.6127127", "0.61106473", "0.6106201", "0.60049003", "0.5987256", "0.5981461", "0.59282196", "0.5903272", "0.5814258", "0.5620608", "0.5563444", "0.5561799", "0.5535941", "0.5439564", "0.5406577", "0.5363146...
0.7274127
0
Return KeySignature objects parsed from a PrettyMIDI object.
def parse_pretty_midi_key_signatures(midi: PrettyMIDI) -> List[KeySignature]: key_signatures = [] for key_signature in midi.key_signature_changes: is_minor, root = divmod(key_signature.key_number, 12) mode = "minor" if is_minor else "major" key_signatures.append(KeySignature(key_signatur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_pretty_midi_time_signatures(midi: PrettyMIDI) -> List[TimeSignature]:\n time_signatures = []\n for time_signature in midi.time_signature_changes:\n time_signatures.append(\n TimeSignature(\n time_signature.time,\n time_signature.numerator,\n ...
[ "0.6434392", "0.56169873", "0.5462598", "0.5379722", "0.51417625", "0.5103898", "0.5073788", "0.50670236", "0.50498134", "0.50284797", "0.50061375", "0.49872193", "0.49071243", "0.4858278", "0.48134124", "0.48109865", "0.47911757", "0.47787046", "0.4734136", "0.47032773", "0....
0.70688844
0
Return TimeSignature objects parsed from a PrettyMIDI object.
def parse_pretty_midi_time_signatures(midi: PrettyMIDI) -> List[TimeSignature]: time_signatures = [] for time_signature in midi.time_signature_changes: time_signatures.append( TimeSignature( time_signature.time, time_signature.numerator, time_s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_pretty_midi_key_signatures(midi: PrettyMIDI) -> List[KeySignature]:\n key_signatures = []\n for key_signature in midi.key_signature_changes:\n is_minor, root = divmod(key_signature.key_number, 12)\n mode = \"minor\" if is_minor else \"major\"\n key_signatures.append(KeySignatur...
[ "0.6275764", "0.58892244", "0.56374276", "0.5439807", "0.53726083", "0.5303696", "0.52133566", "0.5186812", "0.5159303", "0.51515406", "0.5106171", "0.5092063", "0.5086273", "0.50702435", "0.50627047", "0.50611925", "0.50467014", "0.5000148", "0.49985442", "0.49506718", "0.49...
0.7749801
0
Return Lyric objects parsed from a PrettyMIDI object.
def parse_pretty_midi_lyrics(midi: PrettyMIDI) -> List[Lyric]: return [Lyric(lyric.time, lyric.text) for lyric in midi.lyrics]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_pretty_midi(midi: PrettyMIDI) -> Music:\n key_signatures = parse_pretty_midi_key_signatures(midi)\n time_signatures = parse_pretty_midi_time_signatures(midi)\n lyrics = parse_pretty_midi_lyrics(midi)\n tracks = [parse_pretty_midi_instrument(track) for track in midi.tracks]\n return Music(\n...
[ "0.579488", "0.57255405", "0.56990206", "0.54636896", "0.5429183", "0.5366622", "0.5324203", "0.5315204", "0.530973", "0.52658033", "0.5263701", "0.5239986", "0.52301615", "0.5222857", "0.5179883", "0.50878197", "0.5086503", "0.50251985", "0.4993879", "0.4938465", "0.49205038...
0.76382947
0
Return pretty_midi Note object as a MusPy Note object.
def parse_pretty_midi_note(note: PrettyMIDINote) -> Note: return Note(note.start, note.duration, note.pitch, note.velocity)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_pretty_midi(midi: PrettyMIDI) -> Music:\n key_signatures = parse_pretty_midi_key_signatures(midi)\n time_signatures = parse_pretty_midi_time_signatures(midi)\n lyrics = parse_pretty_midi_lyrics(midi)\n tracks = [parse_pretty_midi_instrument(track) for track in midi.tracks]\n return Music(\n...
[ "0.7293404", "0.69942254", "0.6827884", "0.6659135", "0.66532123", "0.65662116", "0.63545966", "0.6179956", "0.61643726", "0.60831136", "0.6072116", "0.60466844", "0.6038118", "0.6034175", "0.5991713", "0.5982047", "0.59645224", "0.592573", "0.5920061", "0.5893302", "0.588902...
0.8291737
0
Return a pretty_midi Instrument object as a Track object.
def parse_pretty_midi_instrument(instrument: Instrument) -> Track: notes = [parse_pretty_midi_note(note) for note in instrument.notes] return Track( instrument.program, instrument.is_drum, instrument.name, notes )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_pretty_midi(midi: PrettyMIDI) -> Music:\n key_signatures = parse_pretty_midi_key_signatures(midi)\n time_signatures = parse_pretty_midi_time_signatures(midi)\n lyrics = parse_pretty_midi_lyrics(midi)\n tracks = [parse_pretty_midi_instrument(track) for track in midi.tracks]\n return Music(\n...
[ "0.70979977", "0.67129993", "0.6334844", "0.59775984", "0.5868439", "0.58336437", "0.57237566", "0.57043034", "0.5686008", "0.5639041", "0.56086385", "0.5597634", "0.55318654", "0.5401908", "0.5341095", "0.52723014", "0.5243355", "0.5189497", "0.5172072", "0.51548624", "0.512...
0.82236636
0
Return a pretty_midi PrettyMIDI object as a Music object.
def from_pretty_midi(midi: PrettyMIDI) -> Music: key_signatures = parse_pretty_midi_key_signatures(midi) time_signatures = parse_pretty_midi_time_signatures(midi) lyrics = parse_pretty_midi_lyrics(midi) tracks = [parse_pretty_midi_instrument(track) for track in midi.tracks] return Music( met...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_midi_pretty_midi(path: Union[str, Path]) -> Music:\n music = from_pretty_midi(PrettyMIDI(str(path)))\n music.metadata.source_filename = Path(path).name\n return music", "def parse_pretty_midi_note(note: PrettyMIDINote) -> Note:\n return Note(note.start, note.duration, note.pitch, note.veloci...
[ "0.75138265", "0.699276", "0.6874977", "0.6330988", "0.6246224", "0.6216866", "0.6144862", "0.5874559", "0.5869969", "0.5819059", "0.577069", "0.57280064", "0.5703918", "0.5631354", "0.56295305", "0.56104314", "0.5555329", "0.5554144", "0.54706466", "0.5468232", "0.54086155",...
0.8231107
0
Read a MIDI file into a Music object using pretty_midi backend.
def read_midi_pretty_midi(path: Union[str, Path]) -> Music: music = from_pretty_midi(PrettyMIDI(str(path))) music.metadata.source_filename = Path(path).name return music
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def readMidi(filename):\n\n global offset, midifile, beatDivision, istart, iend, firstNote, ignorePC\n\n try:\n inpath = file(filename, \"rb\")\n except:\n error(\"Unable to open MIDI file %s for reading\" % filename)\n\n midifile=inpath.read()\n inpath.close()\n\n # Create our stor...
[ "0.74628115", "0.74228954", "0.6857534", "0.67224663", "0.6683038", "0.63632804", "0.63502365", "0.61848986", "0.600662", "0.5934028", "0.5922902", "0.58740115", "0.58473074", "0.5813015", "0.5729665", "0.57268655", "0.57246566", "0.5720767", "0.571235", "0.564108", "0.562890...
0.7921787
0
Get coin pair's last update values.
def get_last_update(self): return self.ticker.all().order_by('-created').first()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def last_value():\n return blockchain[-1]", "def _sensor_last_update(self):\n return self._cam.get_attributes(self._sensor, self._channel)[3]", "def last_update(self):\r\n request = http.Request('GET', '/metadata/last_update.json')\r\n return request, parsers.parse_json", "def get_las...
[ "0.6684023", "0.6549948", "0.6539229", "0.64661556", "0.64345556", "0.64237624", "0.6400178", "0.63635176", "0.6356073", "0.6334206", "0.62591404", "0.62591404", "0.62342775", "0.6230714", "0.61694074", "0.6158482", "0.61460274", "0.61460274", "0.61460274", "0.61460274", "0.6...
0.6575859
1
Encryption side of RSA
def RSAencrypt(m, e, n): # Fill in the code to do RSA encryption cipher = expMod(m,e,n) return cipher
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encryptRSA(e, n , text):\r\n\r\n cyphertext = pow(text, e, n)\r\n return cyphertext", "def RSAencrypt(m, e, n):\n # Fill in the code to do RSA encryption..............\n c = expMod(m, e, n)\n return c", "def encrypt(string,pub):\r\n string = livingDead.utfE(string)\r\n ...
[ "0.7820726", "0.76457095", "0.73712516", "0.73475", "0.69519633", "0.69093955", "0.6883982", "0.6854707", "0.67996645", "0.67863774", "0.66802704", "0.66376483", "0.6523004", "0.6490789", "0.64670193", "0.64281464", "0.6425686", "0.64016366", "0.6369037", "0.6322007", "0.6318...
0.76603293
1
Responds to client's hello message with modulus and exponent
def clientHelloResp(n, e): status = "105 Hello "+ str(n) + " " + str(e) return status
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clientHello():\r\n status = \"100 Hello message\"\r\n return status", "def clientHello():\r\n status = \"100 Hello\"\r\n return status", "def hello_command(chat, message, args):\n resp = \" , \".join( list(global_coin_dct.keys())[:10] )\n chat.send ( resp )", "def greetting(self):\n ...
[ "0.6477898", "0.6301026", "0.6200309", "0.60795236", "0.5945951", "0.5908613", "0.5788467", "0.5742529", "0.5656317", "0.5648232", "0.56224996", "0.5619446", "0.5573948", "0.5560869", "0.5546332", "0.5518212", "0.55160856", "0.54978067", "0.5474646", "0.54656583", "0.54602605...
0.6583435
0
Responds to session key with nonce
def SessionKeyResp(nonce): status = "113 Nonce "+ str(nonce) return status
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ns_authentication(conn):\n # get RSA key of Bob for decrypting\n rsa_key = rsa.import_key(\"RsaKey.asc\")\n\n # A -- {N_A, A}(K_PB) --> B\n request = rsa.decrypt(rsa_key, conn.recv(1024))\n client_nonce, client_name = request.split(',')\n print(\"Bob: recieved nonce {} from client {}\".format...
[ "0.5793612", "0.5780483", "0.5770326", "0.57409924", "0.57409924", "0.57370645", "0.5552399", "0.55310404", "0.5527948", "0.54812276", "0.5478223", "0.5460246", "0.54412866", "0.54359895", "0.5398782", "0.53968924", "0.5381679", "0.5344254", "0.5343409", "0.5310444", "0.53012...
0.77256626
0
Verifies that the transmitted nonce matches that received from the client.
def nonceVerification(nonce, decryptedNonce): if nonce == decryptedNonce: return "200 OK" else: return "400 Error Detected"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nonceVerification(nonce, decryptedNonce):\r\n if (nonce == decryptedNonce):\r\n status = \"150 OK\"\r\n else:\r\n status = \"400 Error\"\r\n return status", "def nonceVerification(nonce, decryptedNonce):\n #Enter code to compare the nonce and the decryptedNonce. This method\n # s...
[ "0.73665047", "0.72356075", "0.7015631", "0.6736863", "0.64736456", "0.64222115", "0.64045054", "0.64045054", "0.63911307", "0.61404437", "0.6129229", "0.61064225", "0.60114044", "0.59985316", "0.5985546", "0.596006", "0.5935649", "0.5932109", "0.59176725", "0.59117854", "0.5...
0.73254204
1
Increments the line number (iff the command doesn't empty) and returns the label name iff the command is a label
def get_label_name(self): command_type = self.get_type() if command_type == LABEL_COMMAND_TYPE: return self.command[1:-1] # ignores the () at the beginning and the end if command_type != EMPTY_COMMAND_TYPE: # increments the line number if it is not a blank line or a label ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cg_label(self, cmd):\n label = self.makeLabel(cmd)\n self.asm(f\"({label})\")", "def set_label(self, parser):\n name = parser.get_label_name()\n if name is not None:\n self.__add_new_label(name, parser.get_line_number())", "def genLabel(self):\n self._nextlabel...
[ "0.64987636", "0.63438123", "0.6116696", "0.6110091", "0.6109755", "0.6047409", "0.6036808", "0.60035855", "0.59979755", "0.59373593", "0.58965594", "0.5892655", "0.58666533", "0.58657324", "0.58552337", "0.5748353", "0.57148457", "0.5693135", "0.563025", "0.55923706", "0.557...
0.7885451
0
Adds the given classified coreference link to this token. Uses sets for the edge case in which two mentions start/end on the same token and refer to the same entity.
def add_classified_coref(self, entity_id, coref_type): if entity_id not in self.classified_corefs: self.classified_corefs[entity_id] = list() self.classified_corefs[entity_id].append(coref_type)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_reference(self, reference):\n self._references.append(reference)", "def addCascadeClassifier( self, classifier ):\n\n self.cascadeClassifier.append( classifier )", "def addCompartmentReference(self, *args):\n return _libsbml.MultiCompartmentPlugin_addCompartmentReference(self, *arg...
[ "0.5133171", "0.5106569", "0.5021588", "0.5004663", "0.5003422", "0.49816415", "0.49596432", "0.49518082", "0.49288562", "0.49035427", "0.48750427", "0.4860708", "0.4857157", "0.4837521", "0.47606665", "0.4743229", "0.4738761", "0.4738425", "0.47250968", "0.4719247", "0.47150...
0.6466837
0
Distance in tokens between the two given tokens.
def token_distance_between_tokens(t1, t2): assert t1.document.id == t2.document.id # If t1 comes after t2, flip variables if t1.key() > t2.key(): temp = t1 t1 = t2 t2 = temp assert t1.sentence_idx <= t2.sentence_idx,\ "wrong order for tokens, t1 should appear before ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getTokenDistance(self,n1,n2):\n txt = self.getText()\n if( n1 < n2 ):\n start = n1.getSpan()[1]+1\n end = n2.getSpan()[0]\n direction = 1\n else:\n start = n2.getSpan()[1]+1\n end = n1.getSpan()[0]\n direction = -1\n\n ...
[ "0.8172838", "0.8170361", "0.797784", "0.703881", "0.6943071", "0.6893108", "0.68514365", "0.6758776", "0.6743447", "0.6735663", "0.6735647", "0.6726448", "0.66758597", "0.66699535", "0.6649276", "0.6644578", "0.6642823", "0.6636252", "0.6635442", "0.66315943", "0.6617269", ...
0.84209156
0
Generate a csd file and run csound binary.
def __run_csound(self, output="soundcard", **keywords): if output == "soundcard": self.__options = '-+rtaudio=portaudio -iadc -odac'\ '--env:CSNOSTOP=yes -d' elif output == "aif": self.output_filename = "" if "output_filename" in keywords:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main() :\n #fname = '/reg/d/psdm/CXI/cxi35711/hdf5/cxi35711-r0009.h5'\n #dsname = '/Configure:0000/Run:0000/CalibCycle:0000/CsPad::ElementV2/CxiDs1.0:Cspad.0/data'\n #event = 1\n\n fname = '/reg/d/psdm/CXI/cxi37411/hdf5/cxi37411-r0039.h5'\n dsname = '/Configure:0000/Run:0000/CalibCycle:0000/C...
[ "0.57365423", "0.56186944", "0.5574678", "0.54052484", "0.5317253", "0.52900714", "0.52790123", "0.52744895", "0.5264449", "0.52615964", "0.5223979", "0.52151585", "0.5213236", "0.5177866", "0.51607", "0.51448005", "0.51300395", "0.5126232", "0.511879", "0.51059324", "0.51019...
0.6995118
0
Play a csd object to an audio device using csound.
def play(self): self.__run_csound()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def playSound(self,sound):\n sound.play()", "def __run_csound(self, output=\"soundcard\", **keywords):\n if output == \"soundcard\":\n self.__options = '-+rtaudio=portaudio -iadc -odac'\\\n '--env:CSNOSTOP=yes -d'\n elif output == \"aif\":\n ...
[ "0.6269429", "0.61539227", "0.60456085", "0.60092014", "0.58705646", "0.58674836", "0.58287036", "0.58065", "0.5775791", "0.5772024", "0.5744826", "0.57348126", "0.57240963", "0.57236195", "0.56866705", "0.5619659", "0.5597016", "0.5537956", "0.5524896", "0.54886436", "0.5475...
0.6945207
0
Event notification for status of TT API initialization
def ttApiInitComplete(self, api, ex): if ex == None: # Authenticate your credentials self.m_apiInstance = api self.m_apiInstance.AuthenticationStatusUpdate += self.m_apiInstance_AuthenticationStatusUpdate self.m_apiInstance.Start() else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ttApiInitComplete(self, api, ex):\r\n if ex == None:\r\n # Authenticate your credentials\r\n self.m_apiInstance = api\r\n self.m_apiInstance.ConnectionStatusUpdate += self.m_apiInstance_ConnectionStatusUpdate\r\n self.m_apiInstance.Start()\r\n else:\r\n...
[ "0.70743406", "0.6790568", "0.6738581", "0.6448092", "0.6446953", "0.63632447", "0.636227", "0.636227", "0.636227", "0.636227", "0.62812483", "0.6280115", "0.6266628", "0.6266628", "0.6266628", "0.6266628", "0.6266628", "0.6266628", "0.6266628", "0.6266628", "0.6266628", "0...
0.69766164
1
Event notification for status of authentication
def m_apiInstance_AuthenticationStatusUpdate(self, sender, e): if e.Status.IsSuccess: # Add code here to begin working with the TT API # lookup an instrument self.m_req = ttapi.InstrumentLookupSubscription(self.m_apiInstance.Session, ttapi.Dispatcher.Current, ttapi.Produc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def auth_status():\n return jsonify(message='Success')", "def authentication_hook(self):\n pass", "def log(self,):\n if self.request.user.is_anonymous():\n self.fail()\n else:\n self.success()\n if conf.LOGIN_GUARD_FREQUENCY_ALERT_ON:\n self.alert...
[ "0.6546244", "0.64068985", "0.6371182", "0.6233236", "0.6162577", "0.6154374", "0.6154374", "0.61292905", "0.6097179", "0.60832304", "0.6082905", "0.59677386", "0.58977073", "0.5853315", "0.58466977", "0.5838684", "0.5836868", "0.58301914", "0.58274776", "0.58274245", "0.5827...
0.6648712
0
Event notification for order rejected
def m_ts_OrderRejected(self, sender, e): print("Order was rejected. {0}".format(e.Message))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reject_order(self, order: Order) -> None:\n order = self.get_order_by_id(order.id)\n order.status = OrderStatus.REJECT", "def on_reject(self):\n self.state = REJECTED\n self._reject()", "def notify_order(self, order):\n if order.status in [order.Submitted, order.Accepted]...
[ "0.67191875", "0.6414657", "0.6310061", "0.62441266", "0.6221967", "0.6149687", "0.6102177", "0.60119236", "0.6005116", "0.59841263", "0.59712696", "0.59682816", "0.5938891", "0.5916137", "0.5908406", "0.5889702", "0.5884586", "0.587423", "0.58654106", "0.5832374", "0.5827764...
0.84262854
0
Event notification for order deleted
def m_ts_OrderDeleted(self, sender, e): print("Order was deleted.")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_on_delete(sender, instance, **kwargs):\n print('delete signal received!')\n instance.order.update_total()", "def delete_order():", "def process_IN_DELETE(self, event):", "def _notify_delete(self, cuds_object):", "def delete(self):\n\t\tself.eventStatus = 0\n\t\tself.save()\n\n\t\t# DEBUG\n...
[ "0.7320903", "0.7144558", "0.70888317", "0.6968218", "0.6846033", "0.6793754", "0.67498124", "0.6744451", "0.66755277", "0.65774417", "0.6568783", "0.65483284", "0.6547605", "0.65354043", "0.6517537", "0.6498457", "0.6435694", "0.642273", "0.64120275", "0.6386343", "0.6384293...
0.8613235
0
Event notification for order update
def m_ts_OrderUpdated(self, sender, e): print("Order was updated with price of {0}.".format(e.NewOrder.LimitPrice))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_order(self, order: OrderData):\n pass", "def on_order(self, order: OrderData):\n pass", "def on_order(self, order: OrderData):\n pass", "def on_order(self, order: OrderData):\n # print(\"on_order\")\n # print(order)\n pass", "async def on_order_updated(self,...
[ "0.7422849", "0.7422849", "0.7422849", "0.7419816", "0.7346783", "0.7266439", "0.7264796", "0.72600794", "0.68950796", "0.68950796", "0.67717516", "0.675061", "0.664399", "0.6603995", "0.65769243", "0.65752244", "0.65470064", "0.6507978", "0.6492238", "0.6441022", "0.64278984...
0.75976294
0
Reload tailed file when it be empty be `echo "" > tailed file`, or segmentated by logrotate.
def reload_tailed_file(self): try: self.file_ = open(self.tailed_file, "r") self.size = os.path.getsize(self.tailed_file) # Go to the head of file self.file_.seek(0, 1) return True except: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reloadfile(self, ):\n self.loadfile()", "def reload(self):\n puts('Reloading application...')\n local('touch ../reload.txt')", "def __touch_file(self, filename):\n with open(filename, \"w\") as fd:\n fd.write(\"\")", "def reten_log(path):\n try:\n file = o...
[ "0.5496116", "0.5365522", "0.5315539", "0.5219072", "0.5130373", "0.50021905", "0.49167272", "0.49028563", "0.48842204", "0.4879666", "0.48672494", "0.48587644", "0.4835034", "0.4810866", "0.47951242", "0.4775855", "0.47621876", "0.47413573", "0.47114828", "0.46846318", "0.46...
0.60765505
0
Returns the last nth elements of an iterable. Takes any iterable and returns its lasth nth items from the iterable/list.
def tail(real_iter, n_th): if n_th <= 0: return [] real_list = list(real_iter) start = len(real_list)-n_th if n_th < len(real_list) else 0 return real_list[start:]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tail(iterable, n):\n if n <= 0:\n return []\n return list(deque(iterable, maxlen=n))", "def last(iterable):\n it = iter(iterable)\n item = next(it)\n for item in it:\n pass\n return item", "def last(iterable):\n d = deque(iterable, maxlen=1)\n try:\n return d.po...
[ "0.7215522", "0.72010607", "0.69654405", "0.6728339", "0.6728339", "0.6709735", "0.6709735", "0.6655737", "0.6654847", "0.6652579", "0.6475296", "0.64121884", "0.6400516", "0.6400516", "0.6400516", "0.63796824", "0.6369243", "0.6335024", "0.63328063", "0.6312754", "0.6283235"...
0.74531543
0
Commandline interface for Lookup and Store Tweets utility.
def main(): parser = argparse.ArgumentParser( description="""Lookup and Store Tweets utility. Fetches a tweet from the Twitter API given its GUID. Stores or updates the author Profile and Tweet in the db.""" ) parser.add_argument( "tweetGUIDs", metavar="TWEET_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n parser = argparse.ArgumentParser(\n description=\"\"\"Print the unique terms\n across Tweet messages in the db. Leave\n arguments unset to show all data.\"\"\"\n )\n parser.add_argument(\n \"-s\",\n ...
[ "0.7159391", "0.65968287", "0.647495", "0.6382528", "0.6258441", "0.60681224", "0.6020659", "0.5959111", "0.5951193", "0.59179854", "0.5899511", "0.58682436", "0.5817269", "0.5817269", "0.5794259", "0.57912624", "0.57797056", "0.5652896", "0.56373084", "0.5601479", "0.5573206...
0.8679154
0
Attempt to parse the file passed via the fullpath variable and store its name, size, owner, group, MACtimes, MD5/SHA1/SHA256 hashes and file magic properties in the object's properties.
def __init__(self, fullpath, config, magic): if not fullpath: pass else: try: self.fullpath = str(fullpath) self.name = str(os.path.basename(fullpath)) self.size = str(os.path.getsize(fullpath)) except: r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fromfileobj(cls, fileobj, fullparse=True):\n buf = fileobj.read(_ArInfoStruct.size)\n if not buf:\n return None\n\n if len(buf) < _ArInfoStruct.size:\n raise IOError(\n 'not enough data for header, got %r, needed %r' % (\n len(buf), _ArInfoStruct.size))\n\n name, mti...
[ "0.613472", "0.60383105", "0.57837415", "0.5732807", "0.57275003", "0.5686399", "0.5665344", "0.56623274", "0.5625609", "0.5623765", "0.56035733", "0.5580675", "0.5577045", "0.5569855", "0.55691713", "0.5511871", "0.55117875", "0.54889184", "0.54689986", "0.54666054", "0.5434...
0.7705137
0
Test the basic implementation of the CloudSpannerIndexer by performing a bulk record operation and then perform a resolve and reverse resolve operation and validate the record.
def test_spanner_indexer_implementation_basic(testing_indexer): codec = IdCodec() record = {"org_id": 55555, "string": get_random_string(10)} testing_indexer.record( use_case_id=UseCaseKey.PERFORMANCE, org_id=record["org_id"], string=record["string"] ) with testing_indexer.database.snapsho...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testdata(in_cluster_app):\n indexer = RecordIndexer()\n\n filenames = (\"records.json\", \"authors.json\")\n with mock.patch('invenio_records.api.Record.validate',\n return_value=None):\n records = load_json_from_datadir('records.json')\n for record in records:\n ...
[ "0.6217362", "0.6150693", "0.61358577", "0.61325765", "0.60075575", "0.59117746", "0.58980227", "0.5891623", "0.5869691", "0.58525294", "0.58386457", "0.5832021", "0.57616365", "0.5725619", "0.56743157", "0.5657491", "0.56536514", "0.56528366", "0.5576361", "0.55615735", "0.5...
0.6471547
0
Transform x, y, z values into RGB colors.
def _rgb(x, y, z): rgb = np.array([x, y, z]).T rgb -= rgb.min(0) rgb /= np.maximum(rgb.max(0), 1e-16) # avoid div by zero return rgb
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def int2color_tuple(x):\n red_val = int(1000 * x % 255)\n green_val = int(10000 * x % 255)\n blue_val = int(100000 * x % 255)\n return red_val, green_val, blue_val", "def int2color(x):\n # r = int(1000 * x % 255)\n # g = int(10000 * x % 255)\n # b = int(100000 * x % 255)\n x = 0 if x == 0...
[ "0.67375964", "0.66734827", "0.6468065", "0.6397281", "0.63308555", "0.6318717", "0.62222016", "0.6016022", "0.6011604", "0.601133", "0.5971275", "0.59469557", "0.59302026", "0.58573526", "0.5854485", "0.5842732", "0.5829991", "0.5825446", "0.58073014", "0.5768837", "0.576405...
0.7237567
0
Plot output coming out of a filterbank Each output of each channel is displayed on top of each other.
def plot_filterbank_output(signals, spacing=None, axis=-1): if spacing is None: spacing = signals.max() for k, filtered in enumerate(signals): plt.gca().set_prop_cycle(plt.cycler('color', COLORS[:signals.shape[2]])) if axis == -1: filtered = filtered.T plt.plot(filt...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_filters(self):\n w_mat = np.transpose(self.sess.run(self.W_fc1))\n\n plt.figure(figsize=(10,10), facecolor='w', edgecolor='w')\n plot_positions = [(0,0),(0,1),(1,0),(1,1)]\n for ch in range(self.n_input_channels):\n grid,_ = ia.image_grid_RGB( w_mat,\n ...
[ "0.696584", "0.6820009", "0.6801705", "0.6717546", "0.66050947", "0.6603371", "0.66028434", "0.657813", "0.6559998", "0.6557731", "0.6497254", "0.646631", "0.6366336", "0.63371474", "0.6322068", "0.6281658", "0.6270719", "0.6263176", "0.6262764", "0.6226906", "0.62220496", ...
0.70844704
0
Shortcut to mne topomap...
def topomap(arr, info, colorbar=True, ax=None, **kwargs): if ax is None: fig, ax = plt.subplots(1, 1) else: fig = ax.get_figure() im, _ = mne.viz.plot_topomap(arr, info, axes=ax, show=False, **kwargs) if colorbar: plt.colorbar(im, ax=ax) return fig
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_param_topo(data, raw, label='', save=False):\n\n fig, ax = plt.subplots();\n mne.viz.plot_topomap(data, raw.info, vmin=min(data), vmax=max(data),\n cmap=cm.viridis, contours=0, axes=ax);\n ax.set_title(label)\n\n if save:\n fig.savefig(fp.make_file_path(fp.eeg_to...
[ "0.5831242", "0.54438674", "0.5416737", "0.5354173", "0.5301379", "0.52005386", "0.51901597", "0.5189498", "0.5123944", "0.509844", "0.5075126", "0.50465196", "0.50435305", "0.5011863", "0.50087327", "0.50000113", "0.49979895", "0.49878076", "0.4983216", "0.49669334", "0.4955...
0.6870408
0
Display a series of plot arranged in a topographical grid. Shaded error bars can be displayed, as well as masking for significance portions of data.
def plots_topogrid(x, y, info, yerr=None, mask=None): fig = plt.figure(figsize=(12, 10)) for ax, chan_idx in mne.viz.topo.iter_topography(info, fig_facecolor=(36/256, 36/256, 36/256, 0), axis_facecolor='#333333', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plots(self, events=None, title=None):\n data = self.data\n P = PH.regular_grid(3 , 1, order='columnsfirst', figsize=(8., 6), showgrid=False,\n verticalspacing=0.08, horizontalspacing=0.08,\n margins={'leftmargin': 0.07, 'rightmargin': 0.20, 'topmarg...
[ "0.66317725", "0.6277279", "0.6208335", "0.62032604", "0.6165613", "0.6155122", "0.6143385", "0.6128001", "0.61128426", "0.61028665", "0.6101165", "0.6055709", "0.60526997", "0.605163", "0.60387224", "0.60376817", "0.6016581", "0.60155934", "0.60078317", "0.6004203", "0.59982...
0.6398036
1
Aux function for plot_evoked and plot_evoked_image (cf. docstrings).
def _plot_evoked(evoked, picks, exclude, unit, show, ylim, proj, xlim, hline, units, scalings, titles, axes, plot_type, cmap=None, gfp=False, window_title=None, spatial_colors=False, selectable=True, zorder='unsorted', noise_cov=None, colorbar=True, ma...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_figure(param1, param2):\n return 0", "def plot():\n pass", "def plot(data, interactive=False):\n if interactive:\n plt.ion()\n fig = plt.figure()\n fig.canvas.draw()\n image = call_imshow(data)\n else:\n fig = plt.figure()\n image = call_imshow(dat...
[ "0.584134", "0.56635904", "0.56613547", "0.56530714", "0.5604805", "0.5600472", "0.55803126", "0.5578704", "0.5569163", "0.55405325", "0.55341494", "0.5500229", "0.5495262", "0.54715306", "0.5404543", "0.5403777", "0.54032916", "0.54017043", "0.5396139", "0.5378572", "0.53678...
0.7586209
0
Send a copy of this checklist to another user. The user will have full privledges to edit the copy as if they created it. The list of collaborators will be cleared in the copy.
def copy_to_user(self, user): user_pod = user.profile.get_user_pod() checklist_copy = self checklist_copy.pk = None checklist_copy.collaborators.clear() checklist_copy.save() # Copy all the checklist entries, but don't save the checked # state or any of the optio...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def share_to_user(self, user):\n user_pod = user.profile.get_user_pod()\n user_access = ChecklistCollaborator(collaborator=user_pod,\n checklist=self, is_owner=False)\n user_access.save()", "def share_to_pod(self, pod):\n pod_access = ChecklistCollaborator(collaborator=...
[ "0.7008991", "0.6049264", "0.5767467", "0.5590991", "0.5535513", "0.5390139", "0.5284711", "0.528459", "0.5242129", "0.52361876", "0.5190488", "0.5170636", "0.51653564", "0.5155007", "0.5148186", "0.5112709", "0.5095346", "0.5089433", "0.50647664", "0.5037926", "0.5037926", ...
0.78651154
0
Allow another user to collaborate and edit this checklist
def share_to_user(self, user): user_pod = user.profile.get_user_pod() user_access = ChecklistCollaborator(collaborator=user_pod, checklist=self, is_owner=False) user_access.save()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def grant_access(acl, list_to_edit):\n if request.POST[list_to_edit]:\n datastore_object = None\n if request.POST[list_to_edit].startswith('user'):\n datastore_object = models.UserProfile.load(request.POST[list_to_edit])\n else:\n datastore_object = models.UserGroup.get_by_id(\n ...
[ "0.64323306", "0.6399683", "0.6291311", "0.6280847", "0.62584", "0.61324805", "0.60935944", "0.60280603", "0.59790397", "0.5928688", "0.5861691", "0.57518196", "0.572239", "0.5699769", "0.569584", "0.56881255", "0.56061393", "0.5587332", "0.5572928", "0.55580455", "0.5549621"...
0.69374204
0
Allow members of a pod to collaborate and edit this checklist
def share_to_pod(self, pod): pod_access = ChecklistCollaborator(collaborator=pod, checklist=self, is_owner=False) pod_access.save()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def share_to_user(self, user):\n user_pod = user.profile.get_user_pod()\n user_access = ChecklistCollaborator(collaborator=user_pod,\n checklist=self, is_owner=False)\n user_access.save()", "def set_checklist(twitchid, checklist):\n\twith postgres, postgres.cursor() as cur:\n\...
[ "0.58862025", "0.54586774", "0.5450247", "0.5381605", "0.5343951", "0.53417027", "0.52989644", "0.5273406", "0.52042836", "0.52028114", "0.51963025", "0.5163082", "0.50889975", "0.50594616", "0.5037592", "0.5030231", "0.49922994", "0.49699014", "0.49388188", "0.4938385", "0.4...
0.7478345
0
I define a Hilbert square as the square of a Hilbert number this is necessarily also a Hilbert number. If n is a Hilbert square it has the form n = (4k + 1)^2 = 16k^2 + 18k + 1 for some positive integer k. Solving for k the positive solution is (1 + sqrt(n)) / 4 and to check whether a given n is a Hilbert square we sim...
def is_hilbert_square(n): return ((-1 + math.sqrt(n)) / 4).is_integer()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_hilbert_squarefree_number(n):\n ubound = math.ceil(n / 2)\n for a in range(5, ubound + 1):\n if is_hilbert_square(a) and n % a == 0:\n return False\n return True", "def is_squarefree_hilbert_number(n):\n return is_hilbert_number(n) and is_hilbert_squarefree_number(n)", "def...
[ "0.69106025", "0.6509095", "0.65000796", "0.64386964", "0.63060224", "0.62453693", "0.624494", "0.6242819", "0.62232995", "0.6059235", "0.60231704", "0.5923944", "0.589762", "0.5833704", "0.57629454", "0.5703082", "0.5683065", "0.5657212", "0.5624439", "0.5613452", "0.5601405...
0.741486
0
I define a "Hilbert squarefree" number as a positive integer not divisible by the square of any Hilbert number, i.e. by a Hilbert square.
def is_hilbert_squarefree_number(n): ubound = math.ceil(n / 2) for a in range(5, ubound + 1): if is_hilbert_square(a) and n % a == 0: return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_squarefree_hilbert_number(n):\n return is_hilbert_number(n) and is_hilbert_squarefree_number(n)", "def test_hilbert_schmidt_bell():\n\n rho = bell(0) * bell(0).conj().T\n sigma = bell(3) * bell(3).conj().T\n\n res = hilbert_schmidt(rho, sigma)\n\n np.testing.assert_equal(np.isclose(res, 1),...
[ "0.6906331", "0.6378379", "0.6275413", "0.60586584", "0.596761", "0.5791194", "0.56839705", "0.568294", "0.5670226", "0.5652047", "0.5639736", "0.55902976", "0.55211806", "0.5458681", "0.5457265", "0.54215807", "0.5387775", "0.5375834", "0.5372753", "0.5350709", "0.5317769", ...
0.6687953
1
As defined in the problem a squarefree Hilbert number is a Hilbert number not divisible by the square of any Hilbert number, i.e. by a Hilbert square. It follows that this is just a special case of a Hilbert squarefree number which happens to be a Hilbert number.
def is_squarefree_hilbert_number(n): return is_hilbert_number(n) and is_hilbert_squarefree_number(n)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_hilbert_schmidt_bell():\n\n rho = bell(0) * bell(0).conj().T\n sigma = bell(3) * bell(3).conj().T\n\n res = hilbert_schmidt(rho, sigma)\n\n np.testing.assert_equal(np.isclose(res, 1), True)", "def is_hilbert_squarefree_number(n):\n ubound = math.ceil(n / 2)\n for a in range(5, ubound +...
[ "0.7158092", "0.65389717", "0.62215245", "0.61266196", "0.6052522", "0.5899162", "0.5891928", "0.5792388", "0.5638274", "0.56164706", "0.56087947", "0.56018597", "0.5598933", "0.55459815", "0.5476767", "0.5448168", "0.5437985", "0.54112256", "0.53658", "0.52765197", "0.526465...
0.69611716
1
Gets the query_aggregation of this OrgApacheJackrabbitOakPluginsIndexSolrOsgiSolrQueryIndexProvidProperties.
def query_aggregation(self) -> ConfigNodePropertyBoolean: return self._query_aggregation
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def default_aggregation(self):\n return self._aggregation", "def query_aggregation(self, query_aggregation: ConfigNodePropertyBoolean):\n\n self._query_aggregation = query_aggregation", "def qcs(self):\n return self.aggregation", "def aggregation_mode(self):\n return self._aggrega...
[ "0.6177832", "0.58804446", "0.5828172", "0.56362057", "0.55480313", "0.55212855", "0.55088204", "0.5444749", "0.53425777", "0.53425777", "0.5086791", "0.5081354", "0.5081354", "0.49848765", "0.49755025", "0.49393013", "0.49376535", "0.48601335", "0.48330206", "0.47809017", "0...
0.6685156
0
Sets the query_aggregation of this OrgApacheJackrabbitOakPluginsIndexSolrOsgiSolrQueryIndexProvidProperties.
def query_aggregation(self, query_aggregation: ConfigNodePropertyBoolean): self._query_aggregation = query_aggregation
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, query_aggregation: ConfigNodePropertyBoolean=None): # noqa: E501\n self.openapi_types = {\n 'query_aggregation': ConfigNodePropertyBoolean\n }\n\n self.attribute_map = {\n 'query_aggregation': 'query.aggregation'\n }\n\n self._query_aggre...
[ "0.63335896", "0.59793025", "0.5388339", "0.5109473", "0.4781185", "0.47073928", "0.46714377", "0.4661912", "0.4658944", "0.4543149", "0.45253658", "0.4478338", "0.44678202", "0.44193915", "0.4408298", "0.43967706", "0.43919444", "0.4351036", "0.4351036", "0.4351036", "0.4326...
0.75618315
0
Write a frame to the PN532 with the specified data bytearray.
async def _write_frame(self, data): assert data is not None and 1 < len(data) < 255, 'Data must be array of 1 to 255 bytes.' # Build frame to send as: # - Preamble (0x00) # - Start code (0x00, 0xFF) # - Command length (1 byte) # - Command length checksum # - Com...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _send_frame(self, dest, data):\n self._log.debug(\"write {} to {}\".format(len(data), dest)) \n # send to endpoint\n self._conn.sendto(data, (dest,0))", "def send_frame(self, frame: np.ndarray) -> None:\n self.sink.putFrame(frame)", "def write_raw(self, offset, size, byte...
[ "0.6591934", "0.6176296", "0.6060436", "0.60490686", "0.604511", "0.60127544", "0.5998665", "0.5916844", "0.5904647", "0.58347297", "0.5802935", "0.5795547", "0.5791357", "0.5784142", "0.57540166", "0.57194185", "0.57152283", "0.5702844", "0.5691807", "0.5690694", "0.56848675...
0.75798
0
Read a response frame from the PN532 and return the data inside the frame, otherwise raises an exception if there is an error parsing the frame.
async def _read_frame(self): # Read the Frame start and header response = await self.sreader.read(len(_FRAME_START)+2) if self.debug: print('_read_frame: frame_start + header:', [hex(i) for i in response]) if len(response) < (len(_FRAME_START) + 2) or response[:-2] != _FRAME...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _read_frame(self, length):\n # Read frame with expected length of data.\n response = self._read_data(length+8)\n # Check frame starts with 0x01 and then has 0x00FF (preceeded by optional\n # zeros).\n if not (PN532_ACK_FRAME == response.tostring()):\n if response[0...
[ "0.7911231", "0.68367535", "0.67801416", "0.6649691", "0.6594188", "0.6514123", "0.6473988", "0.63592666", "0.63119334", "0.6238021", "0.6228184", "0.612759", "0.6042", "0.6012966", "0.5944504", "0.59407514", "0.5890006", "0.5841412", "0.5838734", "0.57812756", "0.57773536", ...
0.7371322
1
Call PN532 GetFirmwareVersion function and return a tuple with the IC, Ver, Rev, and Support values.
async def get_firmware_version(self): if self.debug: print("Sending GET_FIRMWARE_VERSION") response = await self.call_function(_COMMAND_GETFIRMWAREVERSION) if response is None: raise RuntimeError('Failed to detect the PN532') return tuple(response)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_firmware_version(self):\n response = self.call_function(PN532_COMMAND_GETFIRMWAREVERSION, 4)\n if response is None:\n raise RuntimeError('Failed to detect the PN532! Make sure there is sufficient power (use a 1 amp or greater power supply), the PN532 is wired correctly to the devi...
[ "0.8383279", "0.70136064", "0.6901685", "0.6832645", "0.68010277", "0.67757726", "0.67624825", "0.66910803", "0.66849124", "0.6675665", "0.66713864", "0.6624939", "0.65809184", "0.6578045", "0.6573857", "0.6554044", "0.6548348", "0.6521392", "0.6483671", "0.6468917", "0.64019...
0.8340494
1
Create record based on dump.
def create(cls, dump, model, pid_provider, legacy_id_key="legacy_recid"): record = cls.create_record( dump, model, pid_provider, legacy_id_key=legacy_id_key ) return record
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def import_record(dump, model, pid_provider, legacy_id_key='legacy_recid'):\n record = CDSRecordDumpLoader.create(dump, model, pid_provider,\n legacy_id_key)\n return record", "def create_record(\n cls, dump, model, pid_provider, legacy_id_key=\"legacy_recid\"\...
[ "0.66808456", "0.64660925", "0.6414154", "0.6237459", "0.61153007", "0.6107426", "0.60517985", "0.6026747", "0.60184544", "0.59121484", "0.58925533", "0.5860535", "0.57873356", "0.57572144", "0.57391846", "0.5713098", "0.5709929", "0.5707047", "0.57047224", "0.5702121", "0.56...
0.7232181
0
Create a new H2OMojoPipeline object.
def __init__(self, mojo_path=None): assert_is_type(mojo_path, str) self.pipeline_id = h2o.lazy_import(mojo_path)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create(self, params):\n return self.make_client_call('create_pipeline', params)", "def _create_pipeline(self) -> codepipeline.Pipeline:\n source_output = codepipeline.Artifact()\n build_output = codepipeline.Artifact()\n return codepipeline.Pipeline(\n self,\n ...
[ "0.54887015", "0.5431586", "0.53815955", "0.5274971", "0.5268092", "0.51779526", "0.5162874", "0.51473457", "0.51473457", "0.5105957", "0.51048774", "0.5086567", "0.50687826", "0.5026436", "0.5005777", "0.5003951", "0.4977895", "0.4975631", "0.49752188", "0.49669024", "0.4947...
0.5715482
0
Transform H2OFrame using a MOJO Pipeline.
def transform(self, data, allow_timestamps=False): assert_is_type(data, H2OFrame) assert_is_type(allow_timestamps, bool) return H2OFrame._expr(ExprNode("mojo.pipeline.transform", self.pipeline_id[0], data, allow_timestamps))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transform(self):", "def transform(self, X, y=None):\n if isinstance(X, pd.DataFrame):\n self.input_feature_names = list(X.columns.values)\n else:\n self.input_feature_names = range(X.shape[1])\n\n try:\n X_t = self._component_obj.transform(X)\n exc...
[ "0.56691414", "0.5484204", "0.546912", "0.54253453", "0.54253453", "0.5413512", "0.5401586", "0.5385252", "0.5352582", "0.53486073", "0.5344554", "0.5335225", "0.53221405", "0.53099495", "0.53099495", "0.53099495", "0.53099495", "0.53099495", "0.53099495", "0.53099495", "0.52...
0.65737706
0
Returns True if a MOJO Pipelines can be used, or False otherwise.
def available(): if "MojoPipeline" not in h2o.cluster().list_core_extensions(): print("Cannot use MOJO Pipelines - runtime was not found.") return False else: return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_pipeline(self):\n try:\n self.pipeline\n except ObjectDoesNotExist:\n return False\n return True", "def object_is_valid_pipeline(o):\n return (o is not None and\n hasattr(o, 'fit') and\n hasattr(o, 'predict') and\n hasattr(o, '...
[ "0.7181306", "0.68237203", "0.68237203", "0.62587774", "0.5783049", "0.56866866", "0.55988234", "0.557575", "0.556847", "0.5561854", "0.55441844", "0.55331135", "0.55168414", "0.5497436", "0.5484721", "0.5459499", "0.5436395", "0.5426926", "0.54092866", "0.5388678", "0.53692"...
0.7400519
0
Calculate tags for block f
def tag_block(sk, f): Lf = poly(sk, ID(f)) return [(m, Lf(m)) for m in f]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tags():", "def tagger():", "def fBlock(self, tag, atts, ext, cite, content):\n att = atts\n atts = self.pba(atts)\n o1 = o2 = c2 = c1 = ''\n eat = False\n\n if tag == 'p':\n # is this an anonymous block with a note definition?\n notedef_re = re.compi...
[ "0.64705336", "0.64116955", "0.5861155", "0.56975305", "0.56322396", "0.55625427", "0.5538718", "0.5533639", "0.54622245", "0.5459637", "0.5423566", "0.5419793", "0.5332494", "0.53247684", "0.5243655", "0.5231524", "0.5231357", "0.52239925", "0.52226895", "0.5209414", "0.5186...
0.6780912
0
Performs one time step of delay and sum with output squared and optional autopower removal
def _delayandsum2(data, offsets, ifactor2, steeramp, dr, out): gridsize, numchannels = offsets.shape for gi in nb.prange(gridsize): out[gi] = 0 autopower = 0 for mi in range(numchannels): ind = offsets[gi,mi] r = (data[ind,mi] * (1-ifactor2[gi,mi]) \ ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _delayandsum5(data, offsets, ifactor2, steeramp, out, autopower):\n num, gridsize, numchannels = offsets.shape\n num = out.shape[0]\n for n in nb.prange(num):\n for gi in nb.prange(gridsize):\n out[n,gi] = 0\n autopower[n,gi] = 0\n for mi in range(numchannels):\...
[ "0.6547199", "0.6409391", "0.62618876", "0.60998666", "0.604433", "0.5991839", "0.59466964", "0.583773", "0.58337945", "0.575374", "0.57249326", "0.5713465", "0.5699477", "0.5688308", "0.5684459", "0.56745416", "0.56458735", "0.563563", "0.5573914", "0.5569109", "0.55584323",...
0.6754123
0
Performs one time step of delay and sum with output and additional autopower removal
def _delayandsum5(data, offsets, ifactor2, steeramp, out, autopower): num, gridsize, numchannels = offsets.shape num = out.shape[0] for n in nb.prange(num): for gi in nb.prange(gridsize): out[n,gi] = 0 autopower[n,gi] = 0 for mi in range(numchannels): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _delayandsum2(data, offsets, ifactor2, steeramp, dr, out):\n gridsize, numchannels = offsets.shape\n for gi in nb.prange(gridsize):\n out[gi] = 0\n autopower = 0\n for mi in range(numchannels):\n ind = offsets[gi,mi]\n r = (data[ind,mi] * (1-ifactor2[gi,mi]) \\\...
[ "0.67352915", "0.66215795", "0.6258958", "0.62232596", "0.62021774", "0.6093956", "0.6068358", "0.6067829", "0.6064351", "0.6048427", "0.5927088", "0.5822598", "0.57999045", "0.57832927", "0.5773816", "0.5766974", "0.5763814", "0.57486194", "0.57476956", "0.5696975", "0.56745...
0.663813
1
Check that autoincrement is set
def test_create_autoincrement(self): assert self.tbl.autoincrement
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_auto_primary_key(primary_key: bool, autoincrement: bool) -> bool:\n return primary_key and autoincrement", "def allows_auto_pk_0(self):\n return \"NO_AUTO_VALUE_ON_ZERO\" in self.connection.sql_mode", "def test_create_primary_key(self):\n assert self.tbl.primary_key == 'id'", "def tes...
[ "0.74910057", "0.72842467", "0.63927394", "0.61338866", "0.6066646", "0.590858", "0.5777912", "0.5698253", "0.56545085", "0.56233186", "0.5608615", "0.5602873", "0.555006", "0.54998386", "0.5489398", "0.5324094", "0.5314898", "0.5307153", "0.5299481", "0.52506983", "0.5244367...
0.83544594
0
Check that the primary key is set
def test_create_primary_key(self): assert self.tbl.primary_key == 'id'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_at_least_one_non_primary_key_column_is_required(self):", "def _is_primary_key(self, key):\n return self._in_keys(key, [self._primary_key])", "def isPrimaryKey(self):\n return self._primaryKey", "def is_auto_primary_key(primary_key: bool, autoincrement: bool) -> bool:\n return primar...
[ "0.73497427", "0.72938645", "0.70164466", "0.68960434", "0.6798896", "0.6734466", "0.6569314", "0.6552462", "0.6509637", "0.649902", "0.6493253", "0.6483367", "0.64106566", "0.63929945", "0.6349287", "0.6321919", "0.63124704", "0.61852217", "0.61822706", "0.6166233", "0.61194...
0.78008544
0
Create a table from a dataframe with invalid primary key
def test_create_from_dataframe_invalid_pk(self): self.insert() data = self.tbl.select() Table.create( ':memory:', "Foo_2", data, primary_key='foo', verbose=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_from_dataframe(self):\n self.insert()\n data = self.tbl.select()\n data.index.name = None\n tbl = Table.create(':memory:', \"Foo_2\", data, verbose=True,\n primary_key='id', autoincrement=True)\n self.check(self.idata, tbl.select())", "...
[ "0.70122755", "0.6240976", "0.5970256", "0.58288085", "0.5814808", "0.5806164", "0.57886475", "0.5761608", "0.57509387", "0.57361615", "0.57263535", "0.57180977", "0.57058954", "0.5644984", "0.56399155", "0.5600515", "0.5585946", "0.5584463", "0.5578013", "0.5570829", "0.5570...
0.7885295
0
Make sure columns of selected data are correct
def test_select_columns(self): self.insert() data = self.tbl.select() assert (u'id',) + tuple(data.columns) == self.tbl.columns
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def checkcolumnstest(chosen_columns, chosen_df):\n if not all([item in chosen_columns for item in chosen_df.columns]):\n raise ValueError('Columns do not match')", "def _validate_select_where(self):", "def check_dataframe_columns(df):\r\n if len(set(df.columns).intersection(\r\n set([co...
[ "0.6642385", "0.6529115", "0.65254176", "0.64318526", "0.63331735", "0.63293755", "0.62875336", "0.6256394", "0.6249626", "0.62474394", "0.6246228", "0.62398404", "0.62370926", "0.6211776", "0.6199918", "0.6178329", "0.6175473", "0.6131411", "0.6129696", "0.6118074", "0.61112...
0.66131145
1
Slice the 'name' column
def test_slice_name(self): self.insert() data = self.tbl['name'] assert self.check(self.idata[:, [0, 1]], data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_slice_name_age(self):\n self.insert()\n data = self.tbl['name', 'age']\n assert self.check(self.idata[:, [0, 1, 2]], data)", "def _parse_name(self, row):\n return row[Row.NAME]", "def selectnamesD(data):\n col = []\n for name in list(data):\n if name.startswith...
[ "0.6179476", "0.609669", "0.59634894", "0.5951562", "0.5861409", "0.5848749", "0.5827301", "0.5811795", "0.5532235", "0.55257267", "0.5522946", "0.5519457", "0.55022097", "0.54384655", "0.5419768", "0.54136455", "0.54047114", "0.5385596", "0.5374181", "0.53137845", "0.5299029...
0.69616526
0
Slice the 'name' and 'age' columns
def test_slice_name_age(self): self.insert() data = self.tbl['name', 'age'] assert self.check(self.idata[:, [0, 1, 2]], data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_slice_name_height(self):\n self.insert()\n data = self.tbl['name', 'height']\n assert self.check(self.idata[:, [0, 1, 3]], data)", "def test_slice_name(self):\n self.insert()\n data = self.tbl['name']\n assert self.check(self.idata[:, [0, 1]], data)", "def __g...
[ "0.5757313", "0.5589456", "0.53954035", "0.5333304", "0.5242819", "0.5241939", "0.523282", "0.5213496", "0.51884305", "0.5119584", "0.51125234", "0.510249", "0.50922954", "0.5070483", "0.5070483", "0.50398666", "0.5020621", "0.4948877", "0.49431136", "0.49177396", "0.4915361"...
0.7059597
0
Slice the 'name' and 'height' columns
def test_slice_name_height(self): self.insert() data = self.tbl['name', 'height'] assert self.check(self.idata[:, [0, 1, 3]], data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_slice_name_age(self):\n self.insert()\n data = self.tbl['name', 'age']\n assert self.check(self.idata[:, [0, 1, 2]], data)", "def _split_heightmap(self, height):\n half = height.shape[1] // 2\n self._half = half\n height_s = height[:, half:].copy()\n retu...
[ "0.58323634", "0.5790095", "0.5485147", "0.54781175", "0.54555726", "0.52768624", "0.52592105", "0.52119577", "0.51835126", "0.5169544", "0.5164556", "0.5136708", "0.5108937", "0.5105925", "0.5028075", "0.5022546", "0.5014651", "0.5009921", "0.5007547", "0.4992055", "0.495565...
0.7377698
0
Draws the flowable at the current position. Returns 1 if successful, 0 if it would not fit. Raises a LayoutError if the object is too wide, or if it is too high for a totally empty frame, to avoid infinite loops
def _add(self, flowable, canv, trySplit=0): flowable._frame = self flowable.canv = canv #so they can use stringWidth etc try: if getattr(flowable,'frameAction',None): flowable.frameAction(self) return 1 y = self._y p = self._y1...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw_field(self):\r\n field = self.flowfield.field\r\n w = len(field)\r\n h = len(field[0])\r\n for i in range(h):\r\n for j in range(w):\r\n start = vec(WIDTH / w * j + (WIDTH / w) / 2,\r\n HEIGHT / h * i + (HEIGHT / h) / 2)\r\n ...
[ "0.57587594", "0.5710437", "0.5495651", "0.54298085", "0.5391596", "0.5347224", "0.5313901", "0.5284999", "0.5238841", "0.5237812", "0.52116054", "0.5200706", "0.51906836", "0.5187815", "0.5171811", "0.5153717", "0.5153717", "0.51474476", "0.5114448", "0.5106816", "0.5103047"...
0.7160387
0
Return the result of StraightThrough GumbelSoftmax Estimation. It approximates the discrete sampling via GumbelSoftmax trick and applies the biased ST estimator. In the forward propagation, it emits the discrete onehot result, and in the backward propagation it approximates the categorical distribution via smooth Gumbe...
def st_gumbel_softmax(self,logits, temperature=1.0, mask=None): def convert_to_one_hot(indices, num_classes): batch_size = indices.size(0) indices = indices.unsqueeze(1) one_hot = Variable(indices.data.new(batch_size, num_classes).zero_().scatter_(1, indices.data, 1)) return one_hot e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forward(ctx, input, hard=False, tau=1):\n y_soft = F.gumbel_softmax(input, hard=hard, tau=tau)\n ctx.save_for_backward(y_soft)\n if hard:\n _, k = y_soft.max(-1)\n # this bit is based on\n # https://discuss.pytorch.org/t/stop-gradients-for-st-gumbel-softmax...
[ "0.6129613", "0.5773884", "0.57170004", "0.5701716", "0.56725025", "0.56266636", "0.5604889", "0.5589699", "0.55785275", "0.5558289", "0.55573916", "0.55553615", "0.55537367", "0.5552976", "0.5509168", "0.5507917", "0.5502666", "0.5501879", "0.5494517", "0.54930604", "0.54785...
0.5917856
1
Rotate the particle with the specified quaternion
def rotate(self, quaternion): rot3d = quaternion2rot3d(quaternion) new_pos = np.dot(self.atom_pos, rot3d.T) self.set_atom_pos(new_pos)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rotate_particle(quaternion, particle):\n rot3d = quaternion2rot3d(quaternion)\n new_pos = np.dot(particle.atom_pos, rot3d.T)\n particle.set_atom_pos(new_pos)", "def _rotate_quaternion(self, q):\n self._normalise()\n return self * q * self.conjugate", "def qrotate(points, axis, theta)...
[ "0.82134056", "0.7707563", "0.7365915", "0.6868423", "0.6843226", "0.6843226", "0.6707162", "0.6661263", "0.6577403", "0.65072805", "0.6483651", "0.64052", "0.6382379", "0.625872", "0.6237808", "0.6224393", "0.6223185", "0.62230515", "0.61865306", "0.6170144", "0.61595505", ...
0.7728155
1
Apply one quaternion to rotate the particle.
def rotate_particle(quaternion, particle): rot3d = quaternion2rot3d(quaternion) new_pos = np.dot(particle.atom_pos, rot3d.T) particle.set_atom_pos(new_pos)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _rotate_quaternion(self, q):\n self._normalise()\n return self * q * self.conjugate", "def qrotate(points, axis, theta):\n q = Quaternion.rotator(axis, theta)\n return q.rotate(points)", "def rotate(self, quaternion):\n rot3d = quaternion2rot3d(quaternion)\n new_po...
[ "0.742648", "0.70184314", "0.69919026", "0.6387921", "0.6332647", "0.6332647", "0.63158506", "0.63083833", "0.6297896", "0.62867", "0.62408525", "0.6216354", "0.6193681", "0.61933154", "0.6117962", "0.6105211", "0.60729426", "0.6044815", "0.60123914", "0.6005049", "0.59987664...
0.74978524
0
| Determine whether columns required for model are present | | | Parameters |
def cols_valid(self, df: pd.DataFrame, req_cols: set) -> bool: missing_cols = req_cols.difference(df.columns) if len(missing_cols) > 0: logging.error(f"{missing_cols} columns required but missing") return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validateModelCol(self):\n \n ret = False\n \n dc = self.__args['datacolumn'].upper() \n if \"MODEL\" in dc or dc == 'ALL':\n ret = True\n\n return ret", "def check_ingress_required_columns(self, col_names):\n if not set(col_names).issuper...
[ "0.7059832", "0.69020754", "0.68997234", "0.6710782", "0.6685378", "0.6673751", "0.6636029", "0.6606636", "0.65057397", "0.6429789", "0.6416036", "0.6413662", "0.63903826", "0.63859123", "0.635701", "0.6346165", "0.63181156", "0.63172424", "0.63141006", "0.6310056", "0.628343...
0.7210187
0
| Handle JSON input from
def handle_input(data: dict):
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_post_parse_json(self, *args, **kwargs): # real signature unknown\n pass", "def json_input():\r\n with open (FILE_INPUT,'rb') as file:\r\n data = json.load(file)\r\n return data['input_data'][0]", "def handle_json(self, source, data):\n method, args = json.loads(data)\n ...
[ "0.70950407", "0.68287927", "0.6742673", "0.66795117", "0.6670512", "0.66697115", "0.6558478", "0.65509915", "0.65418804", "0.6433201", "0.6433201", "0.63948315", "0.63470036", "0.6341085", "0.6338429", "0.6327966", "0.6311793", "0.6311509", "0.62809986", "0.62404644", "0.623...
0.7049515
1
set the parent password see above for return values
def setParentPassword(self, loginName, password, parentPassword): return self.talk( 'setParentPassword', data=self.__makeLoginDict(loginName, password, {'parentPassword': parentPassword}))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setpassword(self, pwd):\n pass", "def supportsParentPassword(self):\n return 1", "def supportsParentPassword(self):\n return 0", "def set_password(self,\n\t password,\n\t user='',\n\t shutit_pexpect_child=None,\n\t note=...
[ "0.7428312", "0.7229603", "0.7174573", "0.70755666", "0.7022319", "0.69905794", "0.6961242", "0.6891046", "0.68181294", "0.68058497", "0.6801364", "0.6681342", "0.66777885", "0.66328955", "0.66229224", "0.661012", "0.66090435", "0.6590915", "0.6580868", "0.6573485", "0.655185...
0.80740505
0
Returns true if authenticateParentPassword is implemented and meaningful for this type of account system.
def supportsParentPassword(self): return 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def supportsParentPassword(self):\n return 0", "def needParentPasswordForSecretChat(self):\n assert self.notify.debugStateCall(self, 'loginFSM', 'gameFSM')\n return ((self.isPaid() and self.secretChatNeedsParentPassword) or\n (self.productName == \"Terra-DMC\" and self.isBlue(...
[ "0.7771733", "0.70483446", "0.61206824", "0.601213", "0.597314", "0.5865811", "0.5857642", "0.5809064", "0.57723945", "0.5767289", "0.576245", "0.5725101", "0.57053286", "0.5693508", "0.5664147", "0.5643869", "0.56232405", "0.556442", "0.554237", "0.5501253", "0.54991525", ...
0.77878714
0
try to authenticate the parent password
def authenticateParentPassword(self, loginName, password, parentPassword): try: errorMsg = self.talk( 'authenticateParentPassword', data=self.__makeLoginDict(loginName, parentPassword)) if not errorMsg: re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def supportsParentPassword(self):\n return 0", "def authenticateParentUsernameAndPassword(self, loginName,\n password, parentUsername, parentPassword):\n try:\n errorMsg = self.talk(\n 'authenticateParentUsernameAndPassword',\n ...
[ "0.6867316", "0.68405205", "0.6782865", "0.66011554", "0.65107757", "0.65107757", "0.6459787", "0.6273353", "0.61838025", "0.618137", "0.61560285", "0.6132502", "0.61266404", "0.6102126", "0.6100213", "0.60807824", "0.606326", "0.60573035", "0.60517", "0.6050327", "0.6046415"...
0.713082
0
Returns true if authenticateDelete is implemented for this type of account system
def supportsAuthenticateDelete(self): return 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def supportsAuthenticateDelete(self):\n return 0", "def can_delete(self):\r\n return True", "def has_delete(self) -> bool:\n return \"delete_item\" not in self.__abstractmethods__", "def delete(self) -> bool:\n return False", "def can_delete(self, user):\n raise Return(Fa...
[ "0.82833785", "0.71029663", "0.6869898", "0.6685923", "0.6507987", "0.6434551", "0.6404933", "0.63833934", "0.63833934", "0.637983", "0.63774896", "0.6375034", "0.63659364", "0.63214964", "0.63188094", "0.62679625", "0.6145256", "0.61433226", "0.6097948", "0.60784644", "0.596...
0.833293
0
authenticate the deletion of a toon password can be either the login or parent password
def authenticateDelete(self, loginName, password): try: errorMsg = self.talk( 'authenticateDelete', data=self.__makeLoginDict(loginName, password)) if not errorMsg: return (1, None) # we got an error message; check ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def password(self, oid):\n path = '/users/%s' % oid\n res = self.client.call(path, 'DELETE', data='', token=self.manager.identity.token)\n self.logger.debug('Delete openstack user: %s' % truncate(res))\n return res[0]['server']", "def delete_user():", "def delete_account(self):\n ...
[ "0.6451425", "0.6285882", "0.62433904", "0.61198527", "0.60245466", "0.6017969", "0.5928696", "0.5924422", "0.59240913", "0.591194", "0.59017503", "0.5898238", "0.5867974", "0.5838516", "0.5812316", "0.5768099", "0.57485425", "0.574824", "0.5740634", "0.57393557", "0.57303816...
0.6296443
1
attempt to enable secret friends returns (int success, string error)
def enableSecretFriends(self, loginName, password, parentPassword, enable=1): try: errorMsg = self.talk( 'setSecretChat', data=self.__makeLoginDict(loginName, parentPassword, {'chat': base.cr.secret...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ban_members(_) -> int:\n return 1 << 2", "def ban_members(_) -> int:\n return 1 << 2", "def gotConfig(self, mode, buddylist, permit, deny):\n global screename\n\n # add someone to our deny list?\n self.add_deny([])\n\n # add ourself to our buddy list\n self....
[ "0.53365946", "0.53365946", "0.533039", "0.52818006", "0.52717876", "0.525076", "0.5240876", "0.51357734", "0.5104367", "0.5100963", "0.50816137", "0.5080694", "0.50739574", "0.5067463", "0.5067463", "0.5067463", "0.5066841", "0.5061834", "0.5059237", "0.50575906", "0.5057378...
0.60369754
0
request an email with the password(s) will be sent to the parent/billing email address pass email OR acctName see above for return values
def requestPwdReminder(self, email=None, acctName=None): assert acctName or email assert not (acctName and email) data = {} if email is not None: data['email'] = email else: data['accountName'] = acctName return self.talk('forgotPassword', data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_new_credentials(email,name,password,phone,shop,address,lead_mail,fname,mem_mail,website):\n\n logger.info(\"in send lead mail task\")\n return send_lead_generate(email,name,password,phone,shop,address,lead_mail,fname,mem_mail,website)", "def post(self):\n data = request.get_json()\n ...
[ "0.6841881", "0.6628623", "0.6288016", "0.62840873", "0.6271015", "0.62589604", "0.6153573", "0.6141012", "0.6078745", "0.607204", "0.60646117", "0.60420424", "0.6012701", "0.5960068", "0.594408", "0.59352165", "0.58682066", "0.58344555", "0.5819661", "0.5808795", "0.58048123...
0.695225
0
call this function if you need to show the customer service unconditionally on all errors, or if you have a threshold condition beyond which the CS should always be included. For error codes >= 100, we always add the CS . It might be simpler for the server to add it, but that would waste bandwidth.
def getLastErrorMsg(self, forceCustServNum=0): assert self.response.hasKey('errorCode') assert self.response.hasKey('errorMsg') errCode = self.response.getInt('errorCode') if errCode < 100: # these are 'user-fixable' problems # don't show customer service number ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cspm_generate_errors(self):\n falcon.base_url = \"nowhere\"\n error_checks = True\n tests = {\n \"get_aws_account\": falcon.GetCSPMAwsAccount(ids='12345678', org_ids='12345678', scan_type=\"dry\"),\n \"create_aws_account\": falcon.CreateCSPMAwsAccount(account_id=\"123...
[ "0.5590521", "0.55415136", "0.5518279", "0.53195244", "0.52497345", "0.51600313", "0.50857186", "0.5070088", "0.50446516", "0.5021842", "0.50108415", "0.4976918", "0.4971729", "0.4956799", "0.4908803", "0.49047834", "0.4881775", "0.48686874", "0.48686874", "0.48683083", "0.48...
0.60545075
0
many of the TTAccount API functions accept a login and password separately from the dict of data fields; this function puts the login and password into a dict, the way talk() wants it
def __makeLoginDict(self, loginName, password, data=None): dict = { 'accountName': loginName, 'password': password } if data: dict.update(data) return dict
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def talk(self, operation, data={}):\n self.notify.debug(\"TTAccount.talk()\")\n\n # ensure that data contains nothing but strings\n for key in data.keys():\n data[key] = str(data[key])\n\n # assert that 'data' contains all the required data\n if operation in ('play', '...
[ "0.6449946", "0.62254125", "0.61802137", "0.6176133", "0.6158664", "0.61351776", "0.6084416", "0.6020165", "0.5927958", "0.58847016", "0.58739936", "0.58729804", "0.5862952", "0.58617336", "0.58576334", "0.58512074", "0.5845094", "0.58207804", "0.58185965", "0.5816416", "0.58...
0.7050123
0
Reads timestamped edges from TEDGE or TRIGRAM file. If fformat is TEDGES, the file is expected to contain lines in the format 'v,w,t' each line representing a directed timestamped link from v to w at time t. Semantics of columns should be given in a header file indicating either 'node1,node2,time' or 'source,target,tim...
def readFile(filename, sep=',', fformat="TEDGE", timestampformat="%s", maxlines=sys.maxsize): assert filename is not "" assert (fformat is "TEDGE") or (fformat is "TRIGRAM") with open(filename, 'r') as f: tedges = [] twopaths = [] header = f.readline() head...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _read_data(filename):\n file = open(filename, \"r\")\n timestamps = []\n edges = []\n for line in file:\n # source target weight timestamp\n if line.startswith(\"%\"):\n continue\n spl = line.split()\n if len(spl) == 4:\n ...
[ "0.5643542", "0.5263454", "0.5245172", "0.5223828", "0.51953083", "0.5118582", "0.5024415", "0.49872136", "0.49859223", "0.49453086", "0.49228594", "0.49124497", "0.4909262", "0.48854193", "0.48773578", "0.48752686", "0.4834061", "0.47857538", "0.47823223", "0.47796318", "0.4...
0.75540054
0
Returns a sparse adjacency matrix of the given graph.
def getSparseAdjacencyMatrix( graph, attribute=None, transposed=False ): if (attribute is not None) and (attribute not in graph.es.attribute_names()): raise ValueError( "Attribute does not exists." ) row = [] col = [] data = [] if attribute is None: if transposed: for e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_adjacency_matrix(graph):\n index_1 = [edge[0] for edge in graph.edges()]\n index_2 = [edge[1] for edge in graph.edges()]\n values = [1 for edge in graph.edges()]\n node_count = max(max(index_1)+1,max(index_2)+1)\n A = sparse.coo_matrix((values, (index_1,index_2)),shape=(node_count,node_co...
[ "0.84367096", "0.7462596", "0.73087263", "0.7252109", "0.70754355", "0.70687056", "0.6977054", "0.67258203", "0.6614188", "0.65534407", "0.65310895", "0.6487174", "0.6485998", "0.6404112", "0.63745767", "0.6333204", "0.63214475", "0.63014483", "0.6253786", "0.61940306", "0.61...
0.7993467
1
Computes a betweenness preference matrix for a node v in a temporal network t
def BWPrefMatrix(t, v): g = t.igraphFirstOrder() # NOTE: this might raise a ValueError if vertex v is not found v_vertex = g.vs.find(name=v) indeg = v_vertex.degree(mode="IN") outdeg = v_vertex.degree(mode="OUT") index_succ = {} index_pred = {} B_v = np.zeros(shape=(indeg, o...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def graphite_diffusivity_PeymanMPM(sto, T):\n\n D_ref = 5.0 * 10 ** (-15)\n E_D_s = 42770\n arrhenius = np.exp(E_D_s / pybamm.constants.R * (1 / 298.15 - 1 / T))\n\n return D_ref * arrhenius", "def _gv_linear(self, r, t):\n mv1t = torch.matmul(self.mv1.weight, t.T) # [k, b]\n mv2r = to...
[ "0.5223404", "0.51954705", "0.5171383", "0.5067603", "0.50326186", "0.50253755", "0.50194985", "0.50187266", "0.5015703", "0.49782896", "0.4964868", "0.49395758", "0.49266696", "0.49044478", "0.48894548", "0.48849353", "0.48815522", "0.48638576", "0.483494", "0.48302567", "0....
0.6808063
0
Compute normalized leading eigenvector of T (stationary distribution)
def StationaryDistribution( T, normalize=True ): if sparse.issparse(T) == False: raise TypeError("T must be a sparse matrix") # NOTE: ncv=13 sets additional auxiliary eigenvectors that are computed # NOTE: in order to be more confident to find the one with the largest # NOTE: magnitude, see ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eigCent(A):\n lam,V = np.linalg.eig(A)\n v = V[:,np.argmax(lam)]\n v = v*(1./v[0])\n return v", "def eigen_decomposition(self):\n w, V = linalg.eigh(self.K)\n c = w[::-1]\n if isinstance(self.num_xi, float):\n percent_energy = np.cumsum(c) / np.sum(c)\n ...
[ "0.63621014", "0.60731167", "0.60703546", "0.6055143", "0.60064346", "0.5983342", "0.5969434", "0.5951763", "0.5864421", "0.5854737", "0.5836197", "0.5786266", "0.5784749", "0.57844496", "0.5778393", "0.57458246", "0.5740027", "0.57084", "0.5694568", "0.56834084", "0.5680791"...
0.63609034
1
returns a name map of the first order network of a given temporal network t
def firstOrderNameMap( t ): g1 = t.igraphFirstOrder() name_map = {} for idx,v in enumerate(g1.vs()["name"]): name_map[v] = idx return name_map
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nodes_names_map(self):\n return {nd.name: nd for nd in self.nodes}", "def network_nodes_species(self):\n G, mapping = self.network()\n waste, resources, intmed_products = self.amenities()\n\n node_dict = {}\n\n for nd in G:\n # print(nd)\n if isinstanc...
[ "0.5635408", "0.5502186", "0.5452238", "0.5345376", "0.53148454", "0.52867407", "0.5254655", "0.52260834", "0.5189707", "0.5122431", "0.5104162", "0.5066592", "0.50536513", "0.50393295", "0.4992312", "0.49783757", "0.49571565", "0.49385366", "0.49357855", "0.49116367", "0.490...
0.7500666
0
simulate network per second
def run_per_second(self, t, optimizer=None): state = self.communicate() request_id = [] for index, node in enumerate(self.node): if node.energy < node.energy_thresh: node.request(mc=self.mc, t=t) request_id.append(index) else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def simulate(seconds):\n\n #Grab the start time\n start_time = dt.datetime.now()\n\n # fill list with the start\n times_on_the_second = [start_time + dt.timedelta(seconds=x) for x in range(seconds + 1)]\n\n #end_time = start_time + dt.timedelta(seconds=seconds)\n\n end_time = times_on_the_second[-...
[ "0.6378425", "0.62902105", "0.62184536", "0.61169946", "0.6050985", "0.59987754", "0.59875256", "0.5971938", "0.5902132", "0.58752406", "0.58649117", "0.5851755", "0.57721215", "0.5755982", "0.57346815", "0.5733875", "0.57310426", "0.57169384", "0.57112336", "0.5708329", "0.5...
0.6336854
1
simulate in general. if max_time is not none, simulate_max_time will be called
def simulate(self, optimizer=None, max_time=None, file_name="log/energy_log.csv"): if max_time: t = self.simulate_max_time(optimizer=optimizer, max_time=max_time) else: t = self.simulate_lifetime(optimizer=optimizer, file_name=file_name) return t
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def simulate(self, simtime, szType, iIdLow, iIdHigh):\n self.szType = szType\n self.simtime = simtime\n self.iIdLow = iIdLow\n self.iIdHigh = iIdHigh\n self.logger.debug('SIMULATING:' + str(szType) + ' ' + str(iIdLow) + ' ' + str(iIdHigh)) \n\n self.evAPI.clear()\n self.evSimulate.set()", "...
[ "0.6618822", "0.6558103", "0.64484006", "0.64140296", "0.6325125", "0.6257507", "0.60973597", "0.6043331", "0.5915749", "0.591522", "0.59146374", "0.58853424", "0.58749974", "0.5864296", "0.5852688", "0.58440304", "0.58016527", "0.5764426", "0.5750476", "0.57482576", "0.57477...
0.695851
0