query
stringlengths
10
2k
document
stringlengths
20
51.2k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Run the pipeline with some additional checks. It is preferred to use this method over `run`, as it can catch some simple implementation errors of custom pipelines.
def safe_run(self, datapoint: DatasetT) -> Self: run_method = self.run if getattr(run_method, ACTION_METHOD_INDICATOR, False) is True: return run_method(datapoint) return _check_safe_run(self, run_method, datapoint)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(self):\n self.running = True\n\n try:\n for block in self._blocks:\n inputs = self._get_inputs(block.inputs_from)\n block.execute(inputs)\n\n self.is_error = False\n except:\n error_message = traceback.format_exc()\n\n ...
[ "0.6739044", "0.6687787", "0.65310526", "0.64317393", "0.6363915", "0.636217", "0.63401616", "0.61880296", "0.61352956", "0.6099079", "0.6081326", "0.60670596", "0.60395336", "0.603727", "0.60297436", "0.6029559", "0.601459", "0.6000442", "0.5985885", "0.59508604", "0.5946957...
0.0
-1
String representation of the SentencePair object.
def __str__(self): summary = '{} object in the {} language, consisting of {} tokens.' return summary.format( type(self).__name__, self.language, len(self.hand_tagged) )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __repr__(self) -> str:\n return 'Pair({!r}, {!r})'.format(*self.names)", "def to_str(self):\n return pprint.pformat(self.to_dict())", "def to_str(self):\n return pprint.pformat(self.to_dict())", "def to_str(self):\n return pprint.pformat(self.to_dict())", "def to_str(self):\...
[ "0.73634434", "0.6993613", "0.6993613", "0.6993613", "0.6993613", "0.6993613", "0.6993613", "0.6993613", "0.6993613", "0.6993613", "0.6993613", "0.6993613", "0.6993613", "0.6993613", "0.6993613", "0.6993613", "0.6993613", "0.6993613", "0.6993613", "0.6993613", "0.6993613", ...
0.0
-1
Render the homepage template on the / route
def home(): return render_template('home.html', title="Home")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def homepage():\n return render_template(\"home/index.html\")", "def home():\n return render_template('homepage.html')", "def homepage():\n return render_template('homepage.html')", "def homepage():\n return render_template(\"home/index.html\", title=\"Welcome\")", "def render_home():\r\n\treturn...
[ "0.8596693", "0.8568932", "0.8526821", "0.8473926", "0.8473321", "0.84519774", "0.84239286", "0.84239286", "0.8420498", "0.8387553", "0.8311804", "0.82661605", "0.82661605", "0.82661605", "0.82661605", "0.82661605", "0.82661605", "0.8263859", "0.8259376", "0.82504493", "0.825...
0.79348844
55
It defines a new converting rule same with existing one.
def alias(new_field, existing_field): mapping[new_field] = mapping[existing_field]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert(self):\n return _libsbml.SBMLRuleConverter_convert(self)", "def SBMLRuleConverter_init():\n return _libsbml.SBMLRuleConverter_init()", "def init():\n return _libsbml.SBMLRuleConverter_init()", "def __init__(self, *args):\n this = _libsbml.new_SBMLRuleConverter(*args)\n ...
[ "0.69518405", "0.62563586", "0.62316144", "0.61689216", "0.60831445", "0.6059068", "0.5999561", "0.59168714", "0.5782275", "0.5766955", "0.57464975", "0.57464975", "0.57464975", "0.57464975", "0.57464975", "0.5693936", "0.5659466", "0.56519777", "0.5647486", "0.56465423", "0....
0.0
-1
Tests that a `book` statement has the expected `event_type` and `name`.
def test_models_edx_ui_book_with_valid_statement(statement): assert statement.event_type == "book" assert statement.name == "book"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_models_edx_ui_textbook_pdf_search_executed_with_valid_statement(statement):\n assert statement.event_type == \"textbook.pdf.search.executed\"\n assert statement.name == \"textbook.pdf.search.executed\"", "def test_models_edx_ui_textbook_pdf_chapter_navigated_with_valid_statement(\n statement,\n...
[ "0.60359347", "0.5928695", "0.58608747", "0.58318865", "0.58019435", "0.5780866", "0.5736091", "0.5719293", "0.56109756", "0.5595765", "0.55936706", "0.5556197", "0.55440634", "0.5533699", "0.5512486", "0.55102634", "0.5483842", "0.545004", "0.5444361", "0.5413387", "0.538360...
0.8112002
0
Returns absolute distance between self and another interval start positions. Returns 1 if they are on different chromosome. If enforceStrand=True, then this function requires that both intervals be on the same strand. If they aren't, 1 is returned.
def distance(self,b,enforceStrand=False): if b.chr != self.chr: return -1 if enforceStrand: if self.strand!=b.strand: return -1 else: return abs(self.start-b.start)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_position_distance(pos1, pos2, ignore_strand=False):\n NaN = float('nan')\n if pos1 in SPECIAL_POSITIONS.all_undefined: return NaN\n elif pos2 in SPECIAL_POSITIONS.all_undefined: return NaN\n elif pos1.chromosome != pos2.chromosome: return NaN\n elif not i...
[ "0.62291986", "0.6198601", "0.61971086", "0.5852307", "0.5709912", "0.5709912", "0.5695858", "0.56904936", "0.56810915", "0.5667073", "0.56548", "0.5627119", "0.5620375", "0.5607384", "0.5584006", "0.5574366", "0.554463", "0.5541727", "0.5528866", "0.55285597", "0.5491545", ...
0.7466229
0
Returns the distance between two interval TSSs.
def distanceBetweenTSS(self,b): if self.chr != b.chr: return False if self.strand == "+": return b.TSS-self.TSS elif self.strand == "-": return self.TSS-b.TSS else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def distance_between_intervals(s1,s2,interval):\n class __distance_interval:\n def __init__(self,first_pos, last_pos, first, second):\n self.distance = last_pos - first_pos\n self.first = first\n self.second = second\n self.start = first_pos\n self.e...
[ "0.698564", "0.6774889", "0.6765179", "0.6722175", "0.6712679", "0.6698029", "0.6669038", "0.6637071", "0.6636988", "0.6585502", "0.65802956", "0.6547739", "0.6540086", "0.6508521", "0.6507606", "0.6497234", "0.6484807", "0.64818406", "0.6476554", "0.64496255", "0.64443594", ...
0.6561243
11
Returns GC fraction of self.sequence
def getGC(self): numGC = self.sequence.upper().count("G") + self.sequence.upper().count("C") self.gc = float(numGC)/len(self.sequence) return self.gc
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gc(self):\n g = self.seq.count('G')\n g += self.seq.count('g')\n c = self.seq.count('C')\n c += self.seq.count('c')\n return (g + c) / len(self.seq)", "def gc(self) -> float:\n g = self.count(\"G\")\n c = self.count(\"C\")\n return (g + c) / len(self) *...
[ "0.83934665", "0.80268145", "0.7642649", "0.7594442", "0.7413407", "0.73633033", "0.7327052", "0.7321557", "0.7231911", "0.7228322", "0.70943946", "0.70275176", "0.6958186", "0.6618462", "0.6618462", "0.6506674", "0.6505485", "0.64787245", "0.6356298", "0.63087237", "0.614405...
0.8411961
0
Returns list of intervals corresponding to exonic sequences for self
def getExons(self): rtrn = [] for i in range(0,len(self.exonStarts)): rtrn.append(Interval(self.chr,self.exonStarts[i],self.exonEnds[i],self.strand,name = self.name+"_exon_"+str(i+1))) return rtrn
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getIntrons(self):\n rtrn = []\n for i in range(0,len(self.exonStarts)-1):\n rtrn.append(Interval(self.chr,self.exonEnds[i]+1,self.exonStarts[i+1]-1))\n return rtrn", "def interiors(self):\n return self.substrates.interiors", "def make_intervals(self):\n if not ...
[ "0.78634423", "0.67370194", "0.66900665", "0.65599513", "0.63515353", "0.6350036", "0.6305932", "0.622475", "0.6114907", "0.60904825", "0.60872555", "0.59866834", "0.59445083", "0.5938786", "0.59025216", "0.5882685", "0.586071", "0.5848547", "0.58381927", "0.57953453", "0.575...
0.7888401
0
Returns list of intervals corresponding to intronic sequences for self
def getIntrons(self): rtrn = [] for i in range(0,len(self.exonStarts)-1): rtrn.append(Interval(self.chr,self.exonEnds[i]+1,self.exonStarts[i+1]-1)) return rtrn
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getExons(self):\n rtrn = []\n for i in range(0,len(self.exonStarts)):\n rtrn.append(Interval(self.chr,self.exonStarts[i],self.exonEnds[i],self.strand,name = self.name+\"_exon_\"+str(i+1)))\n return rtrn", "def get_interval_seqs(interval_alignment: AlignIO.MultipleSeqAlignment)...
[ "0.6775239", "0.6604869", "0.6517869", "0.65096784", "0.6473863", "0.6273962", "0.6256563", "0.6207553", "0.618841", "0.6166284", "0.6097735", "0.6097617", "0.6088694", "0.60551566", "0.6029853", "0.59518844", "0.5941821", "0.5935434", "0.5893286", "0.5878792", "0.586206", ...
0.73727185
0
Generates random string (by default, length=10)
def GenRandom(length = 10, chars=string.letters+string.digits): return ''.join([random.choice(chars) for i in range(length)])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _random_string(self, size, chars=None):\n return ''.join(random.choice(chars or _DEFAULT_CHARS) for _ in range(size))", "def _generate_random_string(length: int):\n\tall_chars = string.ascii_letters + string.digits\n\treturn ''.join(random.choices(all_chars, k=length))", "def random_string(length=10):\n...
[ "0.83103967", "0.8287568", "0.8245179", "0.8227956", "0.81616807", "0.8126241", "0.81043124", "0.80850524", "0.8079872", "0.80750495", "0.80719614", "0.80427665", "0.803936", "0.8034598", "0.80218595", "0.79637074", "0.79566216", "0.7949181", "0.79441166", "0.7907882", "0.790...
0.77147526
63
returns a list of a text file's contents
def getFastaData2D(fileName): fileThing = open(fileName, "r") data = fileThing.readlines() fileThing.close() retlist = [] for i in range(len(data)): if data[i][0] == ">": retlist.append([fixName(data[i]), fixString(data[i+1])]) return retlist
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getlistfromtext(self,filename):\n l=[]\n\n if self.encoding:\n f = codecs.open(filename,\"r\",encoding=self.encoding)\n for line in f:\n l.append(line.rstrip())\n f.close()\n\n else:\n f = open(filename,\"r\")\n for line...
[ "0.835068", "0.8260842", "0.8114176", "0.79069453", "0.7841011", "0.7759766", "0.77241135", "0.76275873", "0.7534252", "0.7525591", "0.7525591", "0.7517489", "0.7465953", "0.7452292", "0.7432176", "0.7423679", "0.74142164", "0.74059546", "0.74059546", "0.7375245", "0.73552215...
0.0
-1
returns the number of bases that don't match between strings, avoiding '' and 'N'
def determineIdenticalBases(string1, string2): S = 0 D = 0 if len(string1) != len(string2): return -1 for i in range(len(string1)): if checkForNOrGap(string1[i]) and checkForNOrGap(string2[i]) : if string1[i] == string2[i]: S += 1 else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_nmismatches(bases_mask):\n # Check mask is valid\n if not bases_mask_is_valid(bases_mask):\n raise Exception(\"'%s': not a valid bases mask\" % bases_mask)\n # Total the length of all index reads\n index_length = 0\n for read in bases_mask.upper().split(','):\n if read.startswi...
[ "0.699806", "0.6817937", "0.64211917", "0.638937", "0.6240919", "0.6167376", "0.6136362", "0.6132143", "0.6115518", "0.60830444", "0.596033", "0.5893631", "0.58257467", "0.5770797", "0.5730208", "0.57286173", "0.57051694", "0.57040435", "0.57020044", "0.5687875", "0.56573844"...
0.76896596
1
Gets the response_kafka_connection_url of this InlineResponse200Properties.
def response_kafka_connection_url(self) -> str: return self._response_kafka_connection_url
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def response_kafka_connection_url(self, response_kafka_connection_url: str):\n\n self._response_kafka_connection_url = response_kafka_connection_url", "def get_url(self):\n return self.metadata['thisRecordUrl']", "def get_url(self):\n return self.resource.url", "def get_url(self):\n\n ...
[ "0.71108335", "0.57857734", "0.5763466", "0.5646256", "0.5646256", "0.562369", "0.561811", "0.55920327", "0.55904835", "0.55677056", "0.54969454", "0.54969454", "0.5491826", "0.5483601", "0.5424831", "0.54241264", "0.5421835", "0.5419944", "0.53938824", "0.53859395", "0.53664...
0.8369175
0
Sets the response_kafka_connection_url of this InlineResponse200Properties.
def response_kafka_connection_url(self, response_kafka_connection_url: str): self._response_kafka_connection_url = response_kafka_connection_url
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def response_kafka_connection_url(self) -> str:\n return self._response_kafka_connection_url", "def __init__(self, response_kafka_connection_url: str=None, response_kafka_topic_name: str=None):\n self.swagger_types = {\n 'response_kafka_connection_url': str,\n 'response_kafka_...
[ "0.6983392", "0.6147558", "0.5484764", "0.53647417", "0.50474316", "0.50198406", "0.501983", "0.50164306", "0.49665135", "0.49275172", "0.49275172", "0.48909283", "0.48568377", "0.4717892", "0.46949047", "0.46719047", "0.45966697", "0.45937678", "0.45496672", "0.45386308", "0...
0.8191783
0
Retrieves the list of all stores selling the product
def get_stores(self, product_id: str) -> List: product_stores_request = """SELECT s.store_name FROM store s INNER JOIN store_has_product shp ON s.id = shp.store_id WHERE shp.product_id = %s""" stores_list = [] for store in self.query(product_stores_request, (p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_products_stores():\n if not request.args:\n abort(400) # Need at least one article ID/number!\n args = MultiDict(request.args)\n article_nums = args.getlist('article_number')\n if not len(article_nums):\n abort(400) # Same as above\n stores = []\n stock = db_interface.get_...
[ "0.69715244", "0.6951663", "0.69077", "0.6819945", "0.63621163", "0.63463545", "0.6343647", "0.63134104", "0.6296403", "0.6211314", "0.6187462", "0.6183628", "0.6170272", "0.6110572", "0.61092496", "0.6072695", "0.5988726", "0.5955001", "0.5939292", "0.59358704", "0.59162134"...
0.7737977
0
Close the database connection.
def disconnect(self) -> None: self.connection.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close_db_connection(cls):\n db.close()", "def close_database(self):\n if self._conn is not None:\n self._conn.close()\n self._conn = None", "def close(self):\n Log.debug('DB -> close')\n # 关闭数据库连接\n self.conn.close()", "def close(self):\n if...
[ "0.8823254", "0.8553475", "0.8422749", "0.8399332", "0.838896", "0.82840264", "0.81800705", "0.81762004", "0.81495583", "0.798094", "0.798094", "0.798094", "0.7980928", "0.7978066", "0.7977289", "0.79737633", "0.7938943", "0.7933802", "0.79221076", "0.79041046", "0.78885204",...
0.0
-1
Return the polling state.
def should_poll(self): return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_state(self):\r\n alarm = self._alarm()\r\n return alarm.state", "def _get_state(self):\n # gst's get_state function returns a 3-tuple; we just want the\n # status flag in position 1.\n return self.pipeline.get_state(Gst.CLOCK_TIME_NONE)[1]", "def state(self):\n ...
[ "0.70800793", "0.69442177", "0.6918493", "0.6845751", "0.68327427", "0.67729336", "0.67729336", "0.6728276", "0.6668334", "0.6641413", "0.6641413", "0.6641413", "0.6641413", "0.6641413", "0.66395515", "0.66395515", "0.66395515", "0.66395515", "0.66395515", "0.66395515", "0.66...
0.0
-1
Return the name of the climate device.
def name(self): return self._name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name(self):\n return self.device.name()", "def name(self):\n return f\"{get_device_name(self._data, 0, self._name)}\"", "def name(self):\n return self._device.name", "def name(self):\n return self._device.name", "def name(self):\n return self._device.name", "def nam...
[ "0.7371205", "0.7316501", "0.72838986", "0.72838986", "0.72838986", "0.7255765", "0.722154", "0.72074884", "0.7181782", "0.7181782", "0.7166295", "0.7166295", "0.7128231", "0.7119962", "0.7111241", "0.7081883", "0.70140094", "0.6965152", "0.6956518", "0.6927677", "0.6916925",...
0.0
-1
The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
def type(self) -> str: return pulumi.get(self, "type")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resource_type(self) -> Optional[str]:\n return pulumi.get(self, \"resource_type\")", "def resource_type(self) -> Optional[str]:\n return pulumi.get(self, \"resource_type\")", "def resource_type(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"resource_type\")", "def ...
[ "0.7919164", "0.7919164", "0.78668755", "0.78668755", "0.78668755", "0.78668755", "0.78668755", "0.770802", "0.7553664", "0.72831416", "0.70599407", "0.69803584", "0.69217974", "0.6869932", "0.6728729", "0.6705747", "0.66551214", "0.6647084", "0.6552052", "0.65431905", "0.654...
0.66403013
34
Returns the total exit delay time. Returns 0 if an exit delay is not currently running.
async def getDelayTimeTotal(self): delay_time_total = await self.director.getItemVariableValue( self.item_id, "DELAY_TIME_TOTAL" ) return delay_time_total
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def duration( self ):\n return (self.start and time.process_time()-self.start) or 0", "async def getDelayTimeRemaining(self):\n delay_time_remaining = await self.director.getItemVariableValue(\n self.item_id, \"DELAY_TIME_REMAINING\"\n )\n return delay_time_remaining", "d...
[ "0.6798914", "0.6442248", "0.6434253", "0.6420898", "0.641385", "0.64006895", "0.63890743", "0.6387432", "0.63808465", "0.6367981", "0.6362484", "0.63454354", "0.6315505", "0.62969697", "0.62548214", "0.62542737", "0.62450564", "0.6244223", "0.62164456", "0.6215504", "0.62117...
0.6590339
1
Returns the number of open/unsecured zones.
async def getOpenZoneCount(self): open_zone_count = await self.director.getItemVariableValue( self.item_id, "OPEN_ZONE_COUNT" ) return open_zone_count
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def number_of_open_sites(self):\n return sum(sum(line) for line in self._grid)", "def num_memory_zones(self):\n count = self._dll.JLINK_GetMemZones(0, 0)\n if count < 0:\n raise errors.JLinkException(count)\n return count", "def get_num_us_states(self):\n return le...
[ "0.6326803", "0.63020307", "0.6291699", "0.62335384", "0.6196428", "0.61734545", "0.596462", "0.5944165", "0.59410244", "0.59022033", "0.58676916", "0.5866513", "0.58644634", "0.58547765", "0.584626", "0.58282167", "0.5802826", "0.57867056", "0.57859004", "0.5771508", "0.5771...
0.7538739
0
Returns details about the current alarm type.
async def getAlarmType(self): alarm_type = await self.director.getItemVariableValue( self.item_id, "ALARM_TYPE" ) return alarm_type
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_alarm_type(self):\n alarm_type = -1\n if self.last_event_code == DEFS.EF_ALARM:\n alarm_type = struct.unpack('<I', self.last_payload_data[0:4])[0]\n return alarm_type", "def get_alarm_sound_type(self):\n request_command = self.parser_invoker.get_alarm_sound_type_c...
[ "0.71335876", "0.66821986", "0.65856546", "0.62334925", "0.6155503", "0.61454767", "0.6044328", "0.603921", "0.603921", "0.603921", "0.603921", "0.603921", "0.603921", "0.603921", "0.603921", "0.603921", "0.603921", "0.603921", "0.603921", "0.603921", "0.603921", "0.603921"...
0.82118076
0
Returns details about the current arm type.
async def getArmedType(self): armed_type = await self.director.getItemVariableValue( self.item_id, "ARMED_TYPE" ) return armed_type
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def detail_type(self) -> str:\n return pulumi.get(self, \"detail_type\")", "def type(self) -> str:\n return pulumi.get(self, \"type\")", "def type(self) -> str:\n return pulumi.get(self, \"type\")", "def type(self) -> str:\n return pulumi.get(self, \"type\")", "def type(self) ->...
[ "0.68678874", "0.68296057", "0.68296057", "0.68296057", "0.68296057", "0.68296057", "0.68296057", "0.68296057", "0.68296057", "0.68296057", "0.68296057", "0.68296057", "0.68296057", "0.68296057", "0.68296057", "0.68296057", "0.68296057", "0.68296057", "0.68296057", "0.68296057"...
0.6454987
79
return a dictionary with the eligibility of each operator
def get_operators(city): result = {} df = pd.read_csv(output_file, sep = ';') #filter by city df = df.loc[df['city'] == city] if 0 == len(df): msg = "No operator data available in our database for the requested address!" return jsonify(message = msg) else: for index in df.index: operateur = df['Operat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def operators(self):\n return self.domain.operators.keys()", "def get_safety_evaluator(self):\n constraint_names = self._meta['safety_constraints']\n safety_stats = self._stats['safety_stats']\n violations = np.sum(safety_stats['total_violations'], axis=0)\n evaluator_results = collections.Ord...
[ "0.6029907", "0.5899562", "0.5698071", "0.5463518", "0.54496455", "0.5444085", "0.53955126", "0.5374398", "0.53195316", "0.5308774", "0.52776474", "0.52254736", "0.52136505", "0.52115387", "0.5183417", "0.5175295", "0.51550096", "0.5153142", "0.5136422", "0.51112753", "0.5063...
0.4710698
79
Plot x_train (and possibly x_test) and show a 2D scatter plot of x_train (and possibly x_test). If x_test is provided, x_train points will be smaller and grayscale and x_test points will be colored. Will log figure to comet if Experiment object is provided. Otherwise, plt.show() is called.
def plot(self, x_train, x_test=None, cmap='jet', s=15, title=None, fit=False): if self.comet_exp is not None: # If comet_exp is set, use different backend to avoid display errors on clusters matplotlib.use('Agg') # Must be before importing matplotlib.pyplot or pylab! import matp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scatter_plot(x_train, y_train, x_test, y_test, class1, class2):\n train_c0 = x_train[y_train == 0, :]\n train_c1 = x_train[y_train == 1, :]\n test_c0 = x_test[y_test == 0, :]\n test_c1 = x_test[y_test == 1, :]\n fig, a = plt.subplots(1, 2)\n fig.set_size_inches(11, 5)\n a[0].scatter(train_...
[ "0.7804946", "0.7539634", "0.7337518", "0.7090166", "0.70314455", "0.70196027", "0.69485736", "0.6890074", "0.66758955", "0.665319", "0.65678495", "0.65574026", "0.6536623", "0.6490643", "0.6436806", "0.6391436", "0.6317323", "0.6285642", "0.62724614", "0.6234924", "0.6233837...
0.77755105
1
Constructs a `BertConfig` from a Python dictionary of parameters.
def from_dict(cls, json_object): config = BertConfig(vocab_size_or_config_json_file=-1) for key, value in json_object.items(): config.__dict__[key] = value return config
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_dict(cls, json_object):\n config = BertConfig(max_seq_length = None, vocab_size = None)\n for (key, value) in six.iteritems(json_object):\n config.__dict__[key] = value\n return config", "def from_dict(cls, json_object):\n config = BertConfig(vocab_size=None)\n for key, value...
[ "0.71662986", "0.67593825", "0.64461035", "0.6409664", "0.6296021", "0.62563765", "0.59984237", "0.5973476", "0.5962231", "0.5960105", "0.5949449", "0.5949449", "0.59268445", "0.5828967", "0.5776276", "0.57383215", "0.5732002", "0.5730361", "0.56063217", "0.56021696", "0.5591...
0.6755972
4
Serializes this instance to a Python dictionary.
def to_dict(self): output = copy.deepcopy(self.__dict__) return output
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_dict(self):\n return dumpd(self)", "def to_dict(self):\n serialized = self._serializer().dump(self)\n return serialized.data", "def to_dict(self):\n return to_dict(self.__dict__)", "def to_dict(self):\r\n return self.__dict__", "def to_dict(self):\n return s...
[ "0.8421195", "0.84043926", "0.8362277", "0.83090377", "0.82829785", "0.82829785", "0.82829785", "0.82829785", "0.82829785", "0.82829785", "0.8236021", "0.82179517", "0.82133806", "0.82032114", "0.8181652", "0.8179579", "0.81732064", "0.81534773", "0.8118078", "0.8090142", "0....
0.0
-1
Serializes this instance to a JSON string.
def to_json_string(self): return json.dumps(self.to_dict(), indent=2, sort_keys=True) + '\n'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def serialize(self) -> str:\n return json.dumps(self.__dict__)", "def serialize(self):\n return json.dumps(self.as_dict())", "def to_json(self) -> str:\n return json.dumps(self.to_dict())", "def to_json(self) -> str:\n return json.dumps(self.to_dict())", "def to_json(self) -> st...
[ "0.89013636", "0.88374937", "0.8804384", "0.8804384", "0.8804384", "0.8804384", "0.8804384", "0.8804384", "0.8804384", "0.8804384", "0.8804384", "0.8714153", "0.8636141", "0.86186236", "0.8597715", "0.8570726", "0.8567598", "0.8567598", "0.84452665", "0.84452665", "0.84452665...
0.0
-1
Construct a layernorm module in the TF style (epsilon inside the square root).
def __init__(self, hidden_size, eps=1e-12): super(BertLayerNorm, self).__init__() self.weight = nn.Parameter(torch.ones(hidden_size)) self.bias = nn.Parameter(torch.zeros(hidden_size)) self.variance_epsilon = eps
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verhulst(nb_init, t0, tf, eps, methode, gamma, K) :\n f=lambda y,t : gamma*y*(1-y/K)\n Y=meth_epsilon(nb_init, t0, tf, eps, f, methode)\n return Y", "def malthusiens(nb_init, t0, tf, eps, methode, gamma ) :\n\n f=lambda y, t : gamma*y\n Y=meth_epsilon(nb_init, t0, tf, eps, f, methode)\n ...
[ "0.62756556", "0.60137963", "0.5794421", "0.5741132", "0.5537428", "0.55186504", "0.5421792", "0.54128486", "0.5386446", "0.5368555", "0.53518397", "0.52855283", "0.5256953", "0.5231894", "0.52269214", "0.5223639", "0.5220193", "0.5218837", "0.5192135", "0.519095", "0.519095"...
0.0
-1
Checks whether `chars` is a control character.
def _is_control(char): if char == '\t' or char == '\n' or char == '\r': return False cat = unicodedata.category(char) if cat.startswith('C'): return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _is_control(char):\n # These are technically control characters but we count them as whitespace\n # characters.\n if char == \"\\t\" or char == \"\\n\" or char == \"\\r\":\n return False\n cat = unicodedata.category(char)\n if cat.startswith(\"C\"):\n return True\n return False"...
[ "0.81981814", "0.81981814", "0.8177336", "0.8169858", "0.6468453", "0.58763784", "0.582512", "0.5796899", "0.5719301", "0.57148904", "0.57065594", "0.56959367", "0.5653251", "0.5603813", "0.5585948", "0.55843735", "0.55716395", "0.55498976", "0.55498976", "0.55404437", "0.552...
0.80915713
4
Checks whether `chars` is a whitespace character.
def _is_whitespace(char): if char == ' ' or char == '\t' or char == '\n' or char == '\r': return True cat = unicodedata.category(char) if cat == 'Zs': return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _is_whitespace(char):\n # \\t, \\n, and \\r are technically contorl characters but we treat them\n # as whitespace since they are generally considered as such.\n if char == \" \" or char == \"\\t\" or char == \"\\n\" or char == \"\\r\":\n return True\n cat = unicodedata.category(char)\n i...
[ "0.7680234", "0.7633813", "0.76118195", "0.7108098", "0.6929217", "0.6814356", "0.67606235", "0.65372074", "0.64895546", "0.64892155", "0.6466964", "0.64537275", "0.64364225", "0.6071991", "0.5989213", "0.59863365", "0.59160656", "0.5889098", "0.5882985", "0.58735234", "0.580...
0.78012747
0
Runs basic whitespace cleaning and splitting on a piece of text.
def whitespace_tokenize(text): text = text.strip() if not text: return [] tokens = text.split() return tokens
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tokenize(text):\n return text.split(' ')", "def whitespace_tokenize(text):\n text = text.strip()\n if not text:\n return []\n tokens = text.split()\n return tokens", "def clean_whitespace(text):\n return text\n #return re.sub(r'\\r\\n|\\n', \"\\t\", text)", "def _split(self):\n \n ...
[ "0.6439049", "0.6300005", "0.6284847", "0.62824225", "0.62147355", "0.6206382", "0.6165981", "0.61554945", "0.61485386", "0.61298126", "0.6112172", "0.61113316", "0.6097497", "0.60766", "0.6067344", "0.6060772", "0.60185647", "0.6017855", "0.59917736", "0.59917736", "0.598616...
0.6255953
4
Strips accents from a piece of text.
def _run_strip_accents(self, text): text = unicodedata.normalize('NFD', text) output = [] for char in text: cat = unicodedata.category(char) if cat == 'Mn': continue output.append(char) return ''.join(output)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_accented_chars(text):\n text = unidecode.unidecode(text)\n return text", "def remove_accented_chars(text):\n text = unicodedata.normalize('NFKD', text).encode('ascii', 'ignore').decode('utf-8', 'ignore')\n return text", "def _run_strip_accents(self, text):\n text = unicodedata.nor...
[ "0.80722386", "0.794066", "0.78232193", "0.78133005", "0.77829057", "0.76503175", "0.75764644", "0.75723135", "0.755455", "0.75105137", "0.709229", "0.700222", "0.700222", "0.6947644", "0.6937378", "0.6919725", "0.6917741", "0.68839735", "0.6854105", "0.6839982", "0.68178123"...
0.78225666
3
Tokenizes a piece of text into its word pieces. This uses a greedy longestmatchfirst algorithm to perform tokenization using the given vocabulary.
def tokenize(self, text): output_tokens = [] for token in whitespace_tokenize(text): chars = list(token) if len(chars) > self.max_input_chars_per_word: output_tokens.append(self.unk_token) continue is_bad = False start = 0 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def word_tokenize(text):\n for (regexp, replacement) in RULES1:\n text = sub(regexp, replacement, text)\n # add extra space to make things easier\n text = \" \" + text + \" \"\n for (regexp, replacement) in RULES2:\n text = sub(regexp, replacement, text)\n for regexp in CONTRACTIONS:\n...
[ "0.67671174", "0.65832746", "0.6559442", "0.6547052", "0.6541289", "0.65295446", "0.6510093", "0.6504219", "0.6489972", "0.64711624", "0.6445812", "0.6412271", "0.6394383", "0.63709706", "0.6369706", "0.63654137", "0.6364093", "0.63595885", "0.6345023", "0.6342264", "0.633624...
0.6166774
44
Converts a sequence of tokens into ids using the vocab.
def convert_tokens_to_ids(self, tokens): ids = [] for token in tokens: ids.append(self.vocab[token]) if len(ids) > self.max_len: logger.warning('Token indices sequence length is longer than the specified maximum sequence length for this BERT model ({} > {}). Running this...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sequence_to_list_ids(sequence, vocab):\n pass", "def sentence_to_token_ids(sentence, vocabulary):\n return [vocabulary.get(w, UNK_ID) for w in sentence.strip().split()]", "def convert_to_ids(self, vocab):\n for data_set in [self.train_set, self.dev_set, self.test_set]:\n if data_set...
[ "0.7760125", "0.74963677", "0.7465171", "0.74226004", "0.73314273", "0.73061234", "0.7287909", "0.72748107", "0.7237548", "0.7222457", "0.7209118", "0.7168923", "0.70928735", "0.70247203", "0.68646646", "0.6838162", "0.6824125", "0.6781408", "0.67564845", "0.6729754", "0.6718...
0.7257345
8
Excludes any questions that aren't published yet.
def get_queryset(self): return Question.objects.filter(pub_date__lte=timezone.now())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_queryset(self):\n # the filter says that it only returns those w/ the pub_date\n # less or equal to timezone.now() (earlier or now)\n questions = Question.objects.filter(\n pub_date__lte=timezone.now()\n ).order_by('-pub_date')\n\n excludes = []\n for qu...
[ "0.66057587", "0.6447535", "0.6222388", "0.6170101", "0.6170101", "0.6101224", "0.6100283", "0.6083196", "0.6055842", "0.60525465", "0.5971601", "0.5893893", "0.5893893", "0.5890032", "0.5882812", "0.58696455", "0.58696455", "0.58696455", "0.58696455", "0.58689994", "0.585721...
0.62109476
12
Excludes any questions that aren't published yet.
def get_queryset(self): return Question.objects.filter(pub_date__lte=timezone.now())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_queryset(self):\n # the filter says that it only returns those w/ the pub_date\n # less or equal to timezone.now() (earlier or now)\n questions = Question.objects.filter(\n pub_date__lte=timezone.now()\n ).order_by('-pub_date')\n\n excludes = []\n for qu...
[ "0.66057587", "0.6447535", "0.6222388", "0.6170101", "0.6170101", "0.6101224", "0.6100283", "0.6083196", "0.6055842", "0.60525465", "0.5971601", "0.5893893", "0.5893893", "0.5890032", "0.5882812", "0.58696455", "0.58696455", "0.58696455", "0.58696455", "0.58689994", "0.585721...
0.62109476
11
Class to define a player
def __init__(self, name: str, team: str, number: int): self.name = name self.team = team self.number = number
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, player):\n self.player = player", "def __init__(self, player):\n\t\tself.player = player", "def newPlayer():\r\n pass", "def __init__(self,player,name,playerFn):\n\t\tself.player = player\n\t\tself.name = name\n\t\tself.playerFn = playerFn", "def __init__(self, player_name, pla...
[ "0.7903477", "0.78945774", "0.7662981", "0.7617032", "0.73206806", "0.7282273", "0.71071863", "0.7065085", "0.69654334", "0.6925719", "0.6904455", "0.68996996", "0.68797797", "0.68792576", "0.68609095", "0.6815335", "0.68139327", "0.67990184", "0.677923", "0.67778444", "0.677...
0.0
-1
Filter that reads a file and returns one line at random, split into two pieces (quote and author) as a list.
def random_quote(filename): quote = random_line(filename) divided = quote.split('~') if len(divided) > 0: return divided else: return ["OH MY GOD WHO'S FLYING THIS THING!?!!", "..oh right, that would be me."]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def readFiltered(f):\n line = f.readline()\n while line:\n line = line.strip()\n if len(line) != 0:\n if line == \"### NEW EXPERIMENT ###\":\n # print (\"readFiltered: ''\")\n yield \"\"\n elif line[0] != \"#\":\n # print (\"rea...
[ "0.63240975", "0.63120043", "0.60511726", "0.6009503", "0.60046184", "0.58879066", "0.58490366", "0.5842122", "0.5824352", "0.5723417", "0.5720908", "0.5704005", "0.5675544", "0.56403553", "0.5631935", "0.56304055", "0.5628608", "0.56077874", "0.5600509", "0.5599804", "0.5578...
0.6652441
0
This function prints and plots the confusion matrix. Normalization can be applied by setting `normalize=True`.
def plot_confusion_matrix(cm, classes, normalize=False, title='Confusion matrix', cmap=plt.cm.Blues): if normalize: cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis] plt.imshow(cm, interpolation='nearest', cmap=cmap) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_confusion_matrix(cm, classes=[0,1], normalize=False, title='Confusion matrix', print_matrix=False):\n\n if normalize:\n cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis]\n print(\"Normalized confusion matrix\")\n else:\n print('Confusion matrix, without normalization')\n\n...
[ "0.8194862", "0.80949175", "0.8029915", "0.8019153", "0.79941195", "0.7991258", "0.7980955", "0.7976606", "0.79610753", "0.79590565", "0.79378676", "0.7934962", "0.7934504", "0.79313844", "0.7926313", "0.7924577", "0.79241234", "0.7923211", "0.7923023", "0.7921931", "0.791787...
0.0
-1
Convert list to batch.
def batchfy(self, hyps: List[Hypothesis]) -> BatchHypothesis: if len(hyps) == 0: return BatchHypothesis() if self.return_hs: hs = [h.hs for h in hyps] else: hs = [] return BatchHypothesis( yseq=pad_sequence( [h.yseq for h ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_and_load(batch, ctx_list):\n new_batch = []\n for i, data in enumerate(batch):\n if isinstance(data, (list, tuple)):\n new_data = [x.as_in_context(ctx) for x, ctx in zip(data, ctx_list)]\n else:\n new_data = [data.as_in_context(ctx_list[0])]\n new_batch.ap...
[ "0.65825135", "0.6561943", "0.6507611", "0.6401206", "0.6401206", "0.62809867", "0.6262857", "0.62295914", "0.6208166", "0.61986816", "0.6189698", "0.6135773", "0.61332947", "0.60714793", "0.60569495", "0.604786", "0.6027749", "0.5989058", "0.59673804", "0.59143484", "0.58697...
0.0
-1
Batchcompute topk full token ids and partial token ids.
def batch_beam( self, weighted_scores: torch.Tensor, ids: torch.Tensor ) -> Tuple[torch.Tensor, torch.Tensor, torch.Tensor, torch.Tensor]: top_ids = weighted_scores.view(-1).topk(self.beam_size)[1] # Because of the flatten above, `top_ids` is organized as: # [hyp1 * V + token1, hyp2 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_topk_tokens(self,\n scores: np.ndarray) -> List[List[Tuple[str, float]]]:\n # scores is [num_tokens, vocab_size]\n # Find the vocab indices of top k predictions, at each token.\n # np.argpartition is faster than a full argsort for k << V,\n # but we need to sort the outpu...
[ "0.5995347", "0.57646704", "0.5713756", "0.5650496", "0.55799896", "0.5566732", "0.54498386", "0.53750765", "0.53550416", "0.53518784", "0.5336398", "0.5303979", "0.52857816", "0.52762395", "0.5216887", "0.5215781", "0.52095544", "0.5179886", "0.5168961", "0.5164057", "0.5158...
0.5125833
22
Return True if feedparser result indicates feed was not modified.
def _is_not_modified_result(result): return result.get('status', None) == 304
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_update_new_not_modified(reader):\n parser = NotModifiedParser()\n reader._parser = parser\n\n feed = parser.feed(1, naive_datetime(2010, 1, 1))\n\n reader.add_feed(feed.url)\n reader._storage.update_feed(FeedUpdateIntent(feed.url, None, feed=feed))\n\n reader.update_feeds(new=True)\n\n ...
[ "0.6414621", "0.64066607", "0.6327842", "0.6158933", "0.614194", "0.6131379", "0.61303407", "0.61213887", "0.6114745", "0.6027505", "0.59854084", "0.5971408", "0.59555125", "0.5945173", "0.59322053", "0.5888366", "0.5866654", "0.5853819", "0.5845405", "0.5830459", "0.58108", ...
0.6293639
3
Raise FeedParseError if url is not valid.
def _validate_url(url): if urlparse.urlparse(url).scheme not in VALID_SCHEMES: _fail(url, "Invalid URL")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _fail(url, reason):\n LOG.debug(\"Failed to parse feed '{}': {}\".format(url, reason))\n raise FeedParseError(reason)", "def check_url_and_raise_errors(url: str) -> None:\n if not url:\n raise_error(\"Url can not be empty\", 400)\n\n try:\n URL_REGEX.match(url).span()[1] - URL_REGEX...
[ "0.78650814", "0.69990563", "0.678818", "0.66678894", "0.65052646", "0.65051764", "0.64674693", "0.6414717", "0.6407706", "0.6371736", "0.6360883", "0.6345066", "0.6341414", "0.6323587", "0.6291637", "0.6227745", "0.61942345", "0.61738443", "0.61567104", "0.6152634", "0.61244...
0.69329906
2
Inplace modification of maximum number of sides for cells. Can be larger or smaller than current max_sides, but if smaller all existing cells must fit in the new max_sides.
def modify_max_sides(self,max_sides): if max_sides<self.max_sides: if not np.all( self.cells['nodes'][:,max_sides:] == self.UNDEFINED ): raise GridException("Some cells cannot fit in requested max_sides") old_max_sides=self.max_sides self.max_sides=max_sides ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def change_sides(self, sides):\n self.sides = sides", "def change_sides(self, sides):\n self.sides = list(sides)", "def _grow_secondary(self, amt):\n self._resize_secondary(amt)", "def update_max_fringe_size(self, fringe_len):\n if self.max_fringe_size < fringe_len:\n s...
[ "0.6507217", "0.6451431", "0.5271539", "0.52055186", "0.5193042", "0.5193042", "0.5193042", "0.51626533", "0.51570946", "0.514405", "0.5136312", "0.5102727", "0.50815964", "0.5061538", "0.5018758", "0.5007873", "0.5007873", "0.4955237", "0.49488786", "0.4946376", "0.4940112",...
0.8649295
0
return cell indices in the order they should appear, and with deleted cells not appearing at all.
def renumber_cells_ordering(self): Nactive = sum(~self.cells['deleted']) return np.argsort( self.cells['deleted'],kind='mergesort')[:Nactive]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _calcOrderedCellVertexIDs(self):\n ids = numerix.zeros((8, self.nx, self.ny, self.nz), 'l')\n indices = numerix.indices((self.nx, self.ny, self.nz))\n ids[1] = indices[0] + (indices[1] + (indices[2] + 1) * (self.ny + 1) + 1) * (self.nx + 1)\n ids[0] = ids[1] + 1\n ids[3] = in...
[ "0.6758087", "0.63152266", "0.627533", "0.62292653", "0.61578", "0.61261207", "0.60576355", "0.60270035", "0.601324", "0.60121024", "0.6009973", "0.6006585", "0.5952954", "0.5945952", "0.5931032", "0.5929015", "0.59213626", "0.59187233", "0.59087074", "0.5906576", "0.58730245...
0.75893885
0
total number of allocated nodes may include deleted nodes
def Nnodes(self): return len(self.nodes)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count(self):\n\t\treturn len(list(self.nodes))", "def count_nodes(self):\n\t\treturn self.__count_nodes(self)", "def numNodes(self):\n res = 0\n for n in self.iternodes():\n res += 1\n return res", "def size(self):\n\t\treturn len(self.nodes)", "def NodesCount(self):\n ...
[ "0.76748383", "0.7627337", "0.7574109", "0.75234646", "0.74243766", "0.7349152", "0.73254395", "0.728713", "0.7252702", "0.72358304", "0.7233308", "0.7227171", "0.7211665", "0.7204624", "0.72013265", "0.72013265", "0.7178323", "0.71648103", "0.7104176", "0.70815516", "0.70779...
0.74802965
4
total number of allocated edges may include deleted edges
def Nedges(self): return len(self.edges)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def num_edges(self):\r\n return len(self.__generate_edges())", "def return_num_edges(self):\n return sum(map(lambda x: len(x),self.__adj))", "def num_edges(self):\n return sum(1 for _ in self.iteredges())", "def _num_edges(self):\n return len(self._eid2partid)", "def edge_count(...
[ "0.7435879", "0.7423722", "0.7422694", "0.7412441", "0.73746586", "0.7372756", "0.7346467", "0.7342152", "0.73244256", "0.7273992", "0.727092", "0.71816105", "0.7176558", "0.7171847", "0.7143898", "0.7078896", "0.70709676", "0.7026285", "0.70220137", "0.7013911", "0.6971815",...
0.7209948
11
generator for cell indexes which are not deleted. it is safe to delete cells during this call, but not to create cells.
def valid_cell_iter(self): for c in range(self.Ncells()): if ~self.cells['deleted'][c]: yield c
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def empty_cells(self) -> List[Cell]:\n return list(ob.pos[0] for ob in self.new_obs())", "def _exclude_indices(self):\n idx = self._next_idx\n exclude = np.arange(idx - 1, idx + self.obs_len) % self._maxsize\n return exclude", "def iter_unsolved_cells(self):\n\t\treturn (\n\t\t\tcel...
[ "0.6347369", "0.6305505", "0.6295554", "0.62471247", "0.6146813", "0.6098467", "0.6052627", "0.60431504", "0.5988801", "0.59403604", "0.59389204", "0.59361625", "0.59276056", "0.5927425", "0.59199846", "0.5881744", "0.58692455", "0.5859804", "0.5835173", "0.5823762", "0.57819...
0.7720332
0
Return an ndarray of the node indices which share edges with node n.
def node_to_nodes(self,n): js = self.node_to_edges(n) all_nodes = self.edges['nodes'][js].ravel() # return np.setdiff1d(all_nodes,[n]) # significantly slower than lists return np.array( [nbr for nbr in all_nodes if nbr!=n] )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_neighbor_idxes(x, n, limit):\n idxes = sorted(range(limit), key=lambda idx: (abs(x - idx), idx))[:n]\n idxes = sorted(idxes)\n return np.array(idxes)", "def neighbors(self, n):\n\n try:\n return self.dict[n].keys()\n except KeyError:\n raise KeyErr...
[ "0.6535067", "0.6483655", "0.6428438", "0.6286833", "0.6249816", "0.61984056", "0.60142833", "0.59941787", "0.5948946", "0.5935432", "0.5900787", "0.5895051", "0.58909446", "0.58908474", "0.5875703", "0.5853273", "0.5832875", "0.5832762", "0.58172685", "0.5816258", "0.5811219...
0.6828188
0
return list of variables which appear to have real data (i.e. not just mesh geometry / topology)
def data_variable_names(self): data_names = [] mesh = self.mesh_names() prefix = mesh[0]+'_' for vname in self.nc.variables.keys(): if vname.startswith(prefix): if self.nc.dimensions.has_key(vname): continue if hasattr(self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getVariableList(dataset):\n variables = [v for v in dataset.variables.keys() if v not in dataset.dimensions.keys()]\n for d in dataset.dimensions.keys():\n try:\n variables.pop(variables.index(dataset.variables[d].getncattr(\"bounds\")))\n except:\n pass\n return va...
[ "0.67854434", "0.6747893", "0.66953576", "0.66303694", "0.66087323", "0.65763", "0.64299923", "0.63698393", "0.63670903", "0.6293077", "0.6287816", "0.6198853", "0.61776656", "0.616714", "0.61466074", "0.6130938", "0.6114026", "0.6104071", "0.60399276", "0.60351646", "0.60316...
0.66775197
3
Creates vocab from `vocab_size` most common words in Stackoverflow.
def create_vocab(vocab_size): vocab_dict = tff.simulation.datasets.stackoverflow.load_word_counts( cache_dir='/tmp') return list(vocab_dict.keys())[:vocab_size]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_vocab(vocab_size, text_vector):\n vocab = Counter()\n for text in text_vector:\n for word in text.split(' '):\n vocab[word.lower()]+=1\n vocab = dict(vocab.most_common(vocab_size))\n return vocab", "def build_vocab(words, vocab_size, visual_fld=None):\n utils.safe_mkdir...
[ "0.7308795", "0.7094178", "0.69817257", "0.6869419", "0.6844939", "0.6843288", "0.67599815", "0.6752741", "0.67097276", "0.6574834", "0.64526254", "0.64454335", "0.6365274", "0.62852687", "0.6220796", "0.6209236", "0.6185193", "0.61595803", "0.615477", "0.61476374", "0.612460...
0.83660305
0
Gets tokens dataset preprocessing code will add to Stackoverflow.
def get_special_tokens(vocab_size, num_oov_buckets = 1): return SpecialTokens( pad=0, oov=[vocab_size + 1 + n for n in range(num_oov_buckets)], bos=vocab_size + num_oov_buckets + 1, eos=vocab_size + num_oov_buckets + 2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preprocess(self,text):\n return preprocess.get_tokens(text)", "def tokens():\n pass", "def tokenize_dataset(self, data):\n token_pt = tfds.deprecated.text.SubwordTextEncoder.build_from_corpus(\n (pt.numpy() for pt, _ in data), target_vocab_size=2**15)\n token_en = tfds.de...
[ "0.66217196", "0.63654315", "0.62494445", "0.61270416", "0.6102746", "0.6070591", "0.60597533", "0.60339755", "0.6019092", "0.59683913", "0.59498525", "0.59468734", "0.59263486", "0.5895847", "0.58944637", "0.5875552", "0.5875552", "0.5875552", "0.5833355", "0.58276564", "0.5...
0.0
-1
Creates centralized dataset for both training and testing. The following functions are created to flat_map to avoid loading all dataset tensor into the memory.
def build_split_centralized_dataset(clientdata, preprocess_fn, to_embedding_id, sample_client_ids, split_by='date'): # The number of split for train/test sets # Default to...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_dataset():\n ds_train_raw, ds_test_raw = load_raw_datasets()\n vectorize_layer = create_vectorizer(ds_train_raw)\n ds_train = ds_train_raw.map(\n lambda text, label: (vectorize_layer(text), label)\n ).prefetch(tf.data.experimental.AUTOTUNE)\n ds_test = ds_test_raw.map(\n lam...
[ "0.72608274", "0.70874506", "0.6911787", "0.68208206", "0.6777701", "0.6758639", "0.67533207", "0.67222744", "0.6683505", "0.6669558", "0.66216725", "0.661884", "0.6563919", "0.6548555", "0.6514334", "0.64826393", "0.6473218", "0.64710873", "0.64531666", "0.64352864", "0.6418...
0.6420878
20
Given a number x, returns x 1 unless that would be less than zero, in which case returns 0.
def decrement(x): return 0 if x-1 < 0 else x-1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def p(x):\n if x<0 or x>1:\n return 0\n else:\n return 1", "def replace_lowest_one_with_zero(x):\n return x & (x-1)", "def sgn(x) -> int:\n if x > 0:\n return 1\n if x < 0:\n return -1\n return 0", "def fun(self, x):\n if np.any(x > 0):\n return n...
[ "0.7906334", "0.7603963", "0.7591064", "0.7451751", "0.744024", "0.7369466", "0.7321004", "0.7321004", "0.73171556", "0.7279409", "0.7260917", "0.72128093", "0.71720177", "0.716534", "0.7143038", "0.71416765", "0.71017206", "0.7086898", "0.70790356", "0.69700116", "0.69674826...
0.62473357
59
Given a 2D point (represented as a Point object), returns a list of the four points that neighbor it in the four coordinate directions. Uses the "copy" method to avoid modifying the original point.
def get_neighbors(point): pt = point.copy() output= [point.copy() for i in range(4)] output[0:2] = map(Point.setY, output[0:2], [pt.getY()+ i for i in range(-1,2,2)]) output[2:4]= map(Point.setX, output[2:4], [pt.getX()+ i for i in range(-1,2,2)]) return output
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def neighbors(self, point):\n # Sanity checks\n # Check that point has same number of dimensions as graph\n if not len(point) == len(self.dimensions):\n raise Exception(\"Point has \" + str(len(point)) + \" dimensions, Coordination Space has \" + \\\n str(...
[ "0.7103389", "0.6953469", "0.67613405", "0.67361367", "0.6722034", "0.65071344", "0.64217365", "0.6356536", "0.6258935", "0.61712223", "0.61638105", "0.6080958", "0.60804754", "0.6073468", "0.6011799", "0.59988457", "0.596714", "0.59637946", "0.5916069", "0.5860804", "0.58563...
0.79194576
0
Sees if the segment is an empty string. If it is converts the segment to Python's None
def handle_empty(segment): if len(segment) == 0: return None else: return segment
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _nullify(self, value):\n if not str(value).strip():\n return None\n else:\n return value", "def none_string(line):\n out_line = None if line.lower() == \"none\" or len(line) == 0 else line\n return out_line", "def none_to_empty(data):\n return data i...
[ "0.693568", "0.6435146", "0.63631743", "0.63588744", "0.63363886", "0.61822206", "0.61099935", "0.6091123", "0.6088226", "0.6030747", "0.591497", "0.58699614", "0.58275086", "0.5825371", "0.58078766", "0.58047944", "0.5803251", "0.57910377", "0.576847", "0.5761308", "0.575296...
0.8364488
0
Creates a DataFrame of mass changes calculated with the Sauerbrey equation.
def sauerbrey_mass_change( df, f0 = 5e6, density = 2.648, shear = 2.947e11 ): return df.apply( lambda x: sauerbrey( x, f0, density, shear ) )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calc(self) -> pd.DataFrame:\n raise NotImplementedError", "def simulated(self):\n # Join #\n df = self.age_indicators.left_join(self.bef_ft, on='forest_type')\n # Select only some columns #\n columns_of_interest = ['ave_age', 'time_step', 'area', 'biomass', 'bef_tot', 'den...
[ "0.56895524", "0.56655693", "0.5486994", "0.5435106", "0.54306656", "0.5363785", "0.53398186", "0.53356326", "0.5332267", "0.5327864", "0.5263464", "0.5252759", "0.5245913", "0.5244274", "0.52437544", "0.52156675", "0.5203532", "0.5198839", "0.517518", "0.516917", "0.51653856...
0.64077467
0
Add this annotation to our inmemory collection of annotations.
def submit_annotation( self, sample_id: Union[int, str], annotator: str, key: str, value_numeric: Optional[Union[int, float]], value_string: Optional[str], comment: str, ) -> bool: annotation = { 'sample_id': sample_id, 'annotator': annotator, 'annotation_timestamp': datetime.d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_annotation(self, annotation):\n self.annotations.append(annotation)", "def annotations(self, annotations):\n self._annotations = annotations", "def annotate(self, annotation_=None):\n # Important: Need a copy, not the reference to the original object\n annotation_ = copy.dee...
[ "0.7957882", "0.70649177", "0.706217", "0.6931411", "0.68150055", "0.6726897", "0.6685167", "0.64735204", "0.64651215", "0.6454395", "0.63457084", "0.6330764", "0.6250406", "0.6235173", "0.62338287", "0.6167636", "0.6075785", "0.60055727", "0.59357643", "0.5899676", "0.588789...
0.0
-1
Initialize the model by setting up linear layers. Use the input parameters to help define the layers of your model.
def __init__(self, input_dim, hidden_dim, output_dim): super(LstmEstimator, self).__init__() # The LSTM takes track features as inputs, and outputs hidden states # with dimensionality hidden_dim self.lstm = nn.LSTM(input_dim, hidden_dim) self.hidden2targe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self): #initializing\n super(Model, self).__init__()\n self.linear = torch.nn.Linear(3, 1) # one input/feature , one output\n # here where other NN layers are added", "def construct(self):\n self.input_size = self.numplanes * self.boardsize**2\n \n if self....
[ "0.7008832", "0.69599736", "0.68597513", "0.67152196", "0.6621905", "0.6584661", "0.65694517", "0.6538287", "0.6532195", "0.6500315", "0.6499381", "0.6470354", "0.6417762", "0.64157605", "0.63871783", "0.6378827", "0.6356319", "0.63504374", "0.6330771", "0.63287896", "0.63192...
0.0
-1
Perform a forward pass of our model on input features, x.
def forward(self, input_playlist): # define the feedforward behavior lstm_out, _ = self.lstm(embeds.view(len(input_playlist), 1, -1)) target_feat = self.hidden2target(lstm_out.view(len(input_playlist), -1)) return target_feat
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forward(self, x):\n x = self.features(x)\n return x", "def feature_forward(self, x):\n raise NotImplementedError", "def forward(self, x):\n #batch_size = x.shape[0]\n out = self.model(x)\n return out", "def forward(self, x, feature_matching=False):\n x = s...
[ "0.82795644", "0.82144374", "0.7875964", "0.78090376", "0.77056867", "0.768751", "0.767677", "0.7611521", "0.7611521", "0.75855273", "0.75703144", "0.75288767", "0.75205636", "0.7483004", "0.747107", "0.7467246", "0.74611235", "0.7457481", "0.7442586", "0.74420786", "0.742326...
0.0
-1
Opens the selected url in the default browser
def open_news_url(self, url): try: if not webbrowser.open_new_tab(url): raise webbrowser.Error except webbrowser.Error: print('Unable to open a web browser, try accessing this URL manually instead:\n{0}'.format(url))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def open(url):\r\n webbrowser.open(url)", "def open_in_browser(self):\n webbrowser.open(self.url)", "def open_browser(url):\n import webbrowser\n webbrowser.open_new(url)", "def openurl(url):\n\n # Open the URL\n webbrowser.open(url)", "def run(self, url=''):\n if url:\n ...
[ "0.8225739", "0.81169826", "0.79049504", "0.78941965", "0.7836031", "0.7769625", "0.7673989", "0.75603193", "0.7521839", "0.74772763", "0.74540216", "0.73648775", "0.7364675", "0.7361388", "0.730936", "0.7300021", "0.7277844", "0.7266168", "0.72362345", "0.71869177", "0.71772...
0.6767545
37
Returns a list of boto3 clients from the input list
def client_aggregator(profiles, regions, svc, boto_client_params): if 'all' in regions: regions = ['us-west-1', 'us-west-2', 'us-east-1', 'us-east-2'] clients = [] for p in profiles: for r in regions: c = Client(svc=svc,profile_name=p,region_name=r) clients.append(c)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def redis_client_list(self):\n def func(server):\n return server.server.client_list()\n self.__run_redis_cmd(func)", "def get_client_list(self):\r\n cursor = self.conn.cursor()\r\n cursor.execute(\"\"\"SELECT * FROM CLIENT\"\"\")\r\n return cursor.fetchall()", "def...
[ "0.7092549", "0.6989621", "0.69223994", "0.69223994", "0.6848695", "0.6696316", "0.661714", "0.6451524", "0.64163357", "0.6378187", "0.63446283", "0.63149816", "0.62951094", "0.628518", "0.625612", "0.62408686", "0.62253976", "0.621826", "0.6151494", "0.6109674", "0.60962677"...
0.620723
18
Get a single example from the dataset
def __getitem__(self, index): return self.data_source.get_sample(index)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def example(self):\n result = getattr(self, '_example', None)\n if result is None:\n # No example batch was found, so get one from the `.train` dataset\n result = next(iter(self.train))\n # And cache it for next time\n self._example = result\n return result", "def get_first_element(dataset):\n ...
[ "0.7115562", "0.66712093", "0.64783984", "0.6403151", "0.6335547", "0.61371744", "0.60608315", "0.6044252", "0.59989613", "0.59826136", "0.59711236", "0.5924923", "0.5903227", "0.58972275", "0.5886283", "0.57957745", "0.5786258", "0.5776925", "0.57686067", "0.5751819", "0.575...
0.6269411
5
Escape any quotes in a value
def escape_quotes(self, val): if val.startswith(self.quote) and val.endswith(self.quote): # make sure any previously escaped quotes are not re-escaped middle = val[1:-1].replace("\\" + self.quote, self.quote) middle = middle.replace(self.quote, "\\" + self.quote) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _escapeString(self, value):\n if '\"' in value and \"'\" in value:\n substrings = value.split(\"\\\"\")\n result = [\"concat(\"]\n for substring in substrings:\n result.append(\"\\\"%s\\\"\" % substring)\n result.append(\", '\\\"', \")\n ...
[ "0.7982278", "0.78562284", "0.7811659", "0.7776338", "0.76974475", "0.7598575", "0.7596274", "0.7538147", "0.74674416", "0.74620914", "0.74506104", "0.74151826", "0.7318859", "0.728356", "0.7283201", "0.7265275", "0.72581315", "0.72373146", "0.7145665", "0.71076804", "0.70768...
0.78440934
2
Change the quotes used to wrap a value to the pprint default E.g. "val" to 'val' or 'val' to "val"
def standardise_quotes(self, val): if val.startswith(self.altquote) and val.endswith(self.altquote): middle = val[1:-1] val = "%s%s%s" % (self.quote, middle, self.quote) val = self.escape_quotes(val) return val
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _format_default_value(self, default):\n return json.dumps(default)", "def json_defaults(val):\n return str(val)", "def prepare_value(self, value):\n return json.dumps(value, indent=4)", "def StringRep(self, val):\n try:\n return val.DebugString()\n except Exception:\n try...
[ "0.6471782", "0.64030707", "0.612637", "0.6087", "0.6033885", "0.60166377", "0.5982114", "0.5977379", "0.5949123", "0.59039235", "0.58911735", "0.58470637", "0.58337176", "0.5792817", "0.57509005", "0.57447463", "0.5737815", "0.57374895", "0.5730391", "0.57145894", "0.5714589...
0.0
-1
Return the item with the most consecutive repetitions in `iterable`. If there are multiple such items, return the first one. If `iterable` is empty, return `None`.
def track_runs(iterable): track_repeats=[] current_element = None current_repeats = 0 element_i = 0 for element in iterable: if current_element == element: current_repeats += 1 else: track_repeats.append((current_repeats,current_element, element_i-cur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def most_common(iterable):\n from collections import Counter\n\n data = Counter(iterable)\n return data.most_common(1)[0][0]", "def most_common(iterable):\r\n sorted_iterable = sorted((x, i) for i, x in enumerate(iterable))\r\n groups = itertools.groupby(sorted_iterable, key=operator.itemgetter(0)...
[ "0.7029237", "0.68829846", "0.6130474", "0.609786", "0.6056357", "0.5827709", "0.58245623", "0.58226085", "0.5820693", "0.5790731", "0.56872916", "0.56727934", "0.5643067", "0.56388456", "0.56346625", "0.56168485", "0.56049204", "0.55685824", "0.5533396", "0.55208516", "0.550...
0.53461105
32
Get the entity's region for the given siruta code
def get_region(self, siruta): if siruta not in self._data: self.__notify_error("SIRUTA code %d is not in the database" % siruta) return None return self._data[siruta]['region']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_region_string(self, siruta):\n if siruta not in self._data:\n self.__notify_error(\"SIRUTA code %d is not in the database\" % siruta)\n return None\n\n region = self._data[siruta]['region']\n if region in self._regions:\n return self._regions[region]\n ...
[ "0.7476892", "0.7024262", "0.69273514", "0.68431455", "0.6786794", "0.6773941", "0.67410517", "0.67410517", "0.67410517", "0.67410517", "0.67410517", "0.67410517", "0.66919", "0.6667979", "0.66624236", "0.66624236", "0.66624236", "0.66624236", "0.66618127", "0.6631186", "0.65...
0.76183236
0
Get the entity's region for the given name
def get_region_by_name(self, name): raise NotImplementedError()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def region(self):\n return self._get(\"region\")", "def get_region(self):\n return self.creds.get('region_name')", "def findRegion(self, nameOrIndex):\n self.getRegions()\n if isinstance(nameOrIndex, int):\n return self._regionCache[nameOrIndex]\n else:\n ...
[ "0.6874183", "0.6863291", "0.6860014", "0.684181", "0.6645747", "0.6645747", "0.6645747", "0.6645747", "0.6645747", "0.6645747", "0.6634859", "0.6616967", "0.6603311", "0.6596458", "0.6596458", "0.6596458", "0.6596458", "0.6565442", "0.645755", "0.645755", "0.645755", "0.64...
0.8326752
0
Loads the data from a json file. If there are no objects of interest, then load all the objects.
def loadjson(path, objectsofinterest, img): with open(path) as data_file: data = json.load(data_file) # print (path) pointsBelief = [] boxes = [] points_keypoints_3d = [] points_keypoints_2d = [] pointsBoxes = [] poses = [] centroids = [] translations = [] rotati...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _load(self):\n if self.file_path.exists():\n with open(self.file_path) as fid:\n self.data = json.load(fid)", "def load(self):\n if not self.exist:\n self.create()\n\n with open(self.file_path, encoding=Config.ENCODING) as file:\n self.data...
[ "0.77436537", "0.7502876", "0.71920633", "0.7154787", "0.7097119", "0.70624936", "0.69570625", "0.6944725", "0.6907088", "0.6882725", "0.6871144", "0.6864754", "0.68565696", "0.6854614", "0.6841895", "0.6838909", "0.6832275", "0.68125933", "0.67923707", "0.67768687", "0.67741...
0.0
-1
String for representing the Model object.
def __str__(self): return self.designation + ' ' +self.winery + ' wine'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n return super().__str__() + self.model.__str__()", "def __str__(self):\n return \"DataModel(name={},attributes={},description={})\".format(\n self.name, {a.name: str(a) for a in self.attributes}, self.description\n )", "def __str__(self):\n \n res =...
[ "0.82368803", "0.79901737", "0.7849152", "0.78468513", "0.77520275", "0.7625378", "0.7625378", "0.76225406", "0.76225406", "0.75483394", "0.7522958", "0.7470355", "0.7469358", "0.7447144", "0.7447144", "0.74314755", "0.7427648", "0.7389925", "0.7351721", "0.73424315", "0.7322...
0.0
-1
Find all the services that are being tracked.
def find_services(self) -> List[str]: results = self.collection.distinct("process.serviceName") return [result for result in results]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_services(self):\r\n return get_service_list()", "def get_services(self):\n\n return list(self.services.values())", "def services(self) -> List[Service]:\n return self._services", "def getServices(self):\n pass", "def get_all():\n if not SERVICE_DIR:\n raise Com...
[ "0.7159505", "0.7100396", "0.6796669", "0.6707757", "0.6701643", "0.66464925", "0.66085464", "0.6594615", "0.6578773", "0.65621716", "0.6533928", "0.64454466", "0.6441204", "0.643918", "0.643513", "0.64350015", "0.6431797", "0.63280004", "0.62562567", "0.6236417", "0.62164146...
0.691192
2
Create a Span object from a Dict that came from MongoDB.
def make_span_from_db(ret: Dict) -> Span: duration = Duration() duration.FromMicroseconds(ret["duration"]) start_time = Timestamp() start_time.FromDatetime(ret["startTime"]) del ret["startTime"] del ret["duration"] span = ParseDict( ret, Span(duration=...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _es_doc_to_dataset(doc: Dict[str, Any]) -> DatasetDB:\n\n def __key_value_list_to_dict__(\n key_value_list: List[Dict[str, Any]]\n ) -> Dict[str, Any]:\n return {data[\"key\"]: json.loads(data[\"value\"]) for data in key_value_list}\n\n source = doc[\"_source\"]\n ...
[ "0.5917244", "0.5909436", "0.5863986", "0.58041215", "0.5772741", "0.5753794", "0.5753794", "0.5753794", "0.5753794", "0.5753794", "0.5753794", "0.5753794", "0.5753794", "0.5753794", "0.5753794", "0.5753794", "0.5753794", "0.5753794", "0.5753794", "0.5753794", "0.5753794", ...
0.7304594
0
Turn the bytes that represent a trace_id into a string. This conversion mimics how MessageToDict from the protobuf library converts bytes into strings.
def make_trace_id(trace_id: bytes) -> str: return base64.b64encode(trace_id).decode("utf-8")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def str_id(self, id):\n\t\ts = bin(id)\n\t\ts = '0'*64 + s[2:]\n\t\tidbits = 64 - (2*self.xybits+self.tbits)\n\t\tret = []\n\t\tnover = self.xybits - self.level\n\t\tfor l, k in [(0, idbits), (0, self.tbits), (nover, self.xybits), (nover, self.xybits)]:\n\t\t\tc = s[-k:]\n\t\t\ts = s[:-k]\n\t\t\tif l:\n\t\t\t\tc =...
[ "0.5885069", "0.5762447", "0.5742189", "0.56637704", "0.5636197", "0.563501", "0.56241626", "0.5588019", "0.55424225", "0.5515069", "0.5490731", "0.5490206", "0.5490206", "0.54529893", "0.5452448", "0.5441325", "0.537992", "0.53685224", "0.53432894", "0.5329398", "0.53243166"...
0.74089384
0
Normalize a package name. This will ensure the package name is in a suitable format, replacing any invalid characters or dashes with ``_``, and converting it to lowercase.
def _normalize_package_name(self, name): return Prepared.normalize(name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize_package_name(_s: str) -> str:\n return _s.replace('_', '-').lower()", "def normalize_pypi_name(s: str) -> str:\n return NORMALIZE_PACKAGE_NAME_RE.sub(\"-\", s).lower()", "def normalize(name):\n name = name.lower()\n name = name.replace('-', '')\n name = name.replace(' ', '')\n r...
[ "0.86075735", "0.7985997", "0.719426", "0.7178745", "0.6996841", "0.6808761", "0.6766393", "0.67573124", "0.67573124", "0.67573124", "0.67075723", "0.6701549", "0.66942954", "0.66752213", "0.6583071", "0.6573961", "0.65022933", "0.64840996", "0.64646363", "0.6463601", "0.6454...
0.7697759
2
Normalize a class name. This will ensure the class name is in a suitable format, converting it to CamelCase and adding an "Extension" at the end if needed.
def _normalize_class_name(self, name): class_name = ''.join( word.capitalize() for word in re.sub('[^A-Za-z0-9]+', ' ', name).split() ) if not class_name.endswith('Extension'): class_name += 'Extension' return class_name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_class_name(name: str) -> str:\n name_tokens = re_class_name.findall(name)\n return \"_\".join(i.lower() for i in name_tokens if i)", "def _strip_class_name(name):\n name = _strip(name)\n if name.find('.') != -1:\n name = name.split('.')[len(name.split('.')) - 1]\n return name", ...
[ "0.75139934", "0.7461523", "0.72711104", "0.72711104", "0.72711104", "0.6996547", "0.6826107", "0.67109066", "0.6685476", "0.6649813", "0.6515538", "0.65101016", "0.6459786", "0.64231014", "0.64217246", "0.64097345", "0.6391873", "0.62976545", "0.6201929", "0.61608493", "0.61...
0.8932951
0
Returns a random mixed case string of length provided.
def random_str(length): def _random_chr(): if random.randint(0, 1): return chr(random.choice(range(65, 91))) else: return chr(random.choice(range(97, 122))) return "".join([_random_chr() for _ in range(length)])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rndstr(length):\n return ''.join(random.choice(string.ascii_lowercase + string.digits) for _ in range(length))", "def get_random_string(self, length):\n letters = string.ascii_lowercase\n return ''.join(random.choice(letters) for i in range(length))", "def random_string(length=None):\r\n ...
[ "0.7990472", "0.7989844", "0.79613143", "0.7954358", "0.79471385", "0.7940463", "0.7901356", "0.7898593", "0.7890792", "0.78902555", "0.786062", "0.785883", "0.78548884", "0.7852616", "0.7828134", "0.78121334", "0.78052247", "0.7797502", "0.77732736", "0.7767148", "0.77252156...
0.75387603
66
Returns your $HOME/.pypackage file to it's rightful place.
def move_home_pypackage_back(): backups = defaultdict(list) home = os.path.expanduser("~") for file_name in os.listdir(home): if ".pypackage" in file_name and file_name.endswith("~"): file_path = os.path.join(home, file_name) backups[os.stat(file_path).st_ctime].append(file_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetPackageDirectory():\n return os.path.dirname(__file__)", "def package_dir(self):\r\n return \".\"", "def get_package_dir():\n return Path(__file__).parent", "def get_package_path():\n package_name = get_package_name()\n return package_name.replace('.', '/')", "def path(self):\n ...
[ "0.73947304", "0.73318475", "0.7252101", "0.72048944", "0.68447924", "0.66690624", "0.6601104", "0.6515607", "0.6499224", "0.64415187", "0.63735116", "0.6364403", "0.6335699", "0.6332029", "0.63077605", "0.6299004", "0.6277373", "0.62438655", "0.6224149", "0.6222619", "0.6204...
0.58425254
63
Create and configure an instance of the Flask application.
def create_app(): app = Flask(__name__) app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///db.sqlite3' DB.init_app(app) @app.route('/') def root(): symbols = Ticker.query.all() return render_template('base.html', symbols=symbols) @app.route('/symbol/<name>', methods=[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_app():\n\n # 1 Create Flask application\n app = Flask(\n import_name=__name__,\n template_folder=\"templates\",\n static_folder=\"static\"\n )\n\n # 2 Update the apps configuration\n app = config_selector(app)\n register_error_handlers(app)\n\n cache.init_app(app...
[ "0.8524629", "0.851714", "0.85038936", "0.83322567", "0.82400537", "0.823162", "0.8200124", "0.8129433", "0.80291975", "0.8027049", "0.8019719", "0.79989284", "0.7985011", "0.7979019", "0.7973106", "0.7970349", "0.7960044", "0.7955131", "0.79525983", "0.7946503", "0.79371244"...
0.0
-1
Simplify the given list of expressions using algebraic properties of the given MultiExpression subclass. Returns True if the expression list was changed, False otherwise.
def _simplify_algebraic(cls: type[MultiExpression], exprs: list[Expression]) -> bool: changed = False # Merge subexpressions of the same type into this expression. i = 0 while i < len(exprs): expr = exprs[i] if isinstance(expr, cls): del exprs[i] exprs += expr.ex...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _simplify_list(exprs: list[Expression]) -> bool:\n changed = False\n for i, expr in enumerate(exprs):\n simplified = simplify_expression(expr)\n if simplified is not expr:\n exprs[i] = simplified\n changed = True\n return changed", "def simplify(self, expr):\n ...
[ "0.73135275", "0.48316106", "0.4804551", "0.47979146", "0.4780761", "0.47202906", "0.47001037", "0.4699531", "0.46990496", "0.4568783", "0.45541233", "0.45395038", "0.45336792", "0.44673452", "0.4458458", "0.43905544", "0.43788448", "0.43657166", "0.43289033", "0.43164074", "...
0.6794566
1
Sets the name of this CreateCustomRuleInput.
def name(self, name): self._name = name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setName(self, *args):\n return _libsbml.Input_setName(self, *args)", "def set_name(self, name):\n self.name = name # overwrite the existing name with the input name", "def set_name(self, name):\n self.name = name # overwrite the existing name with the input name", "def set_name(sel...
[ "0.6794525", "0.6633151", "0.6633151", "0.6523139", "0.6470618", "0.6470618", "0.6470618", "0.6470618", "0.6470618", "0.6463259", "0.6337424", "0.6333211", "0.6333211", "0.6332695", "0.6327979", "0.63160783", "0.63110447", "0.6310206", "0.6306367", "0.62828803", "0.625488", ...
0.0
-1
Sets the source of this CreateCustomRuleInput.
def source(self, source): allowed_values = ["FUGUE", "CUSTOM"] # noqa: E501 if source not in allowed_values: raise ValueError( "Invalid value for `source` ({0}), must be one of {1}" # noqa: E501 .format(source, allowed_values) ) self._so...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setSource(self, *args):\n return _libsbml.ExternalModelDefinition_setSource(self, *args)", "def set_source(self, source):\n self.data['source'] = source", "def _set_source(source, context):\n if isinstance(source, (str, list, dict, Dataset)):\n return Source(source, context)\n el...
[ "0.67252874", "0.6347752", "0.62617916", "0.6244616", "0.6244616", "0.6244616", "0.6244616", "0.6244616", "0.6244616", "0.6244616", "0.6151421", "0.6098911", "0.60730016", "0.6047532", "0.5826298", "0.5811856", "0.56033814", "0.5600652", "0.5552184", "0.55501616", "0.54944104...
0.637659
1
Sets the resource_type of this CreateCustomRuleInput.
def resource_type(self, resource_type): self._resource_type = resource_type
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resource_type(self, resource_type):\n if self.local_vars_configuration.client_side_validation and resource_type is None: # noqa: E501\n raise ValueError(\"Invalid value for `resource_type`, must not be `None`\") # noqa: E501\n allowed_values = [\"Unknown\", \"File\", \"PeopleStageEle...
[ "0.7091948", "0.69423574", "0.65676475", "0.6102332", "0.6102332", "0.6102332", "0.6102332", "0.6102332", "0.5886645", "0.5870923", "0.566557", "0.56240433", "0.56240433", "0.5615889", "0.5584093", "0.5567213", "0.55102015", "0.5504424", "0.54677767", "0.545863", "0.54002947"...
0.7507194
2
Sets the rule_text of this CreateCustomRuleInput.
def rule_text(self, rule_text): self._rule_text = rule_text
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_set_rule(self) -> None:\r\n\r\n self.stop_animation()\r\n self.master.focus() # Move the cursor away from the rule entry\r\n rule_text = str(self.rule_entry.get())\r\n\r\n if not self.rule.try_set_rule(rule_text):\r\n messagebox.showinfo(message = self.INVALID_RULE...
[ "0.608206", "0.56318605", "0.5553175", "0.5529299", "0.5521087", "0.55108696", "0.5490662", "0.5462072", "0.54478735", "0.54334944", "0.540881", "0.5401167", "0.5348216", "0.53446466", "0.52936006", "0.52936006", "0.52936006", "0.52936006", "0.52936006", "0.52936006", "0.5291...
0.8349702
0
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, CreateCustomRuleInput): return False return self.__dict__ == other.__dict__
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False", "def __eq__(self, other):\n if i...
[ "0.8088132", "0.8088132", "0.8054589", "0.7982687", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", ...
0.0
-1
Returns true if both objects are not equal
def __ne__(self, other): return not self == other
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True", "def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)", "def __ne__(self, other) -> bool:\n return not self.__eq__(other)", "def __eq__(self, other):\n ...
[ "0.845611", "0.8391477", "0.8144138", "0.81410587", "0.8132492", "0.8093973", "0.80920255", "0.80920255", "0.80920255", "0.8085325", "0.8085325", "0.8076365", "0.8076365", "0.8065748" ]
0.0
-1
Return True if the directed graph g has a cycle. g must be represented as a dictionary mapping vertices to
def cyclic(g): path = set() visited = set() def visit(vertex): if vertex in visited: return False visited.add(vertex) path.add(vertex) for neighbour in g.parents_of(vertex): if neighbour in path or visit(neighbour): return True ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_cycle(graph):\n stack = deque()\n visited_vertices = set()\n\n random_vertex = next(iter(graph.get_vertices().values()))\n prev_vertex = random_vertex\n vertex = random_vertex\n\n # prev_vertex let us to track \"parent\" vertex in undirected graph\n stack.append((prev_vertex, vertex))\...
[ "0.7956922", "0.7771935", "0.7623803", "0.75517577", "0.75459206", "0.7429406", "0.7105824", "0.7040336", "0.69249016", "0.686783", "0.6798696", "0.6790878", "0.6739669", "0.67252326", "0.6655793", "0.66074383", "0.64868975", "0.6486594", "0.6414213", "0.64135844", "0.6413248...
0.75209296
5
Shift the xview according to NUMBER which is measured in "units" or "pages" (WHAT).
def xview_scroll(self, number, what): self.tk.call(self._w, 'xview', 'scroll', number, what)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def xview_moveto(self, fraction):\n self.tk.call(self._w, 'xview', 'moveto', fraction)", "def xview(self, *what):\n if not what:\n return self._getdoubles(self.tk.call(self._w, 'xview'))\n self.tk.call((self._w, 'xview') + what)", "def x(self, value: int):\n if not (0 < v...
[ "0.70107734", "0.60189015", "0.5829111", "0.5771307", "0.57405853", "0.5399506", "0.5355404", "0.53498894", "0.53310066", "0.53283936", "0.5272065", "0.5272065", "0.5258325", "0.52514154", "0.52088803", "0.5201017", "0.5166606", "0.5156467", "0.5100794", "0.5075313", "0.50710...
0.57576096
4
Cumsum of a 1D tensor with defined shape by padding and convolving.
def _strict_1d_cumsum(tensor, len_tensor): # Assumes tensor shape is fully defined. with ops.name_scope('strict_1d_cumsum', values=[tensor]): if len_tensor == 0: return constant_op.constant([]) len_pad = len_tensor - 1 x = array_ops.pad(tensor, [[len_pad, 0]]) h = array_ops.ones_like(x) re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cumsum(tensor, axis=None):\n raise NotImplementedError", "def cumsum(x, axis=None):\r\n return CumsumOp(axis=axis)(x)", "def moving_sum(x, back, forward):\n bs, n_heads_mono, n_heads_chunk, qlen, klen = x.size()\n x = x.reshape(-1, klen)\n x_padded = F.pad(x, pad=[back, forward])\n x_...
[ "0.7672529", "0.6703737", "0.669915", "0.6665067", "0.6511301", "0.6393374", "0.6386398", "0.63840306", "0.6377517", "0.6227789", "0.62168896", "0.6203534", "0.6203534", "0.6203534", "0.6199108", "0.6173381", "0.61157113", "0.60873497", "0.60415226", "0.60415226", "0.60415226...
0.7537556
1
Initiates the grid plot for the visualisation.
def init_grid_plot(self): # Create filters to plot households and schools sequentially self.household_view = self.agent_filter(self.source, 'household') self.school_view = self.agent_filter(self.source, 'school') self.neighbourhood_view = self.agent_filter(self.source, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_plot(self):\n self.dpi = 100\n self.fig = Figure((5.0, 5.0), dpi = self.dpi)\n\n self.main_plot = self.fig.add_subplot(111)\n self.main_plot.set_axis_bgcolor('black')\n self.main_plot.set_title('Dynamic venous flow view', size = 12)\n\n pylab.setp(self.main_plot.g...
[ "0.73755175", "0.7165398", "0.7065417", "0.7002135", "0.6973624", "0.69491017", "0.6906295", "0.69040734", "0.69003326", "0.6864124", "0.6783894", "0.6779331", "0.676415", "0.676415", "0.6721529", "0.67055136", "0.668292", "0.6664983", "0.6637825", "0.6607515", "0.65993685", ...
0.7933534
0
Add the ``slug`` to the ``category``. We store category data as
def _categorize(self, slug, category): key = self._category_key(category) self.r.sadd(key, slug) # Store all category names in a Redis set, for easy retrieval self.r.sadd(self._categories_key, category)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save(self, *args, **kwargs):\n self.slug = slugify(self.name)\n super(Category, self).save(*args, **kwargs)", "def add_category(self, category):\n raise NotImplementedError()", "def add_category(self, category):\n if category not in self.categories and category.strip() != \"\":\...
[ "0.6943489", "0.6581925", "0.6511103", "0.64796185", "0.63963604", "0.62886065", "0.6225668", "0.620383", "0.6129536", "0.6048626", "0.60447186", "0.6022177", "0.5883247", "0.5850716", "0.5844365", "0.5790865", "0.57449305", "0.5721442", "0.5721442", "0.5721442", "0.5721442",...
0.80957776
0
Resets (or creates) a category containing a list of metrics. ``category`` A category name ``metric_slugs`` a list of all metrics that are members of the category.
def reset_category(self, category, metric_slugs): key = self._category_key(category) if len(metric_slugs) == 0: # If there are no metrics, just remove the category self.delete_category(category) else: # Save all the slugs in the category, and save the category...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _categorize(self, slug, category):\n key = self._category_key(category)\n self.r.sadd(key, slug)\n\n # Store all category names in a Redis set, for easy retrieval\n self.r.sadd(self._categories_key, category)", "def delete_category(self, category):\n # Remove mapping of met...
[ "0.66299736", "0.5667637", "0.5589249", "0.5577405", "0.5574487", "0.5549506", "0.5549506", "0.5549506", "0.5549506", "0.5549506", "0.54439336", "0.5430014", "0.5415624", "0.53894657", "0.5282674", "0.52785784", "0.5275231", "0.5242125", "0.5236752", "0.5199381", "0.51936287"...
0.844914
0
Set the value for a Gauge. ``slug`` the unique identifier (or key) for the Gauge ``current_value`` the value that the gauge should display
def gauge(self, slug, current_value): k = self._gauge_key(slug) self.r.sadd(self._gauge_slugs_key, slug) # keep track of all Gauges self.r.set(k, current_value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def value(self, new_value):\n for plug in self.plugs:\n plug.value = new_value", "def gauge(self, gauge, value):\n pass", "def set_value(self, new_value):\n temp = new_value\n if temp < self.limits[0]:\n temp = self.limits[0]\n if temp > self.limits[1]:\...
[ "0.5938092", "0.59306407", "0.5756452", "0.5614472", "0.5613387", "0.5590741", "0.55503696", "0.5420602", "0.5411846", "0.5397513", "0.5379045", "0.5343309", "0.5336051", "0.5327031", "0.5316567", "0.5310723", "0.5310723", "0.5310723", "0.53053826", "0.52895015", "0.52830386"...
0.85359114
0
Helper method to post list, then room and keep returned room id as self.room_id
def POST_room(self): if not self.list_id: self.POST_list() rv = self.POST_data('/api/list/' + self.list_id + '/room', data=TEST_ROOM_DATA) self.assertEqual(rv.status_code, 200) self.room_id = json.loads(rv.data)['_id']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_POST_room(self):\n\t\tself.POST_list()\n\t\trooms_list_before = self.GET_data('/api/list/' + self.list_id)['rooms']\n\n\t\t# after posting list, cleaner's lists should contain id of posted list\n\t\trv = self.app.post('/api/list/' + self.list_id + '/room')\n\t\troom_id = json.loads(rv.data)[\"_id\"]\n\t\t...
[ "0.76873094", "0.63827664", "0.61296326", "0.61296326", "0.6034038", "0.6028532", "0.5761359", "0.57121366", "0.5657105", "0.56329674", "0.5632262", "0.5582673", "0.5512861", "0.5481963", "0.541616", "0.54145813", "0.5412288", "0.54108673", "0.5392156", "0.5375952", "0.537246...
0.81727374
0
Coulomb logarithm of electronelectron collision
def lnlambda(Te, nev, debug=True): if debug: return 14.9-0.5*np.log(nev/1.e20)+np.log(Te/1.e3) else: return 15.0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def coulog(Te,nev):\n return np.log(12.0*np.pi*nev*(Debye(Te,nev))**3)", "def eclogite_foliated():\n\n rho = 3300.\n\n C = np.zeros((6,6), dtype=float)\n C[0,0] = 203.45; C[0,1] = 67.76; C[0,2] = 64.47; C[0,3] = 0.08; C[0,4] = 1.9; C[0,5] = -0.4\n C[1,0] = C[0,1]; C[1,1] =...
[ "0.7260762", "0.6410308", "0.62894773", "0.60904723", "0.6042671", "0.593443", "0.5933685", "0.590235", "0.5899121", "0.58949286", "0.58802146", "0.58391416", "0.5831718", "0.5809282", "0.57936275", "0.5789192", "0.5769492", "0.5726789", "0.57259", "0.5682765", "0.56732905", ...
0.0
-1
test whether output file is correct
def test_output_correct(): global out_dir, cor_dir out = codecs.open(path.join(out_dir, 'oshea_similarity.json'), mode='r', encoding='utf-8') inp = codecs.open(path.join(cor_dir, 'oshea_similarity.json'), mode='r', encoding='utf-8') assert(out.read() == inp.read...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_file_output(self, actual: str, expected: str):\n assert self._program_executed, f\"You first need to `execute` the program before checking its outputs!\"\n assert actual in self._write_files, f\"Unknown output file {actual}. Did you forget to provide it to the program by calling input_write...
[ "0.7225775", "0.71919495", "0.7117982", "0.70938843", "0.69489413", "0.6742666", "0.65383106", "0.6522939", "0.6508132", "0.64845866", "0.6449957", "0.63967735", "0.63760954", "0.6373204", "0.6360742", "0.6357689", "0.6345957", "0.63331926", "0.62803346", "0.62741333", "0.627...
0.67739576
5
Return the number of ESSIDs currently stored.
def __len__(self): return len(self.essids)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def keycount(self, essid):\n if essid not in self.essids:\n raise KeyError(\"ESSID not in store.\")\n return len(self.essids[essid][1])", "def keycount(self, essid):\n return self.cli.essids.keycount(essid)", "def __len__(self):\n with SessionContext(self.SessionClass...
[ "0.7487046", "0.7227436", "0.7134951", "0.68750715", "0.6811783", "0.67542565", "0.66645426", "0.662965", "0.65655565", "0.6549831", "0.6452546", "0.6444286", "0.6414019", "0.63826793", "0.63724375", "0.63692725", "0.6349159", "0.6337664", "0.6337297", "0.633663", "0.633002",...
0.669554
6
Return the number of keys that can be used to receive passwordsets.
def __len__(self): return len(self.pwfiles)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getNumberOfKeys(self) -> int:\n ...", "def num_keys(self):\n return len(self.counter.keys())", "def size(self, key):\n return self.cli.passwords.size(key)", "def getNoOfKeys(self):\n return len(self.__keyList)", "def num_keys(self):\r\n return len(self.keys)", "def ...
[ "0.8012067", "0.7403502", "0.7391902", "0.73541915", "0.7213431", "0.71447235", "0.71447235", "0.6996114", "0.69880015", "0.69636816", "0.6794613", "0.6775893", "0.67461437", "0.6740317", "0.6703644", "0.67029864", "0.67029864", "0.66835386", "0.6673835", "0.66159946", "0.660...
0.6524965
24
Return the number of ESSIDs currently stored.
def __len__(self): return self.cli.essids.len()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def keycount(self, essid):\n if essid not in self.essids:\n raise KeyError(\"ESSID not in store.\")\n return len(self.essids[essid][1])", "def keycount(self, essid):\n return self.cli.essids.keycount(essid)", "def __len__(self):\n with SessionContext(self.SessionClass...
[ "0.7487046", "0.7227436", "0.7134951", "0.6811783", "0.67542565", "0.669554", "0.66645426", "0.662965", "0.65655565", "0.6549831", "0.6452546", "0.6444286", "0.6414019", "0.63826793", "0.63724375", "0.63692725", "0.6349159", "0.6337664", "0.6337297", "0.633663", "0.633002", ...
0.68750715
3