query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Awesomeproject spreads pure awesomeness.
def entry_point():
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def project():", "def project():", "def project():", "def test_read_project(self):\n pass", "def test_read_project(self):\n pass", "def test_quick_build(self):\n pass", "def test_quick_build1(self):\n pass", "def main(self):", "def test_get_project(self):\n pass",...
[ "0.75060505", "0.75060505", "0.75060505", "0.61421615", "0.61421615", "0.6136309", "0.6004166", "0.6001538", "0.59665745", "0.5925064", "0.5925064", "0.5925064", "0.5925064", "0.59186715", "0.59168774", "0.59003806", "0.58567214", "0.58567214", "0.5793911", "0.57907754", "0.5...
0.0
-1
Merge two lists sorted in descending order.
def merge(a, b): # your code here m = [] i, j = 0, 0 while i < len(a) and j < len(b): if a[i] < b[j]: m.append(a[i]) i += 1 else: m.append(b[j]) j += 1 m +...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def merge ( list1, list2 ):\n new_list = []\n while len(list1)>0 and len(list2)>0:\n if list1[0] < list2[0]:\n new_list.append (list1[0])\n del list1[0]\n else:\n new_list.append (list2[0])\n del list2[0]\n return new_list + list1 + list2", "def merge(l1, l2):\n\n ...
[ "0.7819038", "0.7720342", "0.7684522", "0.75869024", "0.7551841", "0.7532117", "0.74882025", "0.74285775", "0.7416055", "0.7384424", "0.7365451", "0.73496974", "0.728718", "0.72749096", "0.7255807", "0.72539026", "0.7162134", "0.71429527", "0.71196735", "0.7114966", "0.709943...
0.7145039
17
Retrieve the current values of the RAMSTKMode data model attributes.
def get_attributes(self): _attributes = { 'function_id': self.function_id, 'hardware_id': self.hardware_id, 'mode_id': self.mode_id, 'critical_item': self.critical_item, 'description': self.description, 'design_provisions': self.design_prov...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def device_state_attributes(self):\n # TODO: convert RH from Elk to AH ?\n #if self.current_humidity > 0:\n # humidity = self.current_humidity\n data = {\n 'hidden': self._hidden,\n 'temp_unit' : self.temperature_unit,\n }\n if self._device.tem...
[ "0.61570674", "0.6085479", "0.6055138", "0.6028234", "0.60274136", "0.60102427", "0.59539336", "0.5916759", "0.5916759", "0.58789027", "0.58387506", "0.58357614", "0.58318275", "0.58289427", "0.57944816", "0.57702005", "0.57553905", "0.5739991", "0.57087195", "0.5681874", "0....
0.54526293
57
Set the current values of the RAMSTKMode data model attributes.
def set_attributes(self, attributes): _error_code = 0 _msg = "RAMSTK SUCCESS: Updating RAMSTKMode {0:d} attributes.". \ format(self.hardware_id) try: self.critical_item = int( none_to_default(attributes['critical_item'], 0)) self.descriptio...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_parameters(self, mode, data):\n if mode == 'design' or self.local_design:\n self.new_design = True\n\n for key, dc in self.variables.items():\n if isinstance(dc, dc_cp):\n if ((mode == 'offdesign' and not self.local_design) or\n (mod...
[ "0.59262383", "0.5660007", "0.55965436", "0.5562529", "0.5450975", "0.54298156", "0.54060215", "0.53941303", "0.53482354", "0.5345499", "0.53415346", "0.53402495", "0.5300903", "0.52654946", "0.52514917", "0.52222824", "0.5211762", "0.52113414", "0.5209696", "0.5204078", "0.5...
0.6953201
0
Calculate the Criticality for the Mode. Mode Criticality = Item Hazard Rate Mode Ratio Mode Operating Time Effect Probability
def calculate_criticality(self, item_hr): _error_code = 0 _msg = 'RAMSTK SUCCESS: Calculating failure mode {0:d} criticality.'.\ format(self.mode_id) if item_hr < 0.0: _error_code = 2010 _msg = _(u"RAMSTK ERROR: Item hazard rate has a negative value.") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def conductivity(self):\n m = 1.67296736e-02 # Determined from optimisation\n c = 8.54665149e-05 # Determined from optimisation\n return m * self.concentration + c", "def coherence(self):\r\n return np.abs(self.coherency) ** 2", "def functionality(self):\n self._functionali...
[ "0.6149671", "0.581926", "0.5749423", "0.569552", "0.5639848", "0.5627742", "0.54855204", "0.547161", "0.5445516", "0.5431224", "0.5431224", "0.5400731", "0.539497", "0.5374824", "0.53717357", "0.53432816", "0.53290373", "0.5251396", "0.5239214", "0.5225909", "0.52176267", ...
0.7476894
0
List of signals is split into lists of single signals
def test_process_signal_list(self): input_signals = [Signal({"hello": "n.io"}), Signal({"hello": "n.io"}), Signal({"hello": "n.io"})] blk = SignalListSplitter() self.configure_block(blk, {}) blk.start() # one list of signals is pr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_process_signal_list_of_one(self):\n input_signals = [Signal({\"hello\": \"n.io\"})]\n blk = SignalListSplitter()\n self.configure_block(blk, {})\n blk.start()\n # one list of signals is processed\n blk.process_signals(input_signals)\n blk.stop()\n se...
[ "0.67559826", "0.637552", "0.6127554", "0.58000535", "0.5581344", "0.5568421", "0.5567797", "0.5507483", "0.54910624", "0.546959", "0.5445433", "0.539266", "0.53553843", "0.53532606", "0.5294758", "0.52855957", "0.52851367", "0.5276394", "0.52736336", "0.5243967", "0.5243068"...
0.68666124
0
List of signals is split into lists of single signals
def test_process_signal_list_of_one(self): input_signals = [Signal({"hello": "n.io"})] blk = SignalListSplitter() self.configure_block(blk, {}) blk.start() # one list of signals is processed blk.process_signals(input_signals) blk.stop() self.assert_num_sig...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_process_signal_list(self):\n input_signals = [Signal({\"hello\": \"n.io\"}),\n Signal({\"hello\": \"n.io\"}),\n Signal({\"hello\": \"n.io\"})]\n blk = SignalListSplitter()\n self.configure_block(blk, {})\n blk.start()\n # o...
[ "0.68666124", "0.637552", "0.6127554", "0.58000535", "0.5581344", "0.5568421", "0.5567797", "0.5507483", "0.54910624", "0.546959", "0.5445433", "0.539266", "0.53553843", "0.53532606", "0.5294758", "0.52855957", "0.52851367", "0.5276394", "0.52736336", "0.5243967", "0.5243068"...
0.67559826
1
v_1 w_1 + ... + v_n w_n
def dot(v,w): return sum(v_i * w_i for v_i, w_i in zip(v, w))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vector_add(v, w):\n return [v_i + w_i for v_i, w_i in zip(v,w)]", "def vector_add(v, w):\n return [v_i + w_i for v_i, w_i in zip(v, w)]", "def vector_add(v, w):\n\treturn [v_i + w_i for v_i, w_i in zip(v, w)]", "def add(v: Vector, w: Vector) -> Vector:\n assert len(v) == len(w), 'both vectors mu...
[ "0.7097757", "0.70765364", "0.7075953", "0.65045404", "0.64145964", "0.6388513", "0.63860494", "0.6356628", "0.6353366", "0.6353366", "0.6353366", "0.6353366", "0.6353366", "0.6330879", "0.63247854", "0.6277021", "0.62067485", "0.6178578", "0.6085259", "0.60823065", "0.604902...
0.6338228
13
v_1 v_1 + ... + v_n v_n
def sum_of_squares(x): return dot(x, x)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_vectors(v, u):\n return (v[0] + u[0], v[1] + u[1])", "def vector_add(v1, v2):\n return v1[0] + v2[0], v1[1] + v2[1]", "def __add__(self, _v):\n\t\tif len(self) == len(_v):\n\t\t\tans = copy.deepcopy(self)\n\t\t\tfor i in range(0, self.n):\n\t\t\t\tans[i] += _v[i]\n\t\t\treturn ans", "def vector...
[ "0.6679955", "0.6620289", "0.6549366", "0.6544268", "0.6518459", "0.64456105", "0.64288396", "0.6398406", "0.62491995", "0.6110092", "0.6052938", "0.60382", "0.6037448", "0.602034", "0.5956096", "0.5947813", "0.5876077", "0.58669853", "0.585338", "0.58445466", "0.58286864", ...
0.0
-1
translates x by subtracting its mean from every observation (so that the result has a mean = 0)
def dev_mean(x): x_bar = mean(x) return [x_i - x_bar for x_i in x]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def de_mean(x):\n x_bar = mean(x)\n return [ x_i - x_bar for x_i in x]", "def de_mean(x):\n x_bar = mean(x)\n return [x_i - x_bar for x_i in x]", "def de_mean(x):\n x_bar = mean(x)\n return [x_i - x_bar for x_i in x]", "def de_mean(x):\n x_bar = mean(x)\n return [x_i - x_bar for x_i i...
[ "0.81177664", "0.80826604", "0.80826604", "0.80826604", "0.7419382", "0.71917254", "0.70956707", "0.6826369", "0.6820255", "0.6728887", "0.6728887", "0.6612345", "0.6566342", "0.6563226", "0.6550982", "0.6509516", "0.6455834", "0.63640994", "0.63588613", "0.6349324", "0.63412...
0.68667185
7
assumes x has at least two elements
def variance(x): n = len(x) deviations = dev_mean(x) return sum_of_squares(deviations) / (n-1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def intersect(x):\n if len(x) < 2:\n return x\n\n # Make sure everybody have the same shape\n first_shape = tuple(x[0].shape)\n for pixmap in x[1:]:\n if first_shape != tuple(pixmap.shape):\n return []\n\n return [(np.prod(np.array(x), axis=0) > 0).astype(int)]", "def _che...
[ "0.59251857", "0.5914457", "0.58948374", "0.5855917", "0.58345103", "0.5804906", "0.5720883", "0.57127684", "0.56765395", "0.56101656", "0.5559036", "0.5556334", "0.55350626", "0.5518712", "0.5518712", "0.55062586", "0.5500494", "0.54991597", "0.54929", "0.54871774", "0.54791...
0.0
-1
returns the num_columns x num_columns matrix whose (i,j)th entry is the correlation between columns i and j of data
def correlation_matrix(data): _, num_columns = shape(data) def matrix_entry(i, j): return correlation(get_column(data, i), get_column(data, j)) return make_matrix(num_columns, num_columns, matrix_entry)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def correlation_matrix(data):\n\n _, num_columns = shape(data)\n\n def matrix_entry(i, j):\n return correlation(get_column(data, i), get_column(data, j))\n\n return make_matrix(num_columns, num_columns, matrix_entry)", "def correlation_matrix(data):\n\n _, num_columns = shape(data)\n\n def ...
[ "0.8153571", "0.8153571", "0.7506318", "0.714195", "0.70782083", "0.6879409", "0.687049", "0.6733009", "0.6535114", "0.6527502", "0.6494434", "0.64640766", "0.64628077", "0.64515585", "0.64164704", "0.64059234", "0.6371729", "0.6369661", "0.6355419", "0.63055253", "0.6285088"...
0.8082999
2
Ensure the start and end are appropriately placed in the solution.
def _fix_entrances(self, solution): # prune if start is found in solution if self.start in solution: i = solution.index(self.start) solution = solution[i+1:] # fix solution so it doesn't overlap endpoints if not self._on_edge(self.end): [solution] = [...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recheckPosition(self):\n self.start = self.bounds[0].pos\n self.end = self.bounds[1].pos", "def _adjustRange(self, start, end):\n adjusted_start = start\n if self._start:\n if end < self._start:\n return None\n adjusted_start = max(self._start, start)\n \n adjuste...
[ "0.68125606", "0.6379375", "0.6144579", "0.60662675", "0.6036222", "0.6026443", "0.59448326", "0.58304745", "0.58173734", "0.5811092", "0.57554084", "0.5728628", "0.5727028", "0.5721812", "0.5717647", "0.57121235", "0.5684069", "0.5680649", "0.56578076", "0.5622473", "0.56151...
0.61045414
3
the black side first to place a disc, add output to black_prompt responses and to white_prompt requests, vice versa
def play(self, turn): # global black_prompt, white_prompt, res, pi, board if turn % 2 == 0: prompt, requests_add, responses_add, color_to_play = self.bp, self.bp, self.wp, BLACK print("pure") res = pure_MCTS.UCTAlg(json=prompt).run(time_limit=1) else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hidden_message():\n print(\"\")\n print(f\"{YELLOW}[{MIDDLE_DOT}]{RESET} \"\n \"Choose ZWC option (1 - Encode / 2 - Decode): \", end=\"\")\n option = int(input().lower())\n if option == 1:\n encode_text()\n elif option == 2:\n print(f\"{GREEN}[+]{RESET} Decoded Message: \" ...
[ "0.54052615", "0.5379841", "0.53509325", "0.5323831", "0.5321609", "0.5311181", "0.53076744", "0.5279506", "0.5269653", "0.52644014", "0.52467823", "0.52465475", "0.5240277", "0.52396023", "0.521198", "0.52030087", "0.5173321", "0.51696783", "0.51504856", "0.51416767", "0.513...
0.521329
14
Html representation of Facets Overview for use in a Jupyter notebook.
def _repr_html_(self) -> str: protostr = base64.b64encode(self._proto.SerializeToString()).decode('utf-8') html_template = ''' <script src="{webcomponents_js}"></script> <link rel="import" href="{facets_html}"> <facets-overview id="overview_elem"></facets-overview> <script> ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _repr_html_(self) -> str:\n html_template = \"\"\"\n <script src=\"{webcomponents_js}\"></script>\n <link rel=\"import\" href=\"{facets_html}\">\n <facets-dive id=\"dive_elem\" height=\"{height}\"></facets-dive>\n <script>\n document.querySelector(\"#dive_elem\").data = ...
[ "0.5600265", "0.5545297", "0.5515862", "0.52539235", "0.52248704", "0.51869327", "0.518335", "0.5182476", "0.51630205", "0.5079258", "0.5056503", "0.50485706", "0.50290495", "0.50201535", "0.5011314", "0.49888295", "0.496754", "0.49586928", "0.4941969", "0.49364", "0.4936073"...
0.577709
0
Html representation of Facets Dive for use in a Jupyter notebook.
def _repr_html_(self) -> str: html_template = """ <script src="{webcomponents_js}"></script> <link rel="import" href="{facets_html}"> <facets-dive id="dive_elem" height="{height}"></facets-dive> <script> document.querySelector("#dive_elem").data = {data}; </script>"...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _repr_html_(self) -> str:\n protostr = base64.b64encode(self._proto.SerializeToString()).decode('utf-8')\n html_template = '''\n <script src=\"{webcomponents_js}\"></script>\n <link rel=\"import\" href=\"{facets_html}\">\n <facets-overview id=\"overview_elem\"></facets-overview>\n ...
[ "0.5747352", "0.5307675", "0.5240231", "0.51319224", "0.5109449", "0.50896925", "0.50568515", "0.5052512", "0.49906644", "0.49706864", "0.49553403", "0.4881878", "0.48760134", "0.48600367", "0.48523626", "0.48476768", "0.48415962", "0.4828744", "0.48147592", "0.48147592", "0....
0.62843364
0
BCE summed over the voxels intensities.
def bce_on_intensities(x, recon_x, scale_b): bce = torch.sum( F.binary_cross_entropy(recon_x, x) / scale_b.exp() + 2 * scale_b) return bce
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _vce(self):\n sum = 0.0\n for sail in self.sails:\n cl2 = sail.cl(self.awa)**2\n cd2 = sail.cd(self.awa)**2\n sum += sail.area * sail.vce * sail.bk * np.sqrt(cl2+cd2)\n self._area()\n deltaCH = 0 if self.sails[1].up!=True else (1-self.ftj)*0.05*self....
[ "0.63061666", "0.5997975", "0.588063", "0.5665232", "0.564657", "0.56458056", "0.55187875", "0.5485349", "0.5484678", "0.5478399", "0.5470462", "0.5465121", "0.54145944", "0.54053366", "0.5383228", "0.53753585", "0.5371241", "0.5369686", "0.5359706", "0.5344592", "0.5335335",...
0.55135
7
MSE summed over the voxels intensities.
def mse_on_intensities(x, recon_x, scale_b): print(min(recon_x)) print(max(recon_x)) print(min(x)) print(max(x)) mse = F.mse_loss(recon_x, x, reduction='sum') / scale_b return mse
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _mse(self):\n error = self._input * self._weights - self._label\n sum_ = 0.0\n for i in range(self._input.shape[0]):\n sum_ += error[i, 0]**2\n return sum_/self._input.shape[0]", "def _calc_msve(self):\n v = []\n for state in self._env.state_iterator():\n ...
[ "0.7202287", "0.71245104", "0.70636916", "0.70570135", "0.6970779", "0.69215125", "0.6889753", "0.6849584", "0.67434496", "0.67034423", "0.6664834", "0.6608378", "0.6576306", "0.6547451", "0.64824516", "0.6472968", "0.6437196", "0.6421605", "0.6401893", "0.6368984", "0.636452...
0.567657
96
MSE over features of FC layer of Discriminator.
def mse_on_features(feature, recon_feature, logvar): mse = F.mse_loss(recon_feature, feature) / (2 * logvar.exp()) mse = torch.mean(mse) return mse
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def discriminator_loss(discriminator, fake_images, real_images, fake_labels, real_labels, con_aug, stage):\n discriminator.train()\n criterion = nn.BCELoss()\n fake = fake_images.detach()\n condition = con_aug.detach()\n batch_size = real_images.size(0)\n \"\"\"\n *****************************...
[ "0.58933586", "0.5687825", "0.5670145", "0.5515114", "0.5477524", "0.54765", "0.54389805", "0.5409658", "0.5407765", "0.53701", "0.5356318", "0.5349838", "0.5349151", "0.5302134", "0.52876115", "0.5284638", "0.5263813", "0.52621937", "0.5254285", "0.52520597", "0.5234978", ...
0.59223557
0
Send basic information of channel
async def channel_info(bot, message): if isinstance(CHANNELS, (int, str)): channels = [CHANNELS] elif isinstance(CHANNELS, list): channels = CHANNELS else: raise ValueError("Unexpected type of CHANNELS") text = '📑 **Indexed channels/groups**\n' for channel in channels: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_channel_message(self, status, data1=None, data2=None, ch=None):\n msg = [(status & 0xF0) | ((ch if ch else self.channel) - 1 & 0xF)]\n\n if data1 is not None:\n msg.append(data1 & 0x7F)\n\n if data2 is not None:\n msg.append(data2 & 0x7F)\n\n self....
[ "0.6436497", "0.6348447", "0.63190854", "0.62161165", "0.62013686", "0.6185579", "0.6169274", "0.6159009", "0.61348945", "0.61177874", "0.61107844", "0.61066043", "0.61066043", "0.61066043", "0.6086329", "0.60670966", "0.6052061", "0.60225135", "0.60011584", "0.59927464", "0....
0.59144914
30
Show total files in database
async def total(bot, message): msg = await message.reply("Processing...⏳", quote=True) try: total = await Media.count_documents() await msg.edit(f'📁 Saved files: {total}') except Exception as e: logger.exception('Failed to check total files') await msg.edit(f'Error: {e}')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def total_files(self):\n command = \"SELECT searched FROM options;\"\n return self.c.execute(command)", "def fs_files_total(self):\n return self._fs_files_total", "def getFileCount(self) -> int:\n ...", "def totalfiles(self):\n return len([sz for sz in self.iterate()])", ...
[ "0.75531894", "0.70216966", "0.6991882", "0.69044584", "0.69035006", "0.68878055", "0.68755126", "0.6699878", "0.6671501", "0.65564287", "0.6547608", "0.64975446", "0.64903414", "0.64636934", "0.64395994", "0.640908", "0.63254476", "0.6294701", "0.6255073", "0.6235836", "0.62...
0.67092466
7
Delete file from database
async def delete(bot, message): reply = message.reply_to_message if reply and reply.media: msg = await message.reply("Processing...⏳", quote=True) else: await message.reply('Reply to file with /delete which you want to delete', quote=True) return for file_type in ("document", "v...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_db(self):\n import os.path\n os.remove(self.filepath)", "def delete(self, filename):\n pass", "def delete_file(file_id):\n file_obj = Data.objects.get(id=file_id)\n print(\"Removing file: \", file_obj.name)\n print(file_obj.file.path)\n file_dir = file_obj.file.path\...
[ "0.79601157", "0.7939549", "0.7724207", "0.76846415", "0.749681", "0.72521895", "0.72500366", "0.724998", "0.7248713", "0.72234935", "0.7212773", "0.7202836", "0.718874", "0.7165154", "0.71618164", "0.7144323", "0.7123797", "0.7113529", "0.7098491", "0.7044695", "0.7039676", ...
0.6551673
74
Add new contact to the database
def add_contact(self, contact): self.db.insert_contact(contact) return self.update_contacts()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_contact_to_db(self):\n self.init_db(self._testing)\n\n # make sure that the object is not in the db\n assert self.uid == \"\"\n\n self._insert_row_into_db(Contact.table_name, Contact.columns, self.values)\n\n # update this objects uid\n self.uid = self._get_id_of_l...
[ "0.84468395", "0.8155297", "0.7787158", "0.7690058", "0.7496616", "0.73814785", "0.73638916", "0.73298204", "0.7302359", "0.7158444", "0.7154227", "0.71142626", "0.7102266", "0.7028337", "0.69548136", "0.6899097", "0.68859565", "0.6878193", "0.6827072", "0.6824314", "0.681856...
0.8165148
1
Print contacts without contacting to database
def list_contacts(self): return self.contacts
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display_contact(self):\n contacts = \"\".join(str(contact) for contact in self.contact_list)\n print(contacts)", "def do_show(self, line):\n\t\tif not(self.db is None):\n\t\t\tfor contact in self.db.contact.find():\n\t\t\t\tpprint.pprint(contact)\n\t\telse:\n\t\t\tprint(\"You must open the exis...
[ "0.7405073", "0.7108748", "0.66840386", "0.6666923", "0.6527708", "0.6482683", "0.63072914", "0.63001305", "0.61677194", "0.61671007", "0.6138823", "0.60151744", "0.58849186", "0.58472013", "0.5808614", "0.57923657", "0.57631457", "0.5700023", "0.5692983", "0.56776345", "0.56...
0.55335945
27
Update contacts after change
def update_contacts(self): self.contacts = self.db.list_contacts() return self.list_contacts()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def contacts_list_update(self):\n\t\tself.database.contacts_clear()\n\t\tclient_log.debug(f'Запрос контакт листа для пользователся {self.name}')\n\t\treq = {\n\t\t\tACTION: GET_CONTACTS,\n\t\t\tTIME: time.time(),\n\t\t\tUSER: self.username\n\t\t}\n\t\tclient_log.debug(f'Сформирован запрос {req}')\n\t\twith socket_...
[ "0.75325215", "0.71713334", "0.71713334", "0.70067936", "0.6914438", "0.687053", "0.68023425", "0.67809993", "0.67450345", "0.6729109", "0.67007273", "0.66972715", "0.6619613", "0.65905577", "0.64673847", "0.639455", "0.63806546", "0.62849957", "0.6272024", "0.62464106", "0.6...
0.7861427
0
Delete all contact from database
def delete_contacts(self): self.db.delete_all_contacts() return self.update_contacts()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def RemoveAll(self):\n\t\tcontacts = self.GetContactList()\n\t\t\n\t\tfor contact in contacts:\n\t\t\tself.BatchEnqueue('delete', contact)\n\t\tself.ExecuteBatchQueue()", "def del_contact_all(self):\n\n send_key(KEY_MENU)\n delstr = contact.get_value('contact_delete')\n if search_text(delstr...
[ "0.75905544", "0.7518111", "0.7328898", "0.72868043", "0.7197841", "0.71404386", "0.6918222", "0.6866233", "0.68557423", "0.675412", "0.6746233", "0.6720648", "0.6713548", "0.67038", "0.66817254", "0.6613652", "0.66043967", "0.6591996", "0.65602887", "0.65030277", "0.6497577"...
0.8326911
0
List contact by searching for a given value
def list_contact(self, key, value): self.db.list_contact( key, value, )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search_contact_list(self):\n\n search_db = Database()\n result = search_db.contact_search(self.name)\n if not result:\n print Fore.YELLOW + ' No such contact'\n return None\n if result > 1:\n print ' Which contact ??'\n for items in result:\n...
[ "0.8009426", "0.68117666", "0.6737137", "0.6643471", "0.64197785", "0.63611305", "0.63020825", "0.6217333", "0.6197536", "0.61852074", "0.6019509", "0.60167944", "0.60021037", "0.5823502", "0.58208525", "0.57927597", "0.5778662", "0.5749409", "0.5742812", "0.5683135", "0.5647...
0.7042657
1
Sort list by a given key
def sort_list(self, key_): options = { 'index': 0, 'name' : 1, 'surname': 2, 'email': 3, 'phone': 4, } if key_ in options.keys(): key_ = options.get(key_) return(sorted(self.contacts, key = lambda x: x[key_]))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sort_list(list, key):\r\n list.sort(lambda x,y: cmp(key(x), key(y))) # Python < 2.4 hack\r\n return list", "def sort_by(dict_list, key):\n return sorted(dict_list, key=lambda k: k[key])", "def sort(self, key: Callable):\n self.data.sort(key=key)", "def sort(self, key: Callable):\n self...
[ "0.85183585", "0.76804423", "0.74490815", "0.74490815", "0.7327094", "0.7177161", "0.70513463", "0.70497483", "0.7033415", "0.7021332", "0.6926903", "0.6830539", "0.68296474", "0.6816898", "0.6805124", "0.6768381", "0.6680146", "0.6676333", "0.66692996", "0.66565144", "0.6571...
0.73547125
4
Method to present data in a pretty way
def present_data(self, data=None): print('--------------------------------------------------------------------------') print('{:<10}{:<10}{:<15}{:<17}{:<17}'. format( 'index', 'name', 'surname', 'email', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_data(self, ):\r\n return print('society_name : {}\\n'\r\n 'flat : {}\\n'\r\n 'house_no : {}\\n'\r\n 'no_of_members : {}\\n'\r\n 'income : {}\\n '\r\n .format(self.society_name, ...
[ "0.7862266", "0.76273274", "0.7573931", "0.7204881", "0.6953377", "0.6934812", "0.68800884", "0.68433625", "0.6780841", "0.67295384", "0.6708125", "0.6696236", "0.6686045", "0.6659192", "0.6655323", "0.6651854", "0.6643173", "0.6629567", "0.661392", "0.6545845", "0.6533608", ...
0.6941114
5
Get number of prunable parameters
def num_prunable_parameters(self) -> int: return sum(l.weight.numel() for l in self.emb_layers) + \ sum(weight.numel() for weight in self.emb_projs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def n_parameters(self):\n return self.pdm.n_parameters", "def num_params(self):", "def get_parameter_numbers(self) -> int:\n # TODO(jeikeilim): return the number of parameter list of each layers.\n n_param = sum([x.numel() for x in self.model.parameters()])\n return n_param", "def...
[ "0.75405735", "0.75211614", "0.738875", "0.7387541", "0.73810554", "0.73747927", "0.7355472", "0.73516285", "0.73359424", "0.7311632", "0.7311632", "0.7266938", "0.72314495", "0.72314495", "0.72164834", "0.7203205", "0.7203205", "0.7203205", "0.7185691", "0.71791095", "0.7174...
0.73142964
9
Get number of parameters.
def num_parameters(self, train=True) -> torch.Tensor: params = torch.tensor(0, dtype=torch.float).to(self.emb_projs[0]) if train: for i in range(len(self.cutoffs)): n_proj = self.masks[i].l0_norm() params += (self.emb_projs[i].size(0) + self.emb_layers[i].weig...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_num_parameters(self):\n return len(self.parameters)", "def get_num_params(self):\n if self.num_params is None:\n import inspect\n argspec = inspect.getfullargspec(self.get_code())\n if argspec.varargs or argspec.varkw:\n self.num_params = -1\n...
[ "0.8879826", "0.8658821", "0.8643426", "0.8621051", "0.8559576", "0.8443666", "0.8400023", "0.83914536", "0.8350942", "0.82651836", "0.8234711", "0.8157073", "0.8155948", "0.8069919", "0.8065736", "0.8064464", "0.8031127", "0.80070335", "0.79923403", "0.79663205", "0.7945741"...
0.0
-1
Get number of prunable parameters
def num_prunable_parameters(self) -> int: return sum(l.weight.numel() for l in self.emb_layers) + \ sum(weight.numel() for weight in self.emb_projs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def n_parameters(self):\n return self.pdm.n_parameters", "def num_params(self):", "def get_parameter_numbers(self) -> int:\n # TODO(jeikeilim): return the number of parameter list of each layers.\n n_param = sum([x.numel() for x in self.model.parameters()])\n return n_param", "def...
[ "0.75405735", "0.75211614", "0.738875", "0.7387541", "0.73810554", "0.73747927", "0.7355472", "0.73516285", "0.73359424", "0.7311632", "0.7311632", "0.7266938", "0.72314495", "0.72314495", "0.72164834", "0.7203205", "0.7203205", "0.7203205", "0.7185691", "0.71791095", "0.7174...
0.73142964
10
Get number of parameters.
def num_parameters(self, train=True) -> torch.Tensor: params = torch.tensor(0, dtype=torch.float).to(self.emb_projs[0]) if train: for i in range(len(self.cutoffs)): n_proj = (self.masks[i].data.abs() > self.epsilon).sum() params += (self.emb_projs[i].size(0) +...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_num_parameters(self):\n return len(self.parameters)", "def get_num_params(self):\n if self.num_params is None:\n import inspect\n argspec = inspect.getfullargspec(self.get_code())\n if argspec.varargs or argspec.varkw:\n self.num_params = -1\n...
[ "0.8879826", "0.8658821", "0.8643426", "0.8621051", "0.8559576", "0.8443666", "0.8400023", "0.83914536", "0.8350942", "0.82651836", "0.8234711", "0.8157073", "0.8155948", "0.8069919", "0.8065736", "0.8064464", "0.8031127", "0.80070335", "0.79923403", "0.79663205", "0.7945741"...
0.0
-1
Get number of prunable parameters
def num_prunable_parameters(self) -> int: return sum(l.weight.numel() for l in self.out_layers) + \ sum(weight.numel() for weight in self.out_projs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def n_parameters(self):\n return self.pdm.n_parameters", "def num_params(self):", "def get_parameter_numbers(self) -> int:\n # TODO(jeikeilim): return the number of parameter list of each layers.\n n_param = sum([x.numel() for x in self.model.parameters()])\n return n_param", "def...
[ "0.75405735", "0.75211614", "0.738875", "0.7387541", "0.73810554", "0.73747927", "0.7355472", "0.73516285", "0.73359424", "0.73142964", "0.73142964", "0.7266938", "0.72314495", "0.72314495", "0.72164834", "0.7203205", "0.7203205", "0.7203205", "0.7185691", "0.71791095", "0.71...
0.7311632
12
Get number of parameters.
def num_parameters(self, train=True) -> torch.Tensor: params = torch.tensor(0, dtype=torch.float).to(self.out_projs[0]) if train: for i in range(len(self.cutoffs)): n_proj = self.masks[i].l0_norm() params += (self.out_projs[i].size(0) + self.out_layers[i].weig...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_num_parameters(self):\n return len(self.parameters)", "def get_num_params(self):\n if self.num_params is None:\n import inspect\n argspec = inspect.getfullargspec(self.get_code())\n if argspec.varargs or argspec.varkw:\n self.num_params = -1\n...
[ "0.8879826", "0.8658821", "0.8643426", "0.8621051", "0.8559576", "0.8443666", "0.8400023", "0.83914536", "0.8350942", "0.82651836", "0.8234711", "0.8157073", "0.8155948", "0.8069919", "0.8065736", "0.8064464", "0.8031127", "0.80070335", "0.79923403", "0.79663205", "0.7945741"...
0.0
-1
Get number of prunable parameters
def num_prunable_parameters(self) -> int: return sum(l.weight.numel() for l in self.out_layers) + \ sum(weight.numel() for weight in self.out_projs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def n_parameters(self):\n return self.pdm.n_parameters", "def num_params(self):", "def get_parameter_numbers(self) -> int:\n # TODO(jeikeilim): return the number of parameter list of each layers.\n n_param = sum([x.numel() for x in self.model.parameters()])\n return n_param", "def...
[ "0.75405735", "0.75211614", "0.738875", "0.7387541", "0.73810554", "0.73747927", "0.7355472", "0.73516285", "0.73359424", "0.73142964", "0.73142964", "0.7266938", "0.72314495", "0.72314495", "0.72164834", "0.7203205", "0.7203205", "0.7203205", "0.7185691", "0.71791095", "0.71...
0.7311632
11
Get number of parameters.
def num_parameters(self, train=True) -> torch.Tensor: params = torch.tensor(0, dtype=torch.float).to(self.out_projs[0]) if train: for i in range(len(self.cutoffs)): n_proj = (self.masks[i].data.abs() > self.epsilon).sum() params += (self.out_projs[i].size(0) +...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_num_parameters(self):\n return len(self.parameters)", "def get_num_params(self):\n if self.num_params is None:\n import inspect\n argspec = inspect.getfullargspec(self.get_code())\n if argspec.varargs or argspec.varkw:\n self.num_params = -1\n...
[ "0.8879826", "0.8658821", "0.8643426", "0.8621051", "0.8559576", "0.8443666", "0.8400023", "0.83914536", "0.8350942", "0.82651836", "0.8234711", "0.8157073", "0.8155948", "0.8069919", "0.8065736", "0.8064464", "0.8031127", "0.80070335", "0.79923403", "0.79663205", "0.7945741"...
0.0
-1
create dataset for locate mark area position in omr image
def make_voc_dataset(): # dataset from test omrimage123 # create from test omrimage2 import form_test as ftt # former = ftt.form_21() # omrimage2-1 omr01.jpg, omr2018a # former = ftt.form_22() # omrimage2-2 OMR01.jpg, omr2018b former = ftt.form_6() # omr2018f6 dname = 'omr2018f6...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_annotation_data(self):\n for i, hp in enumerate(self.hanging_point_in_camera_coords_list):\n px, py = self.camera_model.project3d_to_pixel(hp.worldpos())\n if self.save_debug_image:\n self.bgr_axis = self.bgr.copy()\n if 0 <= px < self.target_width ...
[ "0.58949435", "0.5746331", "0.5726559", "0.56060755", "0.5605567", "0.55885756", "0.55885243", "0.54849917", "0.5479196", "0.5452147", "0.5448799", "0.54228556", "0.5405141", "0.54037136", "0.5385172", "0.537736", "0.5366441", "0.5364228", "0.5364176", "0.5347343", "0.5337789...
0.5257886
31
read label,image from tfrecord datafile read number is not limited, 0 indefinite use tensorflow.Session
def fun_read_tfrecord_filelist(file_list, read_num=100): # check file list is ok if type(file_list) != list: if type(file_list) == str: file_list = [file_list] else: print('need a file_name or files_name_list!') return for s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_single():\n\n\n filename = glob.glob(\"rawdata/tfrecords_cleaned/*.tfrecords\")\n\n\n filename_queue = tf.train.string_input_producer(filename, num_epochs=None)\n img, label, rk, links = read_and_decode_file(filename_queue)\n\n init = tf.global_variables_initializer()\n\n sess = tf.Session(...
[ "0.7381145", "0.7147946", "0.70476395", "0.6901313", "0.68394387", "0.6806212", "0.6792378", "0.6766865", "0.6712281", "0.66669863", "0.66519564", "0.6645036", "0.6624598", "0.65483457", "0.6527235", "0.65252674", "0.6501299", "0.64654404", "0.6465048", "0.6458233", "0.645600...
0.71598876
1
Test if the auditor respects "collect_only" config item
def test_collect_only(cinq_test_service): # Prep setup_info = setup_test_aws(cinq_test_service) account = setup_info['account'] prep_s3_testing(cinq_test_service, collect_only=True) # Add resources client = aws_get_client('s3') bucket_name = dbconfig.get('test_bucket_name', NS_CINQ_TEST, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pytest_ignore_collect(path: Any, config: Config) -> bool:\n if config.option.functional:\n return True\n if config.option.markexpr and \"wip\" in config.option.markexpr:\n return False # collect when looking for markers\n return not (config.option.integration or config.option.integratio...
[ "0.6463033", "0.58618915", "0.58207494", "0.56816643", "0.56375605", "0.55994993", "0.54857254", "0.54495823", "0.53826636", "0.5368159", "0.5362893", "0.5337729", "0.533311", "0.532473", "0.532473", "0.5313702", "0.51993185", "0.5181066", "0.5178171", "0.5176643", "0.5131159...
0.54581964
7
Test if the auditor respects "collect_only" config item
def test_ignore_tag(cinq_test_service): # Prep setup_info = setup_test_aws(cinq_test_service) account = setup_info['account'] prep_s3_testing(cinq_test_service) # Add resources client = aws_get_client('s3') bucket_name = dbconfig.get('test_bucket_name', NS_CINQ_TEST, default='testbucket')...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pytest_ignore_collect(path: Any, config: Config) -> bool:\n if config.option.functional:\n return True\n if config.option.markexpr and \"wip\" in config.option.markexpr:\n return False # collect when looking for markers\n return not (config.option.integration or config.option.integratio...
[ "0.6463544", "0.5860176", "0.58197325", "0.5681499", "0.56378657", "0.5598911", "0.54860127", "0.5456772", "0.5450269", "0.5384088", "0.5370349", "0.5365668", "0.53368825", "0.533252", "0.5327629", "0.5327629", "0.531436", "0.52009016", "0.5182213", "0.5179538", "0.51759523",...
0.0
-1
Test whether the auditor respects the alert schedule
def test_alert_schedule(cinq_test_service): setup_info = setup_test_aws(cinq_test_service) account = setup_info['account'] prep_s3_testing(cinq_test_service) # Add resources client = aws_get_client('s3') bucket_name = dbconfig.get('test_bucket_name', NS_CINQ_TEST, default='testbucket') cl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_for_alerts(self, cr, uid, context=None):\n\n dept_obj = self.pool.get('hr.department')\n detail_obj = self.pool.get('hr.schedule.detail')\n attendance_obj = self.pool.get('hr.attendance')\n rule_obj = self.pool.get('hr.schedule.alert.rule')\n\n # TODO - Someone who care...
[ "0.65938187", "0.6176482", "0.61750144", "0.61458766", "0.604789", "0.60455877", "0.60449404", "0.59740597", "0.59729266", "0.5958995", "0.5948456", "0.5939794", "0.5884633", "0.58724236", "0.5820209", "0.58177555", "0.57953286", "0.578536", "0.5773353", "0.57711244", "0.5767...
0.6369556
1
Counting sort arr in place.
def counting_sort(arr): # No need to sort if arr is None: return arr n = len(arr) if n <= 1: return arr # find the counting scope, i.e., the max value max_value = arr[0] for i in range(1, n): if arr[i] > max_value: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def countingSort2(arr):\n freq = [0] * 100\n for el in arr:\n freq[el] += 1\n\n sorted_arr = []\n for i in range(len(freq)):\n sorted_arr = sorted_arr + [i] * freq[i]\n return sorted_arr", "def counting_sort(arr):\n # Given that numbers are integers in range 0 <= x < 100\n coun...
[ "0.78273445", "0.77633786", "0.7481935", "0.7466987", "0.7410261", "0.7389358", "0.7366042", "0.7251443", "0.7188289", "0.71487", "0.7146158", "0.70710707", "0.6989624", "0.6783512", "0.6743108", "0.66933733", "0.66844094", "0.65865797", "0.648153", "0.646309", "0.6394911", ...
0.8207626
0
This test case checks that a field value has the expected values.
def test_props_fields( self, splunk_search_util, splunk_searchtime_fields_positive, record_property ): # Search Query record_property("stanza_name", splunk_searchtime_fields_positive["stanza"]) record_property("stanza_type", splunk_searchtime_fields_positive["stanza_type"]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_field_rules():", "def test_many_values(self):\n write this test!", "def _assert_fields_match(self, actual_field, expected_field):\n assert actual_field is not None, \"Could not find field {name}\".format(name=expected_field[\"name\"])\n\n for key in expected_field:\n as...
[ "0.72825843", "0.69574255", "0.69196886", "0.68443435", "0.6773343", "0.67436814", "0.67333835", "0.67238384", "0.67176306", "0.6717321", "0.6710159", "0.6699414", "0.6687402", "0.6654058", "0.6643046", "0.65910715", "0.658521", "0.6562141", "0.65581733", "0.65155", "0.651239...
0.0
-1
This test case checks negative scenario for the field value.
def test_props_fields_no_dash_not_empty( self, splunk_search_util, splunk_searchtime_fields_negative, record_property ): # Search Query record_property("stanza_name", splunk_searchtime_fields_negative["stanza"]) record_property("stanza_type", splunk_searchtime_fields_negative["stan...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_negative(self):\n self.assertFalse(validate_measure_input('-1', self.measures))", "def test_neg():\n value = -42\n num_a = param.Integer(value=value)\n assert -num_a.value == -value", "def test_negative_validation_decision(self, form_field_name, user_data):\n self.as...
[ "0.77282876", "0.74175817", "0.7015174", "0.701334", "0.6887958", "0.6836617", "0.67478794", "0.66586304", "0.6655187", "0.66419053", "0.66048115", "0.65991557", "0.655143", "0.6464886", "0.64405125", "0.6340747", "0.6301072", "0.6296137", "0.6294943", "0.6275951", "0.6270842...
0.0
-1
Test case to check tags mentioned in tags.conf This test case checks if a tag is assigned to the event if enabled, and also checks that a tag is not assigned to the event if disabled.
def test_tags( self, splunk_search_util, splunk_searchtime_fields_tags, record_property, caplog ): is_tag_enabled = splunk_searchtime_fields_tags.get("enabled", True) tag_query = splunk_searchtime_fields_tags["stanza"] tag = splunk_searchtime_fields_tags["tag"] self.logger.i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_tags(question):\n assert \"tags\" in question[\"instance\"]\n tags = set(question[\"instance\"][\"tags\"])\n # there should be at least one tag\n assert len(tags) >= 1\n # each tags should be in VALID_TAGS\n assert len(tags - VALID_TAGS) == 0\n # there should be exactly one category-d...
[ "0.65553594", "0.6546361", "0.62693006", "0.6008587", "0.59838474", "0.593703", "0.583689", "0.5791458", "0.5709085", "0.5685902", "0.56608677", "0.56162375", "0.56153977", "0.56052005", "0.5602202", "0.5592223", "0.5591245", "0.5573722", "0.5573409", "0.5533851", "0.55135083...
0.6480311
2
Tests if all eventtypes in eventtypes.conf are generated in Splunk.
def test_eventtype( self, splunk_search_util, splunk_searchtime_fields_eventtypes, record_property, caplog, ): record_property( "eventtype", splunk_searchtime_fields_eventtypes["stanza"] ) index_list = "(index=" + " OR index=".join(splunk_s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_be_registered(self, event_type):\n return (event_type in self._watchable_events or\n (event_type == self.ANY and self._allow_any))", "def can_be_registered(self, event_type):\n return True", "def test_query_events_by_type(self):\n events = list(query_events_by_type(E...
[ "0.6341547", "0.6339944", "0.61417574", "0.58374506", "0.57760566", "0.57760566", "0.57760566", "0.56579113", "0.5635613", "0.5614048", "0.557665", "0.55349207", "0.55108035", "0.5440711", "0.5404753", "0.540017", "0.5387301", "0.5341101", "0.53385955", "0.5323464", "0.531907...
0.5889365
3
Create CIFAR100 train/val/test data loaders
def get_train_val_test_datasets( rnd: np.random.RandomState, root='~/data', validation_ratio=0.05, ) -> tuple: transform = transforms.Compose( [ transforms.ToTensor() ] ) train_set = CIFAR100( root=root, train=True, download=True,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_dataloaders(params):\r\n transform_train = transforms.Compose([transforms.RandomCrop(32, padding=4),\r\n transforms.RandomHorizontalFlip(),\r\n transforms.ToTensor(),\r\n transform...
[ "0.7297965", "0.71935004", "0.7103292", "0.70913583", "0.6974186", "0.69686836", "0.6958308", "0.68643886", "0.6819047", "0.67896754", "0.6746235", "0.67130595", "0.67096114", "0.6674631", "0.6631123", "0.65942234", "0.6579366", "0.65782934", "0.65747774", "0.65689075", "0.65...
0.0
-1
Return minibatch shapes for contrastive algorithms. It is especially useful when you use batch norm.
def get_shape_for_contrastive_learning(mini_batch_size: int, block_size: int, neg_size: int, dim_h: int) -> tuple: batch2input_shape_pos = [mini_batch_size * block_size, 3, 32, 32] batch2input_shape_neg = [mini_batch_size * neg_size * block_size, 3, 32, 32] output2emb_shape_pos = [mini_batch_size, block_si...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_consistent_shape(images: Iterable):\n dim0s = []\n dim1s = []\n\n for img in images:\n dim0s.append(img.shape[0])\n dim1s.append(img.shape[1])\n\n assert len(set(dim0s)) == 1 and len(set(dim1s)) == 1, 'Inconsistent shapes.'\n\n return dim0s[0], dim1s[0]", "def input_shape(se...
[ "0.6113688", "0.59597874", "0.59597874", "0.59597874", "0.59297377", "0.5638191", "0.55854297", "0.55849034", "0.55610806", "0.5559144", "0.5558414", "0.5542325", "0.54853", "0.54853", "0.5475481", "0.545066", "0.54470015", "0.54394406", "0.5434174", "0.5428862", "0.5427932",...
0.5596443
6
Selects the action with the highest Qvalue with probability 1eps_threshold and a random action otherwise
def select_action(policy_net, state, eps, n_actions, device, steps_done): sample = random.random() if sample > eps: with torch.no_grad(): # t.max(1) will return largest column value of each row # second column on max result is index of where max element was # found, s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _select_action(self):\n if self.eval_mode:\n self._log_values()\n epsilon = self.epsilon_eval\n else:\n epsilon = self.epsilon_fn(\n self.epsilon_decay_period,\n self.training_steps,\n self.min_replay_history,\n self.epsilon_train)\n if random.random(...
[ "0.79709095", "0.78705657", "0.7817313", "0.7803791", "0.7803791", "0.76855636", "0.7661042", "0.759864", "0.7582084", "0.75690514", "0.75047153", "0.7487146", "0.7473155", "0.74240166", "0.74202406", "0.7387183", "0.7359474", "0.7358641", "0.73480034", "0.73178715", "0.72899...
0.74595815
13
Does one update of the optimizer for the policy_net
def optimize_model(memory, BATCH_SIZE, device, policy_net, Transition, n_actions, target_net, gamma, optimizer, double_q_learning=True, gradient_clipping=True, initial_replay_size=0): if len(memory) < BATCH_SIZE or len(memory) < initial_replay_size: return transiti...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_optimizer(self, context, optimizer, host):\n pass", "def update_policy(self):\n self.optimizer.step()\n self.optimizer.zero_grad()", "def defineUpdateOperations(self):\n self.updated_value = tf.placeholder(shape=[1, self.network.action_size], dtype=tf.float32)\n se...
[ "0.7567972", "0.7425979", "0.6807146", "0.6604179", "0.6524688", "0.6521089", "0.6455929", "0.64432573", "0.63913226", "0.63542", "0.632937", "0.6310982", "0.62825817", "0.6239003", "0.62361735", "0.62241197", "0.6202959", "0.6191064", "0.61622465", "0.61608213", "0.6155807",...
0.0
-1
Gets and sets the vppTokenId
def vpp_token_id(self): if "vppTokenId" in self._prop_dict: return self._prop_dict["vppTokenId"] else: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def token_id(self) -> Optional[pulumi.Input[int]]:\n return pulumi.get(self, \"token_id\")", "def get_token(self):\n auth_data = {\"auth\": {\"tenantName\": 'service',\n \"passwordCredentials\":{ \"username\": 'vsm',\n \"password\": self._password...
[ "0.61384207", "0.611807", "0.5994977", "0.5994693", "0.5693623", "0.55299115", "0.5475123", "0.5429745", "0.5429745", "0.5375773", "0.53675216", "0.5362576", "0.53347", "0.53136176", "0.53107935", "0.5303457", "0.5282872", "0.5282872", "0.5282872", "0.5258768", "0.5255631", ...
0.82442844
0
Gets and sets the appleId
def apple_id(self): if "appleId" in self._prop_dict: return self._prop_dict["appleId"] else: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apple_id(self, apple_id):\n\n self._apple_id = apple_id", "def appid(self):\n return self._item[\"appid\"]", "def ApplicationId(self) -> _n_0_t_0:", "def app_id(self):\n return self._app_id", "def app_id(self) -> str:\n return self._app_id", "async def slashtagset_appid(se...
[ "0.8069875", "0.59851646", "0.5909273", "0.5829789", "0.5814948", "0.5765417", "0.5722226", "0.5701442", "0.5638001", "0.562049", "0.5616317", "0.5522016", "0.55123824", "0.55114925", "0.54531074", "0.54511666", "0.5419831", "0.5416108", "0.54157305", "0.53459615", "0.5323140...
0.8489338
0
Gets and sets the vppOrganizationName
def vpp_organization_name(self): if "vppOrganizationName" in self._prop_dict: return self._prop_dict["vppOrganizationName"] else: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def organization_name(self):\n if self.organization is not None:\n return self.organization.name\n\n return ''", "def organization(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"organization\")", "def getOrganization(self):\n return _libsbml.ModelCreato...
[ "0.684137", "0.6185486", "0.61104095", "0.60688007", "0.6068101", "0.6055266", "0.59143037", "0.5851724", "0.5840031", "0.58396685", "0.58396685", "0.58298886", "0.5803846", "0.5779328", "0.5779328", "0.56808895", "0.56748295", "0.56549084", "0.5612998", "0.5557546", "0.54901...
0.83878106
0
Gets and sets the genres
def genres(self): if "genres" in self._prop_dict: return self._prop_dict["genres"] else: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_genres(self) -> List[Genre]:\n raise NotImplementedError", "def get_genre(self):\n self.genre = imdb.get_title_genres(self.ID)\n self._genre_printer()", "async def get_genres(self) -> APIReturn:\n return await self._request(\"GET\", \"/getGenres\")", "def recommendation_ge...
[ "0.73216236", "0.73034143", "0.73029256", "0.72081995", "0.6950199", "0.67357016", "0.67327183", "0.66221786", "0.66032404", "0.6553856", "0.64852357", "0.64766", "0.646072", "0.6298506", "0.6285007", "0.626418", "0.6256165", "0.62560207", "0.6246242", "0.62147844", "0.614064...
0.7478756
0
Gets and sets the language
def language(self): if "language" in self._prop_dict: return self._prop_dict["language"] else: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_language(self):\r\n return self.language", "def get_language(self):\n return self.lang", "def get_language(self):\n return self.language if self.language is not None else get_language()", "def language(self):\r\n return self._get('language', {})", "def get_language(self)...
[ "0.81069374", "0.8000656", "0.79582477", "0.7830918", "0.77831334", "0.77229893", "0.74865913", "0.74720967", "0.74720967", "0.74720967", "0.74720967", "0.7469725", "0.74637824", "0.7453111", "0.7450087", "0.736944", "0.73569506", "0.7350354", "0.7332747", "0.726062", "0.7256...
0.75225323
6
Gets and sets the seller
def seller(self): if "seller" in self._prop_dict: return self._prop_dict["seller"] else: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def seller(self, seller):\n\n self._seller = seller", "def get_contact_seller(self):\n return self.contact.seller", "def buyer(self, buyer):\n\n self._buyer = buyer", "def seller_from_user(context: Dict[str, Any]) -> Optional[Seller]:\n user: User = context[\"user\"]\n if user.is_a...
[ "0.8109366", "0.698005", "0.62128127", "0.6178388", "0.6039728", "0.6028439", "0.5871527", "0.57780135", "0.5721163", "0.56939894", "0.56875074", "0.5485203", "0.5411141", "0.53689885", "0.5301218", "0.5298088", "0.5297234", "0.52722865", "0.52558464", "0.5248467", "0.5244013...
0.83205086
0
Gets and sets the totalLicenseCount
def total_license_count(self): if "totalLicenseCount" in self._prop_dict: return self._prop_dict["totalLicenseCount"] else: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def used_license_count(self):\n if \"usedLicenseCount\" in self._prop_dict:\n return self._prop_dict[\"usedLicenseCount\"]\n else:\n return None", "def license_count(self) -> pulumi.Output[Optional[int]]:\n return pulumi.get(self, \"license_count\")", "def license_cou...
[ "0.75288534", "0.7378034", "0.7028874", "0.7028874", "0.6017668", "0.590693", "0.5812739", "0.5784844", "0.57754", "0.5763398", "0.57567894", "0.57275337", "0.56986785", "0.5680325", "0.5677107", "0.5677107", "0.5677107", "0.5677107", "0.5677107", "0.5677107", "0.5677107", ...
0.81494826
0
Gets and sets the usedLicenseCount
def used_license_count(self): if "usedLicenseCount" in self._prop_dict: return self._prop_dict["usedLicenseCount"] else: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def total_license_count(self):\n if \"totalLicenseCount\" in self._prop_dict:\n return self._prop_dict[\"totalLicenseCount\"]\n else:\n return None", "def license_count(self) -> pulumi.Output[Optional[int]]:\n return pulumi.get(self, \"license_count\")", "def license_...
[ "0.70619345", "0.6962623", "0.68865573", "0.68865573", "0.61004454", "0.60076684", "0.5775451", "0.56807685", "0.562454", "0.5619409", "0.56166327", "0.5587048", "0.5587048", "0.5530649", "0.5519855", "0.5512422", "0.5486493", "0.5413517", "0.5413517", "0.5386872", "0.5385942...
0.81816816
0
User's current state. Can be used to remember last step, build and parse callbacks.
def __new__(cls, name, build_pattern: str = None, parse_pattern: re.Pattern = None): obj = super().__new__(cls, name) if parse_pattern is not None: obj.parse_pattern = parse_pattern if build_pattern is not None: obj.build_pattern = build_pattern return obj
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def current_state():\n global current_state\n while current_state is None:\n pass\n return current_state", "def state_current(self, instance):\r\n return instance.user.profile.state_current", "def current_state(self):\n return self.obs_hook(self._current_obs)", "def ...
[ "0.6918716", "0.6859633", "0.68032247", "0.6791822", "0.6747422", "0.673759", "0.66993624", "0.6694381", "0.66105115", "0.655849", "0.6546558", "0.6440812", "0.64252305", "0.63976043", "0.63891476", "0.62961525", "0.62944114", "0.62815493", "0.62815493", "0.62815493", "0.6281...
0.0
-1
Creates/updates a Review object
def api_review(review_id=None): from models.review import Review # Retrieve an object if request.method == 'GET': if review_id is not None: obj = storage.get(Review, review_id) if obj is None: abort(404) else: return jsonify(obj.to...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def put_review(review_id):\n ignored_data = [\"id\", \"created_at\", \"updated_at\", \"user_id\", \"place_id\"]\n return put(cls, review_id, ignored_data)", "def put_review(review_id=None):\n\n review = storage.get(Review, review_id)\n if not review:\n abort(404)\n data = request.get_json()...
[ "0.7153411", "0.6968481", "0.6635294", "0.6537341", "0.65146786", "0.6502004", "0.6494259", "0.64685404", "0.6442921", "0.64043444", "0.64022094", "0.630013", "0.6273182", "0.62641233", "0.62522465", "0.6238617", "0.6231669", "0.62089", "0.62036234", "0.62017196", "0.6173334"...
0.6188052
20
Plot the new state of the system
def plotSate(s,i,seed): fig, ax = plt.subplots() im = ax.imshow(s) plt.xticks([i for i in range(dim)], "") plt.yticks([i for i in range(dim)], "") fig.tight_layout() plt.savefig("Systems/" + str(dim) + "_" + str(seed) + "/Images/" + str(i) + ".jpeg",quality=80,optimi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot(self) -> None:\n if self.__fig is None:\n self.__fig = plt.figure()\n\n xv = []\n yv = []\n for x in np.arange(self.state_min(), self.state_max(), self.state_step()):\n xv.append(x)\n yv.append(self.reward(x))\n ax = self.__fig.gca()\n ...
[ "0.7050977", "0.70377105", "0.6921945", "0.6876264", "0.68268037", "0.6729921", "0.66884774", "0.6483927", "0.6483927", "0.6483927", "0.6483927", "0.6483927", "0.64827865", "0.64666325", "0.6431012", "0.64294916", "0.63720846", "0.6361515", "0.63082445", "0.6291267", "0.62908...
0.0
-1
Density of gas assuming ideal gas law in kg/m^3.
def density(self): return (1e-3*self.molar_mass) * self.pressure / (gas_constant * self.temperature) # kg/m^3
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fGasDensity(GasGravity, Temperature, Pressure):\n\tGasConstant = 8.314\n\tPress = Pressure / 145.038 # MPa\n\tTemp = Temperature + 273.16 # Deg K\n\tPr = Press / (4.892 - (0.4048 * GasGravity))\n\tTr = Temp / (94.72 + (170.75 * GasGravity))\n\tA = 0.03 + 0.00527 * ((3.5 - Tr)**3)\n\tB = (0.642 * Tr) - (0.007 *...
[ "0.74058163", "0.7005451", "0.68938565", "0.6806513", "0.6706316", "0.6634284", "0.6574425", "0.65566623", "0.651678", "0.6436798", "0.63436514", "0.633899", "0.6326834", "0.6320278", "0.63081455", "0.6297625", "0.62733966", "0.62247926", "0.6177332", "0.61762756", "0.6155900...
0.81784177
0
Vapour pressure in Pascals.
def vapour_pressure(self): return self.relative_humidity * self.solvent.equilibrium_vapour_pressure(self.temperature)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def PPV(self):\n return _div(self.TP, self.TP + self.FP)", "def vaporPressure(temp: float) -> float:\n exponent = (17.27*temp)/(temp + 237.3)\n vp = 611*np.exp(exponent)\n\n return vp", "def VaporPressure(dwpt):\n\n return 611.2*exp(17.67*dwpt/(243.5+dwpt))", "def volt_to_pressure(volt):\n...
[ "0.7080288", "0.69284487", "0.68418944", "0.6743915", "0.66257185", "0.6582194", "0.6576109", "0.6573769", "0.6532861", "0.65210193", "0.65180355", "0.64524937", "0.64445084", "0.63541234", "0.6329281", "0.6282231", "0.62752527", "0.62735087", "0.62735087", "0.62735087", "0.6...
0.80786455
0
Calculate mean free path via hard sphere approximation.
def mean_free_path(self): return self.dynamic_viscosity / self.density * np.sqrt(np.pi * 1e-3*self.molar_mass / (2*gas_constant * self.temperature))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sphere_sre(solution):\n a = 0\n bias = 0.2\n x = solution.get_x()\n x1 = x[:10]\n x2 = x[10:]\n value1 = sum([(i-bias)*(i-bias) for i in x1])\n value2 = 1/len(x) * sum([(i-bias)*(i-bias) for i in x2])\n return value1 + value2", "def mean_free_path(self, n, T):\n lambda_0 = 1 / ...
[ "0.6078268", "0.6036835", "0.5775312", "0.57285535", "0.57063246", "0.56906533", "0.5667456", "0.5667456", "0.5620325", "0.5604258", "0.552257", "0.5496041", "0.5470228", "0.54219", "0.54151326", "0.54068613", "0.5400745", "0.5382959", "0.53717446", "0.5362374", "0.5358026", ...
0.73044544
0
Set up conditions for Earth's atmosphere.
def Atmosphere(temperature, relative_humidity=0, pressure=standard_atmospheric_pressure, velocity=np.zeros(3)): vapour_pressure_water = relative_humidity * Water.equilibrium_vapour_pressure(temperature) mole_fraction_water = vapour_pressure_water / pressure molar...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_atmospheric_state(self, atmosphere, t_surface):\n atm_fields_compact = atmosphere.to_atm_fields_compact()\n\n # Scale dry air VMRs with water content\n vmr_h2o = atm_fields_compact.get(\"abs_species-H2O\")\n total_vmr = vmr_h2o[0]\n for species in atm_fields_compact.grids...
[ "0.6065568", "0.5984571", "0.59448445", "0.5943248", "0.59086376", "0.58542204", "0.57257646", "0.57075846", "0.5674026", "0.56102806", "0.54650813", "0.53581786", "0.5350245", "0.5348858", "0.5346381", "0.53435713", "0.5343278", "0.5335969", "0.5316473", "0.525487", "0.52013...
0.5434043
11
RescaledRange Subclass of Prefect Task Class.
def __init__(self): super().__init__() self.data = None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rescale(self, xmin, xmax):\n\n # Normalise\n self.normalise()\n\n \n # Rescale\n range = xmax-xmin\n for seg in self.segments:\n seg.lower_bound = seg.lower_bound*range + xmin\n seg.upper_bound = seg.upper_bound*range + xmin", "def clip(self, *a...
[ "0.54382", "0.534953", "0.5344448", "0.5320466", "0.53059083", "0.5240817", "0.5216645", "0.5215252", "0.52043605", "0.51910514", "0.5168013", "0.5165983", "0.5154208", "0.51533276", "0.5143823", "0.5138442", "0.5101876", "0.5092483", "0.5088871", "0.5082565", "0.5073314", ...
0.0
-1
Handler for 404 errors.
def handler404(request): response = render_to_response('404.html', {}, RequestContext(request)) response.status_code = 404 return response
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handleStatus_404(self):\n log.err('HTTP Error 404')", "def handler404(request):\n response = render_to_response('404.html', {})\n response.status_code = 404 # Other errors can be similarly configured\n return response", "def handle_404(request):\n return handle_error(request, django.htt...
[ "0.8526426", "0.7946644", "0.7945557", "0.7903338", "0.7813557", "0.7758015", "0.7735152", "0.7727628", "0.771213", "0.7692894", "0.75920653", "0.7517226", "0.75166225", "0.75061744", "0.7470424", "0.7457936", "0.7394755", "0.7394755", "0.7394755", "0.7394755", "0.7394755", ...
0.76601875
10
Handler for 500 errors.
def handler500(request): response = render_to_response('500.html', {}, RequestContext(request)) response.status_code = 500 return response
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handler500(request):\n \n #Setting the variable and template page for the 500 error\n response = render_to_response('500.html', {}, context_instance=RequestContext(request))\n response.status_code = 500\n return response", "def handler500(request, *args, **argv):\n response = render_to_resp...
[ "0.82592165", "0.82579106", "0.7647247", "0.7604049", "0.75217336", "0.7434948", "0.73925203", "0.7364613", "0.73038787", "0.7235353", "0.7229959", "0.7197154", "0.717115", "0.71682864", "0.71582335", "0.7123201", "0.7115274", "0.7104952", "0.70137286", "0.6970803", "0.697080...
0.82960117
0
Join all party as party key
def all_party_key(all_party): if not all_party: all_party_key = 'all' elif isinstance(all_party, dict): sorted_role_name = sorted(all_party.keys()) all_party_key = gen_key_string_separator.join([ ('%s-%s' % ( role_name, '_'.join([str(p) for p i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def combine_election_public_keys(\n election_public_keys: DataStore[GUARDIAN_ID, ElectionPublicKey]\n) -> ElectionJointKey:\n public_keys = map(lambda public_key: public_key.key, election_public_keys.values())\n\n return elgamal_combine_public_keys(public_keys)", "def party_id(self):\n pass", "...
[ "0.5744274", "0.5568393", "0.54927176", "0.52470684", "0.5210263", "0.5195514", "0.5135702", "0.51080775", "0.5093896", "0.50771976", "0.50136244", "0.50063086", "0.499069", "0.4975437", "0.49622023", "0.49614578", "0.49185023", "0.49098763", "0.48865524", "0.48730585", "0.48...
0.63631517
0
Generator for [n] number of names of lines.
def _get_names(n): from itertools import product def f(): m = 1 while True: it = product(*tuple([string.ascii_uppercase]*m)) for c in it: yield ''.join(c) m += 1 for _, c in zip(range(n), f()): yield c
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_words(self,N):\n for i in xrange(N):\n prefix = \" \" * self.chainlen\n name = \"\"\n suffix = \"\"\n while True:\n suffix = self.get_suffix(prefix)\n if suffix == \"\\n\" or len(name) > 9:\n break\n ...
[ "0.6696066", "0.6580343", "0.6550729", "0.6342123", "0.6274895", "0.6262439", "0.5949424", "0.58654", "0.58533746", "0.58261436", "0.57652855", "0.5749398", "0.5741963", "0.5740459", "0.5722183", "0.5720189", "0.57149017", "0.5682527", "0.5658359", "0.56177384", "0.5612223", ...
0.65257424
3
Generate [n] random lines, and initialize internal structures.
def __init__(self, lines, names): # from graphing import Graph self.lines = lines self.remaining_events = [] leftmost = _MAX_RIGHT for i, (name, left, right) in enumerate(self.lines): self.lines[i] = (name, left-leftmost, right-leftmost) for i, (name, lef...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def random(self, n=1):\n # self.num_generated += n", "def generate_synth_data(n):", "def _make_io_examples(self, n):\n rand = random.Random(6849275409234) # Test cases are fixed, but varied.\n io_examples = [\n ([4, 0], [4, 0]),\n ([0, 5], [5, 0]),\n ([1, 2], [3, 0]),\n ...
[ "0.70913213", "0.6437352", "0.63017213", "0.6262578", "0.6255006", "0.6248576", "0.6231163", "0.61695033", "0.61533153", "0.6150361", "0.6143328", "0.6143328", "0.61114734", "0.6106545", "0.61052126", "0.6093884", "0.60880303", "0.60650104", "0.60589135", "0.60510826", "0.605...
0.0
-1
Generate next image, or if done, generate pdf.
def next(self): if self.is_done: return self.idx += 1 if self.sweep_line is not None: self.remaining_events = self.remaining_events[1:] if len(self.remaining_events) == 0: # End of everything if self.sweep_line is None: self.is_done...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate(self, filename):\n time_0 = time.time()\n self._per_pdf(filename)\n time_1 = time.time()\n time_total = time_1 - time_0\n time_per_image = time_total / (self.beads_num * self.images_num)\n time_min = time_total / 60\n time_sec = time_total % 60\n ...
[ "0.6618433", "0.63336223", "0.62817127", "0.6245009", "0.6133024", "0.60717624", "0.60625297", "0.5926207", "0.58587873", "0.58525664", "0.584871", "0.58015543", "0.5758933", "0.57559025", "0.5751829", "0.5703416", "0.5676019", "0.5664894", "0.563774", "0.56377035", "0.563019...
0.0
-1
When sources override `get_database_names`, they will need to setup multiple inspectors. They can use this function.
def set_inspector(self, database_name: str) -> None: logger.info(f"Ingesting from database: {database_name}") new_service_connection = deepcopy(self.service_connection) new_service_connection.database = database_name self.engine = get_connection(new_service_connection) self.insp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_database_names(self) -> Iterable[str]:\n custom_database_name = self.service_connection.__dict__.get(\"databaseName\")\n\n database_name = self.service_connection.__dict__.get(\n \"database\", custom_database_name or \"default\"\n )\n # By default, set the inspector o...
[ "0.7197303", "0.6543269", "0.6351389", "0.61743826", "0.58797634", "0.5850529", "0.5847243", "0.58301836", "0.5747333", "0.5737547", "0.5716585", "0.5708333", "0.56262535", "0.5581609", "0.5548496", "0.5545168", "0.5539052", "0.5539052", "0.5537416", "0.5527633", "0.5509341",...
0.53393203
33
Default case with a single database. It might come informed or not from the source. Sources with multiple databases should overwrite this and apply the necessary filters.
def get_database_names(self) -> Iterable[str]: custom_database_name = self.service_connection.__dict__.get("databaseName") database_name = self.service_connection.__dict__.get( "database", custom_database_name or "default" ) # By default, set the inspector on the created eng...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def db_for_read(self, model, **hints):\n if model._meta.app_label == 'delivery':\n return 'db1'\n return None", "def get_default_database(self):\n attr_name = mangle_delegate_name(self.__class__, '__default_database_name')\n default_db_name = getattr(self.delegate, attr_nam...
[ "0.6282125", "0.6158884", "0.6089975", "0.59566677", "0.5930733", "0.591902", "0.59030586", "0.57954264", "0.57474667", "0.5674948", "0.5663659", "0.56381756", "0.5626141", "0.5607359", "0.5583429", "0.5558164", "0.5541641", "0.5541641", "0.5531401", "0.54835534", "0.5477847"...
0.0
-1
From topology. Prepare a database request and pass it to the sink
def yield_database(self, database_name: str) -> Iterable[CreateDatabaseRequest]: yield CreateDatabaseRequest( name=database_name, service=EntityReference( id=self.context.database_service.id, type="databaseService", ), )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def before_request():\n\tg.db = sql.connect(host=cfg.dbhost, port=cfg.dbport, user=cfg.user,\\\n\t\tpasswd=cfg.password, db=cfg.database,\\\n\t\tcharset=cfg.charset)", "def __init__(self, dbname, host, writeport):\n self.dbname = dbname\n self.host = host\n self.writeport = writeport\n ...
[ "0.57374924", "0.5632629", "0.5480132", "0.54712677", "0.5464478", "0.54219073", "0.54219073", "0.54219073", "0.54219073", "0.53944474", "0.5393474", "0.5370461", "0.53525424", "0.5305423", "0.5280601", "0.5280414", "0.52712566", "0.5233362", "0.5216953", "0.5216711", "0.5201...
0.0
-1
From topology. Prepare a database schema request and pass it to the sink
def yield_database_schema( self, schema_name: str ) -> Iterable[CreateDatabaseSchemaRequest]: yield CreateDatabaseSchemaRequest( name=schema_name, database=EntityReference(id=self.context.database.id, type="database"), )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_schema(command, conf, vars):", "def __init__(self, schema ):\n self.schema = schema", "def _prepare_schema(self):\n schema = DaskSchema(self.schema_name)\n\n if not self.tables:\n logger.warning(\"No tables are registered.\")\n\n for name, dc in self.tables.ite...
[ "0.6031849", "0.60288286", "0.56962603", "0.5674572", "0.565673", "0.5652133", "0.563791", "0.56235284", "0.5571399", "0.55672354", "0.5506195", "0.54994935", "0.5494928", "0.5465217", "0.5447709", "0.5426592", "0.54234093", "0.53967094", "0.53693163", "0.5365079", "0.5357538...
0.54011047
17
Connect to the source database to get the table name and type. By default, use the inspector method to get the names and pass the Regular type. This is useful for sources where we need finegrained logic on how to handle table types, e.g., external, foreign,...
def query_table_names_and_types( self, schema_name: str ) -> Iterable[TableNameAndType]: return [ TableNameAndType(name=table_name) for table_name in self.inspector.get_table_names(schema_name) or [] ]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_tabletype(cls) -> str:\n raise NotImplementedError", "def get_tables_name_and_type(self) -> Optional[Iterable[Tuple[str, str]]]:\n try:\n schema_name = self.context.database_schema.name.__root__\n if self.source_config.includeTables:\n for table_and_typ...
[ "0.63558096", "0.6177287", "0.58582294", "0.57778627", "0.5763742", "0.57581013", "0.57396495", "0.5699226", "0.5658652", "0.5625839", "0.5606744", "0.5599866", "0.55963886", "0.5581121", "0.55795485", "0.5569123", "0.55615866", "0.5508438", "0.55081236", "0.5479944", "0.5467...
0.5021961
87
Handle table and views. Fetches them up using the context information and the inspector set when preparing the db.
def get_tables_name_and_type(self) -> Optional[Iterable[Tuple[str, str]]]: try: schema_name = self.context.database_schema.name.__root__ if self.source_config.includeTables: for table_and_type in self.query_table_names_and_types(schema_name): table_nam...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_context_data(self, **kwargs):\r\n context = super(SingleTableMixin, self).get_context_data(**kwargs)\r\n table = self.get_table()\r\n context[self.get_context_table_name(table)] = table\r\n return context", "def execute(self, context):\n\n # Initialize PostgreSQL hook\n...
[ "0.5740603", "0.5701369", "0.55218136", "0.5455442", "0.54200023", "0.54088736", "0.5407114", "0.53050184", "0.5299238", "0.5283333", "0.5257961", "0.52211183", "0.52096987", "0.5201612", "0.5185067", "0.5168369", "0.5159047", "0.51454693", "0.51377684", "0.5123308", "0.51186...
0.4954838
33
check if the table is partitioned table and return the partition details
def get_table_partition_details( # pylint: disable=unused-argument self, table_name: str, schema_name: str, inspector: Inspector, ) -> Tuple[bool, Optional[TablePartition]]: return False, None # By default the table will be a Regular Table
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _is_partitioned(self):\n ## check if the table are partitioned, need the split because of a change in the type of partitions in pydantic\n partitions = self.table_config[\"partitions\"]\n if partitions is None or len(partitions) == 0:\n return False\n\n if isinstance(part...
[ "0.72047216", "0.690783", "0.6624961", "0.657136", "0.64423627", "0.6396148", "0.62411654", "0.624026", "0.61577463", "0.606659", "0.606659", "0.6044867", "0.6042913", "0.60408926", "0.6003339", "0.5997353", "0.5991223", "0.5967711", "0.5941188", "0.59136415", "0.5886885", ...
0.7471435
0
From topology. Prepare a table request and pass it to the sink
def yield_table( self, table_name_and_type: Tuple[str, str] ) -> Iterable[Optional[CreateTableRequest]]: table_name, table_type = table_name_and_type schema_name = self.context.database_schema.name.__root__ db_name = self.context.database.name.__root__ try: colum...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main(event, context):\n # pylint: enable=unused-argument\n data = decode(event[\"data\"])\n to_table([data], PROJECT, DATASET, TABLE)", "def _create_input_data(self):\n SCHEMA = parse_table_schema_from_json(\n '{\"fields\": [{\"name\": \"data\", \"type\": \"BYTES\"}]}')\n\n def format_r...
[ "0.5877059", "0.54798776", "0.53474665", "0.53415745", "0.53346676", "0.5334067", "0.5324117", "0.53053784", "0.5297837", "0.5297153", "0.52415204", "0.521387", "0.52090687", "0.51502633", "0.5119904", "0.51124084", "0.5107619", "0.5088214", "0.5088214", "0.50813437", "0.5080...
0.5579226
1
Used a timedbound function to test that the engine can properly reach the source
def test_connection(self) -> None: test_connection_fn = get_test_connection_fn(self.service_connection) test_connection_fn(self.engine)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_check_source_3(self):\n self.eval_flags[\"check_host_typo\"] = False\n import_genome.check_source(self.src1, self.eval_flags,\n host_genus=\"Mycobacterium\")\n self.assertEqual(len(self.src1.evaluations), 1)", "def test_check_source_9(self):\n ...
[ "0.6038599", "0.5966835", "0.58349615", "0.58176917", "0.57997555", "0.57887405", "0.5772166", "0.57598495", "0.5749875", "0.5705047", "0.5690391", "0.5682786", "0.5672137", "0.5664311", "0.56611896", "0.5638981", "0.5601413", "0.55772096", "0.5541266", "0.5538311", "0.549180...
0.0
-1
Return the SQLAlchemy connection
def connection(self) -> Connection: if not self._connection: self._connection = self.engine.connect() return self._connection
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_connection(cls):\n return cls.database.connection", "def get_connection():\n\t# flask.g documentation: http://flask.pocoo.org/docs/0.12/api/#flask.g\n\ttry:\n\t\tconn = flask.g._database_connection\n\texcept AttributeError:\n\t\tconn = flask.g._database_connection = sqlite3.connect(config.PATH_DA...
[ "0.81346554", "0.79718655", "0.79294276", "0.7832428", "0.77796745", "0.7633522", "0.7544016", "0.7544016", "0.7544016", "0.7544016", "0.7541601", "0.7495849", "0.74864846", "0.74438053", "0.7435526", "0.74306893", "0.74256927", "0.7408647", "0.74068403", "0.738495", "0.73501...
0.7378869
20
Method to fetch tags associated with table
def fetch_table_tags( self, table_name: str, schema_name: str, inspector: Inspector, ) -> None:
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_id_and_tags(self):\n return self.database.select(self.tname,\n [self.primary_key, 'tags'])", "def get_tags(self) -> List:\n LOGGER.info('Get all the tags')\n\n with self.client.create_session() as session:\n tag_count = (func.count(RD...
[ "0.6922398", "0.66747177", "0.65673965", "0.65502906", "0.65502906", "0.64735454", "0.6464283", "0.6420494", "0.64154035", "0.64154035", "0.6354844", "0.62586063", "0.6207295", "0.62069833", "0.6197782", "0.61720955", "0.6168536", "0.6159042", "0.61435735", "0.6085799", "0.60...
0.72872764
0
This method is interesting to be maintained in case some connector, such as BigQuery, needs to perform some added logic here. Returning `table` is just the default implementation.
def standardize_table_name(self, schema_name: str, table: str) -> str: return table
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_table(self):\n\t\treturn self._table", "def getTable(self):\n\n raise NotImplementedError", "def _get_table(self, cursor):\n raise NotImplementedError", "def __getTable(self):\n\n if not self.__table:\n tableConnectionParams = parseConnectionString(\n s...
[ "0.7520106", "0.7386781", "0.72861874", "0.7049766", "0.70220125", "0.69553965", "0.69106346", "0.6874991", "0.68543154", "0.6838191", "0.68266505", "0.67859554", "0.67699444", "0.671571", "0.67097473", "0.67097473", "0.6674049", "0.66547084", "0.66416943", "0.6624039", "0.66...
0.0
-1
calcule la puissance de x ^ n
def puissance(x: float, n: int) -> float: resultat: float = 1 signe: int = 1 if n != 0: if n <= 0: n = -n signe = -1 for cpt in range(1, n + 1): resultat = resultat * x if signe < 0: resultat = 1 / resultat return resultat
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pseudo(x,N) :\n\treturn (x**2+1)%N", "def power(x, n):\n power = 1\n for i in range(abs(n)):\n power = multiply(power, x) \n return power", "def __pow__(self,n):\r\n\t\t\r\n\t\t# take power\r\n\t\tp = self.power(n)\r\n\t\t\r\n\t\treturn p", "def power(x, n):\n value = 1\n for i in ...
[ "0.76149625", "0.73387146", "0.7324877", "0.7267193", "0.72311145", "0.71934336", "0.7170515", "0.707581", "0.69598484", "0.69359", "0.69332993", "0.6889131", "0.6868321", "0.68481904", "0.6832225", "0.6832225", "0.6831433", "0.6818101", "0.67940444", "0.67862517", "0.6785801...
0.71249187
7
Create an invalid base log entry for stepbystep creation.
def create_base_entry(vin="INVALID", time_unix=None): return LogEntry(vin=vin, app_id="INVALID", time_unix=time_unix)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_step(self, step):\n raise NotImplementedError", "def createBaseLine(arguments): \n projectSource, projectName = \"\", \"\"\n projectSource, projectName = checkOS(arguments)\n testTempFile = tempfile.TemporaryFile()\n outputFile_name = \"RUN_\" + projectName + \"-planner_g_rt.\" + projectName +...
[ "0.6236393", "0.55243593", "0.54124093", "0.5270877", "0.518995", "0.5183555", "0.5180253", "0.5169412", "0.5137834", "0.5133438", "0.51106143", "0.51106143", "0.5109858", "0.5108779", "0.5071119", "0.50596637", "0.5050473", "0.5044926", "0.50438124", "0.5026648", "0.50259256...
0.60312283
1
Complete this entry from an invalid base entry to a full log entry.
def complete(self, app_id, vin=None, time_unix=None, level=None, log_message=None, gps_position=None, log_id=None, intrusion=None): self.set_any(vin=vin, app_id=app_id, level=level, log_message=log_message, gps_position=gps_position, time_unix=time_unix, log_id=log_id, intrusion=intrusion)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handleAppendEntry(self, leader_id, leader_term, leader_prev_log_idx,\n leader_prev_log_term, entries, leader_commit_idx):\n _, my_prev_log_idx = self.getLatest()\n if self.current_term > leader_term:\n success = False\n else:\n self.current_te...
[ "0.51296234", "0.512334", "0.504368", "0.5036465", "0.48848653", "0.48239094", "0.47969007", "0.47061825", "0.46668997", "0.46590635", "0.45995188", "0.4596216", "0.45927078", "0.45789924", "0.45734036", "0.45707417", "0.45549586", "0.45530573", "0.45396262", "0.45332724", "0...
0.47549245
7
Setter for all fields at once
def set_any(self, vin=None, app_id=None, level=None, log_message=None, gps_position=None, time_unix=None, log_id=None, intrusion=None): self._set_if_not_none(LogEntry.VIN_FIELD, vin) self._set_if_not_none(LogEntry.APP_ID_FIELD, app_id) self._set_if_not_none(LogEntry.LEVEL_FIELD, level) self._set_if_not_n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _update_all_fields(self, name, value):\n for field in self._field_map.values():\n setattr(field, name, value)", "def setValue(self,val):\n for f,v in zip(self.fields,val):\n f.setValue(v)", "def set(self, **kwargs):\n field_names = self.get_field_names()\n ...
[ "0.7270721", "0.7230778", "0.7123487", "0.7027001", "0.7004821", "0.69436187", "0.6810718", "0.6810718", "0.6810718", "0.6810718", "0.6810718", "0.6810718", "0.6793038", "0.6764726", "0.6744737", "0.66250837", "0.6608694", "0.6586342", "0.6529556", "0.65196884", "0.64807785",...
0.0
-1
Create a log string from this item's log data, sorted by key.
def get_log_string(self): result = json.dumps(self.data, sort_keys=True) if self.intrusion is not None and self.intrusion != "": result += ",{}".format(self.intrusion) return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log(data):\n items = []\n for key, value in data.items():\n if value is None:\n items.append('[{}]'.format(key))\n else:\n items.append('[{} {}]'.format(key, value))\n print(' '.join(items))", "def _format_entries(self):\n\n def form...
[ "0.596858", "0.5945771", "0.5798388", "0.57700557", "0.54572475", "0.54416263", "0.5441615", "0.54370725", "0.5413551", "0.52532613", "0.5185452", "0.517661", "0.5171567", "0.5147455", "0.51468164", "0.5139392", "0.51186264", "0.5117158", "0.5103329", "0.5091452", "0.5071409"...
0.5780433
3
Create a LogEntry from the log string produced by get_log_string().
def from_log_string(log_string): first_part = None second_part = None if not log_string.endswith("}"): # Value error for later use value_error = ValueError("Given string has invalid format: {}".format(log_string)) bracket_idx = log_string.find("}") last_comma_idx = log_string.find(",", bracket_idx)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_log_line(cls, log_line: str):\n match = cls.entry_format.match(log_line)\n if not match:\n return None\n\n date = match.group(\"date\")\n time = match.group(\"time\")\n offset = match.group(\"offset\")\n\n entry = cls(\n ip_address=match.grou...
[ "0.8345061", "0.68320376", "0.67686236", "0.6422642", "0.6405456", "0.62253773", "0.6163121", "0.601324", "0.6002534", "0.59997934", "0.5892316", "0.5799083", "0.5459042", "0.54550475", "0.54225075", "0.5376155", "0.53600734", "0.533564", "0.5331905", "0.5318096", "0.5290036"...
0.7880306
1
Create a LogEntry from the given dictionary.
def from_data(data_dict, intrusion=None): # Data is verified in the ctor and setters return LogEntry(vin=data_dict[LogEntry.VIN_FIELD], app_id=data_dict[LogEntry.APP_ID_FIELD], level=data_dict[LogEntry.LEVEL_FIELD], log_message=data_dict[LogEntry.LOG_MESSAGE_FIELD], gps_position=data_dict[LogEntry.GPS_POSITI...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_dict(self, dict_entry, line_length=80):\r\n try:\r\n # Set the entry object's attributes to the corresponding\r\n # values in the dictionary entry. Type conversions need to\r\n # be done for non-string attributes.\r\n for key in dict_entry:\r\n ...
[ "0.6882139", "0.68295366", "0.6646199", "0.6632009", "0.634357", "0.6288146", "0.6288146", "0.62512225", "0.6236364", "0.6207709", "0.61589706", "0.6122494", "0.5947414", "0.59346", "0.5900016", "0.5896469", "0.58897763", "0.58897763", "0.58897763", "0.58897763", "0.58897763"...
0.7672826
0
Valuecopy the given LogEntry object.
def copy(log_entry): assert(isinstance(log_entry, LogEntry)) return LogEntry.from_data(log_entry.data, log_entry.intrusion)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __copy__(self):\n return type(self)(self.value)", "def copy(self):\n return type(self)(self._val, lsd=self._lsd)", "def copy(self, source_valueid, dest_valueid):\n raise NotImplementedError(\"abstract\")", "def copy_entry(self, row, col):\n if self.results and self.settings['a...
[ "0.58514726", "0.57540035", "0.56757045", "0.5513019", "0.544298", "0.5388371", "0.5373151", "0.53523105", "0.53194475", "0.53194475", "0.53194475", "0.53140247", "0.52943194", "0.52818", "0.52673143", "0.5245059", "0.52405113", "0.52405113", "0.52405113", "0.5237511", "0.521...
0.75690794
0
Set the field with the given key to the value specified if that is not None.\n
def _set_if_not_none(self, field_key, value, verifier=str): if value is None: return if verifier is not None: value = verifier(value) self.data[field_key] = value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setnoempty(self, key, value):\r\n if value:\r\n self[key] = value", "def set(self, key, value):\n if key in self.fields:\n return self.fields.get(key).set(value)\n else:\n self.fields[key] = CustomField(default=value)\n return True", "def set...
[ "0.7059926", "0.6968242", "0.66217285", "0.66039425", "0.6589556", "0.65186286", "0.649909", "0.649909", "0.6493354", "0.63856846", "0.6376981", "0.6247511", "0.619377", "0.61290056", "0.6116902", "0.6098176", "0.60701644", "0.6058743", "0.6058516", "0.6049325", "0.6034123", ...
0.7619028
0
Return the given time or the current time if it's None.
def _get_current_time_if_none(given_time): return given_time or time.time()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_time(self, _time: Optional[float] = None) -> float:\n if _time is None:\n return time.time()\n\n return _time", "def get_time():\n return datetime.datetime.now()", "def time(self) -> Optional[str]:\n return pulumi.get(self, \"time\")", "def time(self) -> Optional[s...
[ "0.80231345", "0.7069105", "0.6942688", "0.6942688", "0.6942688", "0.6942688", "0.6942688", "0.6942688", "0.6916243", "0.68154377", "0.66877276", "0.66112775", "0.6595094", "0.655087", "0.65502095", "0.6544651", "0.65381604", "0.6524668", "0.64543414", "0.6442125", "0.6438368...
0.85907197
0
Return the given UUID or generate one if it's None.
def _generate_uuid_str_if_none(given_uuid): return given_uuid or uuid.uuid4().__str__()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_uuid():\n return str(uuid.uuid4())", "def generate_uuid():\n return uuid.uuid4()", "def _generate_uuid():\n return str(uuid.uuid4())", "def generate_uuid():\n return f'{uuid.uuid1()}'", "def get_uuid():\n\n x = uuid.uuid1()\n return str(x)", "def generate_uuid():\n return uu...
[ "0.7421662", "0.7368809", "0.73120177", "0.72946113", "0.7287514", "0.72534025", "0.7210841", "0.7191255", "0.7175415", "0.71420234", "0.70950955", "0.70928544", "0.70928544", "0.7074644", "0.6998014", "0.6964532", "0.69394946", "0.6919046", "0.6864828", "0.6823264", "0.67820...
0.79678607
0
Convert the given time to int.
def _verify_time(given_time): return int(given_time)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def time_to_int(time):\n minutes = time.hour * 60 + time.minute\n seconds = minutes * 60 + time.second\n return seconds", "def time_to_int(self):\n minutes = self.hour * 60 + self.minute\n seconds = minutes * 60 + self.second\n return seconds", "def time_to_int(str_time):\n dt ...
[ "0.8105064", "0.7688117", "0.74488795", "0.7387409", "0.7036349", "0.6889854", "0.67945206", "0.6776978", "0.6736359", "0.6525225", "0.64746207", "0.6470068", "0.64368486", "0.6410069", "0.61911714", "0.61693335", "0.6147289", "0.61194974", "0.6039064", "0.6005749", "0.594594...
0.6239351
14
Convert the given object to a UUID string if it's not yet one.
def _verify_uuid(given_uuid): if isinstance(given_uuid, str) or isinstance(given_uuid, unicode): # Verify the given string is well-formed uuid.UUID(given_uuid) return given_uuid if isinstance(given_uuid, uuid.UUID): return given_uuid.__str__() raise ValueError("Given object is neither a string nor ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def uuid(self, obj: typing.Any = None) -> str:\n if obj is None:\n obj = self.randomString()\n self._counter += 1\n elif isinstance(obj, bytes):\n obj = obj.decode('utf8') # To binary\n else:\n obj = '{}'.format(obj)\n\n return str(uuid.uuid5...
[ "0.814474", "0.77772284", "0.77772284", "0.7146047", "0.69617623", "0.6821387", "0.68103266", "0.6805069", "0.6775859", "0.67503506", "0.66954255", "0.65914947", "0.65580595", "0.6542236", "0.6490117", "0.6463487", "0.64372617", "0.6394203", "0.63477486", "0.63292855", "0.632...
0.6219394
25
read 4 chars to buf
def read4(buf): return 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read(self, buf, n):\n l = min(len(self.prev), n)\n buf[:l] = self.prev[:l]\n self.prev = self.prev[l:] # pitfall self.prev = []\n\n idx = l # the next reading\n while idx < n:\n buf4 = [\"\" for _ in xrange(4)]\n r = read4(buf4)\n if idx+r <...
[ "0.59958696", "0.59186286", "0.59186286", "0.5890578", "0.5830287", "0.58239377", "0.57918686", "0.5736559", "0.57338023", "0.5728563", "0.5623694", "0.5568525", "0.55537534", "0.55537534", "0.5420426", "0.54010665", "0.53901047", "0.5340353", "0.532755", "0.5276123", "0.5266...
0.81999147
0
read n chars to buf, called multiple times
def read(self, buf, n): l = min(len(self.prev), n) buf[:l] = self.prev[:l] self.prev = self.prev[l:] # pitfall self.prev = [] idx = l # the next reading while idx < n: buf4 = ["" for _ in xrange(4)] r = read4(buf4) if idx+r < n: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def readbuf(self, n):\n if n == 0:\n return ''\n try:\n msg = self.sock.recv(n)\n except BaseException:\n msg = ''\n n2 = min(n - len(msg), n / 2)\n return msg + self.readbuf(n2)", "def read(self, n=1):\n s = self._RX_buf[0:n]\n se...
[ "0.7296429", "0.7184826", "0.71118164", "0.6764044", "0.65951157", "0.6557776", "0.6513806", "0.6513806", "0.6513788", "0.6481166", "0.6312328", "0.6295568", "0.62502605", "0.62111115", "0.61962515", "0.6186824", "0.6165042", "0.6112361", "0.60271007", "0.60082614", "0.600411...
0.7302957
0