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
The AES encryption key used to encrypt and decrypt packets by the chip. This can be set to None to disable encryption (the default), otherwise it must be a 16 byte long byte string which defines the key (both the transmitter and receiver must use the same key value).
def encryption_key(self) -> bytearray: # Handle if encryption is disabled. if self.aes_on == 0: return None # Encryption is enabled so read the key and return it. key = bytearray(16) self._read_into(_REG_AES_KEY1, key) return key
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encryption_key(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"encryption_key\")", "def encryption_key(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"encryption_key\")", "def encryption_key(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(...
[ "0.670718", "0.670718", "0.6507702", "0.6415609", "0.63788074", "0.6375878", "0.6375878", "0.637141", "0.6356164", "0.62936723", "0.624198", "0.6219867", "0.62001616", "0.6187914", "0.617804", "0.6172303", "0.6159631", "0.61305374", "0.6107197", "0.60707855", "0.60707855", ...
0.7742385
0
The transmit power in dBm. Can be set to a value from 2 to 20 for high power devices (RFM69HCW, high_power=True) or 18 to 13 for low power devices. Only integer power levels are actually set (i.e. 12.5 will result in a value of 12 dBm).
def tx_power(self) -> int: # Follow table 10 truth table from the datasheet for determining power # level from the individual PA level bits and output power register. pa0 = self.pa_0_on pa1 = self.pa_1_on pa2 = self.pa_2_on current_output_power = self.output_power ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_power(self):\r\n return self._api.get_power()", "def get_power(self) -> float:\n\n #:READ[n][:CHANnel[m]][:SCALar]: POWer[:DC]?\n return float(self._inst.query(\":READ:POW?\"))", "def set_power(self, dbm=-30):\r\n self.write(\"POW \"+str(dbm))", "def _dBmTomW(dBm):\n re...
[ "0.6721028", "0.6673177", "0.6659233", "0.6641891", "0.6546992", "0.65187883", "0.6493218", "0.6450625", "0.6450625", "0.64386564", "0.6427601", "0.6419749", "0.6408049", "0.63702345", "0.63020694", "0.630102", "0.6276734", "0.62521684", "0.62325805", "0.62156737", "0.6208777...
0.7179818
0
The received strength indicator (in dBm). May be inaccuate if not read immediatey. last_rssi contains the value read immediately receipt of the last packet.
def rssi(self) -> float: # Read RSSI register and convert to value using formula in datasheet. return -self._read_u8(_REG_RSSI_VALUE) / 2.0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_signal_level_from_rssi(rssi):\n dBm = -113 + (rssi * 2)\n \n if dBm < -95 or dBm >= 85:\n return 0\n elif dBm >= -95 and dBm < -85:\n return 25\n elif dBm >= -85 and dBm < -75:\n return 50\n elif dBm >= -75 and dBm < -65:\n return 75\n elif dBm >= -65:\n ...
[ "0.658969", "0.628561", "0.6215292", "0.59323895", "0.58326787", "0.57726073", "0.5755803", "0.5669645", "0.56387764", "0.5530442", "0.55092996", "0.5472028", "0.54414", "0.53886384", "0.53790826", "0.5361576", "0.53559226", "0.53532135", "0.5326946", "0.5320569", "0.530747",...
0.6669699
0
The modulation bitrate in bits/second (or chip rate if Manchester encoding is enabled). Can be a value from ~489 to 32mbit/s, but see the datasheet for the exact supported values.
def bitrate(self) -> float: msb = self._read_u8(_REG_BITRATE_MSB) lsb = self._read_u8(_REG_BITRATE_LSB) return _FXOSC / ((msb << 8) | lsb)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bitrate(self) -> int:\n return self.properties[DBUS_ATTR_BITRATE]", "def audio_bitrate(self):\n # type: () -> int\n return self._audio_bitrate", "def target_bitrate(self) -> int:\n return self.__target_bitrate", "def video_bitrate(self):\n # type: () -> int\n ret...
[ "0.70341307", "0.69462824", "0.68479145", "0.6846274", "0.6479049", "0.6396864", "0.639065", "0.6385125", "0.62924814", "0.60948175", "0.6044736", "0.60318154", "0.5999797", "0.59846735", "0.58983445", "0.58243036", "0.5823406", "0.5810605", "0.57764906", "0.5750731", "0.5719...
0.70504725
0
The frequency deviation in Hertz.
def frequency_deviation(self) -> float: msb = self._read_u8(_REG_FDEV_MSB) lsb = self._read_u8(_REG_FDEV_LSB) return _FSTEP * ((msb << 8) | lsb)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def frequency(self):\n return float(self.get_frequency())", "def DominantFrequency(data):\n w = fft.fft(data)\n freqs = fft.fftfreq(len(data))\n i = argmax(abs(w))\n dom_freq = freqs[i]\n dom_freq_hz = abs(dom_freq * 32.0)\n return dom_freq_hz", "def delta_freq(self):\n return s...
[ "0.7284917", "0.68828076", "0.6868749", "0.67600554", "0.67555356", "0.674716", "0.6747092", "0.66368073", "0.6628798", "0.6543518", "0.6542061", "0.653495", "0.65202004", "0.6503117", "0.64936036", "0.6493008", "0.64929736", "0.64923584", "0.6482648", "0.6466687", "0.6459865...
0.75322044
0
Wait to receive a packet from the receiver. If a packet is found the payload bytes are returned, otherwise None is returned (which indicates the timeout elapsed with no reception). If keep_listening is True (the default) the chip will immediately enter listening mode after reception of a packet, otherwise it will fall ...
def receive( self, *, keep_listening: bool = True, with_ack: bool = False, timeout: Optional[float] = None, with_header: bool = False ) -> int: timed_out = False if timeout is None: timeout = self.receive_timeout if timeout is not N...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recieve_data(self):\r\n try:\r\n while True:\r\n try:\r\n data, self.addr = self.sock.recvfrom(1024)\r\n return data\r\n except socket.timeout:\r\n print(\"There is no packet at all!\")\r\n ...
[ "0.5738121", "0.5685111", "0.5575984", "0.55068445", "0.54589325", "0.54057187", "0.53976196", "0.53484493", "0.52613705", "0.5236509", "0.5215168", "0.51983476", "0.51791364", "0.51641446", "0.51576495", "0.5156061", "0.5136369", "0.51328534", "0.5125869", "0.51189816", "0.5...
0.7667439
0
e = svpice(t) Calculates the water vapor mixing ratio
def svpice(t): A0=0.7859063157e0 A1=0.357924232e-1 A2=-0.1292820828e-3 A3=0.5937519208e-6 A4=0.4482949133e-9 A5=0.2176664827e-10 T = t - 273.16 e = pow(10.0,A0+T*(A1 + T*(A2 + T*(A3 + T*(A4 + T*A5))))) return e
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def p(party, vote_count, s):\n return t(party, vote_count) / d(s)", "def es_ice_from_t(t):\n return 0.6108 * np.exp((21.87 * t) / (t + 265.5))", "def MixR2VaporPress(qv,p):\n\n return qv*p/(Epsilon+qv)", "def g_R_mix_i(s, p, k='x'): # (Validated)\n from numpy import log\n if k == 'y': # 'y' ...
[ "0.65096945", "0.6310891", "0.6074309", "0.6026668", "0.58976406", "0.58969826", "0.58613163", "0.5649168", "0.561796", "0.5617289", "0.56026936", "0.5587369", "0.554691", "0.5542271", "0.5528452", "0.5521912", "0.5517318", "0.5499511", "0.5499511", "0.5499511", "0.54806095",...
0.72473395
0
Maps iTunes product names to Subscription attributes. An iTunes "product" also includes information about the billing cycle; by convention we name our products with a suffix of "_month" or "_year" (etc).
def _GetITunesProductInfo(cls, verify_response): product_id = verify_response.GetProductId() base_product, billing_cycle = product_id.rsplit('_', 1) assert billing_cycle in ('month', 'year'), billing_cycle return Subscription._ITUNES_PRODUCTS[base_product]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_products_in_subscription(self, subscription):\n path = 'katello/api/v2/subscriptions/{}'.format(subscription.id)\n subscription_json = satellite_get_response(path)\n name_dict = dict(\n (\n prod_json['name'],\n satellite_json_to_entity(prod_jso...
[ "0.6515709", "0.5283521", "0.5257421", "0.5181248", "0.51356757", "0.51257026", "0.50686973", "0.50410646", "0.50264907", "0.49921265", "0.4973188", "0.49638012", "0.4953467", "0.49528402", "0.49311724", "0.49116105", "0.4900208", "0.48989576", "0.48896012", "0.48830217", "0....
0.61623037
1
Returns the subscription id for an iTunes transaction. THe returned id will be the same for all transactions in a series of renewals.
def GetITunesSubscriptionId(cls, verify_response): return kITunesPrefix + verify_response.GetOriginalTransactionId()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subscription_id(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"subscription_id\")", "def get_subscription_id(self):\n subscription_id = self.get_intermediate(\"subscription_id\", None)\n if not subscription_id:\n subscription_id = self.cmd.cli_ctx.data.get('subscripti...
[ "0.6922909", "0.66919905", "0.6434174", "0.6358435", "0.6095308", "0.5967596", "0.59468853", "0.59185296", "0.57001954", "0.5659351", "0.5659351", "0.5658425", "0.56308174", "0.5568889", "0.5521859", "0.5473928", "0.5415231", "0.5415182", "0.52769345", "0.52344084", "0.520371...
0.7144965
0
Creates a subscription object for an iTunes transaction. The verify_response argument is a response from viewfinder.backend.services.itunes_store.ITunesStoreClient.VerifyReceipt. The new object is returned but not saved to the database.
def CreateFromITunes(cls, user_id, verify_response): assert verify_response.IsValid() sub_dict = dict( user_id=user_id, transaction_id=Subscription.GetITunesTransactionId(verify_response), subscription_id=Subscription.GetITunesSubscriptionId(verify_response), timestamp=verify_response.Ge...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def RecordITunesTransaction(cls, client, callback, user_id, verify_response):\n sub = Subscription.CreateFromITunes(user_id, verify_response)\n sub.Update(client, callback)", "def post_create_subscription(\n self, response: pubsub.Subscription\n ) -> pubsub.Subscription:\n return response"...
[ "0.7048045", "0.61676496", "0.5990635", "0.59361476", "0.5884864", "0.55695355", "0.5556764", "0.541712", "0.5386612", "0.53512514", "0.5335941", "0.5322247", "0.5300988", "0.5213497", "0.52041996", "0.5198155", "0.51571894", "0.50963527", "0.499864", "0.49974996", "0.4977607...
0.6756502
1
Creates a subscription record for an iTunes transaction and saves it to the database. The verify_response argument is a response from viewfinder.backend.services.itunes_store.ITunesStoreClient.VerifyReceipt.
def RecordITunesTransaction(cls, client, callback, user_id, verify_response): sub = Subscription.CreateFromITunes(user_id, verify_response) sub.Update(client, callback)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post_create_subscription(\n self, response: pubsub.Subscription\n ) -> pubsub.Subscription:\n return response", "def CreateFromITunes(cls, user_id, verify_response):\n assert verify_response.IsValid()\n sub_dict = dict(\n user_id=user_id,\n transaction_id=Subscription.GetITun...
[ "0.60433036", "0.5971549", "0.57673633", "0.57216924", "0.5666896", "0.56634444", "0.5558759", "0.5525311", "0.55051625", "0.53845364", "0.53136545", "0.53124315", "0.5200569", "0.5187778", "0.5142988", "0.5119962", "0.51056916", "0.50879365", "0.5056159", "0.50197226", "0.50...
0.75471354
0
Project a subset of subscription attributes that can be provided to the user.
def MakeMetadataDict(self): sub_dict = {} for attr_name in Subscription._JSON_ATTRIBUTES: util.SetIfNotNone(sub_dict, attr_name, getattr(self, attr_name, None)) if self.extra_info: sub_dict['extra_info'] = deepcopy(self.extra_info) return sub_dict
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subscription_attributes_tag(self) :\n self._curattributes = self._subscription_attributes\n return self.parseTag()", "def filter_attributes_choices(self): \n filter_attributes = [\n 'no filters',\n 'user_id',\n 'device_id',\n 'd...
[ "0.58981997", "0.51803654", "0.4960902", "0.49218544", "0.4909942", "0.48150256", "0.47508818", "0.47446656", "0.47212908", "0.47028956", "0.46752736", "0.46638697", "0.46459356", "0.46380746", "0.46220508", "0.46209976", "0.46083537", "0.45452696", "0.45383802", "0.45074958", ...
0.545014
1
This function adds a node to the new SQLite db and appends it's new last_row_id to a dictionary
def add_node(old_node_dict, old_to_new_node_ids_dict, new_accession, new_db_api, aliases): # getting the old node id, and the old node's properties old_node_id = old_node_dict["id"] old_node_alt_accession = old_node_dict["alt_accession"] old_node_name = old_node_dict["name"] tax_id = old_node_dict[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post_database_node_create(self, resource_dict):\n pass", "def add_row(self, row_id):", "def node_create(self, parent, path):\n\n q = (\"insert into nodes (parent, path) \"\n \"values (?, ?)\")\n props = (parent, path)\n return self.execute(q, props).lastrowid", "de...
[ "0.6280573", "0.6190676", "0.6165746", "0.60187334", "0.599376", "0.5868281", "0.5863443", "0.5832126", "0.5823211", "0.57992977", "0.570852", "0.5707201", "0.5702451", "0.5685151", "0.56491435", "0.5606824", "0.5587125", "0.5578876", "0.554295", "0.5534103", "0.5521977", "...
0.6850345
0
Migrate resource to a node in the cluster.
def migrate_resource_to_node(self, resource_name, node_name, lifetime): try: if not os.path.exists('/usr/sbin/crm'): return False # Lifetime follows the duration format specified in ISO_8601 os.system("/usr/sbin/crm resource migrate %s %s P%sS" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def migrate_to_dest(self):\n self.executor.loader.build_graph()\n self.executor.migrate(self.migrate_to)", "def move_node(self, job):\n transfer = Transfer(job.jobInfo)\n target = transfer.target\n direction = transfer.direction\n result = None\n # Check uris\n check_uri(target, s...
[ "0.5999055", "0.59071654", "0.57233363", "0.5619616", "0.559734", "0.5534029", "0.552582", "0.5486577", "0.5478916", "0.5396698", "0.5395462", "0.539263", "0.5368381", "0.5341882", "0.53413707", "0.5332341", "0.52837247", "0.52494556", "0.52229625", "0.5201633", "0.52008086",...
0.65295005
0
Takes res_summary of current run (in json format) and appends to main results frame (in csv format)
def save_results_to_csv(save_file_path, append=True, tmp_file_path=tmp_file_path, datefmt='%d/%m/%Y %H:%M:%S'): # load tmp results res_summary = open_json(tmp_file_path, data_format=pd.DataFrame) # calculate average scores combis = list(product( ['CV', 'Val'], ['precision', 'recall', '...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_rr_summary(results):\n # pylint: disable=unidiomatic-typecheck\n test_result = results.summary()\n assert type(test_result).__name__ == \"Summary\"\n assert type(test_result.tables) == list\n assert len(test_result.tables) == 3\n assert len(test_result.extra_txt) > 0", "def _append_sum...
[ "0.650656", "0.6165997", "0.60928845", "0.6065031", "0.6008469", "0.6008069", "0.59869623", "0.5973775", "0.5949411", "0.5935146", "0.5926118", "0.58959687", "0.58954275", "0.5893671", "0.58762115", "0.5863281", "0.5841817", "0.57980245", "0.5791485", "0.5770941", "0.5745105"...
0.6263398
1
Retrieve all the YouTube IDs (including translations) from KA.org. This will fetch all the publiclyvisible YouTube IDs on the site in all languages and return them as a big, flat list.
def get_youtube_ids(): global _id_list if _id_list is None: all_videos_in = urllib2.urlopen("http://www.khanacademy.org/api/internal/videos/localized/all") try: all_videos = simplejson.load(all_videos_in) finally: all_videos_in.close() # Now get our CS vi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_course_youtube_ids(self):\n\n with ProgressBar() as pb:\n for i, unit_url in zip(\n pb(range(len(self.course_unit_urls)), label=\"Collecting Youtube IDs:\"),\n self.course_unit_urls,\n ):\n unit_url = ROOT_URL + unit_url\n ...
[ "0.63152283", "0.5861457", "0.5785536", "0.57580537", "0.5666724", "0.5644588", "0.557938", "0.55043006", "0.54636925", "0.533987", "0.531919", "0.52610105", "0.52363324", "0.5219416", "0.520358", "0.51786417", "0.5162251", "0.5152716", "0.5128718", "0.5128468", "0.5088688", ...
0.7430867
0
Verify ID token with Google.
def verify_token(token): try: idinfo = client.verify_id_token(token, app.config['GOOGLE_CLIENT_ID']) if idinfo['iss'] not in [ 'accounts.google.com', 'https://accounts.google.com' ]: raise crypt.AppIdentityError("Wrong issuer.") except crypt.AppIdentit...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def google_validate(self, token):\n try:\n payload = client.verify_id_token(token, GOOGLE_USER_ID)\n if payload['iss'] not in ['accounts.google.com', 'https://accounts.google.com'] or payload['aud'] != GOOGLE_USER_ID:\n return False\n else:\n re...
[ "0.73845893", "0.6778414", "0.67744815", "0.6655399", "0.63589007", "0.63034034", "0.62374574", "0.6162608", "0.616177", "0.5989724", "0.5947257", "0.59308225", "0.5929522", "0.5898802", "0.58248806", "0.57806706", "0.57294035", "0.57176304", "0.57089174", "0.56980926", "0.56...
0.7385082
0
Returns the mode`mode` unfolding of `tensor`.
def unfold(tensor, mode): return np.moveaxis(tensor, mode, 0).reshape((tensor.shape[mode], -1))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tucker_to_unfolded(tucker_tensor, mode=0, skip_factor=None, transpose_factors=False):\n return unfold(tucker_to_tensor(tucker_tensor, skip_factor=skip_factor, transpose_factors=transpose_factors), mode)", "def tensor_ring(input_tensor, rank, mode=0, verbose=False):\n rank = validate_tr_rank(tl.shape(in...
[ "0.67084146", "0.6294462", "0.577661", "0.5535891", "0.5533362", "0.5456649", "0.53956753", "0.5325191", "0.52897817", "0.5246781", "0.52451813", "0.51632154", "0.51495504", "0.513701", "0.5103899", "0.505964", "0.50290567", "0.49887982", "0.49594522", "0.49296796", "0.492546...
0.7138083
0
Rescales factors across modes so that all norms match.
def rebalance(self): # Compute norms along columns for each factor matrix norms = [np.linalg.norm(f, axis=0) for f in self.factors] # Multiply norms across all modes lam = np.prod(norms, axis=0) ** (1/self.ndim) # Update factors self.factors = [f * (lam / fn) for f, fn...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _set_scale_factors_to_one(self):\n self.wnorm = 1.0\n self.hnorm = 1.0\n self.xnorm = 0.0\n self.ynorm = 0.0\n self.scale = 1.0", "def normalize(self, factor):", "def renormZeroModes(self):\n\t\tfor z in range(self.nZero):\n\t\t\tfor i in range(self.totalBins):\n\t\t\t\ts...
[ "0.61644113", "0.6141815", "0.60424", "0.59403366", "0.58509684", "0.5777797", "0.5629738", "0.55926096", "0.5536513", "0.5532778", "0.55215365", "0.55069524", "0.5462789", "0.54424363", "0.5442392", "0.5418375", "0.5408845", "0.5396137", "0.53793746", "0.53635174", "0.535856...
0.7145958
0
Adds n more factors holding zeros.
def pad_zeros_(self, n): if n == 0: return self.factors = [np.column_stack((f, np.zeros((f.shape[0], n)))) for f in self.factors] self.rank += n
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def factor_naive(n):\n factors = []\n\n for factor in range(2, n // 2):\n q, r = divmod(n, factor)\n power = 0\n while r == 0:\n power += 1\n n = q\n q, r = divmod(q, factor)\n if power != 0:\n factors.append((factor, power))\n\n if f...
[ "0.67004484", "0.6634243", "0.6552006", "0.64874166", "0.6481583", "0.6470163", "0.6383408", "0.6367483", "0.6337883", "0.6290753", "0.6288449", "0.62507254", "0.6216378", "0.62020445", "0.6158086", "0.6138038", "0.60733265", "0.6064506", "0.60214394", "0.59711444", "0.594252...
0.7863161
0
Permutes the columns of the factor matrices inplace.
def permute(self, idx): # Check that input is a true permutation if set(idx) != set(range(self.rank)): raise ValueError('Invalid permutation specified.') # Update factors self.factors = [f[:, idx] for f in self.factors] return self.factors
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def permute(self):\n raise NotImplementedError()", "def permute(self, ordering: np.ndarray, *, axis: int) -> None:\n\t\tif axis == 0:\n\t\t\tself.values = self.values[ordering, :]\n\t\telif axis == 1:\n\t\t\tself.values = self.values[:, ordering]\n\t\telse:\n\t\t\traise ValueError(\"axis must be 0 or 1\")...
[ "0.60478354", "0.6011948", "0.5995574", "0.59661716", "0.5913475", "0.5913475", "0.5913475", "0.5913475", "0.5913475", "0.59091294", "0.5613283", "0.55513257", "0.5493128", "0.54589325", "0.5422985", "0.5410862", "0.53904605", "0.5309497", "0.5292", "0.5281752", "0.5257484", ...
0.66634274
0
Generates a random Nway tensor with rank R, where the factors are generated from the standard normal distribution.
def randn_ktensor(shape, rank, norm=None, random_state=None): # Check input. rns = _check_random_state(random_state) # Draw low-rank factor matrices with i.i.d. Gaussian elements. factors = KTensor([rns.standard_normal((i, rank)) for i in shape]) return _rescale_tensor(factors, norm)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rand_ktensor(shape, rank, norm=None, random_state=None):\n\n # Check input.\n rns = _check_random_state(random_state)\n\n # Randomize low-rank factor matrices i.i.d. uniform random elements.\n factors = KTensor([rns.uniform(0.0, 1.0, size=(i, rank)) for i in shape])\n return _rescale_tensor(fact...
[ "0.68510383", "0.64044255", "0.6388486", "0.6305706", "0.6206046", "0.6111345", "0.6087686", "0.6041361", "0.60258365", "0.59969205", "0.598002", "0.5974005", "0.5960351", "0.59570074", "0.59499747", "0.59447175", "0.59335643", "0.5925827", "0.59189", "0.5916662", "0.59135413...
0.71602625
0
Generates a random Nway tensor with rank R, where the factors are generated from the standard uniform distribution in the interval [0.0,1].
def rand_ktensor(shape, rank, norm=None, random_state=None): # Check input. rns = _check_random_state(random_state) # Randomize low-rank factor matrices i.i.d. uniform random elements. factors = KTensor([rns.uniform(0.0, 1.0, size=(i, rank)) for i in shape]) return _rescale_tensor(factors, norm)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def randn_ktensor(shape, rank, norm=None, random_state=None):\n\n # Check input.\n rns = _check_random_state(random_state)\n\n # Draw low-rank factor matrices with i.i.d. Gaussian elements.\n factors = KTensor([rns.standard_normal((i, rank)) for i in shape])\n return _rescale_tensor(factors, norm)",...
[ "0.69989693", "0.6552011", "0.6539768", "0.6456678", "0.62823296", "0.62632585", "0.62457913", "0.62007326", "0.6195678", "0.6193777", "0.6189897", "0.61812943", "0.6175768", "0.6164422", "0.6138238", "0.6130913", "0.6128714", "0.6128714", "0.6118652", "0.6090159", "0.6075797...
0.68122905
1
Retrive a proxy if it exists
def get_proxy(self, proxy_name): proxies = self.proxies() if proxy_name in proxies: return proxies[proxy_name] else: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def proxies_get(self) -> bool:\n return True", "def get_proxy():\n response = requests.get(\"http://127.0.0.1:5010/get/\")\n json_response = response.json()\n proxy = json_response.get(\"proxy\")\n return 'http://{}'.format(proxy)", "def proxy(self):\n return self.get('proxy', None)",...
[ "0.7126719", "0.6863153", "0.67914283", "0.67386293", "0.6480348", "0.64458257", "0.63585657", "0.63448906", "0.63342106", "0.6326931", "0.62948895", "0.62872016", "0.6261418", "0.6246672", "0.6245063", "0.6193045", "0.6114846", "0.61114955", "0.610391", "0.60939074", "0.6093...
0.7525604
0
Create a toxiproxy proxy
def create(self, upstream, name, listen=None, enabled=None): if name in self.proxies(): raise_with_traceback(ProxyExists("This proxy already exists.")) # Lets build a dictionary to send the data to the Toxiproxy server json = { "upstream": upstream, "name": ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mutate_toxiproxy(self, body, spec):\n # 1. Precompute the ports that need to be proxied\n # for every port specified in the containers' definitions\n containers_ports = []\n for container in body.spec.template.spec.containers:\n for port in container.ports:\n containers_ports.append(por...
[ "0.6961543", "0.67108846", "0.6638673", "0.66028666", "0.65358055", "0.6422299", "0.6317592", "0.6316147", "0.6288117", "0.6187003", "0.61139774", "0.60965794", "0.5966773", "0.59596086", "0.5955718", "0.5935014", "0.5935014", "0.59328675", "0.59061795", "0.58915186", "0.5883...
0.6930043
1
Update the APIConsumer host and port
def update_api_consumer(self, host, port): APIConsumer.host = host APIConsumer.port = port APIConsumer.base_url = "http://%s:%s" % (host, port)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _update(self, host):\n pass", "def set_service_host(self, host):\n self._api_host = f\"https://{host}\"", "def api_endpoint_port():\n return 5000", "def fusion_api_edit_interconnect_ports(self, body, uri, api=None, param='', headers=None):\n param = '/update-ports%s' % param\n...
[ "0.66297925", "0.6167618", "0.59449947", "0.5854625", "0.58086693", "0.5735921", "0.5632052", "0.5589792", "0.55860806", "0.5578089", "0.5540265", "0.55278695", "0.5506112", "0.5500997", "0.5464852", "0.54536045", "0.5407038", "0.5392257", "0.53792584", "0.5372455", "0.535831...
0.87162656
0
Change the path of the inputfile to the outputdir folder
def create_path(inputfile, outputdir): pathdata = '/'.join(inputfile.split('/')[-3:]) newpath = join(outputdir, pathdata) dirout = dirname(newpath) if not isdir(dirout): os.makedirs(dirout) return newpath
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _make_output_path(self, filename):\n return os.path.join(self._output_directory, filename)", "def opath ( dir_name, file_name = None ):\n if file_name:\n return os.path.join(output_path, dir_name, file_name)\n return os.path.join(output_path, dir_name)", "def set_fileout(sel...
[ "0.6495199", "0.6444686", "0.63556474", "0.63421255", "0.6304217", "0.6299392", "0.62309605", "0.61633223", "0.6139927", "0.60741585", "0.6066437", "0.60580736", "0.599736", "0.5994356", "0.59843665", "0.5979879", "0.59761506", "0.5966698", "0.5939771", "0.59270877", "0.58790...
0.663774
0
Resize images from `fileinput` to `size` by `size`, saving the output images in `output` folder.
def main(inputfile, output, size): if not output: output = join(dirname(inputfile), str(size)) if not isdir(output): os.mkdir(output) logger.info('Resizing images from: %s' % inputfile) inputfile = realpath(inputfile) #/usr/share/datasets/KSCGR_Original/data1/boild-egg/0.jpg...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resize_img(self, filename: str, size: Tuple[int, int] = (299, 299)):\n img = Image.open(join(self.source_dir, filename))\n width, height = img.size\n orig_shape = np.array(img.size)\n wanted_shape = np.array(size)\n ratios = wanted_shape / orig_shape\n wanted_width, wa...
[ "0.7213285", "0.7178544", "0.71401495", "0.711877", "0.70331067", "0.69555014", "0.66056764", "0.6570178", "0.6518711", "0.6505289", "0.6483322", "0.6454556", "0.6443169", "0.634009", "0.6335424", "0.6289591", "0.6263229", "0.62515146", "0.61947256", "0.61846185", "0.6140197"...
0.78881145
0
Handle step to setup using device WiFi information.
async def async_step_wifi(self, info: Optional[dict] = None): errors = {} if info is not None: try: serial, credential, device_type = get_mqtt_info_from_wifi_info( info[CONF_SSID], info[CONF_PASSWORD] ) except DysonFailedToParse...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup():\n print('Setup option is not working')\n quit()\n print('Long press the reset button until the blue Led is blinking quickly')\n print('Long press again until blinking slowly')\n print('Manually connect this device to the Wifi SSID named BlroadlinkProv')\n print('Press security mode (...
[ "0.67737734", "0.64223045", "0.6301936", "0.6131431", "0.6123429", "0.58221936", "0.57750916", "0.57604754", "0.57342184", "0.5592361", "0.5547063", "0.55202025", "0.5427627", "0.54054934", "0.5386828", "0.53794396", "0.5365684", "0.5364412", "0.53481007", "0.5346336", "0.533...
0.6542393
1
Builds the audio bar controls
def build_controls(self): controlSizer = wx.BoxSizer(wx.HORIZONTAL) btnData = [{'bitmap':'player_pause.png', 'handler':self.on_pause, 'name':'pause'}, {'bitmap':'player_stop.png', 'handler':self.on_stop, 'name':'stop'}] for btn...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def musicGrid():\n \n a = os.path.join('samples','0c.wav') #the paths for mixer to locate audio files\n b = os.path.join('samples','1b.wav')\n c = os.path.join('samples','2a.wav')\n d = os.path.join('samples','3g.wav')\n e = os.path.join('samples','4f.wav')\n f = os.path.join('samples','5e.wav...
[ "0.6498628", "0.6370231", "0.606776", "0.59676075", "0.58822334", "0.58665264", "0.5857452", "0.5847591", "0.5829374", "0.58196217", "0.5787688", "0.5785194", "0.5740432", "0.5727481", "0.5706543", "0.57058376", "0.5701793", "0.5619412", "0.56180364", "0.56060165", "0.5597203...
0.6529542
0
Updates playback slider and track counter
def on_update_playback(self, event): try: offset = self.mplayer.GetTimePos() except: return print offset mod_off = str(offset)[-1] if mod_off == '0': print "mod_off" offset = int(offset) self.playbackSlider.SetValue(offs...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_play_time(value=None):\n global track_total_play_time\n global track_last_slided_pos\n global play_time_loop_id\n # Print track position only if the track is playing\n if track_status.get() == \"(Playing)\":\n # The track is playing normally\n if (not value) and pygame.mixer...
[ "0.6873648", "0.6649394", "0.6415135", "0.6347096", "0.6288392", "0.62869227", "0.614899", "0.61304957", "0.60725564", "0.6072319", "0.6061983", "0.60057396", "0.6002242", "0.5939189", "0.59100217", "0.58904165", "0.58603567", "0.5845622", "0.5825989", "0.5806675", "0.5793242...
0.7377823
0
Waits for process to be finished asynchronously and times out if process not returns within given time
async def async_wait_for_process(loop, process: psutil.Process, timeout): try: await asyncio.wait_for(loop.run_in_executor(None, process.wait), timeout=timeout) except asyncio.exceptions.TimeoutError as e: raise e
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wait_to_complete(self, timeout: float = 5) -> None:\n if self.proc.poll() is not None: # type: ignore\n return\n\n start_time = time.time()\n\n while start_time + timeout > time.time() and self.proc.poll() is None: # type: ignore\n time.sleep(0.001)\n\n if se...
[ "0.6986921", "0.68717754", "0.67107403", "0.6620304", "0.6620304", "0.6620304", "0.6613698", "0.6608104", "0.6546768", "0.6472685", "0.6450905", "0.64409566", "0.64409566", "0.63692683", "0.6297638", "0.6277798", "0.6201676", "0.62013197", "0.6187456", "0.613317", "0.6082933"...
0.74258494
0
Run the given logServer as an xmlrpc server (forever).
def startServer(logServer, host="localhost", ports=(globalconst.DEFAULTPORT_XMLRPC,), readyMsg=True): # v0.3.0: The order of host,ports has changed for consistency # warn: if type(host) in (tuple,list) or type(ports) in (str,str): msg = "Unexpected host or ports type. Note: The argument order in startServer has ch...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(self):\n self.__rpc_server.run()", "def main():\n return run_server(**parse_server_args())", "def main(self, path='rpc-modules'):\n\n self.parse_option()\n self.set_option()\n\n inst = RPCServer(module_path = path, parent=self )\n debug(\"calling reactor.listenTCP(...
[ "0.6242714", "0.61977965", "0.61418754", "0.61410034", "0.6135663", "0.6040784", "0.5952568", "0.5952568", "0.5949733", "0.5922887", "0.59156555", "0.5900795", "0.58813983", "0.5802566", "0.57886535", "0.57549906", "0.57344985", "0.572346", "0.56516397", "0.56341165", "0.5587...
0.67763853
0
The OpenJDK download URL appropriate for the current machine.
def OpenJDK_download_url(self): system_arch = self.tools.host_arch # use a 32bit JDK if using 32bit Python on 64bit hardware if self.tools.is_32bit_python and self.tools.host_arch == "aarch64": system_arch = "armv7l" try: platform, arch, extension = { ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_download_url(self, version=\"latest\", os_name=None, bitness=None):\n raise NotImplementedError", "def get_download_url():\n return _DOWNLOAD", "def download_url(self) -> str:\n return self._download_url", "def get_download_url(self):\n\n\t\treturn self.__download_url", "def downlo...
[ "0.685768", "0.6543527", "0.6323465", "0.62235016", "0.61795586", "0.6119425", "0.61190176", "0.6039908", "0.60111797", "0.60054916", "0.5944574", "0.5916891", "0.59126705", "0.5899798", "0.5831214", "0.58159024", "0.57958746", "0.57948136", "0.5783463", "0.57627004", "0.5738...
0.84666663
0
Return a JDK's version from a path by running ``/bin/javac``. This will fail if the path contains a JRE instead of a JDK.
def version_from_path(cls, tools: ToolCache, java_path: str | Path) -> str: output = tools.subprocess.check_output( [ os.fsdecode(Path(java_path) / "bin" / "javac"), "-version", ], ) # javac's output should look like "javac 17.0.X\n" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_jdk_in_path():\n return get_java_binary_version('javac')", "def get_jre_in_path():\n return get_java_binary_version('java')", "def get_java_version(java_path: Optional[Union[Path, str]] = None) -> Optional[Version]:\n if java_path is None:\n if JAVA_HOME_VAR in environ:\n jav...
[ "0.82063043", "0.70633954", "0.6714446", "0.5886016", "0.56962925", "0.5557923", "0.53691846", "0.5357525", "0.5345719", "0.5198481", "0.51854664", "0.5183807", "0.5144315", "0.51439524", "0.51369697", "0.50839484", "0.5081025", "0.5069873", "0.5032907", "0.49192986", "0.4894...
0.8006228
1
Verify that a Java JDK exists. If ``JAVA_HOME`` is set, try that version. If it is a JRE, or its not a Java JDK, download one. On macOS, also try invoking /usr/libexec/java_home. If that location points to a Java JDK, use it. Otherwise, download a JDK from OpenJDK and unpack it into the briefcase data directory.
def verify_install(cls, tools: ToolCache, install: bool = True, **kwargs) -> JDK: # short circuit since already verified and available if hasattr(tools, "java"): return tools.java java = None install_message = None if java_home := tools.os.environ.get("JAVA_HOME", "...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def checkAndInstallJavaSDK():\n\tcheckOS()\n\ttry:\n\t\tstatus = os.system(\"java -version\")\n\texcept OSError as e:\n\t\tprint >>sys.stderr, \"Error with the command\", e\n\n\tif (status == NOT_INSTALLED or status == NOT_INSTALLED_WINDOWS or status == REQUESTING_INSTALL):\n\t\tprint \"Java SDK is not installed o...
[ "0.71323985", "0.64526904", "0.63712895", "0.61811817", "0.60211366", "0.5909117", "0.5800078", "0.56947565", "0.5581963", "0.5572944", "0.55686265", "0.51521194", "0.5105269", "0.5002173", "0.49793836", "0.49781787", "0.49728206", "0.49150807", "0.480734", "0.48046684", "0.4...
0.710017
1
Download and install a JDK.
def install(self): jdk_zip_path = self.tools.download.file( url=self.OpenJDK_download_url, download_path=self.tools.base_path, role=f"Java {self.JDK_MAJOR_VER} JDK", ) with self.tools.input.wait_bar("Installing OpenJDK..."): try: s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def downloadAndInstallJavaSDK():\n\tprint \"Downloading Java SDK...\"\n\tif sys.platform=='win32':\n\t\turl = \"http://download.oracle.com/otn-pub/java/jdk/8u102-b14/jdk-8u102-windows-i586.exe\"\n\t\texeFile = wget.download(url)\n\t\tprint \"Download complete.\"\n\t\tfolder = extractWindowsFolder(exeFile)\n\t\tpri...
[ "0.8000832", "0.6264579", "0.6092127", "0.60225695", "0.58732325", "0.5826047", "0.5808675", "0.5800487", "0.5770403", "0.57411957", "0.56235254", "0.55452937", "0.54516363", "0.5413772", "0.5361504", "0.53518337", "0.53502023", "0.5343844", "0.5325738", "0.5311165", "0.53037...
0.7463964
1
Returns all the words of a string.
def words(s): return (normalize(w) for w in _words_re.findall(s))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allWordsFromString(str):\n return set(re.findall(\"\\w+\", str.lower()))", "def words(self, text):\n return re.findall(r'\\w+', text)", "def extract_words(string):\n l = []\n word = ''\n for c in string+' ':\n if c.isalpha():\n word += c\n else:\n ...
[ "0.7867398", "0.7798272", "0.7793118", "0.7711489", "0.7556821", "0.7495844", "0.7442168", "0.7396945", "0.7370289", "0.7360776", "0.73555183", "0.7345942", "0.73215896", "0.72583306", "0.72428656", "0.72195673", "0.71984345", "0.71700275", "0.7147852", "0.71264493", "0.71194...
0.81549746
0
The frames contained in this sequence. This is on ordered set for fast lookup
def frames(self) -> Set[int]: return self._frames
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def frames(self):\n return list(self._frames)", "def get(self):\n return self.frames", "def frames(self):\n return self._frames", "def frames(self) -> Optional[Tuple[int, ...]]:\n return self._frames", "def getFrameList(self):\n with self.frameLock:\n return li...
[ "0.7574816", "0.74608237", "0.74500144", "0.71399117", "0.7015546", "0.6936743", "0.66036093", "0.65287495", "0.6466118", "0.64419204", "0.6395228", "0.6320455", "0.6297106", "0.6254824", "0.6254526", "0.625082", "0.6212734", "0.6180338", "0.6177756", "0.61253566", "0.6115706...
0.7906355
0
The order representaion of frames
def ordered(self) -> Tuple[int]: return tuple(sorted(self.frames))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def frame(self):\n return self.head", "def _current_frames(): # real signature unknown; restored from __doc__\n return {}", "def frames(self):\n return self._frames", "def frames(self):\n return list(self._frames)", "def frames(self) -> Optional[Tuple[int, ...]]:\n return sel...
[ "0.6191281", "0.6124376", "0.6079153", "0.6025094", "0.6017208", "0.5958478", "0.5891799", "0.58555484", "0.5820901", "0.5818596", "0.5803761", "0.5764077", "0.575034", "0.5744982", "0.5732593", "0.5731976", "0.57294136", "0.5727567", "0.5688107", "0.56705636", "0.5669755", ...
0.70797056
0
Is the composition nondecreasing in argument idx?
def is_incr(self, idx): return self.args[0].is_positive()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_incr(self, idx):\n return False", "def is_incr(self, idx):\n return False", "def is_incr(self, idx):\n return False", "def is_decr(self, idx):\n return self.args[0].is_negative()", "def is_decr(self, idx):\n return True", "def is_incr(self, idx) -> bool:\n ...
[ "0.57850224", "0.57850224", "0.57850224", "0.57031626", "0.568566", "0.5684089", "0.56565714", "0.56490165", "0.56490165", "0.5590573", "0.55803555", "0.5464378", "0.5419069", "0.5418919", "0.5379805", "0.53719294", "0.5369905", "0.53454417", "0.5334994", "0.5289773", "0.5287...
0.58338946
0
Tests that the function rejects an idx_col parameter that is not a string or None
def test_stochatreat_input_idx_col_str(correct_params): idx_col_not_str = 0 with pytest.raises(TypeError): stochatreat( data=correct_params["data"], block_cols=["block"], treats=correct_params["treat"], idx_col=idx_col_not_str, probs=correct_pa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_columns_non_string_error(self):\n\n with pytest.raises(ValueError):\n\n BaseTransformer(columns=1)", "def _check_index(idx):\n return isinstance(idx, _Int)", "def bad_column_positions(self, x):\n return x.is_null()", "def test_get_col_index_not_set_exception(self):\n ...
[ "0.6404591", "0.63827527", "0.63216287", "0.6163207", "0.61565495", "0.59943265", "0.5978478", "0.5954182", "0.5950434", "0.59425557", "0.5931221", "0.5908139", "0.58919454", "0.5880381", "0.585456", "0.5854125", "0.5818678", "0.5807508", "0.5803939", "0.5784186", "0.5773078"...
0.65870094
0
Tests that the function's output contains the `treat` column
def test_stochatreat_output_treat_col(treatments_dict): treatments_df = treatments_dict["treatments"] assert "treat" in treatments_df.columns, "Treatment column is missing"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_stochatreat_output_type(treatments_dict):\n treatments_df = treatments_dict[\"treatments\"]\n assert isinstance(treatments_df, pd.DataFrame), \"The output is not a DataFrame\"", "def test_stochatreat_output_treat_col_dtype(treatments_dict):\n treatments_df = treatments_dict[\"treatments\"]\n ...
[ "0.6361809", "0.6084155", "0.6007108", "0.5937272", "0.5585468", "0.54977846", "0.5414859", "0.53232783", "0.52239245", "0.52214813", "0.521626", "0.51936126", "0.5181886", "0.51548535", "0.5119134", "0.5101088", "0.5044708", "0.5024243", "0.49892232", "0.49809647", "0.496684...
0.72448385
0
Tests that the function's output's 'treat` column is an int column
def test_stochatreat_output_treat_col_dtype(treatments_dict): treatments_df = treatments_dict["treatments"] assert treatments_df["treat"].dtype == np.int64, "Treatment column is missing"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_for_int(check):", "def test_stochatreat_output_block_id_col_dtype(treatments_dict):\n treatments_df = treatments_dict[\"treatments\"]\n assert treatments_df[\"block_id\"].dtype == np.int64, \"Block_id column is missing\"", "def isInteger(data):\n\tif type(data) == list or type(data) == np.ndarr...
[ "0.62884605", "0.61652946", "0.5981654", "0.5873672", "0.58486104", "0.5784886", "0.57747155", "0.57747155", "0.5676851", "0.56675065", "0.56470716", "0.560511", "0.5585921", "0.5578597", "0.55733085", "0.55595696", "0.5519698", "0.5482523", "0.54730487", "0.5461789", "0.5452...
0.6371488
0
Tests that the function's output's 'block_id` column is an int column'
def test_stochatreat_output_block_id_col_dtype(treatments_dict): treatments_df = treatments_dict["treatments"] assert treatments_df["block_id"].dtype == np.int64, "Block_id column is missing"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_stochatreat_output_block_id_col(treatments_dict):\n treatments_df = treatments_dict[\"treatments\"]\n assert \"block_id\" in treatments_df.columns, \"Block_id column is missing\"", "def test_integer(self):\n conn = self.database.connection()\n cursor = conn.cursor()\n dialect ...
[ "0.6305189", "0.58331", "0.56511563", "0.5640875", "0.56148684", "0.5594762", "0.5584043", "0.5340408", "0.5313382", "0.52785057", "0.52666", "0.52666", "0.5187403", "0.5174771", "0.5154937", "0.51512384", "0.5149478", "0.51380587", "0.5119576", "0.5117102", "0.51127774", "...
0.6657692
0
Tests that the function's output's 'idx_col` column is the same type as the input'
def test_stochatreat_output_idx_col(treatments_dict): treatments_df = treatments_dict["treatments"] data = treatments_dict["data"] idx_col = treatments_dict["idx_col"] assert treatments_df[idx_col].dtype == data[idx_col].dtype, "Index column is missing"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_index(idx):\n return isinstance(idx, _Int)", "def checktypestest(chosen_df):\n for i in chosen_df:\n if not chosen_df.dtypes[1] == chosen_df.dtypes[i]:\n raise ValueError('Types do not match')", "def check_type(df: pd.DataFrame, input_output=\"\") -> Tuple[bool, str]:\n\n ...
[ "0.63443065", "0.6277405", "0.6024927", "0.57518595", "0.5739452", "0.5738158", "0.57153356", "0.5696737", "0.5652756", "0.564468", "0.56417584", "0.5635019", "0.5618939", "0.55934775", "0.55778885", "0.55644155", "0.5543343", "0.55209386", "0.5520076", "0.5490408", "0.548197...
0.66742367
0
Test that overall treatment assignment proportions across all strata are as intended when strata are such that there are only misfits
def test_stochatreat_only_misfits(probs): N = 1_000 df = pd.DataFrame( data={ "id": np.arange(N), "block": np.arange(N), } ) treats = stochatreat( data=df, block_cols=["block"], treats=len(probs), idx_col="id", probs=probs, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_verify_npred(self):\n pwl=models.PowerLaw(index=2 * u.Unit(''),\n amplitude=2e-11 * u.Unit('cm-2 s-1 TeV-1'),\n reference=1 * u.TeV)\n\n npred_stacked=self.obs_stacker.stacked_obs.predicted_counts(model=pwl)\n\n npred1=self.obs...
[ "0.6338823", "0.6316183", "0.6285363", "0.623608", "0.60405993", "0.59844124", "0.5984102", "0.5974103", "0.59526855", "0.5952313", "0.59191287", "0.59139067", "0.58853614", "0.5850126", "0.58442956", "0.5843042", "0.58396876", "0.5829377", "0.5817995", "0.57446975", "0.57322...
0.64162827
0
Tests that the function returns the right number of block ids
def test_stochatreat_block_ids(df, block_cols): treats = stochatreat( data=df, block_cols=block_cols, treats=2, idx_col="id", random_state=42, ) n_unique_blocks = len(df[block_cols].drop_duplicates()) n_unique_block_ids = len(treats["block_id"].drop_duplicates()...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def block_size(self, block_id): # -> int:\n ...", "def num_blocks(self): # -> int:\n ...", "def test_32(self):\n assert 'False' == Api.requestBlock('test-32')", "def verify_response_block_list(self, response):\n self.assertSetEqual(\n {block['id'] for block in response....
[ "0.67207634", "0.6684323", "0.64375937", "0.63037455", "0.62656736", "0.6261409", "0.62574625", "0.62260437", "0.61887777", "0.6188286", "0.6175498", "0.61627716", "0.61506116", "0.6137505", "0.6120863", "0.6113503", "0.6110147", "0.6089028", "0.6075936", "0.60719967", "0.606...
0.68350863
0
decorated method should be called if `enabled` is True
def test_require_enabled_call_method(self): method = MagicMock(return_value=True) decorated = require_enabled(method) self = MagicMock() self.enabled = True self.assertTrue(decorated(self)) self.assertTrue(method.called)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def execute_if_enabled(f):\n @functools.wraps(f)\n def wrapper(self, *args, **kwargs):\n if not self._enabled:\n return\n return f(self, *args, **kwargs)\n return wrapper", "def test_require_enabled_do_not_call_method(self):\n method = MagicMock(return_value=True)\n ...
[ "0.7602067", "0.7539771", "0.70453566", "0.6997479", "0.6976197", "0.69035465", "0.69035465", "0.69035465", "0.69035465", "0.69035465", "0.69035465", "0.69035465", "0.69035465", "0.69035465", "0.69035465", "0.69035465", "0.68447906", "0.6843954", "0.6833303", "0.6820647", "0....
0.76498914
0
decorated method should not be called if `enabled` is False
def test_require_enabled_do_not_call_method(self): method = MagicMock(return_value=True) decorated = require_enabled(method) self = MagicMock() self.enabled = False self.assertIsNone(decorated(self)) self.assertFalse(method.called)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def execute_if_enabled(f):\n @functools.wraps(f)\n def wrapper(self, *args, **kwargs):\n if not self._enabled:\n return\n return f(self, *args, **kwargs)\n return wrapper", "def test_require_enabled_call_method(self):\n method = MagicMock(return_value=True)\n decor...
[ "0.7452917", "0.7301492", "0.71809334", "0.70601517", "0.7001034", "0.69053173", "0.6900929", "0.6846621", "0.6835571", "0.6824322", "0.6816589", "0.681614", "0.6773827", "0.6745055", "0.6733445", "0.66820735", "0.6664993", "0.6664993", "0.6664993", "0.6664993", "0.6664993", ...
0.7878429
0
Build package for each os and upload to conda
def build_and_upload(python_version, package, vers): vspl = python_version.split('.') python_string = vspl[0] + vspl[1] current_os = get_current_os() cmd = ('conda build --old-build-string conda.recipe ' '--output-folder artifacts ' '--no-anaconda-upload --python {python_version}')...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_packages(self, board, args=None, **kwargs):\n self.cros_sdk('build packages',\n ['./build_packages', '--board', board],\n args, **kwargs)", "def _install_packages(prefix, net_install):\n prefix = os.path.join(os.path.realpath(prefix), \"miniconda\")\n director...
[ "0.6318299", "0.6317756", "0.59275526", "0.5907683", "0.5734742", "0.57193273", "0.569308", "0.5690895", "0.5686024", "0.5650661", "0.5633407", "0.56055033", "0.55946106", "0.55746275", "0.5563095", "0.55601996", "0.5557544", "0.55510956", "0.5522185", "0.5521586", "0.5512417...
0.71306527
0
Replace version in `meta.yaml` file so that it doesn't need to be updated for each release
def replace_version(version): filename = 'conda.recipe/meta.yaml' pattern = r'version: .*' replacement = 'version: {version}'.format(version=version) lines = [] with open(filename) as meta_file: for line in meta_file.readlines(): lines.append(re.sub(pattern, replacement, line)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def postreleaser_before(data):\n\n data['dev_version_template'] = '%(new_version)s.dev'", "def meta():\n\n meta_version = lain_yaml(ignore_prepare=True).repo_meta_version()\n if meta_version is None:\n error(\"please git commit.\")\n else:\n info(\"meta version : %s\" % lain_yaml(ignore...
[ "0.65754616", "0.6359055", "0.6318528", "0.6077274", "0.59643763", "0.5941292", "0.5903209", "0.5793276", "0.57552695", "0.567457", "0.5664233", "0.5633684", "0.5624107", "0.56136817", "0.55892885", "0.55556065", "0.5486444", "0.5459303", "0.5410023", "0.54058117", "0.5404562...
0.7850825
0
initializes stored procedure information
def construct_sp(self, info): if "query" in info.keys(): if info["query"].upper().startswith("CALL"): self.q_str = info["query"] self.sql_type_ind = (info["q_type_ind"] if "q_type_ind" in info.keys() else sql_type.STORED_PROCEDURE_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_procedure(self):\n pass", "def _initialize_params(self, parnames, sep=\".\"):\n for name in parnames:\n self.get_pvobj(name, sep)", "def init_params(self):\n blah", "def getInitParams(self):\n paramDict = super().getInitParams()\n paramDict['p'] = self.p\n return pa...
[ "0.59764755", "0.5941804", "0.5855939", "0.5826749", "0.5762233", "0.57265705", "0.5702618", "0.5663288", "0.5613711", "0.55711365", "0.54523915", "0.54452837", "0.5422125", "0.54177475", "0.5393153", "0.5381607", "0.5374694", "0.53600717", "0.5359511", "0.5349254", "0.533688...
0.7119033
0
append element to current q_str using user spec'd split
def append_query_element(self, val, append=", "): self.q_str = append.join([self.q_str, val])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __string_splitter(self, arr, string, split_length):\n if len(string) < split_length:\n arr.append(string)\n return arr\n else:\n arr.append(string[:split_length])\n return self.__string_splitter(arr, string[split_length:], split_length)", "def _append...
[ "0.58708", "0.5856596", "0.56759834", "0.567167", "0.5618148", "0.55586773", "0.5510418", "0.5345595", "0.53274137", "0.53195274", "0.5307241", "0.5256639", "0.52213466", "0.5203427", "0.51833206", "0.51606977", "0.51576596", "0.51291513", "0.5114249", "0.5105828", "0.5100663...
0.6831114
0
cleans final element if ends with search (default='), \n')
def clean_query_element(self, search="), \n", replace=");"): if len(search) > 1 and self.q_str.endswith(search): ln1 = len(search) self.q_str = self.q_str[:-ln1] + replace
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clear_useless_end(input_string):\n input_string = input_string.strip()\n while input_string.endswith(\",\"):\n input_string = input_string[:-1]\n return input_string", "def replacenull(results, delimiter=','):\n if results.startswith('null{}'.format(delimiter)):\n # rare spe...
[ "0.5813233", "0.54565173", "0.543722", "0.53934234", "0.52825737", "0.5125342", "0.51030433", "0.5076854", "0.5074915", "0.50553626", "0.50496936", "0.49421328", "0.49227762", "0.49196738", "0.49188486", "0.49136487", "0.49119765", "0.49017024", "0.48889005", "0.48850787", "0...
0.7318379
0
Calculates SQL table from query string
def calc_table_name(q_str, qtype): table = None q_split = q_str.split() # Quick split => all white space throws away empties if qtype is sql_type.SELECT: fnd = False for itm in q_split: if itm.upper() == "FROM": fnd = True elif fnd and itm != "": ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_sql (self):\n sql = self.sql.lower()\n \n split = sql.split('from')\n select = split[0]\n rows = [r.strip().replace(')','').replace('(','') for r in \\\n select.split('select')[1].split(',')]\n \n #~ print rows\n i...
[ "0.6644652", "0.6284445", "0.6271653", "0.5987774", "0.5916836", "0.57384", "0.5712466", "0.57084453", "0.5680048", "0.5653991", "0.55914414", "0.5586974", "0.55139524", "0.55076146", "0.55049515", "0.5489369", "0.54805356", "0.54791594", "0.54344064", "0.5419397", "0.5385396...
0.67341876
0
This crossover is specific to floatingpoint representation. Simulate behavior of onepoint crossover for binary representations. For large values of eta there is a higher probability that offspring will be created near the parents. For small values of eta, offspring will be more distant from parents Equation 9.9, 9.10, ...
def crossover_simulated_binary( self, parent1, parent2, eta: float ): # Calculate Gamma (Eq. 9.11) rand = self.rng.random(parent1.shape) gamma = np.empty(parent1.shape) gamma[rand <= 0.5] = (2 * rand[rand <= 0.5]) ** (1.0 / (eta + 1)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _cross_over(self,mp,cross_rate,eta):", "def crossover_binary(parent1: numpy.ndarray, parent2: numpy.ndarray, eta: float):\n # Ref: https://github.com/Chrispresso/SnakeAI/blob/master/genetic_algorithm/crossover.py\n rand = numpy.random.random(size=parent1.shape)\n gamma = numpy.empty(shap...
[ "0.6985725", "0.61651236", "0.5874237", "0.5868029", "0.57647985", "0.56259626", "0.5567281", "0.5552144", "0.5523105", "0.55015624", "0.54954654", "0.54753745", "0.54397565", "0.542193", "0.5393943", "0.53927535", "0.5379231", "0.5375332", "0.5363005", "0.5359859", "0.534677...
0.65872675
1
A Function that splits the conversations in sentences.
def split_on_sentences(conversations): sentence_list = [] for conversation in conversations: for sentences in conversation: token_sen = tokenize.sent_tokenize(sentences) for sentence in token_sen: if sentence != 'Patient:' and sentence != 'Doctor:': ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def splitInSentence(self,text):\n return self._support.splitInPhrase(text)", "def sentence_split(self, text):\n return split_into_sentences(text)", "def split_sentence(self,sentence):\n sents = self.sentence_splitter.tokenize(sentence) \n return sents", "def split_message(tex...
[ "0.7144037", "0.7122307", "0.7118999", "0.710118", "0.7094287", "0.70698065", "0.7032088", "0.69682485", "0.6958637", "0.69409364", "0.69220287", "0.68684775", "0.68532753", "0.6790916", "0.67372423", "0.6707775", "0.6707775", "0.6688965", "0.6659416", "0.6659416", "0.6632106...
0.7738415
0
A function that preprocesses the data (so that it is displayed per sentence), and saves is as a .csv file for later use.
def preprocess_to_csv(data_path, save_to): # Split on dialogue conversations = split_on_dialogue(data_path) # Split on sentence sentences = split_on_sentences(conversations) # Make dataframe and drop dubplicates df_sent = pd.DataFrame(np.array(sentences), columns=['sentences']) df_sent.dr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_in_sentence_form(self, dataset):\n big_dict = []\n\n # iterating through directories\n for file_path in self.list_news_path:\n with open(file_path, 'r') as f:\n # loading news content into labelled sections\n doc = json.load(f)\n ...
[ "0.6811158", "0.6722584", "0.6567336", "0.6514871", "0.64818025", "0.6445955", "0.6345094", "0.6313514", "0.6310771", "0.6289682", "0.6245924", "0.6188296", "0.61736614", "0.61571324", "0.6153687", "0.61359787", "0.6103529", "0.6078087", "0.607136", "0.60638565", "0.6058391",...
0.75479275
0
This function takes in the prediction of a sentence of the pretrained model and returns the symptoms mentioned in that sentence.
def get_predicted_symptoms(prediction): symptoms = [] # Check if there is a predicted entity if len(prediction[0]['entity']) > 0: number_of_entities = len(prediction[0]['entity']) # Loop over predicted entities and get symptoms (here called: disease) for i in range(num...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pred_sentence(self):\r\n output_sentence = ' '.join(self.predicted_words)\r\n return output_sentence", "def eval(df, model):\n number_of_symptoms = 0\n TP = 0\n FP = 0\n\n for ind in tqdm(df.index):\n\n sentence = df['sentences'][ind]\n\n # Padding is needed because al...
[ "0.67562824", "0.65588856", "0.6452928", "0.61171997", "0.60636955", "0.6010519", "0.5914361", "0.5855167", "0.57648987", "0.5755743", "0.57511836", "0.5746379", "0.57435685", "0.5740282", "0.5716168", "0.57059085", "0.5692928", "0.5658429", "0.5633843", "0.55957675", "0.5588...
0.77734846
0
Because finding primes (especially the first 100 primes) has been done many times before, we can simply lookup the answer and hardcode it into a template. While this doesn't really count as 'computation,' it still can be useful by serving as an acceptance test for the other techniques.
def precomputed(request): return {'name': 'Precomputed Primes'}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solution(resources, args):\n largest_prime_factor = 1\n number = args.number\n prime_generator = primes.get_prime_generator()\n\n while number > 1:\n prime = next(prime_generator)\n if number % prime == 0:\n number /= prime\n largest_prime_factor = prime\n\n i...
[ "0.6713264", "0.65504026", "0.6448229", "0.64136565", "0.63352877", "0.63352877", "0.63124305", "0.6298215", "0.62786496", "0.61895376", "0.6139807", "0.6108025", "0.6101841", "0.60972923", "0.6094449", "0.6084741", "0.6067883", "0.60667527", "0.60423803", "0.60121584", "0.59...
0.70565206
0
Combining the serverside and clientside examples, we can perform the computation in both places. In this particular example, we only calculate a subset of the results on the serveside and then redo the entire computation on the clientside. While not an exceedlingly practical example, performing computations in both pla...
def server_and_clientside(request): return {'name': 'Primes computed on the client and server-side', 'primes': ", ".join([str(prime) for prime in sieve(100)])}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def one_round_computation(examples):\n if secure_sum_bitwidth is not None:\n # Use federated secure modular sum for IBLT sketches, because IBLT\n # sketches are decoded by taking modulo over the field size.\n sketch_sum_fn = secure_modular_sum\n count_sum_fn = secure_sum\n else:\n sk...
[ "0.5717568", "0.55833095", "0.55730796", "0.55366796", "0.5323108", "0.5306153", "0.5130213", "0.5120059", "0.50582993", "0.5034295", "0.5015457", "0.5010904", "0.50048405", "0.49917147", "0.49882138", "0.49708524", "0.49605954", "0.49582422", "0.49241942", "0.49127257", "0.4...
0.5724074
0
Not all web applictions use a relational database as their data layer, but many nosql databases are also capable of performing computations. Using redis' support for lua scripts we can [implement our sieve in
def redis_script(request): r = redis_connection() sieve = r.register_script(sieve_lua) primes = sieve(args=[LAST_PRIME]) return {'name': 'Primes computed with a Redis script', 'primes': ", ".join([str(prime) for prime in primes])}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def database_layer(request):\n\n session = DBSession()\n primes = session.execute(select([func.prime_sieve(LAST_PRIME)])).fetchall()[0][0]\n\n return {'name': 'Primes computed in Postgres',\n 'primes': \", \".join([str(prime) for prime in primes])}", "def redis_compiled(request):\n\n r = r...
[ "0.5941519", "0.54483587", "0.5311856", "0.517093", "0.5147371", "0.51377076", "0.49958253", "0.49889007", "0.49630505", "0.49430978", "0.48612297", "0.485317", "0.48475212", "0.48448664", "0.48408633", "0.48316777", "0.48102888", "0.47792122", "0.47731575", "0.47707817", "0....
0.6405501
0
Handle velocitybased movement requests.
def cmdVelCallback(self, req): x = req.linear.x # m/s th = req.angular.z # rad/s if x == 0: # Turn in place right = th * self.wheel_track * self.gear_reduction / 2.0 left = -right elif th == 0: # Pure forward/backward mot...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _cb_cmd_vel(self,msg):\r\n print \"Walker velocity command received: \",msg\r\n vx=msg.linear.x\r\n vy=msg.linear.y\r\n vt=msg.angular.z\r\n self.start()\r\n self.set_desired_velocity(vx,vy,vt)", "def cmd_vel_callback(self, msg):\n # Just store the desired vel...
[ "0.7259711", "0.6720382", "0.6659159", "0.65937454", "0.6487577", "0.6462729", "0.644443", "0.64142805", "0.634405", "0.6262839", "0.62432337", "0.6237718", "0.6214715", "0.6170314", "0.61636597", "0.61570966", "0.6142357", "0.60791147", "0.60630333", "0.6061513", "0.60610956...
0.6869616
1
load the world from a file
def loadWorld(self, filename): worldFile = open(filename, 'r'); for line in worldFile: info = line.split(' '); if(info[0]=="WIDTH"): self.mWidth = int(info[1]); elif info[0] == "HEIGHT": self.mHeight = int(info[1]); elif in...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load(path):\n pass", "def load(file_name):\n ferme_fenetre()\n Hitori(file_name)", "def load_map(self, filename):\n with open(filename, 'rb') as file:\n self.current_obstacles = pickle.load(file)\n self.current_goal = pickle.load(file)\n try:\n ...
[ "0.68311316", "0.6740746", "0.66702396", "0.66384625", "0.65949744", "0.65949744", "0.6487167", "0.6487167", "0.6480624", "0.646052", "0.6351373", "0.63224137", "0.63044167", "0.627394", "0.62532055", "0.6247879", "0.623936", "0.62302244", "0.62177664", "0.620956", "0.6188659...
0.7381813
0
Save the world in to a file
def saveWorld(self, filename): worldFile = open( filename, 'w' ); worldFile.write( "WIDTH {0}\nHEIGHT {1}\n".format( self.mWidth, self.mHeight ) ); for space in self.mSpaces: if isinstance(space, Circle): worldFile.write( "SPACE circle {0} {1} {2}\n".format( space.X,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_world(self):\n pass", "def save_world(world, filename):\n with open(filename, \"w\") as f:\n for i, row in enumerate(world):\n if i % 2 != 0 and i not in [0, 1]:\n f.write(\" \")\n\n for column in row:\n f.write(str(column))\n ...
[ "0.8183129", "0.7252336", "0.7037761", "0.6917763", "0.6891055", "0.68293405", "0.6819862", "0.67662543", "0.6721494", "0.67030954", "0.66717875", "0.6619894", "0.6612271", "0.6608406", "0.65689576", "0.6563667", "0.65527666", "0.65251917", "0.6498533", "0.64967114", "0.64953...
0.769978
1
Writes an iterable to a CSV file.
def CSVWriter (iterable, outLoc, header="", ): if not iterable: print ("nothing to write") return 0 out = open(outLoc, 'w') if header: out.write(header+'\n') #Only works if iterable is a nested list for member in iterable: for item in member: out.write(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_csv(self, filelike):\r\n items = self.rows()\r\n writer = unicodecsv.writer(filelike, encoding=\"utf-8\")\r\n writer.writerow(self.header())\r\n for item in items:\r\n writer.writerow(item)", "def writeCSV(list, filename):\n with open(filename, \"w\") as file:\...
[ "0.70027983", "0.6912409", "0.67639494", "0.6729994", "0.66990125", "0.66535276", "0.66255945", "0.662186", "0.6618306", "0.6606753", "0.65802383", "0.6577788", "0.65739125", "0.6564288", "0.656423", "0.6561101", "0.65447545", "0.6540821", "0.6539749", "0.65262055", "0.652288...
0.8265631
0
parses .tail file into a nested list usable by other modules
def tailParser(inLoc): f = open(inLoc, 'r') tails = f.readlines() f.close() tailList = [] for i in range(len(tails)): if i==0: continue #skips the header line = tails[i].rstrip().split(',') tailList.append(line) return tailList
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def BuildTailList(all_file_contents):\n tail_list = []\n list_all_file_contents = (all_file_contents)\n tail_start = False\n for line in list_all_file_contents:\n word = line[0:3]\n if word == \"TER\":\n tail_start = True\n if tail_start == True:\n tail_list.a...
[ "0.72035015", "0.6514934", "0.579007", "0.5680975", "0.5618331", "0.5588394", "0.5544913", "0.55165285", "0.54705894", "0.53951365", "0.53817767", "0.53704447", "0.53397006", "0.53328884", "0.5315747", "0.53007895", "0.52965164", "0.5282612", "0.52686566", "0.524207", "0.5234...
0.68354523
1
Reads a file in gettext .po format
def read_po(self, inputfile): is_index = False lines = inputfile.readlines() index = '' value = '' for line in lines: if line.startswith('#'): continue elif line.startswith('msgid'): is_index = True self.translations[index] = value index = '' value...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _read_txt(file_path):\n translation_pairs = []\n with file_path.open() as f:\n for line in f:\n translation_pairs.append(\n evaluation.TranslationPair(source=None, translation=line.strip())\n )\n return translation_pairs", "def msgfmt_check_po_file(filename):\r\n # Use relative pa...
[ "0.65572023", "0.6458775", "0.64038134", "0.62854517", "0.6270582", "0.62263036", "0.61796314", "0.616694", "0.6155343", "0.6076632", "0.60461044", "0.60400975", "0.60199785", "0.598673", "0.5973073", "0.5953786", "0.5939008", "0.5888892", "0.5885888", "0.5885473", "0.5879419...
0.7635462
0
Reads in a translation file in json format.
def read_json(self, inputfile): transtransfile = json.load(inputfile) self.language = transfile['lang'] self.translations = transfile['strings']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_translation_dict_from_file(path, lang, app):\n\tjson_content = {}\n\tif os.path.exists(path):\n\t\twith open(path, 'r') as f:\n\t\t\tjson_content = json.loads(f.read())\n\n\treturn json_content", "def _read_translation_file(language_code: str, filename: str):\n twlight_home = settings.TWLIGHT_HOME\n ...
[ "0.76486564", "0.7577767", "0.7166459", "0.71568304", "0.71235466", "0.71235466", "0.7073017", "0.70480293", "0.70153415", "0.70153415", "0.7010124", "0.6991458", "0.69871974", "0.6984109", "0.6969324", "0.6948705", "0.69473696", "0.6935583", "0.69271183", "0.6904846", "0.688...
0.8315508
0
Writes a new translation file in quoted csv format.
def write_csv(self, outputfile): d = csv.writer(outputfile, quoting=csv.QUOTE_ALL) for row in self.translations.iteritems(): d.writerow(row)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_csv(self, filelike):\r\n items = self.rows()\r\n writer = unicodecsv.writer(filelike, encoding=\"utf-8\")\r\n writer.writerow(self.header())\r\n for item in items:\r\n writer.writerow(item)", "def write_output(self):\n with open(self.filename, 'a', newline=...
[ "0.6866711", "0.6820947", "0.6613735", "0.66032577", "0.66032577", "0.6576775", "0.64796185", "0.64762425", "0.64454246", "0.6426896", "0.63706523", "0.6283822", "0.6281115", "0.62743723", "0.6229221", "0.62278724", "0.62267756", "0.622251", "0.61761016", "0.6173529", "0.6163...
0.7463979
0
Writes a translation file in json format.
def write_json(self, outputfile): outputfile.write(json.dumps(self.translations, sort_keys=True, indent=4))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write(self, _filepath=None):\n _json_txt = json.dumps(self.json_dict, indent=2)\n self._write_json_text(_json_txt, _filepath)", "def write_json_file(self, file, content):\n with open(file, \"w\", encoding=\"utf-8\") as f:\n json.dump(content, f, indent=2)", "def _write_json(...
[ "0.7375926", "0.73411995", "0.72907406", "0.71562773", "0.7133225", "0.70734954", "0.70544845", "0.70544845", "0.7030629", "0.7023544", "0.6961805", "0.6953743", "0.67956346", "0.6769627", "0.6737666", "0.6707589", "0.66768265", "0.6640878", "0.6636975", "0.66189843", "0.6613...
0.80532444
0
Writes a translation file in java properties format.
def write_properties(self, inputfile): raise NotImplementedError( "Writing to this file format is not yet implemented")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_properties(self, prop_filename):\n # Collect list of all keys in self.plats that have True values,\n # but change \"windows\" to \"win64\" because build-sanity is annoying.\n sanity_plats = [\n (x if x != \"windows\" else \"win64\")\n for x in self.plats.keys() ...
[ "0.6460736", "0.62841845", "0.6164885", "0.60153174", "0.5994374", "0.5938699", "0.5874966", "0.58554786", "0.5815331", "0.57727194", "0.57485867", "0.56986195", "0.5662161", "0.5637649", "0.5514797", "0.54490376", "0.5415092", "0.53957224", "0.5384339", "0.5368382", "0.53556...
0.66920125
0
Sets up Reactbased interface if required.
def run(self): super().run() if self.react_interface is not None: self.setup_react_interface( os.path.join( getattr(self, self.__react_path_attr__), 'lingvodoc'))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_react_interface(self, lingvodoc_dir):\n\n self.announce('Installing React-based interface')\n\n interface_dir = os.path.expanduser(self.react_interface)\n\n index_from_path = os.path.join(interface_dir, 'index.html')\n\n index_to_path = os.path.join(lingvodoc_dir,\n ...
[ "0.72385275", "0.6611271", "0.62640107", "0.62640107", "0.62488073", "0.6196481", "0.61828786", "0.61503613", "0.5899332", "0.586623", "0.582399", "0.57989424", "0.57441646", "0.5743917", "0.57193035", "0.5541275", "0.5515964", "0.5472635", "0.5455389", "0.54411745", "0.54372...
0.7011263
1
Sets up Reactbased interface by copying its distribution files to appropriate locations.
def setup_react_interface(self, lingvodoc_dir): self.announce('Installing React-based interface') interface_dir = os.path.expanduser(self.react_interface) index_from_path = os.path.join(interface_dir, 'index.html') index_to_path = os.path.join(lingvodoc_dir, 'views', 'v2'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(self):\n\n super().run()\n\n if self.react_interface is not None:\n\n self.setup_react_interface(\n\n os.path.join(\n getattr(self, self.__react_path_attr__),\n 'lingvodoc'))", "def setup(self, registry):\n logger.info(\...
[ "0.6970949", "0.6705065", "0.59950286", "0.59194136", "0.58531475", "0.5829142", "0.58282024", "0.5789457", "0.5749446", "0.56876594", "0.56726235", "0.5671334", "0.565031", "0.5609633", "0.56066203", "0.5600701", "0.5594198", "0.5583012", "0.55668414", "0.55668414", "0.55668...
0.816652
0
Tries to determine version info from the Git repository and pip installation state, saves it to 'lingvodoc/version.py' if required.
def run(self): version_str = ( get_git_version(here)) version_uniparser_dict = ( get_uniparser_version()) if (version_str is not None or version_uniparser_dict is not None): with open( os.path.join(here, 'lingvodoc', 'version.py...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _version(self):\n # TODO: Can we delete this method and just print the line from the\n # reqs file verbatim instead?\n def version_of_archive(filename, package_name):\n # Since we know the project_name, we can strip that off the left, strip\n # any archive extensions ...
[ "0.6554136", "0.64277714", "0.64107174", "0.64105153", "0.63831925", "0.6373238", "0.62661934", "0.624131", "0.6231936", "0.6206733", "0.61744905", "0.6167809", "0.6142875", "0.6134055", "0.60584974", "0.60271513", "0.60064256", "0.6003224", "0.60003966", "0.59787023", "0.595...
0.68406534
0
API Call for county stats
def get_covid_stats_by_county(state, county): url = "https://corona.lmao.ninja/v2/jhucsse/counties/" + county response = requests.get(url) data = response.json() counties = [] for res in data: if res["province"] == state: county1 = res["county"] updatedAt = res["updat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vi_fetch_voting_info_from_scb(self):\r\n\r\n # map counties and county codes using 'GET' request\r\n response = requests.get(self.url)\r\n if response.status_code == requests.codes.ok:\r\n try:\r\n data = json.loads(response.text)\r\n for code, coun...
[ "0.6145562", "0.60620946", "0.6058099", "0.5975929", "0.59286755", "0.58943254", "0.58749384", "0.58246714", "0.5788244", "0.5776418", "0.5735362", "0.57001615", "0.56669474", "0.563091", "0.5621748", "0.5599172", "0.5588251", "0.5550886", "0.555043", "0.5528751", "0.5510522"...
0.7534534
0
Test invoking the import parameter command in all variants.
def test_cmd_param_import(run_cli_command): from shutil import copyfile from aiida_fleur.cmdline.data.parameters import cmd_param_import options = [SI_INPXML_FILE, '--fleurinp'] run_cli_command(cmd_param_import, options=options) options = [SI_INPXML_FILE, '--fleurinp', '--dry-run'] run_cli_com...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_importtleCommandExists(self):\n self.assertIn('importtle', get_commands())", "def test_get_imports(self):\n pass", "def test_import_string():\n tests = [\n 'virtstrap.commands',\n 'virtstrap.options'\n ]\n for string in tests:\n yield import_a_string, string...
[ "0.6160088", "0.6090805", "0.6086067", "0.6051064", "0.59638643", "0.5948017", "0.5896455", "0.5835063", "0.580878", "0.5771108", "0.5745757", "0.57316685", "0.5719195", "0.57184696", "0.5693952", "0.56784225", "0.56551623", "0.5630251", "0.5627506", "0.55785507", "0.5576672"...
0.6627958
0
Create an exception indicating a PyXBrelated problem. If no args are present, a default argument is taken from the C{message} keyword.
def __init__ (self, *args, **kw): if 0 == len(args) and 'message' in kw: args = (kw.pop('message'),) self._args = args self._kw = kw super(PyXBException, self).__init__(*args)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_exception(self, msg: str):", "def exception(self, msg, *args, **kwargs):\n if args:\n try:\n msg = msg % args\n except TypeError:\n log.exception_orig(_('Wrong format of a log message'))\n\n (exc_type, exc_value, exc_tb) = sys.exc_info(...
[ "0.68352634", "0.6066619", "0.6065441", "0.6022599", "0.5969557", "0.58340555", "0.5802003", "0.5800859", "0.578912", "0.5759686", "0.5755802", "0.57222486", "0.56819206", "0.5680549", "0.5652935", "0.56478715", "0.56346166", "0.5624634", "0.5608549", "0.5593024", "0.55751884...
0.69444495
0
The QName of the L{node} as a L{pyxb.namespace.ExpandedName}
def __get_node_name (self): import pyxb.namespace return pyxb.namespace.ExpandedName(self.node.namespaceURI, self.node.localName)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_name(self):\n return self._qname", "def qname(self):\n return self._qname", "def pyxb_get_namespace_name(obj_pyxb):\n return str(obj_pyxb._ExpandedName)", "def qname(self):\n if self._cls:\n return '{}.{}'.format(self._cls.__name__, self.name)\n else:\n ...
[ "0.70863926", "0.7006185", "0.6901932", "0.68329096", "0.6787703", "0.6749236", "0.6749103", "0.65941036", "0.65729135", "0.64818984", "0.6475633", "0.64207315", "0.640812", "0.6389247", "0.6290715", "0.6273499", "0.6273499", "0.62684476", "0.6264324", "0.6261742", "0.6257794...
0.8167496
0
Step the simulator through step_size using zeroorder hold of estmd_input as the stimulus.
def step(self, step_size, estmd_input=None): if estmd_input and estmd_input is not None: estmd_mapped_input = self.map_estmd_input(estmd_input=estmd_input) if self.verbose_debug: print "Mapped input" print estmd_mapped_input self.simulator.loa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def step(self, d=1):\n raise NotImplementedError()", "def step(self):\n self.state_estimator.step()", "def step(self, state):", "def step(self, action: list) -> None:\n self._input = np.array(\n [self._thrust_surge(action[0]), self._moment_steer(action[1])]\n )\n ...
[ "0.6737271", "0.6551836", "0.64622676", "0.63021123", "0.6259964", "0.6205155", "0.62024444", "0.62018085", "0.61757576", "0.61733276", "0.61100996", "0.6093313", "0.60738367", "0.60738367", "0.60738367", "0.60470164", "0.59941304", "0.5965178", "0.5937705", "0.59028435", "0....
0.8170625
0
Map the estmd input indexed by (x,y) to estmd input indexed by (compartment.idx)
def map_estmd_input(self, estmd_input): return np.array([(self.estmd_mapping[(x, y)], stimulus) for y, x, stimulus in estmd_input])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __getitem__(self, idx):\n src_idx, tgt_idx = self.full_idxs[idx]\n\n X = {'src': self.X['src'][src_idx], 'tgt': self.X['tgt'][tgt_idx]}\n for key, value in X.items():\n X[key] = self.transform(X[key])\n\n y = {'src': self.y['src'][src_idx], 'tgt': self.y['tgt'][tgt_idx]}\...
[ "0.54397434", "0.5336069", "0.5233963", "0.5230029", "0.51724255", "0.5121784", "0.50457424", "0.49999338", "0.4974651", "0.49470836", "0.49393705", "0.49357507", "0.49220154", "0.4909942", "0.4901449", "0.48822236", "0.48798445", "0.486342", "0.48585027", "0.48534808", "0.48...
0.6745299
0
Gets the voltages from CUDA device Indexed like [time,compartment]
def get_voltages(self): if self.v is None or self.dirty is True: v = self.simulator.get_voltages() n_compartments = self.neuron_collection.total_compartments() self.v = np.array(v).reshape([len(v) / n_compartments, n_compartments]) self.dirty = False t = int(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_voltages(self):\n self.check_validity()\n\n return self.ipcon.send_request(self, BrickletIndustrialDualAnalogInV2.FUNCTION_GET_ALL_VOLTAGES, (), '', 16, '2i')", "def get_voltage(self):\n status = self.get_status_response()\n volts = status[20] + (status[21] * 0x100) + (sta...
[ "0.65251243", "0.6435797", "0.6130797", "0.60518754", "0.6035315", "0.6035315", "0.5997567", "0.59718096", "0.5960492", "0.59036136", "0.5835931", "0.5812098", "0.58053833", "0.58048177", "0.57986856", "0.5785891", "0.578279", "0.57616156", "0.57420665", "0.5728613", "0.57097...
0.74122554
0
Gets the recovery variables from CUDA device Each array is indexed [time,compartment]
def get_recovery_variables(self): if self.m is None or self.dirty is True: m, n, h = self.simulator.get_recovery_variables() n_compartments = self.neuron_collection.total_compartments() self.m = np.array(m).reshape([len(m) / n_compartments, n_compartments]) self.n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_variable(x):\n return x.cuda() #if use_cuda else x", "def getDustTemperature(grid=None, ppar=None):\n op = dustopac.radmc3dDustOpac()\n dinfo = op.readDustInfo()\n ngs = len(dinfo['gsize'])\n\n tdust = np.zeros([grid.nx, grid.ny, grid.nz, ngs], dtype=np.float64)\n tgas = getGasTemperatu...
[ "0.53405106", "0.53209364", "0.5263369", "0.5258379", "0.51870215", "0.51741284", "0.5135897", "0.5119875", "0.50913376", "0.50776416", "0.5072281", "0.50565946", "0.50458544", "0.5023531", "0.5016648", "0.50047046", "0.50013745", "0.49942416", "0.49933892", "0.4987643", "0.4...
0.66033685
0
Plot the spikes for each of the electrodes
def plot_spikes(self, show=False, save_path=None, expand = False): spikes = np.array(self.spike_history) spike_time, e_idx = np.where(spikes) spike_time = spike_time.astype('float32') spike_time *= self.global_dt spike_time_pair = zip(e_idx,spike_time) spike_time_pair.sor...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw_spike_times(spike_times):\n for line in spike_times:\n plt.axvline(x=line, color='y')", "def plot_energies(self):\n plt.plot(self.energies[0], self.energies[1])\n plt.xlabel('Time (s)')\n plt.ylabel('Energy (J)')\n plt.show()", "def plot_spikes(self, ax, t, moving...
[ "0.67910856", "0.673331", "0.6470488", "0.62647516", "0.6171178", "0.6167019", "0.61591095", "0.61398757", "0.6139742", "0.61322385", "0.6044586", "0.60297555", "0.6014362", "0.59762037", "0.5975005", "0.5959155", "0.59235686", "0.5915178", "0.5903807", "0.5885255", "0.587836...
0.70663625
0
Returns relative index for the middle frame in sequence.
def get_seq_middle(seq_length): half_offset = int((seq_length - 1) / 2) return seq_length - 1 - half_offset
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_middle():\n num_list = session_attributes[NUMBER_LIST_KEY]\n return num_list[round(len(num_list) / 2) - 1] # Subtract 1 since arrays start at 0", "def middle(self):\n return (self.lo+self.hi)/2", "def middle(self):\n return self.start.point_at_distance(self.length / 2, self.heading...
[ "0.6656334", "0.6505312", "0.6441052", "0.6379832", "0.628277", "0.62609154", "0.62451637", "0.61917377", "0.61507046", "0.6145611", "0.6121926", "0.61117613", "0.609954", "0.6065264", "0.60510075", "0.6040026", "0.6030208", "0.6016878", "0.601593", "0.60141695", "0.5991375",...
0.7059778
0
Returns true if obj is a numpy array.
def is_a_numpy_array(obj): return type(obj).__module__ == np.__name__
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_array(self, arr):\n return isinstance(arr, np.ndarray)", "def is_numpy(obj):\n return 'numpy' in str(type(obj))", "def is_arraylike(obj):\n if isinstance(obj, list):\n return True\n elif isinstance(obj, np.ndarray):\n return True\n elif isinstance(obj, pd.Series):\n ...
[ "0.84035677", "0.8076048", "0.77647555", "0.7741642", "0.7736499", "0.76953906", "0.73582894", "0.7268553", "0.7229395", "0.7178989", "0.70816004", "0.6987525", "0.694164", "0.6726651", "0.6638855", "0.6638471", "0.6598614", "0.65872633", "0.63607806", "0.63399965", "0.630668...
0.8832039
0
Returns dict of variables to restore from ImageNetcheckpoint.
def get_imagenet_vars_to_restore(imagenet_ckpt): vars_to_restore_imagenet = {} ckpt_var_names = tf.contrib.framework.list_variables(imagenet_ckpt) ckpt_var_names = [name for (name, unused_shape) in ckpt_var_names] model_vars = tf.global_variables() for v in model_vars: if 'global_step' in v...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _restore_variables(self, checkpoint):\n checkpoint_variables_map = list_variables(checkpoint)\n valid_variable = lambda name: name.startswith('model/encoder') or \\\n name.startswith('model/decoder')\n checkpoint_variable_names = [name for (name, _) in checkpoint_varia...
[ "0.7614622", "0.7273547", "0.6983407", "0.6972694", "0.68865913", "0.6871682", "0.6640854", "0.65973276", "0.6573616", "0.6573024", "0.65509695", "0.65509695", "0.63917804", "0.6330875", "0.6311535", "0.63001615", "0.6243032", "0.6212812", "0.61679924", "0.61562645", "0.60906...
0.76854444
0
Returns multiple intrinsic matrices for different scales.
def get_multi_scale_intrinsics(intrinsics, num_scales): intrinsics_multi_scale = [] # Scale the intrinsics accordingly for each scale for s in range(num_scales): fx = intrinsics[0, 0] / (2 ** s) fy = intrinsics[1, 1] / (2 ** s) cx = intrinsics[0, 2] / (2 ** s) cy = intrinsics...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scales(self):\n scales = queryMultiAdapter((self, self.request), name=\"images\")\n return scales", "def getScalingMatrix(sx, sy, sz):\n return MatrixExtended([\n [sx, 0, 0, 0],\n [0, sy, 0, 0],\n [0, 0, sz, 0],\n [0, 0, 0, 1]])", "def get_4x4_transform(scale_x, scale_y...
[ "0.61792517", "0.5561209", "0.5490336", "0.5355793", "0.5335191", "0.53225857", "0.5265982", "0.52498347", "0.52465516", "0.5230682", "0.52250534", "0.5224526", "0.5193534", "0.5192898", "0.51894665", "0.51818806", "0.5172432", "0.51714754", "0.5171257", "0.5143741", "0.51318...
0.7096406
0
Pack depth predictions as a single .npy file
def pack_pred_depths(pred_dir, test_file): test_images = read_text_lines(test_file) save_name = 'pred_depth.npy' output_file = os.path.join(pred_dir, save_name) img_height = 128 img_width = 416 all_pred = np.zeros((len(test_images), img_height, img_width)) for i, img_path in enumerate(te...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dump_npy(filename: str, obj, **kwargs):\n return np.save(filename, obj)", "def depth_write(filename, depth):\n height,width = depth.shape[:2]\n f = open(filename,'wb')\n # write the header\n f.write(TAG_CHAR)\n np.array(width).astype(np.int32).tofile(f)\n np.array(height).astype(np.int32...
[ "0.6361462", "0.62038064", "0.61327326", "0.59908193", "0.59681195", "0.5928494", "0.5869742", "0.5850239", "0.58320314", "0.5794976", "0.5778315", "0.57531786", "0.5747946", "0.5745459", "0.5710773", "0.5676477", "0.5663302", "0.56146365", "0.5601037", "0.55919975", "0.55916...
0.73327786
0
This function implements an iterator for searching a gtk.TextBuffer for a certain string. It supports forward and backwards search. It also supports finding from the start or from where the cursor is located.
def search_iterator (text_buffer, search_text, find_forward = True, start_in_cursor = True): if start_in_cursor: bounds = text_buffer.get_selection_bounds () if len (bounds) == 0: text_iter = text_buffer.get_iter_at_mark(text_buffer.get_insert()) else: text_iter = fi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_iter(text, pattern):\n pos = -1\n while True:\n pos = text.find(pattern, pos+1)\n if pos < 0:\n break\n yield pos", "def find(self, next = None):\n\n if not self.textedit:\n return\n\n if not next:\n next = self.ui.downRadioButton...
[ "0.68831205", "0.6396447", "0.6156474", "0.61275357", "0.59533", "0.5832244", "0.5800915", "0.5786592", "0.57398283", "0.5655108", "0.5623964", "0.56227964", "0.5619197", "0.55937743", "0.5572257", "0.5536774", "0.5522381", "0.5506774", "0.5489155", "0.54746735", "0.54592586"...
0.8347966
0
Mutative removal of squares that correspond to only one blank (since we only want to save overlaps)
def clean_overlapping(overlapping): remove = [] for square in overlapping: if len(overlapping[square]) == 1: remove.append(square) for square in remove: overlapping.pop(square) return overlapping
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def uncover_blanks(self, row, col):\n checked = {}\n to_be_checked = []\n to_be_checked.append((row, col))\n while len(to_be_checked) > 0:\n sq_row, sq_col = to_be_checked.pop()\n if checked.has_key((sq_row, sq_col)):\n continue\n checked[...
[ "0.66854084", "0.6584023", "0.6488602", "0.64772785", "0.6418033", "0.636128", "0.6303347", "0.6208574", "0.6192537", "0.61606514", "0.6140698", "0.61212313", "0.6085127", "0.60799956", "0.60640484", "0.604107", "0.6025684", "0.60182196", "0.60146296", "0.6007324", "0.5960313...
0.72625536
0
Returns a dictionary mapping blank number (index) to the number of conflicts the blank's word assignment cause
def check_conflicts(overlapping, vocab_used): conflicts = {} for square in overlapping: overlapped_blanks = overlapping.get(square) # if word at blank is used multiple times add a conflict for the corresponding blank for blank in overlapped_blanks: if blank.index not in confl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prep_dict(word):\n counts = {}\n for l in word.lower():\n if l!=\" \":\n counts[l] = counts.get(l,0) + 1\n return counts", "def word_nbr_map(wl):\n wf = dict()\n for word in wl:\n try:\n wf[word] = wf[word] + 1\n except KeyError:\n wf[word] = 1\...
[ "0.6358027", "0.61197126", "0.595454", "0.59383905", "0.5907387", "0.5898889", "0.5867517", "0.5801122", "0.5680066", "0.56650823", "0.56315726", "0.5617674", "0.5593565", "0.5570576", "0.5550426", "0.5510003", "0.55062515", "0.5496497", "0.5488431", "0.5484789", "0.5460335",...
0.6521071
0
Returns a tuple (sum of all conflicts, list of blanks with conflicts)
def sum_conflicts(conflicts, blanks_list): sum_con = 0 conflict_blanks = [] for b in conflicts: if conflicts[b]: conflict_blanks.append(blanks_list[b]) sum_con += conflicts[b] return sum_con, conflict_blanks
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_conflicts(overlapping, vocab_used):\n conflicts = {}\n for square in overlapping:\n overlapped_blanks = overlapping.get(square)\n # if word at blank is used multiple times add a conflict for the corresponding blank\n for blank in overlapped_blanks:\n if blank.index n...
[ "0.594645", "0.58295256", "0.5766445", "0.5743692", "0.53668827", "0.5336144", "0.5259918", "0.5241343", "0.5204334", "0.5204023", "0.5172444", "0.51344305", "0.5097294", "0.50951535", "0.50504434", "0.501982", "0.50102496", "0.5008078", "0.5003974", "0.49854106", "0.49773923...
0.8209077
0
Check if given value is in the given source
def check_list(source, value): try: return value in json.loads(source) except: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _inlist(self, source, target):\n source = \"\" if not source else source\n target = \"\" if not target else target\n source_list = source.split(\",\")\n target_list = target.split(\",\")\n return 1 if len([value for value in source_list if value in target_list]) > 0 else 0", ...
[ "0.69192827", "0.66882104", "0.6585464", "0.6497034", "0.64430004", "0.6389054", "0.6295213", "0.62825", "0.6278663", "0.62709373", "0.62153465", "0.61816937", "0.61816937", "0.61439365", "0.6069753", "0.6047323", "0.6022397", "0.60170734", "0.5999772", "0.598709", "0.5981293...
0.6815633
1
Print all the table names in this database.
def print_all_tables(self): conn = self.connect() cursor = conn.cursor() cursor.execute("SELECT name FROM sqlite_master WHERE type='table';") print(cursor.fetchall())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_database(self):\n table_names = self.catalog\n for table_name in table_names:\n table = self.parse_table(table_name)\n if not table:\n continue\n print(f'TABLE NAME: {table_name}\\r\\n')\n print(tabulate(table, headers=\"keys\"))\n ...
[ "0.8450392", "0.80969024", "0.7476597", "0.7433552", "0.7337269", "0.7311555", "0.731121", "0.71999973", "0.7183225", "0.7182482", "0.71104795", "0.7020322", "0.70195293", "0.7017233", "0.7010818", "0.6966232", "0.6966074", "0.69387066", "0.68900836", "0.68543434", "0.6818372...
0.84662116
0
Printable representation of Restaurant model.
def __repr__(self): return f'<Restaurant id: {self.id}>'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __repr__(self):\n return f'<RestaurantProduct restaurant: {self.restaurant_id} product: {self.product_id}>'", "def __repr__(self):\n return f'<RestaurantCourier restaurant: {self.restaurant_id} courier: {self.courier_id}>'", "def describe_restaurant(self):\n print(f\"\\nRestaurant name...
[ "0.7871948", "0.7640466", "0.7446896", "0.7329415", "0.7222994", "0.71585876", "0.6995779", "0.6994102", "0.69586176", "0.676439", "0.6754176", "0.67332673", "0.6732389", "0.6634509", "0.6633606", "0.65931666", "0.65119326", "0.6478095", "0.64678675", "0.6462712", "0.64278156...
0.8093058
0
Return a printable representation of the Courier model.
def __repr__(self): return f'<Courier id: {self.id}>'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n return self.printable()", "def __str__(self):\n raise NotImplementedError('Subclasses must define how to layout Character printing')", "def __str__(self):\n astr = '{\\n'\n for (name, _) in self.contracts.iteritems():\n astr += ' ' + name + ',\\n'\n ...
[ "0.69444114", "0.6600302", "0.6576843", "0.65622246", "0.65294516", "0.6454514", "0.6442508", "0.64392525", "0.6436804", "0.6405665", "0.6395191", "0.63725376", "0.6365719", "0.6334325", "0.63229877", "0.63111085", "0.6304928", "0.62987095", "0.6296187", "0.6281976", "0.62819...
0.69949245
0
Printable representation of RestaurantCourier model.
def __repr__(self): return f'<RestaurantCourier restaurant: {self.restaurant_id} courier: {self.courier_id}>'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __repr__(self):\n return f'<Restaurant id: {self.id}>'", "def __repr__(self):\n return f'<RestaurantProduct restaurant: {self.restaurant_id} product: {self.product_id}>'", "def __repr__(self):\n return f'<Courier id: {self.id}>'", "def __repr__(self):\n\n return \"<Truck truck...
[ "0.71120787", "0.70763516", "0.6993424", "0.66813153", "0.6545185", "0.65208304", "0.648358", "0.64835733", "0.6406419", "0.6375339", "0.63424045", "0.63126546", "0.63126546", "0.63126546", "0.63126546", "0.63126546", "0.6304636", "0.6280823", "0.627803", "0.62755007", "0.624...
0.8167621
0
Printable representation of RestaurantProduct model.
def __repr__(self): return f'<RestaurantProduct restaurant: {self.restaurant_id} product: {self.product_id}>'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __repr__(self):\n\n return \"<Product: {}>\".format(self.name)", "def __repr__(self):\n return f'<Restaurant id: {self.id}>'", "def __repr__(self):\n return f'<RestaurantCourier restaurant: {self.restaurant_id} courier: {self.courier_id}>'", "def __str__(self):\n return f\"Ord...
[ "0.7284317", "0.7115957", "0.6930726", "0.65813386", "0.65726453", "0.65726453", "0.6404084", "0.63658136", "0.63448894", "0.63268375", "0.6320364", "0.62845737", "0.62160903", "0.619781", "0.61736524", "0.61555886", "0.6143565", "0.6117131", "0.60542434", "0.60510373", "0.60...
0.84345436
0