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 |
|---|---|---|---|---|---|---|
__ne__(SALOMERuntime_PySwigIterator self, SALOMERuntime_PySwigIterator x) > bool | def __ne__(self, *args):
return _SALOMERuntime.SALOMERuntime_PySwigIterator___ne__(self, *args) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, x):\n return _elas.SwigPyIterator___ne__(self, x)",
"def __ne__(self, *args):\n return _libsbml.SwigPyIterator___ne__(self, *args)",
"def __isub__(self, *args):\n return _SALOMERuntime.SALOMERuntime_PySwigIterator___isub__(self, *args)",
"def __eq__(self, *args):\n ... | [
"0.80862004",
"0.7646542",
"0.7400494",
"0.7271136",
"0.7091208",
"0.70553225",
"0.69964427",
"0.68215626",
"0.68155307",
"0.67758614",
"0.6749217",
"0.6741116",
"0.6680278",
"0.6632606",
"0.66257775",
"0.6581102",
"0.6510739",
"0.64781266",
"0.6452032",
"0.64443284",
"0.6387... | 0.8304529 | 0 |
__iadd__(SALOMERuntime_PySwigIterator self, ptrdiff_t n) > SALOMERuntime_PySwigIterator | def __iadd__(self, *args):
return _SALOMERuntime.SALOMERuntime_PySwigIterator___iadd__(self, *args) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __iadd__(self, n):\n return _elas.SwigPyIterator___iadd__(self, n)",
"def __add__(self, n):\n return _elas.SwigPyIterator___add__(self, n)",
"def __add__(self, *args):\n return _SALOMERuntime.SALOMERuntime_PySwigIterator___add__(self, *args)",
"def __iadd__(self, *args):\n ret... | [
"0.73618877",
"0.7184293",
"0.6820455",
"0.6619166",
"0.65486795",
"0.6318188",
"0.63095236",
"0.6302356",
"0.6299947",
"0.6257304",
"0.6249364",
"0.61234176",
"0.6077772",
"0.6050516",
"0.59905326",
"0.5923489",
"0.5904122",
"0.58388275",
"0.58388275",
"0.5720285",
"0.569705... | 0.7099407 | 2 |
__isub__(SALOMERuntime_PySwigIterator self, ptrdiff_t n) > SALOMERuntime_PySwigIterator | def __isub__(self, *args):
return _SALOMERuntime.SALOMERuntime_PySwigIterator___isub__(self, *args) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __isub__(self, n):\n return _elas.SwigPyIterator___isub__(self, n)",
"def __ne__(self, *args):\n return _SALOMERuntime.SALOMERuntime_PySwigIterator___ne__(self, *args)",
"def __isub__(self, *args):\n return _libsbml.SwigPyIterator___isub__(self, *args)",
"def __isub__(self, *args):\n... | [
"0.777509",
"0.697899",
"0.67721933",
"0.6365751",
"0.63362265",
"0.63322085",
"0.6301605",
"0.6095576",
"0.6052988",
"0.5917371",
"0.5899667",
"0.5865476",
"0.5851208",
"0.5790015",
"0.5731813",
"0.5727193",
"0.5684199",
"0.5674164",
"0.5576558",
"0.55315137",
"0.54916185",
... | 0.7407157 | 1 |
__add__(SALOMERuntime_PySwigIterator self, ptrdiff_t n) > SALOMERuntime_PySwigIterator | def __add__(self, *args):
return _SALOMERuntime.SALOMERuntime_PySwigIterator___add__(self, *args) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __iadd__(self, n):\n return _elas.SwigPyIterator___iadd__(self, n)",
"def __add__(self, n):\n return _elas.SwigPyIterator___add__(self, n)",
"def __iadd__(self, *args):\n return _SALOMERuntime.SALOMERuntime_PySwigIterator___iadd__(self, *args)",
"def __ne__(self, *args):\n ret... | [
"0.7027764",
"0.7027535",
"0.6781361",
"0.6498137",
"0.63756305",
"0.63609344",
"0.63483024",
"0.6345078",
"0.6306904",
"0.6292882",
"0.6160261",
"0.61213726",
"0.6032808",
"0.5924473",
"0.5918188",
"0.59077734",
"0.59077734",
"0.588474",
"0.58227",
"0.58008885",
"0.57965475"... | 0.66492635 | 3 |
getBuiltins(RuntimeSALOME self) > PyObject | def getBuiltins(self):
return _SALOMERuntime.RuntimeSALOME_getBuiltins(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def builtin(self):\n return BuiltIn()",
"def get_builtins(self):\n return self.__builtin_index",
"def builtin(self) :\n try :\n return self._builtin\n except Exception as e:\n raise e",
"def builtin(self) :\n\t\ttry :\n\t\t\treturn self._builtin\n\t\texcept E... | [
"0.63915825",
"0.6335714",
"0.59227836",
"0.58688235",
"0.5800939",
"0.5800186",
"0.5795367",
"0.5773134",
"0.5723305",
"0.5569067",
"0.55601007",
"0.5542715",
"0.5527929",
"0.55000603",
"0.5477311",
"0.5475483",
"0.54649484",
"0.54623646",
"0.5459786",
"0.54227066",
"0.53544... | 0.84636366 | 0 |
initialize(OptimizerAlgSync self, Any input) | def initialize(self, *args):
return _SALOMERuntime.OptimizerAlgSync_initialize(self, *args) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(self, *args):\n return _SALOMERuntime.OptimizerAlgASync_initialize(self, *args)",
"def init_algorithm(self):\n pass",
"def initializeProxy(self, *args):\n return _SALOMERuntime.OptimizerAlgSync_initializeProxy(self, *args)",
"def __init__(self, optimizer):\n super(Shard... | [
"0.7975914",
"0.6993163",
"0.6690137",
"0.6235849",
"0.6181034",
"0.61571807",
"0.6090145",
"0.6051373",
"0.60159487",
"0.601451",
"0.60009867",
"0.59800905",
"0.5979716",
"0.59627587",
"0.5903892",
"0.5901187",
"0.5863974",
"0.5853442",
"0.5841935",
"0.5821476",
"0.5806433",... | 0.82014495 | 0 |
initialize(OptimizerAlgASync self, Any input) | def initialize(self, *args):
return _SALOMERuntime.OptimizerAlgASync_initialize(self, *args) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(self, *args):\n return _SALOMERuntime.OptimizerAlgSync_initialize(self, *args)",
"def init_algorithm(self):\n pass",
"def __init__(self, api_config):\n AbstractOptimizer.__init__(self, api_config)\n \n api_space = BoEI.api_manipulator(api_config) # used for GP... | [
"0.77678543",
"0.69042856",
"0.6393876",
"0.6368886",
"0.63558286",
"0.6316436",
"0.6221916",
"0.6161504",
"0.6133926",
"0.60912806",
"0.60527676",
"0.6027273",
"0.5995777",
"0.5924603",
"0.5856437",
"0.58296204",
"0.5811582",
"0.58013225",
"0.5764076",
"0.5739395",
"0.573787... | 0.81875587 | 0 |
The equivalent of numpy's "dot" | def dot(array1, array2):
return Nd4jArray(array1.array.mmul(array2.array)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dot(a, b):\n return np.vdot(a.arr,b.arr)",
"def _dot(a, b):\n return np.einsum('ijk,ikl->ijl', a, b)",
"def vdot(a, b):\n return np.vdot(a.ravel(), b.ravel())",
"def vec_dot(x, y):\r\n return sum(a * b for a, b in zip(x, y))",
"def vec_dot(v1,v2):\r\n \r\n return np.dot(v1,v2)",
"def ... | [
"0.82776165",
"0.8273074",
"0.79598564",
"0.7946015",
"0.78992903",
"0.7857727",
"0.77509946",
"0.77504516",
"0.7720843",
"0.7702519",
"0.77008337",
"0.76983684",
"0.7680552",
"0.76729745",
"0.76525265",
"0.75721055",
"0.75491023",
"0.7544521",
"0.75433385",
"0.7529519",
"0.7... | 0.7277077 | 48 |
Convert a number to a scalar ndarray | def _to_number(number):
return nd4j.scalar(number) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_scalar(var):\n return var.view(-1).data.tolist()[0]",
"def scalararray(inp) -> np.ndarray:\n return np.array([None, inp], dtype=object)[[1]].reshape([])",
"def convert_scalar(self, v, t):\n return v.asnumpy().item()",
"def to_scalar(self, v):\n raise NotImplementedError('to_scalar'... | [
"0.6826675",
"0.66992795",
"0.65640783",
"0.6399014",
"0.6336081",
"0.632291",
"0.6318561",
"0.6255882",
"0.62347454",
"0.6218334",
"0.62116766",
"0.6174438",
"0.60495514",
"0.60222423",
"0.60157114",
"0.597469",
"0.59731877",
"0.595042",
"0.59376794",
"0.5936643",
"0.5892181... | 0.7067213 | 0 |
Create an nd4j ndarray from a numpy array (passing the numpy pointer buffer by reference) | def from_np(np_arr):
np_arr = _align_np_datatype_for_array(np_arr)
# nd4j doesn't have 1d arrays. Convert to a row vector
if np_arr.ndim == 1:
np_arr = np.reshape(np_arr, (1, np_arr.size))
data_buffer = get_buffer_from_arr(np_arr).data_buffer
_assert_data_type_length(data_buffer)
# ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cpointer_to_ndarray(ptr, size, dtype, shape):\n buf = np.core.multiarray.int_asbuffer(\n ctypes.addressof(ptr.contents), np.dtype(dtype).itemsize * size)\n arr = np.ndarray(shape, dtype=dtype, buffer=buf)\n return arr",
"def get_buffer_from_arr(np_arr):\n\n pointer_address = get_array_addr... | [
"0.6860564",
"0.6643502",
"0.6389973",
"0.6379136",
"0.63027567",
"0.62968016",
"0.6223093",
"0.6206956",
"0.61109513",
"0.60370165",
"0.59652424",
"0.5963501",
"0.5950535",
"0.59458935",
"0.589819",
"0.58875847",
"0.58782184",
"0.5842114",
"0.5832344",
"0.58213294",
"0.58072... | 0.7589337 | 0 |
Handle the 'about' page. | def about(self):
return dict(page='about') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def about_page(request):\r\n return render(request, 'ez_main/about_page.html')",
"def on_about(self):\n render_about_window()",
"def about():\n\n return render_template('about_page.html', title='About')",
"def about_page(request):\n\n return render(request, 'about_page/about_page.html')",
"d... | [
"0.7947727",
"0.7801163",
"0.77714527",
"0.7735051",
"0.77301514",
"0.7610675",
"0.7580613",
"0.75796306",
"0.7572322",
"0.7557062",
"0.75481075",
"0.75284654",
"0.7513668",
"0.7512283",
"0.7512283",
"0.7430789",
"0.7428942",
"0.7427831",
"0.742304",
"0.74222153",
"0.74001",
... | 0.0 | -1 |
Set the string representation of the class. | def __str__(self):
if self.filename:
filename = self.filename
else:
filename = 'Unknown'
if self.endian == '<':
endian = 'Little Endian'
else:
endian = 'Big Endian'
ret_val = ('FILE: %s\nRecord Offset: %i byte\n' +
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setString(self, name: unicode, value: unicode) -> None:\n ...",
"def stringify(self) -> None:\n self._stringify = True",
"def __str__(self):\n return self.string",
"def __str__(self): # reliably restored by inspect\n pass",
"def __str__(self) -> str:\n return self.enc... | [
"0.6487029",
"0.6305368",
"0.62046957",
"0.61895657",
"0.61197263",
"0.6088611",
"0.60507715",
"0.6003458",
"0.6003458",
"0.6003458",
"0.59974086",
"0.5974958",
"0.59605026",
"0.5936551",
"0.5936128",
"0.5936128",
"0.59317434",
"0.5922588",
"0.5909734",
"0.58766603",
"0.58667... | 0.0 | -1 |
Return a friendly HTTP greeting. | def hello():
return 'Hello World!' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_greeting(name):\n\n greeting = (f\"Hello, {name.title()}. It's nice to meet you!\")\n return greeting",
"def welcome():\n return 'Welcome to Flask!'",
"def greeting_message(name):\n print('My name is ' + name)",
"def Welcome():\n return (\n f\"Welcome to the Surf's Up API!\... | [
"0.67860854",
"0.6719625",
"0.67095745",
"0.6680697",
"0.6663219",
"0.6638394",
"0.6633062",
"0.6628187",
"0.6556032",
"0.6536937",
"0.64776874",
"0.6477268",
"0.64715713",
"0.64644194",
"0.6443056",
"0.6435385",
"0.6400719",
"0.6400167",
"0.637615",
"0.637615",
"0.6367243",
... | 0.0 | -1 |
Crops (or slices) a Tensor on a given dimension from start to end | def crop(dimension, start, end):
def func(x):
if dimension == 0:
return x[start: end]
if dimension == 1:
return x[:, start: end]
if dimension == 2:
return x[:, :, start: end]
if dimension == 3:
return x[:, :, :, start: end]
if d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def crop(X,size_crop=_size_crop):\n b = size_crop//2\n shape = tf.shape(X)\n cx= shape[0]//2\n cy= shape[1]//2\n return X[cx-b:cx+b,cy-b:cy+b,...]",
"def CropLayer(start, end, step=1, name=None):\n # See https://github.com/keras-team/keras/issues/890\n return keras.layers.Lambda(lambda x: x[... | [
"0.75142413",
"0.67958534",
"0.67952335",
"0.67656296",
"0.66794866",
"0.65812933",
"0.654544",
"0.6395801",
"0.6388426",
"0.63178444",
"0.624318",
"0.6238846",
"0.6233597",
"0.62291497",
"0.6165468",
"0.61553967",
"0.61509967",
"0.61480236",
"0.6137001",
"0.6081416",
"0.6020... | 0.7340079 | 1 |
Retrieves 'likelihood of use of force' numbers from force.nj.com website. These numbers are in 2 divs inside the 'race_breakdown' div. | def get_likelihood_numbers(div_name="left"):
race_breakdown = browser.find_element_by_class_name("racial_breakdown")
div = race_breakdown.find_element_by_class_name(div_name)
based_on = (
div.find_element_by_class_name("important_num2")
.get_property("innerHTML")
.strip()
.re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_rate_of_force():\n rank_five_years = browser.find_element_by_id(\"rank_five_years\")\n rate_of_force_sentence = rank_five_years.find_element_by_class_name(\n \"third_label\"\n ).get_property(\"innerHTML\")\n clean_sentence = (\n \" \".join(rate_of_force_sentence.split())\n ... | [
"0.57246894",
"0.565999",
"0.54239106",
"0.53009146",
"0.52520365",
"0.5104661",
"0.50448525",
"0.503655",
"0.5031596",
"0.5026367",
"0.50189066",
"0.50106543",
"0.4970183",
"0.49391696",
"0.49059322",
"0.48848364",
"0.48807994",
"0.4863742",
"0.48521334",
"0.48519793",
"0.48... | 0.7476507 | 0 |
Returns an array of shape [group_size, timesteps] that contains the series values. | def get_series(gval, series):
minlen = min([len(d[series]) for f, d in gval])
return np.stack([d[series][:minlen] for f, d in gval]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_timeseries_on_points(self, varname, points):\n res = np.zeros((len(points), self.ntimestep), dtype=np.float64)\n for record in range(self.ntimestep):\n res[:, record] = self.get_data_on_points(varname, record, points)\n return res",
"def make_timeseries_instances(timeserie... | [
"0.61537445",
"0.597137",
"0.5970503",
"0.59157646",
"0.59153384",
"0.5879926",
"0.5847434",
"0.57591003",
"0.5723493",
"0.57063866",
"0.56766707",
"0.56580156",
"0.5607762",
"0.5583387",
"0.55685335",
"0.5548649",
"0.55418396",
"0.55353934",
"0.5518743",
"0.5507648",
"0.5499... | 0.579629 | 7 |
Reads the candidate CSV at file_name into a pandas dataframe. | def read_dataframe_candidate(file_name, n):
cols = ["Name"]
cols.extend(["Mentor Choice {}".format(i + 1) for i in range(n)])
cols.append("Year")
return read_dataframe(file_name, cols) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_csv_from_file(self, file_name):\r\n try:\r\n self.csv_df = pd.read_csv(file_name)\r\n except FileNotFoundError:\r\n print('File does not exists!')",
"def read_from_file_no_check(file_name: str) -> pd.DataFrame:\n return pd.read_csv(file_name)",
"def load_csv_file... | [
"0.77609193",
"0.77473843",
"0.7496029",
"0.7412761",
"0.73846906",
"0.73559046",
"0.7340604",
"0.73132277",
"0.72902495",
"0.7171754",
"0.7170341",
"0.71578044",
"0.70925534",
"0.70819634",
"0.7068748",
"0.70647365",
"0.70647365",
"0.70647365",
"0.70583594",
"0.7044605",
"0.... | 0.0 | -1 |
Reads the mentor CSV at file_name into a pandas dataframe. | def read_dataframe_mentor(file_name, n):
cols = ["Name"]
cols.extend(["Candidate Choice {}".format(i + 1) for i in range(n)])
cols.append("Year")
return read_dataframe(file_name, cols) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_csv_from_file(self, file_name):\r\n try:\r\n self.csv_df = pd.read_csv(file_name)\r\n except FileNotFoundError:\r\n print('File does not exists!')",
"def read_data(file):\n data = pd.read_csv('facebook-links.txt.anon', delimiter=\"\\t\", header=None)\n data.colu... | [
"0.7182008",
"0.709139",
"0.69291466",
"0.6909193",
"0.69042975",
"0.68525136",
"0.6825149",
"0.6825149",
"0.6825149",
"0.6794578",
"0.6705323",
"0.66896296",
"0.6684448",
"0.66769814",
"0.66702247",
"0.66480273",
"0.66234004",
"0.66059583",
"0.6604134",
"0.6598902",
"0.65962... | 0.0 | -1 |
Reads the contents of the CSV at file_name into a pandas dataframe. Returns only the columns specified, so the contents of the other columns are removed | def read_dataframe(file_name, columns):
df = pd.read_csv(file_name, sep = ",")
return df[columns] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_csv_to_dataframe(file_name):\n df = pd.read_csv(file_name)\n df = df.drop(['Unnamed: 0'], axis=1)\n return df",
"def read_from_file_no_check(file_name: str) -> pd.DataFrame:\n return pd.read_csv(file_name)",
"def get_df_from_csv(input_file_name):\n df = pd.read_csv(input_file_name)\n ... | [
"0.8400378",
"0.80289507",
"0.77912444",
"0.7483496",
"0.7308314",
"0.7279259",
"0.72785074",
"0.725898",
"0.7205976",
"0.71855587",
"0.71761286",
"0.7168019",
"0.71657425",
"0.71650904",
"0.7121645",
"0.7027538",
"0.699706",
"0.6949972",
"0.6938592",
"0.6885183",
"0.68824077... | 0.75084597 | 3 |
Plot a line with a linear alpha gradient filled beneath it. | def gradient_fill(x, y, fill_color=None, ax=None, **kwargs):
if ax is None:
ax = plt.gca()
line, = ax.plot(x, y, **kwargs)
if fill_color is None:
fill_color = line.get_color()
zorder = line.get_zorder()
alpha = line.get_alpha()
alpha = 1.0 if alpha is None else alpha
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def line(l, color='k', **kwargs):\n ax.plot(wfl(nth(l, 0)), hfl(nth(l, 1)), color=color, **kwargs)",
"def plot_regression_line():\r\n axes = plt.gca()\r\n x_vals = np.array(axes.get_xlim())\r\n y_vals = y_intercept() + slope() * x_vals\r\n plt.plot(x_vals, y_vals)",
"def line... | [
"0.66440046",
"0.6613925",
"0.6612405",
"0.6563425",
"0.65289396",
"0.6422045",
"0.6422045",
"0.63910335",
"0.6390396",
"0.63902336",
"0.63688433",
"0.63593596",
"0.6357988",
"0.6315235",
"0.6297632",
"0.6262358",
"0.62425077",
"0.6216984",
"0.618948",
"0.61374354",
"0.612745... | 0.61993897 | 18 |
Outputs a JSON file with the correct structure. Returns the data as a list of dictionaries. | def process_map(file_in, pretty = False):
file_out = "{0}.json".format(file_in)
data = []
with codecs.open(file_out, "w") as fo:
for _, element in ET.iterparse(file_in):
el = shape_element(element)
if el:
data.append(el)
if pretty:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def output_jsonl(filename: str, data: List):\n with open(filename, \"w\") as outfile:\n for x in data:\n print(json.dumps(x))\n json.dump(x, outfile)\n outfile.write(\"\\n\")",
"def export_json(meta, data, output):\n\n formatted = { k: list(v.values()) for k, v in da... | [
"0.7320298",
"0.72591424",
"0.71905684",
"0.69907105",
"0.6985157",
"0.6964029",
"0.68853754",
"0.68769604",
"0.68448603",
"0.6829484",
"0.6792914",
"0.6772044",
"0.6729491",
"0.672088",
"0.66414875",
"0.66275954",
"0.66243225",
"0.66187763",
"0.66157293",
"0.6595966",
"0.656... | 0.0 | -1 |
Raise exception if value is not a Binary type. | def validate_strip(cls, value: str) -> str:
if cls.strip is True:
value = value.strip()
return value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_binary(self):\n return self._vtype is self.BINARY",
"def validateTagValue(obj, attribute, value):\n if isinstance(value, dict):\n if sorted(value.iterkeys()) != BINARY_VALUE_KEYS:\n raise ValueError(\"Can't store invalid binary value: %r\" % value)\n return value",
"def checkT... | [
"0.67115235",
"0.6241545",
"0.61557156",
"0.61237323",
"0.6113071",
"0.61129737",
"0.60338545",
"0.60203403",
"0.60054797",
"0.5979806",
"0.59292954",
"0.5888169",
"0.58707136",
"0.582955",
"0.5807684",
"0.575709",
"0.5700912",
"0.56944424",
"0.56943136",
"0.56412524",
"0.561... | 0.0 | -1 |
Returns the item at the given index. | def __getitem__(self, item):
if not 0 <= item < self.n:
return IndexError("Item is out of bounce.")
return self.original_array[item] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_item(self, index: int) -> _T:\n return self.index_to_item[index]",
"def get_by_index(self, index):\n if index > self.length - 1:\n return None\n else:\n return self.items[index]",
"def get_item(self, index):\n if index == 0:\n raise IndexErro... | [
"0.9106033",
"0.8629514",
"0.856631",
"0.84436053",
"0.8386741",
"0.8314993",
"0.8269337",
"0.82434547",
"0.8107382",
"0.7999062",
"0.7946691",
"0.7946691",
"0.7884302",
"0.7864083",
"0.7854244",
"0.7846444",
"0.7837313",
"0.7787859",
"0.7784993",
"0.77576095",
"0.77322066",
... | 0.0 | -1 |
Adds an element to at the last index in the array. | def append(self, element):
if self.n == self.capacity:
self._resize(2*self.capacity) # resizing by 2x if size is not enough
self.original_array[self.n] = element
self.n += 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add(self, elem):\n self.add_last(elem)",
"def add_last(self, e):\n self._insert_between(e, self._tail._prev, self._tail)",
"def add_last(self, elem):\n if self.is_empty():\n self.head = self.tail = self.Node(elem, None, None)\n else:\n self.tail.nxt = self.... | [
"0.72298443",
"0.70436496",
"0.6808906",
"0.6608777",
"0.6498372",
"0.6483794",
"0.6472479",
"0.6471982",
"0.6471614",
"0.64304525",
"0.6387907",
"0.6367448",
"0.6349098",
"0.63329273",
"0.63193005",
"0.6279486",
"0.6272994",
"0.6208235",
"0.61971366",
"0.6178438",
"0.6165764... | 0.66542286 | 3 |
Convert a scipy sparse matrix to a torch sparse tensor. | def sparse_mx_to_torch_sparse_tensor(sparse_mx):
sparse_mx = sparse_mx.tocoo().astype(np.float32)
indices = torch.from_numpy(
np.vstack((sparse_mx.row, sparse_mx.col)).astype(np.int64))
values = torch.from_numpy(sparse_mx.data)
shape = torch.Size(sparse_mx.shape)
return torch.sparse.FloatTen... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def csr2tensor(self, matrix: sp.csr_matrix):\n matrix = matrix.tocoo()\n x = torch.sparse.FloatTensor(\n torch.LongTensor(np.array([matrix.row, matrix.col])),\n torch.FloatTensor(matrix.data.astype(np.float32)),\n matrix.shape,\n ).to(self.device)\n retu... | [
"0.8299787",
"0.8148542",
"0.8045949",
"0.80325705",
"0.80134654",
"0.79973555",
"0.79973555",
"0.7985302",
"0.7985302",
"0.7985302",
"0.7977018",
"0.79650825",
"0.7754673",
"0.7713117",
"0.7429514",
"0.7429514",
"0.735423",
"0.71969247",
"0.7156927",
"0.69882196",
"0.6969645... | 0.80300856 | 10 |
Set's the unique name to the given value. If this class can be referenced by unique name (see stringable) this needs to be implemented | def set_unique_name(self, value):
raise NotImplementedError("Not implemented for "+str(type(self))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setName(self,value):\n assert value == None or type(value) == str, repr(value)+' is not a valid name'\n self._name = value",
"def name(self, value):\n self._name = c(value)",
"def name(self, value: str) -> None:\n self._name = value",
"def name(self, value):\n self._nam... | [
"0.80736",
"0.7962945",
"0.79328364",
"0.7845133",
"0.7845133",
"0.75111175",
"0.738424",
"0.72925436",
"0.7233363",
"0.71925825",
"0.7158312",
"0.7142433",
"0.70786697",
"0.7069268",
"0.7065132",
"0.7065132",
"0.7065132",
"0.7065132",
"0.7042781",
"0.7042781",
"0.7042781",
... | 0.9024151 | 0 |
Checks whether this instance is equivalent to the other instance. Should be reimplemented matching to the specific class. | def equivalent(self, other):
return id(self) == id(other) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return isinstance(other, self.__class__)",
"def same_as(self, other):\n return super().__eq__(other)",
"def __eq__(self, other):\n # Ensure same class and values match\n if isinstance(other, self.__class__):\n return self.__dict__ == other.__dic... | [
"0.7864676",
"0.786059",
"0.7814966",
"0.77419007",
"0.7711112",
"0.7711112",
"0.7707256",
"0.7653467",
"0.7627162",
"0.76209986",
"0.76155514",
"0.76035124",
"0.75941706",
"0.75941706",
"0.7589693",
"0.7576895",
"0.7576895",
"0.7576895",
"0.7574681",
"0.75739515",
"0.7572675... | 0.8154365 | 0 |
Get resource group name from the Azure resource id | def get_resource_group_name(resource_id):
match_groups = re.match(r".*resourcegroups/(?P<group_name>[^/]*)/.*", resource_id, flags=re.IGNORECASE)
return match_groups.group("group_name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resource_group_name(self) -> str:\n return pulumi.get(self, \"resource_group_name\")",
"def resource_group_id(self) -> str:\n return pulumi.get(self, \"resource_group_id\")",
"def resource_group_id(self) -> str:\n return pulumi.get(self, \"resource_group_id\")",
"def resource_group_i... | [
"0.7744581",
"0.7702116",
"0.7702116",
"0.7702116",
"0.7702116",
"0.7702116",
"0.76332533",
"0.76332533",
"0.76332533",
"0.76332533",
"0.76332533",
"0.76332533",
"0.76332533",
"0.76332533",
"0.76332533",
"0.76332533",
"0.76332533",
"0.76332533",
"0.7574852",
"0.7574852",
"0.7... | 0.84541345 | 0 |
Get image name from the Azure image reference id | def get_image_name(resource_id):
match_images = re.match(r".*images/(?P<image_name>[^/]*).*", resource_id, flags=re.IGNORECASE)
if match_images:
return match_images.group("image_name")
return "" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_image_ref() -> str:\n images_rq = request(\n method=\"GET\", url=app.config[\"IMAGE_REF\"], headers=build_header(),\n )\n if not images_rq.ok:\n HTTPError(f\"Can not get image id for virtual machine: {images_rq.status_code}\")\n\n [image] = images_rq.json()[\"images\"]\n return... | [
"0.72672355",
"0.72121674",
"0.72121674",
"0.710759",
"0.7094658",
"0.6998107",
"0.68944526",
"0.6856822",
"0.6836662",
"0.6836662",
"0.68076444",
"0.68076444",
"0.6802989",
"0.6771635",
"0.6746224",
"0.66932",
"0.6685868",
"0.6639236",
"0.66372114",
"0.66343695",
"0.66251403... | 0.80220264 | 0 |
Return a list of two numpy onedimensional float array one with the cell center x coordinate and the other with the cell center y coordinate for every row in the grid in model space not offset of rotated, with the cell center y coordinate. | def xyzcellcenters(self):
cache_index = 'cellcenters'
if cache_index not in self._cache_dict or \
self._cache_dict[cache_index].out_of_date:
# get x centers
x = np.add.accumulate(self.__delr) - 0.5 * self.delr
# get y centers
Ly = np.add.re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cells_list(self):\n xx, yy = np.meshgrid(self.x_spacings, self.y_spacings)\n return np.vstack([yy.ravel(), xx.ravel()]).transpose()",
"def grid_coords(self):\n return [(x, y) for y in range(self.height) for x in range(self.width)]",
"def get_square_centers(self):\n x_values = np... | [
"0.7504642",
"0.74383736",
"0.7284616",
"0.68211687",
"0.66605186",
"0.66504335",
"0.660722",
"0.6605177",
"0.6565715",
"0.65028226",
"0.6484985",
"0.64630383",
"0.6430854",
"0.6422824",
"0.64218557",
"0.6411079",
"0.6378087",
"0.63702494",
"0.63550055",
"0.6320465",
"0.63157... | 0.6121285 | 37 |
Get the row and column of a point with coordinates x and y When the point is on the edge of two cells, the cell with the lowest row or column is returned. | def intersect(self, x, y, local=False, forgive=False):
# transform x and y to local coordinates
x, y = super(StructuredGrid, self).intersect(x, y, local, forgive)
# get the cell edges in local coordinates
xe, ye = self.xyedges
xcomp = x > xe
if np.all(xcomp) or not np.a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute_row_col(self, x, y):\n if self.is_in_small_cell_area(x, y):\n x = int(math.fabs(x - self.xoffset))\n col = x / self.small.width\n row = (self.small_yoffset - y) / self.small.height\n else:\n col = (x - self.xoffset) / self.large.width\n ... | [
"0.7402952",
"0.72800076",
"0.7230437",
"0.7165762",
"0.71515787",
"0.7010293",
"0.7007674",
"0.6883838",
"0.68620276",
"0.6762954",
"0.67166597",
"0.6690788",
"0.6624837",
"0.6604122",
"0.65908575",
"0.6581562",
"0.657649",
"0.6550092",
"0.6527122",
"0.6526927",
"0.650502",
... | 0.6467623 | 23 |
Get vertices for a single cell or sequence of i, j locations. | def _cell_vert_list(self, i, j):
self._copy_cache = False
pts = []
xgrid, ygrid = self.xvertices, self.yvertices
pts.append([xgrid[i, j], ygrid[i, j]])
pts.append([xgrid[i + 1, j], ygrid[i + 1, j]])
pts.append([xgrid[i + 1, j + 1], ygrid[i + 1, j + 1]])
pts.append... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_cell_vertices(self, i, j):\n self._copy_cache = False\n cell_verts = [(self.xvertices[i, j], self.yvertices[i, j]),\n (self.xvertices[i, j+1], self.yvertices[i, j+1]),\n (self.xvertices[i+1, j+1], self.yvertices[i+1, j+1]),\n (sel... | [
"0.75053334",
"0.63540584",
"0.6214483",
"0.6202144",
"0.6152159",
"0.613269",
"0.61114234",
"0.61114234",
"0.60920316",
"0.6039242",
"0.6017772",
"0.6011162",
"0.598754",
"0.59409946",
"0.5926104",
"0.5903147",
"0.5900089",
"0.5866817",
"0.5834045",
"0.58320314",
"0.5816481"... | 0.6499889 | 1 |
Plot the grid lines. | def plot(self, **kwargs):
from ..plot import PlotMapView
mm = PlotMapView(modelgrid=self)
return mm.plot_grid(**kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_lines(self):\n self.plot(3)",
"def draw_grid(plt):\n x0, x1, x2, x3 = 0, 3057, 6508, 9860\n y0, y1, y2, y3, y4, y5, y6, y7, y8 = 0, 1535, 2041, 2547, 3053, 3559, 4257, 5303, 6978\n alpha, linewidth = 0.3, 0.5\n\n # Vertical Lines\n plt.plot((x0, x0), (y0, y8), 'black', alpha=alpha,... | [
"0.77306366",
"0.7440607",
"0.71641326",
"0.71400976",
"0.70725334",
"0.7071036",
"0.706398",
"0.70392907",
"0.70115954",
"0.69848794",
"0.69813",
"0.69724023",
"0.6855517",
"0.68539494",
"0.67763984",
"0.67680395",
"0.6760518",
"0.6744388",
"0.67417234",
"0.6659664",
"0.6651... | 0.0 | -1 |
Validate if the Option is a valid URL with HTTPS schema. | def is_https_url(value):
url = urlparse(value)
if url.scheme != "https":
raise ValidationError("The schema must be HTTPS")
if url.netloc is None or url.netloc == "":
raise ValidationError("The URL is missing the net location")
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_url(self, v):\n u = urlparse.urlparse(v)\n if u.scheme.lower() not in ('http', 'https'):\n raise ValueError('URL scheme must be either http:// or https://')\n if not u.netloc:\n raise ValueError('URL must specify a network location.')\n return u.scheme.lower() == 'https'",
"def... | [
"0.79084134",
"0.71311086",
"0.70606107",
"0.68473023",
"0.67056584",
"0.6607239",
"0.657681",
"0.64448595",
"0.64398307",
"0.6399537",
"0.6303279",
"0.6301982",
"0.62234974",
"0.6160185",
"0.61581695",
"0.61558557",
"0.61405444",
"0.60708654",
"0.6067984",
"0.6067264",
"0.60... | 0.8035799 | 0 |
Index page for webgame | def index():
return render_template('index.html') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index():\n isoko = get_sources('general')\n\n head = \"ALLOVER THE WORLD NEWS\"\n return render_template('index.html', title = head, isoko = isoko)",
"def index():\n\n\treturn(render_template('index.html'))",
"def index():\n\n return render_template(\"index.html\"), 200",
"def index():\n r... | [
"0.7440947",
"0.7281876",
"0.728052",
"0.7277984",
"0.7259999",
"0.72446865",
"0.716484",
"0.71619564",
"0.7153452",
"0.7150985",
"0.71438223",
"0.71385473",
"0.71385473",
"0.7121479",
"0.7106305",
"0.71032816",
"0.71032816",
"0.7061996",
"0.7050072",
"0.7038561",
"0.7038561"... | 0.70019734 | 44 |
If the number of comments is much higher than 5 in test response it would be better to check selected few of them or even only one | def test_comments_structure(self):
for comment in self.resp_json:
assert type(comment) == dict | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_comments_len(self):\n comments = self.story.get_comments()\n soup = utils.get_item_soup(7324236)\n for anchor in soup.find_all('a'):\n if 'More' in anchor.text:\n more_button_present = True\n\n # Note: Hacker News is not consistent about the number... | [
"0.68896806",
"0.64463276",
"0.6385225",
"0.6381302",
"0.637915",
"0.6258812",
"0.62467945",
"0.61738294",
"0.61045444",
"0.6084013",
"0.6064983",
"0.6056753",
"0.60416317",
"0.60391295",
"0.5997156",
"0.59629095",
"0.5925741",
"0.59152126",
"0.59086967",
"0.5868927",
"0.5814... | 0.64648414 | 1 |
Returns cosine distance between predictions and observations | def compute_cosine_local_image_features(pred_location, pred_scale, obs):
pred_location, pred_scale, obs = reshape_local_image_features(pred_location, pred_scale, obs)
# compute cosine distance between ground truth image features and generated image features (zs)
image_cosine = comput... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute_cosine(pred, obs):\n assert(pred.numel() == obs.numel()), \\\n 'Size of observation and prediction tensors much match. Received: pred %s, obs %s.'%(\n str(pred.size()), str(obs.size()))\n\n def normalise(x, dim=1):\n \"\"\" compute L2 norm and normalise x \"\"... | [
"0.7559747",
"0.74727285",
"0.69441396",
"0.68658584",
"0.68453574",
"0.683191",
"0.66757095",
"0.66380966",
"0.661828",
"0.6603164",
"0.65884",
"0.65538114",
"0.6552099",
"0.65217966",
"0.6475256",
"0.64743584",
"0.6449162",
"0.63926864",
"0.6384966",
"0.63498056",
"0.634980... | 0.6639921 | 7 |
Returns cosine distance between predictions and observations | def compute_cosine_global_image_features(pred_location, pred_scale, obs):
pred_location, pred_scale, obs = reshape_global_image_features(pred_location, pred_scale, obs)
# compute cosine distance between ground truth image features and generated image features (zs)
image_cosine = comp... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute_cosine(pred, obs):\n assert(pred.numel() == obs.numel()), \\\n 'Size of observation and prediction tensors much match. Received: pred %s, obs %s.'%(\n str(pred.size()), str(obs.size()))\n\n def normalise(x, dim=1):\n \"\"\" compute L2 norm and normalise x \"\"... | [
"0.7559747",
"0.74727285",
"0.69441396",
"0.68658584",
"0.68453574",
"0.683191",
"0.6639921",
"0.66380966",
"0.661828",
"0.6603164",
"0.65884",
"0.65538114",
"0.6552099",
"0.65217966",
"0.6475256",
"0.64743584",
"0.6449162",
"0.63926864",
"0.6384966",
"0.63498056",
"0.6349805... | 0.66757095 | 6 |
Produces B^t Ni (data B D Mlik) in TQU space, that is fed into the qlm estimator. | def _Mlik2ResTQUMlik_diag(field, ninv_filt, TQUMlik, data, f, fi):
assert field in ['T', 'Q', 'U']
f_id = ffs_id_displacement(ninv_filt.lib_skyalm.shape, ninv_filt.lib_skyalm.lsides)
ninv_filt.set_ffi(f, fi)
_map = data - ninv_filt.apply_R(field, TQUMlik)
ninv_filt.apply_map(f, _map, inplace=True)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def qMethod(g_b, g_n, m_b, m_n):\n\tB = g_b @ g_n.T + m_b @ m_n.T\n\tZ = (np.cross(g_b.flatten(), g_n.flatten()) + np.cross(m_b.flatten(), m_n.flatten())).reshape(-1, 1)\n\tK = np.block([[B + B.T - np.trace(B) * np.eye(3), Z], # quadratic cost max qTKq\n\t\t\t\t [Z.T, np.trace(B)]])\n\tw, v = np.linalg.eig(K)\n\... | [
"0.6256147",
"0.6052208",
"0.60102415",
"0.57456934",
"0.56963843",
"0.5610071",
"0.5568582",
"0.55475044",
"0.54643166",
"0.5450698",
"0.5417998",
"0.53223914",
"0.531416",
"0.53111607",
"0.52984786",
"0.5293964",
"0.52848834",
"0.5284779",
"0.5252042",
"0.5250998",
"0.52436... | 0.55745757 | 6 |
Calculate the energy injected by supernovae in a given time. This will have units of ergs per year. This calculation calculates the energy injected in the given timestep by integrating over the energy from stars dying in the the time interval (time, time + timestep) to get the total energy, then dividing by the time to... | def energy_erg_yr_supernovae(self, time, timestep, metallicity):
# get the mass limits of the timesteps the user passed in. The
# lower time corresponds to the higher stellar mass
m_low = self.lifetimes.turnoff_mass(time + timestep, metallicity)
m_high = self.lifetimes.turnoff_mass(time,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate(self, time):\n from numpy import sqrt\n\n gamma = self.gamma\n xr, r1, p1, u1 = self.vn[0]\n xl, r4, p4, u4 = self.vn[3]\n\n a4 = sqrt(gamma*p4/r4)\n a1 = sqrt(gamma*p1/r1)\n\n # calculate region 2.\n p41 = p4/p1\n p21 = self.strength(p4/... | [
"0.6742708",
"0.630998",
"0.61262596",
"0.6125092",
"0.6024607",
"0.5945905",
"0.5816915",
"0.5804417",
"0.5782341",
"0.57699865",
"0.5769137",
"0.57177836",
"0.56862104",
"0.56768095",
"0.56515694",
"0.56502306",
"0.5634813",
"0.5628416",
"0.5617637",
"0.5609283",
"0.557891"... | 0.7025803 | 0 |
Get the cumulative mass lost between the beginning of an SSP's life and the age at which a given star is moving off the main sequence. This will have units of solar masses. This calculation assumes that massive stars lose mass at a constant rate throughout their main sequence lifetime. The mass loss rate for a given st... | def cumulative_mass_loss_winds(self, mass, metallicity):
# Define the mass limits of the integral. Since we're calculating the
# cumulative mass, we're always considering the whole mass range. The
# only thing that changes with time is time, and how much each star
# has contributed, whic... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def steel_total_moment(self,strain_dis,na_z):\r\n\t\ttotal_moment = 0.0\r\n\t\tfor steel in self.reinforcement:\r\n\t\t\tstrain = np.interp(steel[0], self.mesh_center,strain_dis)\r\n\t\t\tforce = (self.steel(strain)-self.concrete(strain))*steel[1]\r\n\t\t\ttotal_moment = total_moment + force*(steel[0]-na_z)\r\n\t\... | [
"0.58299446",
"0.5730747",
"0.5703498",
"0.54586357",
"0.5412575",
"0.53895235",
"0.52521545",
"0.51173866",
"0.5117087",
"0.51055473",
"0.5089818",
"0.5069426",
"0.5039918",
"0.5005727",
"0.498302",
"0.49761406",
"0.49756926",
"0.49715137",
"0.49605852",
"0.495838",
"0.49443... | 0.65787804 | 0 |
Computes the alpha for the CW/SCW algorithms. The `alpha` variable is used to determine the magnitude of update that needs to be applied to the weights. | def _get_alpha(self, m_t, v_t):
return max(0, ((-m_t * self._psi
+ math.sqrt((m_t ** 2 * self._phi ** 4)
/ 4 + v_t * self._phi ** 2 * self._xi))
/ (v_t * self._xi))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clAlphaW(self):\n A = 2 * pi * self.aspectRatioW\n B = (self.aspectRatioW * self.betaW / self.airfoilEffW)**2\n C = 1 + ((tan(radians(self.sweep50W)))**2) / (self.betaW**2)\n return A / (2 + sqrt(4 + B * C))",
"def test_prop_alpha(self):\n # reproducible arbitrariness\n np.r... | [
"0.6907705",
"0.6739521",
"0.6739521",
"0.66540694",
"0.647519",
"0.6453189",
"0.6395048",
"0.63925457",
"0.63390386",
"0.6329779",
"0.6303836",
"0.62929285",
"0.62763953",
"0.62763953",
"0.626389",
"0.62578696",
"0.6235748",
"0.6235748",
"0.6235748",
"0.6190242",
"0.6175132"... | 0.0 | -1 |
Initializes the values for the model' parameters. Based on the data in argument, this method initializes the parameters `sigma`, `phi`, `psi` and `x_i`. | def _setup(self, X: np.ndarray):
self._sigma = self._a * np.eye(X.shape[1])
self._phi = norm.ppf(self._eta)
self._psi = 1 + (self._phi ** 2) / 2
self._xi = 1 + self._phi ** 2 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def standard_init(self, data):\n comm = self.comm\n H = self.H\n my_y = data['y']\n my_N, D = my_y.shape\n\n assert D == self.D\n\n # Calculate averarge W\n W_mean = parallel.allmean(my_y, axis=0, comm=comm) # shape: (D, )\n\n # Calculate data v... | [
"0.7118763",
"0.68642336",
"0.6758445",
"0.67167825",
"0.67078376",
"0.6705983",
"0.67021585",
"0.66976804",
"0.66822815",
"0.66651964",
"0.6650959",
"0.66064304",
"0.65579665",
"0.6472733",
"0.64611894",
"0.643455",
"0.64272916",
"0.6412706",
"0.6388015",
"0.6367039",
"0.636... | 0.7134091 | 0 |
Asks user to specify a city, month, and day to analyze. | def get_filters():
print('Hello! Let\'s explore some US bikeshare data!')
# get user input for city (chicago, new york city, washington). HINT: Use a while loop to handle invalid inputs
city = input("Enter a city (Chicago / New York City / Washington): ").lower()
while city not in CITY_DATA.keys():
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Raw_Data(city,month,day):\n print(\"The city you have entered is: \",city)\n print(\"The month you have entered is: \",month)\n print(\"The day you have entered is: \",day)",
"def get_filters():\n city = None\n month = None\n day = None\n while day == None:\n # TO DO: get user input f... | [
"0.66714007",
"0.65354675",
"0.64593667",
"0.6374057",
"0.6348314",
"0.63097656",
"0.62868035",
"0.6259136",
"0.62316",
"0.62130964",
"0.62050414",
"0.6181105",
"0.6171822",
"0.61686903",
"0.6158568",
"0.61582303",
"0.61532456",
"0.61444426",
"0.6131269",
"0.610484",
"0.61025... | 0.58331597 | 53 |
Loads data for the specified city and filters by month and day if applicable. | def load_data(city, month, day):
df = pd.read_csv(CITY_DATA[city], parse_dates=['Start Time', 'End Time'])
df['Start month string'] = pd.DatetimeIndex(df['Start Time']).month_name()
df['Start day string'] = pd.DatetimeIndex(df['Start Time']).day_name()
if month != 'all':
month_filter = df['Sta... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_data(city, month, day):\n df = pd.read_csv(CITY_DATA [city])\n \n # convert the Start Time column to datetime\n df['Start Time'] = pd.to_datetime(df['Start Time'])\n \n # extract month and day of week from Start Time to create new columns\n df['month'] = df['Start Time'].dt.month\n ... | [
"0.81320685",
"0.8108889",
"0.8045821",
"0.8042514",
"0.80090284",
"0.79991937",
"0.7998333",
"0.7988789",
"0.797905",
"0.79737365",
"0.79610896",
"0.7956163",
"0.7947432",
"0.79463065",
"0.7908287",
"0.7908229",
"0.7904569",
"0.7900715",
"0.78930074",
"0.7889219",
"0.7882541... | 0.80071104 | 5 |
Displays statistics on the most frequent times of travel. | def time_stats(df):
print('\nCalculating The Most Frequent Times of Travel...\n')
start_time = time.time()
# display the most common month
most_common_month = df['Start month string'].mode()[0]
print('Most common month:\t', most_common_month)
# display the most common day of week
most_com... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def time_stats(df):\n\n print('\\nDisplaying the statistics on the most frequent times of '\n 'travel...\\n')\n start_time = time.time()\n\n # display the most common month\n most_common_month = df['Month'].mode()[0]\n print('For the selected filter, the month with the most travels is: ' +\... | [
"0.80235124",
"0.80223495",
"0.7914819",
"0.78260994",
"0.7821642",
"0.78139323",
"0.77653635",
"0.7739615",
"0.77358055",
"0.7733576",
"0.7686211",
"0.7667902",
"0.76510555",
"0.76440334",
"0.76391727",
"0.7636328",
"0.7624661",
"0.7622607",
"0.76119757",
"0.7599401",
"0.758... | 0.73737377 | 49 |
Displays statistics on the most popular stations and trip. | def start_station_stats(df):
print('\nCalculating The Most Popular Stations and Trip...\n')
start_time = time.time()
# display most commonly used start station
most_common_start_station = df['Start Station'].mode()[0]
print('Most common start station:\t', most_common_start_station)
# display ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def station_stats(df):\n\n print('\\nCalculating The Most Popular Stations and Trip...\\n')\n start_time = time.time()\n\n # display most commonly used start station\n print(popular_start_station(df))\n\n # display most commonly used end station\n print(popular_end_station(df))\n\n # display m... | [
"0.7815502",
"0.76617634",
"0.7553331",
"0.7491147",
"0.747456",
"0.74459386",
"0.7431019",
"0.7423337",
"0.74172765",
"0.7400016",
"0.7387015",
"0.7385145",
"0.73644745",
"0.735896",
"0.7356297",
"0.73543596",
"0.73516876",
"0.73508674",
"0.73499984",
"0.7341763",
"0.7340006... | 0.68855226 | 87 |
Displays statistics on the total and average trip duration. | def trip_stats(df):
print('\nCalculating Trip Duration...\n')
start_time = time.time()
# display total travel time
total_travel_time = df['Trip Duration'].sum()
total_travel_time = time.strftime("%H:%M:%S", time.gmtime(total_travel_time))
print('Total travel time:\t', total_travel_time)
#... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def trip_duration_stats(data):\n print('\\nCalculating Trip Duration...\\n')\n start_time = time.time()\n # display total travel time\n total_trip_time= data['Trip Duration'].sum()\n print('The Total Travel Time is {} Hours'. format(total_trip_time/3600))\n # display mean travel time\n avg_tri... | [
"0.814274",
"0.8025143",
"0.80041367",
"0.79496753",
"0.7937415",
"0.79312176",
"0.7926815",
"0.7915187",
"0.79142886",
"0.7908032",
"0.79055744",
"0.7900715",
"0.7891682",
"0.78894734",
"0.7886722",
"0.78851086",
"0.7884266",
"0.7882474",
"0.78738385",
"0.78686154",
"0.78664... | 0.78427446 | 34 |
Generate the name of the key for this flavor's hash. | def HashKey(flavor):
return 'NACL_TOOL_%s_HASH' % flavor.upper() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def key_name(self) -> str:\n return pulumi.get(self, \"key_name\")",
"def generate_key(self):\n return str(uuid4())",
"def key(self):\n key = self.name\n if self.task:\n key += getsource(self.task.__class__)\n return hashlib.md5(key.encode()).hexdigest()",
"def k... | [
"0.7488",
"0.7429307",
"0.73600364",
"0.7304559",
"0.72464776",
"0.718862",
"0.71711254",
"0.71184045",
"0.7084354",
"0.70744073",
"0.70333755",
"0.70333755",
"0.7004628",
"0.69619656",
"0.6957035",
"0.6938622",
"0.69032454",
"0.6885701",
"0.6879983",
"0.6867718",
"0.68629205... | 0.81271434 | 0 |
Gets the min_in_gbps of this ShapeNetworkingBandwidthOptions. The minimum amount of networking bandwidth, in gigabits per second. | def min_in_gbps(self):
return self._min_in_gbps | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def min_in_gbps(self, min_in_gbps):\n self._min_in_gbps = min_in_gbps",
"def MinGapBytes(self):\r\n\t\treturn self._get_attribute('minGapBytes')",
"def min_memory_gib(self) -> Optional[pulumi.Input[float]]:\n return pulumi.get(self, \"min_memory_gib\")",
"def MinKbpsRate(self):\n\t\treturn self... | [
"0.6912138",
"0.6791437",
"0.6739885",
"0.65856236",
"0.6357323",
"0.61697894",
"0.61697894",
"0.6157149",
"0.61396724",
"0.612507",
"0.61093056",
"0.60834736",
"0.6054049",
"0.6031995",
"0.6031995",
"0.6026044",
"0.6026044",
"0.6017039",
"0.59929556",
"0.59929556",
"0.599295... | 0.7757365 | 0 |
Sets the min_in_gbps of this ShapeNetworkingBandwidthOptions. The minimum amount of networking bandwidth, in gigabits per second. | def min_in_gbps(self, min_in_gbps):
self._min_in_gbps = min_in_gbps | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def min_in_gbps(self):\n return self._min_in_gbps",
"def config_gb_min(self):\n\n self._config_min()\n self.title = \"GB Minimization\"\n self.cntrl[\"cut\"] = 999.0\n self.cntrl[\"igb\"] = 1",
"def config_pbc_min(self):\n self._config_min()\n self.title = \"PBC... | [
"0.68751675",
"0.6780538",
"0.6285035",
"0.5760492",
"0.56505716",
"0.5630046",
"0.55846137",
"0.5520819",
"0.549046",
"0.5457754",
"0.54204243",
"0.54204243",
"0.5413351",
"0.5398297",
"0.5392833",
"0.5375725",
"0.5365129",
"0.5365129",
"0.5365129",
"0.5337964",
"0.529493",
... | 0.8137166 | 0 |
Gets the max_in_gbps of this ShapeNetworkingBandwidthOptions. The maximum amount of networking bandwidth, in gigabits per second. | def max_in_gbps(self):
return self._max_in_gbps | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_in_gbps(self, max_in_gbps):\n self._max_in_gbps = max_in_gbps",
"def max_memory_gib(self) -> Optional[pulumi.Input[float]]:\n return pulumi.get(self, \"max_memory_gib\")",
"def max_memory_gib(self) -> Optional[pulumi.Input[int]]:\n return pulumi.get(self, \"max_memory_gib\")",
"d... | [
"0.7028668",
"0.6906042",
"0.6664025",
"0.6664025",
"0.66097367",
"0.6559346",
"0.6504082",
"0.6504082",
"0.6504082",
"0.64960265",
"0.64960265",
"0.6482595",
"0.64206815",
"0.6349706",
"0.63408065",
"0.63408065",
"0.6317625",
"0.6317625",
"0.6290208",
"0.62633836",
"0.623714... | 0.7842171 | 0 |
Sets the max_in_gbps of this ShapeNetworkingBandwidthOptions. The maximum amount of networking bandwidth, in gigabits per second. | def max_in_gbps(self, max_in_gbps):
self._max_in_gbps = max_in_gbps | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_in_gbps(self):\n return self._max_in_gbps",
"def max_pool_size(self, max_pool_size: ConfigNodePropertyInteger):\n\n self._max_pool_size = max_pool_size",
"def limit():\n bwc = BandwidthConfigurator()\n bwc.limit()",
"def setmaxsize(self, maxsize):\n self.maxsize = maxsize",... | [
"0.6781882",
"0.64031106",
"0.6103184",
"0.608891",
"0.5933184",
"0.5815575",
"0.5793973",
"0.56856155",
"0.56856155",
"0.5683448",
"0.5648881",
"0.5639877",
"0.563147",
"0.5631178",
"0.5631178",
"0.5610735",
"0.56012076",
"0.5566203",
"0.5557816",
"0.55548334",
"0.55209506",... | 0.8038755 | 0 |
Plots houses and batteries in the grid connected through eucledian distance | def line_figure(self, title):
plt.figure()
counter = 0
# plot the x and y for each house and battery
for battery in self.grid.batteries:
x = []
y = []
for house in battery.connections:
x.append(house.x)
y.append(house.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_houses(self):\n # Get coordinates of houses and batteries\n x_houses, y_houses, x_batt, y_batt = self.get_coordinates()\n\n ax = plt.gca()\n ax.axis([-2, 52, -2, 52])\n\n # Plot houses\n ax.scatter(x_houses, y_houses, marker=\".\")\n tot_cap = 0\n\n ... | [
"0.72535896",
"0.67535675",
"0.66000634",
"0.6514646",
"0.62258816",
"0.6031192",
"0.59826785",
"0.59666055",
"0.59561753",
"0.5952954",
"0.5936707",
"0.5921428",
"0.5913936",
"0.59059304",
"0.59002423",
"0.5876313",
"0.58644015",
"0.58514786",
"0.584713",
"0.5836451",
"0.581... | 0.0 | -1 |
Convert a scipy sparse matrix to a torch sparse tensor. | def sparse_mx_to_torch_sparse_tensor(sparse_mx):
# sparse_mx = sparse_mx.astype(np.float32)
indices = torch.from_numpy(
np.vstack((sparse_mx.row, sparse_mx.col)).astype(np.int64))
values = torch.from_numpy(sparse_mx.data)
shape = torch.Size(sparse_mx.shape)
return torch.sparse.FloatTenso... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def csr2tensor(self, matrix: sp.csr_matrix):\n matrix = matrix.tocoo()\n x = torch.sparse.FloatTensor(\n torch.LongTensor(np.array([matrix.row, matrix.col])),\n torch.FloatTensor(matrix.data.astype(np.float32)),\n matrix.shape,\n ).to(self.device)\n retu... | [
"0.8301762",
"0.80461955",
"0.80328023",
"0.8030319",
"0.8030319",
"0.8030319",
"0.8030319",
"0.8030319",
"0.8030319",
"0.8030319",
"0.8030319",
"0.8030319",
"0.8030319",
"0.8030319",
"0.8030319",
"0.8030319",
"0.80137724",
"0.79976094",
"0.79976094",
"0.79855764",
"0.7985576... | 0.8148899 | 1 |
Cut all crossday rows in dataframe into two rows for two days. | def get_cut_day_dataframe(start, end):
entries = get_dataframe(start, end)
data = entries.copy()
data['datetime'] = data['to'].map(ts2date)
point = arrow.Arrow.range('day', ts2datetime(start), ts2datetime(end))
point = [x.timestamp for x in point]
ind = 0
newRow = 0
for index, row in en... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def split_half(slice):\n slice = set_date(slice)\n slice['Date'] = pd.to_datetime(slice['Date'])\n col_names = ['Date', 'Label', 'Text Extract', 'Processed']\n slice = slice[col_names]\n max_date = slice['Date'].max()\n min_date = slice['Date'].min()\n split_day = min_date + (max_date-min_date... | [
"0.57205844",
"0.5296282",
"0.5226702",
"0.51941174",
"0.5174054",
"0.5134353",
"0.5096978",
"0.50088173",
"0.497379",
"0.49556974",
"0.49154148",
"0.48925298",
"0.48854575",
"0.48833495",
"0.48785287",
"0.48541573",
"0.47975639",
"0.47653997",
"0.47234452",
"0.46779266",
"0.... | 0.59827477 | 0 |
Cut all crossday rows in dataframe into two rows for two days. | def get_cut_level_dataframe(start, end, level):
entries = get_cut_dataframe(start, end)
data = entries.copy()
break_point = break_level(start, end, level)
if len(break_point) != 0:
data['datetime'] = data['to'].map(ts2date)
ind = 0
new_row = 0
for index, row in entries.i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_cut_day_dataframe(start, end):\n entries = get_dataframe(start, end)\n data = entries.copy()\n data['datetime'] = data['to'].map(ts2date)\n\n point = arrow.Arrow.range('day', ts2datetime(start), ts2datetime(end))\n point = [x.timestamp for x in point]\n ind = 0\n newRow = 0\n for in... | [
"0.5980997",
"0.5719227",
"0.5295689",
"0.5226085",
"0.5195079",
"0.51722336",
"0.5134623",
"0.5098079",
"0.501017",
"0.49740878",
"0.49554276",
"0.49158332",
"0.48924154",
"0.48842978",
"0.4881196",
"0.48780406",
"0.48525745",
"0.4797994",
"0.47647288",
"0.4722347",
"0.46780... | 0.4430193 | 46 |
Approximates the sigmoid function using a given method. | def sigmoid(tensor: Any, method: str = "exp") -> Any:
if method == "exp":
_sign = sign(tensor)
# Make sure the elements are all positive
x = tensor * _sign
ones = tensor * 0 + 1
half = ones / 2
result = reciprocal(ones + exp(-1 * ones * x), method="nr")
retur... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sigmoid(x):\n\treturn 1.0/(1.0+math.exp(-(x-0.5)*12.0))",
"def sigmoid(x):\n\treturn 1 / (1 + m.exp(-x))",
"def sigmoid(x):\n return 1 / (1 + exp(-x))",
"def sigmoid(x):\n return 1 / (1 + exp(-x))",
"def sigmoid(x):\n return 1.0/(1.0+exp(-x))",
"def sigmoid(x):\r\n return 1 / (1 + np.exp(... | [
"0.72745544",
"0.72070926",
"0.7206784",
"0.7206784",
"0.7200552",
"0.7200484",
"0.71992385",
"0.7196101",
"0.71832377",
"0.71823037",
"0.7164168",
"0.7164168",
"0.7164168",
"0.7164168",
"0.7164168",
"0.7164168",
"0.71496505",
"0.71496505",
"0.7144421",
"0.71398735",
"0.71186... | 0.72111964 | 1 |
The total size, in bytes, of all leased messages. | def bytes(self) -> int:
return self._bytes | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def message_count(self) -> int:\n return len(self._leased_messages)",
"def get_size(self):\n return len(self.get_payload()) + 4",
"def total_length(self):\n return self.length",
"def get_size(self) -> int:\n total_size = 0\n for entry in self.__entries:\n total_s... | [
"0.75183094",
"0.72784305",
"0.7230585",
"0.720367",
"0.7201135",
"0.7140609",
"0.7113522",
"0.7049926",
"0.7034611",
"0.7022236",
"0.70105416",
"0.7006259",
"0.69877964",
"0.6981284",
"0.6976574",
"0.69719225",
"0.69626206",
"0.69575334",
"0.69419324",
"0.693652",
"0.6932801... | 0.0 | -1 |
Add messages to be managed by the leaser. | def add(self, items: Iterable[requests.LeaseRequest]) -> None:
with self._add_remove_lock:
for item in items:
# Add the ack ID to the set of managed ack IDs, and increment
# the size counter.
if item.ack_id not in self._leased_messages:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_message(self, msg):\n self.messages.append(msg)",
"def add_message(self, message):\n self.message_list.append(message)",
"def messages(self, messages):\r\n\r\n self._messages = messages",
"def append_message(self, message_object):\n self.messages.append(message_object)",
... | [
"0.74184006",
"0.6790852",
"0.6684002",
"0.66020757",
"0.6587093",
"0.65160716",
"0.64967066",
"0.6453043",
"0.6432814",
"0.6432814",
"0.6432814",
"0.63893455",
"0.6307925",
"0.6264064",
"0.62637335",
"0.62479365",
"0.62028044",
"0.6183008",
"0.6108057",
"0.6052215",
"0.60455... | 0.6782554 | 2 |
Returns the value to which the specified key is mapped, or 1 if this map contains no mapping for the key | def get(self, key):
if key < self.length:
return self.buckets[key]
return -1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(self, key: int) -> int:\n if key not in self.map:\n return -1\n return self.map[key]",
"def get(self, key: int) -> int:\n if key in self.hashmap.keys():return self.hashmap[key]\n else:return -1",
"def get(self, key: int) -> int:\n sh = key % 37\n if ... | [
"0.800388",
"0.79098475",
"0.762993",
"0.75650334",
"0.7556994",
"0.7529803",
"0.75259614",
"0.7493149",
"0.73738897",
"0.7294419",
"0.72940016",
"0.72216845",
"0.72175443",
"0.7181078",
"0.71774393",
"0.71633786",
"0.6980779",
"0.69289523",
"0.67850846",
"0.6757027",
"0.6734... | 0.65885234 | 23 |
1x1x1 3D convolution, normalization and activation layer. | def conv_1x1x1_norm_activated(in_channels, out_channels):
return nn.Sequential(
OrderedDict(
[
('conv', nn.Conv3d(in_channels, out_channels, kernel_size=1, bias=False)),
('norm', nn.BatchNorm3d(out_channels)),
('activation', nn.ReLU(inplace=True)),... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def CustomConv3D(x_in, nf, strides=1, kernel_size = 3):\r\n\tx_out = Conv3D(nf, kernel_size=3, padding='same',kernel_initializer='he_normal', strides=strides)(x_in)\r\n\t#print(\"AAAAA\", x_out.shape)\r\n\tx_out = BatchNormalization()(x_out)\r\n\tx_out = LeakyReLU(0.2)(x_out)\r\n\treturn x_out",
"def conv_3d(sel... | [
"0.724729",
"0.71564275",
"0.6890467",
"0.6884151",
"0.66806304",
"0.6680195",
"0.6644745",
"0.65998054",
"0.65731966",
"0.6551888",
"0.65489686",
"0.6520543",
"0.6514549",
"0.6491344",
"0.649001",
"0.64689595",
"0.6466041",
"0.6454607",
"0.64452386",
"0.64437526",
"0.6440224... | 0.62410605 | 98 |
Write to the JSON file. Overwrite the file. | def write_cache(cache_dict):
try:
with open(CACHE_FILENAME, 'w', encoding="utf-8") as cache_file:
cache_file.write(json.dumps(cache_dict))
except:
print("error when executing write_cache()") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write(self):\r\n\r\n with open(self.filename + \".json\", mode='w') as json_file:\r\n json.dump(self.data, json_file, separators=(',', ':'))",
"def write(self, _filepath=None):\n _json_txt = json.dumps(self.json_dict, indent=2)\n self._write_json_text(_json_txt, _filepath)",
... | [
"0.84721404",
"0.83824795",
"0.83612686",
"0.8156606",
"0.7811856",
"0.77675617",
"0.7752867",
"0.77504027",
"0.77504027",
"0.7735561",
"0.767308",
"0.7653503",
"0.76517725",
"0.7650155",
"0.76339245",
"0.7620052",
"0.75402486",
"0.7532445",
"0.75242144",
"0.75126064",
"0.745... | 0.0 | -1 |
Construct a timeanddate string for appending to a filename. | def construct_date(date_and_time=None):
if not date_and_time:
date_and_time = datetime.datetime.today()
date_and_time = date_and_time.strftime('%Y%m%d-%H%M')
return date_and_time | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def makeTimeFilename(prefix, ext): \n suffix = time.strftime(\"%b%d_%H%M\") + ext\n return prefix + suffix",
"def _create_time_stamp() -> str:\n\n return datetime.datetime.now().strftime(\"%Y%m%d\")",
"def addDateTime(s = \"\"):\n date = str(datetime.datetime.now())\n allchars = string.maketrans(''... | [
"0.69513226",
"0.6929155",
"0.6874613",
"0.6801094",
"0.667439",
"0.6633975",
"0.6603208",
"0.659177",
"0.65848535",
"0.6476836",
"0.6438638",
"0.6413685",
"0.64041215",
"0.636608",
"0.63591784",
"0.63473755",
"0.63113123",
"0.63111806",
"0.62700707",
"0.6258594",
"0.6229583"... | 0.6500554 | 9 |
Returns the path to the most recent simulation directory. | def lastsim_path(simsdir) -> str:
import os
all_sim_dirs = [d for d in os.listdir(simsdir) if d.isdigit()]
if len(all_sim_dirs):
most_recent_id = max(int(directory) for directory in all_sim_dirs)
return f"{simsdir}/{str(most_recent_id)}"
else:
msg = f"{simsdir} does not contain ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_last_path(self):\n folders = os.listdir(self.data_root_path)\n folders.sort(reverse=True)\n spec_path = self.data_root_path / folders[0]\n logging.info('Last download folder was %s', spec_path)\n return spec_path",
"def simulation_dir(self):\n try:\n r... | [
"0.7658215",
"0.74446243",
"0.73577297",
"0.7107506",
"0.6877394",
"0.6736928",
"0.65541637",
"0.6549205",
"0.6531288",
"0.6510466",
"0.64611596",
"0.6458378",
"0.64568",
"0.6357291",
"0.6354085",
"0.6350771",
"0.6349953",
"0.6309135",
"0.6278726",
"0.62647086",
"0.62399983",... | 0.80483496 | 0 |
Test that as long as age is greater than the oldest rows inserted no rows are removed | def test_enable_retainunsent_default_age():
clean_tables()
set_configuration()
config = update_configuration(age=72, retain_unsent=True)
assert config['age']['value'] == "72"
assert config['retainUnsent']['value'] == "True"
insert_into_reading()
row_count = get_count()
min_id, max_id... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _purge_old(self):\n now = dt_util.utcnow()\n\n _LOGGER.debug(\n \"%s: purging records older then %s(%s)\",\n self.entity_id,\n dt_util.as_local(now - self._samples_max_age),\n self._samples_max_age,\n )\n\n while self.ages and (now - self.... | [
"0.63028944",
"0.62760925",
"0.62470734",
"0.6200026",
"0.6041736",
"0.58103055",
"0.5779796",
"0.5710987",
"0.57089585",
"0.5646545",
"0.5609858",
"0.5590098",
"0.556105",
"0.553753",
"0.5514644",
"0.5453034",
"0.5451192",
"0.54493076",
"0.54358935",
"0.54161143",
"0.5375787... | 0.5636079 | 10 |
View for all students. | def students(page):
student = db.get_table('student')
total = student.count()
paginator = Paginator(page, PER_PAGE, total)
offset = None if page == 1 else PER_PAGE * paginator.previous
students = student.get(offset=offset, limit=PER_PAGE)
form = StudentForm()
if form.validate_on_submit():
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def view_students(request):\n\n\tcontext_dict = {\n\t\t'title': 'All Students',\n\t}\n\treturn render(request, \"viewStudent.html\", context_dict)",
"def __ui_list_students(self):\n try:\n print(str(self.__student_controller))\n except RepositoryException as re:\n print(re)\n ... | [
"0.81970406",
"0.73898804",
"0.7127029",
"0.7097458",
"0.7093142",
"0.70311946",
"0.6977662",
"0.6953657",
"0.6850747",
"0.6753598",
"0.6733519",
"0.656404",
"0.6514122",
"0.6503097",
"0.64813274",
"0.64593303",
"0.6451249",
"0.64389044",
"0.6404133",
"0.6368986",
"0.6348449"... | 0.6516659 | 12 |
Take a list and split it into train and test sets | def holdout(batches, frac=0.1):
batches = list(batches)
num_holdout = int(np.round(len(batches) * frac))
test = batches[:num_holdout]
train = batches[num_holdout:]
return train, test | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def split_datasets(img_lst):\n num = len(img_lst)\n\n idx = np.random.permutation(num)\n train_lst = np.array(img_lst)[idx[:int(num * .8)]] # 80/20 split\n validation_lst = np.array(img_lst)[idx[int(num * .8):int(num * .9)]]\n test_lst = np.array(img_lst)[idx[int(num * .9):]]\n return train_lst... | [
"0.7611403",
"0.7461765",
"0.72952867",
"0.7240172",
"0.71936136",
"0.7119421",
"0.7103254",
"0.7076835",
"0.70647776",
"0.70580447",
"0.70425147",
"0.7025187",
"0.69944006",
"0.69804",
"0.6960664",
"0.69269794",
"0.6901726",
"0.68947387",
"0.6881942",
"0.6862806",
"0.6857363... | 0.0 | -1 |
Unload a config entry. | async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
unload_ok = await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
if unload_ok:
hass.data[DOMAIN].pop(entry.entry_id)
return unload_ok | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def async_unload_entry(hass, config_entry):\n unload_ok = await hass.config_entries.async_forward_entry_unload(\n config_entry, \"climate\"\n )\n return unload_ok",
"async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:\n hass.data.pop(DOMAIN)\n return True",
... | [
"0.697284",
"0.6888074",
"0.6779855",
"0.6747459",
"0.6689002",
"0.6657831",
"0.66162205",
"0.6603433",
"0.65925974",
"0.65595686",
"0.65411645",
"0.6507643",
"0.6507643",
"0.6507643",
"0.6507643",
"0.64977276",
"0.64931643",
"0.6469397",
"0.6469397",
"0.6462678",
"0.6459733"... | 0.6486601 | 20 |
Creates an instance of this model from a dictionary | def from_dictionary(cls,
dictionary):
if dictionary is None:
return None
# Extract variables from the dictionary
setup = idfy_rest_client.models.setup.Setup.from_dictionary(dictionary.get('setup')) if dictionary.get('setup') else None
merge_fie... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_dictionary(cls,\n dictionary):\n if dictionary is None:\n return None\n\n # Extract variables from the dictionary\n id = dictionary.get('id')\n name = dictionary.get('name')\n mtype = dictionary.get('type')\n usage_bytes = diction... | [
"0.8317533",
"0.81689686",
"0.81689686",
"0.81188685",
"0.808892",
"0.7977596",
"0.7949056",
"0.79225504",
"0.78983366",
"0.7893884",
"0.7887517",
"0.7882494",
"0.7881197",
"0.7876339",
"0.78581846",
"0.78387725",
"0.78037786",
"0.78037786",
"0.78037786",
"0.78037786",
"0.780... | 0.77776235 | 62 |
Randomly choose the indexes of starting data to return using ``np.random.randint()``. Disallow samples within certain proximity to the current cursor which hold invalid data, including accounting for sequence length (so every state returned in sequence will hold valid data). If the RNN state is only stored periodically... | def sample_idxs(self, batch_B, batch_T):
t, b, f = self.t, self.off_backward + batch_T, self.off_forward
high = self.T - b - f if self._buffer_full else t - b - f
T_idxs = np.random.randint(low=0, high=high, size=(batch_B,))
T_idxs[T_idxs >= t - b] += min(t, b) + f
if self.rnn_st... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rand_start_pos(self):\n free_list = np.where(self.grid_map == self.empty_value)\n pos_idx = np.random.randint(free_list[0].shape[0])\n self.set_start_pos((free_list[0][pos_idx], free_list[1][pos_idx]))",
"def _random_start_position(self):\r\n self.position = np.array(random.choice... | [
"0.7029994",
"0.6801937",
"0.6612261",
"0.6612261",
"0.6513884",
"0.6417468",
"0.6224727",
"0.62080276",
"0.62076706",
"0.6121593",
"0.6103597",
"0.6091509",
"0.6078231",
"0.60521823",
"0.60099226",
"0.5982151",
"0.5982151",
"0.597269",
"0.59396034",
"0.5921314",
"0.58989227"... | 0.0 | -1 |
Get absolute path to resource, works for dev and for PyInstaller | def resourcePath(relative_path):
if hasattr(sys, '_MEIPASS'):
return os.path.join(sys._MEIPASS, relative_path)
return os.path.join(os.path.abspath("."), relative_path) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_resource_path():\n return os.path.join(os.path.dirname(__file__), \"resources\") + os.path.sep",
"def resourcePath(relative):\r\n try:\r\n # PyInstaller creates a temp folder and stores path in _MEIPASS\r\n base_path = sys._MEIPASS\r\n except Exception:\r\n base_path = os.pa... | [
"0.83694607",
"0.82806563",
"0.82489175",
"0.8139289",
"0.81141907",
"0.80985445",
"0.8094092",
"0.8079724",
"0.80676544",
"0.80673575",
"0.80624634",
"0.80624634",
"0.80624634",
"0.80624634",
"0.80624634",
"0.80624634",
"0.80624634",
"0.80570674",
"0.80545074",
"0.804486",
"... | 0.7650377 | 56 |
Initializes the class with a boolean indicating whether or not the class needs to add a column of 1s to all feature matrices to fit an intercept and an empty beta_hat vector that will hold the regression model's coefficients. | def __init__(self, add_intercept=True):
self.add_intercept = add_intercept
self.beta_hat = None
return | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, parameters={}):\n # Assumes that a bias unit has been added to feature vector as the last feature\n # If usecolumnones is False, it should ignore this last feature\n self.params = {'usecolumnones': True}\n self.reset(parameters)",
"def __init__(self, feat_mtx, y):\n... | [
"0.6654108",
"0.65766996",
"0.6103804",
"0.5983208",
"0.5927043",
"0.581467",
"0.5774484",
"0.57616574",
"0.57154745",
"0.5699553",
"0.5693565",
"0.56914294",
"0.5659531",
"0.56487983",
"0.5647294",
"0.5640823",
"0.5621305",
"0.5616362",
"0.5616257",
"0.55992615",
"0.55955905... | 0.6830809 | 0 |
Returns whether or not `type_signature` contains a federated type. | def contains_federated_types(type_signature):
return contains(
type_signature, lambda t: isinstance(t, computation_types.FederatedType)
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def match_proof(self, signature_type: str) -> bool:\n return signature_type == self.signature_type",
"def contains_tensor_types(type_signature):\n return contains(\n type_signature, lambda t: isinstance(t, computation_types.TensorType)\n )",
"def is_type(self, type_name):\n\n return type_name ... | [
"0.6574802",
"0.62977016",
"0.61390525",
"0.60234207",
"0.5865533",
"0.58028364",
"0.57216316",
"0.57167506",
"0.5706563",
"0.57048905",
"0.5694225",
"0.564713",
"0.56119853",
"0.5609705",
"0.5606092",
"0.55957365",
"0.5577657",
"0.5571839",
"0.555532",
"0.55448955",
"0.55366... | 0.8457984 | 0 |
Checks unambiguity in applying `type_to_upcast` to `possibly_nested_type`. That is, checks that either these types are equivalent and contain only tuples and tensors, or that `possibly_nested_type` is perhaps a nested structure containing only tensors with `dtype` of `type_to_upcast` at the leaves, where `type_to_upcas... | def is_binary_op_with_upcast_compatible_pair(
possibly_nested_type: Optional[computation_types.Type],
type_to_upcast: computation_types.Type,
) -> bool:
if possibly_nested_type is not None:
py_typecheck.check_type(possibly_nested_type, computation_types.Type)
if type_to_upcast is not None:
py_typech... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def canonicalize_type(type_like):\n def rec(typ):\n if isinstance(typ, TupleType) and typ:\n typ = TupleType(rec(t) for t in typ)\n if all(isinstance(t, PyObjectType) for t in typ): return PyObjectType()\n elif isinstance(typ, SequenceType):\n typ = type(typ)(rec(typ.element_type))\n if ... | [
"0.5306997",
"0.52087814",
"0.50368667",
"0.5032811",
"0.49558678",
"0.48660657",
"0.48308232",
"0.4779594",
"0.47210628",
"0.46984035",
"0.46558455",
"0.46510237",
"0.4643031",
"0.46409607",
"0.4631985",
"0.45736837",
"0.45404536",
"0.4539274",
"0.45254016",
"0.4514584",
"0.... | 0.7477062 | 0 |
Returns True iff `dtype` is numeric. | def is_numeric_dtype(dtype):
py_typecheck.check_type(dtype, tf.dtypes.DType)
return dtype.is_integer or dtype.is_floating or dtype.is_complex | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_numeric(x):\n if isinstance(x, NUMBER_TYPES):\n return True\n elif isinstance(x, np.ndarray):\n return x.dtype.type not in NUMPY_NON_TYPES\n return False",
"def is_numeric_dtype(df, col_name):\n dtype = df.dtypes[col_name]\n return np.issubdtype(dtype, np.number)",
"def is_n... | [
"0.8039024",
"0.78276557",
"0.7513296",
"0.75069106",
"0.74880195",
"0.7218451",
"0.7198036",
"0.7179498",
"0.71748924",
"0.71028155",
"0.70366186",
"0.7013944",
"0.7013335",
"0.70019925",
"0.69869417",
"0.6869189",
"0.68515235",
"0.68169427",
"0.67604125",
"0.6736879",
"0.66... | 0.85418904 | 0 |
Determines if `type_spec` is a type that can be added to itself. Types that are sumcompatible are composed of scalars of numeric types, possibly packaged into nested named tuples, and possibly federated. Types that are sumincompatible include sequences, functions, abstract types, and placements. | def check_is_sum_compatible(type_spec, type_spec_context=None):
py_typecheck.check_type(type_spec, computation_types.Type)
if type_spec_context is None:
type_spec_context = type_spec
py_typecheck.check_type(type_spec_context, computation_types.Type)
if isinstance(type_spec, computation_types.TensorType):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_tensorflow_compatible_type(type_spec):\n if type_spec is None:\n return True\n\n def _predicate(type_spec: computation_types.Type) -> bool:\n return isinstance(\n type_spec,\n (\n computation_types.SequenceType,\n computation_types.StructType,\n computa... | [
"0.72847396",
"0.7251267",
"0.61771864",
"0.6086255",
"0.60841954",
"0.6057122",
"0.5956508",
"0.59497744",
"0.5873961",
"0.5773222",
"0.5754168",
"0.56924593",
"0.5638371",
"0.5609985",
"0.5551453",
"0.5509447",
"0.54809743",
"0.546033",
"0.54520494",
"0.5410455",
"0.5365319... | 0.59712666 | 6 |
Determines if `type_spec` is a structure of floats. Note that an empty `computation_types.StructType` will return `True`, as it does not contain any nonfloating types. | def is_structure_of_floats(type_spec: computation_types.Type) -> bool:
py_typecheck.check_type(type_spec, computation_types.Type)
if isinstance(type_spec, computation_types.TensorType):
py_typecheck.check_type(type_spec.dtype, tf.dtypes.DType)
return type_spec.dtype.is_floating
elif isinstance(type_spec, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_average_compatible(type_spec: computation_types.Type) -> bool:\n py_typecheck.check_type(type_spec, computation_types.Type)\n if isinstance(type_spec, computation_types.TensorType):\n return type_spec.dtype.is_floating or type_spec.dtype.is_complex # pytype: disable=attribute-error\n elif isinstance(... | [
"0.64060295",
"0.63375247",
"0.6306502",
"0.62976986",
"0.6270596",
"0.61600924",
"0.60275203",
"0.59922457",
"0.5924918",
"0.5728644",
"0.5728644",
"0.544913",
"0.5226938",
"0.5150155",
"0.5113229",
"0.5076775",
"0.5069336",
"0.50574434",
"0.5053313",
"0.50433326",
"0.500361... | 0.8553015 | 0 |
Determines if `type_spec` is a structure of integers. Note that an empty `computation_types.StructType` will return `True`, as it does not contain any noninteger types. | def is_structure_of_integers(type_spec: computation_types.Type) -> bool:
py_typecheck.check_type(type_spec, computation_types.Type)
if isinstance(type_spec, computation_types.TensorType):
py_typecheck.check_type(type_spec.dtype, tf.dtypes.DType) # pytype: disable=attribute-error
return type_spec.dtype.is_i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_single_integer_or_matches_structure(\n type_sig: computation_types.Type, shape_type: computation_types.Type\n) -> bool:\n\n py_typecheck.check_type(type_sig, computation_types.Type)\n py_typecheck.check_type(shape_type, computation_types.Type)\n\n if isinstance(type_sig, computation_types.TensorType):... | [
"0.66405684",
"0.6301843",
"0.62300223",
"0.6161992",
"0.6123557",
"0.60694224",
"0.57273114",
"0.57273114",
"0.5656848",
"0.54610115",
"0.5227381",
"0.50869685",
"0.50791997",
"0.50734925",
"0.5068805",
"0.50229543",
"0.5010912",
"0.49554342",
"0.49176762",
"0.48999286",
"0.... | 0.83078027 | 0 |
Determines if `type_spec` can be averaged. Types that are averagecompatible are composed of numeric tensor types, either floatingpoint or complex, possibly packaged into nested named tuples, and possibly federated. | def is_average_compatible(type_spec: computation_types.Type) -> bool:
py_typecheck.check_type(type_spec, computation_types.Type)
if isinstance(type_spec, computation_types.TensorType):
return type_spec.dtype.is_floating or type_spec.dtype.is_complex # pytype: disable=attribute-error
elif isinstance(type_spec... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_tensorflow_compatible_type(type_spec):\n if type_spec is None:\n return True\n\n def _predicate(type_spec: computation_types.Type) -> bool:\n return isinstance(\n type_spec,\n (\n computation_types.SequenceType,\n computation_types.StructType,\n computa... | [
"0.60622257",
"0.5890987",
"0.5826187",
"0.582358",
"0.57968456",
"0.5753288",
"0.537869",
"0.5372321",
"0.51814944",
"0.5145223",
"0.51124924",
"0.50845814",
"0.49973708",
"0.49384102",
"0.48507562",
"0.47728163",
"0.47491017",
"0.472637",
"0.47217622",
"0.47213745",
"0.4708... | 0.83512145 | 0 |
Checks whether `concrete_type` is a valid substitution of `generic_type`. This function determines whether `generic_type`'s type parameters can be substituted such that it is equivalent to `concrete type`. Note that passing through argumentposition of function type swaps the variance of abstract types. Argumentposition... | def check_concrete_instance_of(
concrete_type: computation_types.Type, generic_type: computation_types.Type
):
py_typecheck.check_type(concrete_type, computation_types.Type)
py_typecheck.check_type(generic_type, computation_types.Type)
for t in preorder_types(concrete_type):
if isinstance(t, computation_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def match_Generic_against_Generic( # pylint: disable=invalid-name\n self, t1: pytd.GenericType, t2: pytd.GenericType, subst: _SubstType,\n ) -> booleq.BooleanTerm:\n assert isinstance(t1.base_type, pytd.ClassType), type(t1.base_type)\n assert isinstance(t2.base_type, pytd.ClassType), type(t2.base_type... | [
"0.54970366",
"0.5111072",
"0.48853025",
"0.46758652",
"0.46692488",
"0.46145895",
"0.45618585",
"0.4550357",
"0.45171118",
"0.45123285",
"0.448739",
"0.44766307",
"0.44306502",
"0.4412183",
"0.43896735",
"0.43887985",
"0.43690276",
"0.43669742",
"0.4359533",
"0.43512937",
"0... | 0.7095296 | 0 |
Set the destination node. | def setDestination(self, node):
self.dest_node = node | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def SetDestination(self, point):\n\t\tif type(point) != Point:\n\t\t\traise TypeError(\"Incorrect Type\")\n\n\t\tself.destination = point",
"def destination(self, destination):\n\n self._destination = destination",
"def set_node(self, node):\n self.__node = node",
"def handle_set_destination(se... | [
"0.70902777",
"0.6847713",
"0.6847283",
"0.6513333",
"0.65060866",
"0.64828616",
"0.6408787",
"0.6355209",
"0.62307763",
"0.619832",
"0.61198235",
"0.61175764",
"0.61097777",
"0.6108571",
"0.60904706",
"0.6073083",
"0.6070372",
"0.60632175",
"0.606097",
"0.5979292",
"0.597464... | 0.894786 | 0 |
Set the suffix indexes. | def setBound(self, start = None, stop = None):
if start is not None: self.start = start
elif stop is not None: self.stop = stop | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setSuffixes(self, s):\n return self._set(suffixes=s)",
"def _setSubset(self, label, indices):\n\n for label in FLAG_ALIASES.get(label, [label]):\n self._subsets[label] = indices",
"def setIndexNames(self):\n self.xi = self.i1\n self.yi = self.i2",
"def set_index(sel... | [
"0.6747892",
"0.64296925",
"0.63742894",
"0.60896534",
"0.5723922",
"0.5712421",
"0.5695507",
"0.5645258",
"0.5606325",
"0.5606325",
"0.5606325",
"0.5606325",
"0.55466515",
"0.5477034",
"0.54700994",
"0.5453164",
"0.542751",
"0.5381403",
"0.53188866",
"0.53048694",
"0.5262825... | 0.0 | -1 |
Get the suffix indexes. | def getSuffix(self):
stop = 0
if type(self.stop) is SharedCounter:
stop = self.stop.getVal()
else:
stop = self.stop
return (self.start, stop) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_suffixes(self):\n\n ans = self.short_sf.get_suffixes()\n\n self.assertEqual(ans, [(0, 0), (1, 1), (0, 1), (0, 2), (1, 0), (1, 2)])",
"def suffixes(self):\n suffixes = []\n for constraint, suffix in self.conf.get(\"suffixes\", {}).items():\n if constraint in sel... | [
"0.6499877",
"0.64360565",
"0.6414557",
"0.64019066",
"0.62893385",
"0.62181014",
"0.61930084",
"0.61926943",
"0.6110455",
"0.5998016",
"0.59604514",
"0.5945087",
"0.59193087",
"0.5830126",
"0.5813578",
"0.58067375",
"0.5796787",
"0.5794229",
"0.5793287",
"0.57453865",
"0.574... | 0.62456703 | 5 |
Records the latest fixed value for the specified named gauge. This method is nonblocking and is guaranteed not to throw an exception. | def gauge(self, gauge, value):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def record_gauge(self, name, value, tags=None):\n identity = self.create_identity(name, tags)\n with self._lock:\n self._batch[identity] = value\n self._timestamps[identity] = int(time.time() * 1000.0)",
"def gauge(self, gauge, value):\n if self.ignore_metrics:\n ... | [
"0.7072473",
"0.6786743",
"0.6294185",
"0.6071289",
"0.60681546",
"0.602409",
"0.58677465",
"0.58169276",
"0.5756538",
"0.5745851",
"0.573712",
"0.5634433",
"0.54255265",
"0.5389345",
"0.5381477",
"0.53259003",
"0.5317662",
"0.53135365",
"0.52571964",
"0.5205513",
"0.5078789"... | 0.6717131 | 2 |
Records the latest fixed value for the specified named gauge. This method is nonblocking and is guaranteed not to throw an exception. | def gauge(self, gauge, value):
if self.ignore_metrics:
return
with self._gauge_rlock:
self._gauge_metrics[gauge] = value
self._gauge_call_count += 1
old_call_time = self._gauge_last_call_time
self._gauge_last_call_time = arrow.utcnow().timest... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def record_gauge(self, name, value, tags=None):\n identity = self.create_identity(name, tags)\n with self._lock:\n self._batch[identity] = value\n self._timestamps[identity] = int(time.time() * 1000.0)",
"def gauge(self, gauge, value):\n pass",
"def gauge(self, gauge,... | [
"0.7072473",
"0.6717131",
"0.6294185",
"0.6071289",
"0.60681546",
"0.602409",
"0.58677465",
"0.58169276",
"0.5756538",
"0.5745851",
"0.573712",
"0.5634433",
"0.54255265",
"0.5389345",
"0.5381477",
"0.53259003",
"0.5317662",
"0.53135365",
"0.52571964",
"0.5205513",
"0.5078789"... | 0.6786743 | 1 |
Records the latest fixed value for the specified named gauge. This method is nonblocking and is guaranteed not to throw an exception. | def gauge(self, gauge, value):
try:
self._thread_pool_executor.submit(self._delegate.gauge, gauge, value)
except:
self._logger.exception('Exception caught submitting gauge metric') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def record_gauge(self, name, value, tags=None):\n identity = self.create_identity(name, tags)\n with self._lock:\n self._batch[identity] = value\n self._timestamps[identity] = int(time.time() * 1000.0)",
"def gauge(self, gauge, value):\n if self.ignore_metrics:\n ... | [
"0.7072473",
"0.6786743",
"0.6717131",
"0.6071289",
"0.60681546",
"0.602409",
"0.58677465",
"0.58169276",
"0.5756538",
"0.5745851",
"0.573712",
"0.5634433",
"0.54255265",
"0.5389345",
"0.5381477",
"0.53259003",
"0.5317662",
"0.53135365",
"0.52571964",
"0.5205513",
"0.5078789"... | 0.6294185 | 3 |
Returns the initial state given the batch size. | def init_states(self, batch_size: int) -> NestedMap:
raise NotImplementedError('Abstract method') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_initial_state(self, size):\n return self._lstm_cell.zero_state(size, tf.float32)",
"def initial_state(self):\n state = GameState(self.size)\n return state",
"def initial_state(self, batch_size, dtype=tf.float32, trainable=False,\n trainable_initializers=None, tra... | [
"0.7947754",
"0.7363662",
"0.73470986",
"0.72962725",
"0.7291511",
"0.71293545",
"0.7114751",
"0.7112994",
"0.7026598",
"0.6920046",
"0.6772483",
"0.67661166",
"0.676301",
"0.6692351",
"0.6677714",
"0.66522497",
"0.664847",
"0.6627122",
"0.66012615",
"0.65866125",
"0.6583333"... | 0.6452112 | 31 |
Returns the output value given the current state. | def get_output(self, state: NestedMap) -> NestedMap:
raise NotImplementedError('Abstract method') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def output(self, state):\n h, t = state\n\n return h",
"def value(self, state):\n return 0",
"def val(self):\n return self.output",
"def val(self):\n return self.output",
"def state(self):\n return self._current_value",
"def getValue(self, state):\r\n retu... | [
"0.7398709",
"0.72431564",
"0.71744025",
"0.71744025",
"0.7166389",
"0.71622837",
"0.7159815",
"0.7159815",
"0.7128188",
"0.7119671",
"0.7119671",
"0.7119671",
"0.7119671",
"0.7119671",
"0.7119671",
"0.7119671",
"0.7119671",
"0.7119671",
"0.7119671",
"0.7119671",
"0.7119671",... | 0.0 | -1 |
Return the value of the carry flag | def read_carry(self):
return self.CARRY | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ROL(self, value):\n carry = value << 7\n result = ((value << 1) & 0b11111110) | self.reg.C\n self.reg.C = carry\n self.reg.N = result >> 7\n self.reg.Z = result == 0\n return result",
"def get_flag(self, flag_name):\n flags = {'C':0, # Carry\n ... | [
"0.62693137",
"0.6230696",
"0.61328965",
"0.5830107",
"0.5777264",
"0.57185674",
"0.5640024",
"0.5631401",
"0.56254625",
"0.55995286",
"0.5589704",
"0.5561941",
"0.55457854",
"0.5525055",
"0.5513276",
"0.5508285",
"0.54495716",
"0.54201734",
"0.5407557",
"0.54053336",
"0.5399... | 0.7615654 | 0 |
Return the value of the ACBR interim property used for swapping out accumulator with register contents during an XCH instruction | def read_acbr(self):
return self.ACBR | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def acc_b(self):\n return self._acc_b",
"def acc_b_v(self):\r\n return self._acc_b_v",
"def acc_b_tr(self):\r\n return self._acc_b_tr",
"def activate_der(self):\r\n\t\treturn self.value * (1 - self.value)",
"def getACC(self, axis='X'):\r\n\t\tscale = self.getScale(mode='ACC')[0]\r\n\t\tif axis.upp... | [
"0.60649484",
"0.600375",
"0.5831581",
"0.56615984",
"0.5622209",
"0.5611013",
"0.55694467",
"0.5492124",
"0.5483572",
"0.54679024",
"0.5344278",
"0.5287209",
"0.52841294",
"0.52775365",
"0.5192128",
"0.5190853",
"0.51645",
"0.51061803",
"0.50884145",
"0.5082351",
"0.5067708"... | 0.57185477 | 3 |
Determines if two vectors are not equal. | def __ne__(self, candidate):
return not (self == candidate) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_not_equal_same_reference():\n v = Vector(1.0)\n assert_false(v != v)",
"def __ne__(self, other):\n\n if hasattr(other, 'vector'):\n return self.vector != other.vector",
"def test_not_equal_with_different_type():\n assert_true(Vector(1.0) != 1.0)",
"def are_not_equal(value1... | [
"0.7563823",
"0.75083214",
"0.73090285",
"0.7047604",
"0.7042449",
"0.70040464",
"0.6841265",
"0.6825115",
"0.6814429",
"0.6794154",
"0.67216474",
"0.66897804",
"0.6689637",
"0.6681334",
"0.6668205",
"0.66667813",
"0.6638688",
"0.66373545",
"0.6623001",
"0.6620511",
"0.660854... | 0.0 | -1 |
Calculates the cross product of two vectors. | def crossProduct(self, factor):
components = np.cross(self.components(), factor.components())
return Vector.initializeFromComponents(components) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cross_product(v1, v2):\n return cg3d_vector.CG3dVector(\n v1[1] * v2[2] - v2[1] * v1[2],\n v1[2] * v2[0] - v2[2] * v1[0],\n v1[0] * v2[1] - v2[0] * v1[1]\n )",
"def vec_cross(a,b):\r\n return [a[1] * b[2] - a[2] * b[1],\r\n a[2] * b[0] - a[0] * b[2],\r\n a[0] * b... | [
"0.8537387",
"0.85290545",
"0.8522431",
"0.8395807",
"0.834329",
"0.83303016",
"0.8140776",
"0.80807394",
"0.80706483",
"0.8038556",
"0.80100286",
"0.79729694",
"0.7940225",
"0.79104215",
"0.77921957",
"0.77775013",
"0.76141",
"0.75881994",
"0.7565331",
"0.7499446",
"0.748089... | 0.66121656 | 59 |
Returns a normalized vector of this vector. | def getNormalizedVector(self):
return self.scalarMultiplication(self.norm() ** -1.0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalized(self):\n length = self.length\n if length != 0:\n return self/length\n return Vec2d(self)",
"def normalize(self):\n\t\tnorm = self.norm()\n\t\tif norm == 0:\n\t\t\traise ValueError(\"Can't normalize zero vector\")\n\t\treturn self / norm",
"def normalized(self):\n... | [
"0.8697719",
"0.86820084",
"0.86794674",
"0.86303735",
"0.8609313",
"0.85790735",
"0.8454528",
"0.8335318",
"0.8298214",
"0.80549407",
"0.8027868",
"0.7989475",
"0.7983082",
"0.7974867",
"0.79211205",
"0.7825895",
"0.778353",
"0.77772754",
"0.77744186",
"0.77325976",
"0.77016... | 0.85989034 | 5 |
Returns the projection perpendicular to the given vector. | def perpendicularTo(self, vector):
perpendicular = self.subtractVector(self.parallelTo(vector))
return perpendicular | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_perpendicular2d(vector):\n if vector[1] == 0:\n return np.asarray([0.,1.])\n v2_0 = 1.0\n v2_1 = -(vector[0]/vector[1])\n v2 = np.asarray([v2_0, v2_1])\n return v2 / np.linalg.norm(v2)",
"def perpendicular_vector(v):\n if v[1] == 0 and v[2] == 0:\n if v[0] == 0:\n ... | [
"0.82814294",
"0.80773705",
"0.7681912",
"0.76797205",
"0.7292816",
"0.7124389",
"0.7090642",
"0.70646554",
"0.7061533",
"0.69883376",
"0.69417137",
"0.6858889",
"0.66999054",
"0.6589463",
"0.65423685",
"0.6472488",
"0.6468972",
"0.6376101",
"0.6347817",
"0.63074005",
"0.6233... | 0.8799826 | 0 |
Returns one arbitrary vector perpendicular to this vector. | def getOnePerpendicularVector(self):
vector_y = Vector(0, 1, 0)
vector_z = Vector(0, 0, 1)
if self.getNormalizedVector() == vector_z:
return vector_y
vector_perpendicular = vector_z.perpendicularTo(self)
vector_perpendicular = vector_perpendicular.getNormalizedVecto... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def perpendicular(self):\n return tuple.__new__(Vec2, (-self[1], self[0]))",
"def perpendicularTo(self, vector):\n perpendicular = self.subtractVector(self.parallelTo(vector))\n return perpendicular",
"def perpendicular_vector(v):\n if v[1] == 0 and v[2] == 0:\n if v[0] == 0:\n ... | [
"0.8619022",
"0.86175483",
"0.82776195",
"0.7801759",
"0.77954507",
"0.76323676",
"0.70442706",
"0.6989328",
"0.69787717",
"0.6974664",
"0.68927896",
"0.6878145",
"0.68579566",
"0.68519694",
"0.68444",
"0.67860425",
"0.6726913",
"0.66790736",
"0.66581887",
"0.6561418",
"0.654... | 0.83740294 | 2 |
Returns the minimax action using self.depth and self.evaluationFunction | def get_action_of_alphaBeta(self, game_state: Game):
self._node = game_state
actions = []
func = lambda x: 2.5 * surface_heuristic(game_state, x) + 0.5 * row_col_completeness_heuristic(game_state, x)
for block in game_state.current_blocks:
ac = game_state.get_legal_actions(bl... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getAction(self, gameState: GameState):\n _max = float(\"-inf\")\n action = None\n for move in gameState.getLegalActions(0):\n util = minimax(self.evaluationFunction, 1, 0,\n gameState.generateSuccessor(0, move), self.depth)\n if util > _max o... | [
"0.7482665",
"0.7383559",
"0.71806973",
"0.7110041",
"0.70884514",
"0.70694935",
"0.70683014",
"0.7048308",
"0.70055133",
"0.69651455",
"0.69642085",
"0.69604385",
"0.6945924",
"0.68998593",
"0.6895832",
"0.688605",
"0.6826282",
"0.6767276",
"0.6758028",
"0.6751636",
"0.67054... | 0.0 | -1 |
Returns the minimax action using self.depth and self.evaluationFunction | def get_action_of_alphaBeta(self, game_state: Game):
self._node = game_state
actions = []
for block in game_state.current_blocks:
actions += game_state.get_legal_actions(block)
# sort the action by heuristic
actions.sort(key=lambda x: surface_heuristic(game_state, x)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getAction(self, gameState: GameState):\n _max = float(\"-inf\")\n action = None\n for move in gameState.getLegalActions(0):\n util = minimax(self.evaluationFunction, 1, 0,\n gameState.generateSuccessor(0, move), self.depth)\n if util > _max o... | [
"0.7482665",
"0.7383559",
"0.71806973",
"0.7110041",
"0.70884514",
"0.70694935",
"0.70683014",
"0.7048308",
"0.70055133",
"0.69651455",
"0.69642085",
"0.69604385",
"0.6945924",
"0.68998593",
"0.6895832",
"0.688605",
"0.6826282",
"0.6767276",
"0.6758028",
"0.6751636",
"0.67054... | 0.0 | -1 |
Returns the minimax action using self.depth and self.evaluationFunction | def get_action_of_alphaBeta(self, game_state: Game):
self._node = game_state
actions = []
for block in game_state.current_blocks:
actions += game_state.get_legal_actions(block)
# sort the action by heuristic
actions.sort(key=lambda x: surface_heuristic(game_state, x... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getAction(self, gameState: GameState):\n _max = float(\"-inf\")\n action = None\n for move in gameState.getLegalActions(0):\n util = minimax(self.evaluationFunction, 1, 0,\n gameState.generateSuccessor(0, move), self.depth)\n if util > _max o... | [
"0.7482767",
"0.738391",
"0.718179",
"0.7109566",
"0.7088255",
"0.7069878",
"0.7068527",
"0.70486605",
"0.70026934",
"0.69650954",
"0.6964545",
"0.6961983",
"0.6943451",
"0.6897894",
"0.68966156",
"0.6883151",
"0.6828623",
"0.67646855",
"0.67580783",
"0.6753998",
"0.6706473",... | 0.0 | -1 |
Simple bid dataset in which demand intersects supply | def bid_dataset_0():
bm = BidManager()
bm.add_bid(1, 3, 0, True, 0)
bm.add_bid(2, 4, 1, True, 0)
bm.add_bid(5, 1, 2, True, 0)
bm.add_bid(4, 2, 3, False, 0)
bm.add_bid(1, 1, 4, False, 0)
bm.add_bid(5, 6, 5, False, 0)
return bm.get_df() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bid_dataset_1():\n\n bm = BidManager()\n\n bm.add_bid(1, 6.7, 0, True, 0)\n bm.add_bid(1, 6.6, 1, True, 0)\n bm.add_bid(1, 6.5, 2, True, 0)\n bm.add_bid(1, 6.4, 3, True, 0)\n bm.add_bid(1, 6.3, 4, True, 0)\n bm.add_bid(1, 6, 5, True, 0)\n\n bm.add_bid(1, 1, 6, False, 0)\n bm.add_bid(... | [
"0.6820929",
"0.6283623",
"0.60027516",
"0.5882704",
"0.54483455",
"0.5406371",
"0.5152378",
"0.50874776",
"0.50867",
"0.50709",
"0.5037018",
"0.5021237",
"0.50108415",
"0.49826396",
"0.49743584",
"0.49702135",
"0.49678388",
"0.49653396",
"0.49276775",
"0.49064508",
"0.489356... | 0.66265905 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.