query
stringlengths
10
2k
document
stringlengths
20
51.2k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Creates the set of probabilities for the first quadrant. The other three quadrants are copies of this.
def init_block(): final_locs = [[1 for x in range(LOC_SIZE)] for y in range(LOC_SIZE)] for a in range(int(LOC_SIZE / 2)): for b in range(a, int(LOC_SIZE / 2)): # creating and ringing each of the fleas individually print(a, b) locs = [[1 if x == a and y == b else 0 for...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _set_points_and_weights(self):\n if hasattr(self, 'corr'):\n corr = self.corr\n else:\n corr = None\n self.quadrature = Quadrature(parameters=self.parameters, basis=self.basis, \\\n points=self.inputs, mesh=self.mesh, corr=corr)\n quadrat...
[ "0.5961016", "0.58012664", "0.57640105", "0.56292635", "0.53925997", "0.5370593", "0.5367571", "0.53162426", "0.53018135", "0.5242785", "0.52410793", "0.5222286", "0.5174538", "0.51670957", "0.51043785", "0.5088906", "0.50844294", "0.5076748", "0.50747144", "0.50733787", "0.5...
0.0
-1
Creates a vocab of up to max_size words, reading from the vocab_file. If max_size is 0, reads the entire vocab file.
def __init__(self, vocab_file, max_size): self._word_to_id = {} self._id_to_word = {} self._count = 0 # keeps track of total number of words in the Vocab # [UNK], [PAD], [START] and [STOP] get the ids 0,1,2,3. for w in [UNKNOWN_TOKEN, PAD_TOKEN, START_DECODING, STOP_DECODING]: self._word_to_id[w] = self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_vocab(vocab_size):\n vocab_dict = tff.simulation.datasets.stackoverflow.load_word_counts(\n cache_dir='/tmp')\n return list(vocab_dict.keys())[:vocab_size]", "def create_vocabulary(vocabulary_path, data_path, max_vocabulary_size,\n tokenizer=None, normalize_digits=True):\n ...
[ "0.77154875", "0.7610258", "0.75389427", "0.7482672", "0.74462205", "0.71611786", "0.7073963", "0.70486355", "0.6762593", "0.6707071", "0.661201", "0.65914786", "0.64898854", "0.6485488", "0.64273554", "0.6421991", "0.6369072", "0.6351218", "0.6325294", "0.62968075", "0.62607...
0.69756883
8
Add a point that exists in building config but not in message.
def AddMissingPoint(self, point: str) -> None: self._valid = False self._missing_points.append(point)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def AddMissingPresentValue(self, point: str) -> None:\n self._valid = False\n self._missing_present_values.append(point)", "def AddExtraPoint(self, point: str) -> None:\n self._valid = False\n self._extra_points.append(point)", "def addBuildPoint(self, data=None, event=None, axes=None):\n\n ...
[ "0.6199457", "0.60503995", "0.57947356", "0.5788921", "0.5535654", "0.54810846", "0.5433729", "0.5320492", "0.5319616", "0.5284959", "0.52364117", "0.52364117", "0.52364117", "0.52131104", "0.5211699", "0.5187845", "0.5168795", "0.5150008", "0.51141715", "0.5109992", "0.50532...
0.6627074
0
Sets the learning rate to the initial LR decayed by 10 every 30 epochs
def adjust_learning_rate(optimizer, epoch): lr = args.lr * ((1 - 0.015) ** epoch) for param_group in optimizer.param_groups: param_group['lr'] = lr
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def adjust_learning_rate(init_lr, optimizer, epoch, n=100):\n init_lr = init_lr * (0.1 ** (epoch // n))\n print('learning rate : ', init_lr)\n for param_group in optimizer.param_groups:\n param_group['lr'] = init_lr", "def adjust_learning_rate(start_lr, optimizer, epoch, total_epoch_num):\n #l...
[ "0.7913536", "0.7906521", "0.7849834", "0.777524", "0.77338326", "0.77306354", "0.7722718", "0.77224237", "0.771982", "0.77092624", "0.7693604", "0.76742035", "0.7665748", "0.7665748", "0.7665748", "0.7655329", "0.76419765", "0.76399755", "0.7637868", "0.7626077", "0.76247585...
0.7398816
69
Convert a Cypher value to a Python Unicode string. This function converts the supplied value into a string form, as used for humanreadable output. This is generally identical to
def cypher_str(value, **kwargs): if isinstance(value, unicode_types): return value elif isinstance(value, string_types): return value.decode(kwargs.get("encoding", "utf-8")) else: return cypher_repr(value, **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _unicodeify(self, value, encoding=\"utf8\"):\n if isinstance(value, str):\n return value\n return str(value, encoding)", "def _convertUnicodeForCPS(self, value):\n try:\n value = str(value)\n except UnicodeEncodeError:\n try:\n value...
[ "0.73247373", "0.7293527", "0.7141125", "0.69979966", "0.6909878", "0.6879357", "0.67949605", "0.6731768", "0.666175", "0.654128", "0.65021574", "0.6477549", "0.6477549", "0.644888", "0.6448638", "0.64203465", "0.64179426", "0.6406938", "0.6384979", "0.63812923", "0.6380067",...
0.78996384
0
Original Implementation of the gelu activation function in Google Bert repo when initially created.
def _gelu_python(x): return x * 0.5 * (1.0 + torch.erf(x / math.sqrt(2.0)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gelu_activation(inp):\n out = 1 + tf.tanh(np.sqrt(np.pi) * (inp + 0.044715 * tf.pow(inp, 3)))\n out *= 0.5 * inp\n return out", "def gelu_activation(inp):\n out = 1 + tf.tanh(np.sqrt(np.pi) * (inp + 0.044715 * tf.pow(inp, 3)))\n out *= 0.5 * inp\n return out", "def gelu(input_tensor, appr...
[ "0.7250695", "0.7250695", "0.7118769", "0.6987851", "0.6980915", "0.69768816", "0.67160904", "0.67001384", "0.650245", "0.648378", "0.6446696", "0.6422017", "0.6411159", "0.6378614", "0.6306891", "0.61967504", "0.6176067", "0.6128397", "0.6128397", "0.6128397", "0.6128397", ...
0.6266658
15
Basic contact page that takes a name, email, and message and sends the message as an email to the site owner.
def contact(request): if request.method == 'POST': contact_form = forms.Contact(request.POST) if contact_form.is_valid(): cleaned = contact_form.cleaned_data message = f""" Name: {cleaned['first_name']} {cleaned['last_name']} Message: {cl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def email_page(data):\n subject = f\"Inkbusters form contact: {data['title']}\"\n sender = current_app.config[\"MAIL_USERNAME\"]\n recipients= ['adrian.borowski.tattoo@gmail.com']\n text_body=render_template('email/email_contact.txt', data=data)\n html_body=render_template('email/email_contact.html'...
[ "0.7681415", "0.76364386", "0.7580009", "0.75336844", "0.7508874", "0.74715376", "0.7387366", "0.73862416", "0.73083216", "0.7290592", "0.7290198", "0.72797084", "0.72797084", "0.72047776", "0.72031397", "0.72031397", "0.72031397", "0.72031397", "0.72031397", "0.72031397", "0...
0.7452471
6
Returns is seq is sequence and not string.
def _is_proper_sequence(seq): return (isinstance(seq, collections.abc.Sequence) and not isinstance(seq, str))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _is_sequence(obj):\n return hasattr(obj, \"__iter__\") and not isinstance(obj, str)", "def is_sequence(value):\n return (hasattr(value, \"__iter__\") and not\n isinstance(value, (six.string_types, six.binary_type)))", "def is_sequence(item):\n return (not hasattr(item, \"strip\") an...
[ "0.76831025", "0.75530386", "0.7428751", "0.7346544", "0.72136575", "0.7135174", "0.70628536", "0.6936288", "0.68852645", "0.687924", "0.6743411", "0.67217743", "0.670854", "0.6705627", "0.66954195", "0.6666201", "0.6439784", "0.63700044", "0.6265502", "0.62411654", "0.608838...
0.8542561
0
Generates the app routes using the configuration parameters.
def generate_app_routes(conf: T.Dict[T.Text, T.Any]) -> T.List[web.RouteDef]: app_routes = [ web.get("/api/verify", rest.verify), web.get("/api/interpolate", rest.interpolate), ] if conf.get("graphiql"): app_routes.append(graphql.get_view(graphiql=True)) else: app_routes....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_routes(self):\r\n self._app.route('/api/autoconf',\r\n methods=['GET'],\r\n endpoint='api_autoconf')(self.entrypoint)\r\n self._app.route('/api/autoconf/<string:session_id>',\r\n methods=['GET', 'POST', 'DELETE'],\r\n ...
[ "0.7552453", "0.7467011", "0.70304716", "0.70142955", "0.6975728", "0.6853407", "0.6761418", "0.66410583", "0.6578278", "0.65600365", "0.64498144", "0.640278", "0.6389206", "0.6334587", "0.63295215", "0.6309324", "0.628035", "0.6262996", "0.6252107", "0.6222517", "0.6213156",...
0.78941584
0
Given a list, it concatenates all the elements into a string.
def list2string(a_list): the_string = '' for elem in a_list: the_string += str(elem) return the_string
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stringer(list):\n\tstring = \"\"\n\tfor x in list:\n\t\tstring = string + str(x)\n\treturn string", "def listToStringFormat(self, list) ->str:\n string = ''\n for element in list:\n string = string + str(element) + \"\\n\"\n return string", "def list_join(the_list):\n ret...
[ "0.86829597", "0.795348", "0.7901727", "0.78963417", "0.78103286", "0.76697254", "0.76127714", "0.76094127", "0.7530823", "0.7454834", "0.7435962", "0.74323213", "0.73956984", "0.73895997", "0.73823947", "0.73823947", "0.73775", "0.7371389", "0.7365496", "0.731931", "0.731412...
0.81429213
1
Returns the first_name plus the last_name, with a space in between.
def get_full_name(self): full_name = '%s %s' % (self.first_name, self.last_name) return full_name.strip()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def full_name(first_name, last_name):\n return first_name + \" \" + last_name", "def full_name(first_name, last_name):\n\t\n\treturn first_name + \" \" + last_name", "def get_formated_name(first_name,last_name):\n\tfull_name = first_name + '' + last_name\n\treturn full_name.title()", "def get_full_name(se...
[ "0.8313066", "0.82006806", "0.8049215", "0.80409706", "0.8017754", "0.7999701", "0.79541886", "0.7942144", "0.7942144", "0.7942144", "0.7937664", "0.79287225", "0.7921711", "0.790314", "0.7892264", "0.7890117", "0.7878668", "0.786143", "0.78528684", "0.7823523", "0.7813124", ...
0.77466476
47
Test that the url can deal with the current_app context setting.
def test_url_current_app(): from coffin.template.loader import get_template_from_string from django.template import RequestContext from django.http import HttpRequest t = get_template_from_string('{% url testapp:the-index-view %}') assert t.render(RequestContext(HttpRequest())) == '/app/one/' as...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_0020_external(self):\n self.setup_defaults()\n app = self.get_app()\n\n with app.test_request_context('/'):\n self.assertEqual(\n url_for('nereid.website.home', _external=True),\n 'http://localhost/'\n )", "def test_home_route_cont...
[ "0.6544757", "0.63869876", "0.636498", "0.63288945", "0.63288945", "0.63078755", "0.62511945", "0.6223648", "0.61608344", "0.6149793", "0.61488473", "0.6083443", "0.6059816", "0.6058962", "0.60523534", "0.6024216", "0.6016266", "0.601187", "0.59928435", "0.5983868", "0.596849...
0.70756197
0
Define A Simple Data Source Constructor
def data_source(): dataset = [0.1, 0.2, 0.3, 0.4, 0.5] while True: time.sleep(2) yield random.choice(dataset)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, data_source_identifier, verbose=True):\n pass", "def __init__(self):\r\n super(DataSource, self).__init__()", "def __init__(self, **kwargs):\n DataLoader.__init__(self, **kwargs)", "def _init_data_source():\n\n x = np.array([1])\n y = np.sin(x)\n avg = np.cumsum(y...
[ "0.7411646", "0.7189689", "0.66582537", "0.65334475", "0.64920527", "0.64828986", "0.64650285", "0.64563006", "0.6447131", "0.64084506", "0.63733727", "0.6348368", "0.63443285", "0.6323235", "0.63107264", "0.63107264", "0.6273803", "0.6269963", "0.6239284", "0.6216172", "0.62...
0.0
-1
Get parser description. We parse this as reStructuredText, allowing users to embed rich information in their help messages if they so choose.
def _format_description(parser): for line in statemachine.string2lines( parser.description, tab_width=4, convert_whitespace=True): yield line
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def programDescription(self):\n return self._parser.description", "def get_description(self):\n try:\n long_desc = self.__data[\"descriptions\"][\"MM - \" + self.__name][\"text\"].replace(\"<p>\", \"\").split('</p>')[0]\n return long_desc\n except:\n return N...
[ "0.7108416", "0.69704455", "0.68859166", "0.68767816", "0.68767816", "0.682973", "0.682973", "0.682973", "0.682973", "0.67996067", "0.6778806", "0.67397755", "0.67397755", "0.6728579", "0.6728579", "0.67031825", "0.6693854", "0.66926014", "0.6679759", "0.6674419", "0.66639555...
0.0
-1
Get a reader by reader's type.
def get_reader(reader_type): return reader_dict.get(reader_type, None)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_reader(fn):\n if is_bed(fn):\n return BedReader(fn)\n elif is_vcf(fn):\n return VcfReader(fn)\n else:\n raise ValueError(\"Could not get reader for %s\" % fn)", "def _get_reader(self, filepath: str):\n file_extension = os.path.splitext(filepath)[-1]\n\n self._v...
[ "0.7281672", "0.6302608", "0.6185781", "0.61075497", "0.5981711", "0.5973598", "0.59378946", "0.5904417", "0.58844227", "0.5740614", "0.5700527", "0.5684732", "0.5681969", "0.5621444", "0.5567588", "0.5534645", "0.5519957", "0.53459203", "0.53018034", "0.526802", "0.5236586",...
0.8406222
0
Gets the value of the element. For input tags, this method is used to retrieve the value (cannot be obtained with the Textcontent property). Note that for DOM elements with no value, the value is none.
def value(self): return self.raw.get_attribute("value")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def value(self):\n\n return self.element().get_attribute('value') if self.exists() else ''", "def getValue(self):\n return self.field.text()", "def value(self):\n return self.element.get_attribute('value')", "def value(self):\n return self.element.get_attribute('value')", "def v...
[ "0.7887481", "0.78870845", "0.78830457", "0.78830457", "0.78830457", "0.77831835", "0.7523947", "0.74936545", "0.7473668", "0.74506706", "0.7379061", "0.7379061", "0.7345596", "0.7345596", "0.7345596", "0.7345596", "0.7345596", "0.7345596", "0.7345596", "0.7345596", "0.734559...
0.0
-1
Compute softmax values for each sets of scores in x.
def softmax(x): sf = np.exp(x) sf = sf / np.sum(sf, axis=0) return sf
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def softmax(self, scores):\n\n\n # for each sample, for each class ,caclulate\n # np.exp(scores) : still (n_samples, n_classes)\n\n # axis = 1\n # a00, a01, a02 as a sinlge one to perfrom np_sum\n # which is the same sample \n # sum_exp : still (n_samples, 1)\n\n # ...
[ "0.7796294", "0.7760558", "0.7759004", "0.77567077", "0.76577055", "0.76577055", "0.76577055", "0.76577055", "0.7585655", "0.743143", "0.7407772", "0.73941606", "0.7358175", "0.73174125", "0.72689486", "0.72623265", "0.72614294", "0.7256868", "0.723019", "0.7214918", "0.72017...
0.0
-1
Converts flattened theta back to tensor shape compatible with network
def pack_theta(model, theta): weights = [] idx = 0 for layer in model.layers: layer_weights = [] for param in layer.get_weights(): plen = np.prod(param.shape) layer_weights.append(np.asarray( theta[idx:(idx+plen)].reshape(param.shape), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tf_flatten(x):\n return tf.contrib.layers.flatten(x)", "def out_degrees_tf_vector(self):\n return tf.reshape(self.out_degrees_tf, [self.n])", "def _flatten(self, inputT, size):\n return tf.reshape(inputT, (-1, size))", "def _flatten(prev_layer):\n\n with tf.name_scope('flatten'):\n sha...
[ "0.64800155", "0.62993", "0.6212624", "0.61442155", "0.61127913", "0.6107817", "0.6011825", "0.5938885", "0.59202063", "0.5907756", "0.5895051", "0.5882685", "0.58445317", "0.5799527", "0.577262", "0.57253724", "0.57253724", "0.5718193", "0.5685154", "0.56815773", "0.567601",...
0.61661416
3
Sets the Keras model params from a flattened numpy array of theta
def set_model_params(model, theta): weights = pack_theta(model, theta) model.set_weights(weights) return model
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def with_params(self, theta):\n self.params = theta\n return self", "def _set_weights(self, theta):\n self.rnn.theta.set_value(theta)", "def theta(self, theta):\n self.kernel.theta = theta", "def pack_theta(model, theta):\n weights = []\n idx = 0\n for layer in model.laye...
[ "0.6812525", "0.66009647", "0.62490714", "0.6046544", "0.60355115", "0.59157515", "0.59119356", "0.59011436", "0.5796549", "0.5793016", "0.5772094", "0.57327294", "0.56880444", "0.5686082", "0.5668403", "0.56546223", "0.5641231", "0.56330866", "0.56214255", "0.5532082", "0.55...
0.76384664
0
Return the height of the window
def getHeight(self): return self.height
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def window_height(self):\n return self._window_size()[1]", "def height(self):\n _, ymin, _, ymax = self.viewport\n return self.parent.window_size[1] * (ymax - ymin)", "def height(self):\n return(self.SCREEN_H)", "def height(self) -> int:\n return self.screen.getmaxyx()[0]",...
[ "0.8742522", "0.86418915", "0.81723183", "0.8047453", "0.7829384", "0.76832265", "0.76553386", "0.7527061", "0.75238705", "0.75062746", "0.74959934", "0.7469232", "0.74500936", "0.74455863", "0.74455863", "0.7442378", "0.74163246", "0.7395741", "0.7395741", "0.7395741", "0.73...
0.74715227
12
Undraw the object (i.e. hide it). Returns silently if the object is not currently drawn.
def undraw(self): if not self.canvas: return if not self.canvas.isClosed(): #self.canvas.delete(self.id) _tkExec(self.canvas.delete, self.id) if self.canvas.autoflush: #_root.update() _tkCall(_root.update) pass ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def discard(self, obj):\n self._drawables.discard(obj)\n self._updateables.discard(obj)\n self._collidables.discard(obj)\n self._projectiles.discard(obj)\n self._textboxes.discard(obj)\n self.__len__.cache_clear()", "def unbind(self, *args, **kwargs):\n self._canv...
[ "0.6406441", "0.62361354", "0.6193606", "0.6178376", "0.61770606", "0.6104393", "0.6041389", "0.5991233", "0.5923967", "0.5899326", "0.58970976", "0.58596146", "0.58549887", "0.5854115", "0.58108544", "0.57884526", "0.57866013", "0.5782513", "0.5741284", "0.57247525", "0.5720...
0.7296931
0
Returns a copy of this Pixmap
def clone(self): return Pixmap(self.image.copy())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pixmap(self):\n return self._pixmap", "def copy(self):\n return Image(self.img.copy())", "def copy(self) -> 'BaseImage':\n image = BaseImage(\n image_path=self._filepath,\n drawing_mode=self._drawing_mode,\n drawing_offset=self._drawing_offset,\n ...
[ "0.71491456", "0.6812532", "0.6654499", "0.62792975", "0.62792975", "0.6201754", "0.6177614", "0.61632174", "0.61628383", "0.6132829", "0.6066402", "0.59559345", "0.5934361", "0.5921455", "0.58904016", "0.57947856", "0.57946366", "0.5792253", "0.5779137", "0.57752925", "0.574...
0.889772
0
Returns integer representing maximum power output of solar panel array
def solution(xs): negatives = [] smallest_negative = None positives = [] contains_panel_with_zero_power = False if isinstance(xs, list) and not xs: raise IndexError("xs must be a non-empty list. Empty list received.") for x in xs: if x > 0: positives.append(x) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def max_power(self):\r\n est_max_power = self.model * self.max_pwm / 100\r\n return est_max_power", "def getMaxPower(self):\n return self.max_power", "def mamajek08_logRpHK_max():\n return -3.8918287373004357", "def computeMaxPower(self):\n self.max_power = max(self.getOutputVa...
[ "0.69011664", "0.67780834", "0.6692524", "0.6583201", "0.6428379", "0.6374584", "0.63191813", "0.62709254", "0.62561285", "0.6233588", "0.62227124", "0.6212908", "0.61916864", "0.6175198", "0.6144504", "0.61244524", "0.6121709", "0.61081904", "0.610289", "0.61014277", "0.6098...
0.65452266
4
Generates cell to the left of current cell.
def generate_cell_left(self, x, y, list_of_nearby_cells): cell_2 = self.island_map[y][x - 1] list_of_nearby_cells.append(cell_2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rotate_left(self):\n\n grid = Grid(self.width, self.height)\n\n for j in range(0, self.height):\n for i in range(0, self.width):\n v = self.get(self.width - 1 - j, i)\n grid.set(i, j, v)\n\n return grid", "def go_left(self):\n self.rect.cen...
[ "0.70819235", "0.6975897", "0.6953719", "0.69454205", "0.6907529", "0.6897413", "0.6869083", "0.6869083", "0.6783098", "0.67385286", "0.66796345", "0.66774154", "0.6676252", "0.6650228", "0.6643324", "0.66370374", "0.6589287", "0.6584987", "0.6570146", "0.6564305", "0.6525833...
0.7016711
1
Adds carnivores to the island population. Used for 'adding_population' method.
def add_carnivores(self, animal, animal_list): self.island_map[animal_list['loc'][0]][ animal_list['loc'][1]].population.append( Carnivore(age=animal['age'], weight=animal['weight']))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_population(self, population):\n for species in population:\n y, x = [n - 1 for n in species['loc']]\n for ani in species['pop']:\n if ani['species'] == 'Herbivore':\n self.island.island[y][x].herbivores.append(Herbivore(\n ...
[ "0.6488862", "0.5977973", "0.5623271", "0.5505954", "0.5245644", "0.50400364", "0.49819586", "0.49449646", "0.49330732", "0.49230498", "0.48969296", "0.48944554", "0.48917755", "0.48714575", "0.48688993", "0.4861397", "0.4853813", "0.48414904", "0.48213258", "0.48149297", "0....
0.7950215
0
yield successive nsized chunks from list l
def _get_chunks(l, n = 10): for i in range(0, len(l), n): yield l[i: i + n]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __chunks(l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]", "def _chunk(self, l, n):\n for i in range(0, len(l) + 1, n):\n yield l[i:i + n]", "def _chunks(l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]", "def chunks(l, n):\...
[ "0.82189894", "0.8204953", "0.8197592", "0.8148836", "0.8140544", "0.81378734", "0.81292903", "0.8127351", "0.8127351", "0.8124293", "0.81232536", "0.81219226", "0.80977917", "0.80727047", "0.806711", "0.80289614", "0.80289614", "0.8025218", "0.8025218", "0.8025218", "0.79973...
0.0
-1
Get list of available products
def get_product_list(include_details = True): json_obj = requests.get(api_base_url + 'products') products_list = json.loads(json_obj.content)['products'] d = OrderedDict(zip([x.pop('product') for x in products_list], products_list)) if include_details: return d return d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_available_products(): # {{{\n products_available = {}\n try:\n with MONGO:\n product_collection = MONGO.connection.assignment_07[\"product\"].find(\n )\n\n for product in product_collection:\n if int(product[\"quantity_available\"]) > 0:\n ...
[ "0.820228", "0.8188385", "0.8147095", "0.80760795", "0.8058985", "0.76072353", "0.7576175", "0.7575832", "0.75192446", "0.7515428", "0.74613464", "0.74519205", "0.7389093", "0.7314297", "0.72184676", "0.7207571", "0.71557575", "0.7142874", "0.7123189", "0.71197903", "0.711818...
0.6472543
57
Normalize an encoding name.
def normalize_encoding(encoding): if isinstance(encoding, bytes): encoding = str(encoding, "ascii") chars = [] punct = False for c in encoding: if c.isalnum() or c == '.': if punct and chars: chars.append('_') if c.isascii(): chars...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize_name(self, value):\n import unicodedata\n import re\n\n self.log('Converting string %s' % value)\n \n # Double try in name conversion\n try:\n value = unicodedata.normalize('NFKD', u'%s' % value).encode('ascii', 'ignore')\n value = unico...
[ "0.7139224", "0.7113511", "0.70428526", "0.70362127", "0.6853774", "0.6777337", "0.67644906", "0.67644906", "0.67644906", "0.6589034", "0.6557821", "0.64751935", "0.6379293", "0.63538426", "0.63372886", "0.63209635", "0.6301066", "0.62955683", "0.6286991", "0.62798905", "0.62...
0.6184507
23
Constructs a `TensorSummary` instance.
def __init__(self, name: str): if name == _METADATA: raise ValueError( f"{_METADATA} is a reserved name. Please use a different name " f"for summaries." ) super().__init__(name) self._log_provider = _LogProvider(name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_summary(self):\n for k, v in self.metrics.items():\n tf.summary.scalar(k, v)\n \n self.summary_op = tf.summary.merge_all()", "def MakeSummary(name, value):\n summary = tf.Summary()\n val = summary.value.add()\n val.tag = str(name)\n val.simple_value = float(value)\n return summary", ...
[ "0.7188703", "0.68655676", "0.6832173", "0.67569655", "0.6729925", "0.6673327", "0.6660357", "0.6602413", "0.6602413", "0.6545785", "0.6529805", "0.6506894", "0.6496368", "0.6480261", "0.6469945", "0.6331449", "0.62910557", "0.62894934", "0.62371325", "0.6091151", "0.60899967...
0.0
-1
Convenience method for creating and running tensor summaries. This method searches registered summaries for the given name. If one is found, it uses it. Otherwise, it creates a new summary and runs the tensor through that summary.
def tensor_summary(name: str, tensor: torch.Tensor): summary = TensorSummary(name) # Run the summary op summary(tensor)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _summaries(name, var):\n with tf.name_scope('{}/summaries'.format(name)):\n mean = tf.reduce_mean(var)\n tf.summary.scalar('mean', mean)\n with tf.name_scope('stddev'):\n stddev = tf.sqrt(tf.reduce_mean(tf.square(var - mean)))\n tf.summary.scalar('stddev', stddev)\n tf.summary.scalar('ma...
[ "0.66983134", "0.62766343", "0.62203974", "0.62158775", "0.61121404", "0.6107735", "0.60967565", "0.60816747", "0.60495394", "0.6002912", "0.5962757", "0.5958025", "0.59249365", "0.5917806", "0.59047234", "0.5903628", "0.5901872", "0.5901872", "0.58882743", "0.58176863", "0.5...
0.7288509
0
Returns the UTC time when this tensor was saved.
def utctime(self) -> datetime: return datetime.utcfromtimestamp(float(self.ns_since_epoch) / 1e9)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_timestamp(self):\n return datetime.datetime.utcnow()", "def timestamp(self):\n return time.time()", "def observation_time(self):\n epoch = float(self._current_observation['observation_epoch'])\n return datetime.datetime.utcfromtimestamp(epoch)", "def __get_timestamp() -> s...
[ "0.7535067", "0.74245363", "0.7319065", "0.71778023", "0.71778023", "0.7085643", "0.7083075", "0.706", "0.7040117", "0.7004145", "0.6996977", "0.6996977", "0.6996977", "0.6994038", "0.6991442", "0.6991442", "0.6976124", "0.6969902", "0.69696677", "0.69696677", "0.69696677", ...
0.6709185
73
Returns a descriptor from a dict of values.
def from_dict(values) -> "TensorDescriptor": return TensorDescriptor(**values)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _from_dict(cls, d):\n confidence = d.get(\"confidence\", None)\n constant = d.get(\"constant\", False)\n tags = d.get(\"tags\", None)\n return cls(\n d[\"name\"],\n d[\"value\"],\n confidence=confidence,\n constant=constant,\n t...
[ "0.6554534", "0.6157181", "0.60732394", "0.6007713", "0.5857444", "0.584524", "0.5833858", "0.57635784", "0.5691932", "0.5688369", "0.56861687", "0.5673174", "0.5606009", "0.5583979", "0.556795", "0.554785", "0.55357885", "0.55279756", "0.5519273", "0.55075663", "0.54962593",...
0.7652282
0
Constructs a `TensorSummaryReader` instance.
def __init__(self, path: str): self._path = path self._summary_dirs: List[Path] = [] event_files = self._discover_event_files(self._path) cb_summaries = self._discover_cerebras_summary_dirs(event_files) self._summary_dirs = self._discover_tensor_summary_dirs(cb_summaries) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _make_summaries(self):\n\n self.summaries['loss'] = tf.summary.scalar('loss', self.loss)\n\n self.summaries['0_inputs_outputs'] = \\\n tf.summary.image('0_inputs_outputs', tf.concat([\n tf.expand_dims(tf.expand_dims(tf.stack(self.inputs, axis=-1), axis=0), axis=-1),\n ...
[ "0.5490224", "0.5213864", "0.5162801", "0.5153095", "0.5145889", "0.51341957", "0.5131073", "0.5083866", "0.5083866", "0.50705135", "0.5033322", "0.502389", "0.50201267", "0.50047", "0.5002436", "0.4990002", "0.4973144", "0.49505648", "0.49483812", "0.49429953", "0.49415764",...
0.45528874
90
Loads and returns tensor(s) with given name at the given step.
def load( self, name: str, step: int, latest_only: bool = True ) -> Union[TensorDescriptor, List[TensorDescriptor], None]: descriptors = [] for summary_dir in self._summary_dirs: for path in summary_dir.joinpath(name).glob(f"{step}.*"): if path.exists(): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetch_tensor(name, ws):\n return ws.get_tensor(name).ToNumpy()", "def named_tensor(self, name):\n return self._tensor_name_to_result[name]", "def get_tensor(name):\n if name.rfind(':') == -1:\n name += ':0'\n return tf.get_default_graph().get_tensor_by_name(name)", "def get_tensor_by_n...
[ "0.6505942", "0.62820977", "0.61697644", "0.6062561", "0.59731156", "0.5858442", "0.5854949", "0.5758646", "0.56752753", "0.55361956", "0.550396", "0.54739", "0.54528475", "0.53111655", "0.52605957", "0.5206088", "0.5203752", "0.5162752", "0.5152899", "0.51366264", "0.5134263...
0.57487416
8
Returns absolute path to directory for writing tensor data.
def logdir(self) -> Path: assert ( self._logdir ), "Log provider has not been tied to a SummaryWriter yet" return self._logdir
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def out_path(dataset, work_dir=consts.WORK_DIR):\r\n return join_path(dataset_path(dataset, work_dir), consts.OUTPUT_DIR)", "def tensorboard_path(self) -> str:\n if self._tensorboard_path is None:\n folder = os.path.join(self.output_path, self._TENSORBOARD_LOG_DIR)\n\n if not os.p...
[ "0.73302287", "0.71926546", "0.694429", "0.68918866", "0.6798425", "0.67864114", "0.67774826", "0.66907567", "0.6685422", "0.6651306", "0.6612013", "0.6585874", "0.657904", "0.6537162", "0.65232337", "0.65165645", "0.6503679", "0.64261", "0.64139724", "0.6408016", "0.64004344...
0.0
-1
Returns relative path to directory for writing tensor data. This is relative to the directory where the corresponding tensorboard events file resides.
def rel_logdir(self) -> Path: assert ( self._logdir ), "Log provider has not been tied to a SummaryWriter yet" return self._rel_logdir
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tensorboard_path(self) -> str:\n if self._tensorboard_path is None:\n folder = os.path.join(self.output_path, self._TENSORBOARD_LOG_DIR)\n\n if not os.path.exists(folder):\n os.makedirs(folder)\n\n self._tensorboard_path = folder\n\n return self._te...
[ "0.7482737", "0.6904064", "0.6706005", "0.662319", "0.6609771", "0.6598657", "0.65665823", "0.65637386", "0.65606415", "0.65414023", "0.6537445", "0.6537445", "0.6537445", "0.65209556", "0.6520281", "0.65108603", "0.6508724", "0.64876926", "0.64790624", "0.64750886", "0.64496...
0.6303057
41
Returns a root directory for placing tensor summaries.
def get_cb_summaries_root(events_file: Union[str, Path]) -> Path: events_file = Path(events_file).resolve(strict=True) dirname = events_file.name.replace( "events.out.tfevents.", "events.out.cbevents." ) return events_file.parent.joinpath(dirname)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_tensor_summaries_root(cb_summaries_root: Union[str, Path]) -> Path:\n return cb_summaries_root.joinpath(\"tensors\")", "def get_root():\n\n return 'data/simulators/mg1'", "def get_model_directory(self, root_only: bool = False) -> str:\n if self.linked_lut:\n return os.path.j...
[ "0.7534432", "0.66555494", "0.6479312", "0.64318687", "0.6378075", "0.6312645", "0.6236795", "0.6236054", "0.62294745", "0.6200678", "0.61913425", "0.6155077", "0.61528426", "0.6141398", "0.61135185", "0.61075634", "0.6090187", "0.6090187", "0.60888857", "0.6082979", "0.60210...
0.0
-1
Reads the tensor summary version from summaries root dir.
def _read_version(rootdir: Path) -> Union[str, None]: version_file = rootdir.joinpath(_METADATA) if version_file.exists(): with version_file.open("r") as f: content = json.load(f) if _VERSION_KEY in content: return content[_VERSION_KEY] return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_tensor_summaries_root(cb_summaries_root: Union[str, Path]) -> Path:\n return cb_summaries_root.joinpath(\"tensors\")", "def _discover_tensor_summary_dirs(\n cb_summary_dirs: List[Path],\n ) -> List[Path]:\n tensor_summary_dirs = []\n for cb_summary_dir in cb_summary_dirs:\n...
[ "0.6637483", "0.5856737", "0.5608334", "0.5530554", "0.5472221", "0.5454341", "0.5435715", "0.54090637", "0.539351", "0.5331818", "0.5295308", "0.52574855", "0.52530015", "0.52372265", "0.52338415", "0.52194035", "0.514872", "0.514872", "0.51439327", "0.5127861", "0.5121738",...
0.52626777
11
Create a new instance of this Mode. Keyword arguments can be provided for the linker, in which case its `clone` method will be called with these arguments.
def clone(self, link_kwargs=None, optimizer="", message=None): new_linker = self.linker.clone(**link_kwargs) new_optimizer = optimizer if optimizer == "": new_optimizer = self.provided_optimizer new_mode = type(self)(linker=new_linker, optimizer=...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new(self, **kwargs):\n return self.__model__(**self._preprocess_params(kwargs))", "def make(self, *args, **kwargs):\r\n mode = kwargs.pop('mode', theano.compile.mode.get_default_mode())\r\n rval = self.make_no_init(mode)\r\n if hasattr(rval, 'initialize'):\r\n rval.init...
[ "0.6763419", "0.64121944", "0.63908464", "0.62189996", "0.6114689", "0.61039305", "0.5981219", "0.5930975", "0.580109", "0.57511544", "0.57361966", "0.5697168", "0.5650885", "0.56271666", "0.5608665", "0.55935025", "0.55771893", "0.55771893", "0.5562365", "0.55331695", "0.551...
0.7236268
0
Forward propagation compute the output value based on input nodes and store the value into self.value
def forward(self): raise NotImplemented
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forward(self):\n self.value = np.dot(self.x_node.value, self.w_node.value) + self.b_node.value", "def get_value(self):\n if not self.visited:\n # first visit at node\n self.visited = True\n\n # value calculation\n for node, weight in self.predecessors...
[ "0.7669217", "0.74298275", "0.7371656", "0.7253357", "0.7160984", "0.7102906", "0.70070386", "0.6917895", "0.69035614", "0.6715777", "0.6689886", "0.65138143", "0.64646304", "0.64565825", "0.6456289", "0.6448939", "0.6433448", "0.6412225", "0.6402653", "0.6400634", "0.6398856...
0.0
-1
Creates and returns an Axes object attached to this object's Figure.
def new_axes(self, name): return self.figure.add_axes([0.05, 0.05, 0.9, 0.9], label=name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_axes(self):\n plt.switch_backend(\"cairo\")\n fig = plt.figure(figsize=(15,10))\n ax = fig.add_axes([0.05, 0.15, 0.9, 0.80,])\n return (fig, ax)", "def create_figure(self) -> None:\n plt.ion()\n self.fig = plt.figure(1)\n self.axis = self.fig.add_subplot(...
[ "0.7047487", "0.65094334", "0.6505662", "0.6493476", "0.6481961", "0.63738716", "0.634137", "0.63165", "0.63165", "0.6307798", "0.6219995", "0.618631", "0.6172847", "0.61675", "0.60905874", "0.5957569", "0.5946683", "0.5946683", "0.5921273", "0.58983934", "0.58941424", "0.5...
0.6310012
9
Assign rules to bot {list[Rule]|Rule} rules
def rule(self, rules): if not isinstance(rules, list): rules = [rules] for rule in rules: self.__addRule(rule)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_rules(self, rules: List[Rule]):\n self.rules.extend(rules)", "async def set_rules(self, ctx: discord.ext.commands.context.Context, *, rules: str):\n guild_info = server_setup.get_guild_info(ctx.guild)\n\n if guild_info[\"rulesChannelID\"] is not None:\n rules_channel = ser...
[ "0.7151604", "0.6797421", "0.670297", "0.67003846", "0.64769006", "0.6473998", "0.6389133", "0.63680845", "0.63637793", "0.6253548", "0.62169874", "0.62147576", "0.6211387", "0.61407655", "0.6134305", "0.6105276", "0.6081077", "0.6070477", "0.6045388", "0.60409564", "0.601399...
0.74536663
0
Get the front element.
def peek(self): return self.queue[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getFront(self):\n\t\tfront = self.queue[self.front]\n\t\treturn front\n\t\tpass", "def getFront(self):\n if not self.isEmpty():\n return self._data[0]\n else:\n return -1", "def front(self):\n return self.queue[0] if not self.empty() else None", "def peek_front(...
[ "0.82009244", "0.79261875", "0.7852642", "0.7791182", "0.77886623", "0.75723046", "0.752337", "0.7510604", "0.7478953", "0.7379256", "0.7379256", "0.734284", "0.7323573", "0.7320296", "0.7291721", "0.72772557", "0.7269801", "0.72657627", "0.7253295", "0.72355044", "0.72213495...
0.654919
70
Returns whether the queue is empty.
def empty(self): return not self.queue
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_empty(self):\n return len(self.the_queue) == 0", "def is_empty(self):\n return len(self.__queue) > 0", "def is_empty(self):\n return len(self.queue) == 0", "def is_empty(self):\n return len(self.queue) == 0", "def is_empty(self):\n return self.queue == []", "def ...
[ "0.92692643", "0.92497975", "0.92353415", "0.92353415", "0.91545284", "0.9097578", "0.90938354", "0.9091679", "0.9072095", "0.9052828", "0.89198774", "0.89132065", "0.88763297", "0.884273", "0.884273", "0.88345623", "0.88032347", "0.87571824", "0.8730618", "0.864504", "0.8628...
0.8756626
18
Create a new Var and add it to the Var scope.
def mk_var(self, name, type_): # type: (str, ty.Type) -> expr.Var var = expr.Var(name, type_) self.var_scopes[0].appendleft((name, var)) return var
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_variable(self, name, domain):\n name = str(name)\n vnode = VariableNode(name, domain)\n if name in self.vs:\n raise RuntimeError(\"Variable '{0}' already defined\".format(name))\n self.vs[name] = vnode\n return vnode", "def add_variable(self, var):\n s...
[ "0.74044526", "0.69930196", "0.68243915", "0.66757524", "0.66757524", "0.65560055", "0.651152", "0.6464004", "0.64505494", "0.64460903", "0.6439728", "0.6385581", "0.6380459", "0.6375443", "0.6375443", "0.6334677", "0.6319741", "0.63164896", "0.63146156", "0.62874466", "0.627...
0.7330912
1
Deepcopy an observation dict.
def copy_obs_dict(obs): return {k: np.copy(v) for k, v in obs.items()}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy(self):\n return self.from_dict(self.to_dict(True))", "def __copy__(self):\n d = dict()\n d.update(self.items())\n return d", "def copy(self):\n return pdict(dict.copy(self))", "def copy_dictionary(self,dictionary):\r\n return dictionary.copy()", "def copy(self...
[ "0.7131251", "0.7111388", "0.6887822", "0.6787168", "0.67861456", "0.6576845", "0.655322", "0.6445199", "0.6412705", "0.63506573", "0.63001037", "0.6298945", "0.6278639", "0.6261269", "0.6253145", "0.62435263", "0.620387", "0.6175976", "0.6169087", "0.61685205", "0.612027", ...
0.784363
0
Convert an observation dict into a raw array if the original observation space was not a Dict space.
def dict_to_obs(obs_dict): if set(obs_dict.keys()) == {None}: return obs_dict[None] return obs_dict
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _json_numpy_obj_hook(dct):\n if isinstance(dct, dict) and '__ndarray__' in dct:\n data = base64.b64decode(dct['__ndarray__'])\n return np.frombuffer(data, dct['dtype']).reshape(dct['shape'])\n return dct", "def json_numpy_obj_hook(dct):\n if isinstance(dct, dict) and '__ndarray__' in d...
[ "0.67930365", "0.6771495", "0.6771495", "0.6771495", "0.67065537", "0.6422132", "0.64013284", "0.63608253", "0.6109799", "0.610762", "0.6023305", "0.60232586", "0.59954816", "0.5983186", "0.5876181", "0.5838815", "0.580129", "0.5713723", "0.57103366", "0.5697887", "0.56146824...
0.58168477
16
saves data as a yaml file to the given pathname
def _save_data_yaml(self, data, pathname): pathname = self._yaml_extension(pathname) with open(pathname, "w") as outfile: yaml.dump(data, outfile, default_flow_style=False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def saveData(data, file, path='./data/'):\n\twith open(\"{}{}.yml\".format(path, file), 'w') as out:\n\t\tyaml.dump(data, out)", "def save_yaml(data, write_path: PathLike) -> None:\n with open(write_path, \"w\") as write_file:\n yaml.dump(data, write_file, default_flow_style=False)", "def save(data, ...
[ "0.8041541", "0.8008754", "0.79124606", "0.77930826", "0.76837605", "0.7530199", "0.73869854", "0.73643816", "0.7314376", "0.72485584", "0.72120297", "0.71634215", "0.7048274", "0.7010355", "0.6998923", "0.6986194", "0.69353455", "0.69332635", "0.6894796", "0.68790746", "0.68...
0.86586624
1
loads and returns the data from a filepath currently only suports yaml
def load_file(self, filepath): filepath = self._yaml_extension(filepath) data = self._load_data_yaml(filepath) return data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _load_data_yaml(self, pathname): \n pathname = self._yaml_extension(pathname)\n\n with open(pathname) as file:\n traj_data = yaml.load(file, Loader=yaml.FullLoader)\n \n return traj_data", "def LoadYaml(path):\n #NOTE(g): Import is done here, instead of the top ...
[ "0.76325816", "0.7474641", "0.74627763", "0.7451761", "0.74369603", "0.7425077", "0.73399013", "0.7332311", "0.7269149", "0.7255877", "0.7241399", "0.7201785", "0.7159741", "0.71520996", "0.70642245", "0.70540774", "0.70469254", "0.69756097", "0.6961522", "0.69470036", "0.694...
0.79945546
0
open and load yaml file Returns list or dict contents of yaml file
def _load_data_yaml(self, pathname): pathname = self._yaml_extension(pathname) with open(pathname) as file: traj_data = yaml.load(file, Loader=yaml.FullLoader) return traj_data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_yaml(file_path):\n with open(file_path) as fin:\n content = yaml.load(fin, Loader=yaml.FullLoader)\n return content", "def load_yaml(path: str) -> Dict[str, Any]:\n with open(path, \"r\", encoding=\"utf8\") as fp:\n data = yaml.safe_load(fp)\n return data", "def load_yaml...
[ "0.7817054", "0.7654229", "0.7647486", "0.7594485", "0.7582787", "0.7537064", "0.7520317", "0.7514032", "0.7466005", "0.74226195", "0.7417371", "0.7392923", "0.7391325", "0.733824", "0.7330068", "0.73198414", "0.7315563", "0.7312744", "0.7298719", "0.7293845", "0.7289084", ...
0.6858378
48
saves data as a yaml file to the given pathname
def _save_data_yaml(self, data, pathname): pathname = self._yaml_extension(pathname) with open(pathname, "w") as outfile: yaml.dump(data, outfile, default_flow_style=False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def saveData(data, file, path='./data/'):\n\twith open(\"{}{}.yml\".format(path, file), 'w') as out:\n\t\tyaml.dump(data, out)", "def save_yaml(data, write_path: PathLike) -> None:\n with open(write_path, \"w\") as write_file:\n yaml.dump(data, write_file, default_flow_style=False)", "def save(data, ...
[ "0.8041541", "0.8008754", "0.79124606", "0.77930826", "0.76837605", "0.7530199", "0.73869854", "0.73643816", "0.7314376", "0.72485584", "0.72120297", "0.71634215", "0.7048274", "0.7010355", "0.6998923", "0.6986194", "0.69353455", "0.69332635", "0.6894796", "0.68790746", "0.68...
0.86586624
0
Get the node mode class used for this relation link. This is needed to ensure we are not using the base node class used during construction of the model. For polymorphic models the node's node._meta.model may be a subclass of this.
def get_node_model(cls, linkname='children'): return getattr(cls._meta.model, linkname).rel.model
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def node_cls(self):\n return resolve_resource(self._node_cls)", "def get_node_type(self):\n return self.node_type", "def node_type(self):\n return self._node_type", "def db_node_class(self) -> Optional[str]:\n return pulumi.get(self, \"db_node_class\")", "def node_type(self) -> ...
[ "0.6804981", "0.67144865", "0.65858227", "0.64868575", "0.6256244", "0.62095153", "0.6039023", "0.59502524", "0.59421843", "0.58896035", "0.58895594", "0.5766037", "0.57559407", "0.5734141", "0.5732424", "0.5731096", "0.57057875", "0.5695185", "0.5695185", "0.5695185", "0.568...
0.7030535
0
Find the root nodes in the dag attached to the currect node If the dag is node is an island this will return a query set containing just the source node (self).
def get_roots(self): raise NotImplementedError()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def query_nodes(self):\n query_nodes = []\n for node in self.nodes:\n if 'querynode' == node.get('infos').get('type'):\n query_nodes.append(node)\n return query_nodes", "def nodes(self):\n return self._get_tree_queryset()", "def get_roots(self, connection=N...
[ "0.62119275", "0.6149487", "0.60426825", "0.601313", "0.5957541", "0.5841407", "0.58398074", "0.58288956", "0.57975626", "0.57959425", "0.5786706", "0.5759349", "0.5740379", "0.57032055", "0.5695816", "0.56885177", "0.5681696", "0.5668359", "0.563715", "0.56365013", "0.563318...
0.0
-1
Validates all images name in excel.
def validate_excel(self): # Load file retouch_file = pd.read_csv(self.file) # Error Images error_images = [] # Loop over rows for index, row in retouch_file.iterrows(): # print(row['image_name']) if not os.path.isfile(f"{settings.MEDI...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate(self, spec):\n d = spec.directory\n for file_name in os.listdir(d):\n if file_name.endswith(\".icon\"):\n if \" \" in file_name:\n raise ValidationException(f\"The .icon file name was '{file_name}'.\\n \"\n ...
[ "0.66623217", "0.6658406", "0.6494051", "0.63344526", "0.61939657", "0.59784704", "0.59534335", "0.5943832", "0.5930585", "0.5911532", "0.58642864", "0.5753331", "0.56143767", "0.5586891", "0.5578926", "0.55781466", "0.5560841", "0.5503378", "0.54568374", "0.5455", "0.5427461...
0.6937443
0
Read the value of this property
def __get__(self, instance, owner): if self.name is None : self.name = Property.search(instance, owner,self) if self.name is not None: try: if instance is not None: return instance.__dict__[self.name] elif owner is not None: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_value(self):\n return self.load_attr(\"value\")", "def get(self):\n return self._value", "def read_value(self):\n raise NotImplementedError", "def read_value(self):\n raise NotImplementedError", "def read(self):\n return self.read_value", "def read(self):\n ...
[ "0.82250446", "0.8176574", "0.810509", "0.810509", "0.796693", "0.79547805", "0.79393846", "0.78652763", "0.78652763", "0.7815156", "0.7815156", "0.7815156", "0.7789923", "0.7789923", "0.7765907", "0.7765907", "0.7765907", "0.7759358", "0.77522856", "0.7720804", "0.7719444", ...
0.0
-1
Read the value of this property
def __get__(self, instance, owner): return self.key, self.value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_value(self):\n return self.load_attr(\"value\")", "def get(self):\n return self._value", "def read_value(self):\n raise NotImplementedError", "def read_value(self):\n raise NotImplementedError", "def read(self):\n return self.read_value", "def read(self):\n ...
[ "0.82250446", "0.8176574", "0.810509", "0.810509", "0.796693", "0.79547805", "0.79393846", "0.78652763", "0.78652763", "0.7815156", "0.7815156", "0.7815156", "0.7789923", "0.7789923", "0.7765907", "0.7765907", "0.7765907", "0.7759358", "0.77522856", "0.7720804", "0.7719444", ...
0.0
-1
Unicode representation of this model
def __unicode__(self): return u'%s' % str(self)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __unicode__(self):\n return str(self).decode('ascii')", "def __unicode__(self):\n return unicode(self).encode('utf-8')", "def __str__(self):\n return self.__unicode__().encode('utf-8').decode()", "def __unicode__(self):\n return unicode(self.asPyDict())", "def __unicode__(self...
[ "0.8167525", "0.8006175", "0.79807335", "0.7852525", "0.77712053", "0.77484745", "0.7656151", "0.74757063", "0.7471969", "0.7471969", "0.7462336", "0.72724736", "0.7164928", "0.71272665", "0.70481294", "0.7042886", "0.7036273", "0.7017932", "0.69887066", "0.69809884", "0.6946...
0.74055153
11
Optimize the sentence towards the target activation.
def step_towards_activation(optimizer, before, modify, after, pos_embeddings, sentence_embeddings, att_mask, temperature, iteration, gumbel, write_top_k, k_value, data, word_id, neuron_id, layer_id, modify_start, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def optimize(self):\n self.output = self.net.forward(Variable(self.source))\n self.optimizer.zero_grad()\n self.loss = self.loss_function(self.output, Variable(self.target))\n self.loss.backward()\n self.optimizer.step()", "def query_optimizer(sentence):\n if sentence.strip(...
[ "0.62639695", "0.6130314", "0.59339696", "0.5838509", "0.56818515", "0.56087697", "0.55828065", "0.5504363", "0.5461631", "0.54138947", "0.54088014", "0.53690004", "0.5347256", "0.5326484", "0.53169", "0.5314994", "0.530622", "0.52992994", "0.52988243", "0.527495", "0.5267822...
0.6319755
0
Opens a get request with params specifying a query string.
def _get_request(url, params): request = requests.get(url, params=params) return request
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(self, *args, **kw):\n kw['method'] = 'GET'\n return self.open(*args, **kw)", "def get(self, *args, **kwargs):\n self.request(\"get\", *args, **kwargs)", "def req_get(url, headers=None, params=None) -> Response:\n if params:\n url = \"{}?{}\".format(url, parse.urlencode(pa...
[ "0.7315533", "0.6999508", "0.69957286", "0.6964658", "0.6753037", "0.6733682", "0.6717613", "0.6713933", "0.67007315", "0.66816795", "0.66735643", "0.66667134", "0.6625618", "0.6616819", "0.65468645", "0.6501841", "0.64819735", "0.64691085", "0.63853455", "0.6355646", "0.6350...
0.681433
4
Return the name of the sensor.
def name(self): return self._name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name(self):\n return self._sensor.name", "def get_sensor_name(self):\n return self.data[1]", "def name(self):\n return self.device.device_data[self.device_id]['name'] + \\\n f' {self._sensor_type}'", "def name(self):\n return f\"{self._name} {SENSOR_TYPES[self.senso...
[ "0.91893613", "0.9167641", "0.89006543", "0.87700266", "0.8510253", "0.84789824", "0.84436315", "0.82990927", "0.8186006", "0.81047755", "0.8079411", "0.8065188", "0.80489177", "0.770037", "0.7611718", "0.76110727", "0.76002693", "0.76002693", "0.76002693", "0.75386775", "0.7...
0.0
-1
Finds points that don't require clockwise turns to connect.
def find_hull_vertices(points: np.ndarray) -> np.ndarray: M = 3 N = points.shape[0] for i in range(4, N): while ccw(points[M], points[M - 1], points[i]) >= 0: M -= 1 M += 1 swap(points, M, i) return points[1:M + 1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __no_crossing(self):\n for pos_left_1 in range(self.n):\n for pos_left_2 in range(pos_left_1 + 1, self.n):\n for pos_right_2 in range(self.n):\n for pos_right_1 in range(pos_right_2 + 1, self.n):\n # For all i, j, k, m | k < i and m > j . not w(i, j) or not w(k, m)\n ...
[ "0.6028774", "0.5948258", "0.59384656", "0.58502847", "0.5778959", "0.5765414", "0.57120085", "0.56897247", "0.5671454", "0.5671417", "0.56707746", "0.5651507", "0.5587817", "0.5585447", "0.5585396", "0.5555514", "0.55238324", "0.55231136", "0.5506797", "0.55021244", "0.55002...
0.50743437
83
Check to see if a given nick is valid.
def is_valid_nick_name(nick): if not MIN_NICK_LEN < len(nick) < MAX_NICK_LEN: return False valid_symbols = '\\|^`[]()_' valid_chars = string.ascii_letters + string.digits + valid_symbols
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_nick_in_use(self, nick):\n return self.get_client_by_nick(nick) is not None", "def _nick_blocked(self, nick: str) -> bool:\n bad_nicks = self.config.core.nick_blocks\n for bad_nick in bad_nicks:\n bad_nick = bad_nick.strip()\n if not bad_nick:\n ...
[ "0.742499", "0.73148334", "0.63294446", "0.6251922", "0.6213392", "0.6168409", "0.6141596", "0.61354464", "0.611538", "0.61008614", "0.60717684", "0.6069103", "0.60664105", "0.6046842", "0.6039346", "0.6014535", "0.5952144", "0.5940618", "0.5917594", "0.59137994", "0.5910957"...
0.7817538
0
Return the symbolic function.
def get_function(self): raise NotImplementedError()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_symbolic_model(self):\n return self.sym_func", "def get_symbolic_model(self):\n return self.sym_func", "def process_fn(fn_string, symbols):\n fn_string = fn_string.replace('^', '**')\n fn = lambdify([sympy.symbols(symbols)], fn_string, 'numpy')\n return fn", "def get_function(s...
[ "0.73793197", "0.73793197", "0.6614362", "0.6443564", "0.6363499", "0.6328741", "0.62737083", "0.61984783", "0.61444277", "0.614239", "0.6071249", "0.6028624", "0.6011971", "0.59426683", "0.59348416", "0.59200853", "0.5903745", "0.5889025", "0.58782613", "0.58713275", "0.5866...
0.0
-1
Return the symbolic function.
def get_function(self): return self.element.get_basis_functions()[self.n]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_symbolic_model(self):\n return self.sym_func", "def get_symbolic_model(self):\n return self.sym_func", "def process_fn(fn_string, symbols):\n fn_string = fn_string.replace('^', '**')\n fn = lambdify([sympy.symbols(symbols)], fn_string, 'numpy')\n return fn", "def get_function(s...
[ "0.73793197", "0.73793197", "0.6614362", "0.6443564", "0.6363499", "0.6328741", "0.62737083", "0.61984783", "0.61444277", "0.614239", "0.6071249", "0.6028624", "0.6011971", "0.59426683", "0.59348416", "0.59200853", "0.5903745", "0.5889025", "0.58782613", "0.58713275", "0.5866...
0.58109623
25
Return the symbolic function.
def get_function(self): return subs(self.f.get_function(), self.sub_pre, self.sub_post)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_symbolic_model(self):\n return self.sym_func", "def get_symbolic_model(self):\n return self.sym_func", "def process_fn(fn_string, symbols):\n fn_string = fn_string.replace('^', '**')\n fn = lambdify([sympy.symbols(symbols)], fn_string, 'numpy')\n return fn", "def get_function(s...
[ "0.73799556", "0.73799556", "0.6616697", "0.64436275", "0.6363745", "0.6327365", "0.62746584", "0.61976916", "0.614486", "0.6143291", "0.60709494", "0.6030756", "0.60122544", "0.59422994", "0.59352946", "0.5922005", "0.5905769", "0.5889022", "0.5879507", "0.58733386", "0.5866...
0.56339633
37
y = y pixel position (cast as a float)
def getSolidAngle(y, width, is3D=False): height = int(width/2) pi2OverWidth = (np.pi*2)/width piOverHeight = np.pi/height theta = (1.0 - ((y + 0.5) / height)) * np.pi return pi2OverWidth * (np.cos(theta - (piOverHeight / 2.0)) - np.cos(theta + (piOverHeight / 2.0)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def y(self):\r\n return self.position.y", "def y(self):\n return self.coords[1]", "def _get_y(self):\n return self.position.y", "def y(self) -> int:\n return self.data.y_centre >> 4", "def get_y_position(self): \n return self.rect.y", "def get_y_position(self):\n ...
[ "0.72356", "0.69160527", "0.6906892", "0.67751694", "0.6769609", "0.6762792", "0.67605275", "0.67102444", "0.6658589", "0.6648598", "0.6642375", "0.6637628", "0.66358846", "0.6617216", "0.6615922", "0.6602411", "0.6594984", "0.65829456", "0.6565133", "0.65152645", "0.65152645...
0.0
-1
Centers the anchor point of img.
def _set_anchor_center(img): img.anchor_x = int(img.width / 2) img.anchor_y = int(img.height / 2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def center_image_anchor(image):\n image.anchor_x = image.height/2\n image.anchor_y = image.height/2", "def center_image(image):\r\n image.anchor_x = image.width / 2\r\n image.anchor_y = image.height / 2", "def center_image(image):\r\n image.anchor_x = image.width / 2\r\n image.anchor_y = imag...
[ "0.8385181", "0.8043658", "0.8043658", "0.7960501", "0.66741693", "0.66512936", "0.66457415", "0.65865", "0.6578959", "0.65282106", "0.64527196", "0.64204586", "0.64121026", "0.6393284", "0.63400227", "0.633469", "0.62460554", "0.62423754", "0.6190456", "0.6186249", "0.616942...
0.86355156
0
Return True if the user is authenticated.
def is_authenticated(self): return self.authenticated
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_authenticated(self):\n return self.user is not None and self.state == AuthenticationOptions.authenticated", "def is_authenticated(self):\n return bool(get_auth_token())", "def is_authenticated(self):\n return True", "def is_authenticated(self):\n return True", "def is_aut...
[ "0.8739372", "0.87086535", "0.86574197", "0.86574197", "0.86574197", "0.86574197", "0.86574197", "0.86574197", "0.86574197", "0.8613915", "0.8609252", "0.8578436", "0.83723366", "0.83587176", "0.8258534", "0.82273275", "0.8209421", "0.8200795", "0.8174884", "0.81280386", "0.8...
0.8580474
19
Ensure we have access to API endpoint.
def test_api_response(self): # url = 'http://127.0.0.1:8000/api/aircraft/' url = reverse('airlines:aircraft-list') response = self.client.get(url, format='json') self.assertEqual(response.status_code, status.HTTP_200_OK)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_anything_else_is_accessible(api_client):\n\n assert api_client().get(\"/anything/else\").status_code == 200", "def test_GET(self):\n if not self.url:\n return\n response = self.client.get(self.url, {}, format='json')\n self.assertIn(response.status_code, [status.HTTP_4...
[ "0.69789565", "0.68439215", "0.6813232", "0.67298204", "0.6704099", "0.66545403", "0.66545403", "0.6649408", "0.66269577", "0.65817416", "0.6563278", "0.6544286", "0.653628", "0.64732224", "0.64411116", "0.64375037", "0.6402903", "0.6398786", "0.6383181", "0.63590443", "0.635...
0.0
-1
Get an existing Cluster resource's state with the given name, id, and optional extra properties used to qualify the lookup.
def get(resource_name, id, opts=None, arn=None, certificate_authority=None, created_at=None, enabled_cluster_log_types=None, endpoint=None, identities=None, name=None, platform_version=None, role_arn=None, status=None, tags=None, version=None, vpc_config=None): opts = pulumi.ResourceOptions.merge(opts, pulumi.R...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(resource_name: str,\n id: pulumi.Input[str],\n opts: Optional[pulumi.ResourceOptions] = None,\n cluster_id: Optional[pulumi.Input[str]] = None,\n identity: Optional[pulumi.Input[pulumi.InputType['ClusterIdentityArgs']]] = None,\n location: Optional[pul...
[ "0.70554805", "0.68861353", "0.676244", "0.6145249", "0.57506424", "0.57485956", "0.5696903", "0.5688549", "0.5618175", "0.5476951", "0.5444422", "0.54396003", "0.54200834", "0.54180175", "0.53814524", "0.53799874", "0.5322839", "0.52938914", "0.52797425", "0.52736527", "0.52...
0.6268129
3
Return True if expr belongs to Order(self.expr, \self.variables). Return False if self belongs to expr. Return None if the inclusion relation cannot be determined (e.g. when self and expr have different symbols).
def contains(self, expr): # NOTE: when multiplying out series a lot of queries like # O(...).contains(a*x**b) with many a and few b are made. # Separating out the independent part allows for better caching. c, m = expr.as_coeff_mul(*self.variables) if m != (): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def contain_op(self, expr):\n return expr in self.table.inv", "def __contains__(self, name):\r\n name = OrderBy(name).bare\r\n for order_by in self:\r\n if order_by.bare == name:\r\n return True\r\n return False", "def resolve(self, nonempty_universe=True, ...
[ "0.58077276", "0.55266297", "0.5466278", "0.53708196", "0.5359253", "0.5305547", "0.51732755", "0.51732755", "0.51732755", "0.51732755", "0.51605165", "0.50923157", "0.50608295", "0.50448173", "0.5022195", "0.49744135", "0.49448538", "0.4923687", "0.49216893", "0.4900996", "0...
0.5458814
3
Checks whether a value is a number. >>> ISNUMBER(17) True >>> ISNUMBER(123.123423) True >>> ISNUMBER(False) True >>> ISNUMBER(float('nan')) True >>> ISNUMBER(float('inf')) True >>> ISNUMBER('17') False >>> ISNUMBER(None) False >>> ISNUMBER(datetime.date(2011, 1, 1)) False
def ISNUMBER(value): return isinstance(value, numbers.Number)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _is_number(value):\n try:\n float(value)\n return True\n except (TypeError, ValueError):\n return False", "def is_number(value):\n try:\n float(value)\n return True\n except ValueError:\n return False", "def is_number(value):\n tr...
[ "0.78908086", "0.76844984", "0.76667255", "0.76092535", "0.7469764", "0.74561197", "0.7393753", "0.738818", "0.7386333", "0.7339884", "0.73034066", "0.7246958", "0.72397137", "0.72223455", "0.7221903", "0.7217552", "0.72159916", "0.71905726", "0.71905726", "0.71905726", "0.71...
0.8508126
0
Checks whether a value is a table record. For example, if a column person is of type Reference to the People table, then ISREF($person) is True. Similarly, ISREF(People.lookupOne(name=$name)) is True. For any other type of value, ISREF() would evaluate to False. >>> ISREF(17) False >>> ISREF("Roger") False
def ISREF(value): return isinstance(value, Record)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def IsObjectReference(object_id):\n rhobj = rhutil.coercerhinoobject(object_id, True, True)\n return rhobj.IsReference", "def is_reference(type):\n nake_type = remove_alias(type)\n return isinstance(nake_type, cpptypes.reference_t)", "def isReferenceField(cls, _field):\n return isinstance(_f...
[ "0.57230115", "0.5710984", "0.57027227", "0.5514932", "0.54797953", "0.5479475", "0.5419707", "0.53038156", "0.5288411", "0.5287265", "0.5284591", "0.5273162", "0.5267205", "0.5265878", "0.5253703", "0.5239885", "0.51788145", "0.51541865", "0.5154001", "0.510009", "0.50510955...
0.8410261
0
Checks whether a value is a valid URL. It does not need to be fully qualified, or to include
def ISURL(value): value = value.strip() if ' ' in value: # Disallow spaces inside value. return False return bool(_url_regexp.match(value))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_url(value):\n\n valid = validators.url(value)\n if valid != True:\n return False", "def check_url(value):\n\n valid = validators.url(value)\n if valid is not True:\n return False", "def validate_url(self):\n pass", "def validate_url(ctx, param, value):\n try:\n ...
[ "0.82682526", "0.82295996", "0.77959144", "0.7660489", "0.7637248", "0.7582453", "0.7569024", "0.75417864", "0.7533172", "0.74096787", "0.7408426", "0.7406656", "0.7400155", "0.73930186", "0.7385821", "0.737198", "0.73473126", "0.73420054", "0.7330573", "0.7291825", "0.729052...
0.7960981
2
return instance of class argparse.The values returned by parsing will be stored as attributes in this instance
def get_args(self): return self.args
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parser(self):\n return self.arg_parser", "def parse_arguments(cls):\r\n parser = argparse.ArgumentParser(description='Easy Infer for model benchmark')\r\n cls.base_arg_parse(parser)\r\n cls.model_arg_parse(parser)\r\n cls.task_arg_parse(parser)\r\n args = parser.pars...
[ "0.7352352", "0.7336791", "0.72647685", "0.72070444", "0.7202392", "0.7191306", "0.71189225", "0.7108842", "0.70945734", "0.70899105", "0.70814025", "0.7079502", "0.7064564", "0.70624006", "0.702815", "0.7000846", "0.6987335", "0.6967243", "0.69652957", "0.6951666", "0.694105...
0.0
-1
Returns the MAC address of the router in our so called generic format lowercase HEX, no separators.
def get_mac_address(self): self.__not_implemented()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __get_mac_address(self):\n str_hex_mac = uuid.UUID(int=uuid.getnode()).hex[-12:]\n return str_hex_mac", "def get_mac(self) -> str:\n hex_mac = hexlify(self.message)[160:172].decode().upper()\n return (\n hex_mac[0:2]\n + \":\"\n + hex_mac[2:4]\n ...
[ "0.7675288", "0.74545366", "0.74071664", "0.72973883", "0.7281991", "0.7277573", "0.72287804", "0.7214234", "0.7087766", "0.70455676", "0.704051", "0.7003926", "0.6975201", "0.6918401", "0.68629587", "0.686182", "0.6858475", "0.68578047", "0.6826825", "0.681029", "0.6810036",...
0.65107244
39
Updates the DMZ settings and returns True on success.
def push_dmz_settings(self, settings): self.__not_implemented()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(self):\n if self.name == \"Settings\":\n args = [\"NAME:Settings\"]\n else:\n args = [\"NAME:\" + self.name, \"Enable:=\", self.Enable]\n if self.UserSpecifiedSettings:\n args += self.manualsettings\n else:\n ...
[ "0.5928838", "0.58195394", "0.571099", "0.5506674", "0.5441416", "0.53947634", "0.5374681", "0.5373611", "0.5365296", "0.5321621", "0.52768993", "0.5086283", "0.50335664", "0.5022663", "0.50202954", "0.5007967", "0.50024164", "0.49950567", "0.49915543", "0.49895275", "0.49851...
0.54321754
5
Serves root HTML page Renders static page from a template with variables
def index(): return render_template( 'index_t.html', call_counter=str(get_model().call_counter), app_version=str(app.config.get('GIT_HASH', None)) )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main_page():\n return render_template(\"index.html\")", "def main_page():\n return render_template(\"main_page.html\")", "def get(self):\n template = Constants.JINJA_ENVIRONMENT.get_template('homepage.html')\n self.response.headers['Content-Type'] = 'text/html'\n self.response.wr...
[ "0.7882224", "0.7761534", "0.7620109", "0.7612462", "0.76073635", "0.75958955", "0.7573267", "0.7558742", "0.7558742", "0.7558742", "0.7557799", "0.75520384", "0.7548515", "0.75463575", "0.75358224", "0.75358224", "0.75027174", "0.74757636", "0.7473501", "0.74577713", "0.7457...
0.0
-1
Performs vanilla stochastic gradient descent.
def sgd_optim(config = None, global_step = None): learning_rate = config["learning_rate"] train_step = tf.train.GradientDescentOptimizer(learning_rate) #train_step = tf.train.GradientDescentOptimizer(learning_rate) return train_step
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_steep_gradient_descent(data_x, data_y, len_data, alpha, theta):\n n = len_data\n # WE NEED TO transpose data_x into (p+1) *n ,theta is 1*(p+1)\n prod = np.dot(theta, data_x.transpose())\n\n prod -= data_y\n print(\"pro: data_x\", prod.shape, data_x.shape)\n #prod represent the loss of th...
[ "0.71703225", "0.713931", "0.6992501", "0.69541925", "0.685828", "0.6787778", "0.67432874", "0.66829914", "0.6661341", "0.66472995", "0.66416246", "0.66269284", "0.661329", "0.66126883", "0.66101414", "0.6591566", "0.6588291", "0.65871376", "0.6585805", "0.65719914", "0.65586...
0.6620759
12
Uses the RMSProp update rule, which uses a moving average of squared gradient values to set adaptive perparameter learning rates.
def rmsprop_optim(config = None, global_step = None): learning_rate = config["learning_rate"] decay = config.get('decay', 0.9) momentum = config.get('momentum', 0.99) epsilon = config.get('epsilon', 1e-8) train_step = tf.train.RMSPropOptimizer(learning_rate, decay, momentum, eps...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rmsprop_updates(self, params, grads, learning_rate=1e-3, rho=0.9,\n e=1e-8):\n updates = []\n for param, grad in zip(params, grads):\n size = param.shape.eval()\n # accumulator\n accu = theano.shared(\n value=np.zeros(shape=si...
[ "0.70522714", "0.7007888", "0.6803046", "0.68006194", "0.6781389", "0.66811174", "0.6636037", "0.6635496", "0.65722775", "0.6536883", "0.6521535", "0.65201294", "0.65201294", "0.64966524", "0.6490281", "0.6480543", "0.646192", "0.6454348", "0.64211535", "0.6414371", "0.640955...
0.61253726
50
Transform the weight matrix and initial state vector for the simulation.
def __simInputTransform(weight_matrix: Union[pd.DataFrame, np.ndarray], initial_state: dict) -> tuple: if type(weight_matrix) != np.ndarray: # Align the initial_vector order for correct computations (vec . mat) initial_state = {k : initial_state[k] for k in weight_matrix.columns} ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _init_model(self):\n self.A_inv = np.zeros(shape=(self.numUsers, self.d, self.d))\n self.b = np.zeros(shape=(self.numUsers, self.d))\n self.w = np.zeros(shape=(self.numUsers, self.d))\n for i, mat in enumerate(self.A_inv):\n self.A_inv[i] = np.eye(self.d)", "def init_we...
[ "0.63334566", "0.6209362", "0.61789095", "0.6172393", "0.6115332", "0.6115332", "0.6110219", "0.6072243", "0.60429853", "0.6035786", "0.6019923", "0.60196155", "0.59906", "0.5985943", "0.5949474", "0.59448797", "0.59386396", "0.5937977", "0.5925377", "0.5924645", "0.5919815",...
0.7195747
0
Test case for vault_delete_authorization_for_vault_section
def test_vault_delete_authorization_for_vault_section(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_vault_delete_vault_section(self):\n pass", "def test_vault_delete_vault_item(self):\n pass", "def test_vault_create_authorization_for_vault_section(self):\n pass", "def test_delete_o_auth_client_authorization(self):\n pass", "def test_delete_detail_unauthorized(self):\n...
[ "0.8550292", "0.75414014", "0.74407345", "0.7272498", "0.7258358", "0.70472014", "0.6909105", "0.6877982", "0.6726948", "0.6675798", "0.66687953", "0.660025", "0.6595564", "0.6585521", "0.6585157", "0.6563147", "0.643671", "0.6417325", "0.6415729", "0.64053833", "0.63837427",...
0.9493678
0
Test case for vault_delete_vault_section
def test_vault_delete_vault_section(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_vault_delete_authorization_for_vault_section(self):\n pass", "def test_vault_delete_vault_item(self):\n pass", "def test_vault_update_vault_section(self):\n pass", "def test_vault_get_vault_section(self):\n pass", "def test_vault_create_new_vault_section(self):\n ...
[ "0.8530548", "0.80736387", "0.7443883", "0.7115427", "0.7077132", "0.68730193", "0.6823832", "0.67886657", "0.6679716", "0.6649187", "0.65452033", "0.64731526", "0.64704484", "0.6439164", "0.6430353", "0.63685155", "0.6365893", "0.6358025", "0.6326576", "0.6286651", "0.624392...
0.9471199
0
Collect the string of the best predicted span from the context metadata and update `self._per_instance_metrics`, which in the case of SQuAD v1.1 / v2.0 includes the EM and F1 score. This returns a `Tuple[List[str], torch.Tensor]`, where the `List[str]` is the predicted answer for each instance in the batch, and the ten...
def _collect_best_span_strings( self, best_spans: torch.Tensor, context_span: torch.IntTensor, metadata: List[Dict[str, Any]], cls_index: Optional[torch.LongTensor], ) -> Tuple[List[str], torch.Tensor]: _best_spans = best_spans.detach().cpu().numpy() best_spa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _evaluate_span(\n self,\n best_spans: torch.Tensor,\n span_start_logits: torch.Tensor,\n span_end_logits: torch.Tensor,\n answer_span: torch.Tensor,\n ) -> torch.Tensor:\n span_start = answer_span[:, 0]\n span_end = answer_span[:, 1]\n self._span_accur...
[ "0.6227739", "0.597694", "0.56194234", "0.55592126", "0.55447596", "0.55344343", "0.54214895", "0.53767776", "0.5351666", "0.5306305", "0.52820754", "0.5219725", "0.52009577", "0.5197821", "0.5197821", "0.5183327", "0.5170069", "0.51646215", "0.5155521", "0.5149911", "0.51499...
0.76255715
0
Return set of variables in tf.GraphKeys.MODEL_VARIABLES collection.
def get_model_variables(): g = tf.get_default_graph() return set(g.get_collection(tf.GraphKeys.MODEL_VARIABLES))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_trainable_vars(self):\n params = tf.get_collection(tf.GraphKeys.TRAINABLE_VARIABLES, self.scope)\n return params", "def variables(model: Model) -> AbstractSet[str]:\n assert is_model(model)\n return model.keys()", "def get_variables(self, trainable=False):\n if trainable:\n ...
[ "0.7886281", "0.7751747", "0.77346784", "0.7713664", "0.7710161", "0.7666239", "0.7632162", "0.7588056", "0.75370735", "0.71862864", "0.71680355", "0.715456", "0.715456", "0.7113968", "0.708966", "0.7054182", "0.7038533", "0.7027662", "0.6973958", "0.6950921", "0.6926432", ...
0.9027616
0
Tests if the metar is auto or not. Valid cases.
def test_automated(self, automated_metar, normal_metar): # Tests an actual metar to see if it's AUTO parser = Parser(automated_metar) actual = parser.parse() assert actual['is_auto'] is 'True' # not an AUTO metar. parser = Parser(normal_metar) actual = parser.par...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setAuto(self, auto):\n # type: (bool)->None\n\n self._validator.validate_one(\n 'auto', VALID_OPTS['auto'], auto)\n self._ifAttributes['auto'] = auto", "def auto(self):\n return self._auto", "def auto(self, auto):\n self._auto = auto", "def uses_autosetup(sel...
[ "0.6293032", "0.60101646", "0.5869378", "0.57549524", "0.5703336", "0.56967217", "0.5626699", "0.55728626", "0.5507023", "0.54978055", "0.5479172", "0.5479172", "0.5475528", "0.544539", "0.5425172", "0.53885984", "0.5374332", "0.5362702", "0.5356492", "0.5356492", "0.5351057"...
0.77011126
0
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, CertificatePayload): return False return self.__dict__ == other.__dict__
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False", "def __eq__(self, other):\n if i...
[ "0.80886984", "0.80886984", "0.8055307", "0.7983415", "0.79673034", "0.79673034", "0.79673034", "0.79673034", "0.79673034", "0.79673034", "0.79673034", "0.79673034", "0.79673034", "0.79673034", "0.79673034", "0.79673034", "0.79673034", "0.79673034", "0.79673034", "0.79673034", ...
0.0
-1
Returns true if both objects are not equal
def __ne__(self, other): return not self == other
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True", "def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)", "def __ne__(self, other) -> bool:\n return not self.__eq__(other)", "def __eq__(self, other):\n ...
[ "0.8456082", "0.83912885", "0.81436425", "0.81406975", "0.8131807", "0.8093013", "0.80912536", "0.80912536", "0.80912536", "0.8084505", "0.8084505", "0.8075543", "0.8075543", "0.8065009" ]
0.0
-1
Instantiates a new instance of EntityTableManager class
def __init__(self): self.tableConnString = os.environ['ENTITYTABLE_CONNECTIONSTRING']; self.__table = None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def table_manager(table):\n assert table is not None, \"Must provide a table\"\n assert hasattr(table.c, \"id\"), \"Table %s must contain a field named id\" % table\n assert isinstance(table.c.id.type, sa.Integer), \"Field id in table %s must be an integer\" % table\n assert table.c.id.primary_key, \"F...
[ "0.6285532", "0.60943615", "0.59625345", "0.5950479", "0.583876", "0.5794576", "0.5780054", "0.5780054", "0.574905", "0.5706062", "0.5706062", "0.5706062", "0.5706062", "0.5706062", "0.5706062", "0.5706062", "0.5706062", "0.5706062", "0.5706062", "0.5706062", "0.56850576", ...
0.64919806
0
Builds a unique file name out of a given one.
def unique_name(file: Union[str, pathlib.Path]) -> pathlib.Path: return supplement_file_name(file, uuid.uuid1())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unique_filename(data):\n file = data\n get_ext = file.filename.split(\".\")[-1]\n new_name = \"%s.%s\" % (uuid.uuid4().hex, get_ext)\n return new_name", "def generate_filename(filename: str) -> str:\n return f\"{str(uuid.uuid4())}.{get_extension(filename)}\"", "def get_file_name() -> str:\n ...
[ "0.79769593", "0.7955831", "0.7797684", "0.76885605", "0.7623968", "0.76157314", "0.7495375", "0.7490044", "0.7445948", "0.74360776", "0.74340475", "0.742118", "0.738864", "0.7305276", "0.7303047", "0.728939", "0.7257094", "0.7228646", "0.7211563", "0.7208216", "0.720331", ...
0.7445164
9
Computes the accuracy over the k top predictions for the specified values of k
def accuracy(output, target, topk=(1,)): maxk = max(topk) batch_size = target.size(0) _, pred = output.topk(maxk, 1, True, True) pred = pred.t() correct = pred.eq(target.view(1, -1).expand_as(pred)) res = [] for k in topk: correct_k = correct[:k].view(-1).float().sum(0, keepdim=Tru...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def topk_accuracy(y, y_pred, k=2):\n pred = []\n for i in range(len(y)):\n if y[i] in y_pred[i][:k]:\n pred.append(1)\n else:\n pred.append(0)\n return sum(pred) / len(pred)", "def accuracy(y_pred, y_actual, topk=(1, )):\n maxk = max(topk)\n batch_size = y_actua...
[ "0.8330746", "0.8284342", "0.823773", "0.8229572", "0.82199436", "0.81861925", "0.81845963", "0.81748337", "0.8171267", "0.81697196", "0.81662124", "0.81641984", "0.8163521", "0.8161706", "0.8161706", "0.8161706", "0.8161706", "0.8161706", "0.8161706", "0.8161706", "0.8161706...
0.81619215
17
Test method to check initialization of city object.
def test_init(self, fixture_environment): # Generate city object city_object = cit.City(environment=fixture_environment) # Check inheritance from citydistrict object of pycity assert city_object._kind == 'citydistrict'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setUp(self):\n self.my_city = City()", "def test_city(self):\n my_city = City()\n self.assertTrue(hasattr(mycity, \"name\"))\n self.assertEqual(my_city.name, \"\")\n self.assertTrue(hasattr(mycity, \"state_id\"))\n self.assertEqual(my_city.state_id, \"\")", "def te...
[ "0.8208791", "0.78769827", "0.77986366", "0.77795875", "0.76048577", "0.754388", "0.73767126", "0.7267092", "0.7240301", "0.72173876", "0.71167403", "0.7113835", "0.71073353", "0.7061404", "0.7059045", "0.70508224", "0.70508224", "0.70508224", "0.70453376", "0.7042586", "0.70...
0.8608368
0
Is x iterable? >>> isiterable([1, 2, 3]) True >>> isiterable('abc') True >>> isiterable(5) False
def isiterable(x): try: iter(x) return True except TypeError: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isiterable(x):\n try:\n iter(x)\n except TypeError:\n return False\n return True", "def is_iterable(x):\n if isinstance(x, six.string_types):\n return False\n return hasattr(x, '__iter__')", "def iterable(x):\n try:\n iter(x)\n return True\n except Ty...
[ "0.8761655", "0.85234815", "0.8522508", "0.821404", "0.8183848", "0.8150876", "0.8101413", "0.78824735", "0.7839455", "0.77972245", "0.7774228", "0.77212083", "0.7623906", "0.7575932", "0.7564972", "0.7563256", "0.75537014", "0.75014585", "0.7445784", "0.7403414", "0.7394402"...
0.88116336
0
The first n elements of a sequence >>> list(take(2, [10, 20, 30, 40, 50])) [10, 20]
def take(n, seq): return itertools.islice(seq, n)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def take(iterable, n):\n return list(itertools.islice(iterable, n))", "def take(n, seq):\n seq = iter(seq)\n result = []\n try:\n for i in range(n):\n result.append(next(seq))\n except StopIteration:\n pass\n return result", "def take(n, iterable):\n return list(is...
[ "0.8141343", "0.80795014", "0.8068839", "0.8068839", "0.80510163", "0.80510163", "0.775401", "0.76662433", "0.7558641", "0.74475354", "0.7106462", "0.6662611", "0.6599173", "0.65830445", "0.65723467", "0.64912075", "0.6485345", "0.64637107", "0.64611137", "0.6430839", "0.6430...
0.8263646
0
The sequence following the first n elements >>> list(drop(2, [10, 20, 30, 40, 50])) [30, 40, 50]
def drop(n, seq): return itertools.islice(seq, n, None)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def drop(lst, n): # noqa: N805\n for _ in range(n):\n try:\n lst = lst.tail\n except AttributeError:\n break\n return lst", "def drop(iterable, n, islice=islice):\n return islice(iterable, n, None)", "def drop(n):\n def _drop_xducer(step)...
[ "0.7905065", "0.74295384", "0.6763828", "0.67272156", "0.6669577", "0.6648098", "0.66229075", "0.65501606", "0.64945686", "0.643039", "0.63765883", "0.63765883", "0.63395727", "0.63395727", "0.62736756", "0.6054525", "0.60503644", "0.6036039", "0.598577", "0.5961386", "0.5911...
0.8087424
0
The nth element in a sequence >>> nth(1, 'ABC') 'B'
def nth(n, seq): try: return seq[n] except TypeError: return next(itertools.islice(seq, n, None))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nth(iterable, index):\n return next(itertools.islice(iterable, index, None))", "def getitem(s, i):\n while i > 0:\n s, i = rest(s), i - 1\n return first(s)", "def nth(iterable, n, default=None):\n return next(islice(iterable, n, None), default)", "def nth(iterable, n, default=None):\n ...
[ "0.6975472", "0.68884224", "0.684532", "0.684532", "0.684532", "0.682165", "0.6750317", "0.6679597", "0.65622926", "0.648812", "0.63863564", "0.6241083", "0.62299436", "0.6191448", "0.6146418", "0.605952", "0.597531", "0.5928899", "0.59208065", "0.58448225", "0.58417475", "...
0.78693
0
Concatenate zero or more iterables, any of which may be infinite. An infinite sequence will prevent the rest of the arguments from being included. We use chain.from_iterable rather than chain(seqs) so that seqs can be a generator. >>> list(concat([[], [1], [2, 3]])) [1, 2, 3]
def concat(seqs): return itertools.chain.from_iterable(seqs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def concat(*seqs):\n return itertools.chain.from_iterable(seqs)", "def concat(iterables):\n return itertools.chain.from_iterable(iterables)", "def concat(cls, *args):\n \n if isinstance(args[0], list):\n sources = args[0]\n else:\n sources = list(args)\n ...
[ "0.78347844", "0.7793156", "0.6923485", "0.68935525", "0.6584743", "0.64061105", "0.62967205", "0.62400794", "0.6221371", "0.60994184", "0.60464287", "0.6016572", "0.5937169", "0.59291077", "0.58789116", "0.58568937", "0.5801373", "0.57500094", "0.56451416", "0.5623169", "0.5...
0.77909493
2
Variadic version of concat >>> list(concatv([], ["a"], ["b", "c"])) ['a', 'b', 'c']
def concatv(*seqs): return concat(seqs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _concat_vectors(*args):\n args_ = [_static_value(x) for x in args]\n if any(x_ is None for x_ in args_):\n return array_ops.concat(args, 0)\n return constant_op.constant([x_ for vec_ in args_ for x_ in vec_])", "def concat(*seqs):\n return itertools.chain.from_iterable(seqs)", "def concat(V, s):\n...
[ "0.6760438", "0.6125383", "0.5945617", "0.58371544", "0.58182865", "0.5802171", "0.5668729", "0.5651316", "0.5552251", "0.5495297", "0.54793125", "0.5433212", "0.54305035", "0.53857404", "0.5380562", "0.53738916", "0.53682035", "0.53604835", "0.532356", "0.5313424", "0.529761...
0.7426831
0
Apply f to each sequence in seqs, concatenating results
def mapcat(f, seqs): return concat(map(f, seqs))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sequence(f, lst: list) -> list:\n ret = []\n for ele in lst:\n ret.append(f(ele))\n return ret", "def concat_map(f, xs):\n return concat(imap(f, xs))", "def easy_parallize(f, sequence):\n pool = Pool(processes=NPROCESSORS) # depends on available cores\n result = pool.map(f,...
[ "0.7168194", "0.68441665", "0.6557089", "0.6493904", "0.6479037", "0.64775634", "0.62704474", "0.6169643", "0.6145393", "0.61331916", "0.605745", "0.601665", "0.59623605", "0.5956978", "0.59534156", "0.5931321", "0.59240204", "0.58933854", "0.5860937", "0.5825499", "0.5823625...
0.7556508
0
Add el to beginning of (possibly infinite) sequence seq. >>> list(cons(1, [2, 3])) [1, 2, 3]
def cons(el, seq): yield el for s in seq: yield s
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_to_beginning(self, domino):\n self.chain.insert(0, domino)", "def add_first(self, e):\n self._insert_between(e, self._head, self._head._next)", "def cons(l, x):\n return l + [x]", "def add_first(self, elem):\n if self.is_empty():\n self.head = self.tail = self.Node(...
[ "0.61411357", "0.60449934", "0.5978425", "0.59646565", "0.5937577", "0.5890092", "0.5888932", "0.5859856", "0.5706877", "0.5658728", "0.5624926", "0.5615269", "0.5615032", "0.56088316", "0.5608388", "0.55668443", "0.554704", "0.55362463", "0.5493912", "0.5492491", "0.54239213...
0.64185774
0