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
Rewrites the given chart form to contain the specified sections with the specified selection and sequence of grid rows. The OpenMRS data
def apply_chart_sections(sections, form_id): clear_form(form_id) for i, (section, rows) in enumerate(sections): if section == '[chart_divider]': section_type = 'CHART_DIVIDER' else: section_type = section[:1] == '[' and 'TILE_ROW' or 'GRID_SECTION...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apply_chart(rows, form_id):\n clear_form(form_id)\n section = None\n sections = []\n section_rows = []\n\n for row in rows:\n if row['section'].strip():\n if section and section_rows:\n sections.append((section, section_rows))\n ...
[ "0.582681", "0.52939534", "0.520395", "0.5163416", "0.493829", "0.49306026", "0.48850742", "0.48303413", "0.4826802", "0.48048308", "0.47388884", "0.47245994", "0.47122568", "0.46966392", "0.46720192", "0.46618867", "0.46472353", "0.46466905", "0.46448147", "0.46368626", "0.4...
0.68147296
0
Construct a UUID from a form name, and issue a warning if we can't guarantee that the UUID will be unique.
def create_uuid_from_form_name(name): prefix = 'buendia-form-' max_uuid_len = 38 max_name_len = max_uuid_len - len(prefix) if len(name) > max_name_len: warnings.warn( "The form name '%s' has been clipped to create a unique form ID. " "Note that if you ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unique_name():\n return \"unique-{0}\".format(uuid.uuid4())", "def _make_uuid(val):\n h = hashlib.md5(val).hexdigest()\n return '{0}-{1}-{2}-{3}-{4}'.format(\n h[:8], h[8:12], h[12:16], h[16:20], h[20:])", "def _make_uuid():\n parts = [Record._hex_string(k) for k in Record.UUID_P...
[ "0.6460092", "0.607166", "0.5990448", "0.5984713", "0.5966258", "0.58876324", "0.58523846", "0.5790417", "0.57737434", "0.5752431", "0.5731897", "0.57279783", "0.57211757", "0.56958586", "0.56851053", "0.5677647", "0.56701744", "0.56419075", "0.5617644", "0.5595147", "0.55831...
0.8673157
0
Adds our custom XSLT as a form resource to a specified form.
def init_form_xslt(form_id): name = db.get('name', 'form', form_id=form_id) + '.xFormXslt' resource_id = get_or_insert('form_resource', form_id=form_id, name=name, value_reference=XSLT_UUID) odb.update('form_resource', resource_id, datatype=XSLT_DATATYPE, preferred...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __call__(self, f):\n tree = f.build_etree(lxml=True)\n return self.xslt(tree)", "def register_form(self):\n f = Form()\n self.forms = f\n return f", "def _wrap_form(self, parent_form_class):\n steptitle = pd_mf(u'Add ${name}',\n map...
[ "0.5907109", "0.55719566", "0.5429003", "0.52172697", "0.52172697", "0.52159405", "0.5176742", "0.51301825", "0.5041286", "0.49964356", "0.49609685", "0.49543098", "0.49127072", "0.49043992", "0.48935682", "0.48888555", "0.48578233", "0.4842559", "0.4827919", "0.48182356", "0...
0.76507133
0
Function to plot caustics and critical curves only from a lenstool output file
def plot_curves_lenstool(label = ' ', courves_file = 'ce.dat', marker = 'm.', \ plt_show = False): # x_ca, y_ca = np.loadtxt( courves_file, usecols=(3, 4), unpack=True ) # x_cc, y_cc = np.loadtxt( courves_file, usecols=(1, 2), unpack=True ) x_cc, y_cc, x_ca, y_ca = \ np.loadtx...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_cc_lenstool(label = \"\", courves_file = \"ce.dat\", marker = \"m.\", \\\n plt_show = False):\n# plt.figure(1, figsize=(8, 8))\n x_cc, y_cc = np.loadtxt( courves_file, usecols=(1, 2), unpack=True )\n plt.plot(x_cc, y_cc, marker, linewidth=3, label = label)\n axis_limit = ma...
[ "0.66343415", "0.6173719", "0.6099056", "0.6095029", "0.5994987", "0.5958192", "0.5914079", "0.5902058", "0.5837987", "0.58171535", "0.5812772", "0.5753694", "0.5752505", "0.575051", "0.57056487", "0.5703317", "0.56875235", "0.5647246", "0.5630262", "0.56169623", "0.5598104",...
0.7240194
0
Function to perform le lens inversion for point images using lenstool for siep model
def make_inversion_lenstool(image_positons, z_source, \ inversion_par_file = 'make_inversion_siep.par'): write_multfile(image_positons, z_source, file_name = 'multfile.in') str_sys = 'lenstool ' + inversion_par_file + ' -n > lenstool.out' os.system(str_sys) ell ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def image_linear_solve(self, kwargs_lens=None, kwargs_source=None, kwargs_lens_light=None, kwargs_ps=None,\n kwargs_extinction=None, kwargs_special=None, inv_bool=False):\n kwargs_lens_i, kwargs_source_i, kwargs_lens_light_i, kwargs_ps_i, kwargs_extinction_i = self.select_kwargs(\n...
[ "0.5948624", "0.58918554", "0.5609994", "0.5546355", "0.551741", "0.5459656", "0.544555", "0.5338137", "0.5329292", "0.5303097", "0.5299854", "0.5298002", "0.52974206", "0.5291227", "0.528998", "0.52847415", "0.5282245", "0.5281448", "0.52803147", "0.52709806", "0.52708787", ...
0.64352655
0
Function to read the information from the lens inversion
def read_inversion_info(file_dic): #print_file_test = open('file_test.txt','w') if not ( check_inversion_files(file_dic) ): print 'error(read_inversion_info): problem with lenstool file names' return 0 file_generate_arcs = file_dic['file_generate_arcs'] info_input_lens = fc.extract...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_versionInfo(self):\n # PROTECTED REGION ID(SdpMasterLeafNode.versionInfo_read) ENABLED START #\n return self.attr_map[\"versionInfo\"]\n # PROTECTED REGION END # // SdpMasterLeafNode.versionInfo_read", "def vector_info(map, layer=1):\n\n s = read_command('v.info', flags='get'...
[ "0.6252344", "0.60093915", "0.58391017", "0.5604386", "0.55758", "0.5565861", "0.5547063", "0.553496", "0.5532512", "0.5514138", "0.5469955", "0.54428107", "0.54428107", "0.54335344", "0.5419203", "0.5415283", "0.5414018", "0.5409991", "0.5399161", "0.5376428", "0.53641146", ...
0.62555957
0
Function to copy files created by lenstool when doing the lens inversion
def copy_inversion_files(count, file_dic): if not ( check_inversion_files(file_dic) ): print 'error(copy_inversion_files): problem with lenstool file names' return 0 results_directory = 'invertion_stat_results' if results_directory[len(results_directory)-1] != '/': results_directory ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy_files():\n\n # Load the Knifey-Spoony dataset.\n # This is very fast as it only gathers lists of the files\n # and does not actually load the images into memory.\n dataset = load()\n\n # Copy the files to separate training- and test-dirs.\n dataset.copy_files(train_dir=train_dir, test_di...
[ "0.6523025", "0.6344673", "0.6288741", "0.62251234", "0.61428165", "0.59110516", "0.5834108", "0.5792642", "0.57791656", "0.57644975", "0.57507217", "0.57469964", "0.5702967", "0.56924915", "0.56767863", "0.5673358", "0.5671553", "0.56674546", "0.5653934", "0.56349367", "0.55...
0.6790143
0
Check if 'file_dic' has all file names created by lenstool inversion
def check_inversion_files(file_dic): patern_dic = {'file_generate_arcs' : "", \ 'file_source' : "", \ 'file_make_inversion' : "", \ 'file_best_fit' : "", \ 'file_chires' : ""} for i in patern_dic.keys(): os.path.isfile(file_dic[i])...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_file_key(self, key):\n return self.fileList.has_key( key )", "def look_for_interesting_files(self, interesting_files):\n self.valid_interesting_files = []\n for i, f in interesting_files.items():\n if f.hash in self.files:\n self.logger.info(\"New interestin...
[ "0.65571046", "0.6245552", "0.6182016", "0.6143626", "0.5964776", "0.5957236", "0.5832945", "0.58005893", "0.57997817", "0.57805616", "0.5777193", "0.5731755", "0.5723365", "0.5716724", "0.57077074", "0.56764257", "0.5674226", "0.567101", "0.5668708", "0.5658607", "0.565218",...
0.783096
0
Merges multiple pose transformation into a single one.
def compose(pose_list: List['PoseTransform']) -> 'PoseTransform': assert isinstance(pose_list, list) pose_composed = pose_list[0] for pose_current in pose_list[1:]: # shrink the poses from the left # assert pose_current._r is not None # assert pose_current._t ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trajectory_transform_inplace(\n trajectories: Trajectories,\n pose_transform_pre: PoseTransform = PoseTransform(),\n pose_transform_post: PoseTransform = PoseTransform()\n):\n for timestamp, sensor_id, pose in flatten(trajectories):\n trajectories[timestamp, sensor_id] = PoseTran...
[ "0.5955306", "0.5702291", "0.5683068", "0.56704146", "0.5589578", "0.5558499", "0.55362827", "0.55318135", "0.5514867", "0.5505334", "0.5487819", "0.54607487", "0.5366189", "0.53568834", "0.5201881", "0.5175245", "0.5163459", "0.5148306", "0.513156", "0.51281685", "0.51208735...
0.62166566
0
Check weekly how many audios are on audios/ folder and compare them with the ones from active episodes. If they don't match, old files will be erased from file system.
def clean_old_data(): logger.info('Cleaning standalone files on disk...') for absolute_path in glob.glob(MEDIA_URL + '*'): file_name = os.path.basename(absolute_path) try: relative_path = os.path.join(AUDIOS_URL, file_name) audio = Audio.objects.get(filename=relative_path...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clear_outdated_files():\n for f in os.listdir(MEDIA_ROOT):\n file_path = os.path.join(MEDIA_ROOT, f)\n if os.path.isfile(file_path) and os.stat(file_path).st_mtime < time.time() - STORE_PDF_DAYS * 86400:\n os.remove(file_path)", "def test_gathering_audio_files(\n requests_mock:...
[ "0.57853544", "0.5690929", "0.5664392", "0.5610824", "0.5600458", "0.55501133", "0.55487", "0.5545681", "0.5527068", "0.551539", "0.55057174", "0.55004257", "0.54957604", "0.54811597", "0.54759616", "0.54462886", "0.5436322", "0.54287493", "0.5410603", "0.5391393", "0.5376709...
0.6824551
0
Returns tuple of (prefixer, cigar) from concatenated bytes or bytearray of data couple made up of qb64 or qb64b versions of pre+sig couple is used for receipts signed by nontransferable prefix keys
def decouple(data, deletive=False): if isinstance(data, bytearray): if not deletive: data = bytearray(data) # make copy so does not delete underlying data elif isinstance(data, memoryview): data = bytearray(data) elif hasattr(data, "encode"): data = bytearray(data.encode...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def receiptize(serder, cigars):\n msg = bytearray(serder.raw) # make copy into new bytearray so can be deleted\n count = len(cigars)\n counter = Counter(code=CtrDex.NonTransReceiptCouples, count=count)\n msg.extend(counter.qb64b)\n for cigar in cigars:\n if cigar.verfer.code not in NonTransD...
[ "0.62424934", "0.5542669", "0.5443137", "0.54294467", "0.5411475", "0.53460675", "0.5343651", "0.53348476", "0.5233715", "0.52283907", "0.51789343", "0.51617414", "0.5113917", "0.5101181", "0.5099668", "0.50989664", "0.50751287", "0.5015005", "0.49649993", "0.49335024", "0.48...
0.5643064
1
Returns tuple of (diger, prefixer, cigar) from concatenated bytes of data triple made up of qb64 or qb64b versions of dig+pre+sig triple is used for escrows of unverified receipts signed by nontransferable prefix keys
def detriple(data, deletive=False): if isinstance(data, bytearray): if not deletive: data = bytearray(data) # make copy so does not delete underlying data elif isinstance(data, memoryview): data = bytearray(data) elif hasattr(data, "encode"): data = bytearray(data.encode...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def receiptize(serder, cigars):\n msg = bytearray(serder.raw) # make copy into new bytearray so can be deleted\n count = len(cigars)\n counter = Counter(code=CtrDex.NonTransReceiptCouples, count=count)\n msg.extend(counter.qb64b)\n for cigar in cigars:\n if cigar.verfer.code not in NonTransD...
[ "0.59490556", "0.57163787", "0.568874", "0.5567074", "0.53856164", "0.53617924", "0.5346915", "0.5208561", "0.5160905", "0.51214534", "0.5071078", "0.5058566", "0.50510925", "0.50303745", "0.49964765", "0.4958071", "0.49414235", "0.48948917", "0.48762637", "0.48682418", "0.48...
0.5746446
1
Returns tuple of (ediger, seal prefixer, seal seqner, seal diger, siger) from concatenated bytes of quintuple made up of qb64 or qb64b versions of quntipuple given by concatenation of edig+spre+ssnu+sdig+sig Quintuple is used for unverified escrows of validator receipts signed by transferable prefix keys
def dequintuple(data, deletive=False): if isinstance(data, bytearray): if not deletive: data = bytearray(data) # make copy so does not delete underlying data elif isinstance(data, memoryview): data = bytearray(data) elif hasattr(data, "encode"): data = bytearray(data.enc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def der_encode_sig(*args):\n if len(args) == 3:\n v,r,s = args\n elif len(args) == 2:\n r,s = args\n elif len(args) == 1 and isinstance(args[0], tuple):\n return der_encode_sig(*args[0])\n b1, b2 = encode(r, 256), encode(s, 256)\n if len(b1) and changebase(b1[0], 256, 16, 1) in ...
[ "0.5695385", "0.55735", "0.55351436", "0.55197185", "0.54943144", "0.54557663", "0.5367111", "0.53460246", "0.5293684", "0.525874", "0.5120647", "0.51052", "0.5043112", "0.5020866", "0.4995694", "0.49167478", "0.48953703", "0.486931", "0.48589715", "0.48508066", "0.4819822", ...
0.5842057
0
Attaches indexed signatures from sigers to KERI message data from serder
def messagize(serder, sigers): msg = bytearray(serder.raw) # make copy into new bytearray so can be deleted count = len(sigers) counter = Counter(code=CtrDex.ControllerIdxSigs, count=count) msg.extend(counter.qb64b) for siger in sigers: msg.extend(siger.qb64b) return msg
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sign(self, ser, pubs=None, verfers=None, indexed=True, indices=None):\n signers = []\n\n if pubs is None and verfers is None:\n raise ValueError(\"pubs or verfers required\")\n\n if pubs:\n for pub in pubs:\n verfer = coring.Verfer(qb64=pub) # needed t...
[ "0.61640406", "0.6049031", "0.5832937", "0.5736155", "0.56054354", "0.5524652", "0.5503666", "0.5503666", "0.5494993", "0.5488414", "0.5487646", "0.54785854", "0.54785854", "0.54529315", "0.54304457", "0.5386635", "0.53319675", "0.52672094", "0.526222", "0.51847607", "0.51506...
0.62060267
0
Attaches receipt couplets from cigars to KERI message data from serder
def receiptize(serder, cigars): msg = bytearray(serder.raw) # make copy into new bytearray so can be deleted count = len(cigars) counter = Counter(code=CtrDex.NonTransReceiptCouples, count=count) msg.extend(counter.qb64b) for cigar in cigars: if cigar.verfer.code not in NonTransDex: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def processReceipt(self, serder, cigars):\n # fetch pre dig to process\n ked = serder.ked\n pre = serder.pre\n sn = self.validateSN(ked)\n\n # Only accept receipt if for last seen version of event at sn\n snkey = snKey(pre=pre, sn=sn)\n ldig = self.db.getKeLast(key...
[ "0.60540575", "0.5497855", "0.5470443", "0.5386283", "0.53155184", "0.51708555", "0.51046216", "0.50711703", "0.5022875", "0.5020001", "0.49990126", "0.49702698", "0.49583417", "0.4947384", "0.4885955", "0.48587453", "0.4841854", "0.48376426", "0.48330155", "0.4831813", "0.48...
0.5677257
1
Create incepting kever and state from inception serder Verify incepting serder against sigers raises ValidationError if not
def __init__(self, serder, sigers, baser=None, estOnly=None): if baser is None: baser = Baser() # default name = "main" self.baser = baser # may update state as we go because if invalid we fail to finish init self.version = serder.version # version dispatch ? ilk...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def incept(self, serder, baser=None, estOnly=None):\n ked = serder.ked\n\n self.verfers = serder.verfers # converts keys to verifiers\n self.tholder = Tholder(sith=ked[\"kt\"]) # parse sith into Tholder instance\n if len(self.verfers) < self.tholder.size:\n raise ValueErro...
[ "0.64526725", "0.5987278", "0.577748", "0.577748", "0.5518548", "0.544609", "0.54313296", "0.54264337", "0.53833765", "0.5310739", "0.5240064", "0.52227974", "0.5171129", "0.5171129", "0.5153432", "0.5115723", "0.5111007", "0.5097314", "0.5086101", "0.5086101", "0.50623405", ...
0.60700977
1
Not original inception event. So verify event serder and indexed signatures in sigers and update state
def update(self, serder, sigers): if not self.transferable: # not transferable so no events after inception allowed raise ValidationError("Unexpected event = {} is nontransferable " " state.".format(serder.ked)) ked = serder.ked if serder.pre != se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def visit_event(self, event):", "def processEvent(self, serder, sigers):\n # fetch ked ilk pre, sn, dig to see how to process\n ked = serder.ked\n try: # see if code of pre is supported and matches size of pre\n Prefixer(qb64b=serder.preb)\n except Exception as ex: # if ...
[ "0.58825916", "0.5870597", "0.57375866", "0.5670131", "0.56471235", "0.56009394", "0.54955006", "0.54233164", "0.54036677", "0.54036677", "0.5375712", "0.536985", "0.53587145", "0.5345918", "0.53280294", "0.5322039", "0.5318959", "0.5305572", "0.5300746", "0.5280813", "0.5257...
0.6506189
0
Returns list of indices of verified signatures for serder, sigers, and verfers. Assigns verfer to appropriate siger based on index If no signatures verify then indices is empty
def verifySigs(self, serder, sigers, verfers): # verify indexes of attached signatures against verifiers for siger in sigers: if siger.index >= len(verfers): raise ValidationError("Index = {} to large for keys for evt = " "{}.".format(sig...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sign(self, ser, pubs=None, verfers=None, indexed=True, indices=None):\n signers = []\n\n if pubs is None and verfers is None:\n raise ValueError(\"pubs or verfers required\")\n\n if pubs:\n for pub in pubs:\n verfer = coring.Verfer(qb64=pub) # needed t...
[ "0.6717316", "0.6151771", "0.52796984", "0.50320876", "0.50144243", "0.48917884", "0.4866052", "0.4866052", "0.48503053", "0.48334152", "0.48267248", "0.47902778", "0.4784266", "0.4755761", "0.4704231", "0.46914202", "0.46710932", "0.46633467", "0.46568474", "0.4644832", "0.4...
0.7790324
0
Returns seal instance of SealLocation if seal validates with respect to Delegator's KEL Location Seal is from Delegate's establishment event Assumes state setup
def validateSeal(self, serder, sigers): # verify seal pointing delegator event seal = SealLocation(**serder.ked["da"]) # seal has pre sn ilk dig (prior dig) ssn = self.validateSN(ked=seal._asdict(), inceptive=False) # get the dig of the delegating event key = snKey(pre=...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def seal_is_valid(self):\n pass", "def seal_is_valid(self):\n pass", "def originator_station(self):\n\n # decide if there is a station code object by looking for something with data type '2' in the character header\n station = None\n if 'entries' in self.character_data_and_pr...
[ "0.56916845", "0.56916845", "0.5233269", "0.5210077", "0.5134602", "0.4966182", "0.4959291", "0.49591467", "0.4955061", "0.49235255", "0.49157986", "0.4899652", "0.4875822", "0.48563623", "0.48374978", "0.47978267", "0.47679374", "0.47646758", "0.47172087", "0.4709853", "0.47...
0.6324356
0
Returns kever for its .pre
def kever(self): return self.kevers[self.pre] if self.pre else None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pre(self):\n return self._pre", "def _pre(self):\n if self.has_state_info(\"pre\"):\n self.get_state_info(\"pre\")", "def getPre(self, key):\n if hasattr(key, \"encode\"):\n key = key.encode(\"utf-8\") # convert str to bytes\n return self.getVal(self.pres,...
[ "0.622895", "0.6032703", "0.59774035", "0.5827482", "0.5770026", "0.5545077", "0.5520615", "0.5514168", "0.5489111", "0.54458153", "0.5374959", "0.53622746", "0.5342642", "0.5333067", "0.53308123", "0.53175205", "0.52981025", "0.52684015", "0.5263971", "0.5234649", "0.5222620...
0.79261106
0
Extract and return instance of klas from input message stream, ims, given stream state, cold, is txt or bny. Inits klas from ims using qb64b or qb2 parameter based on cold.
def _extract(ims, klas, cold=Colds.txt): if cold == Colds.txt: return klas(qb64b=ims, strip=True) elif cold == Colds.bny: return klas(qb2=ims, strip=True) else: raise ColdStartError("Invalid stream state cold={}.".format(cold))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract(ims, klas, cold=Colds.txt):\n if cold == Colds.txt:\n return klas(qb64b=ims, strip=True)\n elif cold == Colds.bny:\n return klas(qb2=ims, strip=True)\n else:\n raise kering.ColdStartError(\"Invalid stream state cold={}.\".format(cold))", "def _ext...
[ "0.7393836", "0.6161766", "0.60212946", "0.5036648", "0.4962556", "0.49097273", "0.49050674", "0.48725376", "0.48496267", "0.48271218", "0.4826651", "0.4779943", "0.47369504", "0.46404096", "0.4578628", "0.45729345", "0.45590144", "0.45401582", "0.4516563", "0.45160306", "0.4...
0.7314105
1
Returns generator to extract and return instance of klas from input message stream, ims, given stream state, cold, is txt or bny. Inits klas from ims using qb64b or qb2 parameter based on cold. Yields if not enough bytes in ims to fill out klas instance.
def _extractor(ims, klas, cold=Colds.txt): while True: try: if cold == Colds.txt: return klas(qb64b=ims, strip=True) elif cold == Colds.bny: return klas(qb2=ims, strip=True) else: raise ColdSt...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _extractor(ims, klas, cold=Colds.txt, abort=False):\n while True:\n try:\n if cold == Colds.txt:\n return klas(qb64b=ims, strip=True)\n elif cold == Colds.bny:\n return klas(qb2=ims, strip=True)\n else:\n ...
[ "0.6694233", "0.6466237", "0.64252573", "0.49541312", "0.4761128", "0.47587705", "0.47249287", "0.4684452", "0.4657043", "0.4604133", "0.4585061", "0.45711762", "0.45441478", "0.4541176", "0.45360443", "0.44985944", "0.4487008", "0.4486855", "0.44756657", "0.44470677", "0.444...
0.6997333
0
Returns generator to process all messages from incoming message stream, ims until ims is exhausted (empty) then returns. If ims not provided then process messages from .ims Must be framed.
def allProcessor(self, ims=None, framed=None, pipeline=None, cloned=None): if ims is not None: # needs bytearray not bytes since deletes as processes if not isinstance(ims, bytearray): ims = bytearray(ims) # so make bytearray copy else: ims = self.ims # use ins...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def processor(self, ims=None, framed=None, pipeline=None, cloned=None):\n if ims is not None: # needs bytearray not bytes since deletes as processes\n if not isinstance(ims, bytearray):\n ims = bytearray(ims) # so make bytearray copy\n else:\n ims = self.ims # ...
[ "0.7280267", "0.7102326", "0.69537127", "0.6921355", "0.683104", "0.64212596", "0.64173454", "0.62354684", "0.6234267", "0.6111383", "0.60373795", "0.60231596", "0.59423566", "0.59377104", "0.5879577", "0.5869029", "0.58453465", "0.57887495", "0.57767475", "0.57554877", "0.57...
0.72718674
1
Returns generator to continually process messages from incoming message stream, ims. Yields waits whenever ims empty. If ims not provided then process messages from .ims
def processor(self, ims=None, framed=None, pipeline=None, cloned=None): if ims is not None: # needs bytearray not bytes since deletes as processes if not isinstance(ims, bytearray): ims = bytearray(ims) # so make bytearray copy else: ims = self.ims # use instan...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allProcessor(self, ims=None, framed=None, pipeline=None, cloned=None):\n if ims is not None: # needs bytearray not bytes since deletes as processes\n if not isinstance(ims, bytearray):\n ims = bytearray(ims) # so make bytearray copy\n else:\n ims = self.ims ...
[ "0.700756", "0.6966016", "0.6814322", "0.6708461", "0.6693279", "0.6355115", "0.6293897", "0.62454695", "0.62085795", "0.61390156", "0.6100407", "0.6096833", "0.6082772", "0.59236246", "0.5892272", "0.5852037", "0.5847334", "0.57978374", "0.5775372", "0.5743881", "0.5727557",...
0.71261346
0
Processes one messages from incoming message stream, ims, when provided. Otherwise process message from .ims Returns once one message is processed. Convenience executor for .processOneGen when ims is not live, i.e. fixed
def processOne(self, ims=None, framed=True, pipeline=False, cloned=False): processor = self.msgProcessor(ims=ims, framed=framed, pipeline=pipeline, cloned=cloned) while True: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def onceProcessor(self, ims=None, framed=None, pipeline=None, cloned=None):\n if ims is not None: # needs bytearray not bytes since deletes as processes\n if not isinstance(ims, bytearray):\n ims = bytearray(ims) # so make bytearray copy\n else:\n ims = self.ims...
[ "0.7242007", "0.70703036", "0.6868827", "0.6346897", "0.62735486", "0.62636673", "0.61458427", "0.609347", "0.6081421", "0.5955616", "0.5667441", "0.56622064", "0.56599474", "0.5658056", "0.5634451", "0.5599328", "0.559667", "0.5510648", "0.5500032", "0.5499807", "0.54659235"...
0.7735895
0
Process one event serder with attached indexd signatures sigers
def processEvent(self, serder, sigers): # fetch ked ilk pre, sn, dig to see how to process ked = serder.ked try: # see if code of pre is supported and matches size of pre Prefixer(qb64b=serder.preb) except Exception as ex: # if unsupported code or bad size raises error ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def escrowPSEvent(self, serder, sigers):\n dgkey = dgKey(serder.preb, serder.digb)\n self.baser.putDts(dgkey, nowIso8601().encode(\"utf-8\"))\n self.baser.putSigs(dgkey, [siger.qb64b for siger in sigers])\n self.baser.putEvt(dgkey, serder.raw)\n self.baser.addPse(snKey(serder.pre...
[ "0.5801406", "0.5788203", "0.56515425", "0.5613044", "0.5594347", "0.552613", "0.543589", "0.53452754", "0.53452754", "0.5310908", "0.52955586", "0.5290748", "0.5268588", "0.5209935", "0.5195028", "0.51864755", "0.51460266", "0.50282323", "0.50171995", "0.49983758", "0.493516...
0.60208696
0
Process one receipt serder with attached cigars
def processReceipt(self, serder, cigars): # fetch pre dig to process ked = serder.ked pre = serder.pre sn = self.validateSN(ked) # Only accept receipt if for last seen version of event at sn snkey = snKey(pre=pre, sn=sn) ldig = self.db.getKeLast(key=snkey) # r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def iap_process_receipt(request, receipt_data):\n #TODO To be safer against botting, the receipt_data uniqueness constraint\n # needs to be done atomically.\n if IapReceipt.objects.filter(receipt_data=receipt_data).exists():\n # Already processed this receipt, fail silently.\n return {'balan...
[ "0.64511675", "0.57518023", "0.56637657", "0.5646546", "0.5638651", "0.53511095", "0.5158841", "0.513468", "0.5132217", "0.5122839", "0.5113863", "0.50558484", "0.5054606", "0.5035284", "0.50253844", "0.5015664", "0.49984384", "0.49896142", "0.49133635", "0.49063286", "0.4904...
0.7087973
0
Process one transferable validator receipt (chit) serder with attached sigers
def processChit(self, serder, sigers): # fetch pre, dig,seal to process ked = serder.ked pre = serder.pre sn = self.validateSN(ked) # Only accept receipt if for last seen version of receipted event at sn ldig = self.db.getKeLast(key=snKey(pre=pre, sn=sn)) # retrieve di...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def processReceipt(self, serder, cigars):\n # fetch pre dig to process\n ked = serder.ked\n pre = serder.pre\n sn = self.validateSN(ked)\n\n # Only accept receipt if for last seen version of event at sn\n snkey = snKey(pre=pre, sn=sn)\n ldig = self.db.getKeLast(key...
[ "0.6120893", "0.60053635", "0.5762552", "0.57545567", "0.5640128", "0.5444942", "0.54322815", "0.5101184", "0.50422645", "0.48721996", "0.48538446", "0.48450714", "0.4840219", "0.48071924", "0.4777253", "0.47126186", "0.4709919", "0.47092924", "0.47066036", "0.47057864", "0.4...
0.68074274
0
Returns Serder instance of establishment event that is authoritative for event in KEL for pre at sn. Returns None if no event at sn accepted in KEL for pre
def fetchEstEvent(self, pre, sn): found = False while not found: dig = bytes(self.db.getKeLast(key=snKey(pre, sn))) if not dig: return None # retrieve event by dig raw = bytes(self.db.getEvt(key=dgKey(pre=pre, dig=dig))) if no...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def processEvent(self, serder, sigers):\n # fetch ked ilk pre, sn, dig to see how to process\n ked = serder.ked\n try: # see if code of pre is supported and matches size of pre\n Prefixer(qb64b=serder.preb)\n except Exception as ex: # if unsupported code or bad size raises...
[ "0.56672543", "0.5404257", "0.48971954", "0.48692295", "0.48692295", "0.48669097", "0.4826327", "0.48007268", "0.471369", "0.47081718", "0.464219", "0.46276948", "0.46178553", "0.46011168", "0.45787987", "0.45098287", "0.4498054", "0.44819015", "0.44767964", "0.44751388", "0....
0.7592613
0
Iterate throush escrows and process any that may now be finalized
def processEscrows(self): try: self.processOutOfOrders() self.processPartials() self.processDuplicitous() self.processUnverifieds() self.processTransUnverifieds() except Exception as ex: # log diagnostics errors etc if logger.isE...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def processOutOfOrders(self):\n\n ims = bytearray()\n key = ekey = b'' # both start same. when not same means escrows found\n while True: # break when done\n for ekey, edig in self.db.getOoeItemsNextIter(key=key):\n try:\n pre, sn = splitKeySN(eke...
[ "0.6159373", "0.6129845", "0.5921065", "0.5890396", "0.5875011", "0.58331853", "0.58125556", "0.57805544", "0.5750868", "0.5697577", "0.56921256", "0.56921256", "0.56921256", "0.56746393", "0.56361175", "0.56291", "0.5611903", "0.55638885", "0.5529908", "0.5520533", "0.551213...
0.7136633
0
Process events escrowed by Kever that were only partially fulfilled. Either due to missing signatures or missing dependent events like a delegating event. But event has at least one verified signature. Escrowed items are indexed in database table keyed by prefix and sequence number with duplicates inserted in insertion...
def processPartials(self): ims = bytearray() key = ekey = b'' # both start same. when not same means escrows found while True: # break when done for ekey, edig in self.db.getPseItemsNextIter(key=key): try: pre, sn = splitKeySN(ekey) # get pre a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def processDuplicitous(self):\n\n ims = bytearray()\n key = ekey = b'' # both start same. when not same means escrows found\n while True: # break when done\n for ekey, edig in self.db.getLdeItemsNextIter(key=key):\n try:\n pre, sn = splitKeySN(eke...
[ "0.70065784", "0.6401681", "0.60382736", "0.59946674", "0.59668094", "0.59222096", "0.5897621", "0.58375144", "0.5800483", "0.57461584", "0.5554043", "0.5480373", "0.5385489", "0.5045128", "0.49993274", "0.4933887", "0.4773634", "0.4772665", "0.4756193", "0.4692416", "0.46727...
0.6658823
1
Process events escrowed by Kever that are recieved outoforder. An event is out of order if its prior event has not been accepted into its KEL. Without the prior event there is no way to know the key state and therefore no way to verify signatures on the outoforder event. Escrowed items are indexed in database table key...
def processOutOfOrders(self): ims = bytearray() key = ekey = b'' # both start same. when not same means escrows found while True: # break when done for ekey, edig in self.db.getOoeItemsNextIter(key=key): try: pre, sn = splitKeySN(ekey) # get pr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def escrowOOEvent(self, serder, sigers):\n dgkey = dgKey(serder.preb, serder.digb)\n self.db.putDts(dgkey, nowIso8601().encode(\"utf-8\"))\n self.db.putSigs(dgkey, [siger.qb64b for siger in sigers])\n self.db.putEvt(dgkey, serder.raw)\n self.db.addOoe(snKey(serder.preb, serder.sn...
[ "0.6505976", "0.62466806", "0.562699", "0.5230825", "0.5203197", "0.51123375", "0.5040182", "0.5024745", "0.4854788", "0.48446405", "0.48441195", "0.48326492", "0.48110798", "0.47943586", "0.47770968", "0.47062552", "0.468944", "0.4622283", "0.46011913", "0.4581933", "0.45364...
0.71986884
0
Process event receipts escrowed by Kever that are unverified. A receipt is unverified if the associated event has not been accepted into its KEL. Without the event there is no way to know where to store the receipt couplets. The escrow is a triple with dig+spre+sig the verified receipt is just the couple spre+sig that ...
def processUnverifieds(self): ims = bytearray() key = ekey = b'' # both start same. when not same means escrows found while True: # break when done for ekey, etriplet in self.db.getUreItemsNextIter(key=key): try: pre, sn = splitKeySN(ekey) # ge...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def processTransUnverifieds(self):\n\n ims = bytearray()\n key = ekey = b'' # both start same. when not same means escrows found\n while True: # break when done\n for ekey, equinlet in self.db.getVreItemsNextIter(key=key):\n try:\n pre, sn = split...
[ "0.7607545", "0.70743537", "0.70411956", "0.70065844", "0.68082356", "0.6804244", "0.6671297", "0.6497898", "0.6110927", "0.5755252", "0.5653231", "0.5566492", "0.5532932", "0.52485937", "0.5022319", "0.48975947", "0.4723111", "0.46914437", "0.46627778", "0.46209508", "0.4551...
0.7752885
0
Process event receipts from transferable identifiers (validators) escrowed by Kever that are unverified. A transferable receipt is unverified if either the receipted event has not been accepted into the receipted's KEL or the establishment event of the receiptor has not been accepted into the receipter's KEL. Without e...
def processTransUnverifieds(self): ims = bytearray() key = ekey = b'' # both start same. when not same means escrows found while True: # break when done for ekey, equinlet in self.db.getVreItemsNextIter(key=key): try: pre, sn = splitKeySN(ekey) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def escrowVREvent(self, serder, sigers, seal, dig):\n # Receipt dig algo may not match database dig. So must always\n # serder.compare to match. So receipts for same event may have different\n # digs of that event due to different algos. So the escrow may have\n # different dup at same ...
[ "0.7645156", "0.7299317", "0.70316255", "0.67586243", "0.6634027", "0.65027106", "0.64949745", "0.6280355", "0.6053464", "0.5679099", "0.5603615", "0.5526197", "0.5304842", "0.5127679", "0.5101728", "0.5100859", "0.50269413", "0.4992622", "0.49695837", "0.49606505", "0.477545...
0.75576824
1
Process events escrowed by Kever that are likely duplicitous. An event is likely duplicitous if a different version of event already has been accepted into the KEL. Escrowed items are indexed in database table keyed by prefix and sn with duplicates given by different dig inserted in insertion order. This allows FIFO pr...
def processDuplicitous(self): ims = bytearray() key = ekey = b'' # both start same. when not same means escrows found while True: # break when done for ekey, edig in self.db.getLdeItemsNextIter(key=key): try: pre, sn = splitKeySN(ekey) # get pr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def escrowLDEvent(self, serder, sigers):\n dgkey = dgKey(serder.preb, serder.digb)\n self.db.putDts(dgkey, nowIso8601().encode(\"utf-8\"))\n self.db.putSigs(dgkey, [siger.qb64b for siger in sigers])\n self.db.putEvt(dgkey, serder.raw)\n self.db.addLde(snKey(serder.preb, serder.sn...
[ "0.66229594", "0.56637406", "0.55947393", "0.5469166", "0.546293", "0.5433174", "0.53357977", "0.5224905", "0.5155415", "0.50186116", "0.5018416", "0.49218225", "0.48862255", "0.48802808", "0.4871392", "0.48571205", "0.48358124", "0.4823262", "0.47916618", "0.47238755", "0.47...
0.6717506
0
Test case for brains_get
def test_brains_get(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_boat(self):\n pass", "def test_get_ban(self):\n pass", "def test_braces_disabled():\n assert get_html(BRACES_TEXT) == \"<p>I am a {{braces}} example.</p>\"", "def test_braces_enabled():\n assert (\n get_html(BRACES_TEXT, enable_braces=True)\n == \"<p>I am a <kbd...
[ "0.6350414", "0.63265574", "0.59365386", "0.585006", "0.582329", "0.57966876", "0.5663279", "0.56321985", "0.5576031", "0.55441236", "0.55272007", "0.5522783", "0.55140954", "0.5508781", "0.5492196", "0.5484934", "0.54773355", "0.5473548", "0.54375875", "0.54056185", "0.54007...
0.6676945
0
Test case for brains_id_get
def test_brains_id_get(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_drugs_id_get(self):\n pass", "def test_cyclingleagues_id_get(self):\n pass", "def test_solareclipses_id_get(self):\n pass", "def test_abbeys_id_get(self):\n headers = { \n 'Accept': 'application/json',\n }\n response = self.client.open(\n ...
[ "0.6912527", "0.6909161", "0.68567973", "0.6686416", "0.6628402", "0.6600647", "0.65321475", "0.6450782", "0.64036804", "0.64028037", "0.6381658", "0.6337959", "0.63372785", "0.63198286", "0.6300265", "0.6294446", "0.6276211", "0.6254238", "0.6249111", "0.6200433", "0.6176115...
0.8097531
0
Create the projection matrix from the current viewing position. elev stores the elevation angle in the z plane azim stores the azimuth angle in the x,y plane dist is the distance of the eye viewing point from the object point.
def get_proj(self): relev, razim = np.pi * self.elev/180, np.pi * self.azim/180 xmin, xmax = self.get_xlim3d() ymin, ymax = self.get_ylim3d() zmin, zmax = self.get_zlim3d() # transform to uniform world coordinates 0-1.0,0-1.0,0-1.0 worldM = proj3d.world_transformation(x...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_proj(self):\n relev, razim = np.pi * self.elev/180, np.pi * self.azim/180\n\n xmin, xmax = self.get_xlim3d()/self.pbaspect[0]\n ymin, ymax = self.get_ylim3d()/self.pbaspect[1]\n zmin, zmax = self.get_zlim3d()/self.pbaspect[2]\n\n # transform to uniform world coordinates 0-1.0,0-1.0,0-1.0 \n...
[ "0.67287046", "0.57365036", "0.5603947", "0.5603947", "0.5603947", "0.5590555", "0.55803573", "0.55277735", "0.55255705", "0.5514479", "0.5498334", "0.54522187", "0.5427517", "0.53840077", "0.5340383", "0.53077734", "0.5249878", "0.52420133", "0.5239336", "0.520863", "0.51965...
0.69513947
0
Initializes mouse button callbacks to enable 3D rotation of the axes. Also optionally sets the mouse buttons for 3D rotation and zooming. ============ ======================================================= Argument Description ============ ======================================================= rotate_btn The integer ...
def mouse_init(self, rotate_btn=1, zoom_btn=3): self.button_pressed = None canv = self.figure.canvas if canv != None: c1 = canv.mpl_connect('motion_notify_event', self._on_move) c2 = canv.mpl_connect('button_press_event', self._button_press) c3 = canv.mpl_conn...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_render(self):\n plt.ion() # interactive plot mode, panning, zooming enabled\n self.fig = plt.figure(figsize=(9,7)) # create figure object\n self.ax = self.fig.add_subplot(111, projection=\"3d\") # attach z-axis to plot\n # set axe limits and labels\n self.ax.set_xlim([-self.l1max,...
[ "0.60320866", "0.58827245", "0.5719186", "0.53739196", "0.53151923", "0.5239748", "0.5210125", "0.5177485", "0.5143324", "0.50953233", "0.50787985", "0.5051443", "0.5025829", "0.50204533", "0.5020327", "0.5006104", "0.49952722", "0.49941874", "0.4937087", "0.4931774", "0.4922...
0.8558195
0
Return x string formatted. This function will use the attribute self.fmt_xdata if it is callable, else will fall back on the xaxis major formatter
def format_xdata(self, x): try: return self.fmt_xdata(x) except TypeError: fmt = self.w_xaxis.get_major_formatter() return sensible_format_data(fmt, x)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def x_formatter_cb( self, ax ):\n ax.set_xlim( xmin=self.begin_num,xmax=self.end_num )\n dl = common.PrettyDateLocator()\n df = common.PrettyDateFormatter( dl )\n ax.xaxis.set_major_locator( dl )\n ax.xaxis.set_major_formatter( df )\n ax.xaxis.set_clip_on(False)\n s...
[ "0.6987459", "0.694736", "0.63347334", "0.6271026", "0.61887676", "0.6027143", "0.59532624", "0.58278245", "0.58127594", "0.57806253", "0.57793057", "0.5727474", "0.57199484", "0.5715411", "0.5710877", "0.5710877", "0.56786436", "0.5617356", "0.55831313", "0.5575202", "0.5553...
0.87755007
0
Return y string formatted. This function will use the attribute self.fmt_ydata if it is callable, else will fall back on the yaxis major formatter
def format_ydata(self, y): try: return self.fmt_ydata(y) except TypeError: fmt = self.w_yaxis.get_major_formatter() return sensible_format_data(fmt, y)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def y_formatter_cb(self, ax):\n # y_vals should be the y-location of the labels.\n labels = getattr( self, 'labels', [] )\n labels = list(labels); #labels.reverse()\n y_vals = numpy.arange(.5,len(labels)+.5,1)\n\n # Locations should be fixed.\n fl = FixedLocator( y_vals )...
[ "0.7527546", "0.72269374", "0.66370326", "0.65920424", "0.6497946", "0.6424826", "0.63955826", "0.6334902", "0.6334902", "0.6306747", "0.62235653", "0.62140554", "0.62110204", "0.62094826", "0.62075233", "0.6140514", "0.61285925", "0.6106219", "0.61059654", "0.6090984", "0.59...
0.8820941
0
Return z string formatted. This function will use the attribute self.fmt_zdata if it is callable, else will fall back on the yaxis major formatter
def format_zdata(self, z): try: return self.fmt_zdata(z) except (AttributeError, TypeError): fmt = self.w_zaxis.get_major_formatter() return sensible_format_data(fmt, z)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def z_as_plotly(self):\n xs = np.asarray(self.position)[:,2]\n return numpy_to_plotlystring(xs)", "def fCommonZ(self):\n return '%s %s, %4.4d %d:%2.2d %s %s' % (\n self._fmon, self._day, self._year, self._pmhour,\n self._minute, self._pm, self._tz)", "def get_zl...
[ "0.63931024", "0.6110293", "0.6017204", "0.6001318", "0.5913852", "0.5877254", "0.5817488", "0.57752275", "0.57067174", "0.5619133", "0.5577503", "0.55225724", "0.55165666", "0.54910916", "0.5490775", "0.5440366", "0.5431425", "0.5419564", "0.53935236", "0.5381748", "0.533969...
0.8392818
0
Computes the CIEDE2000 ColorDifference from RGB inputs.
def rgb_ciede2000_color_difference(input: Tensor, target: Tensor, **kwargs) -> Tensor: return ciede2000_color_difference(*map(rgb_to_cielab, (input, target)), **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calc_color_distance(rgb1, rgb2):\n\n color1_rgb = sRGBColor(rgb1[0], rgb1[1], rgb1[2])\n color2_rgb = sRGBColor(rgb2[0], rgb2[1], rgb2[2])\n\n color1_lab = convert_color(color1_rgb, LabColor)\n color2_lab = convert_color(color2_rgb, LabColor)\n\n delta_e = delta_e_cie2000(color1_lab, color2_lab)...
[ "0.7290186", "0.7179611", "0.66951436", "0.668342", "0.6507787", "0.64787996", "0.6244714", "0.6182051", "0.6142938", "0.6092788", "0.58380044", "0.58308715", "0.5786474", "0.5744204", "0.57307357", "0.5728735", "0.5702915", "0.56483024", "0.5610936", "0.55991495", "0.5573354...
0.7993048
0
Synchronize the code repositories with upstreams. This is called once on the code host with a list of all components to synchronize. The script should fetch from upstream remotes, sync with a SCM server, or whatever your system does. The command should return a mapping of each component to an object containing a unique...
def synchronize(*components): return { # a component that needs to be built "buildable": { "token": "7be0db612ea365e1d9410763198bb79a9e28dfd6", "buildhost": "build-01", }, # a component that just gets deployed without build "simple": { "to...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sync_wikiversions(hosts, cfg):\n stats = log.Stats(cfg['statsd_host'], int(cfg['statsd_port']))\n with log.Timer('sync_wikiversions', stats):\n compile_wikiversions('stage', cfg)\n\n rsync = ssh.Job(hosts, user=cfg['ssh_user']).shuffle()\n rsync.command(\n 'sudo -u mwdeplo...
[ "0.5728176", "0.5340823", "0.5326653", "0.49276197", "0.49251354", "0.490632", "0.48124173", "0.48022512", "0.47712767", "0.47496063", "0.47308803", "0.4703907", "0.466871", "0.46292278", "0.46281964", "0.46259654", "0.4601795", "0.45963317", "0.45739755", "0.45732173", "0.45...
0.5974811
0
Deploy a component on a host. This is executed on each host to deploy. Rollingpin will pass a list of components with their build tokens as generated by the `build` command. This command is required if you want to run "d" commands in rollingpin.
def deploy(*components_with_tokens): for component_with_token in components_with_tokens: component, sep, build_token = component_with_token.partition("@") assert sep == "@" # TODO: put your deploy logic here!
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deploy():\n return do_deploy(do_pack())", "def deploy():\n return do_deploy(do_pack())", "def deploy():\n return do_deploy(do_pack())", "def deploy(ctx):\n click.echo('deploying')\n ctx.deploy()\n click.echo('done')", "def deploy():\n build()\n collect()\n commit()\n push(...
[ "0.6409896", "0.6409896", "0.6409896", "0.6313663", "0.62410283", "0.6176857", "0.6122709", "0.61016876", "0.60517645", "0.59591544", "0.59504676", "0.5875381", "0.57847923", "0.57187855", "0.57133573", "0.57093143", "0.5700452", "0.5685111", "0.56785846", "0.567795", "0.5657...
0.73414004
0
Restart a named service. This is executed on each host to restart a service. This command is required if you want to run "r" commands in rollingpin.
def restart(service): # TODO: replace this with your relevant restart logic assert service.isalpha() run("service", service, "restart")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def restart_service(service_name):\n subprocess.run([SUPERVISOR_CMD, \"restart\", service_name])", "def service_restart(appname):\n sudo('service {} restart'.format(appname))", "def restart(service_name):\n start_time = time.time()\n\n print(_green(\"Started...\"))\n require('environment', provi...
[ "0.84619176", "0.7962417", "0.7850783", "0.7748154", "0.7706298", "0.7590796", "0.7527931", "0.73082405", "0.7184883", "0.6998991", "0.6987906", "0.6921269", "0.690032", "0.6861545", "0.68512195", "0.6829885", "0.6829885", "0.6829289", "0.6824944", "0.681384", "0.6795301", ...
0.8028757
1
Do basic setup and dispatch commands to their handlers. Rollingpin executes commands that take the format of "command [args...]". With the SSH transport, this program is executed with sudo and the command is passed as the first argument. e.g. deploy project maps to sudo /usr/local/bin/deploy deploy project Additionally...
def main(commands): progname = os.path.basename(sys.argv[0]) if len(sys.argv) < 2: print("USAGE: {} COMMAND [ARG...]".format(progname), file=sys.stderr) sys.exit(1) command_name = sys.argv[1] args = sys.argv[2:] def fatal_error(message_fmt, *args): message = message_fmt.fo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n\n # argument parser\n parser = argparse.ArgumentParser(description=__doc__)\n subparsers = parser.add_subparsers(title='commands')\n\n # add subparsers\n config_parser = subparsers.add_parser(\n 'config',\n help='Not implemented yet.')\n script_parser = subparsers.add_...
[ "0.5643472", "0.55872506", "0.55771416", "0.5482396", "0.545494", "0.54169744", "0.5400855", "0.53704166", "0.53308076", "0.5292438", "0.5290815", "0.52692324", "0.52692324", "0.52692324", "0.52692324", "0.52186424", "0.5172715", "0.5153339", "0.51506704", "0.51496565", "0.51...
0.6441365
0
Computes the unnormalized probabilities from hidden states. Optionally divide logits by a temperature, in order to influence predictions at
def get_logits(self, hidden_states: torch.FloatTensor, temperature: float = 1.0): return self.logits(hidden_states) / temperature
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apply_temperature(prob, temperature):\r\n # Apply temperature\r\n if temperature != 1:\r\n # Inverse sigmoid\r\n x = -np.log(1 / prob - 1)\r\n # Apply temperature to sigmoid function\r\n prob = 1 / (1 + np.exp(-x / temperature))\r\n return prob", "def sample(predictions, ...
[ "0.64837074", "0.63284284", "0.6092236", "0.60557985", "0.60295534", "0.60295534", "0.60031474", "0.5960595", "0.589658", "0.5879161", "0.58180046", "0.5794842", "0.5762275", "0.5746964", "0.5722282", "0.5703965", "0.5691445", "0.5688632", "0.5666804", "0.56628627", "0.566184...
0.7518886
0
Return the outside temperature as a PiecewiseConstant in the destination timezone.
def outside_temp(self) -> models.PiecewiseConstant: month = MONTH_NAMES.index(self.event_month) + 1 wx_station = self.nearest_weather_station() temp_profile = caimira.data.weather.mean_hourly_temperatures(wx_station = wx_station[0], month = MONTH_NAMES.index(self.event_month) + 1) _, u...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ozone(self) -> float | None:\n return round_state(self._get_sensor_value(API_O3))", "def kelvin_2_celsius(x):\n return x - 273.15", "def eco_temperature_high_c(self) -> float:\r\n self._logger.debug(log_message_formatter(\r\n \"get\", f\"{self}\", \"eco_temperature_high_c\"))\r\...
[ "0.57035345", "0.5525141", "0.5409104", "0.54014874", "0.5387626", "0.53555024", "0.5334104", "0.53010106", "0.52087784", "0.5207486", "0.5199115", "0.5177644", "0.5175561", "0.5151671", "0.5150158", "0.51115185", "0.51113534", "0.51105714", "0.50878274", "0.5082578", "0.5071...
0.783782
0
Return the nearest weather station (which has valid data) for this form
def nearest_weather_station(self) -> caimira.data.weather.WxStationRecordType: return caimira.data.weather.nearest_wx_station( longitude=self.location_longitude, latitude=self.location_latitude )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_nearest_station(latitude, longitude):\n url = '{}?api_key={}&filter[latitude]={}&filter[longitude]={}&sort=distance'.format(MBTA_BASE_URL,MBTA_API_KEY,latitude,longitude)\n # print(url)\n station_json = get_json(url)\n # print(station_json)\n station_name = station_json['data'][0]['attribute...
[ "0.699019", "0.6642162", "0.65577376", "0.6445369", "0.6364995", "0.6241201", "0.621524", "0.6184315", "0.61696506", "0.61602503", "0.60939056", "0.60699934", "0.6059913", "0.59862274", "0.5962613", "0.5958538", "0.5920494", "0.5894466", "0.5881648", "0.5874817", "0.5807363",...
0.75116676
0
Calculate the presence interval given the start and end times (in minutes), and a number of monotonic, nonoverlapping, but potentially unsorted, breaks (also in minutes).
def present_interval( self, start: int, finish: int, breaks: typing.Optional[models.BoundarySequence_t] = None, ) -> models.Interval: if not breaks: # If there are no breaks, the interval is the start and end. return models.SpecificInte...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def time_interval(intervals: List[Tuple[int, int]]) -> int:\n\n start = []\n finish = []\n for elems in intervals:\n start.append(elems[0])\n finish.append(elems[1])\n\n # Sorting the start and end times separately\n start.sort()\n finish.sort()\n\n index1, index2 = 0, 0\n cur...
[ "0.63886136", "0.6311775", "0.59914833", "0.59761816", "0.5920472", "0.5874981", "0.5869664", "0.57870585", "0.5778635", "0.5765722", "0.56311196", "0.56113166", "0.56082606", "0.560282", "0.55785656", "0.5574762", "0.5557733", "0.5538139", "0.55277294", "0.55224663", "0.5517...
0.6815659
0
CHECK ADD USER API COMMAND
def test_add_user(self, api): resp = api.add_user(api.get_user()) self.builder.delete_user(api.get_user()) assert resp.status_code == 201
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_011_add_same_user(self):\n testflow.step(ADD_USR_MSG, TEST_USER1)\n assert not USER_CLI.run('add', TEST_USER1)[0]", "def test_add_user(self):\n pass", "def test_000_add_user(self):\n # This case is always passed because it's tested in setup_module,\n # If setup modul...
[ "0.71983826", "0.6994053", "0.6845731", "0.6842112", "0.6815134", "0.68012697", "0.6771713", "0.67107916", "0.6707269", "0.6700492", "0.6698035", "0.6651833", "0.6649123", "0.6617782", "0.66072273", "0.65531474", "0.65497357", "0.6533452", "0.651682", "0.65136844", "0.6510519...
0.70304143
1
A function that returns the indices of the digits in `nums` that add up to create `target`
def return_indices(nums, target): indices = [] i = 0 number_found = False while not number_found: my_target = nums[i] for j in range(i+1,len(nums)): my_target += nums[j] if my_target == target: number_found = True indices =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def twoSum(self, nums: List[int], target: int) -> List[int]:\n # Use a dict to record visited numbers\n d = {}\n for i, n in enumerate(nums):\n m = target - n\n if m in d:\n return [d[m], i]\n else:\n d[n] = i", "def twoSum(self,...
[ "0.7506801", "0.74948615", "0.7404587", "0.7397206", "0.73625934", "0.7320128", "0.7267309", "0.72608113", "0.7228066", "0.7114452", "0.7100507", "0.6910812", "0.6910151", "0.68976074", "0.6882566", "0.6856375", "0.6773999", "0.6723918", "0.6702421", "0.66884637", "0.6559242"...
0.83146
0
Set the active channel on the analyzer
def active_channel(self, channel): old_timeout = self.resource.timeout self.resource.timeout = 500 if channel in self.channel_list: self.scpi.set_active_channel(channel) else: print('Channel %i not in list of channels. Create channel first' % cha...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setactive(self, irc, msg, args, channel):\n res = self._checkDBhasChannel(channel)\n if res is True:\n SQL = 'UPDATE registry SET isActive = ? WHERE channel = ?'\n SQLargs = (1, channel)\n self._SQLexec(SQL, SQLargs)\n self.lock.acquire()\n f...
[ "0.7073186", "0.66680807", "0.6612392", "0.6567156", "0.65555334", "0.6530616", "0.6474333", "0.6464379", "0.6447601", "0.634604", "0.63352233", "0.6331963", "0.63312465", "0.6308919", "0.61969346", "0.61597484", "0.6128631", "0.6062674", "0.60565835", "0.6016985", "0.6001076...
0.68747866
1
get an skrf.Frequency object for the current channel
def get_frequency(self, **kwargs): #self.resource.clear() channel = kwargs.get("channel", self.active_channel) use_log = "LOG" in self.scpi.query_sweep_type(channel).upper() f_start = self.scpi.query_f_start(channel) f_stop = self.scpi.query_f_stop(channel) f_npoints = se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_frequency(self, c, channel=-1):\n if (channel == -1):\n channel = self.guess_channel()\n\n try:\n frequency = self.binding.get_frequency_num(channel)\n return frequency * THz;\n except Exception, e:\n return self.handle_wavemeter_error(e)", ...
[ "0.8054144", "0.7639117", "0.7552545", "0.7393945", "0.73144764", "0.7307729", "0.7307729", "0.71953", "0.71274894", "0.7125579", "0.7101956", "0.70450306", "0.7030463", "0.7003671", "0.6898539", "0.6790573", "0.67650914", "0.66627055", "0.6662272", "0.65912443", "0.6574406",...
0.8455129
0
retrieve traces as 1port networks from a list returned by get_list_of_traces
def get_traces(self, traces, **kwargs): self.resource.clear() sweep = kwargs.get("sweep", False) name_prefix = kwargs.get("name_prefix", "") if name_prefix: name_prefix += " - " channels = OrderedDict() for trace in traces: ch = trace["channel"] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def networks(view):\n return \"network?\" \\\n \"_return_fields=\" \\\n \"extattrs,\" \\\n \"comment,\" \\\n \"network,\" \\\n \"network_view,\" \\\n \"utilization&\" \\\n \"network_view=\" + view + \\\n ...
[ "0.56269556", "0.55539596", "0.5377853", "0.53152835", "0.5294652", "0.5291048", "0.5281379", "0.52650875", "0.526169", "0.52474886", "0.52430606", "0.5223905", "0.5222478", "0.51874423", "0.5139164", "0.51355976", "0.51224667", "0.51205623", "0.5119607", "0.50587183", "0.503...
0.60697514
0
MINIJ Symmetric positive definite matrix MIN(i,j). A = MINIJ(N) is the NbyN symmetric positive definite matrix with A(i,j) = MIN(i,j).
def minij(n): o = np.outer(np.ones(n), np.arange(1, n + 1)) ot = o.T a = np.where(o < ot, o, ot) return a
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def matrix_min(data):\n if is_SparseDataFrame(data):\n data = [np.min(data[col]) for col in data.columns]\n elif is_sparse_dataframe(data):\n data = [sparse_series_min(data[col]) for col in data.columns]\n elif isinstance(data, pd.DataFrame):\n data = np.min(data)\n elif isinstance...
[ "0.60417503", "0.60155433", "0.5997592", "0.5813261", "0.56866276", "0.56028646", "0.55549574", "0.55397415", "0.5496154", "0.54659593", "0.54248524", "0.5402042", "0.5380178", "0.5338527", "0.53362006", "0.5331151", "0.5286433", "0.5266604", "0.5266438", "0.526029", "0.52177...
0.67710686
0
Sign a dict of query params for private API calls
def sign(self, params: Dict[str, Any]) -> str: assert self.secret is not None, "A client secret is required to sign requests." query = urlencode(params) signature = hmac.new(self.secret.encode(), query.encode(), hashlib.sha512) return signature.hexdigest()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def signed_request(params):\n has_signature = False\n keys = params.keys()\n if \"signature\" in keys:\n has_signature = True\n keys.remove(\"signature\")\n keys.sort()\n if has_signature:\n keys.append(\"signature\")\n query_string = \"&\".join(quote(key, \"~\") + \"=\" + qu...
[ "0.7031486", "0.63107616", "0.61605346", "0.60714364", "0.5941597", "0.5905069", "0.58520377", "0.57499033", "0.57226986", "0.5686243", "0.5663891", "0.5659361", "0.56523156", "0.564497", "0.55926687", "0.5566261", "0.55334574", "0.55264515", "0.55031985", "0.5472664", "0.545...
0.677095
1
Create and save an User with the given email, date username and password.
def _create_user(self, username, email, password): now = datetime.now() if username is None: raise ValueError('Must include username') if email is None: raise ValueError('Must include email') email = self.normalize_email(email) user = self.model( email=self.normalize_email(email), username=usernam...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_user(self, email, password,username, **extra_fields):\r\n if not email:\r\n raise ValueError('The given email must be set')\r\n if not username:\r\n raise ValueError('The given username must be set')\r\n email = self.normalize_email(email)\r\n user = se...
[ "0.8264488", "0.8044632", "0.8017942", "0.79963917", "0.7975402", "0.7971667", "0.7956227", "0.7950401", "0.7944039", "0.7933995", "0.7920982", "0.78849393", "0.78843653", "0.78787684", "0.7863827", "0.7850802", "0.78485966", "0.7845105", "0.7843791", "0.78424984", "0.7837284...
0.81243074
1
Initialize the network object.
def __init__(self, network: Network): self.graph = network.graph
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialise_network(self):\n raise NotImplementedError", "def initialize_networkHandler(self):\n\t\tself.networkHandler = NetworkHandler(\n\t\t\tself.callbackQueue,\n\t\t\tself.received_order,\n\t\t\tself.set_light_callback,\n\t\t\tself.newOrderQueue,\n\t\t\tself.startedOrderQueue,\n\t\t\tself.lost_con...
[ "0.8311253", "0.7300697", "0.72333914", "0.72051275", "0.7202887", "0.7143717", "0.71095693", "0.71057093", "0.70741814", "0.6999863", "0.6982835", "0.6895302", "0.68354", "0.6832367", "0.67843825", "0.6771594", "0.6767722", "0.6760657", "0.67256033", "0.66914284", "0.6682826...
0.73163825
1
Get the graph of upregulated genes.
def get_upregulated_genes_network(self) -> Graph: logger.info("In get_upregulated_genes_network()") deg_graph = self.graph.copy() # deep copy graph not_diff_expr = self.graph.vs(up_regulated_eq=False) # delete genes which are not differentially expressed or have no connections to othe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_downregulated_genes_network(self) -> Graph:\n logger.info(\"In get_downregulated_genes_network()\")\n\n deg_graph = self.graph.copy() # deep copy graph\n not_diff_expr = self.graph.vs(down_regulated_eq=False)\n\n # delete genes which are not differentially expressed or have no ...
[ "0.66046745", "0.60100204", "0.57770103", "0.57180667", "0.55749834", "0.5566099", "0.5559344", "0.5492372", "0.54869175", "0.54744697", "0.54700613", "0.54627925", "0.5450532", "0.54221565", "0.5421635", "0.5413574", "0.5413574", "0.54048723", "0.54012454", "0.53893375", "0....
0.7776593
0
Get the graph of downregulated genes.
def get_downregulated_genes_network(self) -> Graph: logger.info("In get_downregulated_genes_network()") deg_graph = self.graph.copy() # deep copy graph not_diff_expr = self.graph.vs(down_regulated_eq=False) # delete genes which are not differentially expressed or have no connections t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_upregulated_genes_network(self) -> Graph:\n logger.info(\"In get_upregulated_genes_network()\")\n\n deg_graph = self.graph.copy() # deep copy graph\n not_diff_expr = self.graph.vs(up_regulated_eq=False)\n\n # delete genes which are not differentially expressed or have no connec...
[ "0.69579864", "0.6351006", "0.6283878", "0.6176444", "0.6084167", "0.5858016", "0.5844809", "0.5842136", "0.57990193", "0.5792703", "0.57469004", "0.5735177", "0.5711884", "0.5665984", "0.5652281", "0.5633673", "0.5633673", "0.5633673", "0.5626247", "0.5619472", "0.5608756", ...
0.79083854
0
Get the shortest paths graph between differentially expressed + special genes.
def get_shortest_paths_graph( self, genes_to_keep: list = None, keep_isolated_nodes: bool = False, ): logger.info("In get_shortest_paths_graph()") sp_graph = self.graph.copy() weights = list(1 - np.array(sp_graph.es['weight'])) sp_graph.es['weight'] = weights ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_shortest_paths(G):\n \n shortest_paths = {}\n \n for origin in list(G.nodes):\n for destination in list(G.nodes):\n \n if origin != destination:\n shortest_path = nx.shortest_path(G, origin, destination, weight='length')\n shortest_path...
[ "0.63874626", "0.61676866", "0.59369975", "0.58809465", "0.5853685", "0.5844638", "0.5814823", "0.581112", "0.57989216", "0.5793979", "0.5778857", "0.5777842", "0.57740647", "0.57677656", "0.5753075", "0.57046866", "0.56543267", "0.56424206", "0.5641741", "0.56304026", "0.559...
0.6341152
1
This routine finds the root of a function using Newton's method using a usersupplied Jacobian. It uses Given's rotation for QR_decomposition.
def newton_jacobian(f, x0, Jf, eps=1e-10): # Initialization globvar.ncalls = 0 x = np.copy(x0) n = len(x) J = np.zeros((n, n), dtype='float64') fx = f(x) # Begin root search while True: globvar.ncalls += 1 # Calculate Jacobian J = Jf(x) # Decompose and ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def newton(f, x0, dx, eps=1e-10):\n # Initialization\n globvar.ncalls = 0\n x = np.copy(x0)\n n = len(x)\n J = np.zeros((n, n), dtype='float64')\n fx = f(x)\n\n # Begin root search\n while True:\n globvar.ncalls += 1\n\n # Fill the Jacobian matrix\n for j in range(n):\n...
[ "0.7064154", "0.6773308", "0.67223287", "0.6665769", "0.6661061", "0.6588345", "0.6577896", "0.65632564", "0.64479625", "0.6429511", "0.642779", "0.62259066", "0.6203847", "0.61860543", "0.6164398", "0.61554545", "0.61498755", "0.6146769", "0.61382174", "0.61307704", "0.61059...
0.69849056
1
Compute the distance matrix where each element m[i][j] is the distance between X1[i] and X2[j].
def compute_dist_matrix(X1, X2, distance): N, M = X1.shape[0], X2.shape[0] dist_matrix = np.zeros((N, M)) for i in range(N): for j in range(M): dist_matrix[i][j] = dist(X1[i], X2[j], distance=distance) return dist_matrix
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def distance_matrix(d1, d2=None):\n if d2 is None:\n dists = np.zeros(shape=(d1.shape[0], d1.shape[0]))\n for i in range(dists.shape[0]):\n dists[i] = (((d1 - d1[i]) ** 2).sum(axis=1)) ** 0.5\n else:\n dists = np.zeros(shape=(d1.shape[0], d2.shape[0]))\n for i in range(...
[ "0.75617665", "0.7318856", "0.72813463", "0.7276832", "0.70679265", "0.6998405", "0.6967657", "0.69262916", "0.69128615", "0.6912195", "0.6910449", "0.6898679", "0.6848797", "0.6822956", "0.6822956", "0.6811146", "0.67233676", "0.67047507", "0.66902006", "0.66814315", "0.6658...
0.8308153
0
Read the file and return the class EvenMorePizza
def ReadInputFile(file:int)->EvenMorePizza: self.files = ('a_example.in','b_little_bit_of_everything.in', 'c_many_ingredients.in','d_many_pizzas.in','e_many_teams.in') EvenMorePizza temporalValue file = open(files[file])#open the file data = doc.Read().strip(' ,\n').split('\n') file.close(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_foods(self, file_name):\n with open(file_name, 'r') as input_file:\n input_reader = csv.reader(input_file)\n for row in input_reader:\n # check if the row is a properly formatted csv line, deals with blank lines in the file\n if row:\n ...
[ "0.594584", "0.56657183", "0.5661011", "0.5652729", "0.563939", "0.56219804", "0.5594143", "0.5574099", "0.5554233", "0.55162", "0.5510586", "0.5473452", "0.54599804", "0.54594177", "0.54568374", "0.5455678", "0.5453081", "0.541443", "0.54093313", "0.53982997", "0.5391018", ...
0.673987
0
retruns sprites for the UI
def get_sprites(self): return self.sprites
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sprites():\n return Globals.instance.sprites", "def get_sprite(idx):\n #print \"in get_sprite: idx = %s\" % str(idx)\n return _sprite_list[idx]", "def load_sprites(self):\n self.widget_sprites = pygame.sprite.Group()\n env = self.env_list[self.current_env]\n for x in range(env...
[ "0.7960551", "0.689996", "0.64536095", "0.64269835", "0.63424385", "0.63285047", "0.6270275", "0.6157129", "0.6125085", "0.6076536", "0.6047347", "0.6017396", "0.600531", "0.598232", "0.5922763", "0.588307", "0.5867869", "0.58450717", "0.58033335", "0.5802144", "0.5799104", ...
0.73955494
1
Clean local build directory
def clean_local(): local('rm -fr build') local('mkdir -p build')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean():\n if os.path.exists('_build'):\n shutil.rmtree('_build')", "def _clean_native_build():\n rmtree(BUILD_DIR)", "def clean():\n local('rm -fr %s' % os.path.abspath(env.config['destination']))", "def devclean():\n click.echo(\"start clean your output folder...\")\n rm(OUTPUTDIR...
[ "0.86501986", "0.834312", "0.8286312", "0.82466394", "0.82212", "0.8094537", "0.77714765", "0.7765651", "0.7694582", "0.76876354", "0.76822776", "0.7665812", "0.76619273", "0.76604414", "0.7618849", "0.76084566", "0.75122166", "0.74436367", "0.74076647", "0.7364907", "0.73379...
0.87414193
0
Copy json files under external
def copy_json(): sourcePath = 'contents/external/' targetPath = 'build/external/' for base,subdirs,files in os.walk(sourcePath): for file in files: orig = os.path.join(base, file) if os.path.isfile(orig) and file[-5:] == '.json': targetBase = os.path.join(targ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_files(self, location):\n for filename in os.listdir(location):\n with open(location + '/' + filename) as json_file:\n data = json.load(json_file)\n self.test_data(data)", "def process_files_json():\n # chdir into beep root\n pwd = os.getcwd()\n os...
[ "0.62083673", "0.61642045", "0.61475873", "0.61259687", "0.60225385", "0.60211897", "0.5844508", "0.58031535", "0.58031535", "0.5770585", "0.5768572", "0.5764731", "0.5740694", "0.5727116", "0.57030046", "0.5688219", "0.56606984", "0.5651181", "0.5647694", "0.5622501", "0.561...
0.8411562
0
Applies optimizations to reduce file sizes
def optimize(): optimizable_extensions = get_optimizable_extensions() file_set = get_optimizable_files(optimizable_extensions) files_no = len(file_set) compressed_total = 0 original_total = 0 for index, (file_basename, file_extension) in enumerate(file_set): puts(green("%.1f%% done (%d/%...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _optimise(self):\n pass", "def image_optimizer_finalized(pelican):\n for dirpath, _, filenames in os.walk(pelican.settings['OUTPUT_PATH']):\n for name in filenames:\n if os.path.splitext(name)[1] in COMMANDS.keys():\n if pelican.settings[FLAG]:\n ...
[ "0.6440606", "0.6218597", "0.6148556", "0.6065853", "0.59288585", "0.59013295", "0.5895138", "0.5893955", "0.5807654", "0.5768352", "0.5717077", "0.56409645", "0.5621075", "0.554719", "0.5520714", "0.5433088", "0.54160446", "0.5414282", "0.5375194", "0.535722", "0.5321384", ...
0.7652481
0
Rolls back currently deployed version to its predecessor
def rollback(): with cd(env.basepath): run('mv current/rollback rollback') run('mv current undeployed') run('mv rollback current') version = run('readlink current') previous = run('readlink undeployed') puts(green('>>> Rolled back from %(previous)s to %(version)s' % {...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rollback():\n current_timestamp = current()\n previous_timestamp = previous()\n\n if previous_timestamp:\n execute(symlink, *(previous_timestamp, ))\n run('rm -rf %s' % os.path.join(env.releases_dir, current_timestamp))", "def rollback(self):\n raise NotImplementedError", "def...
[ "0.74731463", "0.63998336", "0.6332538", "0.62815654", "0.6210352", "0.62041616", "0.61640817", "0.6102337", "0.6065542", "0.60392684", "0.6038867", "0.6020355", "0.600593", "0.59930426", "0.5972654", "0.59693485", "0.5951183", "0.5856918", "0.5856119", "0.5853676", "0.585004...
0.68261755
1
Garbage Collect older deploys by keeping only the last n (defaults to 10) This will delete any directory which is older than the last n releases, preventing rollbacks from before that.
def gc_deploys(n = 10): for deploypath in [env.basepath, env.nodejs]: with cd("%s/releases" % deploypath): files = run("ls -1t").splitlines() older_files = files[n:] if len(older_files) > 0: puts(yellow("Removing older deploys: %s" % ", ".join(older_files)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cleanup(keep_num=5):\n\n keep_num = int(keep_num)\n assert keep_num > 0, \"[ERROR] keep_num must be > 0; refusing to proceed.\"\n\n with cd(\"%(path)s/packages\" % env):\n package_files = sorted(run(\"ls -1\").split())\n package_files = [_.replace(\".tar.gz\", \"\") for _ in package_file...
[ "0.72070456", "0.6784998", "0.6723931", "0.6661816", "0.6166716", "0.61081105", "0.59910256", "0.5987809", "0.57116586", "0.56324124", "0.56302834", "0.56275517", "0.56264186", "0.56139004", "0.56127965", "0.5592206", "0.55564654", "0.55319005", "0.5526508", "0.5506969", "0.5...
0.8368891
0
Finds the positionon the 'Scan Data' and adds additional 2 lines to give as a result the lenght of the header in number of lines. This is then used in csv function
def FindHeaderLength(): lookup = 'Lateral um' with open(filename) as myFile: for FoundPosition, line in enumerate(myFile, 1): if lookup in line: print 'Scan Data found at line:', FoundPosition break return FoundPosition+4
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_table_1(first_line_idx, lineIN_list): \n DEBUG_1A = False\n if DEBUG_1A: header_1A = '>>>DEBUG_1A:\\t'\n\n DEBUG_1 = False\n if DEBUG_1: header = '>>>DEBUG_1:\\t'\n if DEBUG_1: print header, 'first_line_idx', first_line_idx \n if DEBUG_1: from pprint import pprint as pp\n my_lineOU...
[ "0.6193202", "0.6040374", "0.59050536", "0.5783467", "0.57265013", "0.56992877", "0.5694094", "0.56608236", "0.55824596", "0.55560064", "0.5546573", "0.5478504", "0.54733294", "0.5428406", "0.5379636", "0.537075", "0.5348874", "0.53391665", "0.53194135", "0.52867776", "0.5285...
0.6546941
0
Get follower information from youtube api subscriptions
def get_follower_info(self): payload = self._get_subscription() snippet = payload.get('items', [{}])[0].get('snippet', {}) #: re-processing publishedAt if 'publishedAt' in snippet: snippet['publishedAt'] = datetime.strptime( snippet['publishedAt'], ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def followers(self):\r\n request = http.Request('GET', '{0}/followers/'.format(self.get_url()))\r\n\r\n return request, parsers.parse_json", "def followers(self):\r\n request = http.Request('GET', '{0}/followers/'.format(self.get_url()))\r\n\r\n return request, parsers.parse_json", ...
[ "0.6292286", "0.6292286", "0.6292286", "0.62131083", "0.62131083", "0.62131083", "0.62131083", "0.6083211", "0.6050801", "0.6049056", "0.59711623", "0.59216607", "0.5877637", "0.58739287", "0.5818425", "0.57830167", "0.5781198", "0.57692343", "0.5757806", "0.57491636", "0.566...
0.6528171
0
Return the global Qt style sheet of the GUI. Returns
def return_global_style_sheet(): style_sheet = ''' QLabel { font: 12pt "Verdana"; margin-left: 5px; background-color: transparent; } QPushButton { background-color: #3D3D3D; border-style: outset; border: 2px solid #55555...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def default_style_sheet(self) -> str:\n # Valid color names: http://www.w3.org/TR/SVG/types.html#ColorKeywords\n g.trace('===== using default style sheet =====')\n return '''\\\n\n /* A QWidget: supports only background attributes.*/\n QSplitter::handle {\n background-color: #CAE1...
[ "0.7499044", "0.70235384", "0.66133356", "0.6289204", "0.6169656", "0.61319745", "0.60961974", "0.60611403", "0.60246503", "0.60246503", "0.6005138", "0.59843737", "0.5949364", "0.59025097", "0.5857246", "0.585129", "0.58293533", "0.57642174", "0.5673839", "0.5656663", "0.563...
0.7957717
0
Return the Qt style sheet for the button that saves JSON configuration files. Returns
def return_save_json_button_style_sheet(): save_json_icon = pkg_resources.resource_filename( 'neurodatapub', "resources/save_json_icon_50x50.png" ) save_json_icon_pressed = pkg_resources.resource_filename( 'neurodatapub', "resources/save_json_icon_50x50_pressed.png" ) style_s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def return_folder_button_style_sheet():\n style_sheet_folder_button = '''\n QLabel {\n font: 12pt \"Verdana\";\n margin-left: 5px;\n background-color: transparent;\n }\n QPushButton {\n border: 0px solid lightgray;\n border-radius: 4px;...
[ "0.7254106", "0.63199043", "0.62559277", "0.60472584", "0.6017292", "0.57173723", "0.5689586", "0.5608051", "0.55261934", "0.543474", "0.5423989", "0.54113317", "0.5408985", "0.5403117", "0.5389559", "0.5384791", "0.53025055", "0.5291841", "0.5248946", "0.5226415", "0.5208233...
0.8233807
0
Converts a path listing to a whitespace separated list.
def path2list(thePath): theItems = thePath.split( os.pathsep ) theResult = '\n'.join( theItems ) return theResult
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reformatList( listOfPaths):\n newList = []\n first = True\n for seg in listOfPaths: \n newList += seg.asSVGCommand(first)\n first = False\n return newList", "def striplist(l):\n return([x.strip() for x in l])", "def strip_spaces_list(list_in, strip_method=\"all\"):\n\n ...
[ "0.60357594", "0.58714706", "0.57478935", "0.5672808", "0.56116235", "0.5566947", "0.55446213", "0.5505672", "0.54979753", "0.54728156", "0.54159695", "0.53777033", "0.53608954", "0.5335432", "0.5334704", "0.5333364", "0.5326951", "0.5303007", "0.5280472", "0.52630544", "0.52...
0.71204615
0
Returns a tuple (index,value) of the maximum in an 1D array or list
def getMax(array_list): m = array_list[0] m_index = 0 for i,value in enumerate(array_list): if value > m: m = value m_index = i return (m_index,m)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def max_array(func: Callable[[Tuple], np.ndarray], state: Tuple[Union[int, float]]) \\\n -> Tuple[float, Tuple[int], np.ndarray]:\n arr = func((state,)).ravel()\n max_index = np.argmax(arr)\n return (arr[max_index], (max_index,), arr)", "def maximo(arr):\n maxVal = float('-inf')\n maxIdx = -1\n...
[ "0.75346965", "0.7443417", "0.7412157", "0.7412157", "0.7412157", "0.7406443", "0.7315579", "0.73025966", "0.7281516", "0.72562987", "0.72442836", "0.7174529", "0.7159991", "0.71500117", "0.7137905", "0.7137905", "0.71036977", "0.7027038", "0.70268023", "0.7006085", "0.696813...
0.7658867
0
Returns length of Input Layer
def getInputLength(self): return len(self.X[0])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __len__(self):\n num_x, num_y = self.conv_dims()\n return num_x * num_y", "def __len__(self):\n return len(self.inputs)", "def __len__(self):\n _, timesteps, height, width = self.data.shape\n height //= self.size\n width //= self.size\n\n if self.subset == '...
[ "0.72723395", "0.7249418", "0.7229942", "0.7219866", "0.7207118", "0.7194997", "0.7118895", "0.711577", "0.711577", "0.71056104", "0.71054775", "0.70545256", "0.70471865", "0.7038184", "0.70280606", "0.7008883", "0.6989715", "0.694395", "0.69284695", "0.6871657", "0.686542", ...
0.7587583
0
Returns length of Output Layer
def getOutputLength(self): return len(self.Y[0])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __len__(self):\n return len(self.output)", "def output_size(self) -> int:\n return self.output_dim", "def output_size(self) -> int:\n return self.out_sz", "def upperLayersSize(self):\n return sys.getsizeof(self.segment)", "def __len__(self):\n _, timesteps, height, wi...
[ "0.7353651", "0.720268", "0.7105618", "0.70519376", "0.70314616", "0.7029902", "0.7029902", "0.7019995", "0.68950385", "0.6882825", "0.6882825", "0.68770224", "0.6876365", "0.6861504", "0.68612486", "0.68547463", "0.68308866", "0.6828381", "0.6826283", "0.6823162", "0.680069"...
0.7591596
0
Sets the colour for a single test point
def setPointColor(self, pointNo, colour): self.colours[pointNo - 1] = colour self.setData(pos=self.pos, symbolBrush=self.colours, size=1, symbol=self.symbols, pxMode=False, text=self.text)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setPointColor(self, color):\n for point in self.points:\n point.color = color", "def set_color(self, color):\n pass", "def set_color(self, color):\n\t\tpass", "def setColor(self, color):\n self.point_color = color\n self.side_color = color\n self.area_color =...
[ "0.7241225", "0.69932246", "0.6975035", "0.69124943", "0.6663082", "0.6592638", "0.658765", "0.65860903", "0.65610075", "0.6543624", "0.6484143", "0.6457352", "0.6407133", "0.63961405", "0.63827115", "0.63227856", "0.63221604", "0.63164324", "0.63148993", "0.6290626", "0.6288...
0.7157946
1
Decode a base58encoding string, returning bytes
def base58_decode(s): if not s: return b'' alphabet = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz' # Convert the string to an integer n = 0 for c in s: n *= 58 if c not in alphabet: raise Exception('Character %r is not a valid base58 character' % ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decode(s):\n try:\n if not s:\n return b''\n\n # Convert the string to an integer\n n = 0\n for c in s:\n n *= 58\n if c not in b58_digits:\n raise InvalidBase58Error('Character %r is not a valid base58 character' % c)\n digit = b58_digits.index(c)\n ...
[ "0.8355401", "0.819695", "0.73636943", "0.73498034", "0.73448855", "0.7194646", "0.718425", "0.6982863", "0.67967886", "0.6775116", "0.6758219", "0.6669485", "0.66650075", "0.6610328", "0.65940046", "0.6544558", "0.6437999", "0.6397392", "0.6312124", "0.6256049", "0.62495166"...
0.83624893
0
Slot to add all pending clients to our client list
def __addNewClients(self): while True: client = self.nextPendingConnection() if (client == None): break # Add this socket to our list of clients self.__clients.append(client); # When the client disconnects, rem...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clientlist(self) -> None:\n from bacommon.servermanager import ClientListCommand\n self._enqueue_server_command(ClientListCommand())\n self._block_for_command_completion()", "def add_client(self, cli):\n if self.clients.count(cli) is 0:\n self.clients.append(cli)", "d...
[ "0.6503827", "0.6110517", "0.6019832", "0.5921308", "0.5919865", "0.5894686", "0.58289194", "0.58173764", "0.5786933", "0.5777047", "0.57581365", "0.5749104", "0.57443786", "0.56717247", "0.5655023", "0.55998474", "0.55407065", "0.5519964", "0.5497782", "0.547751", "0.5470838...
0.73507994
0
Slot to remove the signal sender from our client list.
def __removeClient(self): client = self.sender() if (client in self.__clients): self.__clients.remove(client) print "disconnect from", self.__clientName(client)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_client(self, client):\n self.clients.remove(client)\n #print(\"removing:\" + str(client))", "def delete_client(self, client):\n for c in self.clients:\n if client == c:\n self.clients.remove(c)", "def _onremove(self):\n self._channellist.remove(s...
[ "0.6799372", "0.64632046", "0.64480466", "0.6365907", "0.6319664", "0.6222383", "0.62166643", "0.6215667", "0.6142886", "0.6092435", "0.60883784", "0.60883784", "0.60883784", "0.60883784", "0.60883784", "0.6046992", "0.60397154", "0.60055655", "0.5963934", "0.5952039", "0.594...
0.76287967
0
Send the given data, of type QByteArray, to each of the connected clients.
def sendToClients(self, data): for client in self.__clients: result = client.write(data) if (result < 0): print "Error writing to", self.__clientName(client), "-", client.errorString() elif (result <> len(data)): print "Only wrote", result, "of...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_all(self, data, sender=None):\n for client in self.clients:\n if client == sender:\n continue\n client.send(data)", "def send_all(self, data):\n\n for client in self.clients:\n try:\n client.send(data)\n except Excep...
[ "0.7545639", "0.7432323", "0.6873917", "0.6808436", "0.6797618", "0.66874385", "0.66292375", "0.6580219", "0.65709496", "0.6551844", "0.6533233", "0.6526014", "0.6516279", "0.6492845", "0.64788616", "0.6469772", "0.6430869", "0.64287275", "0.6418134", "0.6407385", "0.6398216"...
0.78990436
0
Inserts a single fingerprint into the database.
def insert_hash(self, title, artist, song_id:int, fingerprint: str, offset:int): fingerprint = Fingerprints(song_id=song_id, song_title=title, artist=artist, hash=fingerprint, offset=offset) fingerprint.save()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insert(self, fingerprint):\n if len(fingerprint) > 5:\n fingerprint = fingerprint[0:5]\n if self.validate(fingerprint):\n self.fingerprints.add(fingerprint)", "def insert_reference(name, f_ref, r_ref, l_ref, class_ref):\n\n conn = r.connect(host=HOST, port=PORT, db=DB)\...
[ "0.73537487", "0.6291285", "0.61090654", "0.6033433", "0.5983393", "0.59147847", "0.5811616", "0.57555276", "0.55990124", "0.55718535", "0.5565008", "0.55496025", "0.55280703", "0.55280703", "0.55280703", "0.5511524", "0.5504424", "0.5491795", "0.5482527", "0.54671776", "0.54...
0.72678703
1
Insert a multitude of fingerprints.
def insert_hashes(self, title, artist, song_id: int, hashes: List[Tuple[str, int]], batch_size: int = 1000): data = [] for hsh, offset in hashes: document = {} document['song_id'] = song_id document['hash'] = hsh document['song_title'] = title ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insert(self, fingerprint):\n if len(fingerprint) > 5:\n fingerprint = fingerprint[0:5]\n if self.validate(fingerprint):\n self.fingerprints.add(fingerprint)", "def insert_hash(self, title, artist, song_id:int, fingerprint: str, offset:int):\n fingerprint = Fingerpri...
[ "0.6825683", "0.5906483", "0.5688196", "0.5609229", "0.5537088", "0.5531024", "0.5484383", "0.54810137", "0.5470827", "0.52944154", "0.5276511", "0.5269207", "0.52648413", "0.5254324", "0.5237776", "0.51862067", "0.5185001", "0.5170208", "0.516036", "0.51305324", "0.51293284"...
0.6090754
1
Inserts a song name into the database, returns the new identifier of the song.
def insert_song(self, song_name: str, title: str, artist: str, file_hash: str, total_hashes: int) -> int: id = random.randint(1, 1000000000000) song = Songs(meta={'id': id}, song_name=song_name, song_title=title, artist=artist, file_sha1=file_hash, total_hashes=total_hashes) song.save() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_song(self):\r\n path = input(\"Give file path:\\t\") # Request file path\r\n path = path.replace('\\\\', '/')\r\n if self.path_song_re.match(path) and not self.path_storage_re.match(\r\n path): # Check that the path leads to a song that is not already found in Storage\...
[ "0.6810411", "0.66526127", "0.6594127", "0.657137", "0.6506798", "0.65043277", "0.6501528", "0.6483825", "0.64761454", "0.64630157", "0.6401698", "0.63988096", "0.63975096", "0.63790995", "0.6379006", "0.6371201", "0.63673896", "0.63277274", "0.63175327", "0.63076925", "0.628...
0.7379901
0
Sets a specific song as having all fingerprints in the database.
def set_song_fingerprinted(self, song_id): song = Songs.get(id=song_id) song.fingerprinted = True song.save()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_song_fingerprinted(self, song_id):\n print(\"song_id to set fingerprinted: \",song_id)\n record = {\n \"doc\": {\n FIELD_FINGERPRINTED: True\n },\n \"doc_as_upsert\": True \n }\n self.cursor.update(index=SONGS_INDEXNAME, id=song_id...
[ "0.70908713", "0.568045", "0.56608284", "0.5504336", "0.5417803", "0.5379359", "0.5374514", "0.5341975", "0.5334636", "0.53159034", "0.53044254", "0.52961785", "0.5272522", "0.5263356", "0.52398026", "0.52205426", "0.51714045", "0.5163417", "0.50890315", "0.5082276", "0.50459...
0.7480399
0
Searches the database for pairs of (hash, offset) values.
def return_matches(self, hashes, batch_size: int=1000): # Create a dictionary of hash => offset pairs for later lookups mapper = {} for hsh, offset in hashes: if hsh in mapper.keys(): mapper[hsh].append(offset) else: mapper[hsh] = [offset] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def return_matches(hashes):\n # Create a dictionary of hash => offset pairs for later lookups\n mapper = {}\n for hash, offset in hashes:\n mapper[hash.upper()] = offset\n\n # Get an iteratable of all the hashes we need\n values = mapper.keys()\n\n conn = MySQLdb.connect(**connection_strin...
[ "0.6492396", "0.6211473", "0.5909353", "0.5821545", "0.5645369", "0.5560413", "0.5429363", "0.5413995", "0.53395015", "0.5322905", "0.53225833", "0.53145224", "0.52966297", "0.52577573", "0.51969326", "0.5165065", "0.5127904", "0.51113665", "0.5078803", "0.50611925", "0.50597...
0.64959234
0
Returns the combination of self and self.next. sourcepoints has to be set
def mergedWithNext(self, newPath=None): if newPath is None: newPath = Path( numpy.concatenate([self.points, self.next.points]) ) newPath.sourcepoints = self.sourcepoints newPath.prev = self.prev if self.prev : newPath.prev.next = newPath newPath.next = self.next.next if ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getNext(self):", "def getNext(self):\n\t\t\treturn self.next", "def __next__(self):\n if self.iterator < len(self.points):\n iterator = self.iterator\n self.iterator += 1\n return self.points[iterator]\n else:\n raise StopIteration", "def __next__...
[ "0.6585297", "0.6390287", "0.62769747", "0.6258431", "0.61986977", "0.6146859", "0.6111708", "0.6111708", "0.610436", "0.60866207", "0.6075295", "0.6063705", "0.60262126", "0.5934293", "0.58924323", "0.58871156", "0.58700365", "0.586498", "0.5852025", "0.5849822", "0.582998",...
0.6664665
0
return the point projection of p onto this segment
def projectPoint(self,p): a,b,c = self.a, self.b, self.c x,y = p return numpy.array( [ b*(x*b-y*a) - c*a, a*(y*a-x*b) - c*b ] )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def projection(self, point):\n projected_point = self._iterate_over_factors(\"projection\", {\"point\": point})\n return projected_point", "def projection(self, point):\n return gs.copy(point)", "def projectPoint(self, point):\n vector = self.normal_vector\n angle = vector.an...
[ "0.7410298", "0.7243793", "0.7108847", "0.6884003", "0.6823942", "0.6758408", "0.67165405", "0.6670361", "0.6632453", "0.6569346", "0.64356047", "0.6426158", "0.6397794", "0.6246395", "0.624245", "0.62329996", "0.62270254", "0.61561644", "0.6148456", "0.614108", "0.606386", ...
0.77129114
0
Modify self such as self.pointN is the intersection with next segment
def setIntersectWithNext(self, next=None): if next is None: next = self.next if next and next.isSegment(): if abs(self.normalv.dot(next.unitv)) < 1e-3: return debug(' Intersect',self, next, ' from ', self.point1, self.pointN, ' to ' ,next.point1, next...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def drawSegment(self, point):\n import Part\n if self.planetrack and self.node:\n self.planetrack.set(self.node[-1])\n if len(self.node) == 1:\n _msg(translate(\"draft\", \"Pick next point\"))\n elif len(self.node) == 2:\n last = self.node[len(self.node)...
[ "0.64808065", "0.64808065", "0.6317122", "0.61449033", "0.6066232", "0.59485126", "0.5933015", "0.58501744", "0.5846296", "0.5797218", "0.57721126", "0.57359487", "0.5707958", "0.5654892", "0.56543756", "0.56491935", "0.560843", "0.55858374", "0.5569458", "0.5562356", "0.5523...
0.75319207
0
Translate this segment by tr
def translate(self, tr): c = self.c -self.a*tr[0] -self.b*tr[1] self.c =c self.pointN = self.pointN+tr self.point1 = self.point1+tr self.points +=tr
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def translate(self, tr):\n self.points = self.points + tr", "def translate(self):\n pass", "def translate():\n pass", "def retranslate(self):\r\n pass", "def retranslate(self):\r\n pass", "def tr(self, tr):\n\n self._tr = tr", "def translate(self):\n rai...
[ "0.6685087", "0.648391", "0.6363463", "0.6157508", "0.6157508", "0.6068615", "0.60542876", "0.6034571", "0.5873075", "0.58494365", "0.5847122", "0.5831435", "0.5806417", "0.57685256", "0.5755426", "0.573013", "0.57069165", "0.5652448", "0.56457496", "0.5643483", "0.56386644",...
0.67941403
0
Add a node in the xml structure corresponding to this rect
def addToNode(self, refnode): ele = inkex.etree.Element('{http://www.w3.org/2000/svg}rect') self.fill(ele) refnode.xpath('..')[0].append(ele) return ele
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_node(self, node):", "def addToNode(self, refnode):\n ele = inkex.etree.Element('{http://www.w3.org/2000/svg}'+self.type)\n\n ele.set('cx',str(self.center[0]))\n ele.set('cy',str(self.center[1]))\n if self.rmax:\n ele.set('ry',str(self.radius))\n ele.set('...
[ "0.71020305", "0.68090975", "0.6494061", "0.6481451", "0.6260644", "0.6217668", "0.6202852", "0.6190928", "0.61904395", "0.6164714", "0.6160269", "0.6155252", "0.61275285", "0.61193806", "0.6039505", "0.6014048", "0.5997934", "0.59744954", "0.596744", "0.5955086", "0.5936972"...
0.76144874
0
Check if the segments in pathGroups can form a rectangle. Returns a Rectangle or None
def isRectangle( pathGroup): #print 'xxxxxxxx isRectangle',pathGroups if isinstance(pathGroup, Circle ): return None segmentList = [p for p in pathGroup.listOfPaths if p.isSegment() ]#or p.effectiveNPoints >0] if len(segmentList) != 4: debug( 'rectangle Failed at length ', le...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_rectal(self):\n return bool(self.locations and set(self.locations) <= set(StandardTerminology.RECTAL_LOCATIONS)) \\\n or bool(self.depth and 4 <= self.depth <= 16)", "def maybe_rectal(self):\n return bool(set(self.locations) & set(StandardTerminology.RECTAL_LOCATIONS))", "def...
[ "0.69826823", "0.62978417", "0.6102319", "0.60625494", "0.60418236", "0.5927473", "0.5892956", "0.58841634", "0.5868101", "0.5864376", "0.5841679", "0.57597774", "0.5738105", "0.57083166", "0.5663705", "0.56615156", "0.5640866", "0.563536", "0.56327426", "0.56241906", "0.5618...
0.80847883
0
perform a linear regression on 2dim array a. Creates a segment object in return
def regLin(a , returnOnlyPars=False): sumX = a[:,0].sum() sumY = a[:,1].sum() sumXY = (a[:,1]*a[:,0]).sum() a2 = a*a sumX2 = a2[:,0].sum() sumY2 = a2[:,1].sum() N = a.shape[0] pa = (N*sumXY - sumX*sumY)/ ( N*sumX2 - sumX*sumX) pb = (sumY - pa*sumX) /N if returnOnlyPars: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nnRegression(data):", "def linearRegression(A, b):\n m = Model()\n m.setParam('OutputFlag', False)\n\n n = len(A) # number of rows in A\n d = len(A[0]) # number of columns in A\n assert n == len(b) # make sure the shape of matrix is correct\n\n # x is of size d\n x = m.addVars(d, name='x')\n # ** is ...
[ "0.62704104", "0.62557465", "0.61783755", "0.6111347", "0.5941903", "0.5932731", "0.58852684", "0.5828881", "0.5742584", "0.5714349", "0.5658728", "0.5626737", "0.56084454", "0.5604923", "0.5582687", "0.55744016", "0.55706316", "0.5564871", "0.55647075", "0.5560306", "0.55351...
0.6955487
0
Cluster together consecutive angles with similar values (within 'dAng').
def clusterAngles(array, dAng=0.15): N = len(array) closebyAng = numpy.zeros( (N,4) , dtype=int) for i,a in enumerate(array): cb = closebyAng[i] cb[0] =i cb[2]=i cb[3]=i c=i-1 # find number of angles within dAng in nearby positions while c>-1: # indi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def diagonals_in_hd():\n number_of_pairs = 100000\n angles_for_d = {}\n for d in (10, 100, 1000):\n number_of_corners = 2 ** d - 1\n first_corner = [random.randint(0, number_of_corners) for _ in range(0, number_of_pairs)]\n second_corner = [random.randint(0, number_of_corners) for _ i...
[ "0.5694432", "0.56370103", "0.54485214", "0.5447116", "0.5423084", "0.5403551", "0.5376864", "0.5241591", "0.5236832", "0.52235013", "0.51876277", "0.5176692", "0.5172752", "0.51665497", "0.5164385", "0.51602894", "0.51534915", "0.51516104", "0.5128608", "0.5120975", "0.51117...
0.76809263
0
Perform Segment extension from list of Path segmentList returns the updated list of Path objects
def extendSegments(segmentList, relD=0.03, qual=0.5): fwdExt = FwdExtender(relD, qual) bwdExt = BwdExtender(relD, qual) # tag all objects with an attribute pointing to the extended object for seg in segmentList: seg.mergedObj = seg # by default the extended object...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reformatList( listOfPaths):\n newList = []\n first = True\n for seg in listOfPaths: \n newList += seg.asSVGCommand(first)\n first = False\n return newList", "def merge_segments(lst):\n ii = 0\n while True:\n jj = ii + 1\n if len(lst) <= jj:\n return lst\n seg...
[ "0.629697", "0.56867164", "0.56741893", "0.5671815", "0.55723095", "0.5506622", "0.5322704", "0.5272422", "0.51837695", "0.5182994", "0.51195025", "0.50996065", "0.5042988", "0.50389105", "0.50289774", "0.50188166", "0.49961066", "0.49592435", "0.49589303", "0.4912695", "0.49...
0.65964836
0
Returns a SVG paths list (same format as simplepath.parsePath) from a list of Path objects Segments in paths are added in the new list simple Path are retrieved from the original refSVGPathList and put in the new list (thus preserving original bezier curves)
def reformatList( listOfPaths): newList = [] first = True for seg in listOfPaths: newList += seg.asSVGCommand(first) first = False return newList
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addPath(newList, refnode):\n ele = inkex.etree.Element('{http://www.w3.org/2000/svg}path')\n ele.set('d', simplepath.formatPath(newList))\n refnode.xpath('..')[0].append(ele)\n return ele", "def _points_to_paths(self, points):\n prev = points[0]\n result = []\n for point in p...
[ "0.6723711", "0.5969523", "0.5911506", "0.5615803", "0.5556654", "0.543392", "0.5278974", "0.52735007", "0.5239825", "0.5231864", "0.5217833", "0.51845497", "0.51747656", "0.5174688", "0.51559424", "0.51437336", "0.5109244", "0.50839573", "0.50820696", "0.5070767", "0.5066707...
0.71131873
0