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
Verify instance of imageverification is correct
def verifyImageVerification( imageVerification ): if "hash-algorithm" in imageVerification: assert imageVerification[ "hash-algorithm" ] == \ "ietf-sztp-conveyed-info:sha-256",\ "Unsupported hash-algorithm" assert "hash-value" in imageVerification, \ ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verify_binary_image(self, image_path):\n raise NotImplementedError", "def verify_image(self, image_location):\n checksum = self._hash_algo.hexdigest()\n LOG.debug('Verifying image at %(image_location)s against '\n '%(algo_name)s checksum %(checksum)s',\n ...
[ "0.69870156", "0.69740856", "0.69246584", "0.6673187", "0.6650353", "0.66449857", "0.66413474", "0.6540088", "0.6524494", "0.6524494", "0.6514677", "0.64813495", "0.6438443", "0.6420936", "0.6389883", "0.6361156", "0.63330185", "0.63297325", "0.631254", "0.6260492", "0.617737...
0.7009416
0
Verify imageverification list is correct
def verifyImageVerificationList( template, sztpImageVerification ): assert isinstance( sztpImageVerification, list ), \ "Expected list" for imageVer in sztpImageVerification: assert verifyDictTypes( template, imageVer ), "Unexpected value types" assert set( imageVer...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verifyImageVerification( imageVerification ):\n if \"hash-algorithm\" in imageVerification:\n assert imageVerification[ \"hash-algorithm\" ] == \\\n \"ietf-sztp-conveyed-info:sha-256\",\\\n \"Unsupported hash-algorithm\"\n assert \"hash-value\" in imageVer...
[ "0.6735049", "0.672671", "0.67036074", "0.6464152", "0.6445585", "0.6409907", "0.6409425", "0.632909", "0.62680525", "0.6239925", "0.6215872", "0.620192", "0.6181599", "0.6175062", "0.6162376", "0.60837007", "0.60530126", "0.60342985", "0.60265696", "0.60118407", "0.6010814",...
0.7673073
0
Convert ownershipvoucher dictionary to json and write to file. ownershipVoucher is a dictionary of the template below with values as per RFC8366.
def genOwnershipVoucherJsonFile( ownershipVoucher, voucherFileJson ): template = { "created-on": str, "expires-on": str, "assertion": str, "serial-number": str, "pinned-domain-cert": str, "domain-cert-revocation-checks": bool, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _write(self):\n raw_data = {'file_version': 1}\n raw_creds = []\n raw_data['data'] = raw_creds\n for (cred_key, cred) in self._data.items():\n raw_key = dict(cred_key)\n raw_cred = json.loads(cred.to_json())\n raw_creds.append({'key': raw_key, 'crede...
[ "0.57161313", "0.55950993", "0.55210066", "0.5401349", "0.5320288", "0.52819663", "0.5272004", "0.5208323", "0.517391", "0.51711", "0.5164001", "0.5157927", "0.5157889", "0.5153851", "0.5132664", "0.5128681", "0.51168865", "0.51157135", "0.5086597", "0.50822693", "0.50820655"...
0.79461914
0
Verify a dateTime string conforms to RFC3339 format (only Z TZ accepted)
def validDateTime( dateTime ): try: datetime.strptime( dateTime, "%Y-%m-%dT%H:%M:%S.%fZ" ) return True except ValueError: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_valid(string: str, format_: str) -> bool:\n try:\n datetime.strptime(string, format_)\n return True\n except ValueError:\n return False", "def is_time_in_given_format(time_string, time_format):\n try:\n datetime.strptime(time_string, time_format)\n ...
[ "0.697065", "0.6781034", "0.6582872", "0.654285", "0.65413713", "0.65014714", "0.64805967", "0.6473195", "0.6417286", "0.6412882", "0.6391962", "0.6389369", "0.6366332", "0.63501763", "0.6320752", "0.6294031", "0.62899727", "0.6254448", "0.62397885", "0.6235958", "0.6208644",...
0.77382153
0
generate signed bootstrap restconf file that will contain cmssigned(conveyedinformation(json), ownercert) cms(ownercertificate) cmssigned(ownershipvoucher, manufacturercert).
def genSztpSignedBootstrapResponseFile( conveyedInfoFileJson, ownerCert, ownerKey, ownershipVoucher, manufacturerCert, manufacturerKey, reportingLevel ): # CMS sign and wrap the conveyed-info usin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def genSztpBootstrapResponseFile( conveyedInfoFileJson, reportingLevel ):\n\n # CMS wrap this data (unsigned)\n conveyedInfoCms = opensslCmsDataCreate( conveyedInfoFileJson )\n\n # XML encode the artifacts (conveyedInfo only)\n return genBootstrappingDataResponseFile( conveyedInfo=conveyedInfoCms,\n ...
[ "0.5879794", "0.5550124", "0.55329037", "0.55057335", "0.54887927", "0.5484706", "0.5392402", "0.53486747", "0.52842027", "0.52580327", "0.52540106", "0.5248883", "0.52446467", "0.5234645", "0.5156566", "0.5097495", "0.50847185", "0.50532186", "0.5051961", "0.5005859", "0.500...
0.6441284
0
Test case for dev_fetch_api_key Fetch an API key (development only)
async def test_dev_fetch_api_key(client): params = [('username', 'iago@zulip.com')] headers = { 'Accept': 'application/json', } response = await client.request( method='POST', path='/api/v1/dev_fetch_api_key', headers=headers, params=params, ) assert ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_api_key(api_key):\n api.get(api_key)", "async def test_fetch_api_key(client):\n params = [('username', 'iago@zulip.com'),\n ('password', 'abcd1234')]\n headers = { \n 'Accept': 'application/json',\n }\n response = await client.request(\n method='POST',\n ...
[ "0.7381364", "0.71456134", "0.7035455", "0.70299584", "0.7007611", "0.6980134", "0.6950013", "0.6817723", "0.6753935", "0.67477185", "0.67321575", "0.6708487", "0.66948825", "0.66835815", "0.667592", "0.66686666", "0.66462886", "0.6633064", "0.6630445", "0.6614227", "0.660011...
0.7871407
0
Register a class as a custom Keras object. Taken from
def register_keras_custom_object(cls): tf.keras.utils.get_custom_objects()[cls.__name__] = cls return cls
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __create_custom_objects():\n # make some preparation to properly load objects from keras_contribute\n instance_holder = {\"instance\": None}\n\n class ClassWrapper(CRF):\n def __init__(self, *args, **kwargs):\n instance_holder[\"instance\"] = self\n super(ClassWrapper, sel...
[ "0.62000954", "0.6195566", "0.6027426", "0.58367825", "0.58193207", "0.5803586", "0.57035977", "0.56791914", "0.5632764", "0.5585904", "0.55756676", "0.550057", "0.5462705", "0.5437095", "0.54250425", "0.5399139", "0.5376054", "0.537521", "0.53704894", "0.53660065", "0.533990...
0.8505611
0
Get the MySQL password from the config file or an interactive prompt.
def get_mysql_pwd(config): # Two ways to get the password are supported. # # 1. Read clear-text password from config file. (least secure) # 2. Read password as entered manually from a console prompt. (most secure) # First try the config file. This is the least secure method. Protect the file. m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_auth_password():\n password = AUTH_PASSWORD_SCRIPT.get()\n if password:\n return password\n return DEFAULT_AUTH_PASSWORD.get()", "def _password(self):\n if 'password' in self._config:\n return self._config['password']\n else:\n while True:\n passwo...
[ "0.67284405", "0.66505927", "0.6536618", "0.64365983", "0.6373743", "0.6365045", "0.6323383", "0.6244692", "0.6244692", "0.62446654", "0.622668", "0.6200899", "0.6192647", "0.61393917", "0.61063206", "0.6070788", "0.60662985", "0.60662985", "0.60662985", "0.6052463", "0.60440...
0.8176631
0
Get REDCap data as a CSV file with an API key, URL and content type.
def get_data(csv_file, redcap_key, redcap_url, content): with open(csv_file, 'wb') as f: c = pycurl.Curl() c.setopt(pycurl.CAINFO, certifi.where()) c.setopt(c.URL, redcap_url) c.setopt(c.FOLLOWLOCATION, True) post_data = {'token': redcap_key, 'content': content, \ ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _csv(content):\n response = _data_frame(content).to_csv(index=False)\n return response", "def outputapidata_csv(filename, data, headers=None):\n with open(filename,'w',encoding='utf-8',newline = \"\", ) as f:\n if headers:\n writer = csv.DictWriter(f,fieldnames = headers)\n ...
[ "0.65286213", "0.629478", "0.6248273", "0.6128851", "0.60974103", "0.60966414", "0.607682", "0.5992442", "0.5988515", "0.59847116", "0.5964392", "0.58780026", "0.5857897", "0.5815782", "0.58133936", "0.58087337", "0.57530344", "0.5727235", "0.5678315", "0.5674862", "0.5665332...
0.6629378
0
Remove an order and all it's resources.
def purge_order(self, order_id): order = self.load_order(order_id) for authz_id in order.authorization_ids: authz = self.load_authorization(authz_id) for chall_id in authz.challenge_ids: self.delete('challenge', chall_id) self.delete('authorization', a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_order():", "def clear(self):\r\n self.orderitem_set.all().delete()", "def _delete_all_orders(self):\n for order_ref in self.created_entities['order']:\n order = self.barbicanclient.orders.get(order_ref)\n if order.secret_ref:\n self.barbicanclient.s...
[ "0.69970745", "0.67937535", "0.67173916", "0.66631436", "0.6454474", "0.64174116", "0.6353764", "0.63377964", "0.6304071", "0.61717874", "0.61426693", "0.609751", "0.60466385", "0.60095173", "0.5967705", "0.5885886", "0.58851284", "0.5855012", "0.5821319", "0.57647246", "0.57...
0.726116
0
Gets a node tree from the given string.
def getNodeTreeFromStr(string): document = publish_doctree(string) return list([node for node in document.traverse()[1:] if node.parent == document]) # we've to return the chidren of the document, as returning the document itself, seems to duplicate the content of the current file being processed.
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_tree(s):\n return parser.parse(lexer=lexer, input=s)", "def read_tree(cls, string):\n \n # first, remove the brackets ()\n string = string.strip()\n if len(string) == 0:\n raise ValueError(\"empty string cannot be a Synstactic Tree\")\n if string[0] == \...
[ "0.73093045", "0.70739913", "0.6900079", "0.66125304", "0.6608044", "0.65639174", "0.65057653", "0.6496888", "0.64140177", "0.6338099", "0.62794083", "0.6224039", "0.6153235", "0.6035289", "0.601913", "0.5981887", "0.59077924", "0.58890414", "0.58856773", "0.5878001", "0.5825...
0.795937
0
Compute a superset of the true target tract with kNN.
def compute_superset_with_k(true_bundle, kdt, prototypes, k=1000, distance_func=bundles_distances_mam): true_bundle = np.array(true_bundle, dtype=np.object) dm_true_bundle = distance_func(true_bundle, prototypes) D, I = kdt.query(dm_true_bundle, k=k) superset_idx = np.unique(I.flat) # recompute the ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_superset(true_tract, kdt, prototypes, k=1000, distance_func=bundles_distances_mam):\n true_tract = np.array(true_tract, dtype=np.object)\n dm_true_tract = distance_func(true_tract, prototypes)\n D, I = kdt.query(dm_true_tract, k=k)\n superset_idx = np.unique(I.flat)\n return superset_idx...
[ "0.6441935", "0.61719203", "0.58573407", "0.57999724", "0.5726697", "0.57163185", "0.5672652", "0.56291544", "0.5529054", "0.55143523", "0.55143523", "0.5510025", "0.5475415", "0.54626054", "0.5443", "0.54321223", "0.5406091", "0.53836495", "0.53636736", "0.5355484", "0.53139...
0.670607
0
Gather all keys that match pattern, by shard, then invoke shardfn once per shard, passing the shard, and the list of matching keys on that shard.
def with_keys_by_shard(self, shardfn, pattern='*'): for shard in self.shards: keys = shard.keys(pattern) shardfn(shard, keys)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def group_by_key(fileset, keyfunc, min_group_size=2, workers=16):\n pool = ThreadPool(workers)\n\n def evaluate(entry):\n return keyfunc(entry), entry\n\n keyed_fileset = pool.map(evaluate, fileset)\n files_by_key = {}\n for key, entry in keyed_fileset:\n if key is None:\n c...
[ "0.48097777", "0.47111169", "0.47066587", "0.47066587", "0.46778187", "0.46645233", "0.4651981", "0.4619422", "0.45933166", "0.45721135", "0.45453283", "0.4536613", "0.4532428", "0.45301318", "0.4529499", "0.45236236", "0.45110145", "0.45036453", "0.44981468", "0.44917077", "...
0.8449861
0
Generates scenario 2. Scenario 2 consists of radar and ais measurements with the same sampling rate.
def generate_scenario_2(seed=1996, permanent_save=True, sigma_process=0.01, sigma_meas_radar=3, sigma_meas_ais=1, timesteps=20): start_time = datetime.now() # specify seed to be able repeat example np.random.seed(seed) # combine two 1-D CV models to create a 2-D CV model tr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_sampling2 () :\n delta = 2 * np.pi / 3\n r = Reward(partial(stepFunction, \n xRange=(-delta/2, delta/2), \n yRange=(-delta/2, delta/2)), \n (-1, 0))\n states = []\n xs = np.arange(-np.pi, np.pi, delta)\n ys = np.arange(-np.pi, np.pi,...
[ "0.6115581", "0.59218746", "0.591556", "0.5793499", "0.5779642", "0.56699425", "0.5625599", "0.5473677", "0.54238087", "0.54228085", "0.53844553", "0.5353695", "0.5347016", "0.5287351", "0.52831525", "0.52646875", "0.5255052", "0.5238365", "0.5234221", "0.52184963", "0.521451...
0.6111027
1
Generates scenario 3. Scenario 3 consists of radar and ais measurements with different sampling rate. The sampling rate is specified in the input params. A groundtruth is generated for each second.
def generate_scenario_3(seed=1996, permanent_save=True, radar_meas_rate=1, ais_meas_rate=5, sigma_process=0.01, sigma_meas_radar=3, sigma_meas_ais=1, timesteps=20): start_time = datetime.now() # specify seed to be able to repeat the example np.random.seed(seed) # combine two 1-...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_param_scenario3():\n nb_carre_x = 42\n nb_carre_y = 45\n largeur_x = 0.825\n largeur_y = 0.645\n z1 = np.array([[11], [32], [17.26]])\n z2 = np.array([[12], [32], [18.43]])\n z3 = np.array([[13], [32], [23.2]])\n z4 = np.array([[15], [31], [23.4]])\n z5 = np.array([[16], [30], [2...
[ "0.61304635", "0.6005348", "0.59966356", "0.5971647", "0.5719661", "0.5554706", "0.5553684", "0.54804504", "0.5467986", "0.54541695", "0.5442281", "0.53921455", "0.5386651", "0.537223", "0.535773", "0.5339545", "0.5323583", "0.53214395", "0.52994394", "0.52926755", "0.5286437...
0.69548637
0
Create a Simple Good Turing estimator for the given N_r values (as specified in the 'N' kwarg). N[r] == N_r, so N[0] should be blank.
def __init__(self, N, *args, **kwargs): self.N = copy.copy(N) if isinstance(self.N, list): self.max_r = len(self.N) elif isinstance(self.N, dict) or isinstance(self.N, defaultdict): self.max_r = max(self.N.keys()) super(Estimator, self).__init__(*args, **kwargs) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _uniform_number(self, N=None):\n num_frames = self.data.shape[0]\n if not N:\n N = int(np.floor(\n Constants.DEFAULT_SAMPLE_PERCENTAGE * num_frames\n ))\n k = int(np.floor(num_frames / N))\n if k == 0:\n k = 1\n elif...
[ "0.559078", "0.55552906", "0.5441996", "0.5357272", "0.53438485", "0.5331821", "0.5251055", "0.5232737", "0.52025616", "0.5200852", "0.5196297", "0.51273173", "0.51019603", "0.5092297", "0.5092026", "0.5085834", "0.5084632", "0.5060103", "0.504482", "0.50389826", "0.5034161",...
0.56046593
0
Returns the current training instance.
def getTrainInstance(self): #NOTE: Probably faster way of doing this than additional 'if' statement every learning iteration return [self.currentTrainState, self.currentTrainPhenotype] #Return unadulterated training data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getTrainInstance(self):\n self.train_inst_condition = self.format_data.trainFormatted[self.data_ref][0]\n self.train_inst_phenotype = self.format_data.trainFormatted[self.data_ref][1]\n if self.data_ref < (self.format_data.numTrainphenotypes - 1):\n self.data_ref += 1\n e...
[ "0.6745298", "0.65309036", "0.652377", "0.64405304", "0.64387655", "0.63725954", "0.63721037", "0.6339007", "0.633087", "0.6328472", "0.6328472", "0.631136", "0.62620455", "0.6256982", "0.6194044", "0.61931723", "0.61446357", "0.61241245", "0.6090343", "0.6074379", "0.6053777...
0.7190633
0
Turns off evaluation mode. Reestablishes place in dataset.
def stopEvaluationMode(self): self.dataRef = self.storeDataRef
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stopEvaluationMode(self):\n self.data_ref = self.saved_dat_ref", "def eval(self):\n self.train(mode=False)", "def evaluate(self):\n self.training = False", "def startEvaluationMode(self):\n self.saved_dat_ref = self.data_ref", "def startEvaluationMode(self):\r\n self....
[ "0.7714545", "0.7181543", "0.71166897", "0.7048885", "0.6880281", "0.6681234", "0.6602843", "0.6505008", "0.64479685", "0.6384801", "0.622787", "0.61700326", "0.6166375", "0.61271054", "0.612519", "0.6065476", "0.5972313", "0.59697014", "0.5949517", "0.58708465", "0.5826638",...
0.77148956
0
PLots the features in a 3d plot including the hyperplane that separates the data
def plot_3d_plot(self, features, headers, labels): self.master_plot.scatter(features[:, 0], features[:, 1], features[:, 2], c=labels) self.master_plot.set_xlabel(headers[0]) self.master_plot.set_ylabel(headers[1]) self.master_plot.set_zlabel(headers[2]) plot_hyperplane(self.clf,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot3d(self):\n plot_rupture_wire3d(self)", "def svm_add_3d_hyperplane(model, ax, plotted_points):\n SPACE_SAMPLING_POINTS = 70\n X_MIN = np.min(plotted_points[:, 0])\n X_MAX = np.max(plotted_points[:, 0])\n Y_MIN = np.min(plotted_points[:, 1])\n Y_MAX = np.max(plotted_points[:, 1])\n ...
[ "0.7302647", "0.7106038", "0.7101418", "0.69293755", "0.6890816", "0.6856431", "0.6853505", "0.6824226", "0.67982167", "0.6775323", "0.67729586", "0.67109203", "0.67087954", "0.6701973", "0.66566586", "0.6629957", "0.66192967", "0.6613964", "0.66003513", "0.6584965", "0.65722...
0.75784415
0
Clears all the axes
def clear_graphs(self): for ax in (self.master_plot, self.time_velocity, self.time_power, self.power_velocity): ax.cla()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clear(self):\n\n # Clear\n self.axes.cla()\n try:\n self.figure.clf()\n except KeyError:\n FlatCAMApp.App.log.warning(\"KeyError in MPL figure.clf()\")\n\n # Re-build\n self.figure.add_axes(self.axes)\n self.axes.set_aspect(1)\n self...
[ "0.82477164", "0.7836058", "0.7796212", "0.77853906", "0.7656969", "0.7641738", "0.7476974", "0.74030435", "0.738647", "0.7372803", "0.7297088", "0.7183157", "0.7169569", "0.71616346", "0.71613884", "0.70750993", "0.70736307", "0.6969796", "0.69636786", "0.69146824", "0.68999...
0.80753964
1
Shows the grids for the major ticks in the plot.
def show_grid(self): for ax in (self.time_velocity, self.time_power, self.power_velocity): ax.grid(True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nicegrid():\n pl.grid(b=True, which='major', color='black', linestyle='-')\n\n pl.grid(b=True, which='minor', color='silver', linestyle=':')", "def show_grid(frame, episode_nr):\n plt.grid('on')\n ax = plt.gca()\n ax.set_xticks(np.arange(0.5, 10, 1))\n ax.set_yticks(np.arange(0.5, 10, 1))\n...
[ "0.68624645", "0.67270374", "0.66225463", "0.6502822", "0.6419999", "0.6419999", "0.6344717", "0.63419735", "0.62765646", "0.6247754", "0.6218179", "0.6216362", "0.61837363", "0.6176579", "0.6159757", "0.6152556", "0.6152556", "0.61514324", "0.61219585", "0.6111579", "0.60773...
0.7353925
0
Return all the matching commands. Only for the submode which is passed in. Be sensitive to features, be sensitive to the prefix. For commands which have a first keyword which is a pattern, use the command description's completio
def commands_for_submode(prefix): candidates = _lookup_command_candidates(prefix, command_registry) # print type(candidates), [x['self'] for x in candidates] # print [x.get('all-help') for x in candidates] if debug.cli(): # print 'commands_for_submode:', sorted(dict([[x['name']['title'] if type(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_matching_commands(self, command_word, is_no_command, command_list):\n candidates = []\n current_mode = bigsh.run.finder.mode_stack.current_mode()\n command_word_lower = command_word.lower()\n\n try:\n for command in command_list:\n # If this command is ...
[ "0.66676307", "0.6511643", "0.6412278", "0.63640773", "0.6297366", "0.62761074", "0.6274068", "0.6131544", "0.6130938", "0.60968447", "0.6082013", "0.6057049", "0.5983618", "0.5955035", "0.5952809", "0.58883524", "0.58177805", "0.5813151", "0.5804144", "0.5801285", "0.5795904...
0.8093101
0
Returns whether or not the given value is a valid boundary value. Valid values are integers or the special strings 'min' or 'max' (caseinsensitive)
def _is_range_boundary(boundary): return (isinstance(boundary, numbers.Integral) or (_is_string(boundary) and (boundary.lower() in ('min','max'))))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate(self, value: Union[int, float]) -> bool:\n if self.left_boundary['open']:\n if self.left_boundary['value'] >= value:\n return False\n else:\n if self.left_boundary['value'] > value:\n return False\n if self.right_boundary['open']...
[ "0.7001806", "0.69449776", "0.69125473", "0.6847961", "0.6784564", "0.6771291", "0.6754776", "0.671932", "0.67118704", "0.6632516", "0.6568673", "0.6539237", "0.65292275", "0.6448011", "0.6417884", "0.64089316", "0.6399697", "0.6356775", "0.6352202", "0.63023275", "0.6292374"...
0.8070116
0
Converts the given boundary value to an appropriate integral boundary value. This is used to handle the special "min' and 'max' string values. The test_value argument should be the value which is being tested for whether or not it's in a range. Since long integral values have an unlimited precision there is no actual M...
def _convert_range_boundary(boundary, test_value): if _is_string(boundary): if boundary.lower() == 'min': boundary = test_value - 1 elif boundary.lower() == 'max': boundary = test_value + 1 else: raise error.CommandDescriptionError('Invalid range boundary ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _is_range_boundary(boundary):\n return (isinstance(boundary, numbers.Integral) or\n (_is_string(boundary) and (boundary.lower() in ('min','max'))))", "def clean_int(\n i: int,\n ub: int,\n lb: int = 0,\n ) -> int: \n\n # Initialisations\n i_temp = i\n\n # Check if the in...
[ "0.6226162", "0.6110354", "0.5956353", "0.5869911", "0.5851052", "0.5840057", "0.58316064", "0.5831372", "0.5728684", "0.569103", "0.56804085", "0.56803036", "0.5654331", "0.56315446", "0.55944073", "0.5495219", "0.5494189", "0.5409632", "0.5409632", "0.539477", "0.5389832", ...
0.7728433
0
Returns whether or not the argument is a valid single range. A valid range is either a single integral value or else a sequence (tuple or list) with 2 elements, each of which is a valid range boundary value.
def _is_single_range(r): return (isinstance(r, numbers.Integral) or (isinstance(r, collections.Sequence) and (len(r) == 2) and _is_range_boundary(r[0]) and _is_range_boundary(r[1])))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_one_range(r):\n if not _is_single_range(r):\n raise error.RangeSyntaxError(str(r))", "def acceptsArgument(self):\n range = self.validateRange(self.range)\n return not(not(range[1]))", "def isRangeValid(self) -> bool:\n ...", "def _is_range(cls, rng):\n match = re....
[ "0.7808903", "0.7591454", "0.7182697", "0.71769637", "0.7123997", "0.7108595", "0.6981113", "0.69550073", "0.6891303", "0.688228", "0.686025", "0.6788622", "0.6352424", "0.63459134", "0.63131315", "0.62641954", "0.6227245", "0.6194634", "0.61821723", "0.6179093", "0.6149241",...
0.86027473
0
Checks that the argument is a valid single range as determined by _is_single_range. If it is, then the function returns None. It it's not, then a RangeSyntaxError exception is raised.
def _check_one_range(r): if not _is_single_range(r): raise error.RangeSyntaxError(str(r))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _is_single_range(r):\n return (isinstance(r, numbers.Integral) or\n (isinstance(r, collections.Sequence) and (len(r) == 2) and\n _is_range_boundary(r[0]) and _is_range_boundary(r[1])))", "def _check_range(r): \n if _is_single_range(r):\n _check_one_range(r)\n elif isin...
[ "0.71708286", "0.6784762", "0.6421671", "0.63540816", "0.6278021", "0.6267585", "0.61784256", "0.5972375", "0.5945648", "0.5697895", "0.5589983", "0.5469726", "0.53853506", "0.533863", "0.531605", "0.5294728", "0.52871644", "0.528131", "0.5274676", "0.5242175", "0.51893365", ...
0.81059533
0
Look up the given name in a typedef. If it's not found in the given typedef it recursively searches for the value in the base typedefs. Returns None if the value is not found.
def _lookup_typedef_value(typedef, name): assert typedef is not None assert name is not None # Check if the typedef has the attribute value = typedef.get(name) if value: return value # Otherwise, see if it's defined in the base type(s) base_type_name = typedef.get('base-typ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def checkLookup(self, name):\n if not self.symbols.has_key(name):\n # we don't care\n return None\n # is it one we really care about\n t = self.symbols[name].getType()\n if t == \"typedef\":\n t = self.symbols[name].getAliasType()\n if t == \"...
[ "0.62882066", "0.6006309", "0.5985091", "0.58943266", "0.5891234", "0.58053267", "0.57933515", "0.5666294", "0.5659589", "0.556779", "0.5549444", "0.5516995", "0.5516995", "0.54696757", "0.5459081", "0.5456446", "0.5453206", "0.5431234", "0.5415231", "0.5371446", "0.53526515"...
0.8076759
0
Called when an argument doesn't match the expected type. Raises an ArgumentValidationError exception. The message for the exception can be customized by specifying a error format string in the type definition. The format string is called ' validationerrorformat'.
def _raise_argument_validation_exception(typedef, value, detail, expected_tokens=None): typedef_name = typedef.get('help-name') if typedef_name is None: typedef_name = typedef.get('name') if typedef_name is None: typedef_name = typedef.get('field') if typedef_name is None...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_incorrect_arg_type(self):\n\n with pytest.raises(TypeError) as exc_info:\n upper_incomplete_gamma(a='A', z=0.3)\n\n expected_error_msg = (\n 'type of argument \"a\" must be one of (int, float); got str instead'\n )\n assert str(exc_info.value) == expected_...
[ "0.69686395", "0.66745853", "0.6643091", "0.6587547", "0.6579584", "0.646052", "0.6447449", "0.64430845", "0.6376854", "0.63049024", "0.63008493", "0.62791383", "0.6219893", "0.61986107", "0.61303514", "0.6127861", "0.6121139", "0.6109378", "0.6102843", "0.60939085", "0.60928...
0.7721112
0
Gets the args item from the given item. The item may be a command or subcommand description or a nested arg list inside a 'choice' argument. If there's no item names "args", then it returns None. If the args item is a single argument, then it's converted into a tuple containing that single argument, so that the caller ...
def _get_args(item): args = item.get('args') if args and not isinstance(args, collections.Sequence): args = (args,) return args
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _item_or_tuple(self, seq):\n t = tuple(seq)\n if self._is_multi:\n return t\n else:\n return t[0]", "def _item_or_tuple(self, seq):\n t = tuple(seq)\n if self._is_multi:\n return t\n else:\n return t[0]", "def _item_or_tuple(self, seq):\n ...
[ "0.60065734", "0.5978255", "0.5978255", "0.57647127", "0.5749274", "0.5505375", "0.5469559", "0.5410199", "0.53327376", "0.5265627", "0.52116334", "0.5186901", "0.51850796", "0.5178818", "0.5167262", "0.5139123", "0.5139123", "0.51254106", "0.50968003", "0.5068587", "0.506782...
0.7316674
0
Returns the list of matching command candidates from the command list.
def get_matching_commands(self, command_word, is_no_command, command_list): candidates = [] current_mode = bigsh.run.finder.mode_stack.current_mode() command_word_lower = command_word.lower() try: for command in command_list: # If this command is tied to a fe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _lookup_command_candidates(command_prefix, command_list):\n candidates = []\n current_mode = bigsh.run.finder.mode_stack.current_mode()\n try:\n for command in command_list:\n modes = _get_applicable_modes(command)\n if _match_current_modes(command, current_mode, modes):\n...
[ "0.78405523", "0.6468865", "0.63149947", "0.62614846", "0.6214467", "0.6194494", "0.6165398", "0.6153341", "0.6145241", "0.61329925", "0.5982471", "0.59805346", "0.5973649", "0.5963104", "0.59585357", "0.5950532", "0.5916563", "0.59144855", "0.5905247", "0.5900076", "0.589186...
0.71730745
1
Print the completions ourselves in sorted multiple column format. We use this when the completions are are pseudo/help completions that aren't real tokens that we want readline to use for completions.
def print_completions(self, completions): meta_completions = [completion[0] if isinstance(completion, tuple) else completion for completion in completions] meta_completions.sort() bigsh.print_completion_help(bigsh.choices_text_builder(meta_completions))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cli_completions(self) -> str:\n completions = []\n for cmd_name in self.cli_parser.cmd_names:\n completions.append(cmd_name)\n for plugin_name in self.name_to_plugin_class:\n completions.append(plugin_name)\n\n return \",\".join(completions)", "def displaySor...
[ "0.60223293", "0.5749722", "0.57289875", "0.5696492", "0.56638753", "0.55966675", "0.5560439", "0.5553174", "0.5548504", "0.55221015", "0.5500452", "0.5498528", "0.5395442", "0.5389106", "0.53512865", "0.5325396", "0.530939", "0.53022945", "0.5282126", "0.5232109", "0.5226291...
0.7565795
0
The canonical (i.e. most general) representation of a validation result is a list of 2item tuples where the first item in the tuple is the validated value that should be used to update the arg_data and the second item is the actual token that was matched, which may not be the same as the word in the command. For exampl...
def _canonicalize_validation_result(result): if result is None: result = [] elif _is_list(result): if len(result) > 0 and not _is_list(result[0]): result = [result] else: matching_token = result if _is_string(result) else str(result) result = [(result, matching_to...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _process_validator_results(ret, level, object_data, obj):\n\n # The first object in the tuple is the one being validated\n if isinstance(obj, tuple):\n real_obj = obj[0]\n else:\n real_obj = obj\n\n if not ret:\n is_valid = True\n return i...
[ "0.5750961", "0.55248684", "0.5506295", "0.54921216", "0.5306934", "0.5261992", "0.5246164", "0.52409977", "0.51459575", "0.5136628", "0.51328367", "0.5111515", "0.50920993", "0.5087317", "0.5069478", "0.5063956", "0.5053605", "0.5051444", "0.50409806", "0.5040384", "0.502853...
0.7486084
0
qualify Generate qualify version of the permutations field_values Generate instance of command using these fields
def __init__(self, qualify = False, field_values = None): super(CommandPermutor, self).__init__() self.commands = [] self.collect = [] # intended to be boolean, but any predicate type will do. self.qualify = qualify # field_values is intended to be a dictionary of name:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def field_to_generator(self, field, field_values):\n if self.qualify:\n # Many of the fields are actually fields in\n # the named obj-type. Take a shot at seeing if that's\n # the case, and call a sample value collector\n\n if self.path_other:\n # ...
[ "0.59003377", "0.5237725", "0.5203437", "0.5165361", "0.50387293", "0.50179744", "0.4940163", "0.49088612", "0.48980182", "0.48827323", "0.48454884", "0.48104414", "0.4796751", "0.4788122", "0.47654617", "0.47645807", "0.47437337", "0.47381946", "0.47369894", "0.47285095", "0...
0.60619706
0
Permute command for a submode, takes the command, finds all the related submodesmodes, permutes all the commands in the submode, then a recursive call to any submodes found within this one. submode_command command dictionary of the submode command. Can be set to None as an indication of "root" qualify boolean, describe...
def permute_single_submode(submode_command, qualify): permuted = [] permute_submodes = [] if submode_command == None: mode = 'login' else: # first, the submode. There ought to be only one permutation. permute = CommandPermutor(qualify) permuted.append(permute.permute_co...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def permute_command(words, qualify):\n if len(words) == 0:\n return permute_single_submode(None, qualify)\n else:\n permute = CommandPermutor(qualify)\n return permute.handle_command(words)", "def commands_for_submode(prefix):\n candidates = _lookup_command_candidates(prefix, comman...
[ "0.6088499", "0.5510981", "0.5013558", "0.4904283", "0.48374233", "0.47861892", "0.47663242", "0.4672153", "0.4592035", "0.45495653", "0.45457467", "0.4542132", "0.4524321", "0.45221865", "0.44939885", "0.4493422", "0.4463644", "0.44468173", "0.4442733", "0.44194564", "0.4403...
0.78541815
0
Permute all the commands (with no parameters), or a sigle command. The command is named via the name
def permute_command(words, qualify): if len(words) == 0: return permute_single_submode(None, qualify) else: permute = CommandPermutor(qualify) return permute.handle_command(words)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def call_command_direct(self, name, args=None, kwargs=None):\n comm,_=self._commands[name]\n return comm(*(args or []),**(kwargs or {}))", "def _transform_command(self) -> None:\n self.command = None if self.command == [] else self.command", "def __call__(self, cmd):\n cmdname = cmd...
[ "0.5660321", "0.55383295", "0.54060173", "0.539535", "0.5362111", "0.5255111", "0.5249829", "0.524142", "0.5200568", "0.5195856", "0.51837564", "0.51559633", "0.51405185", "0.5124075", "0.51221806", "0.5109466", "0.50891364", "0.50802135", "0.5072316", "0.5067867", "0.503808"...
0.69490945
0
Returns whether or not the argument is a string (either a "str" or "unicode")
def _is_string(arg): return isinstance(arg, types.StringTypes)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def typeIsString(obj):\n return type(obj) is str or _haveTypeUnicode and type(obj) is unicode", "def is_string(atype):\n if atype == str:\n return True\n elif PY2:\n if atype == unicode:\n return True\n return False", "def is_string(value):\n return isinstanc...
[ "0.85439533", "0.8531232", "0.85032046", "0.8458424", "0.8457038", "0.8448985", "0.84387064", "0.84377694", "0.84271085", "0.82765406", "0.82513785", "0.8241974", "0.8218465", "0.81970197", "0.81306636", "0.81137633", "0.8081129", "0.80713755", "0.7998069", "0.7932523", "0.78...
0.9257119
0
Returns whether or not the argument is a list. This means that it's an instance of a sequence, but not including the string types
def _is_list(arg): return isinstance(arg, collections.Sequence) and not _is_string(arg)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_list ( self, s ):\r\n\t\treturn isinstance ( s, type( list () ) )", "def is_list_of(seq, expected_type):\n return is_seq_of(seq, expected_type, seq_type=list)", "def _is_list(item):\n return isinstance(item, list)", "def _is_list(val):\n\n return isinstance(val, list)", "def is_sequence_o...
[ "0.83214027", "0.81061", "0.8065349", "0.79083794", "0.7902992", "0.78376174", "0.78361946", "0.78166515", "0.7780776", "0.7772325", "0.7759591", "0.77538717", "0.7664642", "0.7664073", "0.7621871", "0.7563922", "0.75465405", "0.7468648", "0.73699504", "0.73252976", "0.728769...
0.90609455
0
Look up the given name in the given list of scopes. Returns the default value if the name is not defined in any of the scopes.
def _lookup_in_scopes(name, scopes, default=None): assert name assert scopes is not None # We iterate over the items in the scope (rather than using 'get') # so we can do a case-insensitive lookup. name_lower = name.lower() for scope in scopes: for key, value in scope.items(): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lookup(scopes, name):\n # type: (Scopes[T], str) -> Optional[T]\n\n for scope in scopes:\n for key, val in scope:\n if key == name:\n return val\n return None", "def get_by_name(self, name):\n scopes = self._client.get_all()\n result = [x for x in scope...
[ "0.79767394", "0.71245885", "0.6058012", "0.6011732", "0.59649855", "0.5573654", "0.5547338", "0.55172366", "0.54739946", "0.53942615", "0.53553236", "0.53401506", "0.53022784", "0.52925473", "0.52719605", "0.5179497", "0.51721185", "0.5171616", "0.5151544", "0.5137249", "0.5...
0.8805875
0
Helper function for _get_applicable_modes to add any modes for this command
def _add_applicable_modes(command, mode_dict): description_feature = command.get('feature') if description_feature: if not feature.feature_enabled(description_feature): return mode = command.get('mode') if mode: if type(mode) == list: for m in mode: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_applicable_modes(command):\n mode_dict = {}\n _add_applicable_modes(command, mode_dict)\n return mode_dict.keys()", "def append_modes(self,modes):\n self.modes = np.append(self.modes,np.array(modes,dtype=modetype))", "def apply_mode_command(self, channel, command):\n direction, ...
[ "0.753973", "0.71372646", "0.6752454", "0.6620678", "0.6579078", "0.65712893", "0.6447186", "0.6447186", "0.64453655", "0.64104617", "0.64058155", "0.63210326", "0.6265792", "0.61772203", "0.61080694", "0.6099957", "0.6079826", "0.607896", "0.60186535", "0.6015669", "0.600954...
0.87255466
0
Returns a list of all of the modes that are specified for this command
def _get_applicable_modes(command): mode_dict = {} _add_applicable_modes(command, mode_dict) return mode_dict.keys()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def modes(self) -> List[str]:\n return [m.name for m in self._modes]", "def _get_modes(self):\n return self.__modes", "def get_modes(self):\n return self.circuit.get_modes()", "def modes(self):\n return np.hstack(tuple(self.operator.modes))", "def get_modes(self):\n return [i...
[ "0.8445033", "0.82154745", "0.80214876", "0.7829724", "0.78250915", "0.7822188", "0.7747393", "0.7696896", "0.7645572", "0.75551045", "0.75231206", "0.745426", "0.7388421", "0.73145664", "0.72621864", "0.7185098", "0.71638507", "0.71492827", "0.7133864", "0.7105226", "0.70994...
0.82162344
1
Return True when this command_mode is an exact match for this current mode (used to partition list of commands into two groups, one exact level, and for for related mode matches)
def _exact_mode_match(current_mode, command_modes): if not type(command_modes) == list: command_modes = [command_modes] for mode in command_modes: if mode == current_mode: return True if mode.endswith('*') and mode[:-1] == current_mode: return True return Fals...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _match_current_modes(command, current_mode, modes):\n if current_mode in modes:\n return True\n #\n # if the modes is enable, this works everywhere\n #\n if 'login' in modes:\n return True\n #\n # if the modes is login, and the mode is anything but login,\n # then this is ...
[ "0.7462347", "0.60965776", "0.5913109", "0.57950515", "0.5736853", "0.5670262", "0.5664345", "0.5632514", "0.5624758", "0.5591398", "0.5580854", "0.5562407", "0.5527055", "0.5523893", "0.54978305", "0.5474427", "0.5451625", "0.54250956", "0.5420091", "0.54136974", "0.5408295"...
0.81015956
0
Returns the list of command candidates from the given command list. A candidate must have a 'mode' value that matches the current mode, and its name must begin with the given command prefix.
def _lookup_command_candidates(command_prefix, command_list): candidates = [] current_mode = bigsh.run.finder.mode_stack.current_mode() try: for command in command_list: modes = _get_applicable_modes(command) if _match_current_modes(command, current_mode, modes): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_matching_commands(self, command_word, is_no_command, command_list):\n candidates = []\n current_mode = bigsh.run.finder.mode_stack.current_mode()\n command_word_lower = command_word.lower()\n\n try:\n for command in command_list:\n # If this command is ...
[ "0.6808836", "0.6215403", "0.60658646", "0.59883577", "0.5964308", "0.59415025", "0.58491945", "0.584738", "0.57828355", "0.57461345", "0.5679819", "0.5637294", "0.56194764", "0.56044847", "0.5591293", "0.5573114", "0.55270916", "0.5516119", "0.5515833", "0.55114114", "0.5507...
0.86891496
0
Displays a markdown doc describing the predictive modeling contest. Note ./content/contest/.md must be modified for contest.
def evaluation(): file = open('./contest/content/evaluation.md', 'r') rawText = file.read() file.close() content = Markup(markdown(rawText, extensions=['markdown.extensions.fenced_code', 'markdown.extensions.tables'])) return render_template('markdowntemplate.html', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def markov_story():\n return render_template(\"markovstory.html\")", "def show_story():\n print(story)\n ans = request.args\n mad_story = story.generate(ans)\n return render_template(\"story.html\", story=mad_story)", "def description():\n #rule = request.url_rule\n #print(rule)\n file ...
[ "0.6715872", "0.6109959", "0.605513", "0.60453767", "0.58141357", "0.5764724", "0.56801903", "0.56615716", "0.564484", "0.5626134", "0.56238323", "0.560941", "0.5568852", "0.55506897", "0.55294514", "0.552025", "0.54897755", "0.54637724", "0.54536664", "0.54208964", "0.541954...
0.6191105
1
Allow user to select the upload they'd like to use for submission Default selection should be most recent submissions
def select_model(): try: #check if contest has ended if contestEndBool(): flash("Error: contest has ended") raise Exception("contest has ended") input = request.form print(str(input)) for count, x in enumerate(input): print(count, x) if len(inp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def select_file_upload_method():\n\n if not Settings.prompt(\"upload files\"): \n return \"unset\"\n Settings.print(\"Select an upload source\")\n sources = Settings.get_source_options()\n question = {\n 'type': 'list',\n 'name': 'upload',\n '...
[ "0.5997314", "0.5983872", "0.589526", "0.576531", "0.5642785", "0.5381244", "0.5381244", "0.5363477", "0.5341594", "0.5295605", "0.5283472", "0.5279332", "0.5256086", "0.5177524", "0.5163761", "0.5152573", "0.5134435", "0.51217484", "0.5096993", "0.50757486", "0.5058516", "...
0.6039245
0
Download Reistijden GeoJSON and save it to the database.
def download_and_update(): with tempfile.TemporaryDirectory(dir=TEMP_DOWNLOAD_DIR) as temp_dir: reistijden_jsonfile = os.path.join(temp_dir, 'reistijdenAmsterdam.geojson') r = requests.get(REISTIJDEN_TARGET_URL) with open(reistijden_jsonfile, 'w') as f: f.write(r.text) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_geojson():\n\n # check the file was already downloaded\n global GEOJSON\n if GEOJSON: return GEOJSON\n\n conn = None\n cur = None\n try:\n\n conn = utils.pgconnect(**settings.DEFAULT_CONNECTION)\n cur = conn.cursor()\n cur.execute( \"\"\"SELECT row_to_json(fc) FROM...
[ "0.65090847", "0.6401234", "0.629521", "0.62839437", "0.6232702", "0.61436486", "0.6100601", "0.60972625", "0.5967515", "0.5946081", "0.5935013", "0.5935013", "0.58112276", "0.5717537", "0.5706458", "0.5656695", "0.5588673", "0.55623233", "0.55592436", "0.55287975", "0.552224...
0.751995
0
Return the XPath from node a to node b, assumes b is a descendant of a.
def xpath(a, b): if a.isSameNode(b): return "" return xpath(a, b.parentNode) + "/" + b.localName
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_path8(self):\n xpb = XPathBuilder()\n xp_1 = xpb.foo.baz\n xp_2 = xpb.bar.abc.join(xp_1)\n exp = '/bar/abc/foo/baz'\n self.assertEqual(xp_1, xp_2)\n self.assertEqual(xp_2.tostring(), exp)", "def get_xpath(tag_name: str, parent, suffix = ''):\n xpath =...
[ "0.5497289", "0.5488446", "0.5398042", "0.53868425", "0.5333837", "0.5326444", "0.53179765", "0.5249903", "0.5121286", "0.5086263", "0.5082444", "0.5056868", "0.50500554", "0.5035871", "0.5035871", "0.49958196", "0.49624732", "0.49436888", "0.49340647", "0.49328429", "0.49323...
0.8103554
0
Add a label to node's list of children, the XML contained in that label comes from xml_str. We want to make referencing variables easier, maybe using $varname.
def add_label(xml_str, node): if xml_str: s = u'<?xml version="1.0" ?><label>' + xml_str + u"</label>" node.appendChild( parseString(s.encode("utf-8")).documentElement )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, label):\n self.label = label\n self.children = list()", "def addLabels(t):\n if not t.label:\n t.label = \"\".join([choice(\"abcdefghijklmnopqrstuvwxyz\") for i in range(4)])\n for r,w in t.children:\n addLabels(r)", "def __init__(self, label):\n self...
[ "0.64232975", "0.6181848", "0.60131395", "0.5892141", "0.5781065", "0.57423294", "0.5731213", "0.5660578", "0.56166065", "0.5590489", "0.5573439", "0.5515644", "0.5477117", "0.54630226", "0.5416833", "0.5409699", "0.5392758", "0.53465724", "0.5339193", "0.5337083", "0.5324728...
0.71521944
0
Return a dictionary of multiple choice lists from the Excel Worksheet 'sheet'. The Worksheet named 'Select Choices' defines the choices for all multiple choice questions. This sheet must have three
def construct_choice_lists(sheet): d = {} for row in range(1,sheet.nrows): c = {} for col in range(0,sheet.ncols): c[sheet.cell(0,col).value] = sheet.cell(row,col).value list_name = c.pop("list name") if list_name in d: d[list_name].append(c) else:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_menu_options():\n workbook_path = get_workbook_path()\n wb = openpyxl.load_workbook(workbook_path)\n sheet_names = wb.sheetnames\n return sheet_names", "def get_sheet_data(self) -> List[SheetData]:\n result: List[SheetData] = []\n\n for c in range(self.columnCount() - 1):\n s = Sh...
[ "0.60501075", "0.575098", "0.5318569", "0.53165835", "0.5285447", "0.52561027", "0.52561027", "0.52561027", "0.52561027", "0.52438134", "0.51110536", "0.50920993", "0.50747657", "0.5074488", "0.5042221", "0.5003982", "0.49192867", "0.49099895", "0.4886586", "0.48812103", "0.4...
0.7654838
0
Convert a properly formatted excel file into XForms for use with Open Data Kit. Return a list of all the XForms created.
def write_xforms(xls_file_path): xforms = [] workbook = open_workbook(xls_file_path) folder = os.path.dirname(xls_file_path) choice_sheet = "Select Choices" choices = construct_choice_lists( workbook.sheet_by_name(choice_sheet) ) for sheet in workbook.sheets(): if sheet.name != choice...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_xlsx_sheet(f, n=0):\n xl_file = pd.ExcelFile(f)\n dfs = xl_file.parse(xl_file.sheet_names[n], na_values=['n.a.', 'n.d.'])\n return dfs", "def read_xlsx(self, filename):\n xlsx = pd.ExcelFile(filename)\n for sheet in xlsx.sheet_names:\n table_index_header = cfg.get_list...
[ "0.5343978", "0.52173615", "0.5207813", "0.5159541", "0.5144205", "0.5137643", "0.51044893", "0.50839716", "0.506976", "0.5050417", "0.5023947", "0.4986781", "0.49759924", "0.49596763", "0.4947392", "0.49413222", "0.49334276", "0.49067864", "0.48902297", "0.4873562", "0.48344...
0.6615536
0
Replace all instances of '${tag}' with the XPath corresponding to the tag.
def sub_tag(str): bracketed_tag = r"(\${" + tag_start_char + tag_char + r"*})" m = re.search(bracketed_tag, str) if m: tag = m.group(1) tag = tag[2:len(tag)-1] if tag not in tag_xpath: rai...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def replace_tag(tag, value, file):\r\n with open(file, \"r\") as origin:\r\n with open(file+\".replaced\", \"w\") as dest:\r\n dest.write(origin.read().replace(tag, str(value)))\r\n return file+\".replaced\"", "def replace_tag_value( msg, tag, value ) :\n _TAG_RE = re.compile('\\x01' +...
[ "0.5578515", "0.5398839", "0.53104943", "0.5310126", "0.5291188", "0.5275091", "0.52065635", "0.51992667", "0.5098113", "0.5070617", "0.5046198", "0.5034003", "0.4993068", "0.49627715", "0.4956388", "0.49514914", "0.4910291", "0.48976448", "0.4868524", "0.4832289", "0.4815513...
0.581539
0
Return a list of level seeds for a given gamekey
def ajax_levelseeds(request, gamekey): seed_lst = tools.getLevelSeedsFromGameKey(gamekey) data_response = { "data": seed_lst, "status": "OK" } return HttpResponse(json.dumps(data_response), content_type="application/json")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_game_levels(self):\n\n self._katakana_database.create_katakana_database_connection()\n\n raw_game_levels = self._katakana_database.katakana_db.execute(\n \"\"\"SELECT game_level FROM Games\"\"\").fetchall()\n\n all_game_levels = []\n for i in raw_game_levels:\n ...
[ "0.5885322", "0.5726993", "0.5407367", "0.5301738", "0.5284191", "0.5212815", "0.50632656", "0.50508773", "0.505008", "0.5045081", "0.4962722", "0.49233738", "0.488766", "0.4876195", "0.486169", "0.48457703", "0.4844681", "0.482408", "0.4821691", "0.47913313", "0.4763049", ...
0.5952363
0
Compute infinite time horizon average LQR cost. Returns 1e6 if A+BK is not stable
def LQR_cost(A, B, K, Q, R, sigma_w): L = A + B.dot(K) if spectral_radius(L) >= 1: return 1e6 M = Q + K.T.dot(R).dot(K) P = solve_discrete_lyapunov(L, M) return (sigma_w ** 2) * np.trace(P)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lksprob(alam):\r\n fac = 2.0\r\n sum = 0.0\r\n termbf = 0.0\r\n a2 = -2.0*alam*alam\r\n for j in range(1,201):\r\n term = fac*math.exp(a2*j*j)\r\n sum = sum + term\r\n if math.fabs(term) <= (0.001*termbf) or math.fabs(term) < (1.0e-8*sum):\r\n return sum\r\n ...
[ "0.60029477", "0.5933232", "0.58607453", "0.5827601", "0.57766134", "0.57220405", "0.5690132", "0.5665845", "0.56634825", "0.56570524", "0.5628769", "0.5604078", "0.55918825", "0.5588187", "0.5571809", "0.55503905", "0.55435735", "0.55359924", "0.5530741", "0.55281013", "0.55...
0.6573204
0
Check that the observability matrix is full rank. We check this by using the standard condition that [C CA CA^2 . . . CA^{n1}] is full rank
def check_observability(A, C): assert len(A.shape) == 2 dim = A.shape[0] stack = [] for i in range(dim): term = C @ np.linalg.matrix_power(A, i) stack.append(term) obs_grammian = np.vstack(stack) return np.linalg.matrix_rank(obs_grammian) == dim
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _board_is_full(self):\n return (self.get_counts()[0] + self.get_counts()[1] == self._num_rows * self._num_cols)", "def fullGrid(state):\n return not ((state[:, :, 0] + state[:, :, 1]) == 0).any()", "def is_full_row_rank(G):\n assert len(G.shape) == 2, \"should be a 2d numpy arrayp\"\n rows ...
[ "0.58528364", "0.575484", "0.570392", "0.5627623", "0.5623395", "0.5601164", "0.5532206", "0.5532206", "0.5532206", "0.5532206", "0.5505377", "0.5505377", "0.5463339", "0.54319173", "0.542496", "0.5393358", "0.53866196", "0.5373487", "0.5358698", "0.535044", "0.53352785", "...
0.62513566
0
Check that the controllability matrix [B, BA, ..., BA^{n1}] is full rank
def check_controllability(A, B): assert len(A.shape) == 2 dim = A.shape[0] stack = [] for i in range(dim): term = B @ np.linalg.matrix_power(A, i) stack.append(term) grammian = np.hstack(stack) return np.linalg.matrix_rank(grammian) == dim
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _board_is_full(self):\n return (self.get_counts()[0] + self.get_counts()[1] == self._num_rows * self._num_cols)", "def fullGrid(state):\n return not ((state[:, :, 0] + state[:, :, 1]) == 0).any()", "def check_grid_full(self):\n for row in self.game_state:\n for e in row:\n ...
[ "0.64367396", "0.6185774", "0.61180735", "0.6107293", "0.61059", "0.6050762", "0.6046627", "0.6046486", "0.59971195", "0.5967931", "0.59551543", "0.5925763", "0.59230703", "0.59230703", "0.59198326", "0.5916389", "0.58971936", "0.5856238", "0.5807457", "0.58016616", "0.579588...
0.67005306
0
Returns a random dim x dim matrix with top eigenvalue bounded by bound dim
def sample_matrix(dim, bound): return np.random.uniform(low=-bound, high=bound, size=(dim, dim))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_biggest_eigenvalue(cls, covariance_matrix):\n timer = TimerHandler()\n timer.start(\"eigen2\")\n eigvals = scipy.linalg.eigh(covariance_matrix, \n eigvals_only = True, \n eigvals = (covariance_matrix.shape[0] -1,...
[ "0.5875326", "0.5783161", "0.5597876", "0.5518314", "0.54774606", "0.53589374", "0.53341335", "0.52804285", "0.52785826", "0.52338797", "0.52313197", "0.52312946", "0.52151245", "0.5212694", "0.5212556", "0.5212227", "0.5209878", "0.52093714", "0.52040935", "0.5180018", "0.51...
0.59177387
0
Loop through available emails at the specified time and send emails containing link to the youtube video
def send_video_links(): email_list = Emails.query.filter_by(status="active").all() print("Sending newsletters to ", len(email_list), " users") random_video = get_random_video_link() video_link = f"https://www.youtube.com/watch?v={random_video[1]}" for email in email_list: #send email to us...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_realtime_email(self,body_):\n import smtplib, ssl\n\n port = 465 # For SSL\n smtp_server = \"smtp.gmail.com\"\n sender_email = self.fromaddr # Enter your address\n receiver_email = self.toaddr # Enter receiver address\n password = self.pswd\n message = f...
[ "0.6318766", "0.62500906", "0.6119919", "0.5765977", "0.5693172", "0.5690263", "0.56841874", "0.56350535", "0.5619672", "0.56012964", "0.55933404", "0.5580555", "0.55799156", "0.55671567", "0.5559276", "0.55554837", "0.554504", "0.5533154", "0.5532039", "0.5523625", "0.550718...
0.80123353
0
Spatial_check does does a spatial QC test using a simple neighbor check whereby it looks at stations within a radius and elevation band and checks if at least one value is near the value in question. If not, it tries a bigger radius and checks again, and if not again, the value is flagged.
def spatial_check(obs, nstnnets, lat, lon, elev, var, ivar, qc_flag): ndts = len(obs[:, 0, 0]) # number of hours in obs. roism = 100.0 # smaller radius of influence. roibg = 150.0 # bigger radius of influence. min_stations = 2 # min # of stns needed for testing. level1 = suspflag level2 = w...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_nearest_filter(self):\n for airport, reports, count in (\n (True, True, 6),\n (True, False, 16),\n (False, True, 6),\n (False, False, 30),\n ):\n stations = station.nearest(30, -80, 30, airport, reports, 1.5)\n self.assertEqua...
[ "0.5917477", "0.5785617", "0.5634171", "0.5627542", "0.56037885", "0.54991764", "0.5456539", "0.54477155", "0.5431013", "0.53721654", "0.5309238", "0.52754253", "0.5254569", "0.52498955", "0.5234829", "0.520549", "0.520544", "0.51749706", "0.5160689", "0.5160598", "0.51577854...
0.6094638
0
Searches the provided modules for the named class and returns it.
def find_class_by_name(name, modules): modules = [getattr(module, name, None) for module in modules] return next(a for a in modules if a)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_class(class_name, module_paths=None):\n class_ = locate(class_name)\n if (class_ is None) and (module_paths is not None):\n for module_path in module_paths:\n class_ = locate('.'.join([module_path, class_name]))\n if class_ is not None:\n break\n\n if cl...
[ "0.799943", "0.78490835", "0.768902", "0.76566696", "0.7428545", "0.7255041", "0.71981335", "0.7016138", "0.690594", "0.6841157", "0.68327856", "0.6830363", "0.67620075", "0.67466897", "0.67217135", "0.6679323", "0.6639524", "0.6617279", "0.66102403", "0.64862704", "0.6444248...
0.8418128
0
Tests wholefunction forcedcompilation. This test checks that stateless_random_ can be used in forcedcompilation scenarios (e.g. TPU). The new version of stateless_random_ requires the intermediate tensor `alg` to be compiletime constant, so we need to check that this requirement won't prevent `seed` from depending on v...
def testForcedCompile(self): if config.list_logical_devices('TPU'): self.skipTest('To accommodate OSS, experimental_compile support for TPU ' 'is not linked in.') # GPU doesn't support int32 variables, so we use int64. v = variables.Variable([1, 2], dtype=dtypes.int64) @def_fu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testDistributionOfStatelessRandomUniform(self, alg, dtype, seed):\n philox = random_ops_util.Algorithm.PHILOX\n auto_select = random_ops_util.Algorithm.AUTO_SELECT\n device = xla_device()\n if 'CPU' in device.device_type:\n device_type = 'CPU'\n elif 'GPU' in device.device_type:\n devi...
[ "0.68754524", "0.59406036", "0.5894597", "0.58839476", "0.5882948", "0.5839431", "0.58107805", "0.5770772", "0.5769387", "0.57007724", "0.56494707", "0.5602415", "0.55889", "0.55538785", "0.5541321", "0.5540075", "0.55398744", "0.55398744", "0.55097663", "0.5445315", "0.54414...
0.75544333
0
Tests all values of `alg`.
def testAlg(self, op, alg_group): if config.list_logical_devices('TPU') or config.list_logical_devices('GPU'): self.skipTest('Only _cpu tests linked in support for jit_compile on CPU.') seed = [1, 2] shape = [2, 3] outputs = [] for alg in alg_group: with ops.device('CPU'): output...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testing():\n from random import randint\n algorithms = [dynamic_programming, patience_sort, lis]\n\n sequences = [[],\n [1, 2, 3, 4, 5],\n [5, 4, 3, 2, 1],\n [1, 1, 1, 1],\n [3, 2, 6, 4, 5, 1]]\n sequences.append([26, 65, 42, 18, 73, 7...
[ "0.5886989", "0.5785402", "0.56681657", "0.55894595", "0.5576564", "0.55730575", "0.55704665", "0.5555382", "0.55321616", "0.55156225", "0.54750127", "0.5433971", "0.54276794", "0.53705645", "0.5362628", "0.5354084", "0.53357923", "0.53281313", "0.5325226", "0.5306349", "0.52...
0.6314615
0
Tests an OOM bug of StatelessRandomNormalV2 on TPU.
def testLargeNormal(self): with self.session() as sess, self.test_scope(): seed_t = array_ops.placeholder(dtypes.int32, shape=[2]) key, counter, alg = (gen_stateless_random_ops_v2. stateless_random_get_key_counter_alg(seed_t)) x = gen_stateless_random_ops_v2.stateless_ra...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_random_small_sample_error(self):\n with self.assertRaises(ValueError):\n random_small_sample([], 1e7)", "def safe_rand(self):\n rand_n = np.random.rand()\n if rand_n == float(1):\n rand_n -= 1e-10\n return rand_n", "def test_rng_null(self):\n assert check_random_...
[ "0.6402965", "0.6271759", "0.6156134", "0.60297525", "0.60209405", "0.5990309", "0.5852385", "0.58344805", "0.58285826", "0.5805117", "0.5793341", "0.57845455", "0.5761305", "0.5755326", "0.56997", "0.567426", "0.56445813", "0.5642521", "0.56110024", "0.5595961", "0.55892664"...
0.68676966
0
Get all nearby patterns within hamming distance max_distance
def _get_neighbors(cls, pattern: str, max_distance: int) -> List[str]: return get_neighborhood(pattern, ''.join(cls.nucleobases.keys()), max_distance)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def neighbors(pattern, d):\n tides = set([\"A\", \"C\", \"G\", \"T\"])\n if d == 0:\n return set([pattern])\n if len(pattern) == 1:\n return tides\n neighborhood = set([])\n suffix_neighbors = neighbors(pattern[1:], d)\n for text in suffix_neighbors:\n if ham_dist(pattern[1:]...
[ "0.60756433", "0.586826", "0.5829426", "0.57467127", "0.5627865", "0.5625409", "0.5618249", "0.55964565", "0.5565963", "0.55327606", "0.54889137", "0.54708976", "0.5464563", "0.5462131", "0.53667754", "0.5361143", "0.5356188", "0.5352204", "0.53446394", "0.52754647", "0.52659...
0.6922144
0
Return whether a user has already voted
def has_voted(self, user): return user.choice_set.filter(vote=self).exists()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_voted(self, user, ip_address):\r\n if user.is_anonymous():\r\n return len(self.usedip_set.filter(address=ip_address))>0\r\n else:\r\n return self.is_expert(user) and self.expert_set.filter(user=user)[0].voted", "def vote_exists(self):\n con = psycopg2.connect(**...
[ "0.77529603", "0.7535864", "0.65836215", "0.6361191", "0.6361191", "0.62889564", "0.626759", "0.625303", "0.6251645", "0.62177384", "0.6179546", "0.61739177", "0.6148994", "0.6078883", "0.5977957", "0.5973656", "0.5966548", "0.58713126", "0.5856128", "0.584966", "0.58388305",...
0.84560186
0
Generates the common header XHTML
def header(style=u'default'): return (docType() + u'<html xmlns="http://www.w3.org/1999/xhtml">\n' u'<head>\n' u'<style type="text/css">\n' u' @import url(/css/exe.css);\n' u' @import url(/style/base.css);\n' u' @import url(/style/%s/conten...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def renderHeader(self, name):\n html = u\"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\\n\"\n html += u'<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 '\n html += u'Transitional//EN\" '\n html += u'\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\\n'\n html += u...
[ "0.74553525", "0.7425798", "0.7310361", "0.72088915", "0.7052019", "0.70107", "0.6935558", "0.6934121", "0.6880456", "0.67663515", "0.6619934", "0.6499455", "0.6466389", "0.6450139", "0.6448158", "0.644058", "0.63944995", "0.63919437", "0.63732743", "0.6343069", "0.633073", ...
0.7433771
1
Adds a hidden field to a form
def hiddenField(name, value=u""): html = u"<input type=\"hidden\" " html += u"name=\"%s\" " % name html += u"id=\"%s\" " % name html += u"value=\"%s\"/>\n" % value return html
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def form_Hidden(request):\n schema = schemaish.Structure()\n schema.add('Visible', schemaish.String())\n schema.add('Hidden', schemaish.String())\n\n form = formish.Form(schema, 'form')\n form['Hidden'].widget = formish.Hidden()\n return form", "def add_hidden_input(\n self,\n nam...
[ "0.7501152", "0.70271856", "0.65093476", "0.65093476", "0.65093476", "0.6465911", "0.63139683", "0.6194723", "0.6082944", "0.6055618", "0.59255236", "0.5911473", "0.56137574", "0.5548985", "0.55037236", "0.54748195", "0.53836066", "0.53755033", "0.53438234", "0.5320544", "0.5...
0.73137796
1
Adds a text area to a form
def textArea(name, value="", disabled="", cols="80", rows="8"): log.debug(u"textArea %s" % value) html = u'<textarea name="%s" ' % name html += 'id = "%s"' % name if disabled: html += u'disabled="disabled" ' html += u'style=\"width:100%"' html += u'cols="%s" rows="%s">' %(cols, rows) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def form_TextAreaColsAndRows(request):\n schema = schemaish.Structure()\n schema.add('textAreaCustom', schemaish.String())\n\n form = formish.Form(schema, 'form')\n form['textAreaCustom'].widget = formish.TextArea(cols=20,rows=4)\n return form", "def form_TextAreaStrip(request):\n schema = sche...
[ "0.70033205", "0.65260094", "0.64773655", "0.63208395", "0.614079", "0.6058951", "0.60212314", "0.59914464", "0.5919031", "0.584087", "0.5834448", "0.57610804", "0.57148194", "0.5706627", "0.5695541", "0.5676627", "0.5663998", "0.5651863", "0.5630527", "0.5580933", "0.5561570...
0.6582529
1
Returns the XHTML for flash. 'params' is a dictionary of name, value pairs that will be turned into a bunch of tags
def flash(src, width, height, id_=None, params=None, **kwparams): log.debug(u"flash %s" % src) stan = \ T._object(type='application/x-shockwave-flash', width=width, height=height, **kwparams) if id_: stan.attributes['id'] = id_ stan.attr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flash_message(self, request):\n return FlashMessagesElement()", "def flash_message(self, request):\n return FlashMessagesElement()", "def mediaplayer(src,width=400,height=250):\n return XML('<embed allowfullscreen=\"true\" allowscriptaccess=\"always\" flashvars=\"height=%(height)s&widt...
[ "0.57332635", "0.57332635", "0.54264164", "0.5292242", "0.52749646", "0.52352464", "0.52238834", "0.5138303", "0.5057226", "0.49932578", "0.48965406", "0.48927727", "0.48299986", "0.4776292", "0.4755645", "0.4748481", "0.47427863", "0.47350845", "0.46903166", "0.46795943", "0...
0.6152918
0
Adds a feedback button
def feedbackButton(name, value=None, enabled=True, **kwparams): if value is None: value = _(u'Feedback') kwparams.setdefault('class', 'feedbackbutton') return button(name, value, enabled, **kwparams)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def feedback():\n return render_template(\"feedback.html\")", "async def feedback(self, ctx, *, feedback):\n url = os.environ.get(\"FEEDBACK_WEBHOOK\", None)\n if url:\n webhook = Webhook.from_url(url, adapter=RequestsWebhookAdapter())\n embed = discord.Embed(description=fe...
[ "0.6485179", "0.6422864", "0.63804656", "0.61001223", "0.60035086", "0.5993185", "0.5932232", "0.59071183", "0.58853", "0.58728164", "0.5863927", "0.57498777", "0.5733604", "0.5621053", "0.5585151", "0.5584186", "0.5577006", "0.55740017", "0.5564906", "0.555417", "0.5552995",...
0.7189924
0
Adds an image link which will trigger the javascript needed to post a form with the action and object passed in the args
def submitImage(action, object_, imageFile, title=u"", isChanged=1): onclick = "submitLink('%s', '%s', %d);" % (action, object_, isChanged) titleText = u'' if title: titleText = u'title="%s" ' % title html = u'<a %s' % titleText html += u' href="#" onclick="%s">' % onclick html += u'<im...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def confirmThenSubmitImage(message, action, object_, imageFile, \n title=u\"\", isChanged=1):\n html = u\"<a \"\n if title:\n html += u\"title=\\\"\"+title+\"\\\" \"\n html += \" href=\\\"#\\\" \"\n html += \"onclick=\\\"confirmThenSubmitLink('\"+message+\"', '\"+actio...
[ "0.6467419", "0.6291856", "0.5695191", "0.55512077", "0.54058975", "0.54002887", "0.5396562", "0.5381138", "0.5377608", "0.5334084", "0.52907336", "0.52907336", "0.52527887", "0.524726", "0.5207052", "0.51895213", "0.51895213", "0.51895213", "0.51895213", "0.5137885", "0.5096...
0.75600076
0
Adds an image link which will trigger the javascript needed to post a form with the action and object passed in the args
def confirmThenSubmitImage(message, action, object_, imageFile, title=u"", isChanged=1): html = u"<a " if title: html += u"title=\""+title+"\" " html += " href=\"#\" " html += "onclick=\"confirmThenSubmitLink('"+message+"', '"+action+"', " html += "'"+object_+"',...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def submitImage(action, object_, imageFile, title=u\"\", isChanged=1):\n onclick = \"submitLink('%s', '%s', %d);\" % (action, object_, isChanged)\n titleText = u''\n if title:\n titleText = u'title=\"%s\" ' % title\n html = u'<a %s' % titleText\n html += u' href=\"#\" onclick=\"%s\">' % oncl...
[ "0.75593275", "0.62918144", "0.56968886", "0.5551059", "0.5405228", "0.5401838", "0.5398058", "0.5381089", "0.53773266", "0.5335524", "0.5290609", "0.5290609", "0.52529365", "0.52459806", "0.52074254", "0.51923656", "0.51923656", "0.51923656", "0.51923656", "0.51381063", "0.5...
0.6467512
1
A standard way for showing any form field nicely
def formField(type_, caption, action, object_='', instruction='', *args, **kwargs): html = '<div class="block">' html += '<strong>%s</strong>' % caption if instruction: html += elementInstruc(instruction) html += '</div>' html += '<div class="block">' if type_ == 'select': html ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def html(self):\n lbl = escape(self._label)\n dis = ('disabled' if not self._enabled else '')\n typ = ('password' if self._password else 'text')\n nam = escape(self._name)\n val = escape(self._value)\n return '%s <input name=\"%s\" %s type=\"%s\" value=\"%s\" size=\"%i\">' % (lbl, nam, dis, typ, ...
[ "0.6636922", "0.6503447", "0.6492283", "0.64133143", "0.64047253", "0.64039874", "0.6366983", "0.62991357", "0.62760854", "0.6225514", "0.61878324", "0.6112394", "0.6105818", "0.6105642", "0.6099386", "0.6054292", "0.6020611", "0.5959966", "0.59108335", "0.58825946", "0.58703...
0.68652034
0
Provides a styled editSectionHeading
def editModeHeading(text): return u'<p style="editModeHeading">%s</p>' % text
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def heading(self):\n return self.wrap(\"-------\")", "def format_heading(self, level, text):\n underlining = ['=', '-', '~', ][level-1] * len(text)\n return '%s\\n%s\\n\\n' % (text, underlining)", "def print_section_header(title, color):\n block = \"#\" * (len(title) + 2)\n print(\"\...
[ "0.66849434", "0.6272026", "0.6106788", "0.61038226", "0.60833454", "0.6072701", "0.5986174", "0.59668994", "0.5961167", "0.594331", "0.5935845", "0.5911637", "0.58749354", "0.58624434", "0.5846889", "0.5835326", "0.5825542", "0.58238256", "0.5794538", "0.57842624", "0.578426...
0.67918336
0
Returns the standard InChI string and InChI auxInfo for a molecule
def MolToInchiAndAuxInfo(mol, options="", logLevel=None, treatWarningAsError=False): inchi, retcode, message, logs, aux = rdinchi.MolToInchi(mol, options) if logLevel is not None: if logLevel not in logLevelToLogFunctionLookup: raise ValueError("Unsupported log level: %d" % logLevel) log = logLevelToL...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inchi(self) -> str:\n if not self._inchi:\n self.sanitize(raise_exception=False)\n self._inchi = Chem.MolToInchi(self.rd_mol)\n if self._inchi is None:\n raise MoleculeException(\"Could not make InChI\")\n return self._inchi", "def MolToInchi(mol,...
[ "0.6346383", "0.5750787", "0.57444793", "0.5686185", "0.56063706", "0.56049293", "0.55815786", "0.55815786", "0.5549947", "0.5546916", "0.5512506", "0.54929435", "0.5482103", "0.5443629", "0.54201764", "0.5419237", "0.5418019", "0.533771", "0.52724075", "0.5272198", "0.523930...
0.58500123
1
Returns the standard InChI string and InChI auxInfo for a mol block
def MolBlockToInchiAndAuxInfo(molblock, options="", logLevel=None, treatWarningAsError=False): inchi, retcode, message, logs, aux = rdinchi.MolBlockToInchi(molblock, options) if logLevel is not None: if logLevel not in logLevelToLogFunctionLookup: raise ValueError("Unsupported log level: %d" % logLevel) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def MolBlockToInchi(molblock, options=\"\", logLevel=None, treatWarningAsError=False):\n if options.find('AuxNone') == -1:\n if options:\n options += \" /AuxNone\"\n else:\n options += \"/AuxNone\"\n\n try:\n inchi, aux = MolBlockToInchiAndAuxInfo(molblock, options, logLevel=logLevel,\n ...
[ "0.64976436", "0.60744226", "0.6004788", "0.57994264", "0.5761588", "0.5618919", "0.554857", "0.5285582", "0.52573204", "0.52302134", "0.51718366", "0.5170532", "0.515442", "0.51395327", "0.5137501", "0.5132895", "0.5129088", "0.51100504", "0.5109222", "0.5099051", "0.5088721...
0.64511925
1
Return the InChI key for the given InChI string. Return None on error
def InchiToInchiKey(inchi): ret = rdinchi.InchiToInchiKey(inchi) if ret: return ret else: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inchi_to_inchi_key(ich):\n return _rd_chem.inchi.InchiToInchiKey(ich)", "def inchi_key(self) -> str:\n if not self._inchi_key:\n self.sanitize(raise_exception=False)\n self._inchi_key = Chem.MolToInchiKey(self.rd_mol)\n if self._inchi_key is None:\n r...
[ "0.71598774", "0.7087606", "0.70870805", "0.67726326", "0.66098547", "0.6378951", "0.62275", "0.61656976", "0.59837407", "0.587364", "0.5690562", "0.5690562", "0.5690562", "0.5690562", "0.5690562", "0.5690562", "0.5690562", "0.5690562", "0.5690562", "0.5690562", "0.5690562", ...
0.7775047
0
Returns the standard InChI key for a molecule
def MolToInchiKey(mol, options=""): return rdinchi.MolToInchiKey(mol,options)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inchi_key(self) -> str:\n if not self._inchi_key:\n self.sanitize(raise_exception=False)\n self._inchi_key = Chem.MolToInchiKey(self.rd_mol)\n if self._inchi_key is None:\n raise MoleculeException(\"Could not make InChI key\")\n return self._inchi_k...
[ "0.81321317", "0.7113956", "0.6988666", "0.68637294", "0.6657926", "0.6496378", "0.6411273", "0.6411273", "0.6411273", "0.6411273", "0.6411273", "0.6411273", "0.6411273", "0.6411273", "0.6411273", "0.6411273", "0.6411273", "0.6411273", "0.6411273", "0.6411273", "0.6411273", ...
0.7232959
1
Compute the accuracies for a batch of predictions and answers
def batch_accuracy(predicted, true): _, predicted_index = predicted.max(dim=1, keepdim=True) agreeing = true.gather(dim=1, index=predicted_index) ''' Acc needs to be averaged over all 10 choose 9 subsets of human answers. While we could just use a loop, surely this can be done more efficiently (and ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eval_metrics_for_multiclass(self, predicted_answers):\n total_correct_in_all = 0\n total_pred_in_all = len(predicted_answers)\n # initial a dict for total correct in topK counting.\n total_correct_in_topK = dict([(i, 0) for i in self.topK_list])\n total_pred_in_topK = dict([...
[ "0.72240007", "0.7196117", "0.7156245", "0.71237266", "0.7044354", "0.7011002", "0.69618726", "0.69563323", "0.69142157", "0.6911175", "0.69000417", "0.6897008", "0.6889631", "0.68849134", "0.6882984", "0.68819773", "0.68688965", "0.6854075", "0.6837835", "0.68339974", "0.681...
0.7324437
0
The training procedure that starts from training target model, then launchs baseline membership inference attack
def train_and_attack(args): mem_data, non_mem_data = get_data() num_classes = 10 model = paddle.Model(ResNet(num_classes)) # train model model.prepare(paddle.optimizer.Adam(parameters=model.parameters(), learning_rate=args.train_lr), paddle.nn.CrossEntropyLoss(), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(self) -> None:\n self.model = self.trainer.train_model(self.model, self.data)", "def train():\n # YOUR TRAINING CODE GOES HERE", "def train():\n pass", "def training(self) -> None:\n self.compile_model()\n self.train_epoch()\n self.agent.save()", "def train_nai...
[ "0.6831418", "0.67969114", "0.6743277", "0.6665565", "0.65510994", "0.6513925", "0.6478302", "0.6475857", "0.6475857", "0.6475857", "0.6475857", "0.6475857", "0.6414337", "0.6410145", "0.6364995", "0.6352841", "0.6326412", "0.63112336", "0.6307469", "0.6284598", "0.6273873", ...
0.73666734
0
Implement signal generation method
def generateSignal(self, input): raise NotImplementedError("generateSignals() not implemented!")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_signals(self):\n\n raise NotImplementedError('''\n Must implement generate_signals. Call help() for details.\n ''')", "def _generate_signal(self):\n x = np.arange(self.n, dtype='float')\n resample = np.random.rand(self.n) >= self.proba\n resample[0] = Tr...
[ "0.70712364", "0.685625", "0.6824514", "0.67229414", "0.66387045", "0.64469135", "0.6422895", "0.63325095", "0.630998", "0.62810314", "0.61788267", "0.6141524", "0.60813624", "0.6066498", "0.6045314", "0.6020478", "0.60055816", "0.59975064", "0.599733", "0.59551203", "0.59359...
0.77800155
0
Return all valid assignment statuses
def valid() -> List[str]: return [ AssignmentState.CREATED, AssignmentState.LAUNCHED, AssignmentState.ASSIGNED, AssignmentState.COMPLETED, AssignmentState.ACCEPTED, AssignmentState.MIXED, AssignmentState.REJECTED, As...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_assignment_completion_status(self, assignments):\n\n status_summary = {}\n\n for a in assignments:\n project_id = a.project_id\n user_id = a.user_id\n lof_labels_for_assignment = self._get_users_labels_for_assignment(project_id,\n ...
[ "0.70143026", "0.6910826", "0.6844077", "0.68170166", "0.68170166", "0.6687421", "0.6442801", "0.6300295", "0.62620544", "0.62461126", "0.6133815", "0.6131959", "0.609542", "0.6061567", "0.60590816", "0.60590816", "0.5903232", "0.5902111", "0.5862888", "0.5786772", "0.5783396...
0.7898887
0
Return all statuses that are considered incomplete
def incomplete() -> List[str]: return [ AssignmentState.CREATED, AssignmentState.LAUNCHED, AssignmentState.ASSIGNED, ]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stalled(self):\n oneHourAgo = datetime.today() - timedelta(hours = 1)\n return self.filter(status=m.Update.IN_PROGRESS, requestedAt__lte=oneHourAgo)", "def valid_statuses(self):\n return [\n \"dish_maintenance\",\n \"dish_ok\",\n \"RF_maintenance\",\n ...
[ "0.64917", "0.6279671", "0.62576777", "0.6151896", "0.61158884", "0.61158884", "0.6105256", "0.58749634", "0.5759064", "0.5759049", "0.57464796", "0.5656729", "0.5593512", "0.5588268", "0.55776554", "0.55524373", "0.5532122", "0.55231184", "0.54844177", "0.5471768", "0.546771...
0.6704028
0
Return all statuses that are valids for a Unit
def valid_unit() -> List[str]: return [ AssignmentState.CREATED, AssignmentState.LAUNCHED, AssignmentState.ASSIGNED, AssignmentState.COMPLETED, AssignmentState.ACCEPTED, AssignmentState.REJECTED, AssignmentState.SOFT_REJECTED, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid_statuses(self):\n return [\n \"dish_maintenance\",\n \"dish_ok\",\n \"RF_maintenance\",\n \"RF_ok\",\n \"digital_maintenance\",\n \"digital_ok\",\n \"calibration_maintenance\",\n \"calibration_ok\",\n ...
[ "0.656063", "0.5927815", "0.5911592", "0.5833105", "0.58151245", "0.57673633", "0.5725099", "0.5665793", "0.5665793", "0.5660064", "0.55945444", "0.553925", "0.55057263", "0.5491091", "0.54821205", "0.54818356", "0.5468045", "0.5451015", "0.5422831", "0.54221743", "0.536189",...
0.7242456
0
Returns if the next K elements exists in a list given a NODE
def is_group_valid(node, k): counter = 0 while node.next is not None and counter < k: node = node.next counter += 1 return counter == k
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_element_of(node, lst):\n for k in lst:\n if node is k:\n return True\n return False", "def my_func(k: int, lst: List) -> bool:\n\n if not len(lst) > 0:\n raise ValueError(\"Parameter 'lst' must have at least 2 elements\")\n\n try:\n for x in lst:\n fo...
[ "0.69980997", "0.64902776", "0.64226055", "0.61012685", "0.60695064", "0.6065002", "0.60114795", "0.5890691", "0.588333", "0.5854959", "0.58148426", "0.57728654", "0.577021", "0.57222736", "0.57114935", "0.57027185", "0.57027185", "0.5697907", "0.5697862", "0.56517047", "0.56...
0.65423954
1
Reverses a group of length K given a GROUP_HEAD, returning the new HEAD, new TAIL, and the next element that was detached.
def reverse_group(group_head, k): counter = 0 group_head.next = None previous_node = group_head next_node = previous_node.next_node while counter < k: new_next_node = new_node.next next_node.next = previous_node previous_node = next_node next_node = new_next_node ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reverseList(head, k) :\n\n ptr = head\n new_head = None\n new_tail = None\n \n num_reverse = (n % k) if (n%k) != 0 else k\n while ptr :\n \n left_portion_start = ptr\n \n i = 1\n while ptr.next and i < num_reverse :\n ptr = ptr.next\n i...
[ "0.5858687", "0.56919616", "0.56714123", "0.54803526", "0.546783", "0.52534944", "0.519177", "0.51836807", "0.5168894", "0.5149832", "0.51307", "0.51258576", "0.5063978", "0.5059032", "0.505075", "0.50137126", "0.50092584", "0.50075793", "0.498712", "0.496472", "0.4932703", ...
0.8169252
0
Compute the cross entropy loss given outputs and labels.
def loss_fn(outputs, labels): return nn.CrossEntropyLoss()(outputs, labels)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cross_entropy_loss(outputs, labels): \n# works properly\n \n m = labels.shape[0]\n p = outputs\n log_likelihood = -1*torch.log(p[range(m),labels])\n loss = torch.sum(log_likelihood) / m\n return loss.item()", "def loss_fn(outputs, labels, wts):\n\n # reshape labels to give a flat vecto...
[ "0.8123369", "0.78822637", "0.78552246", "0.76500595", "0.76134384", "0.7363692", "0.73583025", "0.73449636", "0.7331515", "0.7310738", "0.72997314", "0.7284572", "0.7263381", "0.7261452", "0.7139764", "0.71252644", "0.71147245", "0.7082844", "0.707002", "0.7058059", "0.70415...
0.8459237
0
Return true if in service mode.
def is_in_service(self) -> bool: return self._enabled
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __some_alive(self):\n for service in self.__services.values():\n if service.is_alive():\n return True\n return False", "def _interesting_service(self, service: UpnpService) -> bool:\n service_type = service.service_type\n for service_types in self._SERVIC...
[ "0.6862805", "0.6793361", "0.67728746", "0.6701036", "0.66946507", "0.66204697", "0.65540534", "0.6552107", "0.6548141", "0.65428823", "0.6535179", "0.6533675", "0.6501911", "0.6458908", "0.6420852", "0.6314876", "0.63050145", "0.6295161", "0.62929493", "0.62170863", "0.62095...
0.812418
0
Add an alert about a technical problem.
def add_technical_alert(self, device, issue): del device del issue # this is prepared but not yet implemented in service mode
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def requestAlert(self, text=\"Error\", buttons=None):\n\t\tself.alerts.append((text, buttons))", "def add_alerts(self):", "def add_alert(self, content):\n self._add_content(html_alert(content))", "def send_alert(self, level, title, additional_data):\n\n full_title = \"{}: {}\".format(self.build...
[ "0.61283493", "0.5944216", "0.56979954", "0.56085527", "0.55186415", "0.5486692", "0.539759", "0.5389057", "0.5285975", "0.5193649", "0.5193604", "0.5187262", "0.5168358", "0.5166665", "0.5079088", "0.50631", "0.50447834", "0.5036596", "0.50321543", "0.5027627", "0.50111544",...
0.726797
0
Return a map of all coils in the machine.
def get_coil_map(self, do_sort=True) -> List[CoilMap]: coil_map = [] for coil in self.machine.coils.values(): assert coil.hw_driver is not None coil_map.append(CoilMap(coil.hw_driver.get_board_name(), coil)) # sort by board + driver number if do_sort: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_cliffs(self):\n cliff_list = Cliff.list()\n rtn = {}\n\n for clf in cliff_list:\n rtn[clf] = self.read_cliff(clf)\n\n return rtn", "def councils(self):\n catalog = getToolByName(self.context, 'portal_catalog')\n\n return [dict(url=council.getURL(), ti...
[ "0.61735106", "0.6158383", "0.6126377", "0.6033344", "0.5983551", "0.59124845", "0.58763355", "0.57980853", "0.57952774", "0.57756484", "0.56649864", "0.5617694", "0.55903614", "0.5582277", "0.5558947", "0.5551839", "0.5548989", "0.55406815", "0.55191165", "0.5518905", "0.549...
0.6748809
0
This function creates a new movie record in the DB
def create(movie): schema = MovieSchema() new_movie = schema.load(movie, session=db.session) # Add the new movie record to the database db.session.add(new_movie) db.session.commit() # Return the newly created record in the response data = schema.dump(new_movie) return data, 201
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_movie(input_title, input_overview, input_release_date, input_poster_path):\n \n movie = Movie(title=input_title, overview=input_overview, release_date=input_release_date, poster_path=input_poster_path)\n\n db.session.add(movie)\n db.session.commit()\n\n return movie", "def create_movie(...
[ "0.7874085", "0.78123325", "0.76599956", "0.73156875", "0.7210305", "0.720738", "0.7147179", "0.7054669", "0.69906896", "0.6978543", "0.69119096", "0.6850396", "0.67323774", "0.6692045", "0.6638124", "0.66215795", "0.65686864", "0.6558507", "0.6555675", "0.6542822", "0.650204...
0.8181835
0
This function deletes a movie from the Database The method will always succeed, because we want idempotent delete
def delete(movie_id): # Get the movie requested movie = Movie.query.filter(Movie.movie_id == movie_id).one_or_none() if movie is not None: db.session.delete(movie) db.session.commit() return "", 200
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_movie():\n id = request.params.get('id')\n mongo_mgr.remove_film_from_user(id, aaa.current_user.id)", "def test_delete_movie(self):\n # add movie to update -- this functionality requires the executive\n # producer token\n res = self.client().post('/movies', headers={\n ...
[ "0.7769285", "0.7741501", "0.77175105", "0.76620966", "0.7380153", "0.7365287", "0.7278483", "0.7272325", "0.71963173", "0.70115995", "0.69912124", "0.69016904", "0.6759788", "0.6758979", "0.6728785", "0.671315", "0.6663361", "0.6526206", "0.6491936", "0.6491221", "0.6486579"...
0.80962527
0
Compute the rating likelihood probability distribution of Y given X where Y is an individual rating (takes on a value in {0, 1, ..., M1}), and X is the hidden true/inherent rating of a movie (also takes on a value in {0, 1, ..., M1}). Please refer to the instructions of the project to see what the likelihood for rating...
def compute_movie_rating_likelihood(M): # define the size to begin with likelihood = np.zeros((M, M)) # ------------------------------------------------------------------------- # YOUR CODE GOES HERE FOR PART (c) # # Remember to normalize the likelihood, so that each column is a # probabil...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def infer_true_movie_ratings(num_observations=-1):\n\n M = 11 # all of our ratings are between 0 and 10\n prior = np.array([1.0 / M] * M) # uniform distribution\n likelihood = compute_movie_rating_likelihood(M)\n\n # get the list of all movie IDs to process\n movie_id_list = movie_data_helper.get_...
[ "0.6651372", "0.64923996", "0.6368747", "0.6227888", "0.60699147", "0.606234", "0.6056535", "0.6044773", "0.6008728", "0.5998901", "0.598668", "0.5961036", "0.59381664", "0.5892908", "0.58896697", "0.58854824", "0.58576494", "0.5855964", "0.58468914", "0.58361566", "0.5829488...
0.75495005
0
For every movie, computes the posterior distribution and MAP estimate of the movie's true/inherent rating given the movie's observed ratings. Input
def infer_true_movie_ratings(num_observations=-1): M = 11 # all of our ratings are between 0 and 10 prior = np.array([1.0 / M] * M) # uniform distribution likelihood = compute_movie_rating_likelihood(M) # get the list of all movie IDs to process movie_id_list = movie_data_helper.get_movie_id_lis...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def predict_rating(self, movie):\n\n #\n # option 1: SQLAlchemy ORM\n #\n UserMovies = db.aliased(Rating)\n MovieUsers = db.aliased(Rating)\n\n query = (db.session.query(Rating.user_id, Rating.score, UserMovies.score, MovieUsers.score)\n .join(UserMovies, U...
[ "0.6833105", "0.67717224", "0.65626323", "0.62562567", "0.6245194", "0.6105975", "0.60951227", "0.60900235", "0.6040918", "0.5983867", "0.59045374", "0.58595026", "0.5855716", "0.5835745", "0.5835745", "0.58348227", "0.5734984", "0.5729565", "0.57091314", "0.5681885", "0.5681...
0.7685785
0
Evaluates the state for the player with the given row
def evaluate(self, state, my_row): stoneonmyside = 0.00 stoneonopside = 0.00 result = 0.00 for a in range(0,state.M+1): stoneonmyside += state.board[a] for a in range(state.M+1, 2*(state.M)+1): stoneonopside += state.board[a] if my_row == 0: result = (stoneonmyside - stoneonopside) / (2*(state....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluate(self, state, my_row):\n myStones = 0.0\n opponentStones = 0.0\n for i in range(len(state.board)):\n if my_row == 0:\n if i <= State.M:\n myStones += state.board[i]\n else:\n opponentStones += state.boar...
[ "0.6999296", "0.6501366", "0.6476799", "0.6461873", "0.6389604", "0.63032645", "0.62785196", "0.62500495", "0.6232211", "0.6228227", "0.6160248", "0.61407185", "0.6129514", "0.59984934", "0.5966352", "0.59632826", "0.59607756", "0.5958547", "0.595793", "0.5954501", "0.5954304...
0.654148
1
Evaluate expression, try interpret undefined variable as column label of hintvar.
def evaluate_with_hintvar(self, hintvar=None): self.hintvalue = hintvar self.m_locals['col'] = lambda x: model.util.loc_col_str(self.hintvalue, str(x)) self.m_locals['cols'] = lambda x: model.util.loc_col_wildcard(self.hintvalue, str(x)) self.m_locals['hint'] = lambda: self.hintvalue ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_undefined_vars(self):\r\n variables = {'R1': 2.0, 'R3': 4.0}\r\n\r\n with self.assertRaisesRegexp(calc.UndefinedVariable, 'QWSEKO'):\r\n calc.evaluator({}, {}, \"5+7*QWSEKO\")\r\n with self.assertRaisesRegexp(calc.UndefinedVariable, 'r2'):\r\n calc.evaluator({'r1...
[ "0.59284544", "0.531087", "0.5252986", "0.5238921", "0.5207967", "0.52056307", "0.51976365", "0.5167777", "0.5151357", "0.511533", "0.49908173", "0.49555138", "0.49305037", "0.49269688", "0.49070445", "0.48973075", "0.4878731", "0.48532164", "0.48215866", "0.47968546", "0.478...
0.69425213
0
Creates a new row by making a new instance of RowClass out of row_dict and kwargs Ignores keyvalue pairs with list values
def row_constructor(RowClass, row_dict={}, **kwargs): valid_row_dict = dict((key, val) for key, val in row_dict.items() if type(val) is not list) return RowClass(**valid_row_dict, **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deserialize(cls, row: Dict):\n return cls(row)", "def create_from_row(cls, row: pd.Series) -> \"Action\":\n fields = [\n key\n for key, value in cls.__dataclass_fields__.items()\n if value.type != ClassVar\n ]\n d = {key: value for key, value in ro...
[ "0.67752624", "0.67089057", "0.66670537", "0.6566741", "0.64782006", "0.64717084", "0.64357233", "0.64337045", "0.6295816", "0.62405753", "0.6211598", "0.62066907", "0.6147813", "0.6129152", "0.6111731", "0.6024918", "0.6005934", "0.5991014", "0.5965978", "0.592485", "0.58983...
0.82523
0
Evaluates script provided in the header, given the arguments provided in the sequence of RowData objects, the request.
def EvaluateScript(self, header, request, context): # Retrieve function type func_type = self.get_func_type(header) # Retrieve data types from header arg_types = self.get_arg_types(header) ret_type = self.get_return_type(header) logging.info('EvaluateScript: {} ({} {}) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluate(self, script, ret_type, params=[]):\n # Evaluate script\n result = eval(script, {'args': params, 'numpy': numpy})\n logging.debug('Result: {}'.format(result))\n\n bundledRows = SSE.BundledRows()\n if isinstance(result, str) or not hasattr(result, '__iter__'):\n ...
[ "0.5672874", "0.5321719", "0.5199288", "0.5112893", "0.51101923", "0.5086698", "0.50556666", "0.5041273", "0.5037043", "0.5030938", "0.50295895", "0.50164515", "0.49762636", "0.49678123", "0.49415082", "0.4883817", "0.4866478", "0.486476", "0.48512733", "0.48477733", "0.48474...
0.80323666
0
Gets the array of arguments based on the duals, and the type (string, numeric) specified in the header.
def get_arguments(context, arg_types, duals, header): if arg_types == ArgType.String: # All parameters are of string type script_args = [d.strData for d in duals] elif arg_types == ArgType.Numeric: # All parameters are of numeric type script_args = [d.num...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_arg_types(header):\n data_types = [param.dataType for param in header.params]\n\n if not data_types:\n return ArgType.Empty\n elif len(set(data_types)) > 1 or all(data_type == SSE.DUAL for data_type in data_types):\n return ArgType.Mixed\n elif all(data_typ...
[ "0.60939234", "0.5730771", "0.5688855", "0.56779844", "0.5576366", "0.55762005", "0.55699354", "0.54309654", "0.5424725", "0.53861606", "0.53861606", "0.53777516", "0.5362959", "0.53616136", "0.5322445", "0.5303704", "0.52627987", "0.5261432", "0.5249535", "0.5240755", "0.521...
0.782661
0
Evaluates a script with given parameters and construct the result to a Row of duals.
def evaluate(self, script, ret_type, params=[]): # Evaluate script result = eval(script, {'args': params, 'numpy': numpy}) logging.debug('Result: {}'.format(result)) bundledRows = SSE.BundledRows() if isinstance(result, str) or not hasattr(result, '__iter__'): # A si...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def EvaluateScript(self, header, request, context):\n # Retrieve function type\n func_type = self.get_func_type(header)\n\n # Retrieve data types from header\n arg_types = self.get_arg_types(header)\n ret_type = self.get_return_type(header)\n\n logging.info('EvaluateScript...
[ "0.6015507", "0.5322008", "0.5254576", "0.51341265", "0.4956633", "0.49006158", "0.48540375", "0.48286295", "0.48148042", "0.47891203", "0.47660857", "0.4732252", "0.47256294", "0.47207665", "0.47147837", "0.4680894", "0.46803862", "0.4657566", "0.46573547", "0.46534434", "0....
0.7702706
0
Adds string constraints to the puppet.
def add_string_constraints(self, shoulders=True, hands=False, knees=False): strings = [] if shoulders: strings.extend([tc.surfaces.Distance(self, 'Left Torso Hook', 'Left Torso Spindle', 'LeftShoulderString', invalid='long'), tc.surfaces.Distan...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_constraints(self, constraints):\n for const in constraints:\n self.add_constraint(const.type, const.column, const.check_clause)", "def addConstrs(self, constrs, name=''):\n ...", "def add_constraint(self, constraint):\n constraint_type = constraint[0]\n if constra...
[ "0.5748878", "0.572449", "0.54346013", "0.5407176", "0.54051507", "0.53580767", "0.53114223", "0.5225109", "0.52087724", "0.51949704", "0.5179917", "0.5163777", "0.5154891", "0.5153501", "0.51130545", "0.506719", "0.502777", "0.49863383", "0.49863383", "0.4974188", "0.4957412...
0.57676655
0
Initialzes the configuration based on number of strings. Activates the string constraints.
def init_config(self, add_strings): q0 = {'TorsoZ': 10.0} if add_strings['shoulders']: q0.update({'LeftShoulderString': 13.34, 'RightShoulderString': 13.34}) # If there are strings on the hands, we want the elbows bent. Otherwise, straight at the sides. ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_strings(self, config_dict):\n\n # print(config_dict)\n self.string_cond.update(config_dict)", "def __init__(self, strings):\n self.strings = strings", "def __init__(self):\n self.iteration_deep = 0\n self.max_iteration_deep = 2\n self.max_dict_key_length = 10...
[ "0.5682287", "0.5160074", "0.5144449", "0.51122385", "0.51122385", "0.510941", "0.5101239", "0.5072267", "0.5072267", "0.5046157", "0.5018387", "0.49941292", "0.49836668", "0.496977", "0.49088556", "0.48971248", "0.4884416", "0.4863736", "0.48507494", "0.48301223", "0.4816057...
0.6295696
0