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 |
|---|---|---|---|---|---|---|
Create a DataFrame with the levels of the MultiIndex as columns. Column ordering is determined by the DataFrame constructor with data as a dict. | def to_frame(
self,
index: bool = True,
name=lib.no_default,
allow_duplicates: bool = False,
) -> DataFrame:
from pandas import DataFrame
if name is not lib.no_default:
if not is_list_like(name):
raise TypeError("'name' must be a list / se... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_multi_index_data_frame(data_frames: list, sub_header: list, header_columns: list) -> pd.DataFrame:\r\n\r\n tuples = build_multi_index_tuples(header_columns, sub_header)\r\n\r\n multi_header = pd.MultiIndex.from_tuples(tuples)\r\n\r\n df = pd.concat(data_frames, axis=1).loc[:, dict(tuples).keys()... | [
"0.70277464",
"0.6877731",
"0.68394387",
"0.6486251",
"0.63666445",
"0.6252275",
"0.5973582",
"0.5972855",
"0.5968527",
"0.59421885",
"0.59358686",
"0.5903799",
"0.5856466",
"0.5850365",
"0.5832864",
"0.58110815",
"0.580311",
"0.5745067",
"0.5742697",
"0.57394814",
"0.5734639... | 0.6281439 | 5 |
Convert a MultiIndex to an Index of Tuples containing the level values. Returns pd.Index Index with the MultiIndex data represented in Tuples. See Also | def to_flat_index(self) -> Index: # type: ignore[override]
return Index(self._values, tupleize_cols=False) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_level_values(self, level: Union[int, Name]) -> Index:\n level = self._get_level_number(level)\n index_scol = self._internal.index_spark_columns[level]\n index_name = self._internal.index_names[level]\n index_field = self._internal.index_fields[level]\n internal = self._in... | [
"0.6654773",
"0.65434396",
"0.6390498",
"0.62782615",
"0.6262326",
"0.6230774",
"0.5940825",
"0.5918135",
"0.5889361",
"0.58864444",
"0.5844536",
"0.5824272",
"0.5815919",
"0.5757884",
"0.57234967",
"0.56859905",
"0.5666543",
"0.5645326",
"0.56252307",
"0.5598215",
"0.5597644... | 0.6084777 | 6 |
Compute and return the lexsort_depth, the number of levels of the MultiIndex that are sorted lexically Returns int | def _lexsort_depth(self) -> int:
if self.sortorder is not None:
return self.sortorder
return _lexsort_depth(self.codes, self.nlevels) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _lexsort_depth(codes: list[np.ndarray], nlevels: int) -> int:\n int64_codes = [ensure_int64(level_codes) for level_codes in codes]\n for k in range(nlevels, 0, -1):\n if libalgos.is_lexsorted(int64_codes[:k]):\n return k\n return 0",
"def _is_lexsorted(self) -> bool:\n retur... | [
"0.7385462",
"0.6377727",
"0.60690886",
"0.60381955",
"0.56702554",
"0.5659035",
"0.56430185",
"0.5625883",
"0.558787",
"0.5585491",
"0.54812646",
"0.5478165",
"0.5451932",
"0.5448635",
"0.54420763",
"0.54401124",
"0.5437833",
"0.5417721",
"0.5400968",
"0.53594816",
"0.535705... | 0.8027731 | 0 |
This is an internal function. Create a new MultiIndex from the current to monotonically sorted items IN the levels. This does not actually make the entire MultiIndex monotonic, JUST the levels. The resulting MultiIndex will have the same outward appearance, meaning the same .values and ordering. It will also be .equals... | def _sort_levels_monotonic(self, raise_if_incomparable: bool = False) -> MultiIndex:
if self._is_lexsorted() and self.is_monotonic_increasing:
return self
new_levels = []
new_codes = []
for lev, level_codes in zip(self.levels, self.codes):
if not lev.is_monotoni... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_unused_levels(self) -> MultiIndex:\n new_levels = []\n new_codes = []\n\n changed = False\n for lev, level_codes in zip(self.levels, self.codes):\n # Since few levels are typically unused, bincount() is more\n # efficient than unique() - however it only ... | [
"0.5954812",
"0.54548645",
"0.53807276",
"0.52991354",
"0.52768683",
"0.5166339",
"0.4997292",
"0.4974434",
"0.49533498",
"0.48740384",
"0.4789813",
"0.47135466",
"0.46916574",
"0.46884668",
"0.4613576",
"0.4597405",
"0.4597138",
"0.45930836",
"0.45610586",
"0.45311022",
"0.4... | 0.72205967 | 0 |
Create new MultiIndex from current that removes unused levels. Unused level(s) means levels that are not expressed in the labels. The resulting MultiIndex will have the same outward appearance, meaning the same .values and ordering. It will also be .equals() to the original. Returns MultiIndex Examples >>> mi = pd.Mult... | def remove_unused_levels(self) -> MultiIndex:
new_levels = []
new_codes = []
changed = False
for lev, level_codes in zip(self.levels, self.codes):
# Since few levels are typically unused, bincount() is more
# efficient than unique() - however it only accepts posi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def maybe_mi_droplevels(indexer, levels):\n new_index = self[indexer]\n\n for i in sorted(levels, reverse=True):\n new_index = new_index._drop_level_numbers([i])\n\n return new_index",
"def drop_duplicate_levels(self, keep='last', axis=1, inplace=False):\n\n ... | [
"0.64183295",
"0.6152343",
"0.5993427",
"0.59387267",
"0.5914575",
"0.58656716",
"0.5614754",
"0.54434067",
"0.54245543",
"0.5393707",
"0.53626764",
"0.5300463",
"0.5259481",
"0.52122736",
"0.5204181",
"0.5198902",
"0.5162747",
"0.5135656",
"0.51253617",
"0.5004618",
"0.49938... | 0.70321494 | 0 |
Swap level i with level j. Calling this method does not change the ordering of the values. | def swaplevel(self, i=-2, j=-1) -> MultiIndex:
new_levels = list(self.levels)
new_codes = list(self.codes)
new_names = list(self.names)
i = self._get_level_number(i)
j = self._get_level_number(j)
new_levels[i], new_levels[j] = new_levels[j], new_levels[i]
new_co... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _swap(self, i, j):\n self._data[i], self._data[j] = self._data[j], self._data[i]",
"def _swap(self, i, j):\n self._data[i], self._data[j] = self._data[j], self._data[i]",
"def _swap(self, i, j):\n self._data[i], self._data[j] = self._data[j], self._data[i]",
"def _swap(self, i, j, k):\n\t\ti... | [
"0.73458374",
"0.73458374",
"0.7294086",
"0.7292467",
"0.7273556",
"0.7194417",
"0.7175104",
"0.71259874",
"0.7114592",
"0.7006293",
"0.69037265",
"0.68555343",
"0.6693857",
"0.6670536",
"0.664536",
"0.66437215",
"0.6585129",
"0.6562594",
"0.65603286",
"0.6547494",
"0.6513952... | 0.74510264 | 0 |
Slice index between two labels / tuples, return new MultiIndex. | def truncate(self, before=None, after=None) -> MultiIndex:
if after and before and after < before:
raise ValueError("after < before")
i, j = self.levels[0].slice_locs(before, after)
left, right = self.slice_locs(before, after)
new_levels = list(self.levels)
new_leve... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_index(cls, df, selector, start=None, stop=None, names=[]):\n\n assert cls.is_selector(selector)\n\n tuples = cls.get_tuples(df, selector, start, stop)\n if not tuples:\n raise ValueError('no tuples matching selector found')\n\n # XXX This probably could be made faster... | [
"0.6536686",
"0.6037534",
"0.5943314",
"0.5835507",
"0.5824985",
"0.57659537",
"0.5740893",
"0.57109267",
"0.56019133",
"0.5578686",
"0.5508475",
"0.549459",
"0.5400519",
"0.53239614",
"0.53100234",
"0.53050214",
"0.5281642",
"0.52782875",
"0.5255756",
"0.5242891",
"0.5227938... | 0.4968026 | 50 |
Coerce the arraylike indexer to the smallest integer dtype that can encode all of the given categories. | def _coerce_indexer_frozen(array_like, categories, copy: bool = False) -> np.ndarray:
array_like = coerce_indexer_dtype(array_like, categories)
if copy:
array_like = array_like.copy()
array_like.flags.writeable = False
return array_like | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encode_categorical(df):\n cat_cols = df.select_dtypes(\"category\").columns\n for col in cat_cols:\n df[col] = df[col].cat.codes + 1\n unique_no = len(df[col].unique())\n if unique_no < 50:\n df[col] = df[col].astype(\"uint8\")\n elif unique_no < 16000:\n ... | [
"0.6735268",
"0.6106485",
"0.6035604",
"0.5996344",
"0.59342873",
"0.592266",
"0.58900285",
"0.58890307",
"0.58890307",
"0.58890307",
"0.58890307",
"0.58390737",
"0.57942784",
"0.5759401",
"0.574761",
"0.5687597",
"0.5676159",
"0.55336756",
"0.55336756",
"0.5487576",
"0.54527... | 0.6198376 | 1 |
Get a random element from the collection. | def getRandom(self) -> int:
return random.choice(self.items) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_element(self) -> 'PFElement':\n return random.choice(list(iter(self)))",
"def _rand_elem(self, iterable):\n\n lst = list(iterable)\n idx = self._rand_int(0, len(lst))\n return lst[idx]",
"def getRandom(self):\n random_index = randint(0, len(self.list_val)-1)\n ... | [
"0.7651958",
"0.7149041",
"0.70814615",
"0.7044879",
"0.70404017",
"0.7034526",
"0.6959262",
"0.69563407",
"0.68719393",
"0.68376184",
"0.6797525",
"0.670551",
"0.6697882",
"0.6692588",
"0.6692588",
"0.6692588",
"0.6692588",
"0.66815263",
"0.66744214",
"0.66513956",
"0.663908... | 0.6673934 | 19 |
creates a new superuser just created | def create_superuser(self,email,name,password):
user = self.create_user(email, name, password)
user.is_superuser = True
user.is_staff = True
user.save(using=self._db)
return user | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_superuser(self, username, email, password):\n print(\"creating super user....\")\n user = self.create_user(\n\n username=username,\n password=password,\n email = email,\n commit=False,\n )\n user.is_staff = True\n user.is_sup... | [
"0.78085625",
"0.77692896",
"0.77619183",
"0.77399",
"0.75911707",
"0.757191",
"0.75698984",
"0.7533488",
"0.7508352",
"0.7494578",
"0.74885756",
"0.74884254",
"0.74800944",
"0.7480034",
"0.7475248",
"0.7474135",
"0.745501",
"0.74531764",
"0.74500483",
"0.7447716",
"0.7434037... | 0.7629331 | 4 |
A perfect power is a positive integer n of the form m^k, where m>1 is a positive integer and k>=2. This function returns [m, K]. | def perfect_power(n: int):
k = 2
max_k = round(n ** (1/2))
while True:
m = round(n ** (1/k))
if m ** k == n:
return [m, k]
elif k > max_k:
return None
else:
k += 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def power_representation(n, p, k, zeros=False):\n n, p, k = [as_int(i) for i in (n, p, k)]\n\n if n < 0:\n if p % 2:\n for t in power_representation(-n, p, k, zeros):\n yield tuple(-i for i in t)\n return\n\n if p < 1 or k < 1:\n raise ValueError(filldedent('... | [
"0.679824",
"0.66985",
"0.6617389",
"0.6595739",
"0.6545694",
"0.65331304",
"0.6508546",
"0.6452992",
"0.6445225",
"0.63938683",
"0.6377683",
"0.6373241",
"0.6370152",
"0.63428986",
"0.63234127",
"0.6323138",
"0.631711",
"0.6306986",
"0.6303868",
"0.6283668",
"0.62678844",
... | 0.8165863 | 0 |
Constructs an array of booleans where an item is True if its position is in ``indices`` otherwise it is False. This can be viewed as the inverse of | def boolmask(indices, shape=None):
indices = np.asanyarray(indices)
if indices.dtype.kind not in {'i', 'u'}:
indices = indices.astype(int)
if shape is None:
shape = indices.max() + 1
mask = np.zeros(shape, dtype=bool)
if mask.ndim > 1:
mask[tuple(indices.T)] = True
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bool_2_indices(bool_array):\n if ~isinstance(bool_array, np.ndarray):\n bool_array = np.array(bool_array)\n if bool_array[-1]:\n bool_array[-1] = False\n lims = np.arange(bool_array.size)[bool_array ^ np.roll(bool_array, 1)]\n if len(lims) > 0:\n if lims[-1] == bool_array.size ... | [
"0.676458",
"0.641625",
"0.6258842",
"0.624677",
"0.6062399",
"0.6033272",
"0.5918816",
"0.5802164",
"0.5790047",
"0.57650036",
"0.5590764",
"0.55403525",
"0.55307055",
"0.54913014",
"0.5486312",
"0.5405002",
"0.53583485",
"0.5352769",
"0.53451174",
"0.5342532",
"0.53240883",... | 0.73741686 | 0 |
Returns the top ``num`` minimum indicies. This can be significantly faster than using argsort. | def argminima(arr, num, axis=None, ordered=True):
if axis is not None:
# TODO: implement this directly for argminima
# if 0:
# return argmaxima(-arr, num=num, axis=axis, ordered=ordered)
# # raise NotImplementedError('axis must be None for now, can use argmaxima(-arr) with axis i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def top_indices(preds, num):\n sort_preds = np.sort(preds, 1)\n sort_preds = np.flip(sort_preds)\n sort_index = np.argsort(preds, 1)\n sort_index = np.flip(sort_index)\n\n print(f\"Top {num} results:\")\n for i in range(num):\n print(sort_index[0][i], sort_preds[0][i])\n\n return 0",
... | [
"0.7418698",
"0.7147127",
"0.6476449",
"0.61975807",
"0.61156195",
"0.6089095",
"0.59301776",
"0.59248763",
"0.589006",
"0.5882065",
"0.5865648",
"0.5806599",
"0.5789689",
"0.5760827",
"0.57488984",
"0.5728192",
"0.57275623",
"0.5707767",
"0.5677608",
"0.5654873",
"0.5653699"... | 0.52173555 | 61 |
Like unique, but works on rows | def unique_rows(arr, ordered=False, return_index=False):
dtype_view = np.dtype((np.void, arr.dtype.itemsize * arr.shape[1]))
arr_view = arr.view(dtype_view)
if ordered:
arr_view_unique, idxs = np.unique(arr_view, return_index=True)
idxs.sort()
arr_flat_unique = arr_view[idxs].view(ar... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unique_rows(data, digits=None):\n hashes = hashable_rows(data, digits=digits)\n garbage, unique, inverse = np.unique(hashes,\n return_index=True,\n return_inverse=True)\n return unique, inverse",
"def uniqueRows(a):\n ... | [
"0.69672424",
"0.6963373",
"0.6865881",
"0.6846622",
"0.68000805",
"0.6762686",
"0.669262",
"0.6674285",
"0.66658926",
"0.6631138",
"0.6590475",
"0.65817136",
"0.6575414",
"0.6536839",
"0.64441615",
"0.64194566",
"0.63965786",
"0.63751423",
"0.6253804",
"0.62278455",
"0.61671... | 0.62918735 | 18 |
A generalization of the logistic / sigmoid functions that allows for flexible specification of Sshaped curve. This is also known as a "Richards curve" [WikiRichardsCurve]_. | def generalized_logistic(x, floor=0, capacity=1, C=1, y_intercept=None, Q=None, growth=1, v=1):
A = floor
K = capacity
C = C
B = growth
if y_intercept is not None:
if Q is not None:
raise AssertionError('cannot specify Q and y_intercept')
Q = -C + ((A - K) / (A - y_interc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_sigmoidal_curve(\n y_low=0,\n y_high=1.,\n x_start=0,\n x_inflect=0.5,\n multiplier=1.):\n amplitude = y_high - y_low\n if amplitude == 0:\n\n def curve(x):\n return y_low\n\n return curve\n\n x_delta = x_inflect - x_start\n slope_at_... | [
"0.6601383",
"0.6280292",
"0.62607616",
"0.6172488",
"0.6172488",
"0.61618966",
"0.60993767",
"0.60931927",
"0.6071893",
"0.60710996",
"0.60702044",
"0.6062761",
"0.6051798",
"0.6047526",
"0.6046183",
"0.6046183",
"0.6046183",
"0.6046183",
"0.6046183",
"0.6046183",
"0.6036991... | 0.0 | -1 |
Disable missing svn access; raise NotFound.. | def test_disable_missing_svn_access(self):
svn = SpokeSVN(self.org_name, self.user_id)
svn.delete(self.svn_repo_name)
self.assertRaises(error.NotFound, svn.modify, enable=False) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_enable_missing_svn_access(self):\n svn = SpokeSVN(self.org_name, self.user_id)\n svn.delete(self.svn_repo_name)\n self.assertRaises(error.NotFound, svn.modify, enable=True)",
"def test_disable_svn_access(self):\n org = 'o=%s' % (self.org_name)\n people = '%s=%s' % (sel... | [
"0.80089843",
"0.70032465",
"0.6633306",
"0.6282554",
"0.62268615",
"0.62028176",
"0.6000405",
"0.57529354",
"0.5589777",
"0.5475212",
"0.54704934",
"0.5465017",
"0.5455724",
"0.53550005",
"0.53503644",
"0.534648",
"0.5339711",
"0.5336209",
"0.53166074",
"0.52957934",
"0.5292... | 0.80918866 | 0 |
Create a batch from a source sequences only. | def from_src_seq_only(cls, src: T_LongTensor, pad_index: int, sos_index: int, eos_index: int) -> Batch:
src_mask = (src != pad_index)
batch_size = src.shape[0]
tgt_in = torch.tensor([[sos_index]] * batch_size, device=src.device)
tgt_out = torch.tensor([[eos_index]] * batch_size, device=... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def batch_data(source, target, batch_size):\n for batch_i in range(0, len(source)//batch_size):\n start_i = batch_i * batch_size\n source_batch = source[start_i:start_i + batch_size]\n target_batch = target[start_i:start_i + batch_size]\n yield np.array(pad_sentence_batch(source_batc... | [
"0.6716162",
"0.643453",
"0.6406342",
"0.6272184",
"0.6247726",
"0.61936194",
"0.60441166",
"0.5993861",
"0.5975036",
"0.5967578",
"0.5964723",
"0.596399",
"0.5903492",
"0.5900616",
"0.59002256",
"0.5879657",
"0.5832277",
"0.5812053",
"0.5808935",
"0.57994056",
"0.5781162",
... | 0.6316397 | 3 |
Initialize the Iterator Wrapper with the original iterator. | def __init__(self, iterator: BucketIterator, pad_index: int, sos_index: int, eos_index: int) -> None:
self.iterator = iterator
self.pad_index = pad_index
self.sos_index = sos_index
self.eos_index = eos_index | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, outerIterator):\n super().__init__()\n self.outerIterator = outerIterator\n self.innerIterator = None",
"def __init__(self, iterator):\n self.iter = iterator\n self.tmpNext = iterator.next() if iterator.hasNext() else None",
"def __iter__(self):\n se... | [
"0.76188356",
"0.7333537",
"0.7290369",
"0.7290369",
"0.7290369",
"0.7290369",
"0.7206008",
"0.71194106",
"0.7109696",
"0.70647407",
"0.7035208",
"0.67644656",
"0.66755843",
"0.65834635",
"0.6548109",
"0.65479785",
"0.65442103",
"0.6519445",
"0.649507",
"0.6493902",
"0.645673... | 0.63136816 | 27 |
Return the same length as the original iterator. | def __len__(self):
return len(self.iterator) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generator_len(self, it):\n return len(list(it))",
"def __len__(self):\n if self.length is None:\n self.length = 0\n for _ in self:\n self.length += 1\n\n return self.length",
"def __len__(self):\n if self.length is None:\n self.len... | [
"0.7450412",
"0.69837356",
"0.69837356",
"0.69837356",
"0.69319147",
"0.6910794",
"0.6822537",
"0.6749185",
"0.6651546",
"0.66056037",
"0.6542198",
"0.6502088",
"0.6473856",
"0.64374846",
"0.6398692",
"0.63731706",
"0.632748",
"0.63094914",
"0.63094914",
"0.6304582",
"0.62889... | 0.75736177 | 0 |
Render website's home page. | def home():
return render_template('home.html') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render_home():\r\n\treturn render_template(\"index.html\")",
"def home():\n return render_template('homepage.html')",
"def home():\n\n return render_template('home_page.html')",
"def homepage():\n return render_template('home/index.html', \n title=\"Bem vindo!\")",
"... | [
"0.8724249",
"0.85791856",
"0.850329",
"0.84860355",
"0.84612614",
"0.84362435",
"0.8429879",
"0.8419578",
"0.8396612",
"0.8396612",
"0.8374868",
"0.8356488",
"0.8350785",
"0.8340763",
"0.8340763",
"0.8336323",
"0.8330013",
"0.8329599",
"0.8325031",
"0.8317146",
"0.8293699",
... | 0.83374727 | 29 |
Render the website's about page. | def about():
return render_template('about.html', name="Mary Jane") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def about():\n return render_template('about.html', title='About')",
"def about():\n\n return render_template('about_page.html', title='About')",
"def about():\n\n\treturn render_template(\"about.html\")",
"def about():\n return render_template(\n 'about.html',\n title='About',\n ... | [
"0.87910306",
"0.8698105",
"0.86404276",
"0.86124563",
"0.8490408",
"0.84784615",
"0.8467779",
"0.84352976",
"0.84289914",
"0.8424242",
"0.8424242",
"0.8424242",
"0.8424242",
"0.8424242",
"0.8424242",
"0.8424242",
"0.8424242",
"0.8424242",
"0.8424242",
"0.8424242",
"0.8424242... | 0.7684119 | 79 |
Add headers to both force latest IE rendering engine or Chrome Frame, and also to cache the rendered page for 10 minutes. | def add_header(response):
response.headers['X-UA-Compatible'] = 'IE=Edge,chrome=1'
response.headers['Cache-Control'] = 'public, max-age=600'
return response | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_header(response):\n response.headers['X-UA-Compatible'] = 'IE=Edge,chrome=1'\n response.headers['Cache-Control'] = 'public, max-age=60'\n return response",
"def add_header(response):\r\n response.headers['X-UA-Compatible'] = 'IE=Edge,chrome=1'\r\n response.headers['Cache-Control'] = 'publi... | [
"0.82234234",
"0.81956995",
"0.81631994",
"0.81631994",
"0.81631994",
"0.81631994",
"0.81631994",
"0.81631994",
"0.81631994",
"0.81631994",
"0.81631994",
"0.81631994",
"0.81631994",
"0.81631994",
"0.81631994",
"0.81631994",
"0.81631994",
"0.81631994",
"0.81631994",
"0.81631994"... | 0.822252 | 3 |
Accessor for the time interval's start. | def time_start(self):
return self._time_start | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start(self):\n # type: () -> datetime\n return self._start",
"def start(self) -> datetime:\n return self._start",
"def start_time(self):\n # TODO: use pd.Timestamp instead\n return self.time[0].to_pydatetime()",
"def get_datetime_start(self):\n return self.get_t_... | [
"0.74500155",
"0.7447435",
"0.7303191",
"0.7286964",
"0.72022676",
"0.71304",
"0.7127673",
"0.7120771",
"0.7112563",
"0.7096309",
"0.70718575",
"0.70496345",
"0.70496345",
"0.70496345",
"0.70496345",
"0.70496345",
"0.70496345",
"0.70496345",
"0.70496345",
"0.69662225",
"0.695... | 0.7216282 | 4 |
Accessor for the time interval's end. | def time_end(self):
return self._time_end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_end(self):\n return self._start + self._duration",
"def end(self) -> datetime:\n return self._end",
"def end_time(self):\n return self._end_time",
"def end_time(self):\n return self._end_time",
"def end_time(self):\n return self._end_time",
"def end_time(self):\... | [
"0.7803142",
"0.76213586",
"0.75952065",
"0.75952065",
"0.75952065",
"0.75952065",
"0.75952065",
"0.75952065",
"0.75899106",
"0.7588204",
"0.75714433",
"0.7554405",
"0.7553865",
"0.75085384",
"0.74625796",
"0.7456855",
"0.7427449",
"0.73936117",
"0.73402727",
"0.73240787",
"0... | 0.7675933 | 1 |
Given an input array consisting on only 0, 1, and 2, sort the array in a single traversal. | def sort_012(input_list):
# Initial two pointers to beginning and end
# Start another pointer to traverse
# if list[curr] == 0, then beg++, travel++
# if list[curr] == 2, then swap with end, and end--, curr++
# if list[curr] == 1, curr++
# if list[end] == 2, then end-- (to optimize swaps)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sort(array):\n\n for i in range(0, len(array)):\n for j in range(len(array)-1, i, -1):\n if array[j] < array[j-1]:\n ## Move the lighter bubble up\n _temp = array[j]\n array[j] = array[j-1]\n array[j-1] = _temp\n \n ... | [
"0.6792707",
"0.6758305",
"0.6685668",
"0.66711134",
"0.6660409",
"0.6644065",
"0.66035944",
"0.659015",
"0.65542775",
"0.6552274",
"0.65011084",
"0.64874375",
"0.6465411",
"0.6446616",
"0.64315027",
"0.64290977",
"0.6422456",
"0.6421703",
"0.6418894",
"0.64047986",
"0.638907... | 0.0 | -1 |
Collect the outputs of all the exits and return them. The output of each exit was cached during the network forward. | def get_exits_outputs(self, model):
outputs = []
for exit_point in self.exit_points:
branch_point = _get_branch_point_module(model, exit_point)
output = branch_point.output
assert output is not None
outputs.append(output)
return outputs | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process(self):\n while not self.halted:\n self.step()\n return self.outputs",
"def get_outputs(self):\n outputs = []\n missing = []\n for i, name in enumerate(self.output_names[:]):\n try:\n value = self.proto.output_env.look_up(name).un... | [
"0.6618349",
"0.62767285",
"0.61593467",
"0.61307776",
"0.6050383",
"0.59833735",
"0.5953864",
"0.5943678",
"0.59214",
"0.5883286",
"0.5879582",
"0.58708173",
"0.58692396",
"0.58692396",
"0.5866712",
"0.5862258",
"0.585536",
"0.5802761",
"0.5800473",
"0.5800473",
"0.57852036"... | 0.6127013 | 4 |
Initiate the ship and set its initial position | def __init__(self, ai_settings, screen):
super().__init__()
self.screen = screen
self.ai_settings = ai_settings;
# Load the ship picture and get its bounding rectangle
self.image = pygame.image.load('images/ship.bmp')
self.rect = self.image.get_rect()
sel... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setNewShip(self):\r\n self._ship = Ship(GAME_WIDTH/2,SHIP_BOTTOM+SHIP_HEIGHT/2,SHIP_WIDTH,\r\n SHIP_HEIGHT,'ship.png')",
"def _createShip(self):\n self._ship=Ship()",
"def setUp(self):\r\n global ship_image\r\n self.spaceshipgame = SpaceShipGame()\r\n self.spac... | [
"0.74688536",
"0.73925096",
"0.7282132",
"0.7282132",
"0.7265301",
"0.71920747",
"0.7094937",
"0.7037075",
"0.70178735",
"0.69778967",
"0.6960078",
"0.6939337",
"0.69244725",
"0.6922961",
"0.6893168",
"0.6881085",
"0.67898005",
"0.67804223",
"0.67403555",
"0.6687573",
"0.6685... | 0.70033896 | 9 |
Gets the dc_coupled of this HouseData. | def dc_coupled(self):
return self._dc_coupled | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dc_data(self):\n return self._dc_data",
"def dc(self):\n return np.array(self['dc_net'], dtype=np.float32)",
"def dc(self):\n return np.array(self['dc'], dtype=np.float32) / 1000",
"def DCC(self):\n return self.get_class_average(self.DCC_class_level)",
"def ac_dc(self):\n ... | [
"0.6604694",
"0.6540403",
"0.61643595",
"0.61497825",
"0.6048216",
"0.59379596",
"0.5924628",
"0.5906544",
"0.5902303",
"0.58695346",
"0.5744178",
"0.57345384",
"0.57135934",
"0.5684726",
"0.56818265",
"0.56226134",
"0.5620376",
"0.5588807",
"0.5571964",
"0.5488626",
"0.54634... | 0.87088233 | 0 |
Sets the load_meter of this HouseData. | def load_meter(self, load_meter):
self._load_meter = load_meter | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setLoad(self, new_load: float) -> None:\n self.load = new_load",
"def set_load(self, load):\n self.load= load",
"def setLoadInformation(self, load: float, lower_frequency_bound: int,\n upper_frequency_bound: int) -> None:\n self.setLoad(load)\n self.set... | [
"0.71961355",
"0.6657098",
"0.6501059",
"0.62784505",
"0.57750046",
"0.56936467",
"0.54715943",
"0.53181064",
"0.5250121",
"0.5225849",
"0.5183336",
"0.51539314",
"0.51253825",
"0.5106525",
"0.5075985",
"0.5031486",
"0.50192297",
"0.50163555",
"0.5010086",
"0.50047344",
"0.49... | 0.84862006 | 0 |
Gets the solar_meter of this HouseData. | def solar_meter(self):
return self._solar_meter | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getMeter(self):\n return self._Meter",
"def distmeter(self):\n return self._distance.to(\"m\").value",
"def get_vsolar(self):\n return self.read_register(4098, 1, 3)",
"def solar_meta(self):\n return self.data.solar_meta",
"def get_meter(self, name):\n if name not in ... | [
"0.67554307",
"0.640753",
"0.6277873",
"0.616717",
"0.61336553",
"0.6038839",
"0.6010272",
"0.5993609",
"0.59500605",
"0.5888665",
"0.58369154",
"0.582259",
"0.58135253",
"0.5800709",
"0.5791866",
"0.57748806",
"0.5771554",
"0.5762523",
"0.57592297",
"0.57540345",
"0.5752503"... | 0.8894814 | 0 |
Sets the solar_phases of this HouseData. | def solar_phases(self, solar_phases):
self._solar_phases = solar_phases | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def solar_phases(self):\n return self._solar_phases",
"def set_phase(self, phase):\n if phase not in dict(self.PHASES):\n raise ValueError(f\"Invalid phase {phase}\")\n\n self.phase = phase",
"def _set_phase(self):\n self.phase = np.sign(self._model())",
"def load_phases(se... | [
"0.61740994",
"0.5560123",
"0.53640914",
"0.5246248",
"0.5019741",
"0.49605498",
"0.49297005",
"0.478268",
"0.4763144",
"0.47445342",
"0.471208",
"0.47020367",
"0.4693328",
"0.46841028",
"0.4667457",
"0.4655861",
"0.4623477",
"0.46086714",
"0.45770493",
"0.45529512",
"0.45429... | 0.82005054 | 0 |
Gets the solar_streams_ac of this HouseData. | def solar_streams_ac(self):
return self._solar_streams_ac | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def solar_streams_dc(self):\n return self._solar_streams_dc",
"def solar_streams_ac(self, solar_streams_ac):\n\n self._solar_streams_ac = solar_streams_ac",
"def _get_streams(self):\n in1 = self.ins[0]\n out1 = self.outs[0]\n hu = self._heat_utilities[0]\n in2 = hu._fr... | [
"0.751523",
"0.65542555",
"0.53761286",
"0.53480744",
"0.51395327",
"0.50632006",
"0.5053123",
"0.5010916",
"0.49984208",
"0.4803883",
"0.47884506",
"0.47574258",
"0.4740732",
"0.47080755",
"0.46892452",
"0.4688138",
"0.46870744",
"0.4665904",
"0.4635685",
"0.46151915",
"0.46... | 0.88101447 | 0 |
Sets the solar_streams_ac of this HouseData. | def solar_streams_ac(self, solar_streams_ac):
self._solar_streams_ac = solar_streams_ac | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def solar_streams_ac(self):\n return self._solar_streams_ac",
"def solar_streams_dc(self, solar_streams_dc):\n\n self._solar_streams_dc = solar_streams_dc",
"def solar_streams_dc(self):\n return self._solar_streams_dc",
"def solar_phases(self, solar_phases):\n\n self._solar_phases... | [
"0.70731646",
"0.6751197",
"0.53062844",
"0.51466554",
"0.4958905",
"0.48913848",
"0.48836237",
"0.47593847",
"0.46661678",
"0.46238694",
"0.46080375",
"0.46080375",
"0.45820865",
"0.45030233",
"0.44424072",
"0.4438188",
"0.44246235",
"0.44037995",
"0.4402603",
"0.43383124",
... | 0.8630888 | 0 |
Gets the solar_streams_dc of this HouseData. | def solar_streams_dc(self):
return self._solar_streams_dc | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def solar_streams_ac(self):\n return self._solar_streams_ac",
"def solar_streams_dc(self, solar_streams_dc):\n\n self._solar_streams_dc = solar_streams_dc",
"def get_dds(self):\n return self._dds",
"def dc_data(self):\n return self._dc_data",
"def stream(self):\n\t\tdata = self.... | [
"0.7310915",
"0.65142596",
"0.5719843",
"0.55714786",
"0.5327244",
"0.53100216",
"0.51808614",
"0.5156609",
"0.51547754",
"0.5154202",
"0.5080048",
"0.49667823",
"0.49384087",
"0.49361813",
"0.48597783",
"0.48535278",
"0.4834585",
"0.48285556",
"0.48269472",
"0.4826004",
"0.4... | 0.89217335 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
return self.__dict__ == other.__dict__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8088132",
"0.8088132",
"0.8054589",
"0.7982687",
"0.7961088",
"0.7961088",
"0.79433626",
"0.79303336",
"0.7926563",
"0.7897525",
"0.78826123",
"0.78826123",
"0.78806067",
"0.7872423",
"0.7868354",
"0.78668815",
"0.7825702",
"0.7819993",
"0.78162885",
"0.78078854",
"0.78068... | 0.79670393 | 48 |
Returns true if both objects are not equal | def __ne__(self, other):
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.845611",
"0.8391477",
"0.8144138",
"0.81410587",
"0.8132492",
"0.8093973",
"0.80920255",
"0.80920255",
"0.80920255",
"0.8085325",
"0.8085325",
"0.8076365",
"0.8076365",
"0.8065748"
] | 0.0 | -1 |
Allow relations if a model in the auth app is involved. | def allow_relation(self, obj1, obj2, **hints):
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allow_relation(self, obj1, obj2, **hints):\n if self.isAdminApp(obj1) or self.isAdminApp(obj2):\n return True\n return None",
"def allow_relation(self, obj1, obj2, **hints):\n\n result = (obj1._meta.model_name in DefaultRouting.defaultModels and \n obj2._meta.model_... | [
"0.7264568",
"0.70190156",
"0.6919564",
"0.6906994",
"0.69009876",
"0.6783787",
"0.67391515",
"0.67210835",
"0.6704985",
"0.6668281",
"0.6638815",
"0.6542443",
"0.6541121",
"0.65383524",
"0.64997756",
"0.64021367",
"0.6397948",
"0.63407576",
"0.624081",
"0.6170405",
"0.600265... | 0.6990835 | 2 |
Plot the value profile of a color map. Ensuring each colour has a different values helps make the colors distinguishable even in grey scale. It also helps that the value progression be monotonous, that way legends go from e.g. light to dark. | def plot_value_profile(clist, style=None):
if style is None:
style = 'line' if len(clist) >= 8 else 'scatter'
ax = plt.subplot(111)
if style == 'line':
ax.plot(get_value(clist))
else:
ax.scatter(range(len(clist)), get_value(clist)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def display_cmap_color_range(cmap_style='rainbow'):\n cmap = plt.get_cmap(cmap_style)\n for c in range(256):\n plt.scatter([c], [0], s=500, c=cmap(c), lw=0)\n plt.show()",
"def plot_values(self, filename):\n point_colors = [f'rgb{self.get_value_tuple(index)}' for index in range(self.point_... | [
"0.68211716",
"0.66382265",
"0.6287913",
"0.6286099",
"0.6232615",
"0.6203256",
"0.6181341",
"0.617763",
"0.6023412",
"0.5917912",
"0.5879697",
"0.58741736",
"0.5871331",
"0.5832376",
"0.5800985",
"0.5760505",
"0.575366",
"0.57489264",
"0.5708508",
"0.5705339",
"0.5646912",
... | 0.65808487 | 2 |
Replace URLs found in a text string with nothing (i.e. it will remove the URL from the string). | def remove_urls(self, tweet_text):
url_free_tweet_text = " ".join(
re.sub(r"http\S+", "", tweet_text).split())
return url_free_tweet_text | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_urls(text):\n pass",
"def remove_urls(text):\n text = re.sub('(?P<url>https?://[^\\s]+)', '', text)\n return text",
"def remove_urls(self, text):\n return re.sub(r'http.?://[^\\s]+[\\s]?', '', text)",
"def _remove_urls(self, text: str) -> str:\n pattern = r\"http\\S+... | [
"0.84234834",
"0.8375139",
"0.8313424",
"0.8136846",
"0.8086758",
"0.80581635",
"0.7960113",
"0.7952343",
"0.7834781",
"0.7703771",
"0.7645327",
"0.7403271",
"0.7346439",
"0.72760266",
"0.7173462",
"0.7153779",
"0.7122551",
"0.7063723",
"0.7056413",
"0.6891972",
"0.68544376",... | 0.7550426 | 11 |
Returns the key corresponding to the minimal value in a dictionnary | def argmin(self,d):
if not d:
return None
# import ipdb; ipdb.set_trace()
min_val = min(d.values())
return [k for k in d if d[k] == min_val][0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def keywithminval(d): \r\n v=list(d.values())\r\n k=list(d.keys())\r\n return k[v.index(min(v))]",
"def min_in_dict(dict_of_ints):\n list_of_vals =[]\n list_of_min_keys = []\n for i in dict_of_ints:\n list_of_vals.append(dict_of_ints[i])\n min_val = min(list_of_vals)\n for i in di... | [
"0.8475688",
"0.73847765",
"0.72780883",
"0.7092336",
"0.6946089",
"0.69052476",
"0.6904085",
"0.68986154",
"0.68128294",
"0.6771498",
"0.6696533",
"0.6646679",
"0.66122764",
"0.6606074",
"0.6558851",
"0.6503057",
"0.64937824",
"0.6443012",
"0.6403522",
"0.6403522",
"0.638910... | 0.6698241 | 10 |
Plots the palette with or without the original image | def plot_palette(self, imsize=7, ncols=None, include_img=True):
if self._colors is None:
raise ValueError("Model must be fitted in order to plot results")
block_size = 20
offset = 5
total_colors = self._n_colors
if include_img:
fig, ax = plt.subplots(2, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_color_image(image):\n plt.imshow(image, interpolation=\"nearest\")\n plt.axis(\"off\")",
"def run(palette='hsv', num_vals=12):\n fout_png = 'colors_{P}_{N}.png'.format(P=palette, N=num_vals)\n _, axis = plt.subplots(1, 1, figsize=(6, 6))\n colobj = MplColorHelper(palette, 0, num_vals-1)\n... | [
"0.6410979",
"0.6292829",
"0.6111741",
"0.60944027",
"0.59892374",
"0.59699893",
"0.5963698",
"0.5959562",
"0.5907712",
"0.58973783",
"0.58826107",
"0.5882044",
"0.5813558",
"0.58097816",
"0.575529",
"0.5746549",
"0.5722852",
"0.57149655",
"0.57042074",
"0.56977355",
"0.56974... | 0.6250609 | 2 |
Put attention masks on hidden using hidden_features and query. | def attention(query, use_attention=False):
attn_weights = []
ds = [] # Results of attention reads will be stored here.
for i in xrange(num_heads):
with variable_scope.variable_scope("Attention_%d" % i):
y = rnn_cell._linear(query, attention_vec_size, True)
y = array_ops.re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _compute_masked_hidden(self, hidden, mask):\r\n mask = mask.unsqueeze(-1).expand_as(hidden)\r\n hidden_masked = hidden[mask].contiguous().view(-1, hidden.size(-1))\r\n return hidden_masked",
"def reset_hidden(hidden, mask):\n if len(mask) != 0:\n hidden[:, mask,... | [
"0.6559086",
"0.62840223",
"0.6111259",
"0.59778535",
"0.59240407",
"0.590074",
"0.5858773",
"0.57706964",
"0.5740448",
"0.5705913",
"0.5692008",
"0.56839246",
"0.56740963",
"0.5588107",
"0.55809724",
"0.55534023",
"0.55418223",
"0.5530451",
"0.54474396",
"0.5420755",
"0.5420... | 0.58081996 | 7 |
Test to and from json | def test_to_from_json():
matg = matgame.matgame([[[1, 2], [3, 4]], [[5, 6], [7, 8]], [[9, 10], [11, 12]]])
mjson = {
"players": {"r0": 1, "r1": 1},
"strategies": {"r0": ["s0", "s1", "s2"], "r1": ["s3", "s4"]},
"payoffs": {
"s0": {"s3": {"r0": 1, "r1": 2}, "s4": {"r0": 3, "r1"... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testfromjson(self):\n dicty = {\"id\": 5, \"class\": \"string\", \"list\": [], \"set\": {}}\n self.assertEqual([dicty], Base.from_json_string(json.dumps([dicty])))",
"def testfromjson(self):\n dicty = {\"id\": 5, \"class\": \"string\", \"list\": [], \"set\": {}}\n self.assertEqual... | [
"0.7554929",
"0.7507045",
"0.74782544",
"0.74291545",
"0.7233946",
"0.71158844",
"0.6974972",
"0.6964633",
"0.68560344",
"0.6853396",
"0.68450683",
"0.6831718",
"0.6827157",
"0.6801319",
"0.6768733",
"0.6760327",
"0.674297",
"0.6739218",
"0.6722127",
"0.67148465",
"0.6675802"... | 0.61004174 | 91 |
Returns data read from json file at found at 'json_path' location. | def read_from_json(json_path):
# Read data
with open(json_path, 'r') as json_file:
data = json.load(json_file)
return data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_json(path):\n with open(path) as json_file:\n data = json.load(json_file)\n return data",
"def open_json(path):\n with open(path, \"r\") as json_data_file:\n data = json.load(json_data_file)\n return data",
"def read_file(path):\n with open(path) as json_fi... | [
"0.8522099",
"0.84905845",
"0.8424821",
"0.82144815",
"0.8133503",
"0.81079245",
"0.79976314",
"0.79738456",
"0.7885579",
"0.78748626",
"0.7842806",
"0.78236926",
"0.78048843",
"0.77712125",
"0.7758499",
"0.7711884",
"0.77085274",
"0.76701415",
"0.7620861",
"0.75819886",
"0.7... | 0.86335784 | 0 |
cast signed 32 bit integer to an unsigned integer | def unsigned32(i):
return i & 0xFFFFFFFF | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def u32(value: bytes, endian: str = \"little\", sign: bool = False) -> int:\n return unpack(value, 32, endian, sign)",
"def u32(d):\n return unpack('<I', d)[0]",
"def decode_u32(as_bytes: typing.List[int]) -> int:\n return le_bytes_to_int(as_bytes, False)",
"def get_uint(val):\n if is_64bits:\n ... | [
"0.72784126",
"0.6967825",
"0.67574114",
"0.66905993",
"0.66078043",
"0.6566256",
"0.6508671",
"0.6500486",
"0.64816904",
"0.64786464",
"0.64373994",
"0.64254564",
"0.6403062",
"0.6380647",
"0.63588524",
"0.63213164",
"0.63132274",
"0.63097215",
"0.62989795",
"0.6284697",
"0.... | 0.7890273 | 0 |
Close the syslog server. | def close(self) -> None:
self.transport.close() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def server_close(self):\n\t\tself.socket.close()",
"def close(self):\n self.Log.log(\"Server Closed\")\n for User in self.Users.values():\n User.getSocket.shutdown(socket.SHUT_RDWR)\n User.getSocket.close()\n self.DB.close_connection()\n self.Log.closeFile()\n ... | [
"0.6726157",
"0.67099714",
"0.66559184",
"0.6650795",
"0.65764636",
"0.65623915",
"0.65454465",
"0.64631325",
"0.6448734",
"0.6287994",
"0.62663573",
"0.6249086",
"0.62442166",
"0.6178881",
"0.6137097",
"0.6136726",
"0.6134782",
"0.6134782",
"0.6134782",
"0.6134782",
"0.61347... | 0.0 | -1 |
Get url for Cars detail view. | def get_absolute_url(self):
return reverse("cars:detail", kwargs={"slug": self.slug}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_absolute_url(self):\n return reverse('market:category-detail', args=[str(self.id)])",
"def category_details_url(id):\n return reverse('category:category-detail', args=[id])",
"def get_absolute_url(self):\n return reverse('category-detail', args=[str(self.categoryId)])",
"def get_abso... | [
"0.7254118",
"0.7016152",
"0.69017005",
"0.68566227",
"0.6847931",
"0.6825237",
"0.6782469",
"0.67527354",
"0.66832715",
"0.66817003",
"0.66729796",
"0.66469187",
"0.6637912",
"0.6637912",
"0.6637912",
"0.6606177",
"0.6599574",
"0.6578265",
"0.6575122",
"0.6556195",
"0.654518... | 0.708076 | 1 |
Get url for Rental's list view. | def get_absolute_url(self):
return reverse("cars:rental_list") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_absolute_url(self):\n return reverse(\"view_list\", args=[self.id])",
"def index_url(self):\n return reverse('{}:{}_list'.format(self.label, self.model_map[self.label]))",
"def url(self):\n return reverse('snippet-list')",
"def get_absolute_url(self):\n return reverse(\"ca... | [
"0.73320866",
"0.70137763",
"0.6585105",
"0.65309435",
"0.65157586",
"0.650917",
"0.6389919",
"0.6299749",
"0.6267909",
"0.6246725",
"0.6245288",
"0.62239236",
"0.62152666",
"0.6191842",
"0.6189854",
"0.61805797",
"0.61686975",
"0.61682796",
"0.61682796",
"0.61641526",
"0.614... | 0.7494777 | 0 |
Helper function to ensure empty parent categories are included, and in correct hierarchical order. | def parse_base_cats(cat, sep='/'):
cats = cat.split(sep)
return [sep.join(cats[:i]) for i in range(1, len(cats))] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_parents_category(self):\n self.assertEqual(self.category.get_parents(), [])",
"def test_set_category_parent(self):\n pass",
"def show_available_parents(self):\n self.categoryParent.clear()\n\n parents = self.orm.fetch_parents()\n self.categoryParent.addItems([p.n... | [
"0.6736643",
"0.64431727",
"0.61992127",
"0.5955592",
"0.5849891",
"0.5825452",
"0.57866925",
"0.57664514",
"0.5742064",
"0.571915",
"0.5672635",
"0.5653762",
"0.56287664",
"0.5586052",
"0.55782133",
"0.55561423",
"0.55531645",
"0.55225635",
"0.5497372",
"0.5467506",
"0.54416... | 0.0 | -1 |
Initializes a Record object for a given style. | def __init__(self,
model: Union[str, io.IOBase, DM, None] = None,
name: Optional[str] = None,
database = None):
super().__init__(model=model, name=name, database=database) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, styles, nature):\n #: Dictionary of key-value pairs, where *keys* are the style names.\n self.styles = styles\n\n #: Cell *nature* used to distinguish the body cells, from the header and the footer.\n self.nature = nature",
"def __init__(self, data, validate=False):... | [
"0.60679305",
"0.5947927",
"0.59251535",
"0.58511496",
"0.56204385",
"0.5543454",
"0.55402297",
"0.5513867",
"0.550229",
"0.5483007",
"0.5447827",
"0.5371813",
"0.5368332",
"0.5364484",
"0.5348912",
"0.53422546",
"0.5315233",
"0.5280887",
"0.52761346",
"0.5262303",
"0.5239653... | 0.0 | -1 |
Checks if an event is of a given type. | def is_eiffel_event_type(event, event_type):
return event['meta']['type'] == event_type | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_event(event: Any) -> bool:\n return isinstance(event, MenuAction) or str(type(event)) == \"<class 'pygame_menu.events.MenuAction'>\"",
"def can_be_registered(self, event_type):\n return (event_type in self._watchable_events or\n (event_type == self.ANY and self._allow_any))",
"d... | [
"0.74271184",
"0.7038774",
"0.703722",
"0.6969158",
"0.68571806",
"0.6772961",
"0.6551863",
"0.6551863",
"0.65242517",
"0.6511125",
"0.6253715",
"0.62417936",
"0.6198896",
"0.617824",
"0.6177374",
"0.6119438",
"0.6104513",
"0.60985553",
"0.6097152",
"0.6044385",
"0.60175997",... | 0.7812664 | 0 |
"Obtain the mean of tensor on different GPUs. | def reduce_mean(tensor):
if not (dist.is_available() and dist.is_initialized()):
return tensor
tensor = tensor.clone()
dist.all_reduce(tensor.div_(dist.get_world_size()), op=dist.ReduceOp.SUM)
return tensor | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ensemble_mean(self):\n return self.mean(dim='mem')",
"def mean_IOU_gpu(X, Y):\n \n #X_fl = K.clip(K.batch_flatten(X), K.epsilon(), 1.)\n #Y_fl = K.clip(K.batch_flatten(Y), K.epsilon(), 1.)\n X_fl = K.clip(K.batch_flatten(X), 0., 1.)\n Y_fl = K.clip(K.batch_flatten(Y), 0., 1.)\n X_fl ... | [
"0.67156863",
"0.6624079",
"0.63271046",
"0.6325413",
"0.6312363",
"0.62749434",
"0.6229309",
"0.622327",
"0.6207307",
"0.6173767",
"0.61488575",
"0.6117647",
"0.6071423",
"0.60597605",
"0.60274136",
"0.59943736",
"0.5977635",
"0.5942434",
"0.59333897",
"0.5926111",
"0.589711... | 0.6363062 | 2 |
Whether or not to set the range of the spinbox based on userdefined limits. Will also reset the range of the spinbox in case this is called while the application is running to ensure it matches what the user requested. | def userDefinedLimits(self, user_defined_limits: bool) -> None:
self._user_defined_limits = user_defined_limits
self.reset_limits() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset_limits(self) -> None:\n if self.userDefinedLimits:\n if self.userMinimum is None or self.userMaximum is None:\n return\n self.setMinimum(self.userMinimum)\n self.setMaximum(self.userMaximum)\n else:\n if self._lower_ctrl_limit is No... | [
"0.75314075",
"0.7352342",
"0.68105096",
"0.6468874",
"0.6453545",
"0.63285416",
"0.6212366",
"0.6210483",
"0.62017846",
"0.6158805",
"0.6148999",
"0.6049452",
"0.6021119",
"0.6008431",
"0.5981158",
"0.59481835",
"0.5947525",
"0.5915399",
"0.59140646",
"0.59099233",
"0.588906... | 0.6112849 | 11 |
Set the Lower userdefined limit value, updates the range of the spinbox if needed | def userMinimum(self, new_min: float) -> None:
self._user_minimum = new_min
self.reset_limits() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setRange(self, range):\n\t\tself.range = range\n\t\tself.slider.setMinimum(0.0)\n\t\tself.slider.setMaximum(100.0)\n\t\tself.spinbox.setRange(self.range[0], self.range[1])\n\n\t\tdiff = self.range[1] - self.range[0]\n\t\tif diff <= 1:\n\t\t\tself.spinbox.setSingleStep(0.01)",
"def ctrl_limit_changed(self, wh... | [
"0.71557677",
"0.7068435",
"0.6977307",
"0.6972797",
"0.68999773",
"0.6886954",
"0.67278945",
"0.6724877",
"0.6704502",
"0.6704502",
"0.6668009",
"0.66628265",
"0.6652776",
"0.6649353",
"0.6619426",
"0.6611085",
"0.65781635",
"0.65781635",
"0.65715647",
"0.65578175",
"0.65301... | 0.5976795 | 51 |
Set the upper userdefined limit value, updates the range of the spinbox if needed | def userMaximum(self, new_max: float) -> None:
self._user_maximum = new_max
self.reset_limits() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __set_max_value(self, value: int) -> None:\n self.__max_value = value * 2000\n half_value = self.__max_value // 2\n\n self.__x_spinbox.configure(from_=-half_value, to=half_value)\n self.__x_scale.configure(from_=half_value, to=-half_value)\n self.__y_spinbox.configure(from_=-... | [
"0.7456495",
"0.7229764",
"0.7080934",
"0.700931",
"0.69445777",
"0.6728854",
"0.6706969",
"0.6694014",
"0.66746736",
"0.6663448",
"0.6663448",
"0.664382",
"0.6643003",
"0.6643003",
"0.6618452",
"0.6613077",
"0.6583927",
"0.65600157",
"0.6530531",
"0.65131384",
"0.6457018",
... | 0.595102 | 65 |
Will reset the lower and upper limits to either the ones set by the user, or the ones from the channel depending on the current state of userDefinedLimits(). If a None value would be set, do not attempt the update. | def reset_limits(self) -> None:
if self.userDefinedLimits:
if self.userMinimum is None or self.userMaximum is None:
return
self.setMinimum(self.userMinimum)
self.setMaximum(self.userMaximum)
else:
if self._lower_ctrl_limit is None or self._... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def userDefinedLimits(self, user_defined_limits: bool) -> None:\n self._user_defined_limits = user_defined_limits\n self.reset_limits()",
"def update_limits(self):\n if len(self) == 0:\n self.limits = np.array([[0.0, 0.0], [0.0, 0.0]])\n else:\n x_min, x_max = se... | [
"0.6986642",
"0.65963954",
"0.65207833",
"0.62716544",
"0.61193484",
"0.6103533",
"0.6092916",
"0.6036534",
"0.6035578",
"0.59823394",
"0.59669685",
"0.59240234",
"0.5914237",
"0.58373964",
"0.5829013",
"0.5818958",
"0.57566434",
"0.5751602",
"0.5746164",
"0.5744281",
"0.5710... | 0.80892944 | 0 |
Checks if the neighbour cells(left, right, up, down) of a cell contain a piece | def neighboursContains(board, row, column, piece):
neighboursList = []
for rowIndex, columnIndex in BoardUtils.DIRECTIONS.values():
if 0 <= row + rowIndex < len(board) and 0 <= column + columnIndex < len(board[0]):
neighboursList.append((row + rowIndex, column + columnIndex)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def surroundingContains(board, row, column, piece):\n\n neighboursList = list(BoardUtils.neighborsList(board, 1, row, column))\n for element in neighboursList:\n if board[element[0]][element[1]] == piece:\n return True\n return False",
"def _any_piece_in_way(self, f... | [
"0.76284134",
"0.73758364",
"0.7342762",
"0.71909374",
"0.70696115",
"0.7039344",
"0.700078",
"0.69598275",
"0.68701446",
"0.6826606",
"0.67978835",
"0.6761646",
"0.6760024",
"0.6750912",
"0.6745681",
"0.6744129",
"0.67328036",
"0.6694655",
"0.6661721",
"0.66559386",
"0.66550... | 0.7851798 | 0 |
Neighbors as a list | def emptyNeighborsList(board, row, column):
neighboursList = list(BoardUtils.neighborsList(board, 1, row, column))
emptyNeighbours = []
for row, column in neighboursList:
if BoardUtils.isEmpty(board, row, column):
emptyNeighbours.append((row, column))
return ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_of_neighbors(self):\n return self.to_coo_matrix().tolil().rows.tolist()",
"def get_neighbours(self):\n return []",
"def get_neighbors(self):\n \n return [neighbor for neighbor,_ in self.neighbors.items()]",
"def getNeighbors(self):\n return self.neighbors",
"... | [
"0.78987205",
"0.78736323",
"0.7668056",
"0.7640512",
"0.75295043",
"0.73637086",
"0.73570037",
"0.73450565",
"0.73450565",
"0.73450565",
"0.73450565",
"0.7295819",
"0.72040015",
"0.71745765",
"0.71330017",
"0.71217215",
"0.7106848",
"0.70968086",
"0.70505387",
"0.70325005",
... | 0.63921463 | 67 |
Put the ball at the center of the window | def __set_ball_position(self):
self.__window.remove(self.__ball)
self.__window.add(self.__ball, (self.__window.width - self.__ball.width) / 2,
(self.__window.height - self.__ball.height) / 2) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset_ball(self):\n self.window.add(self.ball, x=(self.window.width - self.ball.width) / 2,\n y=(self.window.height - self.ball.height) / 2)",
"def reset_ball(self):\n self.window.add(self.ball,x=(self.window.width - self.radius * 2) / 2,\n y=(self.... | [
"0.7453881",
"0.74392587",
"0.73138",
"0.7275719",
"0.72626454",
"0.725513",
"0.71594524",
"0.7147322",
"0.7109163",
"0.7085537",
"0.70269406",
"0.70195967",
"0.6952797",
"0.6915902",
"0.68783677",
"0.68341815",
"0.67195797",
"0.67095774",
"0.6685317",
"0.6638953",
"0.6638953... | 0.7590598 | 0 |
Put the paddle in the middle of the window | def __set_paddle_position(self):
self.__window.remove(self.__paddle)
self.__window.add(self.__paddle, (self.__window.width - self.__paddle.width) / 2,
self.__window.height - self.__paddle_offset) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n self.center = Point()\n #x coordinate is set in these amount of pixels to leave a slight gap between the screen and paddle just like in real pong video games\n self.center.x = SCREEN_WIDTH - 10\n #when game starts, paddle is placed on the middle of screen's right e... | [
"0.7819728",
"0.76501036",
"0.71932906",
"0.716291",
"0.6831572",
"0.67216986",
"0.6610099",
"0.6514275",
"0.64715",
"0.64278567",
"0.64089906",
"0.6407768",
"0.6406992",
"0.6406575",
"0.6351488",
"0.63323987",
"0.6332168",
"0.62906855",
"0.6281897",
"0.62622166",
"0.62516415... | 0.8017165 | 0 |
To see if the ball hit the paddle | def __hit_paddle(self, g_object):
return g_object == self.__paddle | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hit_paddle(self):\n pass\n\n #Implement if collision with paddle is detected\n\n #Add randomness to how ball direction will change and return value",
"def check_hit(self):\n too_close_x = (PADDLE_WIDTH / 2) + BALL_RADIUS\n too_close_y = (PADDLE_HEIGHT / 2) + BALL_RADIUS\n\n... | [
"0.8416342",
"0.79500014",
"0.7851007",
"0.7644582",
"0.76224506",
"0.73810154",
"0.73634684",
"0.7194109",
"0.71051097",
"0.7101073",
"0.70689505",
"0.6968781",
"0.6764257",
"0.6660021",
"0.6537229",
"0.6526546",
"0.64815164",
"0.64441",
"0.6430917",
"0.6413303",
"0.6405508"... | 0.7832681 | 3 |
converts non standard akkadian into standard UTF characters. Note that the root column does not and cannot contain contracted or long vowels, hence the asymmetry in the number of replacements needed | def utify_chars(babylex_df):
babylex_df['root'] = babylex_df['root'].str.replace("T", "ṭ")
babylex_df['root'] = babylex_df['root'].str.replace("c", "š")
babylex_df['root'] = babylex_df['root'].str.replace("S", "ṣ")
babylex_df['root'] = babylex_df['root'].str.replace("x", "'")
babylex_df['infinitive... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unicode2ascii(_unicrap):\n xlate = {0xc0:'A', 0xc1:'A', 0xc2:'A', 0xc3:'A', 0xc4:'A', 0xc5:'A',\n 0xc6:'Ae', 0xc7:'C',\n 0xc8:'E', 0xc9:'E', 0xca:'E', 0xcb:'E',\n 0xcc:'I', 0xcd:'I', 0xce:'I', 0xcf:'I',\n 0xd0:'Th', 0xd1:'N',\n 0xd2:'O', 0xd3:'O', 0xd4:'O', 0xd5:'O', 0xd6:... | [
"0.63565314",
"0.6283198",
"0.6068743",
"0.6004264",
"0.59716773",
"0.5950174",
"0.5925195",
"0.5923654",
"0.5887589",
"0.5806115",
"0.57845527",
"0.5768532",
"0.57665694",
"0.5756962",
"0.57355344",
"0.57063645",
"0.5687655",
"0.5645826",
"0.56394744",
"0.5630439",
"0.562005... | 0.73196036 | 0 |
Sort a list of tuples by comparing elements of given index, using collation for given language. If C{lang} is C{None}, current locale is used for collation. | def langsort_tuples (lst, index, lang=None):
reset_locale = _set_lang_locale(lang)
lst.sort(lambda x, y: locale.strcoll(x[index], y[index]))
reset_locale() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def langsort (lst, lang=None):\n\n reset_locale = _set_lang_locale(lang)\n lst.sort(locale.strcoll)\n reset_locale()",
"def sorted_languages():\n # Python 3: Use functools.cmp_to_key\n def compare(a, b):\n if a.name == u\"English\":\n return -1\n elif b.name == u\"English\... | [
"0.66975147",
"0.5091974",
"0.50063735",
"0.49946716",
"0.4973507",
"0.49685755",
"0.49521363",
"0.48961574",
"0.4809702",
"0.47563213",
"0.46868575",
"0.46784845",
"0.46690688",
"0.46400306",
"0.46165967",
"0.46158993",
"0.45997033",
"0.455784",
"0.45509714",
"0.45443237",
"... | 0.7953653 | 0 |
Retrieves the list of all State objects | def all_states():
states = []
states_values = storage.all("State").values()
for obj in states_values:
states.append(obj.to_dict())
return jsonify(states) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all_states(self):\n return self._states",
"def all_states():\n dict = storage.all(State)\n list = []\n for state in dict.values():\n list.append(state.to_dict())\n return jsonify(list)",
"def get_list_of_states(self):\n return self.states",
"def get_all_states():\n ... | [
"0.8137676",
"0.8114916",
"0.80541945",
"0.79778695",
"0.7974168",
"0.79698193",
"0.78558934",
"0.77833647",
"0.77445245",
"0.7663341",
"0.765244",
"0.7569619",
"0.7534709",
"0.7502574",
"0.74869597",
"0.7467144",
"0.7464845",
"0.732207",
"0.7299296",
"0.7243289",
"0.72340447... | 0.81053764 | 2 |
Returns the COMPSS_HOME environment variable | def get_compss_home(self):
return self.compss_home | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_user_home(self):\n return os.environ['HOME']",
"def get_user_home(self):\n return os.environ['HOME']",
"def _get_home():\n from os.path import expanduser\n home = expanduser('~')\n return home",
"def get_config_home():\n if platform.system() == 'Linux':\n try:\n ... | [
"0.70737743",
"0.70737743",
"0.69509983",
"0.67604345",
"0.6651154",
"0.66254586",
"0.6606972",
"0.65336055",
"0.6519404",
"0.63782895",
"0.63572073",
"0.63210636",
"0.6248638",
"0.62040174",
"0.6149731",
"0.61052847",
"0.60641414",
"0.6017384",
"0.6003851",
"0.5988884",
"0.5... | 0.7135089 | 0 |
Returns the path to store the tests execution sandbox | def get_target_base_dir(self):
return self.target_base_dir | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tests_dirpath():\n execdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))\n return os.path.join(execdir, \"tests\")",
"def _run_isolated_path(self):\n return self.m.swarming_client.path.join('run_isolated.py')",
"def test_dir():\n return os.path.abspath(os.path.dirn... | [
"0.6948231",
"0.67171586",
"0.6711542",
"0.66976327",
"0.6673063",
"0.66638327",
"0.65690553",
"0.6562768",
"0.6550627",
"0.64866877",
"0.6475483",
"0.64753425",
"0.64646876",
"0.64535296",
"0.63497835",
"0.6305346",
"0.6267874",
"0.62099504",
"0.61871815",
"0.6165046",
"0.61... | 0.0 | -1 |
Retrieves the object from the data layer with the given key. Returns None if the object is not found. By default this method utilizes the memcache.Client at ``pykvdal.store``. Repurpose this method to use a different data layer. | def dal_get(key):
global store
return store.get(urllib.quote(key)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(self, key):\n try:\n\n item = self._item_to_dict(self.client.get_item(**self._prepare_get_request(str(key))))\n\n # If item is empty, nothing in cache\n if not item:\n return None\n\n # If current time beyond expiry, nothing to return\n ... | [
"0.76607823",
"0.7387342",
"0.7363371",
"0.73449254",
"0.73348904",
"0.7309015",
"0.7302387",
"0.72820723",
"0.7277683",
"0.7277683",
"0.72235066",
"0.71865475",
"0.7046676",
"0.6960232",
"0.6960179",
"0.6953953",
"0.6946638",
"0.6926815",
"0.6873523",
"0.68659115",
"0.686108... | 0.63479245 | 67 |
Build and return a data loader. | def getLoader(s_image_dir,c_image_dir,
style_selected_dir, content_selected_dir,
crop_size=178, batch_size=16, num_workers=8,
colorJitterEnable=True, colorConfig={"brightness":0.05,"contrast":0.05,"saturation":0.05,"hue":0.05}):
s_transforms = []
c_transforms = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_loader(data, json, batch_size, shuffle, num_workers):\n dataset = FinNumDataset(data, json)\n\n data_loader = torch.utils.data.DataLoader(dataset=dataset,\n batch_size=batch_size,\n shuffle=shuffle,\n ... | [
"0.74889874",
"0.73519504",
"0.711431",
"0.70320064",
"0.6991118",
"0.6990211",
"0.6968911",
"0.6925782",
"0.69233835",
"0.6864498",
"0.68342435",
"0.6819947",
"0.68127316",
"0.6809393",
"0.68059325",
"0.6692377",
"0.6691707",
"0.6687672",
"0.66781133",
"0.66521686",
"0.66456... | 0.0 | -1 |
Sets up data for the tests. | def setup_data(es_with_collector):
country_uk = constants.Country.united_kingdom.value.id
country_us = constants.Country.united_states.value.id
uk_region = constants.UKRegion.south_east.value.id
CompanyFactory(
name='abc defg ltd',
trading_names=['helm', 'nop'],
address_1='1 Fake... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUpTestData(cls):\n # volunteer user\n common.initialize_empty_volunteer()",
"def setUpTestData(cls):\n data_gen.run()",
"def setUpTestData(cls):\n data_gen.run()",
"def setUpTestData(cls):\n data_gen.run()",
"def setUpTestData(cls):\n data_gen.run()",
"def... | [
"0.81127256",
"0.8057943",
"0.8057943",
"0.8057943",
"0.8057943",
"0.80004704",
"0.7991069",
"0.77982366",
"0.77596",
"0.775312",
"0.77453804",
"0.76861817",
"0.76845056",
"0.76102936",
"0.7474673",
"0.7433597",
"0.74293596",
"0.742385",
"0.7413854",
"0.7412238",
"0.73999125"... | 0.0 | -1 |
Load from a dictionary. | def from_dict(self, d={}):
return Vacancy(
atoms=Atoms.from_dict(d["atoms"]),
defect_structure=Atoms.from_dict(d["defect_structure"]),
defect_index=d["defect_index"],
wyckoff_multiplicity=d["wyckoff_multiplicity"],
symbol=d["symbol"],
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_dict(self, dct):\n pass",
"def loadFromDict(self, d):\n self._data = d\n self._doDefaults()",
"def _load(self, load_dict):\n self._data_ = load_dict",
"def _load(self, load_dict):\n try:\n self.v_protocol = load_dict.pop(PickleParameter.PROTOCOL)\n ... | [
"0.79526144",
"0.78697616",
"0.7191981",
"0.71797186",
"0.6959093",
"0.6824042",
"0.6815806",
"0.67868626",
"0.6686988",
"0.66857815",
"0.6684767",
"0.6667591",
"0.6628185",
"0.6613605",
"0.6611746",
"0.65272284",
"0.65208036",
"0.6468286",
"0.63865453",
"0.63865453",
"0.6386... | 0.0 | -1 |
The constructor for NNData Class. | def __init__(self, features=None, labels=None, train_factor=0.9):
self._train_factor = NNData.percentage_limiter(train_factor)
self._train_indices = []
self._test_indices = []
self._train_pool = collections.deque()
self._test_pool = collections.deque()
if features is Non... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, m, n, data):\n self.m = m\n self.n = n\n self.data = data",
"def __init__(self,data,dimX=0,dimY=0,dimT=0,nodes={},corrs=[],tau=0,gridcells=[],unavail=[],anomaly={},links={},strength={},strengthmap=[]):\n self.data = data\n self.dimX,self.dimY,self.dimT = self... | [
"0.7481049",
"0.7048846",
"0.6989654",
"0.69872123",
"0.69722104",
"0.69353855",
"0.69345397",
"0.6934138",
"0.69143593",
"0.68904585",
"0.6841752",
"0.6841528",
"0.6833406",
"0.6815317",
"0.68038726",
"0.67527837",
"0.6715857",
"0.66883916",
"0.6685127",
"0.6668005",
"0.6660... | 0.6459548 | 47 |
(LinkedList, int, object) > NoneType Insert a new node containing item at position index. Raise IndexError if index is > the length of self. Note that adding to the end of a linked list is okay. >>> lst = LinkedList(['CSC', 'hi', 15, 3.14]) >>> lst.insert(2, 42) >>> lst contains 'CSC', 'hi', 42, 15, 3.14 | def insert(self, index, item):
# Create a new node
new_code = Node(item)
# Go to node (index - 1)
curr = self.first
for i in range(index - 1):
curr = curr.next
old_next_node = curr.next
# Update curr's next attribute
curr.next = new_node
# Update new n... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def insert(self, index, item):\n if index > len(self):\n raise IndexError\n elif index == 0:\n self.insert_first(item)\n else:\n self._rest.insert(index-1, item)",
"def insert(self, index, data):\n\n n = Node(data)\n\n if self.empty() and index ... | [
"0.7871121",
"0.776206",
"0.7720387",
"0.7657963",
"0.7591564",
"0.7544568",
"0.7462508",
"0.74456376",
"0.7424423",
"0.74085724",
"0.73337936",
"0.7316769",
"0.7289341",
"0.72872275",
"0.7267037",
"0.71765625",
"0.71505976",
"0.71348876",
"0.7131583",
"0.7123947",
"0.7089724... | 0.70293206 | 24 |
Gets a list of boundingboxes, representing each cell in the FOV. | def get_fov_bboxes(image_size):
cell_width = image_size[0] / FOV_COLUMNS
cell_height = image_size[1] / FOV_ROWS
bboxes = []
ymin = 0
for row in range(FOV_ROWS):
xmin = 0
for column in range(FOV_COLUMNS):
bbox = BBox(xmin, ymin, xmin + cell_width, ymin + cell_height)
bboxes.append(bbox)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bounding_boxes(self, detections):\n bboxes = []\n while len(detections) > 0:\n det = detections.pop(0)\n merging = True\n while merging:\n merging = False\n pointer = 0\n while pointer < len(detections):\n ... | [
"0.7128498",
"0.67393553",
"0.66903865",
"0.6600977",
"0.65460396",
"0.6500302",
"0.6448963",
"0.64315706",
"0.6422916",
"0.6383243",
"0.638317",
"0.63745356",
"0.63262737",
"0.6292145",
"0.6274384",
"0.6257264",
"0.625344",
"0.6236458",
"0.6227581",
"0.62205577",
"0.6217417"... | 0.7421705 | 0 |
adds an elevation to the LateralProfile | def add_superelevation(self,superelevation):
if not isinstance(superelevation,_Poly3Profile):
raise TypeError('add_elevation requires an _Elevation as input, not ' + str(type(superelevation)))
self.superelevations.append(superelevation) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_elevation(self,elevation):\n if not isinstance(elevation,_Poly3Profile):\n raise TypeError('add_elevation requires an _Poly3Profile as input, not ' + str(type(elevation)))\n self.elevations.append(elevation)",
"def elevation(self, elevation):\n\n self.container['elevation'... | [
"0.7866283",
"0.7541173",
"0.6632503",
"0.59285116",
"0.5915756",
"0.5858479",
"0.58203554",
"0.5817699",
"0.58102375",
"0.57906765",
"0.5745034",
"0.5654982",
"0.56413853",
"0.5635653",
"0.5591043",
"0.55278313",
"0.5497286",
"0.54743564",
"0.54320055",
"0.5428754",
"0.53951... | 0.694613 | 2 |
adds an elevation to the LateralProfile | def add_shape(self,shape):
if not isinstance(shape,_Poly3Profile):
raise TypeError('add_elevation requires an _Elevation as input, not ' + str(type(shape)))
self.shapes.append(shape) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_elevation(self,elevation):\n if not isinstance(elevation,_Poly3Profile):\n raise TypeError('add_elevation requires an _Poly3Profile as input, not ' + str(type(elevation)))\n self.elevations.append(elevation)",
"def elevation(self, elevation):\n\n self.container['elevation'... | [
"0.7866283",
"0.7541173",
"0.694613",
"0.6632503",
"0.59285116",
"0.5915756",
"0.5858479",
"0.58203554",
"0.5817699",
"0.57906765",
"0.5745034",
"0.5654982",
"0.56413853",
"0.5635653",
"0.5591043",
"0.55278313",
"0.5497286",
"0.54743564",
"0.54320055",
"0.5428754",
"0.5395173... | 0.58102375 | 9 |
Get the name of file. | def get_file_name(replay_dir, template_name):
suffix = '.json' if not template_name.endswith('.json') else ''
file_name = f'{template_name}{suffix}'
return os.path.join(replay_dir, file_name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_file_name(self):\n return str(self.get_file())",
"def get_name(self):\n return self.file_name",
"def get_name(self):\n return self._file.name",
"def get_file_name(self):\n return self.file_name",
"def get_file_name(self):\n return self._fileName",
"def get_file_... | [
"0.8970578",
"0.86232793",
"0.86175895",
"0.85611826",
"0.85280865",
"0.8525119",
"0.84631115",
"0.84529465",
"0.83937883",
"0.83937883",
"0.83937883",
"0.83937883",
"0.83937883",
"0.83103794",
"0.8258796",
"0.8249211",
"0.804179",
"0.80200344",
"0.80096227",
"0.7991372",
"0.... | 0.0 | -1 |
Remove an entire group and its imported buckets. Delete from auth JSON and delete .conf file | def remove_group(args):
# check config file is valid first
args.suppress_verify_output = True
if verify(args) != 0:
# restore stdout
sys.stdout = sys.__stdout__
print("OIDC config file not valid, please use the verify function to debug")
return 1
result_remove_config_f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_group_bucket():\n pass",
"def remove_bucket_from_json(args):\n\n sanitised_group = args.group.replace('/', '-')\n\n with open(args.file, \"r\") as f:\n config_json = json.load(f)\n\n for group in config_json[\"groups\"]:\n if group[\"name\"] == sanitised_group:\n ... | [
"0.78195804",
"0.7365278",
"0.690582",
"0.6884984",
"0.68479836",
"0.66439795",
"0.65848356",
"0.6546363",
"0.65119165",
"0.629689",
"0.62732553",
"0.6237461",
"0.61938775",
"0.6176432",
"0.6161303",
"0.6147338",
"0.61454344",
"0.61454344",
"0.6100429",
"0.60979414",
"0.60952... | 0.68554175 | 4 |
Find the patient indices corresponding to all nonmissing values grouped in TMT experiments. | def FindIdxValues(X):
data = X.select_dtypes(include=["float64"])
idx = np.argwhere(~np.isnan(data.values))
idx[:, 1] += 4 # add ID variable columns
StoE = pd.read_csv("msresist/data/MS/CPTAC/IDtoExperiment.csv")
assert all(StoE.iloc[:, 0] == data.columns), "Sample labels don't match."
StoE = S... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_nan_indices(*tensors: Tensor) ->Tensor:\n if len(tensors) == 0:\n raise ValueError('Must pass at least one tensor as argument')\n sentinel = tensors[0]\n nan_idxs = torch.zeros(len(sentinel), dtype=torch.bool, device=sentinel.device)\n for tensor in tensors:\n permuted_tensor = t... | [
"0.58136404",
"0.5708731",
"0.56316876",
"0.55939835",
"0.54255754",
"0.53853405",
"0.53554946",
"0.53549314",
"0.53431654",
"0.53254133",
"0.53028256",
"0.52759653",
"0.5254565",
"0.52477795",
"0.52104425",
"0.52104425",
"0.52104425",
"0.51636666",
"0.51404786",
"0.5124555",
... | 0.6025363 | 0 |
Filter rows for those containing more than cutoff variance. Variance across conditions per peptide. Note this should only be used with logscaled, meancentered data. | def VarianceFilter(X, data_headers, varCut=0.1):
Xidx = np.var(X[data_headers].values, axis=1) > varCut
return X.iloc[Xidx, :] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prune_dims(variances, threshold=0.005):\r\n scale_z = np.sqrt(variances)\r\n return scale_z >= threshold",
"def filter_common_variation(self):\n # Filter common variation\n unknown_freq_df = self.variant_df.query('gnomAD_exome_ALL == \".\"')\n other_freq_df = self.variant_df.query('gno... | [
"0.6006151",
"0.590222",
"0.5869065",
"0.56981874",
"0.5553796",
"0.55403906",
"0.55360204",
"0.5501963",
"0.5459607",
"0.54577994",
"0.54571337",
"0.5424561",
"0.5406711",
"0.53542566",
"0.52668524",
"0.52435094",
"0.5240034",
"0.5233578",
"0.52180266",
"0.52070886",
"0.5202... | 0.64819884 | 0 |
Remove any sample in zeroth dimension which holds a nan | def filter_nan_samples(self, train_x, train_y):
n_samples = train_x.shape[0]
if n_samples != train_y.shape[0]:
raise ValueError("x and y sample lengths don't match")
validity_array = np.zeros(n_samples)
for i in range(n_samples):
x_sample = train_x[i, :]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def removeNans(data):\n for i in data[:]:\n ind = data.index(i)\n for j in i:\n if np.isnan(j):\n data.remove(i)\n break\n return data",
"def remove_nans(coords):\n s = np.apply_along_axis(sum,1,np.isnan(coords[1])) == 0\n coords[0] = (np.asarray... | [
"0.7291344",
"0.7101682",
"0.6896953",
"0.6789577",
"0.67172015",
"0.6643837",
"0.66388255",
"0.66103345",
"0.66024375",
"0.6585844",
"0.65760493",
"0.6542907",
"0.64785993",
"0.6429807",
"0.6405613",
"0.63979244",
"0.63931096",
"0.63767695",
"0.63621247",
"0.63577837",
"0.63... | 0.66236323 | 7 |
Returns set of interfaces that are required if `pkg` were to implement `ifc`. Returned set of interfaces not closed under subsumption. | def pkg_ifc_requires(me, pkg, ifc):
return me._pkg_ifc_reqs.get((pkg,ifc), frozenset()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pkg_ifcs_requires(me, pkg, ifcs):\n un = set()\n for i in ifcs:\n if (pkg,i) in me._pkg_ifc_reqs:\n un.update(me._pkg_ifc_reqs[pkg,i])\n return un",
"def ifc_implementors(me, ifc):\n return me._ifc_imps.get(ifc, frozenset())",
"def ifc_subsets(me, ifc):\n return me._ifc_subs.get(... | [
"0.775189",
"0.70071",
"0.60531425",
"0.55922616",
"0.5562154",
"0.5434335",
"0.5393135",
"0.5346833",
"0.5247362",
"0.5234199",
"0.52315986",
"0.51823986",
"0.5132653",
"0.5073703",
"0.50524145",
"0.5041055",
"0.5034936",
"0.5025728",
"0.5019404",
"0.50037515",
"0.4985805",
... | 0.8017148 | 0 |
Given an iterable of interfaces, returns a set of those which are minimal in the subsumption heirarchy. | def min_ifcs(me, ifcs):
eqrep = me._eqrep
eqset = me._eqset
bigs = me._ifc_bigs
ifcs = set(ifcs)
mins = set(eqrep[a] for a in ifcs)
for a in list(mins):
mins.difference_update(eqrep[b] for b in bigs[a] if eqrep[b] != a)
u = set()
for r in mins:
u.update(eqset[r])
u.inters... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def choose_least(me, ifcs, proj):\n \n eqrep = me._eqrep\n eqset = me._eqset\n subs = me._ifc_subs\n m = {}\n for i in ifcs:\n i = eqrep[i]\n x = None\n for i1 in eqset[i]:\n x1 = proj(i)\n if x is None:\n x = x1\n elif x1 is not None and x != x1:\n ... | [
"0.68048155",
"0.5650379",
"0.5578197",
"0.5515608",
"0.5418277",
"0.5362869",
"0.5359932",
"0.5244764",
"0.5217986",
"0.5217473",
"0.5179484",
"0.51671064",
"0.5166366",
"0.51520455",
"0.5145244",
"0.51439434",
"0.513242",
"0.5074704",
"0.5069232",
"0.50639194",
"0.5041791",... | 0.65822804 | 1 |
construct of lrelu activation | def construct(self, x):
return self.max(x * 0.2, x) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lrelu(self):\n return self.add_layer(lrelu)",
"def _bn_relu(input):\r\n norm = BatchNormalization(axis=3)(input)\r\n return Activation(\"relu\")(norm)",
"def _bn_relu(input):\n norm = BatchNormalization()(input)\n return Activation(\"relu\")(norm)",
"def _bn_relu(input):\n norm = Ba... | [
"0.7797504",
"0.745127",
"0.7377045",
"0.7377045",
"0.7354408",
"0.72624815",
"0.72624815",
"0.7073564",
"0.6981284",
"0.6966602",
"0.6966602",
"0.6953286",
"0.6925608",
"0.6911421",
"0.6769586",
"0.66786194",
"0.6672061",
"0.66297936",
"0.65981644",
"0.657847",
"0.6552481",
... | 0.0 | -1 |
Returns a JSON response, transforming 'context' to make the payload. | def render_to_response(self, context, **response_kwargs):
json = self.convert_context_to_json(context)
# If callback is specified, serve as JSONP
callback = self.request.GET.get('callback', None)
if callback:
response_kwargs['content_type'] = 'application/javascript'
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render_to_response(self, context):\n return self.get_json_response(self.convert_context_to_json(context))",
"def render_to_response(self, context):\n\t\treturn self.get_json_response(self.convert_context_to_json(context))",
"def render_to_json_response(self, context, **response_kwargs):\n ret... | [
"0.7900071",
"0.78258467",
"0.7675795",
"0.7675795",
"0.7558514",
"0.75040793",
"0.7409266",
"0.7409266",
"0.7409266",
"0.7409266",
"0.7409266",
"0.73804635",
"0.73667556",
"0.7348796",
"0.73462486",
"0.73103166",
"0.7131352",
"0.6942184",
"0.6894355",
"0.67183167",
"0.663160... | 0.6624334 | 24 |
Returns a list of all aggregator classes | def get_all():
temp = inspect.getmembers(sys.modules[__name__], inspect.isclass)
return [i[1] for i in temp if i[0] != "Aggregator"] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def classes(self):\n return list(self._classes_generator())",
"def getClasses(self):\n self._process()\n return self._sets",
"def get_class_list(self):\r\n modules = []\r\n classes = []\r\n path = os.path.dirname(os.path.abspath(__file__))\r\n measures_path = os... | [
"0.7129108",
"0.70857936",
"0.7041384",
"0.6905891",
"0.68920404",
"0.6885957",
"0.6814019",
"0.6746654",
"0.6598072",
"0.6582139",
"0.6566984",
"0.6559369",
"0.65102065",
"0.64400405",
"0.6383464",
"0.63516015",
"0.63365006",
"0.63088375",
"0.63088375",
"0.63088375",
"0.6308... | 0.8026953 | 0 |
Returns a certain quantile from the array | def __init__(self, quantile):
self.quantile = quantile
if self.quantile < 0 or self.quantile > 1:
verif.util.error("Quantile must be between 0 and 1") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def quantile(x,p):\n p_index = int(p*len(x))\n return sorted(x)[p_index]",
"def quantile(x, p):\n p_index = int(p * len(x))\n return sorted(x)[p_index]",
"def quantile(x, p):\n p_index = int(p * len(x))\n return sorted(x)[p_index]",
"def quantile(x, p):\n p_index = int(p * len(x))\n r... | [
"0.75492483",
"0.7503795",
"0.7503795",
"0.7503795",
"0.7466237",
"0.74399054",
"0.7174253",
"0.7157689",
"0.7140044",
"0.710925",
"0.70857894",
"0.6915604",
"0.69024676",
"0.68599886",
"0.68067646",
"0.6739679",
"0.67258936",
"0.67170143",
"0.67170143",
"0.66894203",
"0.6673... | 0.0 | -1 |
Float string s as in exponential format | def as_exp(s: str) -> str:
return s if "e" in s else "{:1.0e}".format(float(s)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scientific(x):\n return '{:.2e}'.format(x)",
"def _float_to_string(v):\n\n if not isinstance(v,float):\n raise InstrumentParameterException('Value %s is not a float.' % v)\n else:\n return '%e' % v",
"def write_endf_float(value):\n if(abs(value) < 1e-9 or abs(value... | [
"0.72706103",
"0.7191039",
"0.717974",
"0.6932884",
"0.6918706",
"0.69159305",
"0.6826443",
"0.68035823",
"0.68007165",
"0.67797506",
"0.6731136",
"0.6698608",
"0.669571",
"0.66874605",
"0.6655898",
"0.6636667",
"0.6627454",
"0.65868235",
"0.65603083",
"0.6525312",
"0.6524964... | 0.8536248 | 0 |
Snippet list POST must return a 403 Forbidden response to anonymous users if the FORBID_ANONYMOUS setting is True. | def test_post_forbid_anonymous(self):
self.check_post_forbid_anonymous('FORBID_ANONYMOUS') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def snippet_list_csrf(request, format=None):\n if request.method == 'GET':\n snippets = Snippet.objects.all()\n serializer = SnippetSerializer(snippets, many=True, context={'request': request})\n return JsonResponse(serializer.data, safe=False)\n\n elif request.method == 'POST':\n ... | [
"0.68211657",
"0.6723153",
"0.66859794",
"0.66859794",
"0.62415856",
"0.6184953",
"0.5469489",
"0.5392837",
"0.53698754",
"0.5368289",
"0.5341587",
"0.5333831",
"0.5302393",
"0.52292717",
"0.5176539",
"0.51717633",
"0.5164515",
"0.5144951",
"0.51305294",
"0.5129975",
"0.51180... | 0.5499549 | 6 |
Snippet list POST must return a 403 Forbidden response to anonymous users if the FORBID_ANONYMOUS_CREATE setting is True. | def test_post_forbid_anonymous_create(self):
self.check_post_forbid_anonymous('FORBID_ANONYMOUS_CREATE') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def snippet_list_csrf(request, format=None):\n if request.method == 'GET':\n snippets = Snippet.objects.all()\n serializer = SnippetSerializer(snippets, many=True, context={'request': request})\n return JsonResponse(serializer.data, safe=False)\n\n elif request.method == 'POST':\n ... | [
"0.68456674",
"0.6693871",
"0.6668688",
"0.6668688",
"0.62455344",
"0.6170572",
"0.57565457",
"0.5607574",
"0.5569667",
"0.55346763",
"0.5495014",
"0.5492069",
"0.5443721",
"0.5405239",
"0.52483994",
"0.52196056",
"0.519896",
"0.51826507",
"0.5160289",
"0.5144427",
"0.5115973... | 0.53924054 | 14 |
Returns a Q object that filters for the linkable instance across all LinkFields on the linker model. | def points_to_links(linker, linkable):
content_type = ContentType.objects.get_for_model(linkable)
return reduce(or_, (models.Q(**{field.ct_field: content_type,
field.fk_field: linkable.pk})
for field in linker._meta.virtual_fields
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_query(self):\n q = db.Query(self.KIND,keys_only=self.KEYS_ONLY)\n for prop, value in self.FILTERS:\n q.filter(\"%s =\" % prop, value)\n if self.ancestor:\n q.ancestor(self.ancestor)\n q.order(self.ORDER_BY)\n return q",
"def similar_qs(self):\n ... | [
"0.54400134",
"0.540497",
"0.5374437",
"0.5347432",
"0.53409034",
"0.52882236",
"0.52324855",
"0.52158034",
"0.5199173",
"0.51645124",
"0.5145068",
"0.51381785",
"0.5109251",
"0.51035553",
"0.5099466",
"0.5053235",
"0.5050093",
"0.5038907",
"0.50305086",
"0.4998876",
"0.49960... | 0.62688875 | 0 |
Constructor pass in username/apikey or public/private key pair for MongoDB Atlas. Override `base_url` for use with an instance of MongoDB Ops Manager. | def __init__(self,public_key=Env.get(Env.PUBLIC_KEY)
,private_key=Env.get(Env.PRIVATE_KEY)
,org_id=Env.get(Env.ORG_ID)
,project_id=Env.get(Env.PROJECT_ID)
,base_url="https://cloud.mongodb.com"):
self.public_key = public_key
self.privat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, username, api_key, region, auth_url=None, **kwargs):\n self.user = username\n self.key = api_key\n self.region = region.upper()\n \n if not auth_url:\n auth_url = consts.default_authurl\n \n self.debug = int(kwargs.get('debug', 0))\n ... | [
"0.6838913",
"0.6681511",
"0.6657643",
"0.6552255",
"0.6541692",
"0.64658123",
"0.6409456",
"0.63842857",
"0.63785756",
"0.6363788",
"0.6318257",
"0.62643397",
"0.624119",
"0.6198935",
"0.6158917",
"0.61253655",
"0.6121117",
"0.61211103",
"0.61100906",
"0.6107417",
"0.6101646... | 0.80440503 | 0 |
Return cluster by name for this organization. | def get_cluster(self,cluster_name,project_id=''):
print( f'>>>>>>{self.project_id}')
if project_id == '':
project_id = self.project_id
return self.get('{}/groups/{}/clusters/{}'.format(ApiVersion.A1.value,project_id,cluster_name)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_one_cluster_by_name(ctx, cluster_name, project_name):\n project = ctx.obj.groups.byName[project_name].get().data\n cluster = ctx.obj.groups[project.id].clusters[cluster_name].get()\n pprint(cluster.data)",
"def show_cluster(name: str) -> Cluster:\n environment = EnvironmentProvider().environm... | [
"0.7661818",
"0.7627722",
"0.70136595",
"0.68634033",
"0.682182",
"0.682182",
"0.6767521",
"0.6745533",
"0.6745533",
"0.6722927",
"0.67057276",
"0.67029464",
"0.67029464",
"0.67029464",
"0.67029464",
"0.67029464",
"0.6694726",
"0.6686361",
"0.66803277",
"0.6643556",
"0.659092... | 0.7107379 | 2 |
Turn an individual value into a np.ndarray of length 1. | def test_make_np_iterable(val):
val_rec = uc._make_np_iterable(val)
assert isinstance(val_rec, np.ndarray)
assert len(val_rec) == 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def retrun_1(x):\n ret = np.ones(len(x))\n return ret",
"def _to_ndarray(data):\n return np.atleast_1d(getattr(data, 'values', data))",
"def to_1d_array(self):\n return reshape_fns.to_1d(self._obj, raw=True)",
"def _make_array(x):\n try:\n x = np.asfarray(x).squeeze()\n e... | [
"0.73517627",
"0.7070868",
"0.68515253",
"0.6691133",
"0.65931267",
"0.64962554",
"0.64918286",
"0.644431",
"0.643734",
"0.6403479",
"0.63977665",
"0.63632137",
"0.6356173",
"0.6352373",
"0.6350322",
"0.6311138",
"0.6287624",
"0.6239727",
"0.619818",
"0.6175534",
"0.61736345"... | 0.57535267 | 56 |
Turn a list / similar into a np.ndarray of length 1. | def test_make_np_iterable_list(val):
val_rec = uc._make_np_iterable(val)
assert isinstance(val_rec, np.ndarray)
assert len(val_rec) == len(val) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_numpy(a: List[tvm.nd.NDArray]) -> List[np.ndarray]:\n assert a is not None, \"Empty result cannot be converted to numpy\"\n return [x.numpy() for x in a]",
"def arrayobj1d(inp: Iterable, copy=False) -> np.ndarray:\n return np.array([None] + list(inp), dtype=object, copy=copy)[1:]",
"def... | [
"0.7527172",
"0.74122053",
"0.69679517",
"0.6966055",
"0.679222",
"0.67558897",
"0.6677785",
"0.6649249",
"0.6613946",
"0.6611458",
"0.6600892",
"0.6572598",
"0.6520345",
"0.6474259",
"0.6317794",
"0.63099134",
"0.6287494",
"0.6233881",
"0.6218633",
"0.61926574",
"0.6187089",... | 0.0 | -1 |
Create the data substructure based on a YAML file | def create_datastructure_from_yaml_file(self):
## loading the YAML file
try:
with open(self.source) as f:
hbaseSchemaDic = yaml.load(f)
except:
msg = "Error: the HBase substructure could not be created. File %s could not be loaded. Please check the syntax... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create(self):\n datasubstructure_file = self.source\n if datasubstructure_file.endswith('.yml'):\n print('Generating the data substructure based on the YML file')\n status = self.create_datastructure_from_yaml_file()\n else:\n status = 'failed'\n ... | [
"0.6683344",
"0.63193464",
"0.61889696",
"0.6151949",
"0.6144548",
"0.6132568",
"0.61238873",
"0.61196095",
"0.61189926",
"0.6048359",
"0.60384846",
"0.5928613",
"0.5921998",
"0.58116454",
"0.5802794",
"0.5772116",
"0.57433647",
"0.57385534",
"0.5736408",
"0.5726731",
"0.5721... | 0.6845177 | 0 |
Converts strings to uppercase | def parse_literal(node):
# From client to database
if isinstance(node, ast.StringValue):
if isinstance(node.value, str):
return node.value.upper()
return node.value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def uppercase(str):\n \n return str.upper()",
"def convert_to_uppercase(text):\n return text.upper()",
"def uppercase(string):\n\n return str(string).upper()",
"def to_upper(self, text):\n\t\treturn text.upper()",
"def upper(string):\n new_string = '' # Empty string to append to\n for cha... | [
"0.81250125",
"0.8103617",
"0.7936961",
"0.7930193",
"0.76856434",
"0.76575416",
"0.75560963",
"0.7443349",
"0.7334456",
"0.7305676",
"0.7223347",
"0.7217082",
"0.7197907",
"0.71412665",
"0.7109376",
"0.69752544",
"0.68996614",
"0.6884158",
"0.687342",
"0.68482286",
"0.679561... | 0.0 | -1 |
Reformats date to original Switches date column from integers of days since first entry into a timedelta. Then, adds that timedelta to the min_date In the end getting a datetime. | def reformat_date(all_data, min_date):
all_data["date"] = [datetime.timedelta(x) for x in all_data["date"]]
all_data["date"] = all_data["date"] + min_date | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def min_date(self, rows: List[Row], column: DateColumn) -> Date:\n cell_values = [row.values[column.name] for row in rows if row.values[column.name] is not None]\n if not cell_values:\n return Date(-1, -1, -1)\n if not all([isinstance(value, Date) for value in cell_values]):\n ... | [
"0.60667294",
"0.56381744",
"0.5583762",
"0.55656195",
"0.5565095",
"0.54344136",
"0.5414903",
"0.54056257",
"0.5309771",
"0.52710533",
"0.5220491",
"0.5190669",
"0.5152039",
"0.51239455",
"0.51133674",
"0.51097226",
"0.50717074",
"0.50623274",
"0.50467855",
"0.4990437",
"0.4... | 0.7147386 | 0 |
String for representing the Model object. | def __str__(self):
return self.title | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return super().__str__() + self.model.__str__()",
"def __str__(self):\n return \"DataModel(name={},attributes={},description={})\".format(\n self.name, {a.name: str(a) for a in self.attributes}, self.description\n )",
"def __str__(self):\n \n res =... | [
"0.82368803",
"0.79901737",
"0.7849152",
"0.78468513",
"0.77520275",
"0.7625378",
"0.7625378",
"0.76225406",
"0.76225406",
"0.75483394",
"0.7522958",
"0.7470355",
"0.7469358",
"0.7447144",
"0.7447144",
"0.74314755",
"0.7427648",
"0.7389925",
"0.7351721",
"0.73424315",
"0.7322... | 0.0 | -1 |
Return the string with invalid filename characters excluded. | def string_to_valid_filename(s):
return filter(lambda x: x in valid_file_chars, s) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strip_illegal_chars(filename: str) -> str:\n if OPTIONS['download']['ascii']:\n return ''.join(i for i in filename if i in FILENAME_ALLOWEDASCII)\n else:\n return ''.join(i for i in filename if i not in FILENAME_BANNED)",
"def sanitize_filename(f):\n keepchars = (\" \", \".\", \"_\")\n... | [
"0.8169112",
"0.7668292",
"0.7615177",
"0.75587046",
"0.7555444",
"0.7553094",
"0.7540749",
"0.7485333",
"0.7453738",
"0.7430725",
"0.73914933",
"0.736258",
"0.73283887",
"0.7259114",
"0.7205139",
"0.72023153",
"0.7136878",
"0.7130237",
"0.71038824",
"0.7087985",
"0.6999256",... | 0.7585273 | 3 |
Gets the first_slice_angle of this Chart. Gets or sets the angle of the first piechart or doughnutchart slice, in degrees (clockwise from vertical). Applies only to pie, 3D pie, and doughnut charts, 0 to 360. | def first_slice_angle(self):
return self.container['first_slice_angle'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def first_slice_angle(self, first_slice_angle):\n\n self.container['first_slice_angle'] = first_slice_angle",
"def pie_slice(self, x, y, r, t0, t1, cls=None, style=None):\n tr0 = math.radians(t0)\n tr1 = math.radians(t1)\n x0 = x + r * math.cos(tr0)\n y0 = y + r * math.sin(tr0)... | [
"0.77468836",
"0.5396452",
"0.5396452",
"0.5371567",
"0.5129852",
"0.48152226",
"0.48152226",
"0.48120353",
"0.4805761",
"0.46756354",
"0.4673196",
"0.4552097",
"0.45436895",
"0.45179063",
"0.44669732",
"0.44526485",
"0.44424266",
"0.44206753",
"0.44202927",
"0.44107357",
"0.... | 0.7893725 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.