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 |
|---|---|---|---|---|---|---|
Check self and other is not equal | def __ne__(self, other):
return not self.__eq__(other) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other):\n return not self == other",
"def __ne__(self, other):\n return not self == other",
"def __neq__(self, other): \n return not self == other",
"def __ne__(self, other):\n return not self == other",
"def __ne__(self, other):\r\n return n... | [
"0.851477",
"0.851477",
"0.8507004",
"0.8504522",
"0.84687376",
"0.84687376",
"0.8450398",
"0.8450398",
"0.8450398",
"0.842955",
"0.8423754",
"0.8423754",
"0.8423754",
"0.8423754",
"0.8423754",
"0.8423754",
"0.8423754",
"0.8423754",
"0.8423754",
"0.8423754",
"0.8423754",
"0... | 0.0 | -1 |
Check whether the value self is less than other | def __lt__(self, other):
# Numpy internally checks if the dimensions of self and other match
try:
return self.val < other.val
except:
return self.val < other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ge__(self, other):\r\n # self >= other <=> not (self < other)\r\n return 1 - runtime.lt(self, other)",
"def __le__(self, other):\r\n # self <= other <=> not (other < self)\r\n return 1 - runtime.lt(other, self)",
"def __lt__(self, other):\n return self <= other and self... | [
"0.8055347",
"0.8051002",
"0.7975857",
"0.7975857",
"0.7957924",
"0.79491305",
"0.79417366",
"0.7938579",
"0.79182094",
"0.787731",
"0.7864425",
"0.78534454",
"0.78509116",
"0.78509116",
"0.7847569",
"0.78474003",
"0.7845229",
"0.7834082",
"0.782592",
"0.7824588",
"0.7804401"... | 0.7642524 | 47 |
Check whether the value self is less than or equal to other | def __le__(self, other):
return self.__lt__(other) or self.__eq__(other) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ge__(self: _TT, other: _TT) -> bool:\n if type(self) != type(other):\n raise TypeError(\"Types do not match\")\n return self.value >= other.value",
"def __lt__(self, other):\n return self <= other and self != other",
"def __lt__(self, other):\n return self <= other ... | [
"0.82916117",
"0.82125723",
"0.82125723",
"0.8208959",
"0.818303",
"0.81701463",
"0.8166372",
"0.8166372",
"0.8157619",
"0.81554556",
"0.815016",
"0.8149271",
"0.81261086",
"0.8113528",
"0.8112823",
"0.810707",
"0.810707",
"0.81057215",
"0.806862",
"0.80678856",
"0.8055787",
... | 0.7793942 | 47 |
Check whether the value self is greater than other | def __gt__(self, other):
try:
return self.val > other.val
except:
return self.val > other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __gt__(self, other):\n return self >= other and self != other",
"def __gt__(self, other):\n return self >= other and self != other",
"def __gt__(self, other):\n return not (self <= other)",
"def __gt__(self, other):\n return self >= other and not self <= other",
"def __gt__(... | [
"0.850166",
"0.850166",
"0.8383213",
"0.83828586",
"0.83733726",
"0.8353885",
"0.83260596",
"0.82977545",
"0.8290281",
"0.82490367",
"0.82330704",
"0.8186457",
"0.81820863",
"0.8179524",
"0.81676936",
"0.8158279",
"0.8144876",
"0.8107643",
"0.8071686",
"0.8068013",
"0.8057014... | 0.843813 | 2 |
Check whether the value self is larger than or equal to other | def __ge__(self, other):
return self.__gt__(other) or self.__eq__(other) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __gt__(self, other):\n return not (self <= other)",
"def __gt__(self, other):\n return self >= other and self != other",
"def __gt__(self, other):\n return self >= other and self != other",
"def __gt__(self, other):\n return self.__ge__(other) and self.__ne__(other)",
"def _... | [
"0.8334512",
"0.8323968",
"0.8323968",
"0.8275414",
"0.82664084",
"0.8208709",
"0.8196882",
"0.8178027",
"0.8173796",
"0.81498563",
"0.81466806",
"0.81439584",
"0.8106487",
"0.80786973",
"0.8078147",
"0.80442566",
"0.80442566",
"0.8023268",
"0.7994361",
"0.7992754",
"0.798381... | 0.79692084 | 22 |
Return the exponential of self. | def exp(self):
val = np.exp(self.val)
if len(self.der.shape):
to_multiply = np.exp(self.val)
to_multiply = np.expand_dims(to_multiply, 1) if len(self.der.shape) > len(to_multiply.shape) else to_multiply
der = np.multiply(to_multiply, self.der)
else:
der = None
return Var(val, der) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exponential(value):\n return math.exp(value)",
"def exponential(self) -> np.ndarray:\n if self.is_real():\n return np.array([1.0, 0.0, 0.0, 0.0])\n t = np.linalg.norm(self.v)\n u = self.v/t\n q_exp = np.array([np.cos(t), *u*np.sin(t)])\n if self.is_pur... | [
"0.80905885",
"0.80318856",
"0.7743788",
"0.75203687",
"0.7484333",
"0.74115163",
"0.72976995",
"0.72534764",
"0.72098315",
"0.71438736",
"0.7116615",
"0.70764434",
"0.706863",
"0.6993814",
"0.6909972",
"0.69095373",
"0.6887894",
"0.67494726",
"0.6740504",
"0.67073464",
"0.66... | 0.7773673 | 2 |
delete the character to the left of the cursor | def cmd_X(self):
node = self.start
while node is not None:
if node == self.cursor:
line = node.element
node.element = line[0:self.delta-1] + line[self.delta:]
self.delta = self.delta - 1
break
node = node.next
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_forward():\r\n point().delete_right_char()",
"def backspace(entry):\n entry.delete_symbol()",
"def delete(self):\n del self.characters[self.cursor.position]",
"def delete_chr(text):\n \"\"\" if the user try to delete an empty line it will not allowed him:)\"\"\"\n if len(text.getT... | [
"0.7970712",
"0.7240335",
"0.7229049",
"0.71070904",
"0.695129",
"0.691229",
"0.6835891",
"0.67571753",
"0.67544967",
"0.6754191",
"0.6643641",
"0.6638436",
"0.6558255",
"0.64575654",
"0.64427185",
"0.64377517",
"0.6416933",
"0.63925153",
"0.6387937",
"0.6338906",
"0.62445724... | 0.6320641 | 20 |
Get a list of nodes from the XML data. | def filter_nodes(self, node_filter, parent=None):
if self.data is None:
return None
if parent is None:
return self.data.xpath(node_filter)
else:
return parent.xpath(node_filter) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_node_list(self):\n return []",
"def nodes(self):\r\n return (node.content for node in self.traverse())",
"def nodes(self) -> NodeList:\r\n return self._nodes",
"def nodes( self, data = False ):\n return self._G.nodes(data = data)",
"def get_nodes(self):\n return [... | [
"0.7015951",
"0.7012096",
"0.6912623",
"0.6859364",
"0.68582904",
"0.68582904",
"0.6843832",
"0.6794125",
"0.67779016",
"0.6721625",
"0.67191553",
"0.67184025",
"0.6651142",
"0.6647751",
"0.6625332",
"0.6623198",
"0.66007304",
"0.65728265",
"0.6546428",
"0.6542172",
"0.649753... | 0.0 | -1 |
Get the subject configuration item by ID. | def get_subject(self, idattr):
return self.get_node('//Subject[@id="%s"]' % idattr) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_by_id(self, subject_id: str) -> any:\n pass",
"def get(self, id):\n\n\t\treturn MessageStore.get(id)",
"def get_item(self, key):\n return self.config[key] if key in self.config.keys() else None",
"def getItem(self, id):\n path = 'item/' + id\n return self.sendRestRequest(... | [
"0.64427334",
"0.5887513",
"0.58327484",
"0.57978326",
"0.5784069",
"0.57466805",
"0.5726707",
"0.5711708",
"0.5668366",
"0.5626656",
"0.56199616",
"0.56051797",
"0.5555822",
"0.5547103",
"0.55410844",
"0.5539455",
"0.55092275",
"0.54685116",
"0.5464688",
"0.54578066",
"0.545... | 0.6410556 | 1 |
Get the score panel configuration node. | def get_score_panel(self, idattr):
return self.get_node('//ScorePanels/ScorePanel[@id="%s"]' % idattr) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def node_config(self) -> 'outputs.NodeConfigResponse':\n return pulumi.get(self, \"node_config\")",
"def node_config(self) -> pulumi.Output['outputs.NodeConfigResponse']:\n return pulumi.get(self, \"node_config\")",
"def getConfigPanel():\n\treturn None",
"def config(self) -> Optional[pulumi.In... | [
"0.6304897",
"0.6246214",
"0.5964019",
"0.5856851",
"0.58023477",
"0.5731579",
"0.57037073",
"0.57028264",
"0.5684316",
"0.56469375",
"0.5612736",
"0.56004655",
"0.5577127",
"0.5554848",
"0.55461204",
"0.5518103",
"0.55123484",
"0.5494142",
"0.54831827",
"0.54753786",
"0.5411... | 0.63832724 | 0 |
Get the score function configuration node. | def get_score_function(self, idattr):
return self.get_node(
'//ScoreFunctions/ScoreFunction[@id="%s"]' % idattr) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def node_config(self) -> pulumi.Output['outputs.NodeConfigResponse']:\n return pulumi.get(self, \"node_config\")",
"def node_config(self) -> 'outputs.NodeConfigResponse':\n return pulumi.get(self, \"node_config\")",
"def node_config(self) -> pulumi.Input['NodeConfigArgs']:\n return pulumi.... | [
"0.63718575",
"0.6308112",
"0.61304075",
"0.61296046",
"0.58007616",
"0.5749604",
"0.56206375",
"0.56024706",
"0.5595929",
"0.5578642",
"0.55448943",
"0.5543336",
"0.55408746",
"0.5515674",
"0.5506461",
"0.54993033",
"0.5492998",
"0.5463755",
"0.54461634",
"0.54443985",
"0.54... | 0.0 | -1 |
Get the map server configuration node. | def get_mapserver(self):
return self.get_node('//MapServer') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def config_server(self) -> Optional[pulumi.Input['ConfigServerSettingsArgs']]:\n return pulumi.get(self, \"config_server\")",
"def node_config(self) -> 'outputs.NodeConfigResponse':\n return pulumi.get(self, \"node_config\")",
"def node_config(self) -> pulumi.Output['outputs.NodeConfigResponse']:... | [
"0.729202",
"0.7186677",
"0.7145203",
"0.68700224",
"0.6852158",
"0.6690987",
"0.6620924",
"0.65789413",
"0.65578187",
"0.655448",
"0.6519716",
"0.64807874",
"0.64468384",
"0.62988555",
"0.6187097",
"0.61847913",
"0.6175286",
"0.61583996",
"0.6147118",
"0.61404",
"0.6107913",... | 0.80254036 | 0 |
A class method for parsing action bits, returning all enabled actions. | def all_enabled_actions(action_bits: int) -> List['LoggingActions']:
return [action for action in LoggingActions if action.value & action_bits] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def actions(self) -> list:\n if self.debug: print(f\"AState.actions()\")\n if not self._examined:\n if self.debug: print(f\"\\tExamining...\")\n self._actions = self._generate_actions()\n self._examined = True\n return self._actions",
"def get_actions(self):\... | [
"0.7033281",
"0.70253116",
"0.70028716",
"0.70028716",
"0.70028716",
"0.68904287",
"0.68365353",
"0.68182606",
"0.6795314",
"0.67753595",
"0.67426085",
"0.67391264",
"0.66866684",
"0.6621637",
"0.661713",
"0.6593213",
"0.65725034",
"0.6533465",
"0.65257895",
"0.647652",
"0.64... | 0.68279076 | 7 |
Generates a quaternion described by a direction vector and "upwards" orientation vector. | def _create_quaternion(direction, up) -> Tuple[float, float, float, float]:
direction = direction / spy.vnorm(direction)
up = up / spy.vnorm(up)
x = spy.vcrss(up, direction)
x = x / spy.vnorm(x)
y = spy.vcrss(direction, x)
y = y / spy.vnorm(y)
z = direction
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def euler_to_quat(roll, pitch, yaw):\n pose = Pose()\n quaternion = tf.transformations.quaternion_from_euler(roll, pitch, yaw)\n pose.orientation.x = quaternion[0]\n pose.orientation.y = quaternion[1]\n pose.orientation.z = quaternion[2]\n pose.orientation.w = quaternion[3]\n return pose.orien... | [
"0.61915535",
"0.6190099",
"0.6179429",
"0.6140949",
"0.61003274",
"0.6035656",
"0.603231",
"0.60136503",
"0.60045856",
"0.593415",
"0.59243786",
"0.59128946",
"0.5902041",
"0.5898314",
"0.5885532",
"0.5883003",
"0.58659077",
"0.5852006",
"0.5811246",
"0.5791843",
"0.57909685... | 0.75455904 | 0 |
Calculate the average of a list of ints. | def avg(list):
return sum(list) / len(list) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def number_list_average(numbers):\n return sum(numbers)/len(numbers)",
"def func(lst):\n tot = 0\n for i in lst:\n tot = tot + i\n avg = tot / len(lst)\n return avg",
"def average(num_list):\n nums_average = None\n nums_sum = 0\n if len(num_list) != 0:\n for num in num_lis... | [
"0.7987588",
"0.7841614",
"0.7765132",
"0.7756065",
"0.7707706",
"0.76810974",
"0.76375526",
"0.76363796",
"0.76339686",
"0.7611916",
"0.7609526",
"0.7594919",
"0.75106096",
"0.74903756",
"0.74733925",
"0.7463148",
"0.7437408",
"0.74343395",
"0.7425022",
"0.7414942",
"0.73833... | 0.78449416 | 1 |
Set up the main window | def finish_initializing(self, builder): # pylint: disable=E1002(
super(SlashmPlayerWindow, self).finish_initializing(builder)
self._create_context_menu()
self.AboutDialog = AboutSlashmPlayerDialog
self.PreferencesDialog = PreferencesSlashmPlayerDialog
self.maximize()
self... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setupWindow(self):\n\n\t\tself.main_menu_window = MenuFrame.MainMenuFrame(self.uiCoordinator)\n\t\tself.menu_window = self.main_menu_window._mf\n\t\tself.score_window = self.main_menu_window._hf\n\t\tself.instructions_window = self.main_menu_window._if\n\t\tself.menu_window.playButton.focus_set()",
"def main... | [
"0.80549276",
"0.77803993",
"0.76101744",
"0.76079625",
"0.76058704",
"0.75583404",
"0.75058156",
"0.7500768",
"0.7449036",
"0.74340516",
"0.7430231",
"0.73911846",
"0.73764753",
"0.730698",
"0.7291845",
"0.7287895",
"0.72417337",
"0.72298133",
"0.72146386",
"0.7190348",
"0.7... | 0.0 | -1 |
Removes "$" sign from a column & converts it to float. This function accepts a dataframe and columns with $ sign to be converted to float. | def clean_dollar(df, col):
df[col] = df[col].apply(lambda s: s.strip('$')).astype(float)
return df | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_to_float(df, *cols):\n for col in cols:\n df[col] = df[col].str.replace(',', '')\n df[col] = df[col].str.replace(' ', '')\n df[col] = df[col].astype(float)\n return df",
"def convert_dollars(df,col_name):\n df[col_name] = df[col_name].replace('[^.0-9]','',regex=True).ast... | [
"0.7570698",
"0.75322235",
"0.6993561",
"0.67573756",
"0.63994634",
"0.60710955",
"0.6047121",
"0.60041076",
"0.59911036",
"0.5854781",
"0.58415484",
"0.58027667",
"0.574845",
"0.57288504",
"0.570624",
"0.5689626",
"0.56807375",
"0.5654527",
"0.56319237",
"0.5611079",
"0.5575... | 0.7972689 | 0 |
Plot distribution of the column(s). This function will plot a chart of the passed column as the 'kind' specified in kind_. You can pass multiple columns to this function. | def plot_distribution(kind_, df, *col):
if kind_ == 'box':
if len(col) == 1:
boxplot = df.boxplot(column = col[0], rot = 90)
plt.show()
elif len(col) > 1:
for c in col[1:]:
boxplot = df.boxplot(column = col[0], by = c, rot = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Numeric_plot(df,column = '', title='',ncols=2,trans_func = None):\n \n # Box plot\n trace1 = go.Box(y = df[column],name='Box')\n \n # Histogram\n trace2 = go.Histogram(x = df[column], name = 'x')\n \n fig = tools.make_subplots(rows=1, cols=ncols)\n fig.append_trace(trace1, 1,1)\n ... | [
"0.64963204",
"0.6482532",
"0.6081623",
"0.6079596",
"0.5998469",
"0.59509665",
"0.59473723",
"0.59424454",
"0.58836085",
"0.58611655",
"0.584121",
"0.57620525",
"0.57547474",
"0.5736022",
"0.5730198",
"0.5717798",
"0.5704081",
"0.56984556",
"0.56752133",
"0.5659248",
"0.5658... | 0.81192666 | 0 |
Testing preparation of the database and important functions. | def test_prepare_database(self, json_file_name: str):
db = prepare_database(data_source=json_file_name)
assert db.members == {
Member(member_id='member-123', accounts=set(), name='member-123'),
Member(member_id='member-124', accounts=set(), name='member-124')
}
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUp(self):\n db.drop_all() # clean up the last tests\n db.create_all() # make our sqlalchemy tables",
"def setUp(self):\n with database() as db:\n sql = 'INSERT INTO persons (person_name, address, email) VALUES (%s, %s, %s)'\n db.query(sql, 'test_person_a', '123... | [
"0.7683269",
"0.75967115",
"0.75949347",
"0.7471486",
"0.7423211",
"0.7416072",
"0.7416072",
"0.7416072",
"0.7415056",
"0.7400543",
"0.73796666",
"0.7379533",
"0.73772407",
"0.7360647",
"0.7346288",
"0.7340452",
"0.7337439",
"0.73233026",
"0.73226374",
"0.73203385",
"0.726300... | 0.6909625 | 79 |
Return panda data frame of the moving averages | def moving_average_panda(data_set, periods=4, drop_initial_data=True):
data_set['MA_Col1'] = data_set.iloc[:, 0].rolling(window=periods).mean()
data_set['MA_Col2'] = data_set.iloc[:, 1].rolling(window=periods).mean()
data_set['MA_Col3'] = data_set.iloc[:, 2].rolling(window=periods).mean()
data_set['MA_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def moving_averages(df, start_step, window_size=None):\n if window_size == None: # Use a large window to compute average over all historical data\n window_size = df.shape[0]\n fea = df.shift(start_step).rolling(min_periods=1, center=False, window=window_size).mean()\n fea.columns = fea.columns + \... | [
"0.7443811",
"0.74277246",
"0.72513866",
"0.72178644",
"0.7217166",
"0.71337783",
"0.6939632",
"0.6933122",
"0.6903184",
"0.68855256",
"0.6862415",
"0.6853283",
"0.68278843",
"0.67301923",
"0.66960794",
"0.6654622",
"0.66407907",
"0.66143763",
"0.66110533",
"0.66005486",
"0.6... | 0.71340775 | 5 |
Format electricity price forecast results into a dataframe | def format_forecast_results(X_test,y_pred,prices,schedule):
d_pred = dict((k,v) for k,v in zip(X_test,y_pred))
df_pred = pd.DataFrame.from_dict(d_pred,'index').sort_index() # df from dict
df_pred.columns = ['forecasted_price']
df_pred = df_pred.merge(prices[['blockid']],left_index=True,right_index=True,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _convert_price_todataframe(self, reg_output):\n try:\n price_history = pd.DataFrame(reg_output, columns=['Date', 'Price'])\n except:\n raise TypeError(\n 'Error: Could not convert scraped price history table to dataframe. Check regex function and '\n ... | [
"0.66204685",
"0.6586722",
"0.6498953",
"0.5946335",
"0.5903674",
"0.5885178",
"0.5810363",
"0.5797524",
"0.57929206",
"0.57795846",
"0.5762223",
"0.57479817",
"0.57337576",
"0.5730984",
"0.56588686",
"0.5654153",
"0.56438005",
"0.56434083",
"0.5608236",
"0.5606983",
"0.55988... | 0.6507811 | 2 |
Linearly increase `lr` for `pct_start` or `warmup_steps` before cosine annealing from `pct_start` or `warmup_steps`. | def WarmupCosineLR(
optimizer: torch.optim.Optimizer,
max_iters: int,
pct_start: Optional[float] = None,
warmup_steps: Optional[int] = None,
warmup_factor: float = (1.0 / 1000),
) -> torch.optim.lr_scheduler._LRScheduler:
# warmup iterations
if pct_start is None and warmup_steps is None:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_lr_cosine(self, base_lr):\n # 400, 1e-3\n warmup_steps = 10\n annealing_steps = 500\n end_lr = 1e-3\n if self.steps < warmup_steps:\n lr = base_lr * (self.steps+1) / warmup_steps\n elif self.steps < warmup_steps+annealing_steps:\n step = se... | [
"0.72321916",
"0.658215",
"0.62908053",
"0.6244085",
"0.61668813",
"0.61224467",
"0.6114424",
"0.6068697",
"0.6005816",
"0.6004883",
"0.5999371",
"0.5942117",
"0.5917581",
"0.588871",
"0.5815931",
"0.57902896",
"0.57861066",
"0.57856804",
"0.5781266",
"0.57493615",
"0.5731851... | 0.6678389 | 1 |
Linearly increase `lr` for `pct_start` or `warmup_steps` before linear decreasing of `lr`. | def WarmupLinearLR(
optimizer: Optimizer,
max_iters: int,
pct_start: Optional[float] = None,
warmup_steps: Optional[int] = None,
warmup_factor: float = (1.0 / 1000),
) -> torch.optim.lr_scheduler._LRScheduler:
# warmup iterations
if pct_start is None and warmup_steps is None:
raise V... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def adjust_learning_rate(start_lr, optimizer, epoch, total_epoch_num):\n #lr = start_lr * (0.1 ** (epoch // 30))\n lr = start_lr * (0.3 ** (epoch // 5))\n if epoch==total_epoch_num:\n lr = lr * 0.3\n\n for param_group in optimizer.param_groups:\n param_group['lr'] = lr",
"def WarmupCons... | [
"0.7004273",
"0.69648665",
"0.69609404",
"0.6761896",
"0.67390037",
"0.6617007",
"0.66152376",
"0.6605321",
"0.6546198",
"0.65241843",
"0.6514494",
"0.64930683",
"0.64812076",
"0.645743",
"0.6437994",
"0.6412555",
"0.6396178",
"0.6351208",
"0.63397175",
"0.6321464",
"0.630637... | 0.71566784 | 0 |
Linearly increase `lr` for `pct_start` or `warmup_steps` after which keep the `lr` at constant value. | def WarmupConstantLR(
optimizer: Optimizer,
max_iters: int,
pct_start: Optional[float] = None,
warmup_steps: Optional[int] = None,
warmup_factor: float = (1.0 / 1000),
) -> torch.optim.lr_scheduler._LRScheduler:
# warmup iterations
if pct_start is None and warmup_steps is None:
raise... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def adjust_learning_rate(start_lr, optimizer, epoch, total_epoch_num):\n #lr = start_lr * (0.1 ** (epoch // 30))\n lr = start_lr * (0.3 ** (epoch // 5))\n if epoch==total_epoch_num:\n lr = lr * 0.3\n\n for param_group in optimizer.param_groups:\n param_group['lr'] = lr",
"def WarmupLine... | [
"0.7200733",
"0.70973206",
"0.7034057",
"0.6873075",
"0.68204015",
"0.6768964",
"0.67240745",
"0.6616199",
"0.6600019",
"0.6591008",
"0.6580116",
"0.6574635",
"0.65610594",
"0.6539885",
"0.6520072",
"0.65169734",
"0.6458039",
"0.64431155",
"0.642239",
"0.6408706",
"0.63997823... | 0.71810764 | 1 |
The ``ObjectType`` described in the ACE. ``None`` if `ACE`` has no ``ObjectType`` | def object_type(self):
if not self.Flags & gdef.ACE_OBJECT_TYPE_PRESENT:
return None
return self.ObjectType | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inherited_object_type(self):\n if not self.Flags & gdef.ACE_INHERITED_OBJECT_TYPE_PRESENT:\n return None\n if self.Flags & gdef.ACE_OBJECT_TYPE_PRESENT:\n # There is an ObjectType so our offset is the good one\n return self.InheritedObjectType\n # No Object... | [
"0.69274837",
"0.67652214",
"0.67652214",
"0.6458054",
"0.6458054",
"0.6458054",
"0.6458054",
"0.6293348",
"0.6293348",
"0.6293348",
"0.6293348",
"0.6293348",
"0.6293348",
"0.6293348",
"0.6293348",
"0.6293348",
"0.6293348",
"0.6293348",
"0.6293348",
"0.6293348",
"0.6293348",
... | 0.8260422 | 0 |
The group of the security descriptor | def group(self):
group = gdef.PSID()
lpbGroupDefaulted = gdef.BOOL()
winproxy.GetSecurityDescriptorGroup(self, group, lpbGroupDefaulted)
# Return None of group is NULL
return group or None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def group(self):\n return self._group",
"def group(self):\n return self._group",
"def group(self):\n return self._group",
"def group(self) -> str:\n return pulumi.get(self, \"group\")",
"def security_group(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"... | [
"0.7813998",
"0.7813998",
"0.7813998",
"0.77394426",
"0.77296996",
"0.7722294",
"0.76519376",
"0.7651268",
"0.7507755",
"0.74972963",
"0.74225944",
"0.7297601",
"0.7195563",
"0.7189577",
"0.71889275",
"0.71889275",
"0.7181225",
"0.71059054",
"0.71059054",
"0.71059054",
"0.710... | 0.8435953 | 0 |
Inits a new BT instance with an optional root node created with the provided data. | def __init__(self, rootData=None, treetype=None):
self._root = BTNode(rootData) if rootData else None
self._size = 1 if rootData else 0
self._treetype = treetype
#Only for printing functionality
self._depth = 1 if rootData else 0 #Root is at depth 1
self._max_chars = len(str(rootData)) if rootData else 1 #... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, data=None):\n if data is not None:\n self._size = 1\n self.head = Node(data)\n self.tail = self.head\n else:\n self._size = 0\n self.head = None\n self.tail = None",
"def __init__(self, data=None):\n self.da... | [
"0.68921053",
"0.6869826",
"0.6584426",
"0.65554357",
"0.6441902",
"0.6411301",
"0.63676625",
"0.63672113",
"0.6361909",
"0.6299748",
"0.6291422",
"0.62613595",
"0.62424195",
"0.6233267",
"0.61878353",
"0.6180863",
"0.6157787",
"0.6157787",
"0.61523336",
"0.61441714",
"0.6142... | 0.77117044 | 0 |
Returns the type of the tree, or None if the tree is not typed. | def treetype(self):
return self._treetype | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getType_(self, ctx):\n # type: (Optional[RelayParser.Type_Context]) -> Optional[ty.Type]\n\n if ctx is None:\n return None\n\n return self.visit(ctx)",
"def get_type(node):\n # Assume there is only one type inferred\n # If there are multiple types inferred we have to\n ... | [
"0.7197251",
"0.6993529",
"0.6721539",
"0.6593387",
"0.65631604",
"0.65169317",
"0.6495995",
"0.6378965",
"0.6325105",
"0.6325105",
"0.6325105",
"0.6325105",
"0.6325105",
"0.6325105",
"0.6325105",
"0.6325105",
"0.6325105",
"0.6325105",
"0.6325105",
"0.6325105",
"0.6325105",
... | 0.60337937 | 49 |
Returns True if the instance is a valid binary search tree, False otherwise (if it has been corrupted). Uses a recursive postorder traversal. | def is_bst(self):
try:
self._recursive_is_bst_helper(self._root)
except AttributeError:
return False
return self._root._isvalidBST | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isValidBST(self, root):\n if not root:\n return False\n stack = deque()\n prev = None\n while root or stack:\n if root:\n stack.append(root)\n root = root.left\n else:\n node = stack.pop()\n if prev and prev.val > node.val:\n return False\n ... | [
"0.6934552",
"0.662915",
"0.6591189",
"0.6492879",
"0.63614947",
"0.6301986",
"0.6298726",
"0.6220561",
"0.6192502",
"0.6190562",
"0.6164166",
"0.6162353",
"0.61623365",
"0.61549264",
"0.6091633",
"0.6074732",
"0.6054756",
"0.60321075",
"0.60304135",
"0.60071594",
"0.60021394... | 0.7162799 | 0 |
compute duration between current time and last time. | def get_duration(self, current_time):
return current_time - self.slam.get_data(node_name=self.last_point_name)['time'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def duration(self):\r\n return (self.end_time or time.time()) - self.start_time",
"def duration(self):\n return self.end_time - self.start_time",
"def get_duration(self):\n\n return self.endtime - self.starttime",
"def duration(self) -> float:\n return self.endTime()-self.startTime()"... | [
"0.76543397",
"0.73647034",
"0.73391217",
"0.7181912",
"0.7181031",
"0.7033646",
"0.7029622",
"0.7019136",
"0.7010028",
"0.6971725",
"0.69540006",
"0.69260883",
"0.69109166",
"0.6836921",
"0.6803885",
"0.6760833",
"0.6760276",
"0.6739406",
"0.67309505",
"0.6720957",
"0.668519... | 0.77319616 | 0 |
Lancaster midP(probability) modified binomial uncertainty confidence intervals. | def binom_err_midp(k,n, CL = np.array([0.025, 0.975])):
out = np.zeros(CL.size)
for j in range(len(out)):
def f(p):
psum = 0.0
factor = 1.0
for i in range(0,k+1):
if i == k:
factor = 1/2
psum += factor * binom.pm... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mid(p1, p2):\n\treturn [(p1[0]+p2[0])/2., (p1[1]+p2[1])/2.]",
"def poisson_obs_mid_p(nobs:int, nexp:float, nexperr:float) -> float:\n p = poisson_obs_p(nobs, nexp, nexperr)\n pplus1 = poisson_obs_p(nobs+1, nexp, nexperr)\n mid_p = 0.5 * (p - pplus1)\n p -= mid_p\n\n return p",
"def mid(p1, p... | [
"0.62773454",
"0.62709796",
"0.61771905",
"0.61004615",
"0.5770777",
"0.5769201",
"0.5677501",
"0.5655826",
"0.56488883",
"0.55592686",
"0.5527616",
"0.552404",
"0.5518331",
"0.5499565",
"0.5491422",
"0.5479519",
"0.54634124",
"0.5460115",
"0.5433614",
"0.5418188",
"0.5408561... | 0.65083563 | 0 |
ClopperPearson binomial proportion confidence interval. Below, beta.ppf (percent point functions) returns inverse CDF for quantiles. | def clopper_pearson_err(k, n, CL=[0.025, 0.975]):
# Special case must be treated separately
if k == 0:
lower = 0
upper = 1 - (1-CL[1])**(1/n)
# Special case must be treated separately
elif k == n:
lower = CL[0]**(1/n)
upper = 1
# Normal case
else:
lowe... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ci_prop(p, n, conf_level=95):\n # calculate significance level\n alpha = np.round((1 - conf_level / 100), 2)\n # standard error\n std_error = np.sqrt(p * (1 - p) / n)\n # find the z critical value\n z_star = np.round(stats.norm.ppf(1 - alpha / 2), 3)\n # margin of error\n margin_of_erro... | [
"0.6244176",
"0.6120192",
"0.5931537",
"0.58469415",
"0.5845753",
"0.5788267",
"0.5640404",
"0.5614743",
"0.55501354",
"0.5537031",
"0.5525241",
"0.5525241",
"0.5502838",
"0.548889",
"0.548889",
"0.5488433",
"0.5446284",
"0.54461855",
"0.54424006",
"0.54341644",
"0.5433645",
... | 0.5481795 | 16 |
Katz el al. ratio confidence interval of two binomial proportions. | def katz_binomial_ratio_err(k1,n1, k2,n2, z=1.0):
RR = (k1/n1) / (k2/n2) # mean
logRR = np.log(RR)
seLogRR = np.sqrt(1/k1 + 1/k2 - 1/n1 - 1/n2)
lower = np.exp(logRR - z*seLogRR)
upper = np.exp(logRR + z*seLogRR)
return np.array([lower, upper]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bootstrap_binomial_ratio(k1,n1, k2,n2, B):\n\n B1 = bootstrap_sample_binomial(k=k1, n=n1, B=B)\n B2 = bootstrap_sample_binomial(k=k2, n=n2, B=B)\n R = (B1/n1) / (B2/n2)\n\n return R, B1, B2",
"def newcombe_binomial_ratio_err(k1,n1, k2,n2, z=1.0):\n \n RR = (k1/n1) / (k2/n2) # mean\n\n... | [
"0.7155009",
"0.71242326",
"0.6707542",
"0.6669287",
"0.65800554",
"0.65685",
"0.6514665",
"0.6391786",
"0.6281577",
"0.62768036",
"0.6186152",
"0.6129782",
"0.60850835",
"0.60487473",
"0.60415936",
"0.6029413",
"0.5936662",
"0.5915111",
"0.5906728",
"0.59012157",
"0.5895611"... | 0.7235961 | 0 |
Tests a block to see if it's an armature. | def is_armature_root(self, niBlock):
if isinstance(niBlock, NifFormat.NiNode):
return niBlock in self.nif_import.dict_armatures
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_block(self, block):\n pass",
"def check_block(block):\n asides = block.runtime.get_asides(block)\n assert len(asides) == 1, f'Found {asides} asides but expected only test_aside'\n assert isinstance(asides[0], AsideTestType)\n category =... | [
"0.74814016",
"0.68003225",
"0.66845286",
"0.63154423",
"0.6108202",
"0.6065927",
"0.6026056",
"0.60030407",
"0.5943352",
"0.5940206",
"0.593345",
"0.59219223",
"0.5920326",
"0.590203",
"0.58903724",
"0.5882341",
"0.5870395",
"0.5869949",
"0.5851886",
"0.5844354",
"0.58418363... | 0.6206139 | 4 |
Initialize the ship and set its starting position. | def __init__(self,screen,ai_settings):
self.screen = screen
self.ai_settings = ai_settings
# Load the ship image and get its rect
self.image = pygame.image.load('images/ship.bmp')
self.rect = self.image.get_rect() #Stores the images's rect object through which we can c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUp(self):\r\n global ship_image\r\n self.spaceshipgame = SpaceShipGame()\r\n self.spaceshipgame.init()\r\n pos = [1,1]\r\n vel = [1,1]\r\n angle = 0\r\n image = ship_image\r\n\r\n center = [1,1]\r\n size = 1\r\n info = ImageInfo(center, s... | [
"0.7156775",
"0.7156775",
"0.71117884",
"0.7104403",
"0.70625305",
"0.6991875",
"0.69255584",
"0.68944544",
"0.688422",
"0.6880826",
"0.68696547",
"0.6849714",
"0.68470556",
"0.68340504",
"0.6809345",
"0.6806218",
"0.67833537",
"0.6759838",
"0.6683925",
"0.6680851",
"0.663616... | 0.65135926 | 25 |
Center the ship on the screen. | def center_ship(self):
self.center = self.screen_rect.centerx | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def center_ship(self):\n self.center = self.screen_rect.centerx",
"def center_ship(self):\n self.center = self.screen_rect.centerx",
"def center_ship(self):\n self.center = self.screen_rect.centerx",
"def center_ship(self):\n # Start each new ship at the bottom center\n sel... | [
"0.90483487",
"0.90483487",
"0.90483487",
"0.86796546",
"0.77428573",
"0.7571409",
"0.7519597",
"0.7502143",
"0.74013364",
"0.7365447",
"0.72528094",
"0.7213482",
"0.7202151",
"0.71933264",
"0.7159793",
"0.712372",
"0.712372",
"0.7016084",
"0.6983172",
"0.6981482",
"0.6975728... | 0.90521824 | 0 |
Dump data to JSON string and encode it to UTF8 bytes | def encode(data):
return json_mod.dumps(data).encode("utf-8") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def serialize_json(json_data):\n return json.dumps(json_data).encode(\"utf-8\")",
"def json_encode(data):\n return json.dumps(data, cls=JSONEncoder)",
"def dump_json_bytes(obj, dumps=json.dumps):\n result = dumps(obj)\n if isinstance(result, text_type):\n return result.encode('utf-8')\n ... | [
"0.7268252",
"0.7101218",
"0.70162684",
"0.7004749",
"0.6861776",
"0.6849809",
"0.6734317",
"0.66930455",
"0.6684536",
"0.6682361",
"0.66691464",
"0.6613906",
"0.65788335",
"0.65686315",
"0.65555805",
"0.65536755",
"0.65452945",
"0.65111357",
"0.6478395",
"0.6444124",
"0.6441... | 0.7895607 | 0 |
Set sequence length and reshape the tensors. | def sequence_length(self, new_seq_length):
self._sequence_length = new_seq_length
self.tensors = [torch.tensor(
generate_batches(x, self._sequence_length, self._sequence_stride)).float()
for x in [self.inputs, self.outputs]] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reshape_pyramidal(outputs): #, sequence_length):\n # [batch_size, max_time, num_units]\n shape = outputs.get_shape().as_list()\n #shape = tf.shape(outputs)\n max_time = shape[1]\n num_units = outputs.get_shape().as_list()[-1]\n ... | [
"0.616096",
"0.59452933",
"0.58334416",
"0.5833246",
"0.57840604",
"0.5783229",
"0.57400054",
"0.5584882",
"0.55569005",
"0.5551493",
"0.55459756",
"0.5541593",
"0.5534233",
"0.5533882",
"0.54904556",
"0.54662037",
"0.5457648",
"0.5410564",
"0.5408659",
"0.5408425",
"0.540616... | 0.7175728 | 0 |
Returns the containerStatus.name value. | def get_name(self) -> Text:
return self._get_value(KubernetesResource.Keys.NAME) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def container_status(self) -> str:\n return pulumi.get(self, \"container_status\")",
"def name(self):\n return self.container['name']",
"def name(self):\n return self.container['name']",
"def container_status(self):\n if self.status == 'complete':\n return 'complete'\n ... | [
"0.78838944",
"0.7151554",
"0.7151554",
"0.6861036",
"0.6508252",
"0.6507606",
"0.6414648",
"0.63992006",
"0.63624674",
"0.6326732",
"0.6276408",
"0.6272272",
"0.62708735",
"0.62708735",
"0.62708735",
"0.62708735",
"0.62708735",
"0.62708735",
"0.62708735",
"0.62708735",
"0.62... | 0.6182458 | 48 |
Returns the containerStatus.ready value. | def is_ready(self) -> Text:
return str(self._get_value(KubernetesResource.Keys.READY)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_ready_status():\n statusObj = get_server_status(fields=['ready'])\n return statusObj['ready']",
"def container_status(self) -> str:\n return pulumi.get(self, \"container_status\")",
"def _IsReady(self):\n return self._GetPod()['status']['phase'] != 'Pending'",
"def IsReady(self):\r\n\... | [
"0.81886744",
"0.6929381",
"0.6631243",
"0.66224277",
"0.6563929",
"0.6491427",
"0.64218175",
"0.63882756",
"0.6378612",
"0.6316286",
"0.62270486",
"0.61994684",
"0.6191246",
"0.6165124",
"0.6148387",
"0.6110771",
"0.6104591",
"0.6102533",
"0.6092385",
"0.60668665",
"0.606650... | 0.77743787 | 1 |
Returns the containerStatus.started value. | def is_started(self) -> Text:
return str(self._get_value(KubernetesResource.Keys.STARTED)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def started(self):\n if self._started is not None:\n return self._started\n\n self._started = getattr(self.factory, 'status_' + self.class_name())(self)\n return self._started",
"def started(self):\n return self._started",
"def started(self):\n return self._started... | [
"0.69823766",
"0.68510574",
"0.6814347",
"0.65220654",
"0.63466644",
"0.6272844",
"0.6268768",
"0.6218933",
"0.6149078",
"0.6070092",
"0.5989994",
"0.59782565",
"0.59665734",
"0.59665734",
"0.5962265",
"0.5914463",
"0.5910613",
"0.5910613",
"0.59023404",
"0.5895928",
"0.58878... | 0.75084513 | 0 |
Returns a flattened version of the containerStatus.state dictionary with one level of keys for the current container state. | def get_state_dict(self) -> Dict[Text, Text]:
# get the containerStatus.state dict
container_state: Dict = self._container_status_dict.get(KubernetesResource.Keys.STATE)
# create a dictionary to hold the state values
state_dict: Dict = dict()
# if there is no state dict, return... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_container_statuses(self):\n return {c['id']: c['state'] for c in self.get_containers()}",
"def flatten_state_dict(state_dict, keep_empty_nodes = False):\n return traverse_util.flatten_dict(\n state_dict,\n is_leaf=tensorstore_leaf,\n keep_empty_nodes=keep_empty_nodes,\n sep='/... | [
"0.6925622",
"0.6215494",
"0.6113009",
"0.59109503",
"0.5887527",
"0.58695763",
"0.5763103",
"0.57626987",
"0.5760663",
"0.57332975",
"0.57332975",
"0.5721266",
"0.5720302",
"0.570658",
"0.5704859",
"0.56571037",
"0.5656357",
"0.56533784",
"0.5651744",
"0.56394327",
"0.563511... | 0.7052586 | 0 |
Returns the name of the pod being targeted by this _LogDownloadProcess. | def get_pod_name(self) -> Text:
return self._pod_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def log_name(self) -> Optional[str]:\n return self._log_name",
"def name(self):\n return self._job",
"def name(self):\n try:\n return self._name\n except AttributeError:\n if self.is_task:\n try:\n return self.pos_str\n ... | [
"0.6230243",
"0.59221005",
"0.588133",
"0.5842129",
"0.577266",
"0.5664137",
"0.5626554",
"0.5615543",
"0.56040597",
"0.55814016",
"0.5578702",
"0.5563325",
"0.554708",
"0.5527147",
"0.54400164",
"0.54400164",
"0.54400164",
"0.5436899",
"0.54166156",
"0.54166156",
"0.5415997"... | 0.7364078 | 0 |
Initialize a new Turing machine tape. | def __init__(
self, tape: Sequence[str], blank_symbol: str, current_position: int = 0
) -> None:
tape = list(tape)
# Make sure that there's something under the cursor.
while len(tape) <= current_position:
tape.append(blank_symbol)
object.__setattr__(self, "tape", ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_machine_init_tape(self):\n with raises(SyntaxError):\n self.machine.init_tape('abacab')\n assert self.machine.head is None\n assert self.machine.state is None\n assert self.machine.tape is None\n\n self.machine.add_state('0 ,R, ,R, ,R, a,N,!')\n wit... | [
"0.7160444",
"0.6507855",
"0.6280777",
"0.62381667",
"0.61869127",
"0.61729425",
"0.60678405",
"0.6059041",
"0.5912671",
"0.59116876",
"0.5856003",
"0.58186525",
"0.5801618",
"0.5732802",
"0.5710768",
"0.5688818",
"0.5668883",
"0.5644087",
"0.5640291",
"0.5631922",
"0.5630079... | 0.59690666 | 8 |
Ask the `scf.issues` table for the `max(updated_at)` value | def get_max_update_dt():
from .utils import connect_to_pg
conn = connect_to_pg()
query = "select max(updated_at) from scf.issues"
res = conn.execute(query)
max_dt = res.fetchone()[0]
print(max_dt)
return max_dt | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def latest_update():\n try:\n return ProjectSummary.objects.latest().updated_at\n except ProjectSummary.DoesNotExist:\n return None",
"def last_update(cls):\n\n score = Score.query.with_entities(Score.updated_on).order_by(desc(Score.updated_on)).first()\n if score:\n ... | [
"0.68252975",
"0.64990026",
"0.63866246",
"0.6291118",
"0.6145425",
"0.61246777",
"0.60446906",
"0.5908022",
"0.5897066",
"0.5886259",
"0.5859047",
"0.5829207",
"0.5802256",
"0.57248986",
"0.57241786",
"0.569559",
"0.5686604",
"0.5686604",
"0.5678401",
"0.56739753",
"0.566812... | 0.79132134 | 0 |
Owner is not allowed to create new assessments | def test_owner_create_assessment(self):
req, resp = data.get_assessment(self.contract['id'])
response = self.user_01.post(self.assessment_list_url, req)
self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_owner_create_assessment(self):\n req, resp = data.get_assessment(self.contract['id'])\n response = self.user_01.post(self.assessment_list_url, req)\n self.assertEqual(response.status_code, status.HTTP_201_CREATED)\n response.data.pop('id')\n assert_assessment_response(se... | [
"0.7729678",
"0.7404685",
"0.7404685",
"0.73812246",
"0.70971346",
"0.6987078",
"0.6987078",
"0.6125905",
"0.6123834",
"0.6116707",
"0.6007696",
"0.600519",
"0.5966265",
"0.59602743",
"0.5905564",
"0.5899384",
"0.58667445",
"0.5829399",
"0.5825799",
"0.5779918",
"0.57797366",... | 0.8200943 | 0 |
Owner is allowed to update assessment, but not its template | def test_owner_edit_assessment_valid(self):
req = {'weight': 60, 'additional_description': 'asdfqwer'}
response = self.user_01.put(self.assessment_report_url, req)
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
response = self.user_01.patch(self.assessment_report_url... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_owner_edit_assessment_invalid(self):\n req, resp = data.get_assessment(self.contract['id'])\n response = self.user_01.put(self.assessment_report_url, req)\n self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN)",
"def test_owner_create_assessment(self):\n req, res... | [
"0.76198685",
"0.7014278",
"0.69869745",
"0.69542193",
"0.691126",
"0.6698085",
"0.6698085",
"0.6694836",
"0.6629851",
"0.6591788",
"0.6454214",
"0.6403161",
"0.63843614",
"0.6370104",
"0.6331404",
"0.63233614",
"0.6264152",
"0.62533796",
"0.62363976",
"0.62208354",
"0.620975... | 0.65763557 | 10 |
Owner is allowed to update assessment, but not its template | def test_owner_edit_assessment_invalid(self):
req, resp = data.get_assessment(self.contract['id'])
response = self.user_01.put(self.assessment_report_url, req)
self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_owner_create_assessment(self):\n req, resp = data.get_assessment(self.contract['id'])\n response = self.user_01.post(self.assessment_list_url, req)\n self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN)",
"def write_authorize(cls, user, obj):\n if not cls._meta.m... | [
"0.7016037",
"0.6986622",
"0.6953042",
"0.69114345",
"0.6697692",
"0.6697692",
"0.6693855",
"0.6629722",
"0.6591057",
"0.6575246",
"0.6452929",
"0.6403039",
"0.63823926",
"0.63718337",
"0.6331136",
"0.63222486",
"0.62632626",
"0.6253046",
"0.6236008",
"0.6219802",
"0.62087697... | 0.76203734 | 0 |
Gets value at each latent site in `model` given unconstrained parameters `params`. The `transforms` is used to transform these unconstrained parameters to base values of the corresponding priors in `model`. If a prior is a transformed distribution, the corresponding base value lies in the support of base distribution. ... | def constrain_fn(model, model_args, model_kwargs, transforms, params):
params_constrained = transform_fn(transforms, params)
substituted_model = substitute(model, base_param_map=params_constrained)
model_trace = trace(substituted_model).get_trace(*model_args, **model_kwargs)
return {k: model_trace[k]['v... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transform_fn(transforms, params, invert=False):\n if invert:\n transforms = {k: v.inv for k, v in transforms.items()}\n return {k: transforms[k](v) if k in transforms else v\n for k, v in params.items()}",
"def transform(self, params, model, transformation, target_shape):\n sel... | [
"0.51287293",
"0.5014981",
"0.49878404",
"0.49160644",
"0.48483506",
"0.48171145",
"0.4814651",
"0.47981277",
"0.4785113",
"0.47635627",
"0.47552845",
"0.47528157",
"0.4731376",
"0.47163966",
"0.47118264",
"0.46632335",
"0.46602204",
"0.46121612",
"0.4611313",
"0.4600581",
"0... | 0.5808672 | 0 |
Run model by sampling latent parameters from `posterior_samples`, and return values at sample sites from the forward run. By default, only sites not contained in `posterior_samples` are returned. This can be modified by changing the `return_sites` keyword argument. | def predictive(rng, model, posterior_samples, return_sites=None, *args, **kwargs):
# TODO: consider to support `num_samples`, `return_traces`, `parallel` kwargs
def single_prediction(rng, samples):
model_trace = trace(seed(condition(model, samples), rng)).get_trace(*args, **kwargs)
sites = model... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sample_posterior(\n rng_key: random.PRNGKey,\n model,\n data: np.ndarray,\n Nsamples: int = 1000,\n alpha: float = 1,\n sigma: float = 0,\n T: int = 10,\n gibbs_fn=None,\n gibbs_sites=None):\n\n if gibbs_fn is None or gibbs_sites is None:\n ... | [
"0.5906568",
"0.5903699",
"0.5674437",
"0.56429356",
"0.55982494",
"0.5565764",
"0.55430764",
"0.5409633",
"0.5352642",
"0.53096735",
"0.5296155",
"0.52424693",
"0.5212656",
"0.5209799",
"0.51776236",
"0.51599663",
"0.51223016",
"0.5116351",
"0.5079671",
"0.5070743",
"0.50510... | 0.7101027 | 0 |
Read one double from the mmap at the given index. | def _read_var(self, time_idx, pressure_idx, var_idx, lat_idx, lng_idx):
offset = self.item_size * (
time_idx * self.t_idx + pressure_idx * self.p_idx +
var_idx * self.v_idx + lat_idx * self.l_idx + lng_idx)
self.mm.seek(offset)
return self.unpacker.unpack(self.mm.read(sel... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read(self, addr, index=None):\n\n addr_idx = self.index_addr(addr, index)\n value = self.mem.read(addr_idx)\n\n return value",
"def read(reader: BitStreamReader, _index: int) -> float:\n\n return reader.readFloat64()",
"def read_double(self, process_handle: int, address: int):\n... | [
"0.65888184",
"0.63827366",
"0.6195038",
"0.6150515",
"0.6065789",
"0.6041797",
"0.59662384",
"0.5801523",
"0.5800641",
"0.5800641",
"0.57903033",
"0.577169",
"0.5763536",
"0.57473046",
"0.57420444",
"0.57398087",
"0.57294977",
"0.57294977",
"0.57169896",
"0.57151556",
"0.566... | 0.5224635 | 78 |
Closes the connection to the database. | def close(self):
self.__database__.close() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close_db_connection(cls):\n db.close()",
"def close_database(self):\n if self._conn is not None:\n self._conn.close()\n self._conn = None",
"def close(self):\n Log.debug('DB -> close')\n # 关闭数据库连接\n self.conn.close()",
"def close(self):\n if... | [
"0.8420153",
"0.8370933",
"0.8159778",
"0.8131062",
"0.81211287",
"0.80669576",
"0.7892404",
"0.78269607",
"0.7820135",
"0.7819574",
"0.7819202",
"0.779008",
"0.77802986",
"0.7766655",
"0.77557564",
"0.77336437",
"0.7686685",
"0.7686685",
"0.7686685",
"0.76859367",
"0.7666182... | 0.7944911 | 6 |
Retorna la columna indicada por col_ | def filtro_por_criterio_columna(col_extraer, col_criterio, operacion, criterio, Base) -> list:
filtrada = []
if len(Base) == 0:
print("La lista esta vacía")
else:
t1_start = process_time() # tiempo inicial
filtrada = [el[col_extraer]
for el in Base if operacion... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_column(cls, name):\r\n return cls._columns[name]",
"def col(self):\n\t\treturn self.__col",
"def _get_column(self, name):\r\n return self.column(name)",
"def _get_col(self, idx):\n return self.text[self._fwf.column_slices[idx]]",
"def getCol(self, column_name):\n idx = ... | [
"0.7297933",
"0.7265185",
"0.72539353",
"0.72371495",
"0.71198535",
"0.7071204",
"0.7057092",
"0.70470905",
"0.69812626",
"0.6970632",
"0.69333863",
"0.692727",
"0.692428",
"0.6921571",
"0.6904998",
"0.6902945",
"0.6902945",
"0.68911576",
"0.6882006",
"0.6864295",
"0.68458384... | 0.0 | -1 |
decay the learning rate | def decay(self):
if self.l_rate > self.l_rate_bound[0] and self.l_rate - self.decay_rate > 0.0:
self.l_rate -= self.decay_rate
elif self.l_rate - self.decay_rate <= 0.0 or self.l_rate < self.l_rate_bound[0]:
self.l_rate = self.l_rate_bound[0]
for layer in self.network:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lr_decay(step):\n return(alpha / (1 + decay_rate * step))",
"def step_decay(epoch):\n # initial_lrate = 1.0 # no longer needed\n #drop = 0.5\n #epochs_drop = number_epoch_drop\n #lrate = init_lr * math.pow(drop,\n #math.floor((1+epoch)/epochs_drop))\n lr = learning_rate\n ... | [
"0.8596038",
"0.8295382",
"0.8146965",
"0.80920637",
"0.8000208",
"0.7931285",
"0.79282117",
"0.7827922",
"0.7731021",
"0.76989293",
"0.76924986",
"0.7688428",
"0.76328516",
"0.7614572",
"0.7609397",
"0.7555843",
"0.75371397",
"0.7528518",
"0.7517061",
"0.72959",
"0.7262789",... | 0.7892362 | 7 |
Sets the id of this MMCTicketsTicket. | def id(self, id):
if id is None:
raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501
self._id = id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ticket_id(self, ticket_id):\n self._ticket_id = ticket_id",
"def set_id(self, id):\n self.__id = id",
"def SetId(self, id):\n self.id = int(id)",
"def set_id(self, id_):\n\n self.id_ = id_",
"def set_id(self, id):\n self.data['id'] = id",
"def setID(self, id):\n ... | [
"0.7516366",
"0.7246705",
"0.7182433",
"0.7181039",
"0.69257003",
"0.6905536",
"0.67877376",
"0.67877376",
"0.67877376",
"0.67733014",
"0.67733014",
"0.67733014",
"0.67733014",
"0.67733014",
"0.6727641",
"0.6727641",
"0.6727641",
"0.6727641",
"0.6727641",
"0.6727641",
"0.6727... | 0.0 | -1 |
Sets the status of this MMCTicketsTicket. | def status(self, status):
if status is None:
raise ValueError("Invalid value for `status`, must not be `None`") # noqa: E501
allowed_values = ["Open", "Claimed", "Held", "Closed"] # noqa: E501
if status not in allowed_values:
raise ValueError(
"Invalid v... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setstatus(self, status):\n with self.lock:\n self.status = status",
"def set_status(self, status):\n self.status = status",
"def set_status(self, status):\n self.status = status",
"def set_status(self, status):\n self.status = status",
"def SetStatus(self, status)... | [
"0.7207598",
"0.7055755",
"0.7055755",
"0.7055755",
"0.69597983",
"0.69264305",
"0.6909668",
"0.67951363",
"0.67951363",
"0.67951363",
"0.67951363",
"0.67951363",
"0.67951363",
"0.67951363",
"0.67607075",
"0.67607075",
"0.67607075",
"0.67607075",
"0.67607075",
"0.67607075",
"... | 0.581172 | 74 |
Sets the sender of this MMCTicketsTicket. | def sender(self, sender):
self._sender = sender | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sender(self, sender: str):\n if sender is None:\n raise ValueError(\"Invalid value for `sender`, must not be `None`\") # noqa: E501\n\n self._sender = sender",
"def sender(self, sender: Address) -> None:\n enforce(\n isinstance(sender, str), f\"Sender must be strin... | [
"0.7231686",
"0.6864236",
"0.6267467",
"0.6013667",
"0.58400345",
"0.5560073",
"0.54336375",
"0.5334049",
"0.52730346",
"0.52726376",
"0.5245843",
"0.52189356",
"0.5139688",
"0.51391596",
"0.51367354",
"0.5121695",
"0.5088449",
"0.505906",
"0.5021455",
"0.4994811",
"0.4980890... | 0.6058703 | 6 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, MMCTicketsTicket):
return False
return self.__dict__ == other.__dict__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8088132",
"0.8088132",
"0.8054589",
"0.7982687",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.845611",
"0.8391477",
"0.8144138",
"0.81410587",
"0.8132492",
"0.8093973",
"0.80920255",
"0.80920255",
"0.80920255",
"0.8085325",
"0.8085325",
"0.8076365",
"0.8076365",
"0.8065748"
] | 0.0 | -1 |
Convert JSON string to Series | def from_json(cls, json, orient="index", dtype=None, numpy=True):
s = None
if dtype is not None and orient == "split":
numpy = False
if numpy:
try:
if orient == "split":
decoded = loads(json, dtype=dtype, numpy=True)
decoded = dict((str(k), v) fo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _xml_to_series(self, xml):\n d = self._xml_to_dict(xml)\n d = d['Data']\n if isinstance(d, basestring):\n raise EmptyXMLError('Provided xml has no content.')\n shows = d['Series'] #list of dicts\n if self.get_first:\n if isinstance(shows, list):\n ... | [
"0.63821644",
"0.61480427",
"0.60911655",
"0.6006355",
"0.6005788",
"0.5944397",
"0.5919177",
"0.5919177",
"0.5813796",
"0.571271",
"0.5710816",
"0.5703605",
"0.5689672",
"0.5645758",
"0.56379116",
"0.5601851",
"0.55863893",
"0.556919",
"0.5563988",
"0.5561029",
"0.5530773",
... | 0.70196193 | 0 |
Convert JSON string to DataFrame | def from_json(cls, json, orient="columns", dtype=None, numpy=True):
df = None
if dtype is not None and orient == "split":
numpy = False
if numpy:
try:
if orient == "columns":
args = loads(json, dtype=dtype, numpy=True, labelled=True)
if args:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_pandas(data: str) -> pandas.DataFrame:\n src = json.loads(data)\n if isinstance(src, list): # list of row dicts\n return pandas.DataFrame.from_records(src)\n if 'instances' in src: # TF serving's \"instances\" format\n return pandas.DataFrame.from_records(src['in... | [
"0.77508926",
"0.7245385",
"0.7098532",
"0.6824663",
"0.6778319",
"0.6456525",
"0.6408276",
"0.63489217",
"0.6340924",
"0.630475",
"0.6302125",
"0.628899",
"0.6159746",
"0.615229",
"0.6135666",
"0.610166",
"0.6096299",
"0.60884327",
"0.6076875",
"0.6049788",
"0.60476893",
"... | 0.6804238 | 4 |
close out ROUTER socket and and all the PUSH clients we are holding | def close(self):
self._router_socket.close()
for client in self._active_clients.values():
client.close() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close(self):\n if self.push_socket is not None:\n self.push_socket.close()\n\n if self.pull_socket is not None:\n self.pull_socket.close()\n\n if self.control_socket is not None:\n self.control_socket.close()",
"def close(self):\n if self.pending_m... | [
"0.7677334",
"0.74523956",
"0.7361958",
"0.73474795",
"0.7299397",
"0.7273113",
"0.7256868",
"0.72533935",
"0.7221448",
"0.72152513",
"0.72001386",
"0.71951497",
"0.7192452",
"0.7170539",
"0.7135394",
"0.7116222",
"0.7116222",
"0.7116222",
"0.7116222",
"0.7116222",
"0.7116222... | 0.7443191 | 2 |
Create a frame of tkinter.Buttons | def make_buttons(self, location, buttons, commands=None):
button_frame = tkinter.Frame(location)
self.make_spacer(button_frame).grid()
for button_num, each_b in enumerate(buttons):
self.make_spacer(button_frame, width=3).grid(
column=NUMBERS[::2][button_num], row... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_buttons(frame):\n button0 = Button(frame, height=2, width=2, text=\" \",\n command=lambda: on_click(button0))\n button0.pack(side=LEFT)\n button1 = Button(frame, height=2, width=2, text=\" \",\n command=lambda: on_click(button1))\n button1.pack(side=LE... | [
"0.845355",
"0.80933005",
"0.78759617",
"0.77731866",
"0.75577736",
"0.7283207",
"0.7246773",
"0.71515995",
"0.71356755",
"0.71343994",
"0.71298456",
"0.710385",
"0.70527506",
"0.7039372",
"0.7023345",
"0.7014041",
"0.69850445",
"0.6969275",
"0.69688344",
"0.69489366",
"0.692... | 0.7694392 | 4 |
Compute my distance from the origin | def DistanceFromOrigin(self):
return ((self.x ** 2) + (self.y ** 2)) ** 0.5 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def distance_from_origin(self):\n return ((self.x ** 2) + (self.y ** 2)) ** 0.5",
"def distance_from_origin(self):\n return ((self.x ** 2) + (self.y ** 2)) ** 0.5",
"def distance_from_origin(self):\n return ((self.x ** 2) + (self.y ** 2)) ** 0.5",
"def distance_from_origin(self):\n ... | [
"0.85663384",
"0.85663384",
"0.85663384",
"0.85663384",
"0.85663384",
"0.85663384",
"0.85663384",
"0.8565058",
"0.84973544",
"0.8323514",
"0.8296796",
"0.7732662",
"0.74226093",
"0.7381035",
"0.7292783",
"0.7264896",
"0.72594285",
"0.7255858",
"0.72473836",
"0.7230952",
"0.72... | 0.8215572 | 11 |
Return the halfway point between myself and the target | def halfway(self, target):
mx = (self.x + target.x)/2
my = (self.y + target.y)/2
return Point(mx, my) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def halfway(self, target):\n mx = (self.x + target.x)/2\n my = (self.y + target.y)/2\n return Point(mx, my)",
"def halfway(self, target):\n mx = (self.x + target.x)/2\n my = (self.y + target.y)/2\n return Point(mx, my)",
"def halfway(self, target):\n mx = (self.... | [
"0.87807095",
"0.87807095",
"0.87807095",
"0.8739289",
"0.7258228",
"0.67555827",
"0.6575694",
"0.63087344",
"0.6154392",
"0.6012264",
"0.5984519",
"0.5891061",
"0.5862106",
"0.5861572",
"0.58551717",
"0.58381695",
"0.5818833",
"0.5798639",
"0.57962465",
"0.5786625",
"0.57834... | 0.8788246 | 0 |
Returns self >= y | def ge(self, y):
return 1 - self.lt(y) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __gt__(self, other):\n return self.x ** 2 + self.y ** 2 > other.x ** 2 + other.y ** 2",
"def __ge__(self, other):\n return self.x ** 2 + self.y ** 2 >= other.x ** 2 + other.y ** 2",
"def __le__(self, other):\n return self.x ** 2 + self.y ** 2 <= other.x ** 2 + other.y ** 2",
"def gt(... | [
"0.7647544",
"0.74854106",
"0.7406816",
"0.7226857",
"0.721487",
"0.7059892",
"0.69713557",
"0.69652885",
"0.68853354",
"0.68498856",
"0.6845239",
"0.6838656",
"0.683052",
"0.6814957",
"0.6814957",
"0.6806536",
"0.6777519",
"0.6776329",
"0.675417",
"0.67368144",
"0.6689226",
... | 0.7751738 | 0 |
Returns self <= y | def le(self, y):
return 1 - self.gt(y) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __le__(self, other):\n return self.x ** 2 + self.y ** 2 <= other.x ** 2 + other.y ** 2",
"def ge(self, y):\n return 1 - self.lt(y)",
"def __ge__(self, other):\n return self.x ** 2 + self.y ** 2 >= other.x ** 2 + other.y ** 2",
"def __gt__(self, other):\n return self.x ** 2 + self.... | [
"0.7712549",
"0.7471368",
"0.74442613",
"0.74333876",
"0.72451806",
"0.69610465",
"0.69493896",
"0.6913926",
"0.6838152",
"0.68102074",
"0.68092567",
"0.68027353",
"0.6795027",
"0.67910564",
"0.67843527",
"0.6767478",
"0.6742666",
"0.67419136",
"0.6737069",
"0.6735821",
"0.67... | 0.7036661 | 5 |
Returns self < y | def lt(self, y):
return (self - y)._ltz() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __lt__(self, other):\n return self.y < other.y or (\n not self.y > other.y and\n self.x < other.x\n )",
"def __lt__(self, other):\n return self.x ** 2 + self.y ** 2 < other.x ** 2 + other.y ** 2",
"def ge(self, y):\n return 1 - self.lt(y)",
"def lt(self, x, y... | [
"0.8192013",
"0.8107101",
"0.79201335",
"0.7781432",
"0.76688457",
"0.75860703",
"0.75636667",
"0.7492044",
"0.7480179",
"0.7467689",
"0.74646187",
"0.7455622",
"0.74427897",
"0.74427897",
"0.7411403",
"0.7411403",
"0.740588",
"0.740277",
"0.73811054",
"0.73806155",
"0.737833... | 0.75649625 | 6 |
Returns self == y | def eq(self, y):
return 1 - self.ne(y) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self,y):\r\n\t\r\n\t\t# compare\r\n\t\tq = self.compare(y)\r\n\t\t\t\r\n\t\treturn q",
"def __eq__(self,other):\n if self.x == other.x and self.y == other.y:\n return True\n else:\n return False\n pass",
"def __eq__(self, other):\n x_eq = self.x == o... | [
"0.8355385",
"0.77769613",
"0.77367425",
"0.77367425",
"0.77257544",
"0.76997656",
"0.76812845",
"0.7634397",
"0.762615",
"0.7546791",
"0.75340766",
"0.7519",
"0.741281",
"0.7358739",
"0.7357912",
"0.7351526",
"0.7351526",
"0.7307372",
"0.7258089",
"0.7238714",
"0.7215591",
... | 0.7246933 | 19 |
Returns self != y | def ne(self, y):
difference = self - y
difference = type(difference).stack([difference, -difference])
return difference._ltz().sum(0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other):\n return self.x != other.x or self.y != other.y",
"def __ne__(self, y):\n if isinstance(y, Annotation):\n return ((self._name != y._name) or\n (self._value != y._value) or\n (self._start != y._start) or\n (... | [
"0.7969515",
"0.79550064",
"0.7879952",
"0.75674444",
"0.7565495",
"0.7564373",
"0.7504307",
"0.7504307",
"0.7492106",
"0.7477315",
"0.7477315",
"0.7466425",
"0.74612075",
"0.7441007",
"0.74299884",
"0.74299884",
"0.74299884",
"0.74299884",
"0.74299884",
"0.74299884",
"0.7429... | 0.0 | -1 |
Computes the sign value of a tensor (0 is considered positive) | def sign(self):
return 1 - 2 * self._ltz() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sign(tensor):\n raise NotImplementedError",
"def nonzero_sign(\n x: type_alias.TensorLike,\n name: str = 'nonzero_sign') -> tf.Tensor:\n with tf.name_scope(name):\n x = tf.convert_to_tensor(value=x)\n\n one = tf.ones_like(x)\n return tf.where(tf.greater_equal(x, 0.0), one, -one)",
"d... | [
"0.8688876",
"0.8020817",
"0.73350376",
"0.72776",
"0.71012455",
"0.7001005",
"0.69773585",
"0.69760126",
"0.6954157",
"0.69462097",
"0.68638426",
"0.6846129",
"0.68455863",
"0.6840148",
"0.681499",
"0.6723042",
"0.6689427",
"0.64769393",
"0.6449525",
"0.6414176",
"0.6403147"... | 0.6835348 | 14 |
Compute a Rectified Linear function on the input tensor. | def relu(self):
return self * self.ge(0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rectified_linear_unit(x):\r\n # TODO\r\n return(max(0,x))",
"def linear(self, x):\n with tf.name_scope(\"presoftmax_linear\"):\n batch_size = tf.shape(x)[0]\n length = tf.shape(x)[1]\n\n x = tf.reshape(x, [-1, self.hidden_size])\n logits = tf.matmul(x,... | [
"0.5970563",
"0.588639",
"0.58455044",
"0.57528335",
"0.573016",
"0.5672835",
"0.5606219",
"0.5543441",
"0.5519835",
"0.54540956",
"0.53852",
"0.5361734",
"0.5357778",
"0.5347382",
"0.53225744",
"0.5321803",
"0.5249057",
"0.5242132",
"0.5223154",
"0.521976",
"0.52183104",
"... | 0.0 | -1 |
Filters queryset by the authenticated user | def get_queryset(self):
# distinct is needed to prevent multiple instances of product in resultset if multiple subscriptions are present
return self.model.objects.filter(subscription__owner=self.request.user).distinct() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_queryset(self, *args, **kwargs):\n qs = super().get_queryset(*args, **kwargs).filter(user=self.request.user)\n return qs",
"def get_queryset(self, request):\n qs = super().get_queryset(request)\n return qs.filter(user=request.user)",
"def get_queryset(self):\n return ... | [
"0.8423304",
"0.8391054",
"0.838733",
"0.8149967",
"0.7963382",
"0.7937927",
"0.7909407",
"0.79084146",
"0.7890036",
"0.774387",
"0.77354693",
"0.7706081",
"0.7612861",
"0.75021136",
"0.74818945",
"0.74818945",
"0.7450472",
"0.73689824",
"0.7309137",
"0.7304479",
"0.72586757"... | 0.0 | -1 |
Construct an OffPolicyRLAlgorithm class. | def __init__(
self,
env_spec,
policy,
qf,
replay_buffer,
use_target=False,
discount=0.99,
n_epoch_cycles=20,
max_path_length=None,
n_train_steps=50,
buffer_batch_size=64,
min_b... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self,lpr='__label__',lr=0.1,lru=100,dim=100,ws=5,epoch=5,minc=1,neg=5,ngram=1,\\\nloss='softmax',nbucket=0,minn=0,maxn=0,th=12,t=0.0001,verbosec=0,encoding='utf-8'):\n\t\t\tself.lr=lr\n\t\t\tself.lr_update_rate=lru\n\t\t\tself.dim=dim\n\t\t\tself.ws=ws\n\t\t\tself.epoch=epoch\n\t\t\tself.min_count=min... | [
"0.585678",
"0.57566017",
"0.5522687",
"0.53843707",
"0.53692234",
"0.52911294",
"0.5261529",
"0.52430874",
"0.52410984",
"0.5224469",
"0.52211624",
"0.5208351",
"0.5171106",
"0.5160015",
"0.51163393",
"0.51117873",
"0.5096557",
"0.50862664",
"0.50831383",
"0.5071074",
"0.507... | 0.49913856 | 32 |
Return data saved in the snapshot for this iteration. | def get_itr_snapshot(self, itr, samples_data):
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def data_snapshot(self) -> Dict[str, Any]:\n self.__logger.debug('Eva.data_snapshot called')\n return self.__http_client.data_snapshot()",
"def get_snapshot(self):\n data = {\n \"t\": self.sim.t,\n \"time\": self.time,\n \"vehicles\": self.sim.vehicles,\n ... | [
"0.75004965",
"0.7392499",
"0.69908816",
"0.69753265",
"0.6927988",
"0.6900747",
"0.6900747",
"0.6900747",
"0.68804044",
"0.6871595",
"0.6871595",
"0.6871595",
"0.6871595",
"0.6858777",
"0.68576086",
"0.68576086",
"0.68576086",
"0.6849394",
"0.6764887",
"0.6764887",
"0.676488... | 0.64540744 | 66 |
Test that the __repr__ returns the expected string. | def test_basic(self):
result = str(SaturatedVapourPressureTable())
msg = (
"<SaturatedVapourPressureTable: t_min: {}; t_max: {}; "
"t_increment: {}>".format(183.15, 338.25, 0.1)
)
self.assertEqual(result, msg) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_repr():\n c = Circle(4) \n assert c.__repr__() == 'Circle(4)'",
"def test_repr(self, r, rep):\n assert repr(r) == rep",
"def test_repr(self):\n self.assertEqual(repr(self.card), \"A of Spades\")",
"def test_repr(self):\n self.assertEqual(repr(self.deck), \"Deck of 52 cards... | [
"0.84488606",
"0.8367304",
"0.8118027",
"0.8027177",
"0.7913055",
"0.7902084",
"0.77371377",
"0.77266246",
"0.7684297",
"0.7648227",
"0.7643458",
"0.7641018",
"0.7561054",
"0.75464463",
"0.75418574",
"0.75004804",
"0.74947554",
"0.74875206",
"0.7480081",
"0.7434388",
"0.74266... | 0.0 | -1 |
Loads content from the .yaml file | def load_yaml(file: Text):
with open(file) as fp:
return yaml.load(fp, yaml.FullLoader) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_yaml(content):\n from yaml import load, FullLoader\n return load(content, Loader=FullLoader)",
"def load_yaml(file_path):\n with open(file_path) as fin:\n content = yaml.load(fin, Loader=yaml.FullLoader)\n return content",
"def load_yaml_file(self, path):\n with path.open('r'... | [
"0.75512975",
"0.7452672",
"0.73025095",
"0.7236565",
"0.723366",
"0.71937925",
"0.7175745",
"0.7158273",
"0.7081697",
"0.706416",
"0.7013241",
"0.69512755",
"0.6909463",
"0.69061136",
"0.69010407",
"0.6862992",
"0.6861315",
"0.6846718",
"0.68331915",
"0.6832633",
"0.6817455"... | 0.7285358 | 3 |
Verifies the password with the hashed version of the password | def verify_password(plain_password, hashed_password):
return Utility.pwd_context.verify(plain_password, hashed_password) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def verify_password(self, password):\n return check_password_hash(self.password_hash, password)",
"def verify_password(password, password_hash):\n\n password_entered = hash_password(password)\n return secrets.compare_digest(password_entered, password_hash)",
"def verify_password(password, hash):\n\n ... | [
"0.8170109",
"0.8021272",
"0.79729545",
"0.7930665",
"0.78215545",
"0.7796895",
"0.77442235",
"0.7738284",
"0.76607555",
"0.7628723",
"0.76221764",
"0.76201296",
"0.7602849",
"0.75910705",
"0.7545537",
"0.7542424",
"0.751934",
"0.751934",
"0.751934",
"0.751934",
"0.751934",
... | 0.7447905 | 28 |
Gaussian Error Linear Unit (GELU) is a new type of activation function that can estimate any of the existing activation values such as Sigmoid, ReLU, ELU, tanh while providing superior learning. | def gelu_activation(inp):
out = 1 + tf.tanh(np.sqrt(np.pi) * (inp + 0.044715 * tf.pow(inp, 3)))
out *= 0.5 * inp
return out | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gelu(input):\n return FunctionLib.apply('Gelu', input.device, [input], approximate=False)",
"def gelu(x):\n return f_gelu(x)",
"def convert_gelu(g, op, block):\n\n x = g.get_node(op.input(\"X\")[0])\n out = x * (\n _expr.const(0.5, dtype=\"float32\")\n + _op.erf(x * _expr.const(0.... | [
"0.75621027",
"0.7431084",
"0.73271376",
"0.72919774",
"0.7239625",
"0.71963245",
"0.71963245",
"0.71963245",
"0.71963245",
"0.71963245",
"0.71963245",
"0.71963245",
"0.71963245",
"0.71847886",
"0.7039584",
"0.700383",
"0.678312",
"0.674072",
"0.6735506",
"0.67328763",
"0.672... | 0.6913287 | 17 |
perform softmax, this is slightly different to the default softmax in tensorflow | def softmax_with_reduce_max(inp, axis=-1):
out = inp - tf.reduce_max(inp, axis=axis, keepdims=True)
ex = tf.exp(out)
sm = ex / tf.reduce_sum(ex, axis=axis, keepdims=True)
return sm | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def softmax(x):\n return np.exp(x) / np.sum(np.exp(x), axis=1, keepdims=True)",
"def softmax(x):\r\n sum_c = np.sum(np.exp(x), axis=1)\r\n sum_c = np.expand_dims(sum_c, axis=1)\r\n pred_x = np.divide(np.exp(x), sum_c)\r\n return pred_x",
"def softmax(x):\n return np.exp(x) / np.sum(np.exp(x), a... | [
"0.8079552",
"0.80553985",
"0.8020616",
"0.80151814",
"0.7982914",
"0.7977513",
"0.793704",
"0.79321504",
"0.7920388",
"0.79125535",
"0.79017717",
"0.79017717",
"0.78836805",
"0.7881727",
"0.7871345",
"0.7871345",
"0.7871345",
"0.7871345",
"0.7871345",
"0.7871345",
"0.7871345... | 0.7552131 | 61 |
2 reshape last dimension of input tensor from n > [n, inp.shape[1]/n] | def split_into_n_states(inp, n):
*start, m = shapes_list(inp)
out = tf.reshape(inp, start + [n, m // n])
return out | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def merge_n_states(inp):\n *start, m, n = shapes_list(inp)\n out = tf.reshape(inp, start + [m * n])\n return out",
"def merge_n_states(inp):\n *start, m, n = shapes_list(inp)\n out = tf.reshape(inp, start + [m * n])\n return out",
"def split_last_dimension(x, n):\r\n old_shape = x.get_shap... | [
"0.74011856",
"0.74011856",
"0.71523815",
"0.7100475",
"0.7057273",
"0.7048126",
"0.6899745",
"0.68313116",
"0.6741739",
"0.6631202",
"0.66274846",
"0.6624807",
"0.66114247",
"0.66114247",
"0.66114247",
"0.66111815",
"0.6583127",
"0.6561051",
"0.6561051",
"0.65291256",
"0.652... | 0.72413564 | 3 |
one stack or block with multihead attention and ff block | def block(inp, scope, past, config):
with tf.variable_scope(scope):
nx = inp.shape[-1].value
norm = normalise_tensor(inp, 'ln_1')
attn, present = attention(norm, 'attn', nx, past=past, config=config)
out = attn + inp
norm = normalise_tensor(out, 'ln_2')
mlp_out = mult... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attention_module_multi_head(roi_feat, position_embedding,\n nongt_dim, fc_dim, feat_dim,\n dim=(1024, 1024, 1024),\n group=16, index=1):\n dim_group = (dim[0] / group, dim[1] / group, dim[2] / group)\n nongt_roi_... | [
"0.6630847",
"0.6301414",
"0.6099973",
"0.5977877",
"0.59587246",
"0.58791524",
"0.5762132",
"0.5739169",
"0.5729132",
"0.5719356",
"0.5711061",
"0.56902385",
"0.5645238",
"0.5633464",
"0.5624794",
"0.5579361",
"0.5577352",
"0.55726933",
"0.5571347",
"0.5570089",
"0.5562015",... | 0.6139001 | 2 |
sets a new head of the linked list to be the given node | def set_head(self, new_head: Node):
pointer = self.head
self.head = new_head
self.head.next_node = pointer
return self | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_head(self, node, head):\n # Check indices.\n if head in [node] + self.children_recursive(node):\n msg = 'future head %i is a (possibly indirect) child of %i'\n raise ValueError(msg % (head, node))\n if node <= 0 or head < 0:\n raise IndexError()\n\n ... | [
"0.7799535",
"0.7725687",
"0.72488606",
"0.71570104",
"0.7054193",
"0.7029424",
"0.6931657",
"0.69270885",
"0.69005203",
"0.69005203",
"0.69005203",
"0.69005203",
"0.69005203",
"0.6899239",
"0.6879037",
"0.6832339",
"0.6794643",
"0.6790538",
"0.6777206",
"0.67569387",
"0.6737... | 0.8215506 | 0 |
The identity block is the block that has no conv layer at shortcut. Arguments | def _identity_block(self, input_tensor, kernel_size, filters, stage, block, dilation=1):
filters1, filters2, filters3 = filters
if backend.image_data_format() == 'channels_last':
bn_axis = 3
else:
bn_axis = 1
if block > 'z':
block = chr(ord(block) - o... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def identity_block(self, input_tensor, filters, activation, stage, block, start_with_batch_norm = True):\n\n # Set the naming convention\n conv_name_base = 'res' + str(stage) + block + '_branch'\n batch_norm_name_base = 'batch_norm' + str(stage) + block + '_branch'\n\n x_shortcut = inpu... | [
"0.7128075",
"0.7022187",
"0.69112873",
"0.6884249",
"0.6846568",
"0.6822699",
"0.6821866",
"0.6803595",
"0.6800122",
"0.6784813",
"0.6770751",
"0.67161965",
"0.6714853",
"0.67141736",
"0.6663679",
"0.66245866",
"0.66224706",
"0.66224706",
"0.66083175",
"0.65988076",
"0.65481... | 0.6850563 | 4 |
A block that has a conv layer at shortcut. Arguments | def _conv_block(self,
input_tensor,
kernel_size,
filters,
stage,
block,
strides=(2, 2),
dilation=1):
filters1, filters2, filters3 = filters
if backend.image_data_fo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def conv_block(self, output_channel, filter_, activate):\n return self.add_layer(conv_block, output_channel, filter_, activate)",
"def _convolution_block(self, X, filters, f, s, stage, block):\n\n\t\tconv_layer_name = 'res' + str(stage) + block + '_branch'\n\t\tbn_layer_name = 'bn' + str(stage) + block + ... | [
"0.72210574",
"0.6797653",
"0.67508686",
"0.673468",
"0.6702727",
"0.66709983",
"0.66706705",
"0.6638113",
"0.6602907",
"0.6602907",
"0.65983295",
"0.65591985",
"0.6556552",
"0.6553555",
"0.6531844",
"0.65101147",
"0.650745",
"0.6479069",
"0.6421294",
"0.64118993",
"0.6391051... | 0.6210063 | 42 |
call for ResNet50, ResNet101 or ResNet152. | def __call__(self, inputs, output_stages='c5', **kwargs):
if backend.image_data_format() == 'channels_last':
bn_axis = 3
else:
bn_axis = 1
dilation = self.dilation
x = layers.ZeroPadding2D(padding=(3, 3), name='conv1_pad')(inputs)
x = layers.Conv2D(64, (... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resnet():\n return models.resnet152(pretrained=True)",
"def resnet101(**kwargs):\n model = ResNet(Bottleneck, [3, 4, 23, 3], **kwargs)\n return model",
"def resnet50(**kwargs):\n model = ResNet(Bottleneck, [3, 4, 6, 3], **kwargs)\n return model",
"def resnet50(**kwargs):\n model = ResNe... | [
"0.73285013",
"0.7169848",
"0.71270514",
"0.71270514",
"0.7047204",
"0.6935936",
"0.6908594",
"0.6895498",
"0.6894643",
"0.6874172",
"0.68439186",
"0.68203944",
"0.6648259",
"0.66323125",
"0.66323125",
"0.66323125",
"0.66323125",
"0.6628184",
"0.6621562",
"0.66200966",
"0.658... | 0.0 | -1 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, ServerRateLimiting):
return False
return self.to_dict() == other.to_dict() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.80885184",
"0.80885184",
"0.805514",
"0.7983044",
"0.7966715",
"0.7966715",
"0.7966715",
"0.7966715",
"0.7966715",
"0.7966715",
"0.7966715",
"0.7966715",
"0.7966715",
"0.7966715",
"0.7966715",
"0.7966715",
"0.7966715",
"0.7966715",
"0.7966715",
"0.7966715",
"0.7966715",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
if not isinstance(other, ServerRateLimiting):
return True
return self.to_dict() != other.to_dict() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.845611",
"0.8391477",
"0.8144138",
"0.81410587",
"0.8132492",
"0.8093973",
"0.80920255",
"0.80920255",
"0.80920255",
"0.8085325",
"0.8085325",
"0.8076365",
"0.8076365",
"0.8065748",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
... | 0.0 | -1 |
Get form process mapper by id. | def get(mapper_id):
try:
return FormProcessMapperService.get_mapper(mapper_id), HTTPStatus.OK
except BusinessException as err:
return err.error, err.status_code | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_form_by_id(cls, form_process_mapper_id) -> FormProcessMapper:\n return cls.query.filter(FormProcessMapper.id == form_process_mapper_id).first()",
"def find_form_by_form_id(cls, form_id) -> FormProcessMapper:\n return cls.query.filter(\n and_(\n FormProcessMapper.f... | [
"0.81324744",
"0.74157876",
"0.6764169",
"0.57165146",
"0.5708167",
"0.5707011",
"0.56617624",
"0.5577138",
"0.55048394",
"0.54706615",
"0.54040277",
"0.5401317",
"0.53922546",
"0.5378217",
"0.53765863",
"0.5335342",
"0.5287182",
"0.5236855",
"0.51899993",
"0.51656705",
"0.51... | 0.72150403 | 2 |
This is the constructor for a Serializer, which will serialize a midi given the filename. It will generate buckets for the different phrases in it and generate a markov chain of the different phrases in them. | def __init__(self, filename, verbose=False):
self.filename = filename
self.markov_chain = MarkovChain()
self.initial_notes = []
self.bpm = None
self.song_length = None
self.phraseLength = None
self._parse(verbose=verbose) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, path: str) -> None:\n self.path = path\n\n self.path_token_idx_corpus = os.path.join(\n path, 'processed_corpus/token_idx_corpus.txt')\n self.path_token_terms_idxs = os.path.join(\n path, 'processed_corpus/token_terms_idxs.txt')\n self.path_tf_to... | [
"0.60947126",
"0.59937733",
"0.59885854",
"0.5966946",
"0.5927021",
"0.5846304",
"0.5830441",
"0.5800224",
"0.5792673",
"0.57770985",
"0.57458854",
"0.5722488",
"0.5695499",
"0.56746894",
"0.56612754",
"0.56236064",
"0.55936116",
"0.55885524",
"0.5581206",
"0.5574399",
"0.554... | 0.6294542 | 0 |
Asks user to specify a city, month, and day to analyze. | def get_filters():
print('Hello! Let\'s explore some US bikeshare data!')
# TO DO: get user input for city (chicago, new york city, washington). HINT: Use a while loop to handle invalid inputs
city = input ('can you please choose a city from chicago, new york city, washington ')
while city not in (C... | {
"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.6671997",
"0.6536215",
"0.646006",
"0.6373503",
"0.634963",
"0.6310927",
"0.62878346",
"0.6260315",
"0.6230766",
"0.6212286",
"0.62057954",
"0.61819345",
"0.6171279",
"0.617014",
"0.6159775",
"0.6159162",
"0.6154152",
"0.6145805",
"0.61331624",
"0.6105786",
"0.6103557",
... | 0.58829975 | 45 |
Loads data for the specified city and filters by month and day if applicable. | def load_data(city, month, day):
#load data file into a dataframe
df = pd.read_csv(CITY_DATA[city])
#convert start time to datatime
df['start time'] = pd.to_datetime(df['start time'])
#extract month and day of week
df['month'] = df['start time'].dt.month
df['day_of_week'] = df['start... | {
"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.80071104",
"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.788921... | 0.76218694 | 78 |
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()
# TO DO: display the most common month
months = ['january','february','march','april','may','june']
month = df ["month"].mode()[0]
print('most coommon month is: {months [month]}')... | {
"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.80219704",
"0.8020818",
"0.7913993",
"0.78247195",
"0.78199595",
"0.7812343",
"0.7763912",
"0.77388734",
"0.7734508",
"0.77323586",
"0.7684857",
"0.7667099",
"0.7649721",
"0.7642678",
"0.7637972",
"0.76349765",
"0.762374",
"0.76213294",
"0.7611406",
"0.7598117",
"0.7581664... | 0.7542168 | 25 |
Displays statistics on the most popular stations and trip. | def station_stats(df):
print('\nCalculating The Most Popular Stations and Trip...\n')
start_time = time.time()
# TO DO: display most commonly used start station
most_start_station = df['start station'].mode(0)
print('most coommon start station is: [most_start_station]')
# TO DO: display mo... | {
"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.7815675",
"0.7662213",
"0.7553417",
"0.74914914",
"0.74748665",
"0.7446617",
"0.7428588",
"0.74237514",
"0.74177027",
"0.7400495",
"0.7387161",
"0.7385634",
"0.73647535",
"0.735934",
"0.73566747",
"0.73548365",
"0.7351854",
"0.7351274",
"0.735057",
"0.73421645",
"0.7340198... | 0.731165 | 22 |
Displays statistics on the total and average trip duration. | def trip_duration_stats(df):
print('\nCalculating Trip Duration...\n')
start_time = time.time()
# TO DO: display total travel time
total_time = df['Trip Duration'].sum()
print('total trave time:',total_time,'seconds, or',total_time/3600,'hour')
# TO DO: display mean travel time
mean_t... | {
"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.8143788",
"0.8025597",
"0.7950089",
"0.7937902",
"0.79316837",
"0.7927231",
"0.7915687",
"0.7914976",
"0.79086065",
"0.79061425",
"0.79011726",
"0.7892046",
"0.7890013",
"0.7887204",
"0.7885618",
"0.7884607",
"0.78830457",
"0.7874646",
"0.78690827",
"0.78669995",
"0.786436... | 0.8004826 | 2 |
GetOutput(itkMeshSourceMD2 self) > itkMeshD2 GetOutput(itkMeshSourceMD2 self, unsigned int idx) > itkMeshD2 | def GetOutput(self, *args) -> "itkMeshD2 *":
return _itkMeshSourcePython.itkMeshSourceMD2_GetOutput(self, *args) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetOutput(self, *args) -> \"itkMeshD2 *\":\n return _itkVTKPolyDataReaderPython.itkVTKPolyDataReaderMD2_Superclass_GetOutput(self, *args)",
"def GetOutput(self, *args) -> \"itkMeshF2 *\":\n return _itkMeshSourcePython.itkMeshSourceMF2_GetOutput(self, *args)",
"def GetOutput(self, *args) -> \"... | [
"0.7293018",
"0.72541255",
"0.7158855",
"0.70990807",
"0.6907669",
"0.68959236",
"0.685535",
"0.68515456",
"0.6817617",
"0.6721697",
"0.66275924",
"0.6499262",
"0.64549446",
"0.6446446",
"0.6421495",
"0.6414436",
"0.6413012",
"0.64019996",
"0.63796735",
"0.6310147",
"0.626708... | 0.7765747 | 0 |
SetOutput(itkMeshSourceMD2 self, itkMeshD2 output) | def SetOutput(self, output: 'itkMeshD2') -> "void":
return _itkMeshSourcePython.itkMeshSourceMD2_SetOutput(self, output) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def SetOutput(self, output: 'itkMeshD2') -> \"void\":\n return _itkVTKPolyDataReaderPython.itkVTKPolyDataReaderMD2_Superclass_SetOutput(self, output)",
"def SetOutput(self, output: 'itkMeshF2') -> \"void\":\n return _itkMeshSourcePython.itkMeshSourceMF2_SetOutput(self, output)",
"def SetOutput(se... | [
"0.85408777",
"0.8436794",
"0.8156087",
"0.8082966",
"0.8075073",
"0.80591136",
"0.8037396",
"0.8017616",
"0.7772682",
"0.7687711",
"0.75678295",
"0.7477237",
"0.7435119",
"0.7377135",
"0.73440486",
"0.73304504",
"0.7190394",
"0.7167892",
"0.7145344",
"0.7143531",
"0.71410066... | 0.9047114 | 0 |
GraftOutput(itkMeshSourceMD2 self, itkDataObject output) | def GraftOutput(self, *args) -> "void":
return _itkMeshSourcePython.itkMeshSourceMD2_GraftOutput(self, *args) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GraftOutput(self, *args) -> \"void\":\n return _itkMeshSourcePython.itkMeshSourceMF2_GraftOutput(self, *args)",
"def GraftOutput(self, *args) -> \"void\":\n return _itkMeshSourcePython.itkMeshSourceMD3_GraftOutput(self, *args)",
"def GraftOutput(self, *args) -> \"void\":\n return _itkM... | [
"0.813137",
"0.8047807",
"0.79801047",
"0.7901101",
"0.7811657",
"0.77159315",
"0.7714399",
"0.75027156",
"0.7500757",
"0.7483299",
"0.7471552",
"0.74177057",
"0.7356151",
"0.73276156",
"0.7275761",
"0.72537553",
"0.725138",
"0.7121262",
"0.7118158",
"0.7051659",
"0.6980417",... | 0.85767597 | 0 |
GraftNthOutput(itkMeshSourceMD2 self, unsigned int idx, itkDataObject output) | def GraftNthOutput(self, idx: 'unsigned int', output: 'itkDataObject') -> "void":
return _itkMeshSourcePython.itkMeshSourceMD2_GraftNthOutput(self, idx, output) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GraftNthOutput(self, idx: 'unsigned int', output: 'itkDataObject') -> \"void\":\n return _itkMeshSourcePython.itkMeshSourceMUS2_GraftNthOutput(self, idx, output)",
"def GraftNthOutput(self, idx: 'unsigned int', output: 'itkDataObject') -> \"void\":\n return _itkMeshSourcePython.itkMeshSourceMF2... | [
"0.8895929",
"0.8845778",
"0.87717694",
"0.87607586",
"0.87497526",
"0.8741091",
"0.86390656",
"0.8607202",
"0.8592239",
"0.8582708",
"0.85725385",
"0.85713667",
"0.8549169",
"0.8525887",
"0.84945935",
"0.8478014",
"0.83609694",
"0.83421946",
"0.8329922",
"0.8310773",
"0.8295... | 0.9096824 | 0 |
cast(itkLightObject obj) > itkMeshSourceMD2 | def cast(obj: 'itkLightObject') -> "itkMeshSourceMD2 *":
return _itkMeshSourcePython.itkMeshSourceMD2_cast(obj) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def itkMeshSourceMD2_cast(obj: 'itkLightObject') -> \"itkMeshSourceMD2 *\":\n return _itkMeshSourcePython.itkMeshSourceMD2_cast(obj)",
"def itkMeshSourceMF2_cast(obj: 'itkLightObject') -> \"itkMeshSourceMF2 *\":\n return _itkMeshSourcePython.itkMeshSourceMF2_cast(obj)",
"def itkMeshSourceMD3_cast(obj: 'i... | [
"0.8996953",
"0.84341466",
"0.83416533",
"0.83237725",
"0.8267698",
"0.80988115",
"0.80505294",
"0.7952978",
"0.7903292",
"0.78473246",
"0.7822463",
"0.7807682",
"0.78034276",
"0.7794012",
"0.7734233",
"0.7728149",
"0.7705135",
"0.76785487",
"0.7651541",
"0.7634923",
"0.76227... | 0.8830349 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.