query
stringlengths
10
2k
document
stringlengths
20
51.2k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
This method will build heap array, and we conside only parent nodes which ends at n/2 1
def heap_sort(arr): build_heap(arr) for i in range(len(arr) -1 , -1, -1): arr[i], arr[0] = arr[0], arr[i] """Here we swap current element with root as it is already sorted and apply heapify. Index = 0 represents root""" heapify(arr, 0, i)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_heap(self):\n n = int((len(self.array) / 2) - 1)\n\n while n >= 0:\n self.heapify_top_down(n)\n n -= 1", "def buildHeap(A):\n n = len(A)\n for i in range(n/2-1, -1, -1):\n heapify(A, i, n)", "def build_heap(arr):\n for i in range((len(arr)//2), -1, ...
[ "0.78074706", "0.7763945", "0.76223963", "0.75372446", "0.74055773", "0.7405558", "0.73994493", "0.73548913", "0.72669005", "0.7156649", "0.70752496", "0.70303065", "0.6964611", "0.69284904", "0.6879574", "0.6834992", "0.6804962", "0.67995226", "0.6771774", "0.6747888", "0.67...
0.6418377
32
This method will call heapify method across all elements in the array
def build_heap(arr): for i in range((len(arr)//2), -1, -1): heapify(arr,index=i, size=len(arr)-1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def heapify(x):\n pass", "def _heapify(self):\n for _ in range(len(self.elements)):\n for i in range(len(self.elements)-1, 0, -1):\n parentPosition = (i-1)/2 # defaults to int i.e. 7/2=3, and 6/2=3\n if parentPosition < 0:\n parentPosition = 0...
[ "0.80610263", "0.7722756", "0.7705861", "0.73335224", "0.73239356", "0.7314641", "0.7219604", "0.7193673", "0.7179256", "0.7095849", "0.7072819", "0.70289546", "0.6944731", "0.6944614", "0.6891272", "0.68883836", "0.68864703", "0.68610173", "0.68610173", "0.68462807", "0.6834...
0.7795577
1
Adds transparency according to a precomputed mask of the central circle.
def transparency(img): black_mask_undistorted_file = open(os.path.join(settings.BASE_DIR, 'static', 'mask_undistorted.npy'), 'r') black_mask_undistorted = np.load(black_mask_undistorted_file) alpha = 200 * black_mask_undistorted img = scipy.misc.imresize(img, (np.shape(alpha)[0], np.shape(alpha)[1]...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mask_particle_circle(image, circle_center, circle_radius, color):\r\n \r\n masked_image = cv2.circle(image, circle_center, circle_radius, color, -1)\r\n return masked_image", "def _generate_circle_mask(center_y, center_x, radius):\n\n circle = draw.circle(center_y, center_x, radius)\n\n return...
[ "0.6404722", "0.61965626", "0.61880237", "0.6181813", "0.60998386", "0.59009665", "0.58496034", "0.5814131", "0.5787221", "0.57763857", "0.5747643", "0.57454926", "0.57408136", "0.5644814", "0.56216925", "0.5609337", "0.5534257", "0.55015475", "0.55003166", "0.5492463", "0.54...
0.5289992
33
Returns the labels rounded using the threshold given
def get_predict(prediction, threshold): prediction[prediction < threshold] = 0 prediction[prediction >= threshold] = 1 return prediction
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def round_using_t(prediction, threshold):\n return (prediction >= threshold).astype('int')", "def get_tpr_from_threshold(scores,labels, threshold_list):\n tpr_list = []\n hack_scores = []\n for score, label in zip(scores,labels):\n if label == 1:\n hack_scores.append(float(score))\n ...
[ "0.6723008", "0.61811215", "0.60980386", "0.60972923", "0.60350806", "0.5971849", "0.5841451", "0.5839919", "0.5768366", "0.5767951", "0.56559384", "0.5633376", "0.56127113", "0.55892754", "0.5570103", "0.55532324", "0.5536158", "0.55278546", "0.5500906", "0.5488597", "0.5471...
0.52103573
61
Transform X using onehot encoding.
def transform(self, X): X = check_array(X, accept_sparse='csc', dtype=np.object, copy=True) n_samples, n_features = X.shape X_int = np.zeros_like(X, dtype=np.int) X_mask = np.ones_like(X, dtype=np.bool) for i in range(n_features): valid_mask = np.in1d(X[:, i], self.c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def one_hot_encode(x):\n # TODO: Implement Function\n lb = preprocessing.LabelBinarizer()\n lb.fit([0,1,2,3,4,5,6,7,8,9])\n \n return lb.transform(x)", "def one_hot_encode(x):\n # TODO: Implement Function\n output = np.zeros((len(x), 10))\n \n for i, j in enumerate(x):\n output[...
[ "0.8219971", "0.81998163", "0.8187003", "0.80171347", "0.80086917", "0.7953275", "0.7925757", "0.7909148", "0.7731275", "0.764463", "0.76382214", "0.7606447", "0.75770795", "0.7576713", "0.7539266", "0.75064456", "0.75040966", "0.74916536", "0.7488146", "0.7440699", "0.742351...
0.0
-1
Strips all whitespace from a string.
def _StripWS(s): return re.sub('\s+', '', s)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _clean(s):\n return re.sub(r'\\s+', ' ', s.strip())", "def strip_space(string):\n return string.replace(' ', '')", "def trim_whitespace(str):\n return str.strip()", "def remove_white_spaces(input_string):\n return re.sub(r'\\s+', ' ', input_string).strip()", "def space_strip(string):\n ...
[ "0.8220123", "0.82075036", "0.8189269", "0.8109563", "0.7996455", "0.7980642", "0.79463935", "0.78487414", "0.78111756", "0.75946873", "0.7535476", "0.75354433", "0.75068045", "0.7500625", "0.745083", "0.7430749", "0.73904836", "0.7367788", "0.73488903", "0.731534", "0.730678...
0.78219575
8
Strips all whitespace from a string.
def _StripWS(s): return re.sub('\s+', '', s)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _clean(s):\n return re.sub(r'\\s+', ' ', s.strip())", "def strip_space(string):\n return string.replace(' ', '')", "def trim_whitespace(str):\n return str.strip()", "def remove_white_spaces(input_string):\n return re.sub(r'\\s+', ' ', input_string).strip()", "def space_strip(string):\n ...
[ "0.8219388", "0.8206231", "0.8187886", "0.81094575", "0.7995543", "0.79807216", "0.79477304", "0.7849996", "0.78120714", "0.7594074", "0.75342447", "0.75330484", "0.75072616", "0.75003797", "0.74503", "0.74304545", "0.7390482", "0.73688823", "0.7349161", "0.73173594", "0.7309...
0.78209794
9
Unload a config entry.
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: unload_ok = await hass.config_entries.async_unload_platforms(entry, PLATFORMS) if unload_ok: hass.data[DOMAIN].pop(entry.entry_id) return unload_ok
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def async_unload_entry(hass, config_entry):\n unload_ok = await hass.config_entries.async_forward_entry_unload(\n config_entry, \"climate\"\n )\n return unload_ok", "async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:\n hass.data.pop(DOMAIN)\n return True", ...
[ "0.69727516", "0.6888386", "0.6779764", "0.6747861", "0.6690448", "0.66583025", "0.66159624", "0.6602564", "0.659272", "0.65593284", "0.6541738", "0.6499104", "0.64934844", "0.648678", "0.648678", "0.648678", "0.648678", "0.6469535", "0.6469535", "0.6462851", "0.6459961", "...
0.65078104
13
Add a token to the vocabulary.
def _add_word(self, word): if not word in self._word2idx.keys(): self._word2idx[word] = self.vocab_size self.freqs[word] = 0 self._idx2word[self.vocab_size] = word self.vocab_size += 1 self.freqs[word] += 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_token(self,token):\n\t\tif not token:\n\t\t\tlogging.error(\"Token cannot be empty!\")\n\t\t\texit()\n\n\t\tself.tokens.append(token.lower())\n\t\t#self.user_defined_token = token.lower()", "def add_token(self, token):\n token = self.process_token(token)\n self._token_count.update([token])"...
[ "0.77649343", "0.724687", "0.724687", "0.7041156", "0.6942803", "0.6942648", "0.68020165", "0.67651683", "0.6716386", "0.6630396", "0.6579675", "0.64914465", "0.6415", "0.63805306", "0.6305696", "0.6305696", "0.62857854", "0.6260862", "0.6243819", "0.6243666", "0.61960804", ...
0.617617
22
Build vocab from list of tokens, limit to min_freq and max_size
def build_vocab(self, lst_tokens): freqs = {} # Calculate frequency of words for tokens in lst_tokens: for word in tokens: if word not in self._special_tokens.values() and word not in freqs.keys(): freqs[word] = 0 freqs[word] += 1 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build(corpus: List[List[str]], size=5000, freq_cutoff=5):\n vocab = VocabEntry()\n word2freq = Counter(chain(*corpus))\n word2freq = {word: freq for word, freq in word2freq.items() if freq > freq_cutoff}\n words_selected = sorted(word2freq.keys(), key=lambda w: word2freq[w], reverse...
[ "0.7532421", "0.75256574", "0.72232324", "0.6994269", "0.69791996", "0.68010587", "0.6737256", "0.6727638", "0.6682001", "0.66760063", "0.6657784", "0.66242343", "0.65911585", "0.6563319", "0.65575534", "0.6538948", "0.6532733", "0.65188223", "0.6483983", "0.64821064", "0.642...
0.8209771
0
Returns the number of components in the decomposition
def count(self): return len(self._components)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def components(self):\n return self.num_components", "def getNumberOfScalarComponents(self):\n\t\treturn self.numberOfComponents", "def n_components(self):\n return 1", "def n_components(self):\n return self._components.shape[0]", "def countComponents26(cube):\n n,l = labelComponents2...
[ "0.78362834", "0.7746766", "0.76586896", "0.76526594", "0.7248819", "0.7232771", "0.7170004", "0.7166764", "0.71628004", "0.70968354", "0.7089202", "0.70868075", "0.7075053", "0.70293504", "0.7006513", "0.6986728", "0.6986728", "0.6975097", "0.6907768", "0.690017", "0.6891938...
0.73265475
4
Plot model loss and accuracy through epochs.
def plot_model_performance(train_loss, train_acc, train_val_loss, train_val_acc): green = '#72C29B' orange = '#FFA577' with plt.xkcd(): # plot model loss fig, ax1 = plt.subplots() ax1.plot(range(1, len(train_loss) + 1), train_loss, green, linewidth=5, label='trai...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_loss(model_fit, save_folder): \n train_loss = model_fit.history['loss']\n val_loss = model_fit.history['val_loss']\n epoch_axis = np.arange(1, len(train_loss) + 1)\n plt.title('Train vs Validation Loss')\n plt.plot(epoch_axis, train_loss, 'b', label='Train Loss')\n plt.plot(epoch_axis, v...
[ "0.7966805", "0.79076326", "0.786378", "0.76951486", "0.76869094", "0.7668865", "0.76305395", "0.76072", "0.7603405", "0.7574415", "0.754213", "0.75366443", "0.75253296", "0.75221163", "0.7511269", "0.75017285", "0.7492026", "0.7465758", "0.7455267", "0.7441248", "0.7436774",...
0.75799984
9
Return the cost associated with an output ``a`` and desired output ``y``. Note that np.nan_to_num is used to ensure numerical stability for log close to 0 values. In particular, if both ``a`` and ``y`` have a 1.0 in the same slot, then the expression (1y)np.log(1a) returns nan. The np.nan_to_num ensures that that is co...
def value(a, y, weights, lambda_): return np.sum(np.nan_to_num(-y*np.log(a + 1e-15)-(1-y)*np.log(1-a + 1e-15))) / (a.shape[0] * a.shape[1]) # return unregularize + (0.5*lambda_*np.sum(np.square(weights[-1])) / (a.shape[0] * a.shape[1]))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prediction_cost(a, y):\n return np.sum(-(y * np.log(a) + (1 - y) * np.log(1 - a)))", "def cost_(self, y_hat, y, eps=1e-15):\n\t\treturn -(1 / y.shape[0]) * np.sum((y * np.log(y_hat + eps)) + (1 - y) * np.log(1 - y_hat + eps))", "def compute_cost(AL, Y):\n m = AL.shape[1]\n cost = 1./m*(-Y*np.l...
[ "0.7274893", "0.6889817", "0.682838", "0.6763906", "0.67032224", "0.6618208", "0.65619063", "0.65550745", "0.6528756", "0.6520607", "0.6442274", "0.6386759", "0.63430005", "0.6327413", "0.63139385", "0.63134575", "0.62941635", "0.6221718", "0.620202", "0.6172732", "0.6155647"...
0.6033699
26
Finds and replaces a missing dimension in an output shape. This is a near direct port of the internal Numpy function `_fix_unknown_dimension` in `numpy/core/src/multiarray/shape.c` Arguments
def _fix_unknown_dimension(self, input_shape, output_shape): output_shape = list(output_shape) msg = 'total size of new array must be unchanged' known, unknown = 1, None for index, dim in enumerate(output_shape): if dim < 0: if unknown is None: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _fix_shape(x, n, axis):\n s = list(x.shape)\n if s[axis] > n:\n index = [slice(None)]*len(s)\n index[axis] = slice(0,n)\n x = x[tuple(index)]\n return x, False\n else:\n index = [slice(None)]*len(s)\n index[axis] = slice(0,s[axis])\n s[axis] = n\n ...
[ "0.60012424", "0.58389354", "0.54475015", "0.53713906", "0.52496743", "0.52364945", "0.5225566", "0.51583886", "0.51510143", "0.49967852", "0.4992651", "0.49831882", "0.49597657", "0.49522159", "0.4934343", "0.4927318", "0.49135688", "0.49042878", "0.4900138", "0.48978037", "...
0.76785934
0
Obtain datasets for ssbr model
def data_preprocessing_ssbr(df: pd.DataFrame, config: ModelSettings): train_filenames = df.loc[df.train_data == 1, "filename"].values val_filenames = df.loc[df.val_data == 1, "filename"].values test_filenames = df.loc[df.test_data == 1, "filename"].values train_zspacings = df.loc[df.train_data == 1, "p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def datasets(self):\n pass", "def get_datasets(config: ModelSettings, df: pd.DataFrame):\n train_filenames = df.loc[df.train_data == 1, \"filename\"].values\n val_filenames = df.loc[df.val_data == 1, \"filename\"].values\n test_filenames = df.loc[df.test_data == 1, \"filename\"].values\n\n tra...
[ "0.70185155", "0.6772077", "0.6703192", "0.6698656", "0.66024745", "0.65546775", "0.6469686", "0.6397291", "0.6387752", "0.6329411", "0.6322257", "0.62787044", "0.6245999", "0.62277496", "0.6161619", "0.61306846", "0.6100437", "0.6083513", "0.6082553", "0.6071402", "0.6064065...
0.5855956
45
Retrieve all transactions in current page.
def get_all_transactions_in_current_page(page: int = Path(..., gt=0), per_page: int = Query(default=20, gt=0), product_name: Optional[str] = '', provider_name: Optional[str] = '', description: Optional[str] = '', transaction_type: Optional[TransactionTypeEnum] = '', start_date: Optional[date] = '' ,finish_d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transactions(self):\n return self._call_account_method(\n 'transactions'\n )", "def all_transactions(self, request):\n user_id = request.data[\"user\"]\n user = User.objects.get(id=user_id)\n user_transactions = user.transactions.all()\n serializer = Trans...
[ "0.7636284", "0.7164458", "0.7111992", "0.7103535", "0.696806", "0.6916532", "0.6859332", "0.6771906", "0.67608154", "0.6738442", "0.6737192", "0.6637984", "0.6466853", "0.6457939", "0.64430684", "0.64178246", "0.6374042", "0.63619363", "0.6345448", "0.63206285", "0.62852013"...
0.6546276
12
Return all schedules by table_id
def find_by_table_id(cls, table_id): return Score.query.filter(Score.table == table_id).order_by(desc(func.greatest(Score.score_1, Score.score_2))).all()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_schedules(session, logger):\n for sched in session.query(Schedule).all():\n logger.info(\"- {}\".format(sched))", "def all_schedules(self):\n return self._all_schedules", "def list_schedules(profile=None, api_key=None):\n return salt.utils.pagerduty.list_items(\n \"schedules...
[ "0.68276", "0.64066154", "0.6318095", "0.6214963", "0.6143802", "0.6073995", "0.60682213", "0.6029638", "0.6027172", "0.58612263", "0.5858773", "0.5795927", "0.5794017", "0.575908", "0.5735127", "0.5698692", "0.56806535", "0.56722736", "0.5655395", "0.5655395", "0.5646926", ...
0.51265866
51
Set the view given the indices to slice with.
def _set_view_slice(self): nd = self.dims.not_displayed if self.multichannel: # if multichannel need to keep the final axis fixed during the # transpose. The index of the final axis depends on how many # axes are displayed. order = self.dims.displayed_ord...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _set_view_slice(self, indices):\n\n vertices = self._mesh_vertices\n faces = self._mesh_triangles\n\n if len(faces) == 0:\n self._node.set_data(vertices=None, faces=None)\n else:\n self._node.set_data(vertices=vertices[:, ::-1], faces=faces,\n ...
[ "0.782912", "0.6324031", "0.6289688", "0.6064714", "0.5679231", "0.5642572", "0.5620179", "0.5590102", "0.55810845", "0.555939", "0.55344766", "0.55198014", "0.54366237", "0.53852654", "0.53639066", "0.5330852", "0.530797", "0.5307188", "0.5296461", "0.5278933", "0.5276212", ...
0.6058476
4
Constructor Will call .grid() on parent_frame
def __init__(self, window, parent_frame): self.window = window self.frame = parent_frame self.add_button = ttk.Button(self.frame, text='add massless vector object', command=self.add_button_press) x_label = ttk.Label(self.frame, text='x') y_label = ttk.Label(self.frame, text='y') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, parent):\r\n Frame.__init__(self, parent) \r\n \r\n self.parent = parent\r\n self.initUI()", "def __init__(self, parent, *args, **kwargs):\n tk.LabelFrame.__init__(self, parent, *args, **kwargs)\n self.canvas = MainCanvas(self, bg=\"orange\")\n ...
[ "0.7866988", "0.75522554", "0.75497085", "0.74889493", "0.7467792", "0.7436946", "0.73132837", "0.7282456", "0.72607166", "0.72269994", "0.717041", "0.70813274", "0.70638937", "0.7046002", "0.7043227", "0.7038707", "0.70196617", "0.69892186", "0.6986772", "0.6963065", "0.6927...
0.0
-1
return magnitude of a vector, (square root of sum of squares)
def mag(x): return np.sqrt(sum(i**2 for i in x))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def magnitude(vector):\n return math.sqrt(sum_of_squares(vector))", "def magnitude(v: Vector) -> float:\n return math.sqrt(sum_of_squares(v))", "def magnitude(v: Vector) -> float:\n return math.sqrt(sum_of_squares(v)) #math.sqrt() is a square root function", "def magnitude_of_vector(v):\n return ...
[ "0.914317", "0.9045394", "0.9005773", "0.8998474", "0.860308", "0.8567576", "0.84165233", "0.83673674", "0.8315628", "0.82909733", "0.82634825", "0.81141907", "0.80058897", "0.77465874", "0.7713982", "0.7468436", "0.74294335", "0.74219257", "0.74146706", "0.7361557", "0.73056...
0.7266897
22
scales a vector by its magnitude, returning a new vector with magnitude of ~1
def scale_mag_1(x): return np.array([np.true_divide(ui, mag(x)) for ui in x])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize(v):\n\n return v * (1.0 / magnitude(v))", "def normalize(self):\n\n if not self.magnitude():\n return Vector(0, 0)\n\n l = 1 / self.magnitude()\n return self.scale(l)", "def unit_vector(vector):\n return vector / max(np.linalg.norm(vector), 1e-10)", "de...
[ "0.74288636", "0.7021322", "0.6747838", "0.6701064", "0.668675", "0.6676347", "0.66709733", "0.66610444", "0.6651794", "0.6644284", "0.65938985", "0.65840244", "0.65840244", "0.65840244", "0.6544901", "0.65427446", "0.65406215", "0.6539357", "0.65319777", "0.65319777", "0.653...
0.687879
2
Round int i up to the nearest power of 10.
def ceil_10(i: int) -> int: return 10 ** (math.ceil(math.log10(i)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _pow_10_round(n, up=True):\n if up:\n return 10 ** math.ceil(math.log(n, 10))\n else:\n return 10 ** math.floor(math.log(n, 10))", "def floor_int(i: int, base: int) -> int:\n return (i // base) * base if i > 0 else (i + 1) // base * base - base", "def _round_bits(n: int, radix_bits: ...
[ "0.73753357", "0.71792126", "0.7033097", "0.7018407", "0.6806228", "0.6714022", "0.6690494", "0.63273466", "0.62847763", "0.62699604", "0.6245603", "0.62395316", "0.611164", "0.6104998", "0.60938394", "0.60352737", "0.6021549", "0.5978459", "0.5966613", "0.59659374", "0.59639...
0.77841604
0
Updates by adding overwriting or clearing existing choices.
def update(self, choices, clear=False): if clear: self._weights.clear() self._weights.update(choices) self._generate_p()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setChoices(self, choices):\n self.getGtkObject('property_liststore').clear()\n for choice in choices:\n self.getGtkObject('property_liststore').append([str(choice)])", "def choices(self, choices):\n\n self._choices = choices", "def _update_model(self, idx):\n self._wf...
[ "0.66463643", "0.6613712", "0.6404525", "0.626038", "0.6151048", "0.6070011", "0.6036216", "0.58630985", "0.5857508", "0.5770117", "0.5733792", "0.5706769", "0.56976545", "0.56625485", "0.5646731", "0.56261164", "0.557902", "0.5565845", "0.5526703", "0.55093473", "0.5497267",...
0.66069365
2
Generates cumulative p values for each choice.
def _generate_p(self): self._values, weights = zip(*self._weights.items()) cumsum = list(itertools.accumulate(weights)) total = cumsum[-1] self._p = [i / total for i in cumsum]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cumulative_probability_distribution(self):\n return list(accumulate(self.probability_distribution()))", "def cumprob(self):\r\n return self.probabilities.cumsum(-1)", "def cumulative_distribution(self):\n\n cum_dd = []\n sum_p = 0\n for k, p in reversed(self.dd):\n ...
[ "0.6410551", "0.6266399", "0.61421305", "0.61290544", "0.60461", "0.5807687", "0.5678223", "0.5669986", "0.5666902", "0.56559545", "0.56063056", "0.55881065", "0.5568507", "0.5553318", "0.5548019", "0.5545678", "0.55144906", "0.55047977", "0.5448066", "0.53852797", "0.5382755...
0.66284406
0
(WeightedSelector) Returns a clone of this object.
def clone(self): return WeightedSelector(self._weights)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy(self):\n G = WeightedGraph(self.V, self.edges.copy(), self.weights.copy())\n return G", "def copy(self):\n edges, weights = [], []\n \n # This is a microoptimization\n edges_append = edges.append\n weights_append = weights.append\n \n for ed...
[ "0.7191921", "0.66938823", "0.6508605", "0.64418036", "0.63979053", "0.6389897", "0.6344159", "0.6300275", "0.62992996", "0.62557423", "0.62420535", "0.6239324", "0.6223754", "0.61786884", "0.61488116", "0.61488116", "0.61406386", "0.61406386", "0.61406386", "0.61406386", "0....
0.8988116
0
Stack input features. Each frame is now the concatenation of its previous frames and its next frames. First and last frames are padded with zeros.
def stack_fbanks(features, nframes=7): assert nframes % 2 == 1, 'number of stacked frames must be odd' dim = features.shape[1] pad = np.zeros((nframes/2, dim), dtype=features.dtype) features = np.concatenate((pad, features, pad)) aux = np.array([features[i:i-nframes+1] for i in x...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stack_frames(self, state):\n # Preprocess frame\n frame = self.preprocess_frame(state)\n\n # Append frame to deque, automatically removes the oldest frame\n self.stacked_frames.append(frame)\n\n # Build the stacked state (first dimension specifies different frames)\n s...
[ "0.6678294", "0.6494997", "0.6412541", "0.64059865", "0.61112463", "0.6092659", "0.6080295", "0.60777", "0.5981213", "0.5959917", "0.59465384", "0.5897115", "0.5891432", "0.5847991", "0.5811647", "0.5781475", "0.57280844", "0.57240045", "0.5706831", "0.56814253", "0.5664145",...
0.6815267
0
returns the path where the module is actually living. if module is in link mode the linkPath is returned else the installPath is returned
def realPath(self): return (self.useLink and [self.linkPath] or [self.installPath])[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_module_path():\n\n return os.path.dirname(os.path.realpath(__file__))", "def module_path(self):\n return self.config['cwd']", "def module_path():\r\n if hasattr(sys, \"frozen\"):\r\n return os.path.dirname(sys.executable)\r\n return os.path.dirname(__file__)", "def install_des...
[ "0.705268", "0.7011493", "0.6880964", "0.6862019", "0.6841915", "0.6766617", "0.6762512", "0.67554486", "0.6719864", "0.670789", "0.6662805", "0.66373676", "0.6582765", "0.65316254", "0.6483963", "0.6391418", "0.63768464", "0.6376281", "0.6354351", "0.6342916", "0.63093585", ...
0.7661609
0
Init with the API key and model id.
def __init__(self, hass, data, camera_entity_id, name, targets): super().__init__() self._targets = targets self.hass = hass self.timeout = IMAGE_TIMEOUT.seconds self._camera_entity_id = camera_entity_id self._data = data if name: self._name = f'{D...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, api_key=None):\n self.api_key = api_key", "def __init__(self, api_key):\r\n self.api_key = api_key", "def __init__(self, api_key: str):\n self.api_key = api_key", "def __init__(self, api_key, app_id):\n api.APIRequest.__init__(self, api_key)\n self._key =...
[ "0.69842", "0.6938503", "0.6916152", "0.68459374", "0.67813087", "0.67236847", "0.66746324", "0.66445667", "0.6562677", "0.65619016", "0.6552311", "0.65291405", "0.6512542", "0.6495062", "0.6474344", "0.64647484", "0.6449278", "0.6419762", "0.63789266", "0.63198686", "0.63189...
0.0
-1
Return the name of the sensor.
def name(self): return self._name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name(self):\n return self._sensor.name", "def get_sensor_name(self):\n return self.data[1]", "def name(self):\n return self.device.device_data[self.device_id]['name'] + \\\n f' {self._sensor_type}'", "def name(self):\n return f\"{self._name} {SENSOR_TYPES[self.senso...
[ "0.9189599", "0.91678053", "0.8901546", "0.87707126", "0.8511107", "0.84797406", "0.84445643", "0.82992035", "0.8186399", "0.8105673", "0.807955", "0.80660135", "0.8049639", "0.7702056", "0.7613606", "0.76128423", "0.7602013", "0.7602013", "0.7602013", "0.75404775", "0.751766...
0.0
-1
Return device specific state attributes.
def device_state_attributes(self): attr = { CONF_TARGETS: self._targets, PREDICTIONS: self._predictions } return attr
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def device_state_attributes(self):\r\n return self.attributes", "def device_state_attributes(self):\n return self.attr", "def device_state_attributes(self):\n return self.attr", "def device_state_attributes(self): # Can be remove from 0.99\n return self._attr", "def device_stat...
[ "0.87326586", "0.87130606", "0.87130606", "0.8661474", "0.86244243", "0.86244243", "0.86156", "0.8589153", "0.85687816", "0.85626554", "0.85169643", "0.84891194", "0.84891194", "0.84891194", "0.84891194", "0.84891194", "0.84891194", "0.84891194", "0.84891194", "0.84891194", "...
0.76999617
73
The header should not be read when header_start=None. Unless names is passed, the column names should be autogenerated.
def test_no_header(parallel, read_basic, read_no_header): # Cannot set header_start=None for basic format with pytest.raises(ValueError): read_basic( "A B C\n1 2 3\n4 5 6", header_start=None, data_start=0, parallel=parallel ) t2 = read_no_header("A B C\n1 2 3\n4 5 6", parallel=p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reset_header(self):\n new_header = []\n for col_name in self.header:\n is_left = self.left_cols.get(col_name)\n if is_left:\n new_header.append(col_name)\n self.header = new_header", "def test_empty_cols_allowed(self):\n self.test_table.allow_...
[ "0.62357193", "0.62156737", "0.62111676", "0.61707246", "0.6118131", "0.60490113", "0.60072345", "0.60051966", "0.5986627", "0.5983217", "0.5959099", "0.5915511", "0.5888868", "0.58644795", "0.5839701", "0.5836435", "0.58133745", "0.5794937", "0.5738853", "0.5698285", "0.5667...
0.54610664
32
Make sure memory reallocation works okay when the number of columns is large (so that each header string is longer than INITIAL_HEADER_SIZE).
def test_many_columns(parallel, read_basic): # create a string with 500 columns and two data rows text = " ".join([str(i) for i in range(500)]) text += "\n" + text + "\n" + text table = read_basic(text, parallel=parallel) expected = Table([[i, i] for i in range(500)], names=[str(i) for i in range(50...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _parse_dynamic_length_data(self, original_record, relative_record_metadata,\n relative_records_column_map):\n relative_offsets = relative_record_metadata.variable_length_field_offsets\n jump_table_addition = 0\n for i, column_index in enumerate(relative_re...
[ "0.5877849", "0.5704505", "0.5599233", "0.5558367", "0.5531432", "0.55200785", "0.538015", "0.5311291", "0.5296101", "0.5227285", "0.52105296", "0.51850283", "0.51717174", "0.51593125", "0.5154613", "0.5148306", "0.51415116", "0.51164883", "0.5102157", "0.51011115", "0.509417...
0.0
-1
Make sure the C reader doesn't segfault when the header for the first column is missing [3545]
def test_fast_tab_with_names(parallel, read_tab): content = """# \tdecDeg\tRate_pn_offAxis\tRate_mos2_offAxis\tObsID\tSourceID\tRADeg\tversion\tCounts_pn\tRate_pn\trun\tRate_mos1\tRate_mos2\tInserted_pn\tInserted_mos2\tbeta\tRate_mos1_offAxis\trcArcsec\tname\tInserted\tCounts_mos1\tInserted_mos1\tCounts_mos2\ty\tx\...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_too_many_cols1():\n text = dedent(\n \"\"\"\n A B C\n 1 2 3\n 4 5 6\n 7 8 9 10\n 11 12 13\n \"\"\"\n )\n with pytest.raises(InconsistentTableError) as e:\n FastBasic().read(text)\n assert (\n \"Number of header columns (3) inconsistent with data columns i...
[ "0.65467274", "0.6392961", "0.6326611", "0.6239705", "0.6144893", "0.61026126", "0.6089404", "0.5966", "0.5840112", "0.581514", "0.5782535", "0.5775039", "0.5767639", "0.57463944", "0.5733267", "0.57315075", "0.570626", "0.56590587", "0.565102", "0.565102", "0.5642892", "0....
0.0
-1
Create a new InternetAccessControl object.
def __init__( self, internet_management=None, domain_name_allowed=None, ftp_server=None, http_server=None, enforce_https_access=None, https_server=None, telnet_server=None, tr069_server=None, ssh_server=None, snmp_server=None, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Create(self):\n\n gateway = None\n netmask = None\n\n self._AcquireNetworkDetails()\n\n if self.is_vpc:\n # Create a VPC first\n\n cidr = '10.0.0.0/16'\n vpc = self.cs.create_vpc(self.vpc_name,\n self.zone_id,\n cidr,\n ...
[ "0.51479644", "0.5073318", "0.50203687", "0.50203687", "0.47671458", "0.47036737", "0.46915144", "0.46802634", "0.4674453", "0.45738888", "0.45644355", "0.45596462", "0.45531636", "0.4541367", "0.4515936", "0.45148748", "0.45145407", "0.4503812", "0.4500249", "0.449895", "0.4...
0.0
-1
Computes the precision for the specified values of k
def accuracy(output, target, topk=(1,)): maxk = max(topk) batch_size = target.size(0) _, pred = output.topk(maxk, 1, True, True) pred = pred.t() correct = pred.eq(target.view(1, -1).expand_as(pred)) res = [] for k in topk: correct_k = correct[:k].view(-1).float().sum(0, keepdim=Tru...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def precision(gt, pred, k):\n k = min(len(pred), k)\n den = min(len(gt), k)\n return sum([int(pred[i] in gt) for i in range(k)]) / den", "def precision_at_k(r, k):\n assert k >= 1\n r = np.asarray(r)[:k] != 0\n if r.size != k:\n raise ValueError('Relevance score length < k')\...
[ "0.7642171", "0.7419321", "0.74184227", "0.72697616", "0.7244972", "0.7244229", "0.7236948", "0.7220481", "0.72104603", "0.7058168", "0.68511814", "0.6786012", "0.67824614", "0.67672175", "0.6726138", "0.6716942", "0.6716942", "0.6716942", "0.6716942", "0.6716942", "0.6716942...
0.0
-1
Sets the learning rate to the initial LR decayed by 10 every 10 epochs
def adjust_learning_rate(lr, optimizer, epoch): lr = lr * (0.1 ** (epoch // 10)) for param_group in optimizer.param_groups: param_group['lr'] = lr
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def adjust_learning_rate(init_lr, optimizer, epoch, n=100):\n init_lr = init_lr * (0.1 ** (epoch // n))\n print('learning rate : ', init_lr)\n for param_group in optimizer.param_groups:\n param_group['lr'] = init_lr", "def adjust_learning_rate(initial_lr, optimizer, epoch, every_epoch):\n lr = i...
[ "0.77828217", "0.7726167", "0.764902", "0.76205736", "0.759192", "0.759192", "0.75520676", "0.7540509", "0.75102913", "0.7499418", "0.74817014", "0.74764925", "0.7467575", "0.7464192", "0.7457668", "0.74407345", "0.7422522", "0.74218893", "0.74207723", "0.74133664", "0.741026...
0.74108756
20
Get the raw block data from the Tendermint API and deserializes it into a Block object. Applies the transformer(block) function to the block before returning.
def at(self, height: int): res = self.terra._tendermint.block(height) # block data block = Block.deserialize(res) if self.transform_after_fetch: block = self.transformer(block) return project(res, block)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def block_transaction_raw(self, block):\n # Allow for a list of blocks..\n block = utils.request_type(block)\n\n res = r.get(self.url + self.block_raw + str(block))\n return self.execute(res)", "def transform_block(block):\n return {\n 'type': 'block',\n 'children': [...
[ "0.5944021", "0.58109295", "0.5724975", "0.5714348", "0.56095743", "0.5568709", "0.5567682", "0.55174416", "0.53945524", "0.53845173", "0.5382481", "0.53438663", "0.53366035", "0.53298193", "0.5304173", "0.52518994", "0.52490246", "0.522847", "0.5226342", "0.52075773", "0.519...
0.5629696
4
Gets the current HDP version of the component that this role command is for.
def get_role_component_current_stack_version(): stack_select_component = None role = default("/role", "") role_command = default("/roleCommand", "") stack_selector_name = stack_tools.get_stack_tool_name(stack_tools.STACK_SELECTOR_NAME) if role in SERVER_ROLE_DIRECTORY_MAP: stack_select_component = SERVE...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_current_component_version():\n from resource_management.core.exceptions import Fail\n from resource_management.libraries.functions.default import default\n from resource_management.libraries.functions.stack_select import get_role_component_current_stack_version\n from resource_management.libraries.func...
[ "0.7523242", "0.73901236", "0.7267877", "0.71965766", "0.7179699", "0.7179699", "0.71410614", "0.71401906", "0.70852923", "0.70405716", "0.7028212", "0.70190775", "0.70030165", "0.69422984", "0.69422984", "0.694135", "0.693519", "0.69280255", "0.688495", "0.6874432", "0.68416...
0.6804491
26
Get a list of sliding windows to use.
def get_windows(img): w_far = slide_window(img, x_start_stop=[0, 1280], y_start_stop=[350, 550], xy_window=(96,64), xy_overlap=(0.5, 0.5)) w_medium_s = slide_window(img, x_start_stop=[0, 1280], y_start_stop=[400, 650], xy_window=(128,96), xy_overlap=(0.7, 0...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def win_slide(stream, start_time, win_size, step_size, max_windows):\n stream_list=[]\n for i in range(max_windows):\n ts = start_time + (i*step_size)\n st = stream.slice(ts, ts+win_size)\n # skip missing data\n if len(st)!=3: continue\n if not st[0].stats.starttime == st[1...
[ "0.7306303", "0.70957905", "0.69270307", "0.6835083", "0.6689294", "0.66644084", "0.66088057", "0.6599263", "0.6591293", "0.65680134", "0.65331507", "0.65246797", "0.65135914", "0.6484974", "0.64718443", "0.64620095", "0.6459099", "0.6444671", "0.6416923", "0.6402252", "0.639...
0.6734395
4
Creates a timestamp in DB format.
def timestamp(): timestamp = datetime.today().strftime('%Y-%m-%d') return timestamp
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_timestamp(record):\n\n timestamp = datetime.fromtimestamp(record.created)\n return timestamp.strftime(\"%y-%m-%d %H:%M:%S,%f\"),", "def createTimeStamp_Date():\r\n\r\n return str(datetime.now().strftime(\"%Y%m%d\"))", "def _generate_timestamp():\n\t\treturn strftime(\"%Y%m%dT%H%M%S\")",...
[ "0.7738274", "0.7268141", "0.72515184", "0.71872133", "0.71751755", "0.7012307", "0.69915664", "0.69871", "0.69780505", "0.6894051", "0.6886895", "0.6874987", "0.68270093", "0.6784383", "0.66748714", "0.66741574", "0.66724783", "0.667211", "0.6654683", "0.6653958", "0.6606984...
0.6496026
29
Calculate the percentage of incorrectly predicted label values
def eval_metrics(y, pred): classification_error = np.sum(pred != y) / float(y.shape[0]) return classification_error
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def label_accuracies(preds, labels):\n num_correct = num_correct_fun(preds, labels)\n return (num_correct / preds.size(0)) * 100.0", "def label_errors(preds, labels):\n num_correct = num_correct_fun(preds, labels)\n return (1.0 - num_correct / preds.size(0)) * 100.0", "def error_rate(predictions, l...
[ "0.80377483", "0.7879995", "0.7641581", "0.74007845", "0.73810023", "0.73648286", "0.7364221", "0.7356962", "0.72855103", "0.7274031", "0.727198", "0.7246465", "0.72424173", "0.7147145", "0.7079178", "0.69923675", "0.6948483", "0.69374347", "0.69283485", "0.6924704", "0.68963...
0.6391968
92
Test dhcp or discovery updates existing host.
async def test_discovered_by_dhcp_or_integration_discovery_updates_host( hass: HomeAssistant, source, data ) -> None: entry = MockConfigEntry( domain=DOMAIN, unique_id=TEST_SYSTEM_INFO["id"], data={CONF_HOST: "dummy"}, ) entry.add_to_hass(hass) with _patch_wizlight(): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def test_aiodiscover_finds_new_hosts(hass: HomeAssistant) -> None:\n with patch.object(hass.config_entries.flow, \"async_init\") as mock_init, patch(\n \"homeassistant.components.dhcp.DiscoverHosts.async_discover\",\n return_value=[\n {\n dhcp.DISCOVERY_IP_ADDRESS: ...
[ "0.68110013", "0.66385823", "0.6593177", "0.65430945", "0.64767206", "0.64748585", "0.6312028", "0.6281673", "0.6248021", "0.6244119", "0.6243533", "0.6213883", "0.61922854", "0.6105293", "0.6103723", "0.607218", "0.60274696", "0.6022667", "0.60175586", "0.5983484", "0.597737...
0.7247094
0
Converts string datetime to timezone aware datetime.
def get_timezone_aware_datetime(datetime): if not datetime: return None local = timezone.get_current_timezone() return (local.localize(parse(datetime), is_dst=None)).astimezone(timezone.utc)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_date(self, date_str):\n\t\tdate_obj = datetime.datetime.strptime(date_str, '%Y-%m-%d %H:%M:%S')\n\t\tdate_obj = date_obj.replace(tzinfo=pytz.timezone('UTC'))\n\t\treturn date_obj.astimezone(pytz.timezone(self.time_zone))", "def parse_datetime(date_string):\n try:\n return datetime.datetime....
[ "0.7262786", "0.72241807", "0.7173887", "0.7151987", "0.7147669", "0.69533306", "0.68472767", "0.6847195", "0.68270355", "0.68248796", "0.68104637", "0.6807708", "0.6722802", "0.6696234", "0.667518", "0.66569746", "0.66096705", "0.66083807", "0.6589531", "0.6586944", "0.65668...
0.6612839
16
Verify that do cell update calls CellManager create.
def test_do_cell_update_calls_cell_manager_with_fields(self, mock_update): client = mock.Mock() inventory = mock.Mock() inventory.cells = cells.CellManager(mock.ANY, mock.ANY, 'http://127.0.0.1/') cli...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_do_cell_create_calls_cell_manager_with_fields(self, mock_create):\n client = mock.Mock()\n inventory = mock.Mock()\n inventory.cells = cells.CellManager(mock.ANY,\n mock.ANY,\n 'http://127.0.0.1/')\n...
[ "0.68141335", "0.6155915", "0.5974574", "0.5714955", "0.5666055", "0.56608856", "0.56464547", "0.55555964", "0.55555964", "0.55555964", "0.55548155", "0.55375826", "0.54605967", "0.5450916", "0.53880346", "0.5372732", "0.53677785", "0.5350337", "0.53278863", "0.5323651", "0.5...
0.6796846
1
Verify that do cell update calls CellManager create.
def test_do_cell_show_calls_cell_manager_with_fields(self, mock_get): client = mock.Mock() inventory = mock.Mock() inventory.cells = cells.CellManager(mock.ANY, mock.ANY, 'http://127.0.0.1/') client.i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_do_cell_create_calls_cell_manager_with_fields(self, mock_create):\n client = mock.Mock()\n inventory = mock.Mock()\n inventory.cells = cells.CellManager(mock.ANY,\n mock.ANY,\n 'http://127.0.0.1/')\n...
[ "0.68141335", "0.6796846", "0.6155915", "0.5974574", "0.5714955", "0.5666055", "0.56608856", "0.56464547", "0.55555964", "0.55555964", "0.55555964", "0.55548155", "0.55375826", "0.54605967", "0.5450916", "0.53880346", "0.5372732", "0.53677785", "0.5350337", "0.53278863", "0.5...
0.5002037
69
Verify that do cell update calls CellManager create.
def test_do_cell_delete_calls_cell_manager_with_fields(self, mock_delete): client = mock.Mock() inventory = mock.Mock() inventory.cells = cells.CellManager(mock.ANY, mock.ANY, 'http://127.0.0.1/') cli...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_do_cell_create_calls_cell_manager_with_fields(self, mock_create):\n client = mock.Mock()\n inventory = mock.Mock()\n inventory.cells = cells.CellManager(mock.ANY,\n mock.ANY,\n 'http://127.0.0.1/')\n...
[ "0.6814643", "0.6797944", "0.61562145", "0.5975411", "0.5715707", "0.56667656", "0.56606185", "0.56469303", "0.55566", "0.55566", "0.55566", "0.55550104", "0.55366814", "0.546137", "0.54521716", "0.5389324", "0.5374067", "0.53685415", "0.53506666", "0.5327221", "0.53194857", ...
0.5324747
20
Reverse the given string with slicing
def reverse_string(str): # start = 0, stop = len(str), hence range is whole string. # step = -1, hence go backwards through range. reversed_str = str[::-1] return reversed_str # return the reversed string to the caller
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reverse(string):\n return string[::-1]", "def reverse_string_2(s):\n s[:] = s[::-1]", "def reverse(s):\n return s[::-1]", "def reverseString(string):\n return string[::-1]", "def reverse_string( str ):\n return str[::-1]", "def reverse_string(s):\n s.reverse()", "def reverseString(s...
[ "0.8095392", "0.80254585", "0.80009514", "0.7986198", "0.7942354", "0.7874921", "0.7851158", "0.7835852", "0.7827083", "0.7654088", "0.75222313", "0.74649084", "0.7400841", "0.7382287", "0.73788613", "0.7369324", "0.7299289", "0.727316", "0.72633284", "0.72515875", "0.7249994...
0.7619139
10
Test the constructor for invalid arguments.
def test_constructor_invalid(): with pytest.raises(TypeError, match='missing 1 required positional argument'): PseudoPotentialData() # pylint: disable=no-value-for-parameter
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_constructor_wrong_options(self):\n with self.assertRaises(TypeError):\n base = BaseExporter(something_else=6)", "def testConstructorValueError(self):\n test_cases = [\n 'these',\n 'are',\n 'bad',\n 'data',\n 'types',\n ...
[ "0.76987416", "0.7626607", "0.75467724", "0.7453583", "0.7440058", "0.73776245", "0.73658013", "0.73522073", "0.7345662", "0.73348534", "0.7254934", "0.7249312", "0.71799356", "0.7176312", "0.7168076", "0.71643054", "0.7125113", "0.7108121", "0.7051961", "0.70131165", "0.6990...
0.8000088
0
Checks the file extension. Args file
def file_check(file): # unpacking the tuple file_name, file_extension = os.path.splitext(file) return file_extension
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_extension(filename):\r\n split_tup = os.path.splitext(ntpath.basename(filename))\r\n file_extension = split_tup[1]\r\n if file_extension not in ('.json', '.pem', '.dat'):\r\n raise click.BadParameter('File extension is not supported. Read --help')", "def check_allowed_extension(filen...
[ "0.8026882", "0.78837764", "0.7703984", "0.7652094", "0.76387596", "0.758239", "0.75796986", "0.7574908", "0.7497997", "0.7497502", "0.7497502", "0.7495254", "0.7495254", "0.74915504", "0.7477477", "0.74755526", "0.74755526", "0.7466241", "0.7466241", "0.7466241", "0.7466241"...
0.82417715
0
Augment the input list of sequences by appending ngrams values
def add_ngram(sequences, token_indice, ngram_range=2): new_sequences = [] for input_list in sequences: new_list = input_list[:] for i in range(len(new_list) - ngram_range + 1): for ngram_value in range(2, ngram_range + 1): ngram = tuple(new_list[i:i + ngram_value]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_ngram(self, sequences, token_indice, ngram_range=2):\n new_sequences = []\n for input_list in sequences:\n new_list = input_list[:]\n for ngram_value in range(2, ngram_range + 1):\n for i in range(len(new_list) - ngram_value + 1):\n ngra...
[ "0.7681208", "0.7675428", "0.76655996", "0.6763514", "0.6468898", "0.64642733", "0.64475375", "0.63863313", "0.6317442", "0.626571", "0.62319916", "0.6228931", "0.61691546", "0.61463", "0.6142432", "0.6118912", "0.6103955", "0.6077205", "0.6056036", "0.60474086", "0.600418", ...
0.7652802
3
Symmetrically normalize adjacency matrix.
def normalize_adj(adj): rowsum = np.array(adj.sum(1)) d_inv_sqrt = np.power(rowsum, -0.5).flatten() d_inv_sqrt[np.isinf(d_inv_sqrt)] = 0. d_mat_inv_sqrt = np.diag(d_inv_sqrt) return adj.dot(d_mat_inv_sqrt).transpose().dot(d_mat_inv_sqrt)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize_adj(adj):\n adj = sp.coo_matrix(adj)\n rowsum = np.array(adj.sum(1))\n d_inv_sqrt = np.power(rowsum, -0.5).flatten()\n d_inv_sqrt[np.isinf(d_inv_sqrt)] = 0.\n d_mat_inv_sqrt = sp.diags(d_inv_sqrt)\n return adj.dot(d_mat_inv_sqrt).transpose().dot(d_mat_inv_sqrt).tocoo()", "def norm...
[ "0.7698141", "0.7698141", "0.7698141", "0.7698141", "0.7698141", "0.7698141", "0.7698141", "0.7698141", "0.7698141", "0.7691616", "0.759434", "0.7566608", "0.7335597", "0.730491", "0.72684425", "0.688461", "0.68616927", "0.686005", "0.6832041", "0.682895", "0.6750887", "0.6...
0.788518
0
Checks if the state of local migrations is represented by the database. This code follows the logic of Djangos showmigrations
def check_migration_state(exclude: Optional[List[str]] = None): exclude = exclude or [] try: connection = connections[DEFAULT_DB_ALIAS] loader = MigrationLoader(connection, ignore_no_migrations=True) graph = loader.graph targets = graph.leaf_nodes() plan = set() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_migrated_before():\n\n global migration_sign\n if os.path.exists(migration_sign):\n return True\n else:\n return False", "def is_migrated(self) -> bool:\n return pulumi.get(self, \"is_migrated\")", "def check_missing_migrations():\n from django.db.migrations.autodetector...
[ "0.6937181", "0.67706954", "0.6709497", "0.65763515", "0.6568473", "0.65206534", "0.64669234", "0.6466898", "0.64315015", "0.62776256", "0.6270633", "0.6245146", "0.62290853", "0.61852956", "0.61298704", "0.60894835", "0.6082115", "0.6068364", "0.60573006", "0.6027737", "0.59...
0.70863914
0
Close the working SQLAlchemy session.
def close(self): self.__session.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close_db_session(self, session):\r\n session.close()", "def _close(self):\n if self.__session is not None:\n self._rollback()\n self.__session.close()", "def close(self):\n self.session.close()", "def close_session(self):\n self.session.execute(QUERY_DROP...
[ "0.86326617", "0.8163551", "0.792834", "0.7871033", "0.7806409", "0.78057593", "0.77157265", "0.75799274", "0.75342184", "0.75342184", "0.75342184", "0.7463312", "0.7447553", "0.7441324", "0.73577297", "0.7341358", "0.73267347", "0.72309726", "0.7190295", "0.7140263", "0.7082...
0.7949453
6
Return a list with empty cells indexes
def get_empty_cells(board): empty_cells = [idx for idx, e in enumerate(board) if e == ' '] return empty_cells
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def empty_cells(self) -> List[Cell]:\n return list(ob.pos[0] for ob in self.new_obs())", "def get_empty_cells(state):\n cells = []\n for row_index, row in enumerate(state.board):\n for col_index, cell in enumerate(row):\n if cell == 0:\n cells.append([row_index, col_...
[ "0.8245677", "0.8238602", "0.8154329", "0.8087778", "0.808601", "0.80676603", "0.7856164", "0.7835591", "0.76332384", "0.72810984", "0.72167367", "0.7212291", "0.71867734", "0.6963971", "0.6946055", "0.68970704", "0.68473846", "0.6804161", "0.66702586", "0.6659935", "0.665993...
0.8151153
3
Plot Keras training history
def plot_training_history(history, title_str=''): acc = history.history['accuracy'] val_acc = history.history['val_accuracy'] loss = history.history['loss'] val_loss = history.history['val_loss'] epochs = range(len(acc)) plt.plot(epochs, acc, 'r', label='Training accuracy') plt.plot(ep...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_training_history(self):\n hist = [i.history[\"loss\"][0] for i in self.history]\n plt.plot(hist)", "def show_training(history: tf.keras.callbacks.History) -> None:\n hist = history.history\n\n if \"loss\" not in hist:\n print(\"Error: 'loss' values not found in the history\")\...
[ "0.79111916", "0.76914424", "0.76778966", "0.7628878", "0.74945456", "0.7407132", "0.7405166", "0.7392716", "0.7346568", "0.7264914", "0.7221192", "0.7187259", "0.7151695", "0.7077803", "0.7074188", "0.706685", "0.7041299", "0.7036636", "0.7018735", "0.69484806", "0.6900296",...
0.6817478
22
gbk bytes to python unicode str
def gbk2unicode(s): return s.decode(encoding='gbk', errors='ignore')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unicode2gbk(s):\n return s.encode(encoding='gbk', errors='ignore')", "def gbk2utf8(s):\n return s.decode(encoding='gbk', errors='ignore').encode('utf-8')", "def utf82gbk(s):\n return s.decode(encoding='utf-8', errors='ignore').encode('gbk')", "def to_gbk(encode_str, py_version):\n if ((py_ver...
[ "0.7948762", "0.7605153", "0.7083185", "0.7027147", "0.6758249", "0.66483253", "0.6646478", "0.65365076", "0.6528566", "0.65284765", "0.648821", "0.6436496", "0.6380478", "0.6346599", "0.6319003", "0.6311035", "0.63037145", "0.6292455", "0.6283372", "0.6271419", "0.6247709", ...
0.79282606
1
utf8 bytes to python unicode str
def utf82unicode(s): return s.decode(encoding='utf-8', errors='ignore')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bytes_to_str(s, encoding='utf-8'):\n if six.PY3 and isinstance(s, bytes):\n return s.decode(encoding)\n return s", "def bytes_to_str(s, encoding='utf-8'):\n if six.PY3 and isinstance(s, bytes):\n return s.decode(encoding)\n return s", "def bytes_to_str(s, encoding='utf-8'):\n i...
[ "0.7507079", "0.7507079", "0.7481168", "0.7395557", "0.7363697", "0.7318634", "0.73154855", "0.7289983", "0.7278981", "0.72236717", "0.7156093", "0.7143345", "0.712737", "0.7084777", "0.7080835", "0.7039472", "0.7031851", "0.7006882", "0.7002018", "0.69774926", "0.69750834", ...
0.62704414
99
python unicode str to utf8 bytes
def unicode2utf8(s): return s.encode(encoding='utf-8', errors='ignore')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _encode_to_utf8(s):\n return s.encode('utf-8')", "def to_utf8(self, _string):\n if isinstance(_string, unicode):\n _string = _string.encode(\"UTF-8\")\n return _string", "def utf8(unicode_str):\n if six.PY2 and isinstance(unicode_str, __unicode__):\n return unicode_str...
[ "0.789065", "0.7747764", "0.75910074", "0.7558442", "0.7461178", "0.74263465", "0.7425319", "0.73928267", "0.7371974", "0.7221622", "0.71997035", "0.71843624", "0.7129607", "0.710285", "0.70867145", "0.7046657", "0.7043448", "0.70384073", "0.70332557", "0.70191157", "0.699912...
0.7969587
0
Returns an estimate of how many documents this query could potentially match (for example, the estimated size of a simple term query is the document frequency of the term). It is permissible to overestimate, but not to underestimate.
def estimate_size(self, ixreader): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_total_number_of_documents(self):\n return self.total_number_of_documents", "def total_estimated_words(self):\n return len(self.sentence) / 5", "def corpus_size():\n return ix.doc_count()", "def count(self, ngram, options):\n return len(self.find_docs(ngram, options))", "def ...
[ "0.65491986", "0.6447662", "0.64241576", "0.6308219", "0.6256283", "0.6234672", "0.6234117", "0.61537194", "0.61186713", "0.60851234", "0.6079203", "0.60769117", "0.6075671", "0.6067316", "0.6062671", "0.60546535", "0.60532045", "0.59717464", "0.5959743", "0.59370553", "0.593...
0.0
-1
Calls the forward on the provided data, but without affecting/using training variables.
def predict(self, *args, **kwargs): return self(*args, **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forward(self, X, training=False):\n pass", "def forward_train(self, *args, **kwargs):\n pass", "def forward(self, *args, mode=\"train\", **kwargs):\n raise NotImplementedError", "def forward_train(self, *args, **kwargs):\n raise NotImplementedError('This interface should not b...
[ "0.81209666", "0.78838", "0.73728895", "0.7231575", "0.71928275", "0.7102799", "0.7079915", "0.703482", "0.69566274", "0.69025844", "0.6871952", "0.6813764", "0.6808116", "0.6781144", "0.67732155", "0.67460984", "0.6735482", "0.6735482", "0.67261505", "0.67126864", "0.6708138...
0.0
-1
Iterate over batches in the dataset and returns a list of the of losses of each batch. This method does not affect training variables and can be used to evaluate the model performance in a different data (such as validation and test sets).
def evaluate(self, dataset, *args, **kwargs): losses = [] for sample in dataset: output = self.predict(sample, *args, **kwargs) losses.append(self.metric_loss(output, sample, *args, **kwargs)) return losses
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_batch_loss(self, batch_data):\n loss = 0\n for data in batch_data:\n x, y = data\n x = x.view(-1,x.shape[0],x.shape[1])\n y = y.view(-1,y.shape[0], y.shape[1])\n loss += self.compute_loss(x.to(self.device), y.to(self.device))\n \n ...
[ "0.71647626", "0.67906415", "0.67728376", "0.6557134", "0.65410614", "0.6533", "0.6533", "0.6399335", "0.6385801", "0.6373669", "0.6288752", "0.62568", "0.6181159", "0.613512", "0.6099078", "0.60927504", "0.6044774", "0.60406625", "0.60303414", "0.6027511", "0.599679", "0.5...
0.6894182
1
Checks if the confusion prevents the current attack
def immobilized(self, owner): messages = [] immobilized = False if self.checkOver(owner, messages): immobilized = False elif self.confused(random.randint(0, 1)): self.doDamage(owner, messages) immobilized = True r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_attack(self):\n\n return self.purpose == 'attack'", "def check_vulnerability(self):\n\t\tpass", "def check_allowed(self):\n if self.state_model.op_state in [\n DevState.FAULT,\n DevState.UNKNOWN,\n DevState.DISABLE,\n ]:\n return False\n\n...
[ "0.7102391", "0.6516199", "0.62073326", "0.62063766", "0.6108665", "0.6108665", "0.6102144", "0.6079558", "0.600544", "0.59991246", "0.59914947", "0.5986069", "0.5942835", "0.59351426", "0.5929831", "0.5911488", "0.582791", "0.5762859", "0.57321775", "0.57292444", "0.5722454"...
0.0
-1
parse table(s) from a Word Document (.docx) into Pandas DataFrame(s)
def read_docx_tables(filename, tab_id=None, **kwargs): def read_docx_tab(tab, **kwargs): vf = io.StringIO() writer = csv.writer(vf) for row in tab.rows: writer.writerow(cell.text for cell in row.cells) vf.seek(0) return pd.read_csv(vf, **kwargs) doc = Documen...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_docx(docx_file, **kwargs):\n ns = {'w': 'http://schemas.openxmlformats.org/wordprocessingml/2006/main'}\n with zipfile.ZipFile(docx_file).open('word/document.xml') as f:\n root = etree.parse(f)\n for el in root.xpath('//w:tbl', namespaces=ns):\n el.tag = 'table'\n for el in root....
[ "0.7392762", "0.72351867", "0.70553774", "0.65633327", "0.60446614", "0.58778", "0.58463025", "0.5658593", "0.56454825", "0.55822045", "0.55814713", "0.5578909", "0.55448884", "0.55115086", "0.5508259", "0.5501753", "0.5501329", "0.54765594", "0.54438335", "0.5425399", "0.540...
0.6212207
4
Visualize a color image
def image_vis(img, ax=None): if ax is None: fig = plt.figure() ax = fig.add_subplot(1, 1, 1) # CHW -> HWC img = img.transpose((1, 2, 0)) ax.imshow(img.astype(np.uint8)) return ax
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_image(image):\r\n plt.imshow(image, cmap='gray')\r\n plt.show()", "def plot_color_image(image):\n plt.imshow(image, interpolation=\"nearest\")\n plt.axis(\"off\")", "def visualizeImg(img):\n plt.figure(figsize=(10,4))\n plt.imshow(img)\n plt.show()", "def show_rgb_img(img):\n retur...
[ "0.77427536", "0.7546661", "0.747081", "0.7363349", "0.6996778", "0.6985246", "0.6968029", "0.69547486", "0.6941524", "0.6932158", "0.6932158", "0.6932158", "0.69201076", "0.68824816", "0.6863322", "0.68544775", "0.68536454", "0.6831093", "0.68017477", "0.68012094", "0.677004...
0.63664997
60
Sets title , x and y label, initializes the x and y limits
def set_up(self): self.h, = self.ax.plot(self.x, lw=2) self.ax.set_ylim(0,100) self.ax.set_xlim(0,100) self.ax.title.set_text(self.config["title"]) self.ax.set_xlabel(self.config["x_label"]) self.ax.set_ylabel(self.config["y_label"])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __createLimits(self):\r\n self.lowerXLabel = QLabel(\"lower limits of (x)\")\r\n self.lowerXField = QLineEdit(self)\r\n self.lowerXField.setPlaceholderText(\"-10\")\r\n\r\n self.upperXLabel = QLabel(\"upper limits of (x)\")\r\n self.upperXField = QLineEdit(self)\r\n se...
[ "0.6769912", "0.6549715", "0.6474373", "0.6474117", "0.63571525", "0.63026917", "0.62767696", "0.6264058", "0.62588245", "0.6190079", "0.6177307", "0.6119817", "0.61111957", "0.6084374", "0.6076514", "0.60667014", "0.5968769", "0.5953797", "0.5935342", "0.59228855", "0.591242...
0.7339217
0
Splits a list into n equal parts
def chunk(iterable, n): iterable = [e for e in iterable] avg_length = int(math.ceil(len(iterable) / n)) return [iterable[i * avg_length:(i + 1) * avg_length] for i in range(n)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split(a, n):\n k, m = divmod(len(a), n)\n ret = [a[i*k+min(i, m):(i+1)*k+min(i+1, m)] for i in range(n)]\n return ret", "def divide_chunks(a_list, n):\n return [a_list[i:i + n] for i in range(0, len(a_list), n)]", "def split(a, n):\n n = min(n, len(a))\n k, m = divmod(len(a), n)\n retu...
[ "0.82351094", "0.8180714", "0.8160528", "0.80372447", "0.79980785", "0.7907051", "0.789344", "0.7883085", "0.78794646", "0.7871949", "0.7853938", "0.78450656", "0.78273165", "0.7824251", "0.7785028", "0.77367926", "0.77367926", "0.77309424", "0.7727871", "0.77180386", "0.7713...
0.75772685
67
Splits a list into batches of size n
def batch(iterable, n): iterable = [e for e in iterable] size = len(iterable) return [iterable[i:i + n] for i in range(0, size, n)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def batches(l, n):\n for i in xrange(0, len(l), n):\n yield l[i:i+n]", "def batches(l, n):\n for i in xrange(0, len(l), n):\n yield l[i:i+n]", "def batches(l, n):\n for i in xrange(0, len(l), n):\n yield l[i:i+n]", "def split_to_batches(iterable, n=1):\n l = len(iterable)\n ...
[ "0.835316", "0.835316", "0.835316", "0.83314914", "0.7985582", "0.7932926", "0.79112965", "0.7890662", "0.7847705", "0.7841402", "0.7818193", "0.7788425", "0.7762736", "0.7730047", "0.7729001", "0.7723097", "0.77107507", "0.77107507", "0.77086455", "0.7687203", "0.76853514", ...
0.7577256
60
Get the code object which represents the compiled Python file. This property is cached and only parses the content once.
def parsed(self): if not self._parsed: self._parsed = compile(self.content, self.path, "exec") return self._parsed
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def code(self):\r\n if (os.path.exists(self._bytecode_path) and\r\n os.path.getmtime(self.full_path) <= os.path.getmtime(self._bytecode_path)):\r\n with open(self._bytecode_path, 'rb') as bytecode:\r\n return marshal.load(bytecode)\r\n else:\r\n with open(self.full_path, 'rb') as sour...
[ "0.80309623", "0.80178577", "0.761211", "0.7101209", "0.7101209", "0.7068245", "0.7006913", "0.6977557", "0.6964024", "0.6865524", "0.6822016", "0.6801215", "0.66854495", "0.6660865", "0.6659816", "0.6596805", "0.65345806", "0.6499262", "0.64816934", "0.64757425", "0.6464226"...
0.71058965
3
Cast geography fields to geometry type when validating uniqueness to remove the reliance on unavailable ~= operator.
def test_geography_unique(self): htown = City.objects.get(name="Houston") CityUnique.objects.create(point=htown.point) duplicate = CityUnique(point=htown.point) msg = "City unique with this Point already exists." with self.assertRaisesMessage(ValidationError, msg): du...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_geom(geom):\n if isinstance(geom, BaseGeometry):\n return geom\n elif isinstance(geom, str): # assume it's a wkt\n return loads(geom)\n elif isinstance(geom, list) and len(geom) == 2: # coordinates\n return Point(geom)", "def normalizeGeometry(geom):\n\t# Convert string...
[ "0.6260974", "0.62050176", "0.6125373", "0.610527", "0.6010191", "0.5934143", "0.5893113", "0.573542", "0.57259893", "0.5578561", "0.55168813", "0.5507094", "0.549569", "0.54358715", "0.5427892", "0.5398686", "0.53870076", "0.5373128", "0.53518975", "0.5346898", "0.53454524",...
0.55543137
10
Test the `w_f_approx()` method with values computed using `scipy.special.wofz()`.
def test_w_f_approx(self): x = np.logspace(-3., 3., 100) y = np.logspace(-3., 3., 100) X, Y = np.meshgrid(x, y) w_f_app = self.gaussian_kappa_ellipse.w_f_approx(X+1j*Y) w_f_scipy = wofz(X+1j*Y) npt.assert_allclose(w_f_app.real, w_f_scipy.real, rtol=4e-5, atol=0) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_fwhm(self):\n for i, func in enumerate(self.fwhm_funcs):\n for j, arr1d in enumerate(self.input_arrays):\n res = func(arr1d)\n assert_allclose(res.fwhm, self.answers[i][j], atol=1e-4)", "def _evaluate(self, w, x, y, z):\n if _isscalar(x):\n ...
[ "0.645775", "0.61831236", "0.6172862", "0.6125837", "0.61175096", "0.61174655", "0.6054809", "0.5898712", "0.5876218", "0.5824651", "0.5793389", "0.5782404", "0.57606804", "0.5760634", "0.57589155", "0.57445526", "0.57148796", "0.5670434", "0.5652321", "0.5648216", "0.5641882...
0.8538672
0
parse a json file on hdfs into a dictionary
def parse_json2dict_hdfs(sc, dir_name, file_name): file_path = os.path.join(dir_name, file_name) sc.addFile(file_path) with open(SparkFiles.get(file_name)) as json_file: content = json_file.read() return byteify(json.loads(content, object_hook=byteify), ignore_dicts=True) # return json.loa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_json_file(self, fname):\n return {}", "def parse_json_from_path(self, infile_path):\r\n with open(infile_path, 'r') as infile:\r\n return self.parse_from_json(infile)", "def json_dict(path):\n json_file=open(path)\n json_str = json_file.read()\n json_data = json.loads(json_str)...
[ "0.6497791", "0.6422381", "0.637966", "0.6346529", "0.63006794", "0.62977976", "0.62975645", "0.61913216", "0.61909026", "0.6163039", "0.6142715", "0.6132705", "0.6122396", "0.6119079", "0.6089422", "0.6076096", "0.6076096", "0.6073556", "0.60657555", "0.60657555", "0.6058010...
0.78886014
0
parse a json file uploaded into a dictionary
def parse_json2dict_upload(file_name): with open(file_name) as dict_file: dict_content = dict_file.read() # 返回字节化的字典 return byteify(json.loads(dict_content, object_hook=byteify), ignore_dicts=True) # return json.loads(dict_content) # return ast.literal_eval(dict_content)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _parse_json(self, file_location: str) -> Dict:\n with open(file_location, mode=\"r\") as json_file:\n raw_json = json.loads(json_file.read())\n return raw_json", "def ingest_json_file(request):\n path = save_file(request) \n try:\n with open(path, encoding='utf-8') as...
[ "0.7149824", "0.70174104", "0.6948303", "0.68862444", "0.6824629", "0.67609507", "0.66862756", "0.6683606", "0.667417", "0.6665659", "0.66583246", "0.6639565", "0.6638207", "0.6638207", "0.6633967", "0.66029507", "0.6602732", "0.65757734", "0.6548045", "0.65301657", "0.651943...
0.7529472
0
Extract link data as features from the context.
def extract( self, pack: DataPack, context: Optional[Annotation] = None ) -> Feature: if self.config is None: raise ProcessorConfigError( "Configuration for the extractor not found." ) index_annotations: List[Annotation] = list( pack.get(s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_features(self):\n self.extract_features_static()\n self.extract_features_dynamic()", "def extractFeatures(self, datum):\n abstract", "def _extract_features(self):\n # print(os.getpid())\n return {n:self._extract_feature(f) for (n,f) in self.features.items()}", "...
[ "0.6760152", "0.66827595", "0.66419166", "0.629859", "0.6094478", "0.60377336", "0.6008946", "0.59788764", "0.58890676", "0.5858884", "0.5797005", "0.5770386", "0.5761613", "0.57616067", "0.574238", "0.57100546", "0.5690778", "0.56568676", "0.56444585", "0.5640194", "0.562587...
0.5603246
22
Read COMPAS object data from a JSON string.
def json_loads(s): return json.loads(s, cls=DataDecoder)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read(fname):\n # Read string from JSON file.\n with open(fname, 'r') as fi:\n serial = fi.read()\n\n # Decode.\n decoder = json.JSONDecoder(object_hook=numpy_hook)\n data = decoder.decode(serial)\n\n return data", "def _load_data_from_str(self, data_as_str):\n try:\n ...
[ "0.6303844", "0.625892", "0.6192657", "0.6159829", "0.6151952", "0.6098237", "0.6073731", "0.6019715", "0.5998748", "0.5959328", "0.59557545", "0.58935", "0.58603454", "0.5846889", "0.58438236", "0.58217627", "0.58202165", "0.5812604", "0.5806856", "0.5797874", "0.5791613", ...
0.584647
14
Sample from a softmax distribution.
def sample_softmax(x : Union[List[float], np.ndarray], t : float = 1): x = np.array(x) x = x - np.max(x) x = np.exp(x / t) x = x / np.sum(x) return np.random.choice(range(len(x)), p = x)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sample_from_softmax_policy(self, batch_state):\n batch_q_values = self.forward(batch_state)\n batch_pi = F.softmax(batch_q_values, dim=1)\n batch_size = batch_pi.shape[0]\n batch_actions = torch.empty(batch_size, 1)\n for i in range(batch_size):\n pi = batch_pi[i, ...
[ "0.69764", "0.6569724", "0.64835894", "0.64835894", "0.64571816", "0.64233273", "0.63840836", "0.63798803", "0.63701445", "0.6357113", "0.62935793", "0.627588", "0.6273231", "0.6256282", "0.6253801", "0.6253801", "0.6253801", "0.6246124", "0.62344235", "0.6179284", "0.6156391...
0.7523831
0
This is Post REST api expected result is fail as status code is not 200
def test_doPost(self) -> None: status_code = apicall.doPost(URL, self._browserheader) assert status_code != API_SUCCESS
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_post(self):\n self.assertEqual(200, self.resp.status_code)", "def test_post(self):\n self.assertEqual(200, self.resp.status_code)", "def test_post(self): \n self.assertEqual(200, self.resp.status_code)", "def test_post(self):\n self.assertEqual(200, self.re...
[ "0.762489", "0.762489", "0.7509563", "0.7430955", "0.740684", "0.72444063", "0.71784866", "0.71688765", "0.71078527", "0.7104422", "0.7031082", "0.69913083", "0.6976978", "0.69753176", "0.69411516", "0.6939505", "0.6876415", "0.6800966", "0.6790501", "0.67541087", "0.67331827...
0.65233296
38
check if 2 grids are equal return boolean value
def grid_equal (grid1, grid2): if grid1 == grid2: return True else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def grid_equal (grid1, grid2):\r\n if grid1 == grid2:\r\n return True\r\n return False", "def grid_equal (grid1, grid2):\r\n for i in range (4):\r\n for j in range (4):\r\n if grid1[i][j] != grid2[i][j]:\r\n return False\r\n return True", "def grid_equal (gri...
[ "0.8914656", "0.87099695", "0.8585009", "0.8558586", "0.8200414", "0.80762106", "0.79177386", "0.7875002", "0.784008", "0.75213224", "0.7462791", "0.7448489", "0.7448489", "0.74154866", "0.7414818", "0.73950034", "0.7244226", "0.7191573", "0.7164593", "0.7132306", "0.71306413...
0.8933384
0
If the timestamp is negative (not set by kafka), it should be reflected as None in the message metadata
def test_timestamp_is_negative(): mock_message.timestamp = Mock(return_value=(1, -1)) new_message = Message(mock_message) assert new_message.value == mock_message.value() assert new_message._raw == mock_message assert new_message._meta.key == mock_message.key() assert new_message._meta.partitio...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_timestamp_is_not_available():\n mock_message.timestamp = Mock(return_value=(0, 0))\n new_message = Message(mock_message)\n\n assert new_message.value == mock_message.value()\n assert new_message._raw == mock_message\n assert new_message._meta.key == mock_message.key()\n assert new_messag...
[ "0.71459144", "0.62150496", "0.5804217", "0.57617605", "0.5738937", "0.5721665", "0.57025474", "0.56683886", "0.5654295", "0.56069356", "0.5603363", "0.56019497", "0.55792874", "0.5564616", "0.55573756", "0.55353737", "0.5531539", "0.54997975", "0.5495634", "0.54765135", "0.5...
0.72654325
0
If the timestamp is 0 and not available, it should be reflected as None in the message metadata
def test_timestamp_is_not_available(): mock_message.timestamp = Mock(return_value=(0, 0)) new_message = Message(mock_message) assert new_message.value == mock_message.value() assert new_message._raw == mock_message assert new_message._meta.key == mock_message.key() assert new_message._meta.part...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_timestamp_is_negative():\n mock_message.timestamp = Mock(return_value=(1, -1))\n new_message = Message(mock_message)\n\n assert new_message.value == mock_message.value()\n assert new_message._raw == mock_message\n assert new_message._meta.key == mock_message.key()\n assert new_message._m...
[ "0.7057385", "0.61804193", "0.6083281", "0.6026797", "0.59391373", "0.5938441", "0.59369254", "0.5936825", "0.5921441", "0.5913083", "0.5903439", "0.58198416", "0.57855564", "0.57849187", "0.5771871", "0.5731976", "0.56881845", "0.56855017", "0.566642", "0.5664509", "0.565861...
0.744637
0
Create a view of `array` which for every point gives the ndimensional neighbourhood of size window. New dimensions are added at the end of `array` or after the corresponding original dimension.
def rolling_window_better(array, window=(0,), asteps=None, wsteps=None, axes=None, toend=True): array = np.asarray(array) orig_shape = np.asarray(array.shape) window = np.atleast_1d(window).astype(int) # maybe crude to cast to int... if axes is not None: axes = np.atleast_1d(axes) w...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def expand_dims(array):\n return array[np.newaxis, np.newaxis, ...]", "def window_blocks(large_array, window_size):\n y_size = large_array.shape[0]/window_size\n blocks_array = large_array.reshape(y_size, window_size)\n return blocks_array", "def rolling_window(array, window):\n shape = array.sh...
[ "0.66081053", "0.6360102", "0.6086337", "0.6076989", "0.5899036", "0.5898784", "0.5864093", "0.5851059", "0.58076084", "0.57797295", "0.5767237", "0.5639638", "0.56304556", "0.5614217", "0.5592851", "0.55643237", "0.5562221", "0.5546096", "0.55438805", "0.5539408", "0.5504820...
0.55665666
15
Split labels_ into labels_row_ and labels_col_
def _split_vars(self, n_row): self.embedding_row_ = self.embedding_[:n_row] self.embedding_col_ = self.embedding_[n_row:] self.embedding_ = self.embedding_row_ return self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unpack_labels(self, labels,\n is_box = False):\n unpacked_labels = {}\n count = 0\n for level in range(self.min_level, self.max_level + 1):\n feat_size_y = tf.cast(self.image_size[0] / 2 ** level, tf.int32)\n feat_size_x = tf.cast(self.image_size[1] / 2 ** level, tf.int32)...
[ "0.6617698", "0.6444378", "0.63443524", "0.6303607", "0.62101483", "0.6194093", "0.617766", "0.61467004", "0.6146654", "0.6141428", "0.61044294", "0.6101433", "0.6092476", "0.60638714", "0.60529196", "0.6020905", "0.601322", "0.5994954", "0.59757525", "0.5969096", "0.5966928"...
0.0
-1
r""" Unit conversion (ms)
def convert_execute_time_to_ms(value): units = ['ns', 'µs', 'ms', 's'] unified_unit_index = 2 # ms # match time string format: 22.22us match_time = re.search(r'(\d*[\.]*\d*)(\w+)', value) execution_time = float(match_time.group(1)) time_unit = match_time.group(2) if time_unit not in units:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _unit_ms(self):\n return (self.time_base / 1000.0) / 60.0", "def unit_of_measurement(self) -> str:\n return MS", "def unit_ms(self):\n return (self.time_base / 1000.0) / 60.0", "def test_ms2min(self):\n result = round(TimeUnit(50, 'ms', 'min').doconvert(), 4)\n self.ass...
[ "0.7893714", "0.76256883", "0.7606962", "0.7207754", "0.7145342", "0.70552766", "0.7055099", "0.70255965", "0.69903594", "0.6901484", "0.68101496", "0.6796152", "0.67126644", "0.6687243", "0.6684979", "0.6684979", "0.6661508", "0.6636671", "0.66325575", "0.6626533", "0.661742...
0.65088755
28
r""" Unit conversion (ms)
def execute_time(self, value): # unfied unit and rounded to two decimals unfied_execute_time = convert_execute_time_to_ms(value) self._execute_time = round(unfied_execute_time, 2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _unit_ms(self):\n return (self.time_base / 1000.0) / 60.0", "def unit_of_measurement(self) -> str:\n return MS", "def unit_ms(self):\n return (self.time_base / 1000.0) / 60.0", "def test_ms2min(self):\n result = round(TimeUnit(50, 'ms', 'min').doconvert(), 4)\n self.ass...
[ "0.7893714", "0.76256883", "0.7606962", "0.7207754", "0.7145342", "0.70552766", "0.7055099", "0.70255965", "0.69903594", "0.6901484", "0.68101496", "0.6796152", "0.67126644", "0.6687243", "0.6684979", "0.6684979", "0.6661508", "0.6636671", "0.66325575", "0.6626533", "0.661742...
0.0
-1
r""" Recursive extract join tree from the root node data data node must be join type.
def extract_join_info(node): operator_info = node['operatorInfo'] analyze_info = node['AnalyzeInfo'] if 'Join' in node['id']: # Join Node join_type = extract_join_type(operator_info) conditions = extract_join_conditions(operator_info) current_node = JoinPlan(join_type, condi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testCorrectJoin(self):\n b_tree = OOBTree()\n b_tree.update({1: \"Monkey D. Luffy\", 2: \"Roronoa Zoro\", 3: \"Nami\"})\n failed_counter = 0\n key = 1\n data = {\"from\":\"East Blue\"}\n (mod_data, mod_tree, failed_counter) = self.processing.join(b_tree, key, data, fai...
[ "0.6225024", "0.57793206", "0.5416884", "0.53980875", "0.5371879", "0.53369486", "0.53081393", "0.53014165", "0.5278884", "0.5260483", "0.5222885", "0.52102673", "0.519504", "0.5193261", "0.5169744", "0.5169327", "0.5137751", "0.5124536", "0.51232505", "0.51178175", "0.509967...
0.6396678
0
Create an instance of EoTRandomAffinePyTorch.
def __init__( self, nb_samples: int, clip_values: Tuple[float, float], degree: float, translate: List[float] = [0.0, 0.0], scale: List[float] = [1.0, 1.0], apply_fit: bool = False, apply_predict: bool = True, ) -> None: super().__init__( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def affine_trans(self):\n h, w, _ = self.img.shape\n\n \"\"\"\n pts1 = np.float32(\n [\n [randint(0, rows), randint(0, cols)],\n [randint(0, rows), randint(0, cols)],\n [randint(0, rows), randint(0, cols)],\n ]\n )\n ...
[ "0.5811028", "0.5593739", "0.5526075", "0.54783726", "0.5455869", "0.53046626", "0.52877545", "0.52203125", "0.5171621", "0.5160332", "0.5155644", "0.51184356", "0.5107178", "0.5062412", "0.5055823", "0.502846", "0.501191", "0.50101507", "0.49590996", "0.49539426", "0.4948892...
0.0
-1
Creates a Conv2D message in the specified protobuf format
def makeConv2DMessage(conv_layer, layer_callback): kernel_size = list(conv_layer.kernel_size) stride = list(conv_layer.stride) padding = list(conv_layer.padding) dilation = list(conv_layer.dilation) weights = torch.flatten(conv_layer.weight.data).numpy().tolist() bias_present = False if co...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_datum( img, label ):\n return caffe_pb2.Datum( channels=3, width=img.shape[1], height=img.shape[0],\n label=label, data=np.rollaxis(img, 2).tostring())", "def create_from_pb2(cls, pb2_obj: _DetectionProto) -> 'Detection':\n categories = []\n keypoints = []\n\n for idx, score in enumerate(...
[ "0.59721273", "0.5666284", "0.5624164", "0.56058335", "0.55747026", "0.5525985", "0.54438275", "0.54363924", "0.54352313", "0.5423963", "0.5408764", "0.5366068", "0.53651476", "0.5356964", "0.533114", "0.53221387", "0.53207964", "0.5312145", "0.52808297", "0.5269769", "0.5267...
0.6507097
0
Creates a Sigmoid Activation message in the specified protobuf format
def makeSigmoidMessage(layer_callback): layer_callback.type = 5 layer_callback.act.type = 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_sigmoid(self):\n activation_name = 'Sigmoid'\n args = {}\n\n activation = activation_factory.create(activation_name, **args)\n self.assertEqual(activation._get_name(), activation_name)\n\n x = torch.empty(10)\n y = activation(x)\n assert_array_equal(y, torc...
[ "0.6356937", "0.6255257", "0.62285084", "0.60508984", "0.58609265", "0.5741726", "0.5741381", "0.57225883", "0.5713638", "0.5680143", "0.5605521", "0.55998635", "0.55864185", "0.55861324", "0.55722415", "0.5563115", "0.55580914", "0.55580914", "0.5541464", "0.554058", "0.5511...
0.7003909
0
The topic name to which this routine subscribes.
def topic_name( self ): return Constants.TopicNames.TMP36Volts2CentigradeStep
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def topic(self):\n return self._topic_name", "def topic(self) -> str:\n return self._topic", "def __get_topic(self) -> str:\n\t\treturn os.getenv('MQTT_DRIVEN_TOPIC', 'app/event')", "def kafka_topic(self) -> str:\n return self._kafka_topic", "def topic(self):\n return self.confi...
[ "0.8290344", "0.7857479", "0.7763859", "0.772341", "0.76762116", "0.7624991", "0.761631", "0.75047714", "0.7446853", "0.7295065", "0.72786874", "0.72563225", "0.72202724", "0.705012", "0.70395416", "0.7038251", "0.6979839", "0.6861829", "0.6726751", "0.6633332", "0.6632931", ...
0.6755075
18
Set the logger name. This needs to be added to house_monitoring_logging.conf
def logger_name( self ): return Constants.LogKeys.steps
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rename(self, name):\n self._name = name\n self._logger = logging.getLogger(name)\n self._logger.setLevel(self._level)", "def plog_use_logger(name):\r\n global logger, loglevels\r\n logger = logging.getLogger(name)", "def log_name(self) -> Optional[str]:\n return self._log_name...
[ "0.7469645", "0.69028306", "0.6808502", "0.667052", "0.6661131", "0.6651183", "0.66152275", "0.66138965", "0.64757454", "0.6454443", "0.6447923", "0.64411664", "0.64059615", "0.6372161", "0.63544333", "0.63477993", "0.63377064", "0.6247669", "0.61736137", "0.6166142", "0.6150...
0.62850153
17
split line into dict of fields, and append some data according to line
def inner(): for line in file_obj: logdata = tilak_haproxylog.parse_line(line) if logdata is not None: logdata["hits"] = 1 for value_key in value_keynames: if value_key not in logdata: logdata[value_key] = 0 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _parse_line(self, line):\n fields = line.split('|', 4) # stop splitting after fourth | found\n line_info = {'raw_message': line}\n if len(fields) == 5:\n line_info.update(dict(zip(self._fieldnames, fields)))\n return line_info", "def split(self, line):\n parts =...
[ "0.7134842", "0.6989714", "0.65005213", "0.6490106", "0.6313594", "0.6297368", "0.6275981", "0.6269996", "0.6256164", "0.6221441", "0.61952657", "0.61724025", "0.61245376", "0.610096", "0.60672164", "0.6064664", "0.602788", "0.5993243", "0.5990225", "0.5983162", "0.59480417",...
0.0
-1
create CSV like file with StringIO
def generate_datalogger_csv(logdir, datestring, keys, values, ts_keyname): if datestring == datetime.date.today().isoformat(): logging.error("todays Logs are actually written and cannot used in datalogger") return headers = [ts_keyname, ] + list(keys) + list(values) linebuffer = [] lineb...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_csv_file_obj(self, rows):\n output = StringIO.StringIO()\n writer = csv.writer(output)\n writer.writerows(rows)\n return output", "def generate_csv_file(rows: Collection[dict[str, str]]):\n file = io.StringIO()\n csv_writer = csv.DictWriter(file, (\"label\", \"inv...
[ "0.7161255", "0.693741", "0.6911866", "0.6720335", "0.6594665", "0.6552549", "0.6510752", "0.65039057", "0.6355445", "0.629252", "0.6264264", "0.61657834", "0.6098117", "0.60459083", "0.60171694", "0.6010695", "0.5978563", "0.59070265", "0.5885642", "0.586393", "0.5841963", ...
0.59030396
18
convert string in format YYYYMMDD into date object
def datestring_to_date(datestring): year, month, day = datestring.split("-") date = datetime.date(year=int(year), month=int(month), day=int(day)) return date
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def string_to_date(string):\n params = string.strip().split('-')\n year = int(params[0])\n month = int(params[1])\n day = int(params[2])\n d = date(year, month, day)\n return d", "def str_to_date(str_input):\n date = str_input.split('-')\n return dt.date(int(date[0...
[ "0.7919252", "0.76031214", "0.7577364", "0.7537934", "0.7410421", "0.71575046", "0.7152921", "0.71462893", "0.7123076", "0.71200943", "0.7075329", "0.70734406", "0.7017597", "0.7006403", "0.70054543", "0.69766206", "0.6960586", "0.695634", "0.6942011", "0.693959", "0.6936646"...
0.726246
5
clean up any weird text that would break xml name tag formatting.
def cleanLabel(label): if label.startswith('^'): label = label[1:] + '_prexisting' label = label.replace('?', 'Q') # happens with mRnaCompare filter labels return label
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _process_name(name):\n\n # Unescape HTML entities\n name = unescape(name)\n\n # Remove bracketed stuff on the end\n name = NG_RE.sub('', name).strip() # Nomenclature groups\n name = END_RE.sub('', name).strip(', ') # Words\n name = RATIO_RE.sub('', name).strip(', ') # Ratios\n\n # Remov...
[ "0.68991137", "0.67728376", "0.67570674", "0.66739416", "0.6631625", "0.6610066", "0.65658", "0.6521895", "0.6486077", "0.6450203", "0.64252394", "0.6393617", "0.63427913", "0.6339716", "0.63312113", "0.6317761", "0.6315477", "0.63111675", "0.6280022", "0.6245489", "0.6237489...
0.0
-1
for a list of TranscriptAnnotations, create a list that contains no duplicate heirarchies.
def flattenAnnotations(transcriptAnnotations): root = StatNode() root.name = 'not_ok' for ta in transcriptAnnotations: pos = root # descend the implicit heirarchy of the labels and build a tree for label in ta.labels: label = cleanLabel(label) if label not in pos.childrenNames: n =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _remove_duplicates(input_list):\n return list(OrderedDict.fromkeys(input_list))", "def remove_duplicates(input_list):\n return list(dict.fromkeys(input_list))", "def uniq(listinput):\n\t\"\"\" This will be provided for the student. \"\"\"\n\toutput = []\n\tfor x in listinput:\n\t\tif x not in output:...
[ "0.5937925", "0.5794307", "0.5769347", "0.5633134", "0.5611898", "0.5602201", "0.5591378", "0.5588073", "0.5584934", "0.555694", "0.55319834", "0.553135", "0.54964066", "0.5479843", "0.54641867", "0.545365", "0.5434244", "0.54171443", "0.54149956", "0.5405248", "0.53869027", ...
0.5999212
0
The Amazon Resource Name (ARN) of the Lambda function that will be used to decode the access token created by the authorization server.
def idp_lambda_arn(self) -> Optional[pulumi.Input[str]]: return pulumi.get(self, "idp_lambda_arn")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lambda_arn_lookup(session, lambda_name):\n if session is None:\n return None\n\n client = session.client(\"lambda\")\n response = client.get_function(FunctionName=lambda_name)\n if response is None:\n return None\n else:\n return response['Configuration']['FunctionArn']", ...
[ "0.66945344", "0.66296077", "0.62236685", "0.609313", "0.609313", "0.6063506", "0.6040473", "0.59884787", "0.59884787", "0.59884787", "0.59884787", "0.59884787", "0.59884787", "0.59884787", "0.59884787", "0.59884787", "0.59884787", "0.59884787", "0.59884787", "0.59884787", "0...
0.64016044
2
The customermanagedkey (CMK) used when creating a Data Store. If a customer owned key is not specified, an AWS owned key will be used for encryption.
def __init__(__self__, *, cmk_type: pulumi.Input['FhirDatastoreKmsEncryptionConfigCmkType'], kms_key_id: Optional[pulumi.Input[str]] = None): pulumi.set(__self__, "cmk_type", cmk_type) if kms_key_id is not None: pulumi.set(__self__, "kms_key_id", kms_key_id)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def customer_managed_key_encryption(self) -> Optional[pulumi.Input['ClusterPropertiesCustomerManagedKeyEncryptionArgs']]:\n return pulumi.get(self, \"customer_managed_key_encryption\")", "def kms_key(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"kms_key\")", "def kms_key(self) -> Option...
[ "0.7549974", "0.677194", "0.6660802", "0.65285224", "0.6471129", "0.6471129", "0.6471129", "0.6471129", "0.6462255", "0.6374206", "0.6374206", "0.6374206", "0.6374206", "0.6374206", "0.6250203", "0.6149054", "0.6149054", "0.6149054", "0.6116679", "0.6116679", "0.6110464", "...
0.5394026
52
A keyvalue pair. A tag consists of a tag key and a tag value. Tag keys and tag values are both required, but tag values can be empty (null) strings.
def __init__(__self__, *, key: pulumi.Input[str], value: pulumi.Input[str]): pulumi.set(__self__, "key", key) pulumi.set(__self__, "value", value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_tag_key_value(key_value: str, value_required=True) -> Tuple[str, Any]:\n if not key_value:\n raise ValueError(\"key must be specified.\")\n\n if \"=\" not in key_value:\n if value_required:\n raise ValueError(f\"key=value pair expected: '{key_value}'\")\n return (key...
[ "0.685107", "0.64542276", "0.60178965", "0.5632052", "0.56062156", "0.5548841", "0.5536213", "0.54951835", "0.54703075", "0.5439231", "0.54334384", "0.5392088", "0.53913426", "0.53571194", "0.5283122", "0.5253015", "0.52526695", "0.5182586", "0.5178686", "0.5175563", "0.51545...
0.0
-1
The key of the tag.
def key(self) -> pulumi.Input[str]: return pulumi.get(self, "key")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tag_key(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"tag_key\")", "def tag_key(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"tag_key\")", "def key(self) -> \"str\":\n return self._attrs.get(\"key\")", "def key(self):\n return key_for_name(self.name)", "d...
[ "0.84898543", "0.84898543", "0.8288552", "0.81219745", "0.8093125", "0.8014419", "0.7971125", "0.7935384", "0.7935384", "0.7935384", "0.7935384", "0.7926913", "0.7926913", "0.7926913", "0.7926913", "0.7926913", "0.7926913", "0.7926913", "0.7926913", "0.7926913", "0.7926913", ...
0.0
-1
The value of the tag.
def value(self) -> pulumi.Input[str]: return pulumi.get(self, "value")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tag_value(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"tag_value\")", "def value(self):\n return self.element.get_attribute('value')", "def value(self):\n return self.element.get_attribute('value')", "def value(self):\n return self.element.get_attribute('v...
[ "0.82383764", "0.785411", "0.785411", "0.785411", "0.7756515", "0.77040124", "0.77033937", "0.76801986", "0.7640115", "0.7635428", "0.75873566", "0.75873566", "0.75873566", "0.75873566", "0.75873566", "0.75873566", "0.75873566", "0.75873566", "0.75873566", "0.75873566", "0.75...
0.73069435
82
Return the list of platforms the plugin is available for.
def platform(): return ['linux']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def platforms(self):\n logger.debug(\"Get platforms\")\n return self._raw_api.platforms.get()", "def platforms(self) -> Any:\n\n return search_api(\"platforms\")", "def Platforms():\n return platforms", "def list_platforms(self):\n return self.do_rpc('list_platforms')", "def ...
[ "0.85451066", "0.85076827", "0.8496267", "0.8486667", "0.8091293", "0.8080378", "0.79298854", "0.7464367", "0.7254925", "0.72508", "0.7138831", "0.7036631", "0.6925982", "0.6661122", "0.65201426", "0.64277816", "0.6384982", "0.63784766", "0.63503206", "0.6322077", "0.6321469"...
0.64176804
16