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
Returns the probability of curr ngram, given prev ngram. e.g. P(prev+curr|prev)
def Pngram(self, curr, prev): # Penalize for spaces to give more influence to building words if curr == SPACE*2 or prev == SPACE*2: return self.min_value if prev[-1] == SPACE: prev = SPACE*2 if curr[0] == SPACE: curr = SPACE*2 # Could impleme...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def word_probability(self, word, prev):\n bg = \"{} {}\".format(prev, word)\n p_c = self.model[word] if word in self.model else 1e-10 \n p_cw = self.bigrams[bg] if bg in self.bigrams else 1e-10 \n p = p_c * p_cw if prev else p_c\n return p", "def estimate_probability(word, prev...
[ "0.73266536", "0.69812423", "0.68827367", "0.6861786", "0.6690899", "0.66197664", "0.6422066", "0.6417808", "0.6359895", "0.63190407", "0.6308393", "0.6282323", "0.6276786", "0.6249632", "0.61448574", "0.61228746", "0.6106884", "0.60913527", "0.607965", "0.6070805", "0.606580...
0.7935357
0
Plot the first few weights as matrices. `weights` should be an array of shape (output_dim, input_dim), i.e. `weights[i,j]` is the weight connecting the $j$th neuron of a layer $n$ to the $i$th neuron of the $n+1$ layer. Namely, all the weights connected to the $i$th output neuron are the ones in the $i$th row of `weigh...
def draw_weights(weights : np.ndarray, reshape_dim : tuple[int, int] = (28, 28), max_per_row : int = 5, max_rows : int = 5): #import from helper #Shape of weights is (output_dim, input_dim) nc = np.max(np.abs(weights)) #(Absolute) range of weights ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_weights(input, weights, nrows, ncols, shape, out_path=None,\r\n\tshow=True):\r\n\t\r\n\t# Construct the basic plot\r\n\tfig = plt.figure(figsize=(16, 8))\r\n\tgs = gridspec.GridSpec(nrows, ncols + 2, wspace=0, hspace=0.5)\r\n\t\r\n\tax = plt.subplot(gs[nrows/2, 0])\r\n\tax.imshow(input.reshape(shape), cma...
[ "0.5800919", "0.5654372", "0.5599497", "0.5537731", "0.5039131", "0.5035792", "0.49482757", "0.48810765", "0.48718238", "0.4838093", "0.47592998", "0.47370803", "0.47356096", "0.47200862", "0.47039303", "0.46986285", "0.46673578", "0.46432695", "0.4599174", "0.45958695", "0.4...
0.7613167
0
call l, = plt.loglog(x, y) label_line(l, "text", near_x=0.32)
def label_line(line, label_text, ax, near_i=None, near_x=None, near_y=None, rotation_offset=0, offset=(0,0)): def put_label(i): """put label at given index""" i = min(i, len(x)-2) dx = sx[i+1] - sx[i] dy = sy[i+1] - sy[i] rotation = np.rad2deg(math.atan2(dy, dx)) + rotation_o...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_loglog(ax, x, y, title='', xlabel='', ylabel='', show_corr=True, **kwargs):\n xs = []\n ys = []\n for i, j in zip(x, y):\n # remove 0-pairs\n if not (abs(i) < 1e-15 or abs(j) < 1e-15):\n xs.append(i)\n ys.append(j)\n\n ax.loglo...
[ "0.7067108", "0.69180614", "0.68032867", "0.67824423", "0.6511491", "0.64664274", "0.6433299", "0.6405433", "0.6381109", "0.6373579", "0.6353825", "0.6341346", "0.63394994", "0.6299723", "0.6250637", "0.6230682", "0.61972433", "0.6184654", "0.61649233", "0.61295223", "0.61187...
0.7032489
1
Function to output a turbine array file given x and y locations
def make_turbine_array(x,y,filename='turbineArrayProperties',turbine='NREL5MWRef'): # Open the file for writing with open(filename,'w') as f: # Write out the headerlines f.write('/*--------------------------------*- C++ -*----------------------------------*\\\n') f.write('| ========= ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_turbine_array(x,\n y,\n filename='turbineArrayProperties',\n turbine='NREL5MWRef'):\n\n # Open the file for writing\n with open(filename, 'w') as f:\n\n # Write out the headerlines\n f.write(\n '/*------------...
[ "0.73296237", "0.58511424", "0.58031017", "0.5802097", "0.5752832", "0.56306803", "0.5620673", "0.5612616", "0.5590749", "0.5580848", "0.5580442", "0.55541426", "0.5535899", "0.5514052", "0.5512528", "0.55024314", "0.5478987", "0.54711324", "0.5438902", "0.54264915", "0.53760...
0.7292398
1
Computes a gaussian pyramid for an input image
def compute_gaussian_pyramid(img, level = 5): image_pyramid = list(pyramid_gaussian(img, max_layer = level)) image_pyramid.reverse() return image_pyramid
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cs4243_gauss_pyramid(image, n=3):\n kernel = cs4243_gaussian_kernel(7, 1)\n pyramid = []\n ## your code here####\n\n pyramid = [image]\n for i in range(n):\n gpyr_image = cs4243_filter_faster(pyramid[i], kernel)\n gpyr_image = cs4243_downsample(gpyr_image, 2)\n pyramid.appen...
[ "0.72078294", "0.7160451", "0.7004107", "0.68300813", "0.6759211", "0.66889745", "0.6619591", "0.65370846", "0.653064", "0.6460172", "0.60098743", "0.5983682", "0.59755254", "0.597127", "0.5963547", "0.5955024", "0.59330815", "0.59312946", "0.59301037", "0.5922019", "0.590096...
0.7812754
0
Factory associated with TimeHistory.
def temporal_database(): return TimeHistory()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def instantiate_history(self):\n serialized_history = self.cache.get('history')\n history = ast.literal_eval(serialized_history.decode('utf-8'))\n return history", "def __init__(self, batch_size, log_steps):\n self.batch_size = batch_size\n super(TimeHistory, self).__init__()\n self...
[ "0.6433754", "0.5975737", "0.59020305", "0.5813602", "0.57606184", "0.57445085", "0.566231", "0.55973494", "0.5569253", "0.5422708", "0.5354144", "0.5344575", "0.5340997", "0.53403884", "0.53334385", "0.5331813", "0.5322913", "0.5300688", "0.5224628", "0.5209072", "0.5206041"...
0.6637183
0
Initialize the result client.
def __init__(self, host=None, logger=core_log): if host is None: host = RESOURCE_MANAGER_HOST super(ClientResultManager, self).__init__(logger=logger, host=host)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, client, raw_result):\n\t\tself._client = client\n\t\tself._raw_result = raw_result\n\t\tself._oid = int(raw_result['id'])\n\t\tself._ot = int(raw_result['typeID'])", "def client_setup(self):\n self.client = Client()", "def _init_(self):\n self.res = {}", "def __init__(self, r...
[ "0.6798567", "0.6733852", "0.6671324", "0.6653381", "0.6630057", "0.65233314", "0.6444146", "0.64313793", "0.6408919", "0.63944614", "0.63944614", "0.63766706", "0.6376498", "0.6369883", "0.6276332", "0.6244732", "0.6226654", "0.6210841", "0.6204223", "0.61977386", "0.6140917...
0.71401954
0
Update the run data in the server.
def update_run_data(self, run_data): run_data_fields = run_data.get_fields() msg = messages.UpdateRunData(run_data=run_data_fields) self._request(msg)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_run_data(self, request):\n request.worker.update_run_data(request.message.run_data)\n\n return SuccessReply()", "def update_data():\n pass", "def __send_update(self):\n\n offset = self.app_id * 10\n\n # TODO set number of leading zero depending on max value\n ...
[ "0.8137309", "0.6930309", "0.68822575", "0.688068", "0.688068", "0.688068", "0.688068", "0.6700479", "0.66524553", "0.65909153", "0.6545456", "0.64871997", "0.64871997", "0.6464504", "0.6457081", "0.64231396", "0.6417105", "0.6391709", "0.63724333", "0.63467187", "0.63467187"...
0.758264
1
Remove a list of packages.
def remove_packages(self, packages):
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove(self, packages):\n raise NotImplementedError()", "def remove(self, packages):\n if packages:\n cmd = ['dnf', 'remove'] + list(packages)\n subprocess.Popen(cmd).wait()", "def _remove_extra_packages(frozen_pkgs, ret, **kwargs):\n pkgs = __salt__[\"pkg.list_pkgs\"...
[ "0.8236208", "0.8182445", "0.69466376", "0.69109696", "0.68176574", "0.6720167", "0.66783506", "0.6318952", "0.63164514", "0.62676316", "0.617139", "0.61597127", "0.6116011", "0.60816824", "0.60816824", "0.60404295", "0.60010064", "0.5977833", "0.5941293", "0.5929391", "0.591...
0.82860637
0
Get a ``sqlalchemy.orm.Session`` instance backed by a transaction. This function will hook the session to the transaction manager which will take care of committing any changes. When using pyramid_tm it will automatically be committed or aborted depending on whether an exception is raised. When using scripts you should...
def get_tm_session(session_factory, transaction_manager): dbsession = session_factory() zope.sqlalchemy.register( dbsession, transaction_manager=transaction_manager) return dbsession
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transaction_session(session=None, auto_commit=False):\n from decanter.database import db\n session = session or db.session\n try:\n yield session\n # Catch any and every exception and execute a rollback\n except Exception, e:\n session.rollback()\n # Now re-raise the excepti...
[ "0.7648893", "0.74518377", "0.7412716", "0.73840916", "0.73745173", "0.727017", "0.7153125", "0.7119644", "0.7098833", "0.7096247", "0.6928977", "0.69017285", "0.6872564", "0.6851235", "0.6846475", "0.68021566", "0.6773855", "0.676662", "0.675105", "0.669633", "0.666999", "...
0.75496256
1
Return a dictionary with all available competitions. Returns dict A mapping between (competion ID, season ID) tuples and the information available about each competition in the data stream.
def extract_competitions(self) -> Dict[Tuple[int, int], Dict[str, Any]]: optadocument = self._get_doc() attr = assertget(optadocument, '@attributes') competition_id = int(assertget(attr, 'competition_id')) season_id = int(assertget(attr, 'season_id')) competition = dict( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def as_dict(self):\n d = {}\n for name, competition, sid in self.get_queryset().values_list('name', 'competition', 'id'):\n d[(name, competition)] = sid\n return d", "def games(self, competition_id: int, season_id: int) -> DataFrame[Any]:", "def get_competitions_choice():\n\n ...
[ "0.65355116", "0.62301177", "0.6032052", "0.57329816", "0.5678602", "0.56458104", "0.5595009", "0.55902636", "0.5554317", "0.5479191", "0.54588366", "0.5453403", "0.5423016", "0.54026157", "0.53667915", "0.5355198", "0.5328461", "0.5313618", "0.52766347", "0.5248475", "0.5174...
0.74643964
0
Create the QT application.
def setup_qt(): app = QApplication([]) return app
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def createApp(self):\n app = self.app\n window = self.window\n window.show()\n app.exec()", "def qt_app():\n if not _check_qt():\n return\n app = start_qt_app()\n yield app\n run_qt_app()", "def main():\n app = QApplication(sys.argv)\n app_window = Gui()\n ...
[ "0.77793914", "0.72767174", "0.7190189", "0.7167984", "0.71408427", "0.69675606", "0.6914929", "0.68103015", "0.6786863", "0.67378205", "0.6633584", "0.6630677", "0.6618296", "0.66159457", "0.6611168", "0.66091394", "0.647071", "0.6424138", "0.63822687", "0.6381246", "0.63415...
0.7907272
0
Test the speech interactor
def test_bardspeechinteractor(setup_qt): # pylint: disable=redefined-outer-name,unused-argument config = { "timeout for command" : 1, "sensitivities" : [1.0], "interval": 10, "recogniser" : "testing", "test signals" : [ ["start_listen", False], ["googl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def speech_callback(self, data):\n speech = data.data\n print \"RECEIVED SPEECH: \", speech\n if \"keyword detected\" in speech:\n if self.idling:\n self.control_pub.publish(\"ft go; idle stop; stt go\")\n self.behav_pub.publish(\"greet\")\n # se...
[ "0.6916086", "0.6754174", "0.66763437", "0.6674567", "0.6645836", "0.6630316", "0.65520406", "0.65336657", "0.6521435", "0.6462442", "0.6451762", "0.6451762", "0.644162", "0.6390568", "0.6370383", "0.63611645", "0.6341513", "0.6277656", "0.62717277", "0.62502027", "0.6236805"...
0.7262975
0
rename output images written by output code using objective number and format
def rename_outputs(size, i, format): for k in range(size): src_name = 'out' + str(k) + '.png' dst_name = 'objective' + str(i) + '_' + format + '.png' os.rename(src_name, dst_name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def imageSaveOutput(image,name,number):\n FileName = name +\" \"+number\n mpimg.imsave(\"test_images_output\"+'//'+FileName,image)\n return 0;", "def make_output_names(self):\n yaml_names = []\n fits_names = []\n\n if self.use_nonstsci_names:\n for i in range(len(self.inf...
[ "0.6772987", "0.6689639", "0.65986234", "0.6343068", "0.633771", "0.63196355", "0.6313772", "0.62585586", "0.62319684", "0.611626", "0.61088413", "0.6053359", "0.6047611", "0.6013354", "0.6008044", "0.5944866", "0.59288144", "0.5926681", "0.5909546", "0.5861312", "0.5856344",...
0.8266767
0
reshape array to fit batch tensor
def reshape_to_batch(array): if len(array.shape) == 2: array = numpy.expand_dims(array, axis=2) array = numpy.expand_dims(array, axis=0) return array
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reshape_batch(inputs, size, batch_size):\n batch_inputs = []\n for length_id in range(size):\n batch_inputs.append(np.array([inputs[batch_id][length_id]\n for batch_id in range(batch_size)], dtype=np.int32))\n return batch_inputs", "def reshape(data):\n retu...
[ "0.7143927", "0.71257526", "0.7067894", "0.7067894", "0.6958456", "0.6958456", "0.68448645", "0.6827045", "0.6812873", "0.6714276", "0.6714276", "0.6591677", "0.6576278", "0.65548646", "0.6531735", "0.65049464", "0.6428692", "0.6423084", "0.63991225", "0.6348185", "0.63211346...
0.74596584
0
Parse a function docstring for SQL and execute it in a new cursor. If there is a function body, call it with the cursor, if there is no body, return cursor.fetchone()
def query(f): d = dedent(f.__doc__.split("\n", 1)[1]) doc_query = ( "\n".join(line for line in d.split("\n") if line.startswith(" ")) or d ) arg_count = doc_query.count("%s") code = True if f.__code__.co_code in _no_codes: code = False @wraps(f) def wrapper(self, curs...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mogrify_sql_statement(self, content):\n sql = content[0]\n args = content[1]\n\n if self.dbmi.__name__ == \"psycopg2\":\n if len(args) == 0:\n return sql\n else:\n if self.connected:\n try:\n retu...
[ "0.5955515", "0.56560946", "0.55345607", "0.5520009", "0.5476548", "0.54461306", "0.5433511", "0.5387105", "0.53727716", "0.5340966", "0.5332515", "0.52923286", "0.5274462", "0.5267352", "0.5248495", "0.52235997", "0.5220274", "0.5215734", "0.5192158", "0.5182753", "0.5156708...
0.64550996
0
Encode both image and sentence representations into same file since the captions are ManytoOne for each image.
def sentence_and_image_representations(dataset, text_encoder, image_encoder): vectorizer = get_text_vectorizer(text_encoder) stream_encoder, imread = get_image_encoder(image_encoder) captions = load_captions(dataset) images = load_images(dataset) encoding_path = BASE_PATH / dataset / ('{}_{}'.for...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_image_caption_pairs(self):", "def encode_images(self, images):\n # todo\n pass", "def image_tagger_representations(dataset, text_encoder, image_encoder):\n\n vectorizer = get_text_vectorizer(text_encoder)\n\n if image_encoder == 'inceptionresnetv2':\n stream_encoder, imrea...
[ "0.59882003", "0.59708166", "0.58312005", "0.5578528", "0.5473576", "0.5319502", "0.5306816", "0.5253091", "0.52464", "0.5237821", "0.52263683", "0.5203492", "0.5186329", "0.51826364", "0.51683277", "0.51528764", "0.512642", "0.5121072", "0.5105321", "0.50635815", "0.5058806"...
0.70844114
0
Simply tag the images, and use the vectorized tags as the image representation. In the wild, the easiest thing to do is to tag images using some tagging network (trained on something like ImageNet) and then directly match search queries to those tags (or captions if we had them). Here we try to tag images using a netwo...
def image_tagger_representations(dataset, text_encoder, image_encoder): vectorizer = get_text_vectorizer(text_encoder) if image_encoder == 'inceptionresnetv2': stream_encoder, imread = get_inceptionresnetv2_tagger() else: raise NotImplementedError('{} not recognized image_encoder'.format(i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tag_images(self, image_files, model=None):\n return self._multi_image_op(image_files, ['tag'], model=model)", "def predict_images(tags, classification):\n\n # convert document into bag-of-words\n user_tags = [[word2id[tag], 1]\n for tag in [lemma.lemmatize(tag)\n for ...
[ "0.72053057", "0.6413003", "0.6186345", "0.6092435", "0.6081351", "0.59808224", "0.59498763", "0.5938242", "0.5929515", "0.59186465", "0.5889199", "0.58851916", "0.58506864", "0.58506864", "0.58175564", "0.57547325", "0.5718487", "0.5704841", "0.56911063", "0.5666895", "0.566...
0.6683806
1
Submit changes in property edit widgets to model and update fields again
def submit_properties(self): self.logger.debug("Submit properties") self.datamapper_properties.submit() selection = self.tblProperties.selectionModel().selection() self.update_property_fields(selection)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edit_submit(self, REQUEST):\n failed = 0\n properties = self.get_editable_properties()\n for property in properties:\n try:\n value = REQUEST[property['id']]\n status, message = self.validate(property, value)\n if status != 1:\n ...
[ "0.68337953", "0.6573007", "0.6545176", "0.64124006", "0.6388891", "0.635046", "0.6297855", "0.62735224", "0.62675095", "0.62220067", "0.6218924", "0.6169075", "0.6140008", "0.6110494", "0.6071132", "0.6042266", "0.60049266", "0.59798795", "0.5965224", "0.5959027", "0.5957726...
0.6893325
0
Submit changes in dependency edit widgets to model and update fields again
def submit_dependencies(self): self.logger.debug("Submit dependencies") self.datamapper_dependencies.submit() selection = self.tblDependencies.selectionModel().selection() self.update_dependency_fields(selection)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _update_model(self, idx):\n self._wfield.update(self._choices[idx][0])", "def after_successful_edit(self):\n pass", "def update_model(self):\n pass", "def updateModel(self):\n pass", "def _refresh_model_fields(self) -> None:\n if self.model and self.model.actions:\n ...
[ "0.64844865", "0.6416429", "0.63246214", "0.6322889", "0.62898666", "0.62230843", "0.6190809", "0.6124276", "0.6117549", "0.60825074", "0.60761553", "0.5899015", "0.5859345", "0.5832426", "0.5826565", "0.58236843", "0.5811908", "0.5803408", "0.57866013", "0.5767866", "0.57493...
0.6566606
0
Opens a folder selection dialog and emits selected folder name via Signal projectNewRequested
def new_project(self): self.logger.debug("New project dialog") directory = QFileDialog.getExistingDirectory(self, translate("MainWindow", "Create new project"), ConfigHandler.cfg.dev_dir, QFileDialog.ShowDirsOnly) # sometimes window disappear...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nd_ok_clicked(self, widget, data=None):\n filename = self.new_chooser.get_filename()\n self.communicator.new_project(filename)", "def _on_new_project(self):\n lang = self.ddnGuiLanguage.get()\n projectfile = filedialog.asksaveasfilename(\\\n filetype...
[ "0.7069874", "0.66684926", "0.66355836", "0.65189046", "0.6452621", "0.64077383", "0.6400855", "0.63867944", "0.63357", "0.62919456", "0.6271953", "0.6255477", "0.6199662", "0.61871713", "0.61805075", "0.61643195", "0.6160981", "0.6108902", "0.6088471", "0.60452026", "0.60257...
0.67259324
1
Delegate closeEvent handling to parent controller
def closeEvent(self, event): self._parent.quit_application(event)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def controller_close(event):\n await controller.close()", "def closeEvent(self, event):\r\n self.app.stop()\r\n event.accept()", "def close(event):\n event.widget.destroy()", "def outCloseEvent(self):\r\n pass", "def closeEvent(self, event):\n super(MainWindow, s...
[ "0.72185016", "0.71067077", "0.7026615", "0.68930256", "0.6875968", "0.6874235", "0.68606085", "0.68590677", "0.6844628", "0.68396074", "0.67954725", "0.6782441", "0.6782441", "0.6782441", "0.67824376", "0.67378294", "0.6722553", "0.6716043", "0.6714222", "0.67062473", "0.669...
0.730754
0
Send signal if main window is moved
def moveEvent(self, *args, **kwargs): self.windowMoved.emit()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ev_windowmoved(self, event: WindowMoved) -> None:", "def resizeEvent(self, *args, **kwargs):\n self.windowMoved.emit()", "def ev_windowmoved(self, event: tcod.event.WindowMoved) -> T | None:", "def signal_handler(self,sig,data):\n self.resize_child_window()", "def OnMove(self, event):\r\n...
[ "0.7545605", "0.6950908", "0.69090176", "0.66536665", "0.6533433", "0.64312404", "0.63531667", "0.6276419", "0.6259146", "0.62170637", "0.6213087", "0.6198362", "0.61020774", "0.6079096", "0.60722506", "0.6049514", "0.60485786", "0.60323316", "0.60098267", "0.59626704", "0.59...
0.7464172
1
Send signal if main window is resized
def resizeEvent(self, *args, **kwargs): self.windowMoved.emit()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def signal_handler(self,sig,data):\n self.resize_child_window()", "def ev_windowsizechanged(self, event: WindowResized) -> None:", "def ev_windowresized(self, event: WindowResized) -> None:", "def resizeEvent(self, event):\n self.resized.emit()\n return super(PiWndow, self).resizeEvent(e...
[ "0.80196744", "0.78305197", "0.78030384", "0.75725263", "0.74003345", "0.710629", "0.70706946", "0.705455", "0.70195395", "0.69006795", "0.6847376", "0.6830406", "0.6805399", "0.6789115", "0.67793876", "0.6706277", "0.6648844", "0.6638831", "0.65603334", "0.6557982", "0.65276...
0.79051423
1
Check combobox status and update ui (set widgets enabled/disabled accordingly)
def check_combobox_selection(self, value): if self.sender() == self.cmbDepReqAction: if value != 0: self.cmbDepInstState.setCurrentIndex(0) elif self.sender() == self.cmbDepInstState: if value != 0: self.cmbDepReqAction.setCurrentIndex(0) elif self.sender() == self.cmbPro...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def enable(self):\n self.colour_combo.config(state=tk.NORMAL)\n self.game_name_entry.config(state=tk.NORMAL)\n self.num_tickets_entry.config(state=tk.NORMAL)", "def _updateState(self):\n\n self.changeColorBtn.setEnabled(self.transformTypeCbx.isChecked() or self.shapeTypeCbx.isChecked(...
[ "0.6506025", "0.6456816", "0.635315", "0.6326897", "0.62769324", "0.6264006", "0.6196845", "0.6192171", "0.6100461", "0.6087843", "0.60248643", "0.6022327", "0.5994431", "0.5991329", "0.59849316", "0.59571487", "0.593989", "0.59279436", "0.59016544", "0.5877541", "0.5870868",...
0.6955832
0
Assign file validator to field
def set_scriptfile_validator(self, field): validator = ScriptFileValidator(self, field) field.setValidator(validator)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __call__(self, form, field):\n\t\tif field.data and field.name in request.files:\n\t\t\tfile_size = get_file_size(request.files[field.name]) / 1000.0\n\t\t\tif file_size > self.max_size:\n\t\t\t\tif self.message is None:\n\t\t\t\t\tmessage = \"Max. ukuran file {} KB.\".format(self.max_size,)\n\t\t\t\telse:\n\t...
[ "0.7086566", "0.6746681", "0.66677517", "0.64856714", "0.6383482", "0.6353473", "0.61992645", "0.61299723", "0.612891", "0.6122797", "0.5960798", "0.59368056", "0.59305626", "0.59191996", "0.58918554", "0.5880026", "0.58263505", "0.57995903", "0.5685544", "0.5671797", "0.5669...
0.7383827
0
Corpus must be list of lists. Each contained lists have two sentences message and reply. [ ['message_1', 'reply_1'], ['message_2', 'reply_2'] ]
def build_seq2seq(self, corpus): self.dataset = [[self.encode(message), self.encode(reply)] for message, reply in corpus]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def corpus_dtm(texts):\n \n try:\n corpora = DTMcorpus(texts)\n print (\"DTMcorpus constructed\")\n \n except Exception as e:\n print ('Input data must be a list of tokens. Use gensim_corpus.docs_to_list(documents)', e)\n \n return corpora", "def convert_corpus_to_lists(cor...
[ "0.600668", "0.5783302", "0.5688599", "0.5669579", "0.56430215", "0.56205535", "0.56115824", "0.5589338", "0.5551976", "0.5511939", "0.5511871", "0.54739755", "0.5463528", "0.5435128", "0.541996", "0.5394388", "0.5388315", "0.53772926", "0.53731275", "0.5366445", "0.53607595"...
0.61771977
0
Computes value provided at a certain bandwidth.
def compute_value_at_bandwidth(self, x): x = x.value if x < 0: raise ComputeValueException( 'Bandwidth must be greater than 0: {0}'.format(x), 'TA.compute_value') elif x < self.total_minimum_bandwidth.value: return 0.0 elif x < MAX...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bandwidth(self):\n self._filter()\n return 1. * self._aggregate / self._window", "def compute_bandwidth_at_value(self, x):\n if x < 0:\n raise ComputeBandwidthException(\n 'Value must be greater than 0: {0}'.format(x),\n 'TA.compute_bandwidth')\n e...
[ "0.6521758", "0.6396415", "0.63033366", "0.62982845", "0.6233606", "0.6124905", "0.59888184", "0.59181553", "0.59112334", "0.56851643", "0.56685334", "0.5648434", "0.5556231", "0.5553291", "0.5539228", "0.5477659", "0.5470884", "0.5464445", "0.5432923", "0.54314643", "0.54183...
0.73236036
0
Determines if a TA has been discretized to communicate on a input channel.
def discretized_on_current_channel(self, channel): return channel.frequency.value == self.channel.frequency.value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_buffered_inputs(self):", "def cca(self):\n return self._current_rx_count == 0", "def is_normal(self, channel=None):\n return self.get_state(channel) == 0", "def readable (self):\r\n return len(self.ac_in_buffer) <= self.ac_in_buffer_size", "def is_input(self,chip,line):\n ...
[ "0.6363155", "0.60727596", "0.6054221", "0.6040357", "0.6031591", "0.5995268", "0.59752", "0.59397674", "0.5815966", "0.5785996", "0.5778", "0.5776649", "0.5731664", "0.5722634", "0.572255", "0.57182926", "0.5701452", "0.5688387", "0.5676843", "0.56746817", "0.56505793", "0...
0.60801667
1
%5 discount for customers with 1000 or more fidelity points
def fidelity(order): return order.total() * .05 if order.customer.fidelity >= 1000 else 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fidelity_promo(order: Order) -> float: # <3>\n return order.total() * 0.05 if order.customer.fidelity >= 1000 else 0", "def implied_discount_factor(p1: Instrument, c1: Instrument, p2: Instrument, c2: Instrument) -> float:\n return (c1.price - p1.price - c2.price + p2.price)/ (c2.strike - c1.strike)", ...
[ "0.64993364", "0.6432645", "0.6350103", "0.6273197", "0.62670875", "0.6262244", "0.62574667", "0.6253552", "0.62094176", "0.6180136", "0.6094795", "0.60798603", "0.6044674", "0.60022724", "0.6001723", "0.5985655", "0.5960018", "0.59496325", "0.59489", "0.59476423", "0.5898595...
0.6536574
0
%10 discount for each LineItem with 20 or more units
def bulk_item(order): discount = 0 for item in order.cart: if item.quantity >= 20: discount += item.total() * .1 return discount
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bulk_item(order: Order) -> Decimal:\n discount = Decimal(0)\n for item in order.cart:\n if item.quantity >= 20:\n discount += item.total() * Decimal('0.1')\n return discount", "def discount(self, cart):", "def bulk_item_promo(order: Order):\n discount = 0\n for item in orde...
[ "0.7108228", "0.67959064", "0.6609528", "0.65666103", "0.6467767", "0.6465719", "0.63740313", "0.6287296", "0.62742394", "0.6267985", "0.62542427", "0.62512463", "0.6193217", "0.6131217", "0.61192834", "0.6019739", "0.60004294", "0.5998084", "0.5987135", "0.5964816", "0.59164...
0.6951887
1
Function to adjust the dollar amounts of previous years by the Consumer Price Index. x_tf = x_ts (CPI_tf / CPI_ts)
def cpi_adjust(row, CPI_tf): CPI_ts = row['CPIAUCSL'] x_ts = row.iloc[0] x_tf = x_ts * (CPI_ts / CPI_tf) return x_tf
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inflation_adjustment(amount, year):\n\n inflation_rate = cpi[year]\n output = amount * (baseline_inflation/inflation_rate)\n return (f' If you had ${amount} in {year}, you would have ${output:.2f} in 2019 dollars.')", "def running_adjustment(self, adjustment: float, days_in_year: int = 365):\n ...
[ "0.6207601", "0.59599173", "0.5845487", "0.5592323", "0.5527225", "0.55032283", "0.5486278", "0.54853994", "0.54476976", "0.54183614", "0.54148906", "0.53950626", "0.5334004", "0.52869624", "0.5278198", "0.5255259", "0.5246605", "0.52281773", "0.5223281", "0.52129626", "0.520...
0.6880021
0
Pass web progress code from request content to the context
def report_download(self, data, token): requestcontent = json.loads(data) if len(requestcontent) > 2: request_context = requestcontent[2] if 'progress_code' in request_context: context = request.env.context.copy() context.update(request_context) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def progress(request):\n\n progress_key = json.loads(request.body).get('progress_key')\n\n return {\n 'progress_key': progress_key,\n 'progress': cache.get(progress_key) or 0\n }", "def renderHTTP(ctx):", "def upload_progress(request):\n progress_id = ''\n if 'X-Progress-ID' in req...
[ "0.59906286", "0.5982435", "0.5975375", "0.59643483", "0.58364147", "0.5810905", "0.57777965", "0.57261384", "0.57013774", "0.56169605", "0.5612233", "0.5535877", "0.55278003", "0.55193424", "0.54881096", "0.5481456", "0.5472085", "0.54345477", "0.5416612", "0.5416612", "0.54...
0.6018383
0
Checks that this Key exists at the expected key file path.
def exists(self): return os.path.exists(self.key_file)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _search_for_key_file(path_to_key_file):\n\n return True if os.path.exists(path_to_key_file) else False", "def ifExist(file_name, key):\n\tif exists(file_name) and exists(key):\n\t\treturn True\n\telse:\n\t\treturn False", "def test_getKey_keyexists(self):\n filename = self.mktemp()\n with ...
[ "0.74915767", "0.71452975", "0.70876056", "0.70746976", "0.70626205", "0.69822335", "0.6978283", "0.6974939", "0.6962695", "0.6908441", "0.6907718", "0.68556577", "0.6779752", "0.6696763", "0.6669888", "0.6595212", "0.65900004", "0.65569675", "0.65125424", "0.65033907", "0.64...
0.7784058
0
DRY method for checking if generate should be allowed even if the key file already exists.
def check_force_generate(self, force): if self.exists() and not force: self.log.warn( '{} already exists, skipping key generation...'.format(self.key_file) ) return False else: return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _need_generate(paths):\r\n if not os.path.exists(paths.generated_dir):\r\n return True\r\n\r\n if not os.path.exists(paths.index_file):\r\n return True\r\n\r\n # Use the index file to determine if regeneration is necessary\r\n with open(paths.index_file, 'r',newline='\\n') as index_fi...
[ "0.6670432", "0.6520227", "0.6349675", "0.62517345", "0.615382", "0.6059461", "0.6057273", "0.6055064", "0.6039753", "0.60282785", "0.6023372", "0.6022504", "0.6003615", "0.6002611", "0.5984005", "0.5968481", "0.59650403", "0.59387076", "0.59246224", "0.59217215", "0.58882457...
0.7751307
0
Implement this method to support generation of your Key subclass.
def generate(self, force=False): raise NotImplementedError( 'Cannot generate Key of unknown algorithm type. Use a subclass.', self )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_key ():", "def gen_keys():", "def _newKey(self, key):\n pass", "def generate_key(self):\n\n self.key = Fernet.generate_key()\n self.cryptor = Fernet(self.key)", "def generate_keystream(self):", "def new_key(self, key_name=None):\r\n return self.key_class(self, key_n...
[ "0.767463", "0.716922", "0.7102915", "0.70238763", "0.70136666", "0.6997118", "0.6956524", "0.6956524", "0.68581253", "0.6841527", "0.6826754", "0.6816592", "0.67725015", "0.6719353", "0.66671324", "0.66461104", "0.65992904", "0.65992904", "0.65838915", "0.6562164", "0.651551...
0.73684067
1
constructor intialize the properties of an atom as state variables of the atom, such as atomic coordinates, atom_id, item number in the simulation system the size of simulation system
def __init__(self, atom_loc, box_dim=None, atom_id=1,item=1, atom_z=None): if type(atom_loc) != list or len(atom_loc) != 3: raise Exception("atom location coordinates incorrect") if box_dim != None: if type(box_dim) != list or len(box_dim) != 3: raise Exception("simulation box dimension incorrect") self...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, atomic_number, element, mass, state):\n self.atomic_number = int(atomic_number)\n self.element = element\n self.mass = int(mass)\n self.state = int(state)", "def __init__(self, position, momentum, mass):\n self.position = position\n self.momentum = mom...
[ "0.7452794", "0.65500087", "0.6459785", "0.6367183", "0.6300204", "0.63001", "0.62847096", "0.62725914", "0.6252705", "0.6248129", "0.6173322", "0.61437315", "0.61175084", "0.6111833", "0.6111443", "0.6099645", "0.6099065", "0.60610306", "0.6016982", "0.6011741", "0.60072285"...
0.70336884
1
class method to calculate the distance between atom_1 and atom_2, where atom_1 and atom_2 are the instances of class Atom
def distance(cls, atom_1, atom_2): return np.linalg.norm((atom_1-atom_2).atom_loc)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_distance(atom1,atom2): #dot string to show when you go into the help doc of this function\n x_distance = atom1[0]-atom2[0]\n y_distance = atom1[1]-atom2[1]\n z_distance = atom1[2]-atom2[2]\n distance = numpy.sqrt(x_distance**2+ y_distance**2+z_distance**2)\n return distance", "def di...
[ "0.81255573", "0.7571165", "0.7275821", "0.72124124", "0.7155912", "0.7127433", "0.70064884", "0.6992389", "0.6969356", "0.69646084", "0.6959134", "0.69474787", "0.6918886", "0.68868566", "0.68815756", "0.6880222", "0.6875835", "0.6871246", "0.6860088", "0.6851087", "0.683919...
0.8444228
0
create a Atom class object from single column pandas.DataFrame or pandas.Series
def from_ds(cls, data): if isinstance(data, pd.DataFrame) == False and isinstance(data, pd.Series) == False: raise Exception("data converted into Atom class object must be single column pandas.DataFrame or pandas.Series") data = data.squeeze() _x,_y,_z = data["x"], data["y"], data["z"] _atom_id = data["atom_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_dataframe(cls, dataframe):\n return cls(dataframe)", "def from_pandas(cls, df, data_cls):\n pass", "def from_pandas(cls, pandasFrame,timeSeriesCol,mainCategoryCol):\n data = io.from_pandas(pandasFrame,timeSeriesCol,mainCategoryCol)\n return cls(data,timeSeriesCol,mainCatego...
[ "0.6015301", "0.58995456", "0.5687649", "0.5633098", "0.56181765", "0.5561371", "0.5517346", "0.5513094", "0.5416853", "0.535607", "0.53412056", "0.5313786", "0.52888185", "0.52873284", "0.5280166", "0.52746046", "0.5247512", "0.5225565", "0.52111584", "0.52030045", "0.515952...
0.74053574
0
this method convert a class Atom object into a list whose three elements are x,y,z
def to_list(cls, data): if isinstance(data, Atom) == False: raise Exception("data must be a class object") x,y,z = (data.atom_loc)[0], (data.atom_loc)[1], (data.atom_loc)[2] return [x,y,z]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_list(self):\n return [self.x, self.y, self.z]", "def list(self):\n return [self.x, self.y, self.z]", "def X(self)->list:", "def to_list(self):\n return [self._position, self._focal_point, self._viewup]", "def At_list(self):\n return self.Atom_list", "def tolist (self) :...
[ "0.7546165", "0.7043041", "0.64497614", "0.6400961", "0.6345722", "0.6263949", "0.61894405", "0.6171474", "0.6100994", "0.6097576", "0.6094943", "0.6089146", "0.60801834", "0.6061327", "0.6061327", "0.604603", "0.5976551", "0.5975239", "0.5934041", "0.59266096", "0.5896629", ...
0.82212514
0
this method implement the distance in the following definition sqrt(sum(dx2+dy2+dz2) for each atom in config)
def distance(cls,config_1, config_2): sorted_data_1 = (config_1.data).sort_values('item') sorted_data_2 = (config_2.data).sort_values('item') dr = sorted_data_1 - sorted_data_2 return np.linalg.norm(dr)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_distance(atom1,atom2): #dot string to show when you go into the help doc of this function\n x_distance = atom1[0]-atom2[0]\n y_distance = atom1[1]-atom2[1]\n z_distance = atom1[2]-atom2[2]\n distance = numpy.sqrt(x_distance**2+ y_distance**2+z_distance**2)\n return distance", "def _c...
[ "0.68678474", "0.66423666", "0.6570215", "0.65150434", "0.64703304", "0.64563346", "0.6453569", "0.6370578", "0.6322843", "0.6270577", "0.62704265", "0.62269044", "0.6110816", "0.608518", "0.60772324", "0.60722506", "0.60655046", "0.6056526", "0.6052166", "0.60220104", "0.594...
0.68862534
0
this method implement the distance in the following definition sqrt(sum(dx2+dy2+dz2) for each atom in config) the dx, dy, dz should follow the minumum image convention in pbc
def distance_pbc(cls, config_1, config_2): sorted_data_1 = (config_1.data).sort_values('item') sorted_data_2 = (config_2.data).sort_values('item') box_dim_1 = config_1.box_dim box_dim_2 = config_2.box_dim i = 0 total_distance = 0.0 for index, row in sorted_data_1.iterrows(): atom_1 = Atom.from_ds(row) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def distance(cls,config_1, config_2):\n\t\tsorted_data_1 = (config_1.data).sort_values('item')\n\t\tsorted_data_2 = (config_2.data).sort_values('item')\n\t\tdr = sorted_data_1 - sorted_data_2\n\t\treturn np.linalg.norm(dr)", "def distance_pbc(cls, atom_1, atom_2):\n\t\tif atom_1.box_dim is None or atom_2.box_dim...
[ "0.64624643", "0.6239607", "0.61084557", "0.60709614", "0.604959", "0.6001386", "0.59123105", "0.5898167", "0.5858806", "0.5841348", "0.58185434", "0.5796002", "0.57622707", "0.57417536", "0.5731279", "0.5700072", "0.5697999", "0.56880176", "0.5682528", "0.5682055", "0.566921...
0.6664281
0
this function calculates the distance between final and initial configuration of a single event
def event_distance(path_to_test_dir, event_state, box_dim): event_init,event_sad,event_fin = event_state[0],event_state[1],event_state[2] init_path = path_to_test_dir + '/' + event_init +".dump" sad_path = path_to_test_dir + '/' + event_sad +".dump" fin_path = path_to_test_dir + '/' + event_fin +".dump" init...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calc_distance(self, observation):\n actual_obs = observation[0]\n scrn_player = actual_obs.observation.feature_screen.player_relative\n scrn_select = actual_obs.observation.feature_screen.selected\n scrn_density = actual_obs.observation.feature_screen.unit_density\n\n state_a...
[ "0.6625728", "0.6161054", "0.6045253", "0.5970809", "0.5956048", "0.59524876", "0.5882668", "0.58502865", "0.582583", "0.58139366", "0.5805957", "0.58047825", "0.57432467", "0.5692882", "0.5687489", "0.56241304", "0.5586961", "0.5572496", "0.55686724", "0.5542973", "0.5537939...
0.7019884
0
this function returns a list containing the strings of the selected events after stage I two criteria for all tests in list_of_test_id
def get_list_of_selected_events_str(path_to_data_dir, list_of_test_id): all_selected_events = [] for i in list_of_test_id: path_to_curr_test = data_dir_to_test_dir(path_to_data_dir,i) path_to_selected_events = path_to_curr_test + "/results/selected_events.json" # skip the test who do not have selected_events.js...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_list_of_final_filtered_events_str(path_to_data_dir):\n\tall_selected_events = []\n\tpath_to_final_selected_events = os.path.join(path_to_data_dir,\"final_selected_events.json\")\n\tif os.path.exists(path_to_final_selected_events):\n\t\tfinal_selected_events = json.load(open(path_to_final_selected_events,'r...
[ "0.69613487", "0.60197365", "0.57867223", "0.56587726", "0.5596005", "0.55904245", "0.5515877", "0.5510531", "0.53991413", "0.5391873", "0.5383801", "0.53755015", "0.5366717", "0.5353771", "0.5275629", "0.52477634", "0.52439374", "0.5231011", "0.5210642", "0.5187125", "0.5179...
0.78697056
0
this function returns a list containing the strings of the selected events after both stage I and stage II three criteria for all tests in list_of_test_id
def get_list_of_final_filtered_events_str(path_to_data_dir): all_selected_events = [] path_to_final_selected_events = os.path.join(path_to_data_dir,"final_selected_events.json") if os.path.exists(path_to_final_selected_events): final_selected_events = json.load(open(path_to_final_selected_events,'r')) # value = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_list_of_selected_events_str(path_to_data_dir, list_of_test_id):\n\tall_selected_events = []\n\tfor i in list_of_test_id:\n\t\tpath_to_curr_test = data_dir_to_test_dir(path_to_data_dir,i)\n\t\tpath_to_selected_events = path_to_curr_test + \"/results/selected_events.json\"\n\t\t# skip the test who do not hav...
[ "0.73680484", "0.5553837", "0.5552638", "0.5530768", "0.53562665", "0.5334484", "0.5333782", "0.5282885", "0.52828157", "0.5280706", "0.5223931", "0.52195364", "0.5186898", "0.5179156", "0.51418114", "0.5056616", "0.50471", "0.50386775", "0.4990059", "0.4979482", "0.49577212"...
0.64990443
1
this function calculates the activiation energy for a single event from the test/log.file.1
def event_act_relax_energy(event, path_to_data_dir): if 'test' in event[0]: test_id = int(event[0][4:]) else: test_id = int(event[0]) path_to_test_dir = data_dir_to_test_dir(path_to_data_dir, test_id) #path_to_test_dir = path_to_data_dir + event[0] test_energy_list = event_energy(path_to_test_dir) init_eng ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_energy():\n\n # open the psi4 log file\n with open('output.dat', 'r') as log:\n lines = log.readlines()\n\n # find the total converged energy\n for line in lines:\n if 'Total Energy =' in line:\n energy = float(line.split()[3])\n ...
[ "0.6727377", "0.6576601", "0.655035", "0.62417734", "0.61165905", "0.6109422", "0.6080716", "0.605267", "0.605228", "0.6019188", "0.59683543", "0.59492683", "0.588925", "0.5865757", "0.58025926", "0.5800119", "0.5794899", "0.57305336", "0.57293963", "0.5673038", "0.5672142", ...
0.6774561
0
this function check if a single event the maximum displacement aton is the triggered atom stored inside the bart.sh
def triggered_atom_is_max_disp(path_to_data_dir, event): print "event:", event[0],event[1][0],event[1][1],event[1][2] if 'test' in event[0]: test_id = int(event[0][4:]) else: test_id = int(event[0]) path_to_test_dir = data_dir_to_test_dir(path_to_data_dir, test_id) #path_to_test_dir = path_to_data_dir + ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_triggered_gas(self):\n return self == ArmingState.ALARMING_CARBON_MONOXIDE", "def event_m20_11_x27(z104=20111500, mode2=1, goods3=60536000):\n \"\"\"State 0,1: Judgment to examine\"\"\"\n IsObjSearched(0, z104)\n assert ConditionGroup(0)\n \"\"\"State 2: Available branch\"\"\"\n # go...
[ "0.581377", "0.5808638", "0.5546775", "0.54734147", "0.5442827", "0.53959715", "0.53807074", "0.5377089", "0.53671163", "0.5305538", "0.529778", "0.5280826", "0.5280374", "0.52750415", "0.5272845", "0.5264755", "0.5254308", "0.5254082", "0.5245802", "0.52419674", "0.5196696",...
0.7807952
0
this function perform an operation function on each events listed in tests in list_of_test_id
def operation_on_events(path_to_data_dir, list_of_test_id, operation, num_of_proc=1): test_id = ["test%s"%i for i in list_of_test_id] pool = Pool(processes = num_of_proc) path_to_final_selected_events = path_to_data_dir + "final_selected_events.json" if os.path.exists(path_to_final_selected_events): final_selecte...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _do_test(self):\n\n process_all_events()\n\n if self.list:\n (callback, args, kwargs) = self.list.pop(0)\n callback(*args, **kwargs)\n else:\n safe_exit(force=1)", "def run_code(self, test):\n for action in test:\n ...
[ "0.62546134", "0.6011957", "0.5862495", "0.58525497", "0.58436847", "0.58201325", "0.57717764", "0.57470894", "0.5725658", "0.5705969", "0.5625481", "0.56109726", "0.5465798", "0.54145825", "0.540387", "0.54005617", "0.5383072", "0.53810245", "0.5361003", "0.5304539", "0.5299...
0.787161
0
this function get the local atom atom_ids as a list of lists (that will be flattern into a single list) from the triggered atoms (whose item_ids in triggered_atom_list) item_ids and num_of_involved atoms NN For example, each trigger atom has k th NN. Then for x triggered atoms, it would be a x element list of lists (ea...
def event_local_atom_index(initial_config_data, triggered_atom_list, num_of_involved_atom, path_to_init_sad, box_dim, save_results = True, re_calc = False): path_to_local_nn_results = path_to_init_sad + "/local_nn_results_dict.pkl" print "the triggering atoms are:", triggered_atom_list if re_calc is False: if os...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_influence_atoms(atomlist):\n enviromentlist = []\n trunclist = []\n neighbourlist = get_closest_neighbours(atomlist, 4)\n for neighbours in neighbourlist:\n if neighbours[0][0] == \"H\":\n neighbours = neighbours[:2]\n if neighbours[0][0] == \"O\":\n neighbou...
[ "0.6220006", "0.5571359", "0.52277535", "0.5219997", "0.51586866", "0.5051917", "0.49784568", "0.49731946", "0.4964381", "0.48162273", "0.48123714", "0.47998986", "0.47891927", "0.47792614", "0.47758946", "0.474015", "0.4729828", "0.46249926", "0.4600663", "0.45954043", "0.45...
0.7072962
0
this function get the triggered atom index from the art input file bart.sh
def read_from_art_input_file(path_to_test_dir): path_to_test_bart = path_to_test_dir + "/bart.sh" f=open(path_to_test_bart) string=f.read() pattern = "([#\n])setenv[\s]+Central_Atom[\s]+([1-9]+)" #pattern #setenv Central_Atom 1 match = re.search(pattern, string) if match.group(1) == "#": return [1] el...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index(self, atom):\n return self.atom_list.index(atom)", "def _get_natom(self, file):\n f = open_general(file)\n tmptxt = f.readlines()\n f.close()\n itmp = search_string('NATOM is', tmptxt)\n natom = int(tmptxt.pop(itmp).split()[-1])\n return natom", "def i...
[ "0.6268435", "0.5717367", "0.564274", "0.55397516", "0.55169034", "0.54986376", "0.5386432", "0.5373571", "0.53509676", "0.5333663", "0.5312557", "0.5303886", "0.5286595", "0.5276855", "0.52701", "0.52492356", "0.5242478", "0.52420354", "0.5216488", "0.5204868", "0.520097", ...
0.59132856
1
A very general nearest neigbor finder function calculate multiple atom's nearest neighbor all at once using the efficient cKDTree algorithm, the multiple atoms whose item number is listed inside the atom_list input argument, the default is to calculate all atoms inside initial_config_data file User can customize which ...
def NN_finder_all(initial_config_data, cut_off_distance, box_dim, path_to_test_dir, atom_list = None, save_results = False, re_calc = False): # set up path_to_file and check results out of this function before calling it # if check_results is True: # if path_to_file is None or os.path.exists(path_to_file): # raise...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def event_local_atom_index(initial_config_data, triggered_atom_list, num_of_involved_atom, path_to_init_sad, box_dim, save_results = True, re_calc = False):\n\t\n\tpath_to_local_nn_results = path_to_init_sad + \"/local_nn_results_dict.pkl\"\n\tprint \"the triggering atoms are:\", triggered_atom_list\n\tif re_calc ...
[ "0.6331955", "0.60810894", "0.57165396", "0.5676549", "0.5620134", "0.5502116", "0.5489957", "0.5463027", "0.5419951", "0.5402583", "0.5354871", "0.53289664", "0.5288252", "0.52799964", "0.52748334", "0.5270086", "0.5263335", "0.5260335", "0.5213674", "0.5202472", "0.519903",...
0.7503903
0
this function calcualte the pair distribution function from scratch in a rigorous way it takes the configurational data stored inside the pandas.Dataframe initial_config_data, calculate the pair distribution function of pair atom_type_1, atom_type_2
def pdf_calculator_pair(initial_config_data,atom_type_1,atom_type_2): atom_1 = pd.DataFrame([]) atom_2 = pd.DataFrame([]) for (index,atom) in initial_config_data.iterrows(): if atom["atom_id"] == atom_type_1: atom_1 = atom_1.append(atom) if atom["atom_id"] == atom_type_2: atom_2 = atom_2.append(atom) fo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stats_pairs(): \n \n setproctitle(f\"RNANet statistics.py stats_pairs()\")\n\n def line_format(family_data):\n return family_data.apply(partial(format_percentage, sum(family_data)))\n\n if not path.isfile(\"data/pair_counts_{res_thr}.csv\"):\n results = []\n allpairs = []\n ...
[ "0.6010703", "0.5603974", "0.54960746", "0.5480738", "0.5433196", "0.542965", "0.54272074", "0.5371495", "0.53666085", "0.53359693", "0.5331222", "0.52925444", "0.5265734", "0.5234465", "0.51832867", "0.51448876", "0.5131116", "0.5125846", "0.5122046", "0.50958025", "0.508427...
0.756521
0
this function takes a atomic configuration pandas.Dataframe, calculate all possible atomic_type pairs' pair distribution function, get the cutoff distance for each specific atomic_type pair as the first minumum of each pair distribution function, output the cutoff distances of each pair as a dictionary in the order [at...
def cut_off_distance_calculator(config_data): atom_type = ((config_data["atom_id"].unique()).astype(np.int64)).tolist() atom_type.sort() config_size = config_data["item"].size cut_off_distance = [] for i in range(len(atom_type)): for j in range(i+1,len(atom_type)-1): pair_dist_fun = pdf_calculator_pair(config...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pdf_calculator_pair(initial_config_data,atom_type_1,atom_type_2):\n\tatom_1 = pd.DataFrame([])\n\tatom_2 = pd.DataFrame([])\n\t\n\tfor (index,atom) in initial_config_data.iterrows():\n\t\tif atom[\"atom_id\"] == atom_type_1:\n\t\t\tatom_1 = atom_1.append(atom)\n\t\tif atom[\"atom_id\"] == atom_type_2:\n\t\t\ta...
[ "0.68174624", "0.58087265", "0.5688583", "0.56643254", "0.5632365", "0.55641323", "0.53449357", "0.52611566", "0.5246771", "0.52349377", "0.5224341", "0.5216087", "0.51952434", "0.5185263", "0.5176844", "0.5151462", "0.51493895", "0.5101092", "0.50873154", "0.50671023", "0.50...
0.60374993
1
Perform BFS for the entire graph. In the case where the graph is not connected, we can count the number of vertces in the forest dictionary that has None value.
def BFS_complete(g, outgoing=True): forest = {} component = -1 for v in g.vertices(): if v not in forest: component += 1 forest[v] = (None, component) BFS(g, v, forest, component, outgoing) return forest
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bfs_counting(graph, root_vertex, bottom_vertex): # perform analysis twice: 1) set root_vertex = 't'; 2) set root_vertex = 's'\r\n\r\n #visited = dict()\r\n nd_list = graph.keys()\r\n visited = dict((node, 0) for node in nd_list)\r\n visited[bottom_vertex]=0\r\n\r\n nq = deque()# queue for record...
[ "0.7009593", "0.66057473", "0.65865463", "0.6492491", "0.6371876", "0.6364139", "0.6311149", "0.62698257", "0.62304497", "0.6211036", "0.61986816", "0.61959815", "0.6155067", "0.6141026", "0.6131594", "0.60663885", "0.6056702", "0.60428315", "0.6029285", "0.60270005", "0.6002...
0.71259964
0
Called when an attachment is added.
def attachment_added(self, attachment): if 'attachment' not in self.sources: return gnp = GrowlNotificationPacket(notification='attachment', title='Attachment added', description=attachment.title) gs = GrowlS...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_attachment(self, attachment):\n self.attachments.append(attachment.build())", "def add_attachment(self, val: Attachment):\n self._attachments.append(val)", "def add_attachment(self, fname, attachname=None):\n if fname is None:\n return\n self._attach.append( (fnam...
[ "0.7710118", "0.73610187", "0.71346426", "0.70922565", "0.6843109", "0.6749022", "0.657133", "0.64204466", "0.6410837", "0.6375717", "0.6346004", "0.624108", "0.6240345", "0.6226666", "0.6212406", "0.6199379", "0.6144526", "0.61328626", "0.6070976", "0.60528594", "0.6040466",...
0.7984342
0
Called when an attachment is deleted.
def attachment_deleted(self, attachment): if 'attachment' not in self.sources: return gnp = GrowlNotificationPacket(notification='ticket', title='Attachment deleted', description=attachment.title) gs = GrowlS...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_delete_record(event):\n keep_old_files = asbool(utils.setting_value(event.request, 'keep_old_files', default=False))\n\n # Retrieve attachments for these records using links.\n resource_name = event.payload['resource_name']\n filter_field = '%s_uri' % resource_name\n uri = event.payload['uri'...
[ "0.7044458", "0.7012366", "0.7004079", "0.6997185", "0.6960599", "0.6775819", "0.67452586", "0.6715248", "0.6685065", "0.65996385", "0.65996385", "0.6582654", "0.6573256", "0.64647585", "0.6452755", "0.64395016", "0.6427186", "0.6396091", "0.636038", "0.6356127", "0.6262333",...
0.81781095
0
Called when a ticket is created.
def ticket_created(self, ticket): if 'ticket' not in self.sources: return gnp = GrowlNotificationPacket(notification='ticket', title='Ticket #%d created' % ticket.id, description=self._ticket_repr(ticket)) gs...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ticket_created(self, ticket):", "def create_ticket(self, user):\n return Ticket.objects.create_ticket('test', user)", "def create_ticket(self, ticket):\r\n ticket_url = self._zendesk_instance.create_ticket(data=ticket)\r\n return zendesk.get_id_from_url(ticket_url)", "def Ticket(tick...
[ "0.8907934", "0.7257761", "0.7245278", "0.71920204", "0.6770903", "0.673267", "0.6723259", "0.6695793", "0.6668929", "0.6656974", "0.6653784", "0.6470401", "0.6438275", "0.6346723", "0.6339659", "0.6296467", "0.6289099", "0.6274628", "0.62530595", "0.621988", "0.61875856", ...
0.80531174
1
Called when a ticket is modified.
def ticket_changed(self, ticket, comment, author, old_values): if 'ticket' not in self.sources: return gnp = GrowlNotificationPacket(notification='ticket', title='Ticket #%d updated' % ticket.id, description=self._ti...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_changes(self, author, comment, when=0, db=None):\r\n assert self.exists, 'Cannot update a new ticket'\r\n\r\n if not self._old and not comment:\r\n return # Not modified\r\n\r\n if not db:\r\n db = self.env.get_db_cnx()\r\n handle_ta = True\r\n ...
[ "0.6736545", "0.6710248", "0.65016633", "0.6456627", "0.6430149", "0.6349059", "0.6279751", "0.6163126", "0.6144943", "0.6025728", "0.60211134", "0.5982489", "0.5950839", "0.59400314", "0.58793396", "0.5797524", "0.57475674", "0.57456625", "0.57394665", "0.5711103", "0.564871...
0.76431406
0
Called when a ticket is deleted.
def ticket_deleted(self, ticket): if 'ticket' not in self.sources: return gnp = GrowlNotificationPacket(notification='ticket', title='Ticket #%d deleted' % ticket.id, description=self._ticket_repr(ticket)) gs...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ticket_deleted(self, ticket):", "def ticket_delete(request, ticket_id):\n ticket = get_object_or_404(Ticket, code=ticket_id)\n ticket_assignment = TicketAssignment.objects.filter(ticket=ticket).first()\n\n # log action\n logger.info('[{}] ticket {} assignment'\n ' to office {}'\n ...
[ "0.8716265", "0.71849394", "0.71637696", "0.69254124", "0.653573", "0.65166426", "0.6450615", "0.6427037", "0.63474953", "0.63368064", "0.63368064", "0.63162476", "0.63037455", "0.61697847", "0.61172366", "0.6102864", "0.608461", "0.60695094", "0.6060715", "0.60483205", "0.60...
0.81990707
1
Called whenever a new Wiki page is added.
def wiki_page_added(self, page): if 'wiki' not in self.sources: return gnp = GrowlNotificationPacket(notification='wiki', title='Page created', description=page.name) gs = GrowlSender(self.env) gs.not...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_page(self, page): \n self.pages.append(Page(page))", "def create_page(self):", "def add_page(self, title, wiz_page=None):\n page = Page(self, self._title, title, wiz_page)\n self._pages.append(page)\n return page", "def addPage(self, name, page, **attrs):\n page.glo...
[ "0.72817034", "0.6532871", "0.6499059", "0.6448013", "0.6411673", "0.6409773", "0.6251704", "0.62361807", "0.61289036", "0.60423297", "0.59953743", "0.5961439", "0.5941256", "0.5931068", "0.59029233", "0.58968425", "0.588897", "0.5888269", "0.58855134", "0.5870525", "0.586762...
0.7918421
0
Called when a page has been modified.
def wiki_page_changed(self, page, version, t, comment, author, ipnr): if 'wiki' not in self.sources: return gnp = GrowlNotificationPacket(notification='wiki', title='Page updated', description=self._wiki_repr(page, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post_save_page(instance, raw, created, **kwargs):\n old_page = instance.old_page\n del(instance.old_page)\n \n if settings.CMS_MODERATOR:\n # tell moderator something was happen with this page\n from cms.utils.moderator import page_changed\n page_changed(instance, old_page)", ...
[ "0.7015026", "0.6813357", "0.658847", "0.64705795", "0.646106", "0.6301072", "0.6244035", "0.62386775", "0.6235251", "0.6095932", "0.60871124", "0.60664463", "0.60445684", "0.6037244", "0.6024243", "0.60021216", "0.5940169", "0.59353137", "0.5889857", "0.58359975", "0.5817587...
0.7258363
0
Called when a page has been deleted.
def wiki_page_deleted(self, page): if 'wiki' not in self.sources: return gnp = GrowlNotificationPacket(notification='wiki', title='Page deleted', description=self._wiki_repr(page)) gs = GrowlSender(self.env) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete(request, page_id):\n page = Page.objects.get(pk=page_id)\n error_messge = \"\"\n if page:\n try:\n editor = page.get_editor()\n if editor and editor.user.id != request.user.id:\n # msg = 'You can\\'t delete this page because %s is editing it' % (\n ...
[ "0.71248585", "0.69981265", "0.6952281", "0.6943332", "0.6901331", "0.6796682", "0.6663727", "0.6482316", "0.6393535", "0.63243026", "0.6310776", "0.6268726", "0.6254105", "0.6222369", "0.61693466", "0.61619943", "0.61601704", "0.6115656", "0.6108992", "0.6108992", "0.6108992...
0.76841575
0
Called when a version of a page has been deleted.
def wiki_page_version_deleted(self, page): if 'wiki' not in self.sources: return gnp = GrowlNotificationPacket(notification='wiki', title='Page suppressed', description=self._wiki_repr(page)) gs = GrowlSender...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wiki_page_deleted(self, page):\n if 'wiki' not in self.sources:\n return\n gnp = GrowlNotificationPacket(notification='wiki',\n title='Page deleted',\n description=self._wiki_repr(page))\n gs = GrowlSender...
[ "0.69931", "0.68966717", "0.68432987", "0.67907906", "0.6601703", "0.64514005", "0.642314", "0.6365946", "0.6354027", "0.62893754", "0.62693644", "0.6240412", "0.62078655", "0.62069273", "0.61867154", "0.61382854", "0.6101729", "0.6066212", "0.6041199", "0.60385466", "0.60385...
0.7122477
0
String representation of a Trac ticket
def _ticket_repr(self, ticket): rep = '%s (%s)' % (ticket['summary'], ticket['status']) return rep
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\r\n return self.ticket_description", "def get_ticket_info(self):\n return json.dumps(self.__dict__)", "def print_ticket(json_data):\n print(\"\\nSubject: \" + json_data[\"ticket\"][\"subject\"])\n print(\"Created: \" + json_data[\"ticket\"][\"created_at\"])\n print(\"L...
[ "0.7466198", "0.6808034", "0.63357925", "0.6073038", "0.60218924", "0.58795893", "0.58645093", "0.5851554", "0.58250564", "0.5798312", "0.5767452", "0.5749324", "0.5733681", "0.5733541", "0.57177705", "0.5710717", "0.56982017", "0.5691143", "0.5668958", "0.5639125", "0.563874...
0.7667076
0
String representation of a Trac wiki page
def _wiki_repr(self, page, comment=None): rep = page.name if comment: rep += '\n%s' % comment return rep
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\r\n return str(self.page)", "def __str__(self):\n return self.page.get_title()", "def page_to_string(page, alph):\n s = ''\n links = Measurements.get_all_links(page)\n for l in links:\n s += alph[l]\n return s", "def wikiword(self):\r\n ...
[ "0.6515011", "0.5941286", "0.58847797", "0.5807885", "0.56281483", "0.5604634", "0.5604634", "0.55739504", "0.5548761", "0.5534429", "0.5529693", "0.54604805", "0.54487354", "0.5406728", "0.54053766", "0.53658545", "0.5347607", "0.53428036", "0.53349537", "0.532796", "0.53271...
0.6324626
1
String representation of a Bitten build
def _bitten_repr(self, build): rep = '%s (%d) r%d' % (build.config, build.id, build.rev) if build.platform: rep += ' %s' % build.platform if build.slave: rep += ' %s' % build.slave return rep
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gen_build_str_dec():\n\t#Get name of person building firmware\n\t#git config --get-all user.name\n\t#Get repo revision\n\t#git log | head -1 | cut -d \" \" -f 2\n\t#Get branch\n\t#git branch | grep \"\\*\" | cut -d \" \" -f 2\n\t#Get modified status\n\t#Date, time, gcc version (__VERSION__)\n\ts = \"Miniboard ...
[ "0.70024306", "0.6503", "0.64342046", "0.6400183", "0.6378306", "0.63406193", "0.62962973", "0.6284292", "0.6222426", "0.61538315", "0.61174536", "0.61050576", "0.61004865", "0.6030988", "0.6020752", "0.60144764", "0.5996878", "0.5987033", "0.59849584", "0.59841853", "0.59822...
0.80604726
0
Calculates the latest login time for each user
def latest_login(login): df = login df = df.groupby("Login Id").max() df["Time"] = pd.to_datetime(df["Time"]) return df
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scrape_data_from_last_user():\n\n # todo: This should be fixed, this is only getting the last user, so if a user is logging in twice, the last user will be scraped\n users = DatabaseExtractor.get_users()\n\n\n try:\n lastUsername = users[0][0]\n lastPassword = users[0][1]\n except:\n ...
[ "0.6262186", "0.621211", "0.6167909", "0.60667956", "0.6007308", "0.5986034", "0.59452766", "0.59318644", "0.5917966", "0.58925635", "0.58882385", "0.5851214", "0.5807692", "0.57905364", "0.5762357", "0.57421076", "0.57414514", "0.5671302", "0.56597006", "0.56548935", "0.5603...
0.6433532
0
Calculates the the smallest time elapsed for each user.
def smallest_ellapsed(login): df = login df["Time"] = pd.to_datetime(df["Time"]) return df.groupby("Login Id").agg(lambda group: group.diff().min()).dropna()["Time"].to_frame()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_best_time():\n\n # Always remember about db.session.rollback() when debugging\n\n max_timing = db.session.query(func.min(Game.timing)).filter(Game.status == \"won\").first()\n time_user = db.session.query(Game.timing, User.username).join(User).filter(Game.timing == max_timing, Game.st...
[ "0.6256323", "0.61203563", "0.60695493", "0.60549474", "0.59113646", "0.5857357", "0.58422977", "0.5745896", "0.5739044", "0.573889", "0.569649", "0.5691981", "0.5544899", "0.5509867", "0.5506299", "0.54894155", "0.5487675", "0.5484633", "0.54340637", "0.5426308", "0.5423832"...
0.6702292
0
Total for each seller
def total_seller(df): return pd.pivot_table(df, values = "Total", index = ["Name"], aggfunc = "sum")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def total_sales(self):\n total_sales = 0\n items = self.item_set.filter(status=\"sold\")\n for item in items:\n total_sales += item.price\n return total_sales", "def set_total(self):\n\n self.total = 0\n for item in self.items.all():\n self.total +=...
[ "0.6856465", "0.68208617", "0.6774696", "0.67029786", "0.66495395", "0.66230905", "0.6456046", "0.64348704", "0.64264435", "0.6355792", "0.6297414", "0.623296", "0.62291956", "0.6223041", "0.61303955", "0.6124231", "0.61233926", "0.612243", "0.6113089", "0.6102002", "0.605564...
0.70128644
0
diff_of_means takes in a dataframe of counts of skittles (like skittles) and their origin and returns the absolute difference of means between the number of oranges per bag from Yorkville and Waco.
def diff_of_means(data, col='orange'): skittles = data skittles["sum"] = skittles.sum(numeric_only=True, axis=1) yorkville = skittles.loc[skittles["Factory"] == "Yorkville"] waco = skittles.loc[skittles["Factory"] == "Waco"] return abs(yorkville[col].mean() -waco[col].mean())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def diff_of_means(data_1, data_2):\n # The difference of means of data_1, data_2: diff\n diff = np.mean(data_1) - np.mean(data_2)\n return diff", "def diff_of_means(data_1, data_2):\n\n # The difference of means of data_1, data_2: diff\n diff = np.mean(data_1)-np.mean(data_2)\n\n return diff", ...
[ "0.61920446", "0.6191641", "0.6150082", "0.6150082", "0.5934566", "0.5760465", "0.55434215", "0.5501849", "0.5440874", "0.5399032", "0.53529066", "0.53268355", "0.5321408", "0.5294929", "0.5185486", "0.5175903", "0.5175903", "0.5147754", "0.5130945", "0.5103602", "0.5084434",...
0.7585615
0
simulate_null takes in a dataframe of counts of skittles (like skittles) and their origin, and generates one instance of the teststatistic under the null hypothesis
def simulate_null(data, col='orange'): df = data.loc[data["Factory"].isin(np.array(["Waco", "Yorkville"]))] df = df[[col, "Factory"]] shuffled= ( df[col] .sample(replace=False, frac=1) .reset_index(drop=True) ) original_and_shuffled = ( df .assign(**{'Shuffle...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_stochatreat_output_no_null_treats(treatments_dict):\n treatments_df = treatments_dict[\"treatments\"]\n assert treatments_df[\"treat\"].isnull().sum() == 0, \"There are null assignments\"", "def test_with_shots_none(self):\n sampler = Sampler()\n result = sampler.run(\n ci...
[ "0.5930204", "0.56862783", "0.565035", "0.5505018", "0.5474153", "0.5472593", "0.54340166", "0.54319847", "0.5414649", "0.5402921", "0.5401196", "0.5368733", "0.5356214", "0.53448266", "0.53281367", "0.52950525", "0.5284538", "0.52789956", "0.5254063", "0.5251757", "0.5249014...
0.65114623
0
pval_orange takes in a dataframe of counts of skittles (like skittles) and their origin, and calculates the pvalue for the permutation test using 1000 trials.
def pval_orange(data, col='orange'): n_trials = 1000 differences = [] observed_difference = diff_of_means(data, col) for _ in range(n_trials): # shuffle the weights difference = simulate_null(data, col) # add it to the list of results differences.append(difference) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def manual_perm_test(model: 'Fitted sklearn estimator',\n X: 'Pandas df',\n y: 'Pandas series',\n true_score: float,\n n_permutations: int=10000,\n plot: bool=True,\n clf: bool=False) -> 'p-value...
[ "0.6030136", "0.5724346", "0.569684", "0.55865425", "0.5524843", "0.5475442", "0.5416673", "0.533493", "0.5277253", "0.5272123", "0.52555996", "0.51800054", "0.51461583", "0.50837976", "0.50823635", "0.507052", "0.5061921", "0.5059486", "0.50593233", "0.5040701", "0.50282633"...
0.6533991
0
ordered_colors returns your answer as an ordered list from "most different" to "least different" between the two locations. You list should be a hardcoded list, where each element has the form (color, pvalue).
def ordered_colors(): return [("yellow",0.263) ,("orange", 0.047), ("red",0.0),("green", 0.444), ("purple", 0.972)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_sorted_colors(colors: dict, sorted_names: list) -> list:\r\n sorted_colors = []\r\n for name in sorted_names:\r\n list.append(sorted_colors, colors[name])\r\n\r\n return sorted_colors", "def sortColors(self, nums: List[int]) -> None:\n\n red = 0\n white = 1\n blue = 2...
[ "0.7004721", "0.6824147", "0.6769305", "0.6700664", "0.6685316", "0.65987086", "0.6584858", "0.65333414", "0.6529312", "0.6495163", "0.6493362", "0.64637977", "0.64431506", "0.6410376", "0.6402401", "0.6387043", "0.6384323", "0.6361488", "0.6340934", "0.6336277", "0.6300782",...
0.84680796
0
same_color_distribution outputs a hardcoded tuple with the pvalue and whether you 'Accept' or 'Reject' the null hypothesis. >>> out = same_color_distribution() >>> isinstance(out[0], float) True >>> out[1] in ['Fail to Reject', 'Reject'] True
def same_color_distribution(): return 0.03, "Fail to Reject"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_hist_colors(candidate, expected1, expected2):\n\n assert hist_colors(candidate) == (expected1, expected2)", "def _random_color() -> List[float]:\n return [np.random.uniform(), np.random.uniform(), np.random.uniform()]", "def random_color() -> Tuple[int, int, int]:\n return randrange(0, 255), ...
[ "0.5990919", "0.5350464", "0.53470534", "0.53138745", "0.5289391", "0.5243735", "0.524281", "0.52380764", "0.5236244", "0.51772785", "0.5159144", "0.5153953", "0.50517535", "0.5045978", "0.50380236", "0.5037266", "0.5029589", "0.4995291", "0.496046", "0.49306923", "0.4904249"...
0.7563151
0
Multiple choice response for question 8 >>> out = perm_vs_hyp() >>> ans = ['P', 'H'] >>> len(out) == 5 True >>> set(out) <= set(ans) True
def perm_vs_hyp(): return ["P","P","P","P","P"]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def answers():\n answer = ([[1, 2, 2, 1], # 3. Not necessarily legal if terms of service disallow\n ['https://soundcloud.com/', # 1. soundcloud, some disallow\n 'https://cfmriweb.ucsd.edu/', # 1. wiki, some disallow\n 'https://www.thesaurus.com/', # 1. thesaurus, some d...
[ "0.59207153", "0.5808408", "0.5643477", "0.5552465", "0.5529437", "0.5472268", "0.5472268", "0.5472268", "0.5472268", "0.5469707", "0.54491585", "0.54332787", "0.54126716", "0.54105896", "0.53873295", "0.53617615", "0.53617615", "0.53617615", "0.53569764", "0.5282725", "0.524...
0.74474204
0
Multiple choice response for question 8 >>> out = after_purchase() >>> ans = ['MD', 'MCAR', 'MAR', 'NI'] >>> len(out) == 5 True >>> set(out) <= set(ans) True
def after_purchase(): return ["MCAR", "MD", "NI", "MAR","MAR"]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_store_three_responses(self):\n question = \"What language did you first learn to speak?\"\n my_survey = AnonymousSurvey(question)\n responses = ['English','German','French']\n for response in responses:\n my_survey.store_response(response)\n\n for response in ...
[ "0.60020375", "0.58717483", "0.55157185", "0.55157185", "0.55157185", "0.55157185", "0.5382636", "0.53652716", "0.5359235", "0.5342151", "0.533962", "0.5276502", "0.5273247", "0.5244043", "0.5244043", "0.5244043", "0.5232465", "0.52047324", "0.5195064", "0.517971", "0.5174562...
0.64320636
0
Multiple choice response for question 9 >>> out = multiple_choice() >>> ans = ['MD', 'MCAR', 'MAR', 'NI'] >>> len(out) == 5 True >>> set(out) >> out[1] in ans True
def multiple_choice(): return ["MAR", "MAR", "NI", "NI", "MCAR"]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def multiple_choices(self, choices, response):\n for elem in self.method_order:\n if elem in choices:\n return [elem]\n raise NoData", "def multiple_choice(correct_choice, all_choices):\r\n # format for character is {'あ': 'ah'}\r\n # format for character is {'japanes...
[ "0.6627957", "0.64027756", "0.6274816", "0.6274816", "0.6274816", "0.6274816", "0.60417473", "0.60417473", "0.60417473", "0.60417473", "0.5988469", "0.5867146", "0.5841692", "0.576208", "0.5735764", "0.5637686", "0.5637686", "0.5637686", "0.56292915", "0.56203747", "0.5600155...
0.7454306
0
Converts a named tuple object to an ImmutableSlots object.
def namedtuple_to_immutable_slots(tup: namedtuple) -> Type[_ImmutableSlotsBase]: return make_immutable_slots_class(tup._fields)(tup._asdict())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_tuple(in_dict,tupname='values'):\n the_tup = namedtuple(tupname, in_dict.keys())\n the_tup = the_tup(**in_dict)\n return the_tup", "def tuple_namer(name,tupl):\n tupl_templ = collections.namedtuple(name, 'battery status neighbour')\n named = tupl_templ(battery = tupl[0], status = tupl[1],...
[ "0.5847437", "0.5831953", "0.57099456", "0.56842464", "0.5633817", "0.54116267", "0.5404363", "0.53364587", "0.53333336", "0.5254004", "0.5215058", "0.51736814", "0.51676255", "0.5143053", "0.5117113", "0.51117927", "0.5107757", "0.5080521", "0.5059298", "0.5055158", "0.50393...
0.7912038
0
send a track to the API
def sendTrack(self, interpreter, title, link=None): return urllib2.urlopen( urllib2.Request( self.api_base_url+self.api_key, urllib.urlencode({ 'interpreter': interpreter, 'title': title, 'link': link })) ).read()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def track(self,name):\n self.sendCommand(\"global /track\",name)", "def track(self, track_id, **kwargs):\n _id = self._get_track_id(track_id)\n # pylint: disable=no-member\n return self._get(API.TRACK.value.format(id=_id), **kwargs)", "async def set_track(self, track: Optional[str])...
[ "0.68751675", "0.6809481", "0.6597903", "0.65403426", "0.6452935", "0.6406464", "0.63692", "0.6354182", "0.6281223", "0.61586994", "0.60754055", "0.6055909", "0.59933174", "0.5883789", "0.5875666", "0.58745676", "0.58637184", "0.5854832", "0.58506185", "0.5798716", "0.5791088...
0.72230273
0
Given some plot_options as part of a plot call, decide on final options.
def _plot_option_logic(plot_options_from_args): default_plot_options = copy.deepcopy(DEFAULT_PLOT_OPTIONS) file_options = tools.get_config_file() session_options = session.get_session_plot_options() plot_options_from_args = copy.deepcopy(plot_options_from_args) # Validate options and fill in defaul...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _processPlotTypeOptions(self):\n if self.plotDataType == PlotDataType.grid2d:\n self.plotOptionsToolBar.setAllowedPlotTypes(\n PlotType.image, PlotType.colormesh, PlotType.scatter2d\n )\n\n elif self.plotDataType == PlotDataType.scatter2d:\n self.pl...
[ "0.674999", "0.6641711", "0.64975595", "0.630337", "0.61323076", "0.6006877", "0.5936545", "0.5908138", "0.57951355", "0.57250416", "0.5652516", "0.56082225", "0.560066", "0.5551111", "0.5547328", "0.5546938", "0.55253613", "0.55043787", "0.5427558", "0.5401567", "0.53918284"...
0.73451847
0
Replot a matplotlib figure with plotly in IPython.
def iplot_mpl(fig, resize=True, strip_style=False, update=None, **plot_options): import plotly.tools fig = plotly.tools.mpl_to_plotly(fig, resize=resize, strip_style=strip_style) if update and isinstance(update, dict): fig.update(update) elif update is not None: raise _plotly_utils.exce...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def iplot(figure_or_data, **plot_options):\n from plotly.basedatatypes import BaseFigure, BaseLayoutType\n\n if \"auto_open\" not in plot_options:\n plot_options[\"auto_open\"] = False\n url = plot(figure_or_data, **plot_options)\n\n if isinstance(figure_or_data, dict):\n layout = figure_...
[ "0.7199734", "0.67511827", "0.6750704", "0.6731573", "0.655579", "0.6525485", "0.6423796", "0.6296553", "0.62379843", "0.6211984", "0.620417", "0.6188163", "0.6186371", "0.6174686", "0.6152642", "0.6139009", "0.607362", "0.6068566", "0.6052091", "0.60306394", "0.60303473", ...
0.7058932
1
Replot a matplotlib figure with plotly.
def plot_mpl(fig, resize=True, strip_style=False, update=None, **plot_options): import plotly.tools fig = plotly.tools.mpl_to_plotly(fig, resize=resize, strip_style=strip_style) if update and isinstance(update, dict): fig.update(update) elif update is not None: raise _plotly_utils.excep...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def iplot(figure_or_data, **plot_options):\n from plotly.basedatatypes import BaseFigure, BaseLayoutType\n\n if \"auto_open\" not in plot_options:\n plot_options[\"auto_open\"] = False\n url = plot(figure_or_data, **plot_options)\n\n if isinstance(figure_or_data, dict):\n layout = figure_...
[ "0.6826958", "0.6752633", "0.6570612", "0.64662457", "0.63952416", "0.636544", "0.634323", "0.6337081", "0.62863755", "0.6274899", "0.6144783", "0.6138428", "0.6116096", "0.6087245", "0.6086027", "0.6064025", "0.6011416", "0.6009311", "0.5987653", "0.5985614", "0.59496045", ...
0.7114484
0
Swap obj[key1] with obj[key2]
def _swap_keys(obj, key1, key2): val1, val2 = None, None try: val2 = obj.pop(key1) except KeyError: pass try: val1 = obj.pop(key2) except KeyError: pass if val2 is not None: obj[key2] = val2 if val1 is not None: obj[key1] = val1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __swap_kv(self, node1, node2):\r\n node1.key, node2.key = node2.key, node1.key\r\n node1.value, node2.value = node2.value, node1.value", "def swap(obj1, obj2):\n return obj2, obj1", "def set_obj2(self, obj1, obj2):\n self.obj1_obj2[obj1] = obj2", "def swap(self, x, y):\n se...
[ "0.7297494", "0.7208084", "0.6571542", "0.6521067", "0.6442046", "0.641916", "0.63468003", "0.63329935", "0.6316341", "0.6288712", "0.62851954", "0.62409693", "0.62176627", "0.6209308", "0.613267", "0.613267", "0.6107493", "0.6101429", "0.60906696", "0.6038625", "0.5968764", ...
0.82804424
0
Returns a JSON figure representation for the specified file Plotly uniquely identifies figures with a 'file_owner'/'file_id' pair. Since each file is given a corresponding unique url, you may also simply pass a valid plotly url as the first argument.
def get_figure(file_owner_or_url, file_id=None, raw=False): import plotly.tools plotly_rest_url = get_config()["plotly_domain"] if file_id is None: # assume we're using a url url = file_owner_or_url if url[: len(plotly_rest_url)] != plotly_rest_url: raise _plotly_utils.exceptio...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plotlyfromjson(fpath):\n with open(fpath, 'r') as f:\n v = json.loads(f.read().encode().decode())\n\n fig = go.Figure(data=v['data'], layout=v['layout'])\n return fig\n # iplot(fig, show_link=False)", "def create_figure_file():\n\n # Any plotly compliant dict or list that can be convert...
[ "0.6201225", "0.58051383", "0.55810076", "0.5529109", "0.544995", "0.52864736", "0.51116204", "0.5072611", "0.5001298", "0.5000963", "0.4995678", "0.49639544", "0.49576038", "0.49263456", "0.49240315", "0.48255748", "0.48229688", "0.47934148", "0.4782595", "0.47803304", "0.47...
0.75329757
0
Initialize a Stream object with your unique stream_id. Find your stream_id at {plotly_domain}/settings.
def __init__(self, stream_id): self.stream_id = stream_id self._stream = None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, arg=None, maxpoints=None, token=None, **kwargs):\n super(Stream, self).__init__(\"stream\")\n\n # Validate arg\n # ------------\n if arg is None:\n arg = {}\n elif isinstance(arg, self.__class__):\n arg = arg.to_plotly_json()\n elif...
[ "0.65360594", "0.65284956", "0.65099794", "0.65099794", "0.6359299", "0.62888134", "0.627075", "0.616162", "0.61568725", "0.6090464", "0.60570395", "0.6003694", "0.5991606", "0.5950815", "0.5910893", "0.58550227", "0.5847195", "0.5809842", "0.57834864", "0.5774941", "0.575554...
0.7824181
0
Returns the streaming server, port, ssl_enabled flag, and headers.
def get_streaming_specs(self): streaming_url = get_config()["plotly_streaming_domain"] ssl_verification_enabled = get_config()["plotly_ssl_verification"] ssl_enabled = "https" in streaming_url port = self.HTTPS_PORT if ssl_enabled else self.HTTP_PORT # If no scheme (https/https)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_request(\n self,\n ) -> typing.Tuple[ssl.SSLSocket, typing.Tuple[str, int]]:\n socket, addr = self.socket.accept()\n stream = ssl.wrap_socket(\n socket,\n server_side=True,\n keyfile=self.keyfile,\n certfile=self.certfile,\n ssl...
[ "0.61110896", "0.57250774", "0.5683427", "0.56257254", "0.5585618", "0.55359834", "0.55183804", "0.5342632", "0.53296316", "0.52517325", "0.52303445", "0.52181673", "0.51873034", "0.5181517", "0.5177206", "0.51663375", "0.5151513", "0.5140805", "0.51296836", "0.5127893", "0.5...
0.68292314
0
Close the stream connection to plotly's streaming servers.
def close(self): try: self._stream.close() except AttributeError: raise _plotly_utils.exceptions.PlotlyError( "Stream has not been opened yet." )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close_stream(self):\n sel.socket.close()", "def disconnect(self):\n stream=self.get_stream()\n if stream:\n stream.disconnect()", "def close(self):\n self.stream.stop_stream()\n self.stream.close()\n self.p.terminate()", "def _close_stream(p, stream):\...
[ "0.7038836", "0.6809915", "0.6370374", "0.6226571", "0.6219564", "0.6183803", "0.61723834", "0.615057", "0.6136596", "0.61273986", "0.6110791", "0.60903466", "0.6074495", "0.606672", "0.60604995", "0.6060323", "0.60494447", "0.60249203", "0.6017445", "0.60132563", "0.60065466...
0.81177336
0
Save a image of the plot described by `figure_or_data` locally as `filename`. Valid image formats are 'png', 'svg', 'jpeg', 'pdf' and 'emf'. The format is taken as the extension of the filename or as the supplied format.
def save_as( cls, figure_or_data, filename, format=None, width=None, height=None, scale=None ): # todo: format shadows built-in name (base, ext) = os.path.splitext(filename) if not ext and not format: filename += ".png" elif ext and not format: format ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_figure(plt, name, fmt='all'):\n \n if fmt in ('jpg', 'all'):\n fname = os.path.join(SAVEDIR, f\"{name}.jpg\")\n plt.savefig(fname, **FIGURE_KWARGS['jpg'])\n if fmt in ('svg', 'all'):\n fname = os.path.join(SAVEDIR, f\"{name}.svg\")\n plt.savefig(fname, **FIGURE_KWARGS[...
[ "0.71846277", "0.70481104", "0.69980633", "0.69701624", "0.69000703", "0.6853185", "0.681366", "0.68117416", "0.67696893", "0.6699261", "0.6639746", "0.65510106", "0.65188605", "0.6498196", "0.6486598", "0.64562404", "0.6453651", "0.6444305", "0.6356741", "0.63389814", "0.633...
0.7904951
0
Upload a grid to your Plotly account with the specified filename.
def upload( cls, grid, filename=None, world_readable=True, auto_open=True, meta=None ): # transmorgify grid object into plotly's format grid_json = grid._to_plotly_grid_json() if meta is not None: grid_json["metadata"] = meta payload = {"data": grid_json, "world_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_GRID( self , filename ):\n self._fwrite_GRID( filename )", "def upload(cls, meta, grid=None, grid_url=None):\n fid = parse_grid_id_args(grid, grid_url)\n return v2.grids.update(fid, {\"metadata\": meta}).json()", "def import_grid(file_name):\n\n return FileReader(file_name=fil...
[ "0.6436436", "0.6056239", "0.57571983", "0.5604714", "0.5547521", "0.55456346", "0.54981285", "0.5425839", "0.5378712", "0.52782524", "0.52125007", "0.5204059", "0.5099559", "0.5084988", "0.5080778", "0.5079114", "0.5020949", "0.5014791", "0.49684644", "0.49590257", "0.495235...
0.7272853
0
Append columns to a Plotly grid. `columns` is an iterable of plotly.grid_objs.Column objects and only one of `grid` and `grid_url` needs to specified. `grid` is a ploty.grid_objs.Grid object that has already been uploaded to plotly with the grid_ops.upload method. `grid_url` is a unique URL of a `grid` in your plotly a...
def append_columns(cls, columns, grid=None, grid_url=None): grid_id = parse_grid_id_args(grid, grid_url) grid_ops.ensure_uploaded(grid_id) # Verify unique column names column_names = [c.name for c in columns] if grid: existing_column_names = [c.name for c in grid] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _set_grid_column_references(figure, grid):\n from plotly.basedatatypes import BaseFigure\n\n for col in grid:\n prop_path = BaseFigure._str_to_dict_path(col.name)\n prop_parent = figure\n for prop in prop_path[:-1]:\n prop_parent = prop_parent[prop]\n\n prop_parent[...
[ "0.5943319", "0.5628936", "0.5230675", "0.51281375", "0.5109687", "0.5079159", "0.50280106", "0.50114954", "0.4970198", "0.4965271", "0.49189016", "0.48864537", "0.48318532", "0.4806694", "0.48048466", "0.47727522", "0.4772182", "0.47653592", "0.4756444", "0.47546798", "0.472...
0.85522825
0
Append rows to a Plotly grid. `rows` is an iterable of rows, where each row is a list of numbers, strings, or dates. The number of items in each row must be equal to the number of columns in the grid. If appending rows to a grid with columns of unequal length, Plotly will fill the columns with shorter length with empty...
def append_rows(cls, rows, grid=None, grid_url=None): grid_id = parse_grid_id_args(grid, grid_url) grid_ops.ensure_uploaded(grid_id) if grid: n_columns = len([column for column in grid]) for row_i, row in enumerate(rows): if len(row) != n_columns: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _appendRows(self, rows, gridName):\n body = {\n 'values': rows\n }\n result = self.service.spreadsheets().values().append(\n spreadsheetId=self.SPREADSHEETID, range=gridName,\n valueInputOption=\"USER_ENTERED\", body=body).execute()\n ...
[ "0.65651476", "0.60804015", "0.54311484", "0.538625", "0.5365716", "0.53307086", "0.5273271", "0.52221763", "0.5206065", "0.520537", "0.5203777", "0.51569676", "0.5131733", "0.5053757", "0.5029543", "0.5025182", "0.5022299", "0.50163096", "0.4983757", "0.49728733", "0.4914881...
0.8073901
0
Delete a grid from your Plotly account. Only one of `grid` or `grid_url` needs to be specified. `grid` is a plotly.grid_objs.Grid object that has already been uploaded to Plotly. `grid_url` is the URL of the Plotly grid to delete
def delete(cls, grid=None, grid_url=None): fid = parse_grid_id_args(grid, grid_url) grid_ops.ensure_uploaded(fid) v2.grids.trash(fid) v2.grids.permanent_delete(fid)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_figure_grid(fig: object, grid: object) -> None:\n\n mpl.delete(grid)", "def delete_grid(self):\n\n\t\tself.a_grid = None\t\t# Deletes the object from memory", "def deleteClimateGridEntry(context, key):\n GenericMetadata.deleteEntryFromSection(context, GenericMetadata.CLIMATE_GRID_SECTION, ...
[ "0.7186983", "0.67403626", "0.5834384", "0.5561851", "0.5319743", "0.52811825", "0.5211115", "0.5207671", "0.51796585", "0.50366807", "0.499836", "0.49930185", "0.4973415", "0.4872451", "0.48672095", "0.4813392", "0.47991794", "0.4791814", "0.4761085", "0.47460988", "0.474547...
0.7675923
0
Upload Metadata to a Plotly grid. Metadata is any JSONencodable object. For example, a dictionary, string, or list. Only one of `grid` or `grid_url` needs to be specified. `grid` is a plotly.grid_objs.Grid object that has already been uploaded to Plotly. `grid_url` is the URL of the Plotly grid to attach Metadata to.
def upload(cls, meta, grid=None, grid_url=None): fid = parse_grid_id_args(grid, grid_url) return v2.grids.update(fid, {"metadata": meta}).json()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upload(\n cls, grid, filename=None, world_readable=True, auto_open=True, meta=None\n ):\n # transmorgify grid object into plotly's format\n grid_json = grid._to_plotly_grid_json()\n if meta is not None:\n grid_json[\"metadata\"] = meta\n\n payload = {\"data\": g...
[ "0.6808476", "0.55337286", "0.54692566", "0.52799404", "0.52799404", "0.52799404", "0.52799404", "0.52799404", "0.52799404", "0.52799404", "0.52541316", "0.51228565", "0.5045308", "0.5039793", "0.503959", "0.5015943", "0.5015943", "0.5008952", "0.50036097", "0.4995261", "0.49...
0.77461725
0
Return the grid_id from the nonNone input argument. Raise an error if more than one argument was supplied.
def parse_grid_id_args(grid, grid_url): if grid is not None: id_from_grid = grid.id else: id_from_grid = None args = [id_from_grid, grid_url] arg_names = ("grid", "grid_url") supplied_arg_names = [ arg_name for arg_name, arg in zip(arg_names, args) if arg is not None ] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def input_grid_size(n: int = None) -> int:\n if n is None:\n print(\"Please enter grid size as integer\")\n in_size = input(\"Grid size: \")\n try:\n processed_size = int(in_size)\n if processed_size <= 0:\n raise GridError(\"Incorrect grid size, should ...
[ "0.5901206", "0.5866118", "0.5744191", "0.56400174", "0.55817884", "0.55191326", "0.54913074", "0.54913074", "0.54913074", "0.5467385", "0.546528", "0.546528", "0.546528", "0.546528", "0.546528", "0.5451512", "0.53863543", "0.53851545", "0.53799814", "0.53799814", "0.5378563"...
0.6769207
0
Check that share key is enabled and update url to include the secret key
def add_share_key_to_url(plot_url, attempt=0): urlsplit = urllib.parse.urlparse(plot_url) username = urlsplit.path.split("/")[1].split("~")[1] idlocal = urlsplit.path.split("/")[2] fid = "{}:{}".format(username, idlocal) body = {"share_key_enabled": True, "world_readable": False} response = v2.f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_set_share(self):\n self.app.post_json(url=\"/config/shares\",\n params=dict(\n source='gsiftp://source',\n destination='gsiftp://nowhere',\n vo='dteam',\n ...
[ "0.57457876", "0.5697298", "0.5606015", "0.5575573", "0.55460995", "0.5532096", "0.55242616", "0.5515466", "0.5480044", "0.54565465", "0.5449846", "0.54389703", "0.53686386", "0.5361808", "0.5354469", "0.53479713", "0.53303134", "0.53255117", "0.53255117", "0.53246206", "0.53...
0.7188282
0
Returns the specified grid as a Grid instance or in JSON/dict form.
def get_grid(grid_url, raw=False): fid = parse_grid_id_args(None, grid_url) response = v2.grids.content(fid) parsed_content = response.json() if raw: return parsed_content return Grid(parsed_content, fid)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getGrid(self):\n\n\t\treturn self._grid", "def getGrid(self):\n\n\t\t\treturn self._logic.getGrid()", "def get_grid(self):\r\n return self.grid", "def grid(self):\n if hasattr(self.cls, \"grid\"):\n return self.cls.grid", "def get_grid(self):\n return self._grid", "def...
[ "0.659167", "0.65391994", "0.63961095", "0.6389297", "0.63853145", "0.62779856", "0.6201186", "0.6196243", "0.6151549", "0.60673505", "0.6022994", "0.59992915", "0.5958351", "0.59094775", "0.58419627", "0.58129126", "0.58106285", "0.57829565", "0.5735798", "0.5711646", "0.558...
0.7106741
0
Create or update (if file exists) and plot, spectacle, or dashboard object
def _create_or_update(data, filetype): api_module = getattr(v2, filetype + "s") # lookup if pre-existing filename already exists if "parent_path" in data: filename = data["parent_path"] + "/" + data["filename"] else: filename = data.get("filename", None) if filename: try: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create(self):\n self.create_file()", "def test_DL_export_existing_file(self):\n filepath = '3.txt'\n existing_file = open(filepath, 'x')\n existing_file.write(\"This file is existing.\")\n existing_file.close()\n dl = flow_processing_input.DetectorsLocation(2021)\n ...
[ "0.58206177", "0.5560111", "0.5492527", "0.5477165", "0.54585886", "0.54557425", "0.54345864", "0.54220116", "0.5403174", "0.5384884", "0.5347757", "0.53445154", "0.5339448", "0.5320854", "0.53163195", "0.52945584", "0.5291235", "0.528829", "0.52748024", "0.52698153", "0.5259...
0.58983546
0
Create or overwrite (if file exists) a grid
def _create_or_overwrite_grid(data, max_retries=3): api_module = v2.grids # lookup if pre-existing filename already exists if "parent_path" in data: filename = data["parent_path"] + "/" + data["filename"] else: filename = data.get("filename", None) if filename: try: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_GRID( self , filename ):\n self._fwrite_GRID( filename )", "def _ensure_grid_file(self, clobber, **kwargs):\n if os.path.exists(self.grid_file) and not clobber:\n print(f'exists: {self.grid_file}')\n return\n \n # generate file if needed\n if sel...
[ "0.6903848", "0.62700546", "0.6261709", "0.5990803", "0.5818813", "0.5719103", "0.5593271", "0.550517", "0.5497797", "0.5459508", "0.53811026", "0.53346616", "0.52730274", "0.52547", "0.52231735", "0.5141341", "0.5114245", "0.5095713", "0.5095273", "0.5081367", "0.5078799", ...
0.7367
0
Returns a Dashboard object from a dashboard name.
def get_dashboard(cls, dashboard_name): dashboard_json = cls._get_dashboard_json(dashboard_name) return dashboard.Dashboard(dashboard_json)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_dashboard(resource_root, dashboard_name):\n return call(resource_root.get, _get_dashboard_path(dashboard_name), \\\n ApiDashboard)", "def get(resource_name: str,\n id: pulumi.Input[str],\n opts: Optional[pulumi.ResourceOptions] = None) -> 'Dashboard':\n opts = pulumi.Re...
[ "0.73589206", "0.6890932", "0.67619425", "0.655442", "0.63736624", "0.6345506", "0.63205844", "0.6297831", "0.60473573", "0.59165466", "0.5912832", "0.5871978", "0.57265705", "0.56691986", "0.56377304", "0.55732214", "0.55593884", "0.55397475", "0.5507765", "0.54816306", "0.5...
0.861657
0
Return list of all active dashboard names from users' account.
def get_dashboard_names(cls): dashboards = cls._get_all_dashboards() return [str(dboard["filename"]) for dboard in dashboards]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display_accounts(cls):\n return cls.account_list", "def list(ctx):\n if ctx.obj.get('NAMESPACE') != 'accounts':\n click.echo(\n click.style('Only account data is available for listing.', fg='red')\n )\n return\n\n swag = create_swag_from_ctx(ctx)\n accounts = s...
[ "0.64981794", "0.6417875", "0.63847524", "0.63779753", "0.6344453", "0.6327755", "0.6259707", "0.6220032", "0.6215746", "0.6207821", "0.6178857", "0.6154511", "0.6147729", "0.6140553", "0.6117583", "0.61069334", "0.609698", "0.60702467", "0.603182", "0.60122234", "0.6011292",...
0.6887892
0