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 |
|---|---|---|---|---|---|---|
!TXT! Return tuples of filename, metadata of Presets files. | def preset_items(self):
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_preset_metadata(self, filename):\r\n\r\n raise NotImplementedError",
"def prepare_review_data():\n with open(REVIEW_FILE, 'r') as fread:\n reviews = fread.read()\n with open(LABEL_FILE, 'r') as fread:\n labels = fread.read()\n return reviews, labels",
"def getList(self):\n... | [
"0.693726",
"0.5923202",
"0.5914771",
"0.5845786",
"0.58441585",
"0.58344805",
"0.5825557",
"0.5815137",
"0.573884",
"0.5734459",
"0.57249343",
"0.5702774",
"0.5702683",
"0.5691204",
"0.56708646",
"0.56609833",
"0.56391597",
"0.5625635",
"0.56070983",
"0.5585533",
"0.55531454... | 0.0 | -1 |
Creates a matrix filled with zeros. | def zeros_matrix(rows, cols):
M = []
while len(M) < rows:
M.append([])
while len(M[-1]) < cols:
M[-1].append(0.0)
return M | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def zeroes(height, width):\n g = [[0.0 for _ in range(width)] for __ in range(height)]\n return Matrix(g)",
"def zeroMatrix(width, height):\n returnvalue = Matrix()\n for i in range(width):\n newrow = [0] * height\n returnvalue.addRow(*newrow)\n return returnvalue",
"def ze... | [
"0.83105844",
"0.82251585",
"0.8177624",
"0.814171",
"0.80738527",
"0.8053129",
"0.7960837",
"0.7792159",
"0.7705187",
"0.7678834",
"0.76101226",
"0.7580145",
"0.74690133",
"0.7464018",
"0.7462307",
"0.74617356",
"0.7240482",
"0.7231481",
"0.718796",
"0.71302176",
"0.70924646... | 0.7950135 | 7 |
Checks the equality of two matrices. | def check_matrix_equality(A, B, tol=None):
# Section 1: First ensure matrices have same dimensions
if len(A) != len(B) or len(A[0]) != len(B[0]):
return False
# Section 2: Check element by element equality
# use tolerance if given
for i in range(len(A)):
for j in range(le... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def IsEqual(*args, **kwargs):\n return _gdi_.GraphicsMatrix_IsEqual(*args, **kwargs)",
"def _are_matrix_elements_equal(element, another_element):\n difference = sympy.N(sympy.expand(element) - sympy.expand(another_element))\n\n try:\n return np.allclose(\n float(sympy.re(difference... | [
"0.7714554",
"0.740203",
"0.7398573",
"0.73428464",
"0.73169017",
"0.7311009",
"0.7276583",
"0.7269618",
"0.7231773",
"0.71865493",
"0.7137955",
"0.71372896",
"0.7098439",
"0.7072754",
"0.7070013",
"0.7067749",
"0.70479655",
"0.69766957",
"0.69462913",
"0.6940412",
"0.693163"... | 0.7387387 | 3 |
Perform a dot product of two vectors or matrices | def dot_product(A, B):
# Section 1: Ensure A and B dimensions are the same
rowsA = len(A); colsA = len(A[0])
rowsB = len(B); colsB = len(B[0])
if rowsA != rowsB or colsA != colsB:
raise ArithmeticError('Matrices are NOT the same size.')
# Section 2: Sum the products
total = 0
for i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dot(a, b):\n return np.vdot(a.arr,b.arr)",
"def vdot(a, b):\n return np.vdot(a.ravel(), b.ravel())",
"def dotproduct(vec1, vec2):\n return sum((a*b) for a, b in zip(vec1, vec2))",
"def dotproduct(vec1, vec2):\n import operator\n return sum(map(operator.mul, vec1, vec2))",
"def dotProduct... | [
"0.8477723",
"0.84724677",
"0.84555465",
"0.8350394",
"0.8327652",
"0.82895535",
"0.8278643",
"0.82655513",
"0.82386166",
"0.82098264",
"0.8188375",
"0.81818444",
"0.8119691",
"0.8118718",
"0.8095748",
"0.8047339",
"0.80167305",
"0.7980042",
"0.79692096",
"0.79012764",
"0.787... | 0.77130616 | 32 |
Find the unit vector for a vector | def unitize_vector(vector):
# Section 1: Ensure that a vector was given
if len(vector) > 1 and len(vector[0]) > 1:
raise ArithmeticError(
'Vector must be a row or column vector.')
# Section 2: Determine vector magnitude
rows = len(vector); cols = len(vector[0])
mag = 0
for r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cal_unit_vec(vector):\n return vector / np.linalg.norm(vector)",
"def unit_vector(vector):\n #print 'unit_vector'\n #print vector\n #print type(vector)\n #npvector = np.array(vector)\n return vector / np.linalg.norm(vector)",
"def _get_unit_vector(self, v):\n return v / np.linalg.n... | [
"0.8210302",
"0.8197049",
"0.8093858",
"0.8063628",
"0.8060808",
"0.8060808",
"0.8060808",
"0.80278605",
"0.80196196",
"0.80061513",
"0.80061513",
"0.80061513",
"0.80061513",
"0.80061513",
"0.80061513",
"0.80061513",
"0.80061513",
"0.80061513",
"0.80061513",
"0.80061513",
"0.... | 0.6489918 | 49 |
Construct a MultiscaleSpectralLoss instance. | def __init__(self, scales=(2048, 1024, 512, 256, 128, 64)):
super(MultiscaleSpectralLoss, self).__init__()
self.scales = scales
self.stfts = nn.ModuleList([
Spectrogram(
n_fft=scale,
hop_length=(scale//4))
for scale in scales
])
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n super(SpectralConvergenceLoss, self).__init__()",
"def make_loss(self, logit=None, labels=None):\r\n return nn.functional.mse_loss(logit, labels, reduction='mean') # The MSE Loss\r",
"def __init__(self, scales, downscale, weights=None, train_loss = 'smoothL1', test_... | [
"0.58293366",
"0.5678484",
"0.56208384",
"0.55866665",
"0.55633307",
"0.554813",
"0.5506747",
"0.54174733",
"0.5366562",
"0.5366562",
"0.52967584",
"0.52646774",
"0.52602464",
"0.52426994",
"0.5188218",
"0.51837677",
"0.5170337",
"0.51639026",
"0.5162801",
"0.5136168",
"0.513... | 0.62690294 | 0 |
Test unloading the config entry. | async def test_unload_entry(
hass: HomeAssistant,
mqtt_mock_entry: MqttMockHAClientGenerator,
) -> None:
domain = select.DOMAIN
config = DEFAULT_CONFIG
await help_test_unload_config_entry_with_platform(
hass, mqtt_mock_entry, domain, config
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def test_unload_config_entry(\n hass: HomeAssistant, aioclient_mock: AiohttpClientMocker\n) -> None:\n entry = await init_integration(hass, aioclient_mock)\n assert hass.data[DOMAIN]\n\n await hass.config_entries.async_unload(entry.entry_id)\n await hass.async_block_till_done()\n assert not... | [
"0.7604923",
"0.7319425",
"0.7198364",
"0.71626264",
"0.71538424",
"0.71115565",
"0.7025292",
"0.68330365",
"0.6810021",
"0.6803139",
"0.67975754",
"0.6777911",
"0.676454",
"0.6698933",
"0.669777",
"0.6684034",
"0.66482663",
"0.6645694",
"0.6643434",
"0.6614721",
"0.66143346"... | 0.7071926 | 6 |
Make a two pixel thick E centered on the image. | def make_big_e(self):
l = self.l_i
self.img[l/2-1:l/2+1, l/2-5:l/2+5] = 1
self.img[l/2-5:l/2-3, l/2-5:l/2+5] = 1
self.img[l/2+3:l/2+5, l/2-5:l/2+5] = 1
self.img[l/2-5:l/2+5, l/2-5:l/2-3] = 1
self.img_name = 'bigE' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_e(self):\n self.img[1, 2:-1] = 1\n self.img[self.l_i / 2, 2:-1] = 1\n self.img[-2, 2:-1] = 1\n self.img[1:-1, 2] = 1\n self.img_name = 'E'",
"def center(self):\n return (self.upper_right + self.lower_left) * 0.5",
"def center(self):\n return self._lower... | [
"0.6205571",
"0.6005698",
"0.5979291",
"0.5890722",
"0.58373564",
"0.57617915",
"0.5691448",
"0.568293",
"0.568293",
"0.56337875",
"0.560571",
"0.55771095",
"0.55635655",
"0.55396354",
"0.5528683",
"0.54597014",
"0.5456997",
"0.5446501",
"0.5438212",
"0.5433568",
"0.54240096"... | 0.56884634 | 7 |
Plots the IR image of a subject. | def ir(subject):
return image(data.get_ir(subject)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_obs(self):\n if self.obs_im is None and self.obs_ax is None:\n fig, self.obs_ax = plt.subplots()\n self.obs_ax.set_title('Observation')\n self.obs_ax.set_xticks(())\n self.obs_ax.set_yticks(())\n self.obs_im = self.obs_ax.imshow(self.obs, cmap=... | [
"0.637681",
"0.62718505",
"0.6264983",
"0.6259479",
"0.6129825",
"0.6127133",
"0.6058327",
"0.6009594",
"0.59844464",
"0.5932868",
"0.58988154",
"0.5898064",
"0.58920294",
"0.58896095",
"0.58350086",
"0.5829529",
"0.5777113",
"0.5769449",
"0.5746391",
"0.5731819",
"0.5704164"... | 0.68176895 | 0 |
Plots the radio image of a subject. | def radio(subject):
return image(data.get_radio(subject)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot(self):\n\t\tself.plotOfSpect().plot()",
"def plot(self):\n\t\tself.plotOfSpect()",
"def plot_obs(self):\n if self.obs_im is None and self.obs_ax is None:\n fig, self.obs_ax = plt.subplots()\n self.obs_ax.set_title('Observation')\n self.obs_ax.set_xticks(())\n ... | [
"0.60876",
"0.6054036",
"0.57861894",
"0.5768034",
"0.5684072",
"0.5639077",
"0.5528013",
"0.5508448",
"0.54798543",
"0.5479557",
"0.54772764",
"0.5472437",
"0.54466945",
"0.54305136",
"0.54268515",
"0.53493",
"0.5348296",
"0.53450686",
"0.53313863",
"0.5328863",
"0.53185254"... | 0.73903203 | 0 |
Checks whether a string is a possibly valid stock ticker symbol. | def is_ticker_symbol(value):
return re.match(r'^[A-Z0-9/]{1,7}(\s+[ABC])?(\s+[A-Z]{1,3})?$', value) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _is_symbol(s):\n\tif (type(s) == types.StringType and s >= 'A' and s[0] <= 'Z'\n\t\t\tand (len(s) < 2 or s[1] < '0' or s[1] > '9')):\n\t\treturn 1\n\treturn 0",
"def is_symbol(p):\n return len(p) == 1 and p.isalpha()",
"def isValid(text):\n return bool(re.search(r'\\bstocks\\b', text, re.IGNORECASE))... | [
"0.78896636",
"0.7215032",
"0.70640963",
"0.6931195",
"0.6728775",
"0.66810614",
"0.6618225",
"0.6549594",
"0.6435831",
"0.6417622",
"0.63457596",
"0.62866443",
"0.6267425",
"0.62303394",
"0.62107503",
"0.615779",
"0.61523664",
"0.6094993",
"0.6078192",
"0.60514677",
"0.60500... | 0.7523547 | 1 |
Checks whether a string is a valid CUSIP identifier. | def is_cusip(value):
return re.match(r'^([\w\d]{6})([\w\d]{2})([\w\d]{1})$', value) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_identifier(identifier: str) -> bool:\n if identifier[:2] == 'NR':\n return True\n\n if len(identifier) < 9:\n return False\n\n try:\n d = int(identifier[-7:])\n if d == 0:\n return False\n except ValueError:\n ... | [
"0.7227955",
"0.7152577",
"0.6996781",
"0.6726937",
"0.6718862",
"0.66375023",
"0.64392036",
"0.6431555",
"0.6376493",
"0.6321352",
"0.63011646",
"0.62758017",
"0.62744635",
"0.6234123",
"0.6233153",
"0.6213799",
"0.6138585",
"0.61351186",
"0.6128853",
"0.6101495",
"0.6075032... | 0.6582344 | 6 |
Checks whether a string is an ISIN identifier. | def is_isin(value):
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_identifier(cls, s):\n\n if isinstance(s, Selector):\n return len(s) == 1\n\n if np.iterable(s):\n\n # Try to expand string:\n if isinstance(s, basestring):\n try:\n s_exp = cls.expand(s)\n except:\n ... | [
"0.64061177",
"0.6389671",
"0.62742746",
"0.62229645",
"0.6090249",
"0.60567725",
"0.6030903",
"0.5980523",
"0.5914132",
"0.58190334",
"0.58088684",
"0.57880276",
"0.5767305",
"0.5737967",
"0.57233167",
"0.56836736",
"0.56448156",
"0.5620792",
"0.56000733",
"0.5578737",
"0.55... | 0.6372353 | 2 |
IN PLACE removal of keyvalues from bad values list | def replace_dict_value(d, bad_values):
for key, value in d.copy().items():
for n in bad_values:
if n == value:
del d[key] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_from_values(values, to_remove):\n to_keep = []\n for x in to_remove:\n if '!' in x:\n to_keep.append(x.replace(\"!\", \"\"))\n\n if len(to_keep) == 0:\n for x in to_remove:\n del values[x]\n else:\n tmp_values = v... | [
"0.69766015",
"0.6767876",
"0.674696",
"0.6674704",
"0.6361227",
"0.6335204",
"0.63038313",
"0.6275231",
"0.62743896",
"0.6264737",
"0.62486774",
"0.62433916",
"0.6238611",
"0.6233265",
"0.61752516",
"0.61717343",
"0.61646086",
"0.614754",
"0.614754",
"0.61379445",
"0.6135186... | 0.6890187 | 1 |
Gets the ``submission`` instance at the particular ``trigger`` in the process. Allow some flexibility in the function signature here, to allow retrieval via the ``entry_point`` in the future. | def get_submission(learner, trigger, entry_point=None):
submission = None
subs = trigger.submission_set.filter(is_valid=True).\
order_by('-datetime_submitted')
if is_group_submission(learner, entry_point):
# At this point it means the user is part of a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getSubmission(permalink, reddit):\r\n\r\n submissionUrl = REDDIT_URL_PREFIX + permalink\r\n submission = reddit.submission(url=submissionUrl)\r\n return submission",
"def getSubmission(self, ind):\r\n if ind >= 0 and ind < len(self.submissions):\r\n return self.submissions[ind]\r\n... | [
"0.6466969",
"0.6425069",
"0.6153192",
"0.5954331",
"0.5900884",
"0.55746895",
"0.5520922",
"0.5398328",
"0.5272872",
"0.5242507",
"0.5226199",
"0.5210771",
"0.5202184",
"0.5192073",
"0.5188932",
"0.5110893",
"0.50977373",
"0.5068678",
"0.5045009",
"0.50332797",
"0.500906",
... | 0.76395285 | 0 |
Find the pane manager for this dock pane. Returns | def _FindPaneManager(self):
event = aui.AuiManagerEvent(aui.wxEVT_AUI_FIND_MANAGER)
self.ProcessEvent(event)
return event.GetManager() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetManager(window):\r\n \r\n if not isinstance(wx.GetTopLevelParent(window), AuiFloatingFrame):\r\n if isinstance(window, auibar.AuiToolBar):\r\n return window.GetAuiManager()\r\n \r\n evt = AuiManagerEvent(wxEVT_AUI_FIND_MANAGER)\r\n evt.SetManager(None)\r\n evt.ResumePropa... | [
"0.6655293",
"0.6584411",
"0.6507682",
"0.6477738",
"0.6453988",
"0.6444569",
"0.6294568",
"0.62182343",
"0.61861306",
"0.61673534",
"0.6099288",
"0.6037872",
"0.6018933",
"0.6009684",
"0.59996665",
"0.59830785",
"0.5909946",
"0.5821921",
"0.57773924",
"0.5744784",
"0.5738358... | 0.8224824 | 0 |
A private method which will run the given closure if there is a valid pane info object for this dock pane. | def _PaneInfoOperation(self, closure):
manager = self._FindPaneManager()
if manager is not None:
pane = manager.GetPane(self)
if pane.IsOk():
closure(pane)
manager.Update() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def PaneHitTest(self, panes, pt):\r\n\r\n for paneInfo in panes:\r\n if paneInfo.IsDocked() and paneInfo.IsShown() and paneInfo.rect.Contains(pt):\r\n return paneInfo\r\n\r\n return NonePaneInfo",
"def ValidateNotebookDocking(self, valid):\r\n \r\n return 0",... | [
"0.5657871",
"0.5132612",
"0.5107232",
"0.5096747",
"0.5079873",
"0.5059674",
"0.5040905",
"0.49814218",
"0.49722317",
"0.49413636",
"0.48404264",
"0.48210448",
"0.48043796",
"0.47585303",
"0.47116345",
"0.47031805",
"0.4696436",
"0.4685807",
"0.4678158",
"0.46629152",
"0.464... | 0.7355897 | 0 |
Set the dock widget to be managed by the pane. Any old dock widget will be removed, but not destroyed. | def SetDockWidget(self, widget):
old_widget = self._dock_widget
if old_widget:
old_widget.Hide()
self._dock_widget = widget
self.GetSizer().Add(widget)
self.UpdateSizing() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_dock_area(self, dock_area):\n self.widget.SetDockArea(_DOCK_AREA_MAP[dock_area])",
"def SetDockArea(self, dock_area):\n if self._dock_area != dock_area:\n self._dock_area = dock_area\n def closure(pane):\n pane.Direction(dock_area)\n self._Pan... | [
"0.7255009",
"0.705866",
"0.6679586",
"0.6516265",
"0.6435674",
"0.6408096",
"0.63685894",
"0.6184282",
"0.61376697",
"0.6108132",
"0.6080258",
"0.60613954",
"0.6037219",
"0.5971556",
"0.59677136",
"0.595693",
"0.595267",
"0.5908903",
"0.5872027",
"0.5839911",
"0.5825193",
... | 0.7751048 | 0 |
Get whether or not the dock pane is open. Returns | def IsOpen(self):
return self._is_open | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_open(self):\n return self.name == \"open\"",
"def is_open(self):\n return (not self.interface.is_open)",
"def _isopen(self):\n return self.dp.state()==PyTango.DevState.OPEN",
"def IsDockable(self):\r\n \r\n return self.IsTopDockable() or self.IsBottomDockable() or se... | [
"0.6983675",
"0.69524133",
"0.6938929",
"0.69123167",
"0.69085985",
"0.6845953",
"0.6833596",
"0.68226427",
"0.6715917",
"0.6643322",
"0.66325974",
"0.6570659",
"0.6569526",
"0.6569526",
"0.65684795",
"0.6561622",
"0.6547256",
"0.65129095",
"0.6457779",
"0.64156824",
"0.63894... | 0.7104729 | 0 |
Open the dock pane in the main window. If the pane is already open, this method is a noop. | def Open(self):
self._is_open = True
def closure(pane):
if not pane.IsShown():
pane.Show(True)
self._PaneInfoOperation(closure) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def onInvoke():\n if dock.isVisible():\n dock.toggleViewAction().trigger()\n else:\n dock.setFloating(True)\n pos = QtGui.QCursor.pos()\n dock.move(pos.x() - dock.size().width() / 2,\n pos.y() - dock.size().height() / 2)\n dock.setVisible(True)",
"def ope... | [
"0.6752355",
"0.6393653",
"0.635054",
"0.62943107",
"0.6252884",
"0.61238146",
"0.5862237",
"0.5844267",
"0.5818779",
"0.5736199",
"0.5711433",
"0.5710257",
"0.56829995",
"0.5643768",
"0.562504",
"0.5609804",
"0.5606231",
"0.5602444",
"0.55807114",
"0.5571818",
"0.5567417",
... | 0.7227996 | 0 |
Get the title for the dock pane. Returns | def GetTitle(self):
return self._title | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_window_title(self):\n\n return self.window_title",
"def title(self):\n return self._frame._title",
"def get_window_title(self): # real signature unknown; restored from __doc__\n return \"\"",
"def title(self):\n with switch_window(self._browser, self.name):\n re... | [
"0.7514823",
"0.7311126",
"0.7304894",
"0.7299354",
"0.72942185",
"0.71827435",
"0.7170205",
"0.7089124",
"0.70619303",
"0.7024847",
"0.69839376",
"0.67431253",
"0.67431253",
"0.67431253",
"0.6740328",
"0.67234224",
"0.6717274",
"0.66952205",
"0.66807824",
"0.66652113",
"0.66... | 0.66238946 | 24 |
Set the title bar orientation for the dock pane. | def SetTitleBarOrientation(self, orientation):
if self._title_bar_orientation != orientation:
self._title_bar_orientation = orientation
def closure(pane):
visible = self._title_bar_visible
left = orientation == wx.VERTICAL
pane.CaptionVisib... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_title_bar_orientation(self, orientation):\n self.widget.SetTitleBarOrientation(_ORIENTATION_MAP[orientation])",
"def SetDockArea(self, dock_area):\n if self._dock_area != dock_area:\n self._dock_area = dock_area\n def closure(pane):\n pane.Direction(dock... | [
"0.7791384",
"0.6170316",
"0.58988345",
"0.58503455",
"0.58292603",
"0.5706907",
"0.5570912",
"0.5531702",
"0.55306387",
"0.55292004",
"0.5517117",
"0.55099344",
"0.5429316",
"0.5323064",
"0.5318741",
"0.5252104",
"0.52493757",
"0.52383184",
"0.5206824",
"0.5149807",
"0.51413... | 0.77474463 | 1 |
Get the movable state of the pane. Returns | def GetMovable(self):
return self._movable | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def IsMovable(self):\r\n \r\n return self.HasFlag(self.optionMovable)",
"def Movable(self, b=True):\r\n \r\n return self.SetFlag(self.optionMovable, b)",
"def move_state(self):\n return self._move_state",
"def getMoveStatus(self):\n return self.hasMoved",
"def is_m... | [
"0.73814183",
"0.6871679",
"0.6766147",
"0.65151626",
"0.6477025",
"0.6297161",
"0.62134385",
"0.6198357",
"0.6186342",
"0.605576",
"0.60148036",
"0.5912496",
"0.5882996",
"0.5747405",
"0.5695605",
"0.55856556",
"0.556169",
"0.55449396",
"0.55219716",
"0.55048335",
"0.5498659... | 0.73327494 | 1 |
Get the floatable state of the pane. Returns | def GetFloatable(self):
return self._floatable | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetFloating(self):\n return self._floating",
"def Float(self):\r\n\r\n if self.IsNotebookPage():\r\n self.notebook_id = -1\r\n self.dock_direction = AUI_DOCK_NONE\r\n\r\n return self.SetFlag(self.optionFloating, True)",
"def IsFloatable(self):\r\n\r\n retur... | [
"0.66941845",
"0.6677167",
"0.65259075",
"0.64723754",
"0.6325488",
"0.60977393",
"0.5975314",
"0.58441347",
"0.57102877",
"0.56608474",
"0.56487536",
"0.5644348",
"0.56134635",
"0.56081825",
"0.559499",
"0.5532942",
"0.55052155",
"0.5503425",
"0.55016",
"0.5481973",
"0.54757... | 0.710401 | 0 |
Get the floating state of the pane. Returns | def GetFloating(self):
return self._floating | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Float(self):\r\n\r\n if self.IsNotebookPage():\r\n self.notebook_id = -1\r\n self.dock_direction = AUI_DOCK_NONE\r\n\r\n return self.SetFlag(self.optionFloating, True)",
"def IsFloating(self):\r\n\r\n return self.HasFlag(self.optionFloating)",
"def SetFloating(sel... | [
"0.7078875",
"0.68520176",
"0.6676681",
"0.62979376",
"0.6101623",
"0.59974843",
"0.5874167",
"0.5835459",
"0.58042806",
"0.5714184",
"0.5659281",
"0.56355155",
"0.56107",
"0.5609352",
"0.538732",
"0.53418714",
"0.5314349",
"0.52319914",
"0.5193341",
"0.51932466",
"0.51729184... | 0.72386533 | 0 |
Get the current dock area of the pane. Returns | def GetDockArea(self):
return self._dock_area | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetDock(self):\n return self.dock",
"def default_dock_widget_area(self):\n return Qt.BottomDockWidgetArea",
"def GetAllowedDockAreas(self):\n return self._allowed_dock_areas",
"def get_area(self):\n return self._area",
"def dock_direction_get(self):\r\n \r\n if... | [
"0.762887",
"0.6992044",
"0.69423616",
"0.6757393",
"0.66858554",
"0.6628298",
"0.66141295",
"0.6512895",
"0.65115595",
"0.6427808",
"0.6295147",
"0.6290179",
"0.62432027",
"0.6201897",
"0.6196833",
"0.6196833",
"0.6108198",
"0.59955895",
"0.5974354",
"0.59420717",
"0.5912098... | 0.8735494 | 0 |
Set the dock area for the pane. | def SetDockArea(self, dock_area):
if self._dock_area != dock_area:
self._dock_area = dock_area
def closure(pane):
pane.Direction(dock_area)
self._PaneInfoOperation(closure) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_dock_area(self, dock_area):\n self.widget.SetDockArea(_DOCK_AREA_MAP[dock_area])",
"def createDockArea(self):\n self.centralDock = CentralDockArea(self.globalSession)\n self.setCentralWidget(self.centralDock)",
"def Center(self):\r\n\r\n self.dock_direction = AUI_DOCK_CENTER... | [
"0.8479615",
"0.7309666",
"0.7006313",
"0.698692",
"0.6964776",
"0.6743218",
"0.6743218",
"0.67106277",
"0.6687882",
"0.6619457",
"0.6612757",
"0.6546633",
"0.64087695",
"0.6371462",
"0.62851703",
"0.6146433",
"0.6118997",
"0.6078263",
"0.59949034",
"0.59886897",
"0.5956006",... | 0.8348828 | 1 |
Set the title bar orientation of the underyling widget. | def set_title_bar_orientation(self, orientation):
self.widget.SetTitleBarOrientation(_ORIENTATION_MAP[orientation]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def SetTitleBarOrientation(self, orientation):\n if self._title_bar_orientation != orientation:\n self._title_bar_orientation = orientation\n def closure(pane):\n visible = self._title_bar_visible\n left = orientation == wx.VERTICAL\n pane.C... | [
"0.7591745",
"0.62480235",
"0.5741273",
"0.56907344",
"0.5638287",
"0.5472007",
"0.53996396",
"0.5370837",
"0.5336395",
"0.5314121",
"0.5260498",
"0.5194256",
"0.5170995",
"0.51473856",
"0.51277953",
"0.51234436",
"0.51201206",
"0.51191103",
"0.508708",
"0.50702876",
"0.50368... | 0.7616213 | 0 |
Set the dock area on the underyling widget. | def set_dock_area(self, dock_area):
self.widget.SetDockArea(_DOCK_AREA_MAP[dock_area]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def SetDockArea(self, dock_area):\n if self._dock_area != dock_area:\n self._dock_area = dock_area\n def closure(pane):\n pane.Direction(dock_area)\n self._PaneInfoOperation(closure)",
"def createDockArea(self):\n self.centralDock = CentralDockArea(se... | [
"0.7441139",
"0.7092396",
"0.705354",
"0.70327806",
"0.7008638",
"0.70001256",
"0.69229954",
"0.6918497",
"0.6918497",
"0.6787247",
"0.6787247",
"0.6783655",
"0.66908836",
"0.63934094",
"0.63934094",
"0.6358976",
"0.626946",
"0.6262434",
"0.62333214",
"0.6210916",
"0.6197859"... | 0.79480535 | 0 |
Add a QComboBox that setupUi would crash on | def addComboBoxToFormLayout(self, row, name, menu_items, enabled=True):
if hasattr(self, name):
raise ValueError("can't add combo box named %r: name exists" % name)
setattr(self, name, gui.QComboBox())
self.formLayout.setWidget(row, 1, getattr(self, name))
getattr(self, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_combo_box(self, name, value=None, options=None, label=None, add_indicator=None):\n widget=QtWidgets.QComboBox(self)\n widget.setObjectName(_fromUtf8(self.name+\"_\"+name))\n if options:\n widget.addItems(options)\n if value is not None:\n widget.set... | [
"0.7517522",
"0.7271121",
"0.706342",
"0.66867125",
"0.65471137",
"0.64341116",
"0.6300311",
"0.62977344",
"0.6286095",
"0.62541264",
"0.62303025",
"0.61623096",
"0.6103901",
"0.60588175",
"0.6057701",
"0.60550004",
"0.60543835",
"0.6037464",
"0.593779",
"0.5924008",
"0.59157... | 0.65526927 | 4 |
Test that an instance of HospitalResident is created correctly. | def test_init(resident_names, hospital_names, capacities, seed):
residents, hospitals, match = _make_match(
resident_names, hospital_names, capacities, seed
)
assert match.suitors == residents
assert match.reviewers == hospitals
assert all([suitor.matching is None for suitor in match.suito... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_init(players, clean):\n\n residents, hospitals = players\n\n game = HospitalResident(residents, hospitals, clean)\n\n for resident, game_resident in zip(residents, game.residents):\n assert resident.name == game_resident.name\n assert resident._pref_names == game_resident._pref_name... | [
"0.6768469",
"0.65924954",
"0.65022165",
"0.64469266",
"0.6421933",
"0.639555",
"0.636657",
"0.63443536",
"0.6332781",
"0.63260925",
"0.62565887",
"0.6232469",
"0.62238586",
"0.6222996",
"0.6221828",
"0.62073743",
"0.61879903",
"0.61489904",
"0.6137705",
"0.6112875",
"0.61028... | 0.5865152 | 52 |
Test that each suitor's preference list is a subset of the available reviewer names, and check that an Exception is raised if not. | def test_inputs_suitor_prefs(resident_names, hospital_names, capacities, seed):
_, _, match = _make_match(resident_names, hospital_names, capacities, seed)
assert match._check_suitor_prefs()
match.suitors[0].pref_names = [1, 2, 3]
with pytest.raises(Exception):
match._check_suitor_prefs() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _check_hospital_prefs(self):\n\n errors = []\n for hospital in self.hospitals:\n residents_that_ranked = [\n res for res in self.residents if hospital in res.prefs\n ]\n if set(hospital.prefs) != set(residents_that_ranked):\n errors.a... | [
"0.6764958",
"0.66023237",
"0.64850444",
"0.63506216",
"0.6300171",
"0.6155866",
"0.6098008",
"0.6083776",
"0.6046839",
"0.5963478",
"0.59560454",
"0.5882122",
"0.58743244",
"0.58740515",
"0.587275",
"0.58153176",
"0.5726357",
"0.57196206",
"0.5704368",
"0.56553525",
"0.56467... | 0.6158292 | 5 |
Test that each reviewer has ranked all and only those suitors that have ranked it, and check that an Exception is raised if not. | def test_inputs_reviewer_prefs(
resident_names, hospital_names, capacities, seed
):
_, _, match = _make_match(resident_names, hospital_names, capacities, seed)
assert match._check_reviewer_prefs()
match.reviewers[0].pref_names.pop()
with pytest.raises(Exception):
match._check_reviewer_pr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _check_ties(self,rank):\n for k in self._run:\n curr_dict = defaultdict(list)\n qid = self._run[k][0].get_qid()\n for t in self._run[k]:\n # print t.get_str()\n curr_dict[t.get_score()].append(t)\n curr_dict = OrderedDict(sorted(c... | [
"0.6469241",
"0.62758523",
"0.6181548",
"0.61339307",
"0.61067796",
"0.6058243",
"0.59401476",
"0.59044033",
"0.5869293",
"0.5826729",
"0.5811665",
"0.5782488",
"0.5748695",
"0.5733024",
"0.56846386",
"0.56811875",
"0.5670597",
"0.56693673",
"0.563712",
"0.55853856",
"0.55815... | 0.50680566 | 82 |
Get the value of the indexth node in the linked list. If the index is invalid, return 1. | def get(self, index: int) -> int:
if index + 1 >self.cnt:
return -1
tmp = self.dummy
for i in range(index+1):
tmp = tmp.next
return tmp.val | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(self, index: int) -> int:\n node = self.get_node(index)\n if node:\n return node.val\n else:\n return -1",
"def get(self, index: int) -> int:\n cnt = 0\n cur = self.head \n while cur != None:\n if(cnt == index):\n r... | [
"0.8309656",
"0.82243836",
"0.8102444",
"0.7983202",
"0.79731077",
"0.7967487",
"0.79533577",
"0.7950739",
"0.792881",
"0.7906973",
"0.7800858",
"0.7736764",
"0.7731777",
"0.75855",
"0.75083053",
"0.747588",
"0.7456431",
"0.73877585",
"0.73877585",
"0.7385753",
"0.73379",
"... | 0.76522416 | 13 |
Add a node of value val before the first element of the linked list. After the insertion, the new node will be the first node of the linked list. | def addAtHead(self, val: int) -> None:
self.addAtIndex(0, val) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def insert(self, val):\n new_node = Node(val)\n new_node.next = self.head\n self.head = new_node",
"def addAtHead(self, val):\n node = ListNode(val)\n if self.head == None:\n self.head = node\n else:\n node.next = self.head\n self.head = ... | [
"0.78888327",
"0.78128237",
"0.77156687",
"0.76672965",
"0.7632993",
"0.75963074",
"0.7586912",
"0.75706255",
"0.7502218",
"0.74938524",
"0.7477616",
"0.74631184",
"0.7429465",
"0.7405691",
"0.73827714",
"0.73492926",
"0.73492926",
"0.728465",
"0.72477174",
"0.72355413",
"0.7... | 0.65709186 | 72 |
Append a node of value val to the last element of the linked list. | def addAtTail(self, val: int) -> None:
tmp = ListNode(val)
tmp1 = self.dummy
while tmp1 and tmp1.next:
tmp1 = tmp1.next
tmp1.next = tmp
tmp.pre = tmp1
self.cnt += 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def append(self, val):\n inserted_node = DblNode(val, previous_node=self.tail)\n self.tail.next_node = inserted_node\n self.tail = inserted_node",
"def addAtTail(self, val):\n if self.head is None:\n self.addAtHead(val)\n else:\n new_node = Node(val)\n ... | [
"0.80130863",
"0.79794717",
"0.78928936",
"0.7879162",
"0.7879162",
"0.7856019",
"0.7782996",
"0.7744707",
"0.77368987",
"0.7721728",
"0.76904315",
"0.7632201",
"0.76267153",
"0.7550089",
"0.7530205",
"0.7521708",
"0.74483246",
"0.7416057",
"0.73196465",
"0.72394246",
"0.7223... | 0.7097635 | 27 |
Add a node of value val before the indexth node in the linked list. If index equals to the length of linked list, the node will be appended to the end of linked list. If index is greater than the length, the node will not be inserted. | def addAtIndex(self, index: int, val: int) -> None:
# 按题目要求,如果索引大于链表长度,不添加
if index > self.cnt:
return
if index == self.cnt:
# 插到末尾
self.addAtTail(val)
else:
tmp = self.dummy
if index < 0:
index = 0
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def addAtIndex(self, index, val):\n if index < 0:\n new_node = ListNode(val)\n new_node.next = self.head\n self.head = new_node\n\n if index <= self.length:\n prev = None\n curr = self.head\n for i in range(1, index + 1):\n ... | [
"0.8006325",
"0.7905185",
"0.78425467",
"0.7801852",
"0.7757298",
"0.77432555",
"0.7742992",
"0.77307177",
"0.7709473",
"0.7613535",
"0.7613535",
"0.75972575",
"0.7502922",
"0.728164",
"0.7210373",
"0.7155025",
"0.70898044",
"0.702463",
"0.70231825",
"0.7017992",
"0.69305086"... | 0.7618637 | 9 |
Dataset which can be used for training spectrogram generators and endtoend TTS models. It loads main data types (audio, text) and specified supplementary data types (log mel, durations, align prior matrix, pitch, energy, speaker id). Some of supplementary data types will be computed on the fly and saved in the sup_data... | def __init__(
self,
manifest_filepath: Union[str, Path, List[str], List[Path]],
sample_rate: int,
text_tokenizer: Union[BaseTokenizer, Callable[[str], List[int]]],
tokens: Optional[List[str]] = None,
text_normalizer: Optional[Union[Normalizer, Callable[[str], str]]] = Non... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_dataset(dataset_type, soruce, opts): \n\n p = PreProcessor(dataset_type, opts)\n\n # If we are NOT running \"implementation.py\", we read the data from file\n if dataset_type == \"train\" or dataset_type == \"dev\" or dataset_type == \"test\":\n path_to_data = soruce\n p.read_labe... | [
"0.58437884",
"0.5739225",
"0.5708014",
"0.5656097",
"0.56303513",
"0.55449504",
"0.5538415",
"0.55168533",
"0.55012786",
"0.54751885",
"0.54746354",
"0.5467275",
"0.5459591",
"0.5457424",
"0.54521024",
"0.5427669",
"0.5426178",
"0.53898054",
"0.5376765",
"0.5373822",
"0.5371... | 0.0 | -1 |
Returns the path to a BibDesk bibliography file that is copied to a temporary directory. | def bib_bibdesk(tmpdir) -> str:
src = resource_filename("tests", "libs/bibdesk.bib")
dst = str(tmpdir.join("tmp.bib"))
# Copy the file to the temporary directory and return the path
copyfile(src, dst)
return dst | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bib_minimal(tmpdir) -> str:\n src = resource_filename(\"tests\", \"libs/minimal.bib\")\n dst = str(tmpdir.join(\"tmp.bib\"))\n\n # Copy the file to the temporary directory and return the path\n copyfile(src, dst)\n return dst",
"def _get_tmp_file_path(self):\n return os.path.join(self.t... | [
"0.68788886",
"0.64717203",
"0.63957345",
"0.6213849",
"0.62029254",
"0.62006164",
"0.60602593",
"0.60386026",
"0.59996456",
"0.5967908",
"0.59356284",
"0.588327",
"0.58453137",
"0.5838895",
"0.58359873",
"0.58337235",
"0.58220637",
"0.58204013",
"0.58014196",
"0.58002347",
"... | 0.7576836 | 0 |
Like rotateX(angle).rotateY(angle).rotateZ(angle) but uses matrix multiplication to only perform one transform. There's absolutely no reason for this function to exist other than testing that. | def rotateXYZ(self, angle):
return self.transform(Matrix3(
Vec3(1, 0, 0),
Vec3(0, math.cos(angle), -math.sin(angle)),
Vec3(0, math.sin(angle), math.cos(angle)),
) * Matrix3(
Vec3(math.cos(angle), 0, math.sin(angle)),
Vec3(0, 1, 0),
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __compose_transformation(self):\n s = self.scale\n rotR = self.rotation\n t = self.translation\n T = np.eye(4)\n T[0:3, 3] = t\n R = np.eye(4)\n R[0:3, 0:3] = rotR\n M = T.dot(R)\n if s == 1:\n M = T.dot(R)\n else:\n S ... | [
"0.63130075",
"0.62962544",
"0.61084145",
"0.6066426",
"0.60474545",
"0.6031393",
"0.60095197",
"0.596904",
"0.596904",
"0.59246504",
"0.5903646",
"0.5896643",
"0.5892085",
"0.58662206",
"0.58590734",
"0.5851976",
"0.58361",
"0.58358335",
"0.5829941",
"0.58259666",
"0.5814351... | 0.577997 | 26 |
Return the data value of the node. | def value(self) -> int:
return self._data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_data(node):\n return node['data']",
"def node_data(self):\n return self.node_data_",
"def value(self):\n return self.node_value",
"def data(self):\n return self.first_node.data",
"def value(self):\n return self.data",
"def data(value):\n return value.data",
"de... | [
"0.8122141",
"0.80983746",
"0.7842725",
"0.7686201",
"0.75900394",
"0.7585623",
"0.7509356",
"0.7475221",
"0.739067",
"0.7377329",
"0.70728797",
"0.706496",
"0.69888496",
"0.6977477",
"0.6965514",
"0.6791275",
"0.67525953",
"0.6750329",
"0.67410964",
"0.672525",
"0.6707573",
... | 0.6779014 | 16 |
Initialize the LinkedList iterator object given the linked_list. | def __init__(self, linked_list: object):
self.current_node = linked_list._head | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, iterator):\n self.iterator = iterator\n self.has_next = False\n self.next_val = None\n if self.iterator.hasNext():\n self.has_next = True\n self.next_val = self.iterator.next()",
"def __init__(self, iterator):\n self.iter = iterator\n ... | [
"0.71621466",
"0.70398086",
"0.68298244",
"0.67458314",
"0.67156994",
"0.66142976",
"0.65694284",
"0.6517483",
"0.6431664",
"0.64072555",
"0.63967097",
"0.6393169",
"0.63692564",
"0.6356869",
"0.63014317",
"0.6299737",
"0.62996423",
"0.6255542",
"0.62534875",
"0.6240954",
"0.... | 0.7426335 | 0 |
Return the head of the LinkedList. | def head(self) -> object:
if not self._head:
raise EmptyListException("The list is empty.")
return self._head | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def head(self):\n return self._head",
"def head(self):\n return self._head",
"def first(self):\n if self.is_empty():\n raise Empty('list is empty')\n return self._head._next._element # front aligned with head of list",
"def first(self):\n return self... | [
"0.7556119",
"0.7556119",
"0.75447136",
"0.7280577",
"0.72457653",
"0.72197556",
"0.7189784",
"0.703998",
"0.70123273",
"0.70082986",
"0.6975683",
"0.69577503",
"0.68581474",
"0.6805673",
"0.6795312",
"0.67889017",
"0.6732605",
"0.6732162",
"0.6681944",
"0.66437566",
"0.66242... | 0.78340995 | 0 |
Push the new value onto the LinkedList. | def push(self, value: int):
new_node = Node(value)
new_node._next = self._head
self._head = new_node
self._len += 1
print(f"value: {value}, head: {self._head}, len: {self._len}, new_node: {new_node}") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def push(self, val):\n self._linkedlist.push(val)\n self._update_attr()",
"def push(self, val):\n new_node = Node(val)\n new_node.next = self.head\n self.head = new_node\n self.length += 1",
"def push(self, val):\n self.head = Node(val, self.head)",
"def push(... | [
"0.8347391",
"0.81557643",
"0.8090113",
"0.8020132",
"0.8018572",
"0.8007591",
"0.79513216",
"0.7887896",
"0.77093863",
"0.76772517",
"0.76615965",
"0.7597464",
"0.7562861",
"0.7504391",
"0.7447806",
"0.74339634",
"0.74079585",
"0.737281",
"0.7363634",
"0.73435974",
"0.729231... | 0.7666103 | 10 |
Remove the last element of the LinkedList. | def pop(self) -> object:
if len(self) <= 0:
raise EmptyListException("The list is empty.")
pop_node = self._head
self._head = self._head.next()
self._len -= 1
return pop_node.value() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_last(self):\n if self.is_empty():\n raise Empty('list is empty')\n answer = self._tail._element\n self._tail = self._tail._prev\n self._size -= 1\n if self.is_empty(): # special case as deque is empty\n self._head = None ... | [
"0.82564855",
"0.82166255",
"0.8123317",
"0.7931033",
"0.7908211",
"0.78697264",
"0.78574336",
"0.7707979",
"0.75320977",
"0.7531054",
"0.74108934",
"0.7384918",
"0.7362352",
"0.7274183",
"0.7194808",
"0.7166217",
"0.71122855",
"0.7086372",
"0.70681304",
"0.70380235",
"0.6993... | 0.65305364 | 49 |
Initialize the EmptyListException object with the provided message. | def __init__(self, message: str):
self.message = message | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_initial_length_equals_zero(self):\r\n msg_list = messages.MessageList()\r\n self.assertEqual(msg_list.length(), 0)",
"def __init__(self, message):\n ModelException.__init__(self, message)",
"def test_first_when_empty(self):\n l_list = DoubleLinkedList()\n with self.a... | [
"0.5568676",
"0.5387466",
"0.5357251",
"0.52515054",
"0.52413714",
"0.5232845",
"0.5107999",
"0.5089557",
"0.50886047",
"0.50819343",
"0.50465214",
"0.50449264",
"0.5015206",
"0.5004433",
"0.5003975",
"0.5003975",
"0.50033313",
"0.49960613",
"0.49541035",
"0.49537975",
"0.493... | 0.4744995 | 54 |
char> char embedding > dropout > char lstm > char representation word > word embedding [char representation, word embedding] > dropout > word lstm > dropout > Linear > tagscores | def _get_lstm_features(self, word_inputs, feature_inputs, word_seq_lengths, char_inputs, char_seq_lengths,
char_seq_recover, vfeature_input, v_mask, alpha):
batch_size = word_inputs.size(0)
sent_len = word_inputs.size(1)
char_batch_size = char_inputs.size(0)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sample_beam(model, input_embedding, char2idx, idx2char, k=5, maxlen=30,\n start='START', use_head=True):\n with torch.no_grad():\n device = input_embedding.device\n softmax = nn.Softmax(dim=1)\n if use_head:\n input_embedding = input_embedding.view(1, -1)\n\n ... | [
"0.7193272",
"0.693685",
"0.6792849",
"0.6774681",
"0.67458636",
"0.6681713",
"0.66226333",
"0.6610731",
"0.6559845",
"0.65537155",
"0.6553014",
"0.6550164",
"0.6549374",
"0.65235955",
"0.65217996",
"0.6506037",
"0.6497246",
"0.64923733",
"0.64649737",
"0.6433044",
"0.642133"... | 0.64141935 | 21 |
char> char embedding > dropout > char lstm > char representation word > word embedding [char representation, word embedding] > dropout > word lstm > dropout > Linear > tagscores crf > loss | def calculate_loss(self, word_inputs, feature_inputs, word_seq_lengths, char_inputs, char_seq_lengths, \
char_seq_recover, batch_label, mask, vfeature_input, v_modal_label, t_modal_label, v_mask, alpha=0):
outs, textual_clf_outputs, visual_clf_outputs = self._get_lstm_features(word_inpu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_model(options,worddicts):\n opt_ret=dict()\n params=dict()\n word_xr1_mask=tf.reverse(word_x1_mask,[1])\n word_xr2_mask = tf.reverse(word_x2_mask, [1])\n\n\n\n #embedding layer\n word_embedding = norm_weight(options['n_words'], options['dim_word'])\n if options['embedding']:\n ... | [
"0.71209943",
"0.7086162",
"0.6996406",
"0.6978016",
"0.68382674",
"0.6807232",
"0.6806796",
"0.6795835",
"0.6780171",
"0.6751966",
"0.67269224",
"0.670758",
"0.6698155",
"0.6688772",
"0.66606766",
"0.6617124",
"0.65809166",
"0.6575013",
"0.6572967",
"0.6563658",
"0.6563452",... | 0.0 | -1 |
Returns value or None type if value is an empty string. | def _assignValue(value):
if value == "":
return None
else:
return value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process(self, value):\n return six.text_type(value) if value is not None else None",
"def _coerce_str_unless_none(value):\n return str(value) if value is not None else None",
"def str_or_none(val):\n return str(val) if val is not None else None",
"def noneType(value):\r\n return ''",
... | [
"0.76035935",
"0.75459725",
"0.7512423",
"0.7413424",
"0.7339698",
"0.7286229",
"0.7267827",
"0.72608846",
"0.72509575",
"0.7182878",
"0.7170925",
"0.70737046",
"0.70331645",
"0.6977212",
"0.68738705",
"0.6815573",
"0.68155557",
"0.6777452",
"0.6723878",
"0.6723878",
"0.67238... | 0.6739135 | 18 |
Returns the database Id of the object. | def getId(self):
return self._id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def database_id(self) -> str:\n return pulumi.get(self, \"database_id\")",
"def id(self):\n return self.odb_id",
"def get_objectID(self):\n return self.collection.uuid",
"def database_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"database_id\")",
"def get_id(self):... | [
"0.7847081",
"0.7796932",
"0.75531095",
"0.7402224",
"0.728605",
"0.72676873",
"0.72676873",
"0.7254392",
"0.72041106",
"0.71636456",
"0.7140959",
"0.7140959",
"0.7140959",
"0.7140959",
"0.7140959",
"0.7140959",
"0.71392024",
"0.7117711",
"0.71175086",
"0.71175086",
"0.711750... | 0.0 | -1 |
Returns the type of the object. | def getType(self):
return self._type | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_type ( self, object ):\n return self.type",
"def get_type ( self, object ):\n return self.type",
"def object_type(self):\n return self._object_type",
"def object_type(self):\n return self._object_type",
"def object_type(self):\n return self._object_type",
"def o... | [
"0.9011973",
"0.9011973",
"0.87428284",
"0.87428284",
"0.87428284",
"0.87428284",
"0.87428284",
"0.8628344",
"0.8628344",
"0.8628344",
"0.8628344",
"0.8628344",
"0.8628344",
"0.8628344",
"0.8628344",
"0.8628344",
"0.8628344",
"0.8628344",
"0.8628344",
"0.8628344",
"0.8628344"... | 0.75876486 | 88 |
Returns the Right Ascension in J2000 Epoch. | def getRA(self):
return self._ra | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def epoch():\n\treturn time.time()",
"def get_year(self):\n\n # First we get the first 8 bits stored in the yqr register\n year_bcd = self.__read_register(_REGISTER_YEAR)\n\n # Then we extract the digits and the tens\n tens = (year_bcd & 0xF0) >> 4 # 0xF0 = 0b11110000\n digit ... | [
"0.620437",
"0.5979336",
"0.58972114",
"0.5843888",
"0.5695694",
"0.5625431",
"0.5598738",
"0.5595205",
"0.5591743",
"0.55489904",
"0.5536614",
"0.55146855",
"0.5505633",
"0.5483326",
"0.54042184",
"0.5403001",
"0.5377564",
"0.53264105",
"0.5312148",
"0.5303543",
"0.5279033",... | 0.0 | -1 |
turns on / off pumps. | def set_pump(self, pump: str, state: bool):
if pump == "NF":
if state:
self.msg_send_upr.data[:3] = [0x11, 0x00, 0x01]
else:
self.msg_send_upr.data[:3] = [0x11, 0x00, 0x02]
elif pump == "NT":
if state:
self.msg_s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def turn_on(self):\n self._remote.power(1)",
"def __manage_pump(self):\r\n with self.config_lock:\r\n if self.config['pump_auto_control'] == False:\r\n # Controller doesn't need to do anything about the pump as it is in manual control mode\r\n pass\r\n ... | [
"0.6871326",
"0.6809076",
"0.6781299",
"0.666911",
"0.6667819",
"0.66241765",
"0.66100115",
"0.6594827",
"0.65811825",
"0.64907134",
"0.6487059",
"0.6463835",
"0.6396959",
"0.6356148",
"0.6352164",
"0.63509923",
"0.63369036",
"0.6331773",
"0.63199294",
"0.63054764",
"0.629732... | 0.6536948 | 9 |
Imports JSON file and returns a dictionary | def importJSON(path_to_json) -> dict:
try:
with open(path_to_json, 'r') as f:
json_data = json.load(f)
return(json_data)
except Exception as error:
print(f"Error: importJSON({path_to_json}) -> {error}") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def import_json(self) -> dict:\n with open(self.path, encoding=\"utf8\") as json_file:\n return json.load(json_file)",
"def load_json(file_path):\n\n \n with open(file_path, 'r') as json_file:\n # print(file_path)\n dictionary = json.loads(json_file.read())\n\n return dic... | [
"0.85834503",
"0.7709707",
"0.7598824",
"0.7573594",
"0.7572569",
"0.7552922",
"0.7552436",
"0.75074273",
"0.75054115",
"0.74738044",
"0.7451817",
"0.7427834",
"0.7427461",
"0.74194014",
"0.74162835",
"0.74103576",
"0.7408963",
"0.73839617",
"0.73726296",
"0.73726296",
"0.737... | 0.8168396 | 1 |
Exports a dictionary to JSON file | def exportJSON(data, path_to_json="./exported_data.json") -> None:
try:
with open(path_to_json, 'w') as f:
return(json.dump(data, f))
except Exception as error:
print(f"Error: exportJSON({path_to_json}) -> {error}") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_dict_as_json(dict, output_path):\n with open(output_path, \"w\") as f:\n json.dump(dict, f)",
"def save_to_json(dict, file):\n with open(file, 'w') as f:\n json.dump(dict, f, indent=2)\n return file",
"def dict_2_json(obj, filename):\n\twith open('data/output/' + filename, 'w') ... | [
"0.8035493",
"0.7801481",
"0.7734556",
"0.7691705",
"0.7673766",
"0.7669284",
"0.76607645",
"0.763052",
"0.76286983",
"0.7537519",
"0.74532783",
"0.74123806",
"0.7406959",
"0.7400805",
"0.7392136",
"0.7347749",
"0.7330607",
"0.73212755",
"0.7313775",
"0.72894317",
"0.7251004"... | 0.67715466 | 68 |
Tests update_person() method of Movement class and movements module to check data is getting updated randomly | def test_update_person(self) -> None:
self.assertIsInstance(self.movement.update_persons(self.pop.get_person(),len(self.pop.get_person())), np.ndarray)
self.pop.persons[:,idx.speed] = 0.1
self.assertNotEqual(self.movement.update_persons(self.pop.get_person(),
len(self.pop.get_person... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_update_sim():\n # Generate a random set of parameters, a random start date, and a Chromosome\n r_start_date, r_end_date = sga.generate_random_dates()\n r_param_ids = wp.flexible_generate()\n individual = sga.Chromosome(r_param_ids, fitness=100, start_date=r_start_date, end_date=r_end_date)\n ... | [
"0.64512783",
"0.63961077",
"0.63852954",
"0.63351357",
"0.63273567",
"0.63273567",
"0.63273567",
"0.63068795",
"0.6271266",
"0.61678606",
"0.60767657",
"0.6065645",
"0.60372084",
"0.5999817",
"0.5984909",
"0.59714514",
"0.5966152",
"0.59648436",
"0.5938008",
"0.59065086",
"0... | 0.83454645 | 0 |
googletrans limits 5000 characters split text with nltk.sent_tokenize >>> nltk.sent_tokenize('hello world!') | def split_text(self, text, max_len=5000):
if len(text) <= max_len:
return [text]
if not self.nltk_checked:
self.check_nltk()
self.logger.info('split text with nltk')
texts = []
for sent in nltk.sent_tokenize(text):
if (not texts) or (len(tex... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sentence_tokenizer(text):\n return sent_tokenize(text)",
"def preprocess_sent(sent):\n #tokenized = word_tokenize(sent.lower())\n tokenizer = Tok()\n tokenized = tokenizer.tokenize(sent.lower())\n return tokenized",
"def process_token_sentence(text):\n\n sentences = nltk.sent_tokenize(tex... | [
"0.66927284",
"0.6563007",
"0.6555195",
"0.64186853",
"0.64105844",
"0.63427496",
"0.6328147",
"0.63174146",
"0.6293481",
"0.6278385",
"0.62573266",
"0.6235347",
"0.6232791",
"0.622834",
"0.6219701",
"0.6219701",
"0.6219701",
"0.6219701",
"0.6213303",
"0.61912453",
"0.6187746... | 0.69289625 | 0 |
Convenience layer that perorms an affine transform followed by a ReLU | def affine_relu_forward(x, w, b):
a, fc_cache = affine_forward(x, w, b)
out, relu_cache = relu_forward(a)
cache = (fc_cache, relu_cache)
return out, cache | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def affine_layernorm_relu_forward(x, w, b, gamma, beta, ln_param):\n fc_out, fc_cache = affine_forward(x, w, b)\n norm_out, norm_cache = layernorm_forward(fc_out, gamma, beta, ln_param)\n out, relu_cache = relu_forward(norm_out)\n cache = (fc_cache, norm_cache, relu_cache)\n return out, cache",
"def affineT... | [
"0.698708",
"0.6572305",
"0.64399964",
"0.64333427",
"0.64333427",
"0.64333427",
"0.64333427",
"0.6421351",
"0.63357264",
"0.62894714",
"0.62431055",
"0.6235563",
"0.62171966",
"0.6188857",
"0.6136671",
"0.6121202",
"0.6056053",
"0.6045708",
"0.6031193",
"0.6011002",
"0.60026... | 0.71835244 | 1 |
Convenience layer that performs affinebatchnormReLU | def affine_batchnorm_relu_forward(x, w, b, gamma, beta, bn_param):
fc_out, fc_cache = affine_forward(x, w, b)
norm_out, norm_cache = batchnorm_forward(fc_out, gamma, beta, bn_param)
out, relu_cache = relu_forward(norm_out)
cache = (fc_cache, norm_cache, relu_cache)
return out, cache | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def affine_batchnorm_relu_forward(x, w, b, gamma, beta, bn_params):\n af_out, af_cache = affine_forward(x, w, b)\n bf_out, bf_cache = batchnorm_forward(af_out, gamma, beta, bn_params)\n out, relu_cache = relu_forward(bf_out)\n \n cache = (af_cache, bf_cache, relu_cache)\n return out, cache",
"d... | [
"0.7431693",
"0.69721717",
"0.69712144",
"0.6892716",
"0.6888509",
"0.6838043",
"0.67680544",
"0.67216855",
"0.67216855",
"0.6699832",
"0.6664292",
"0.66618466",
"0.66618466",
"0.6607757",
"0.65978956",
"0.6596755",
"0.65825033",
"0.65523744",
"0.65495676",
"0.6429723",
"0.63... | 0.754547 | 0 |
Backward pass for the affinebatchnormrelu convenience layer | def affine_batchnorm_relu_backward(dout, cache):
fc_cache, norm_cache, relu_cache = cache
d_norm_out = relu_backward(dout, relu_cache)
d_affine_out, dgamma, dbeta = batchnorm_backward_alt(d_norm_out, norm_cache)
dx, dw, db = affine_backward(d_affine_out, fc_cache)
return dx, dw, db, dgamma, dbeta | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def affine_batchnorm_relu_backward(dout, cache):\n af_cache, bf_cache, relu_cache = cache\n \n dbf_out = relu_backward(dout, relu_cache)\n daf_out, dgamma, dbeta = batchnorm_backward(dbf_out, bf_cache)\n dx, dw, db = affine_backward(daf_out, af_cache)\n return dx, dw, db, dgamma, dbeta",
"def a... | [
"0.7582516",
"0.7579367",
"0.74716526",
"0.72218114",
"0.70446813",
"0.7039857",
"0.7027473",
"0.69938916",
"0.69381684",
"0.69119525",
"0.6853897",
"0.68478745",
"0.6847587",
"0.6847587",
"0.6838061",
"0.6838061",
"0.6838061",
"0.6838061",
"0.68255734",
"0.68255734",
"0.6741... | 0.7655345 | 0 |
Convenience layer that performs affinebatchnormReLU | def affine_layernorm_relu_forward(x, w, b, gamma, beta, ln_param):
fc_out, fc_cache = affine_forward(x, w, b)
norm_out, norm_cache = layernorm_forward(fc_out, gamma, beta, ln_param)
out, relu_cache = relu_forward(norm_out)
cache = (fc_cache, norm_cache, relu_cache)
return out, cache | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def affine_batchnorm_relu_forward(x, w, b, gamma, beta, bn_param):\n fc_out, fc_cache = affine_forward(x, w, b)\n norm_out, norm_cache = batchnorm_forward(fc_out, gamma, beta, bn_param)\n out, relu_cache = relu_forward(norm_out)\n cache = (fc_cache, norm_cache, relu_cache)\n return out, cache",
"def affine_... | [
"0.75442225",
"0.7430464",
"0.6972153",
"0.69712216",
"0.6894696",
"0.6890417",
"0.6840082",
"0.67684895",
"0.6723512",
"0.6723512",
"0.666368",
"0.666368",
"0.66630596",
"0.6607281",
"0.65974224",
"0.6597175",
"0.658122",
"0.6552558",
"0.65493417",
"0.64293724",
"0.6388399",... | 0.6699408 | 10 |
Backward pass for the affinelayernormrelu convenience layer | def affine_layernorm_relu_backward(dout, cache):
fc_cache, norm_cache, relu_cache = cache
d_norm_out = relu_backward(dout, relu_cache)
d_affine_out, dgamma, dbeta = layernorm_backward(d_norm_out, norm_cache)
dx, dw, db = affine_backward(d_affine_out, fc_cache)
return dx, dw, db, dgamma, dbeta | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def affine_relu_backward(dout, cache):\n fc_cache, relu_cache = cache\n da = layers.relu_backward(dout, relu_cache)\n dx, dw, db = layers.affine_backward(da, fc_cache)\n return dx, dw, db",
"def affine_relu_backward(dout, cache):\n fc_cache, relu_cache = cache\n da = relu_backward(dout, relu_ca... | [
"0.79162735",
"0.77082694",
"0.77082694",
"0.77082694",
"0.77082694",
"0.75409967",
"0.75409967",
"0.75409967",
"0.75409967",
"0.75165737",
"0.7237262",
"0.719231",
"0.7134813",
"0.7077822",
"0.6990777",
"0.69573253",
"0.6910288",
"0.6885332",
"0.6885332",
"0.6866233",
"0.685... | 0.73152465 | 10 |
Compute softmax values for each sets of scores in x. | def softmax(x):
return np.exp(x)/np.sum(np.exp(x),axis=0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def softmax(self, scores):\n\n\n # for each sample, for each class ,caclulate\n # np.exp(scores) : still (n_samples, n_classes)\n\n # axis = 1\n # a00, a01, a02 as a sinlge one to perfrom np_sum\n # which is the same sample \n # sum_exp : still (n_samples, 1)\n\n # ... | [
"0.77987385",
"0.7762009",
"0.7761647",
"0.77591646",
"0.76599663",
"0.76599663",
"0.76599663",
"0.76599663",
"0.75852114",
"0.743222",
"0.7408266",
"0.739256",
"0.73593086",
"0.73172486",
"0.7269417",
"0.7262718",
"0.72612756",
"0.72568876",
"0.7230255",
"0.7215012",
"0.7201... | 0.69525695 | 94 |
Constructs a DeepLook model with initialized weights | def __init__(self, num_classes, **kwargs):
super(DeepLook, self).__init__()
# Make config
kwargs['num_classes'] = num_classes
self.configs = make_configs(**kwargs)
# Build submodules
self.build_modules() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_weights(model):\n ...",
"def build(self):\n\n self.W = self.init([self.n_atom_input_feat, self.n_output])\n self.b = model_ops.zeros(shape=[\n self.n_output,\n ])\n\n self.trainable_weights = self.W + self.b",
"def __init__(self, weights):\n self._weights = weights",
... | [
"0.7520669",
"0.7104912",
"0.698615",
"0.6942081",
"0.69123715",
"0.6764348",
"0.6719176",
"0.6717331",
"0.67129856",
"0.67129856",
"0.6706106",
"0.66934836",
"0.6685458",
"0.6673794",
"0.665862",
"0.6657789",
"0.6654211",
"0.6623683",
"0.65879536",
"0.65709233",
"0.6565613",... | 0.0 | -1 |
the total squared variation of y_i's from their mean | def total_sum_of_squares(y: np.ndarray) -> float:
return np.sum(np.square(y - np.linalg.norm(y))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calc_rmse(y: np.ndarray, y_hat: np.ndarray) -> float:\n return np.sqrt(np.mean((y - y_hat)**2))",
"def avgY(self):\n return np.mean(self.gety())",
"def variance(y, w):\n # w = clip_normalize(w)\n # Compute the expectance (d_y, n_q)\n y_q_exp = np.dot(y.T, w)\n\n # Compute the expectan... | [
"0.70017594",
"0.6955629",
"0.67753834",
"0.6746618",
"0.6737711",
"0.66908747",
"0.66682976",
"0.6650526",
"0.66179186",
"0.6607198",
"0.6597729",
"0.6570701",
"0.6559402",
"0.65435",
"0.65130544",
"0.65017146",
"0.6485777",
"0.64714175",
"0.6431823",
"0.6427266",
"0.6408846... | 0.67733693 | 3 |
Returns full path of setting file | def filename(self):
return self.system.fileName() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def settingsFilePath(self):\n return self._settingsFilePath",
"def path(self):\n return os.path.join(self.config.get('path', os.getcwd()))",
"def get_tool_settings_file_path(self, tool_id):\n\n settings_path = path_utils.get_user_data_dir(appname=tool_id)\n settings_file = path_util... | [
"0.77539456",
"0.74510545",
"0.74167013",
"0.7281087",
"0.7264031",
"0.7241672",
"0.7123057",
"0.7096696",
"0.70910966",
"0.70663893",
"0.7064822",
"0.7046031",
"0.7027928",
"0.6939331",
"0.6920426",
"0.6917326",
"0.69078636",
"0.6905789",
"0.68682075",
"0.68119115",
"0.67275... | 0.0 | -1 |
The creation timestamp of a DnsAuthorization. | def create_time(self) -> str:
return pulumi.get(self, "create_time") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def creation_timestamp(self):\n\n return self.get_signingTime()",
"def creation_timestamp(self) -> str:\n return pulumi.get(self, \"creation_timestamp\")",
"def creation_timestamp(self) -> str:\n return pulumi.get(self, \"creation_timestamp\")",
"def creation_timestamp(self) -> str:\n ... | [
"0.78806496",
"0.7557236",
"0.7557236",
"0.7557236",
"0.72999173",
"0.72999173",
"0.72999173",
"0.7299115",
"0.7215541",
"0.71454126",
"0.70997787",
"0.7056697",
"0.7056697",
"0.7049394",
"0.7041489",
"0.7026219",
"0.6997765",
"0.6997765",
"0.6997765",
"0.6956887",
"0.6956887... | 0.6690682 | 45 |
Gets details of a single DnsAuthorization. | def get_dns_authorization(dns_authorization_id: Optional[str] = None,
location: Optional[str] = None,
project: Optional[str] = None,
opts: Optional[pulumi.InvokeOptions] = None) -> AwaitableGetDnsAuthorizationResult:
__args__ = dict()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_dns_authorization_output(dns_authorization_id: Optional[pulumi.Input[str]] = None,\n location: Optional[pulumi.Input[str]] = None,\n project: Optional[pulumi.Input[Optional[str]]] = None,\n opts: Optional[pulumi... | [
"0.6578292",
"0.54455376",
"0.5380194",
"0.53527355",
"0.5132181",
"0.50677764",
"0.50275254",
"0.49004343",
"0.48588067",
"0.4857909",
"0.46524522",
"0.46483263",
"0.46464095",
"0.46286583",
"0.4588383",
"0.45825982",
"0.45228297",
"0.45139465",
"0.44855255",
"0.4472644",
"0... | 0.698003 | 0 |
Gets details of a single DnsAuthorization. | def get_dns_authorization_output(dns_authorization_id: Optional[pulumi.Input[str]] = None,
location: Optional[pulumi.Input[str]] = None,
project: Optional[pulumi.Input[Optional[str]]] = None,
opts: Optional[pulumi.InvokeO... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_dns_authorization(dns_authorization_id: Optional[str] = None,\n location: Optional[str] = None,\n project: Optional[str] = None,\n opts: Optional[pulumi.InvokeOptions] = None) -> AwaitableGetDnsAuthorizationResult:\n __args__ = d... | [
"0.69820035",
"0.5445114",
"0.5380819",
"0.5352421",
"0.51325935",
"0.50696605",
"0.5029935",
"0.49021158",
"0.4862916",
"0.48571897",
"0.46530038",
"0.46492136",
"0.46489808",
"0.46292678",
"0.45852825",
"0.45825338",
"0.4525407",
"0.45121774",
"0.44856316",
"0.44752708",
"0... | 0.65815955 | 1 |
Get input tensor from input data. | def get_tensor_from_input(input_data: Dict[str, Any]) -> torch.Tensor:
return input_data['img'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_tensor_from_input(self, input_data: Dict[str, Any],\n **kwargs) -> torch.Tensor:\n raise NotImplementedError",
"def input_tensor(interpreter):\n tensor_index = interpreter.get_input_details()[0]['index']\n return interpreter.tensor(tensor_index)()[0]",
"def inp... | [
"0.796942",
"0.7573257",
"0.7500826",
"0.70625985",
"0.69879276",
"0.67678607",
"0.67557603",
"0.67429",
"0.6610127",
"0.6550787",
"0.65429455",
"0.64512795",
"0.64491844",
"0.6445135",
"0.64403015",
"0.6310326",
"0.6305846",
"0.62908643",
"0.6244693",
"0.62428",
"0.62336826"... | 0.78926533 | 1 |
Get the model name. | def get_model_name(self) -> str:
assert 'backbone' in self.model_cfg.model, 'backbone not in model '
'config'
assert 'type' in self.model_cfg.model.backbone, 'backbone contains '
'no type'
name = self.model_cfg.model.backbone.type.lower()
return name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def model_name(self) -> str:\n return self._model_name",
"def get_model_name(self) -> str:\n return self._get_string(openvr.Prop_RenderModelName_String)",
"def get_model_name(self) -> str:\n raise NotImplementedError",
"def model_name(self):\n setting = self.get_setting_definition... | [
"0.88881665",
"0.883052",
"0.87915975",
"0.84520155",
"0.8416848",
"0.8376444",
"0.83522457",
"0.8329777",
"0.82505643",
"0.8224384",
"0.81623787",
"0.80150056",
"0.78287315",
"0.77966535",
"0.77646977",
"0.7711224",
"0.76936203",
"0.76847035",
"0.76512337",
"0.7626555",
"0.7... | 0.7973438 | 12 |
Proxy that forwards all attribute accesses to the superclass, except those methods that are forbidden. | def __getattribute__(self, name):
_allowed = object.__getattribute__(self, '_FORBIDDEN_METHODS')
if name in _allowed:
raise AttributeError("Method %s is disabled"%name)
else:
return object.__getattribute__(self, name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attr(self) -> 'AttributeProxy':\n return AttributeProxy(self, [])",
"def __getattribute__(self,attr):\n if attr in super(BaseTransformer,self).__getattribute__('_overrides'):\n return super(BaseTransformer,self).__getattribute__('_'+attr)\n return super(BaseTransformer,self)._... | [
"0.6254422",
"0.6140603",
"0.6105151",
"0.6105151",
"0.59995437",
"0.5867957",
"0.5818519",
"0.57248545",
"0.57248545",
"0.56791687",
"0.5665688",
"0.55978006",
"0.55934083",
"0.55390936",
"0.55293083",
"0.5507923",
"0.5498142",
"0.5475571",
"0.54467595",
"0.54467297",
"0.541... | 0.6206676 | 1 |
Sample from a Gaussian distribution The scatter is small enough that the emulated value is always used. | def noise(x: np.ndarray) -> np.ndarray:
return np.random.normal(loc=MEAN, scale=1e-2, size=1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gaussianOneSample(self, mu=0., sig=1., size=1):\n\n thisSample = np.random.normal(mu, sig, size)\n\n return thisSample",
"def _gaussian_distribution(self, x: ndarray, mu: float, sigma: float) -> ndarray:\n return 1 / (np.sqrt(2 * np.pi) * sigma) * np.exp(\n -np.power(\n ... | [
"0.7596691",
"0.7329784",
"0.7011989",
"0.696803",
"0.6929013",
"0.6925154",
"0.6900917",
"0.6885902",
"0.68128633",
"0.6810032",
"0.67928547",
"0.6703149",
"0.66871804",
"0.66139936",
"0.65987223",
"0.6594328",
"0.6574367",
"0.65527934",
"0.6495717",
"0.64853245",
"0.6455124... | 0.0 | -1 |
Return to index page | def index(request):
products = Top_selling_product.objects.all()
context = {'products':products}
return render(request, 'home/index.html',context) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index():\n\n return {\n 'page': 'index',\n }",
"def index():\n return render_template('pages/index.html', isNav=True)",
"def index():\n\n\treturn(render_template('index.html'))",
"def index():\r\n return render_template('index.html')",
"def index():\n\n return render_templ... | [
"0.7747321",
"0.77358466",
"0.7673683",
"0.7654069",
"0.76329625",
"0.7622914",
"0.7601515",
"0.7589556",
"0.7579431",
"0.7579431",
"0.7579431",
"0.7560658",
"0.7555432",
"0.75540775",
"0.75540775",
"0.7549194",
"0.7548505",
"0.7548505",
"0.74995077",
"0.74826896",
"0.748134"... | 0.0 | -1 |
Create and save a User with the given email and password. | def _create_user(self, email, password, **extra_fields):
if not email:
raise ValueError('The given email must be set')
email = self.normalize_email(email)
user = self.model(email=email, **extra_fields)
user.set_password(password)
user.save(using=self._db)
retu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _create_user(self, email, password, **extra_fields):\n if not email:\n raise ValueError('The given email must be set')\n email = self.normalize_email(email)\n user = self.model(email=email, **extra_fields)\n user.set_password(password)\n user.save(using=self._db)\n return user",
"def... | [
"0.8544657",
"0.8512018",
"0.85083485",
"0.8502773",
"0.8502675",
"0.8489725",
"0.8489725",
"0.8489304",
"0.8489304",
"0.8489304",
"0.8486331",
"0.8477427",
"0.84767264",
"0.84573674",
"0.84573674",
"0.84573674",
"0.84553957",
"0.84486383",
"0.84455115",
"0.84436715",
"0.8442... | 0.84756774 | 17 |
Convert GPS Time Of Week to UTC time. | def itow2utc(itow: int) -> datetime.time:
utc = datetime(1980, 1, 6) + timedelta(seconds=(itow / 1000) - (35 - 19))
return utc.time() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def UTCFromGps(gpsWeek, SOW, leapSecs=18): \n\tsecFract = SOW % 1 \n\tepochTuple = gpsEpoch + (-1, -1, 0) \n\tt0 = time.mktime(epochTuple) - time.timezone #mktime is localtime, correct for UTC \n\ttdiff = (gpsWeek * secsInWeek) + SOW - leapSecs \n\tt = t0 + tdiff \n\t(year, month, day, hh, mm, ss, dayOfWeek, jul... | [
"0.662997",
"0.5682649",
"0.5614565",
"0.56099886",
"0.55695164",
"0.53725725",
"0.5305614",
"0.5305614",
"0.5292093",
"0.5285639",
"0.52802724",
"0.52693546",
"0.5244044",
"0.5222375",
"0.52195513",
"0.52033424",
"0.5191457",
"0.5189699",
"0.5189699",
"0.5174292",
"0.5157019... | 0.5575819 | 4 |
Convert Dilution of Precision float to descriptive string. | def dop2str(dop: float) -> str:
if dop == 1:
dops = "Ideal"
elif dop <= 2:
dops = "Excellent"
elif dop <= 5:
dops = "Good"
elif dop <= 10:
dops = "Moderate"
elif dop <= 20:
dops = "Fair"
else:
dops = "Poor"
return dops | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def latex_format(n,u, precision = 1):\n if u<0:\n raise ValueError(\"uncertainty cannot be negative\")\n x = ufloat(n,u)\n s = (\"{:.\"+str(precision)+\"uS}\").format(x)\n # s = (\"{:.\"+str(precision)+\"L}\").format(x)\n # This removes a decimal point in uncertainty\n... | [
"0.6629014",
"0.6559915",
"0.6528791",
"0.65271384",
"0.6480672",
"0.643901",
"0.643667",
"0.64344287",
"0.6432693",
"0.6403251",
"0.6394071",
"0.6367707",
"0.6366634",
"0.6346724",
"0.63314986",
"0.63251585",
"0.63068",
"0.63017994",
"0.6295359",
"0.62918156",
"0.62710553",
... | 0.0 | -1 |
``make_rpm_version`` raises ``Exception`` when supplied with a version with a noninteger pre or dev suffix number. | def test_non_integer_suffix(self):
with self.assertRaises(Exception) as exception:
make_rpm_version('0.1.2preX')
self.assertEqual(
u'Non-integer value "X" for "pre". Supplied version 0.1.2preX',
unicode(exception.exception)
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_prerelease_package_version(self, production: bool = False) -> str:\n rc = 1\n if describe := get_git_describe(CONFIG.mpy_path.as_posix()):\n ver, rc, _ = describe.split(\"-\")\n base = bump_version(Version(ver), minor_bump=True)\n rc = int(rc)\n ret... | [
"0.58532333",
"0.56656224",
"0.5518152",
"0.5504085",
"0.5457581",
"0.5415907",
"0.5397619",
"0.53010786",
"0.52818906",
"0.52620435",
"0.526008",
"0.5256599",
"0.5248018",
"0.522226",
"0.5196774",
"0.5193043",
"0.5191568",
"0.5168565",
"0.514132",
"0.51356226",
"0.51069486",... | 0.70420545 | 0 |
In dynamic mode, this function will modify the value at input tensor, returning same Tensor as input. But it will return a new Tensor with assigned value in static mode. | def _setitem_static(x, indices, values):
from .framework import default_main_program, Variable
if x.type == paddle.fluid.core.VarDesc.VarType.LOD_TENSOR_ARRAY:
return _setitem_for_tensor_array(x, indices, values)
# step1: parsing the index and recording them
(
starts,
ends,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Update(self, value):\n self.SetValue(self.GetValue() + tf.cast(value, self.dtype))",
"def Update(self, value):\n self.SetValue(self.GetValue() + tf.cast(value, self.dtype))",
"def read_value_and_reset(self):\n value = self.value\n with tf.control_dependencies([value]):\n with tf.control_de... | [
"0.6813833",
"0.6813833",
"0.63934433",
"0.62455034",
"0.6197038",
"0.6161538",
"0.6161538",
"0.6128425",
"0.6084013",
"0.6013784",
"0.60116863",
"0.5935033",
"0.5930476",
"0.5930476",
"0.5899636",
"0.5822346",
"0.580287",
"0.5755837",
"0.57234085",
"0.56966144",
"0.56885964"... | 0.5349769 | 59 |
Return a given number of bitwise left rotations of an integer n, for a given bit field width. | def rol(n, rotations=1, width=8):
rotations %= width
if rotations < 1:
return n
n &= mask(width) ## Should it be an error to truncate here?
return ((n << rotations) & mask(width)) | (n >> (width - rotations)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rol(n, rotations, width=8):\n rotations %= width\n if rotations < 1:\n return n\n n &= mask(width)\n return ((n << rotations) & mask(width)) | (n >> (width - rotations))",
"def rotate_left(x, d):\n d = d % N\n out = x << d\n excess = out \n out = out & (2**N-1)\n for i in ra... | [
"0.7246081",
"0.70839494",
"0.7044055",
"0.6820828",
"0.666304",
"0.66329354",
"0.65664095",
"0.65483034",
"0.6521907",
"0.6521907",
"0.65084624",
"0.65040386",
"0.64923596",
"0.6482142",
"0.6463128",
"0.6459508",
"0.6453292",
"0.6447717",
"0.63981503",
"0.62720966",
"0.62689... | 0.7145871 | 1 |
Return a given number of bitwise right rotations of an integer n, for a given bit field width. | def ror(n, rotations=1, width=8):
rotations %= width
if rotations < 1:
return n
n &= mask(width)
return (n >> rotations) | ((n << (width - rotations)) & mask(width)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ror(n, rotations, width=8):\n rotations %= width\n if rotations < 1:\n return n\n n &= mask(width)\n return (n >> rotations) | ((n << (width - rotations)) & mask(width))",
"def rol(n, rotations, width=8):\n rotations %= width\n if rotations < 1:\n return n\n n &= mask(width... | [
"0.77245474",
"0.73624015",
"0.72432333",
"0.7106471",
"0.70073396",
"0.6920127",
"0.6906766",
"0.68072695",
"0.6733679",
"0.6733679",
"0.6696039",
"0.6650104",
"0.6618279",
"0.65910864",
"0.6569401",
"0.65529823",
"0.64899784",
"0.64454335",
"0.6401584",
"0.6208439",
"0.6179... | 0.76810896 | 1 |
Return a list with all variables in the given formula that appear free. | def free_variables(formula):
visitor = CollectFreeVariables()
visitor.visit(formula)
return [x.expr for x in visitor.free_variables] # Unpack the symrefs | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_variables(formula):\n return collect_unique_nodes(formula, lambda x: isinstance(x, Variable))",
"def free_variables(self):\n\n free_vars = set()\n self.free_variables_helper(free_vars)\n return free_vars\n # Task 7.6",
"def findall_var(formula, variable):\n res = []\n ... | [
"0.6934321",
"0.68128234",
"0.67672044",
"0.6518919",
"0.6500751",
"0.6422018",
"0.6394407",
"0.6355575",
"0.63519716",
"0.6219452",
"0.5955306",
"0.5955306",
"0.588178",
"0.5695791",
"0.56850743",
"0.568267",
"0.55884",
"0.555021",
"0.55492115",
"0.5522038",
"0.54979265",
... | 0.8913732 | 0 |
Return a list with all variables that appear in the given formula. | def all_variables(formula):
return collect_unique_nodes(formula, lambda x: isinstance(x, Variable)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def findall_var(formula, variable):\n res = []\n s = Solver()\n s.add(formula)\n while True:\n if s.check() == sat:\n m = s.model()\n res.append(m)\n value = m[variable]\n if value == None:\n return res\n s.add(variable != val... | [
"0.7732734",
"0.75076985",
"0.714017",
"0.71367186",
"0.68405294",
"0.64734256",
"0.642139",
"0.62636507",
"0.6191016",
"0.5957787",
"0.5805247",
"0.5769637",
"0.57411927",
"0.57296854",
"0.56776047",
"0.5671479",
"0.56569624",
"0.5640331",
"0.563023",
"0.56238985",
"0.561338... | 0.7631351 | 1 |
Return all nodes in the AST of the given expression, formula or term. If a Boolean function `filter_` is provided, only those nodes that satisfy the function are returned. The method returns only one copy of each node, under syntactic equivalence. | def collect_unique_nodes(expression, filter_=None):
walker = NodeCollectionWalker(filter_)
walker.run(expression)
return list(x.expr for x in walker.nodes) # Unpack the symrefs | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all(self, type_filter=None):\n res = []\n if type_filter is None or isinstance(self, type_filter):\n res.append(self)\n for v in self._all_subnodes():\n if isinstance(v, IDLNode):\n res.extend(v.all(type_filter))\n elif isinstance(v, list):\n... | [
"0.5398623",
"0.5274756",
"0.5203433",
"0.51431704",
"0.5136322",
"0.5015866",
"0.50046176",
"0.49533865",
"0.49408776",
"0.49122068",
"0.490939",
"0.48621005",
"0.48532584",
"0.4841998",
"0.4820637",
"0.4766783",
"0.47431847",
"0.47342184",
"0.47326326",
"0.4731354",
"0.4709... | 0.62511396 | 0 |
Return the (int) amount of members currently in this union. | def member_count(self):
return len(self.members) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getNumElements(self):\n return 1 + sum(m.getNumElements() for m in self.members)",
"def getNumMembers(self):\n return _libsbml.ListOfMembers_getNumMembers(self)",
"def getSize(self):\n return sum(m.getSize() for m in self.members)",
"def getNumMembers(self):\n return _libsbml.... | [
"0.78084075",
"0.7654494",
"0.7556883",
"0.74550307",
"0.709529",
"0.69526315",
"0.6885538",
"0.68679696",
"0.6843339",
"0.6809259",
"0.6777342",
"0.6777342",
"0.6777342",
"0.6756881",
"0.6753978",
"0.67324567",
"0.6727253",
"0.6709362",
"0.6659741",
"0.66593146",
"0.66539705... | 0.8271798 | 0 |
Initialise queue from given values and end lists with ``None``. | def __post_init__(self) -> None:
self.gtex += [None]
self.bm += [None]
self._q: queue.Queue = queue.Queue(maxsize=self.maxsize) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, v1, v2):\n self.queue = [v for v in (v1, v2) if v]\n # 03092022\n # 初始化的时候,避免其中一个为None, 这样再叫next的时候\n # 则避免head.pop(0)的情况,一旦进入next, 则有if head判断\n if not v1:\n self.queue = [v2]\n elif not v2:\n self.queue = [v1]\n else:\n ... | [
"0.7096569",
"0.6672627",
"0.63467634",
"0.6329318",
"0.61678356",
"0.6155835",
"0.6147771",
"0.61285764",
"0.6101321",
"0.6060145",
"0.60539764",
"0.60539764",
"0.60323143",
"0.5988656",
"0.59788394",
"0.592103",
"0.58979785",
"0.5865467",
"0.585814",
"0.5854326",
"0.5851839... | 0.59948444 | 13 |
Initialise the queue's producer. The producer will return when all files have been iterated over, as indicated by the presence of `None` appended in `__post_init__`. This works by popping from 0 instead of 1. Additionally, the None signal is sent to the consumer to indicate when there are no more items to process. | def _producer(self) -> None:
while (gtex_path := self.gtex.pop(0)) is not None and (
bm_path := self.bm.pop(0)
) is not None:
data = merge_data(gtex_path, bm_path, self.mane)
self._q.put(data)
logger.info(f"Contents of file {gtex_path} added to queue")
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_init(self, queue=None, **kwargs):\n self.queue = queue if queue else Queue()",
"def __init__(self) -> None:\n self._queue = []",
"def __post_init__(self) -> None:\n self.gtex += [None]\n self.bm += [None]\n self._q: queue.Queue = queue.Queue(maxsize=self.maxsize)",
"... | [
"0.628365",
"0.620188",
"0.61403084",
"0.61233914",
"0.60602796",
"0.60498834",
"0.60498834",
"0.60498834",
"0.60498834",
"0.60498834",
"0.60078365",
"0.60078365",
"0.59780794",
"0.5937476",
"0.5934577",
"0.5797804",
"0.5794447",
"0.578564",
"0.578564",
"0.578564",
"0.578564"... | 0.67630744 | 0 |
Run the queue. The producer will return when there are no more files, and the consumer will return when the producer sends `None`. This prevent the interesting, and entirely common, situation of the consumer returning before the producer finishes the known number of inputs. A call to `join` is still used, however, to i... | def run(self) -> None:
with ThreadPoolExecutor(max_workers=self.maxworkers) as ex:
ex.submit(self._producer)
ex.submit(self._consumer)
self._q.join() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _producer(self) -> None:\n while (gtex_path := self.gtex.pop(0)) is not None and (\n bm_path := self.bm.pop(0)\n ) is not None:\n data = merge_data(gtex_path, bm_path, self.mane)\n self._q.put(data)\n logger.info(f\"Contents of file {gtex_path} added to... | [
"0.74263084",
"0.6735508",
"0.6593552",
"0.633845",
"0.6297317",
"0.6170219",
"0.6114574",
"0.6083693",
"0.60824466",
"0.6059971",
"0.6034089",
"0.6031405",
"0.60099685",
"0.59966487",
"0.59722286",
"0.59697235",
"0.59629416",
"0.59563047",
"0.59235376",
"0.59201366",
"0.5906... | 0.6108876 | 7 |
Initializes the weights using He initialization method | def get_weights(fs, W_init=None, std_scale=0.4):
if W_init == None:
stddev = std_scale*np.sqrt(2.0 / np.prod(fs[:3]))
W_init = torch.normal(torch.zeros(*fs), stddev)
W_init = nn.Parameter(W_init)
return W_init | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _initialize_weights(self):\n pass",
"def init_weights_(self):\n raise NotImplementedError",
"def init_weight(self):\n init_bn(self.norm0)",
"def init_weights(self):\n # Initialize weights\n self.apply(self._init_weights)",
"def setWeightInitializer(self,weights):\n ... | [
"0.84351933",
"0.83029956",
"0.82767093",
"0.82620287",
"0.82098764",
"0.81617516",
"0.810246",
"0.80302036",
"0.79046226",
"0.78775537",
"0.78557485",
"0.7802045",
"0.7782881",
"0.77632976",
"0.77632976",
"0.77632976",
"0.7734256",
"0.7727934",
"0.77277565",
"0.770799",
"0.7... | 0.0 | -1 |
If no symbols are provided at initialization, the get_symbols method must be implemented to return a pandas DataFrame containing all | def get_symbols(self):
raise NotImplementedError('''
Must implement get_symbols. Call help() for details.
''') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_symbols(self):\n\n symbols = self.get_symbols()\n\n if isinstance(symbols, dict):\n keys = ['symbol', 'from_symbol', 'to_symbol']\n correct_keys = np.isin(keys, list(symbols.keys())).all()\n\n if not correct_keys:\n raise ImplementationError(''... | [
"0.80878913",
"0.68316513",
"0.6801852",
"0.6721141",
"0.6611969",
"0.6606819",
"0.6595123",
"0.6579887",
"0.651697",
"0.6495848",
"0.6485053",
"0.6475171",
"0.6351629",
"0.62744075",
"0.6126246",
"0.61093897",
"0.6075509",
"0.60509646",
"0.6019992",
"0.59519726",
"0.5887002"... | 0.6196945 | 14 |
Always access the most recent candle at index 0. Previous candles are accessed with negative indices, future candles can be accessed with positive indices. | def __getitem__(self, ind):
try:
if isinstance(ind, slice):
if ind.start is None:
start = self.increments
else:
start = ind.start + self.increments
if ind.stop is not None:
stop = ind.stop +... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def last_candle(self):\r\n if self.length() > 0:\r\n return self.candles[0]\r\n else:\r\n return None",
"def current_candle(self) -> np.ndarray:\n return store.candles.get_current_candle(self.exchange, self.symbol, self.timeframe).copy()",
"def candle(self, tf):\n ... | [
"0.7291005",
"0.6713927",
"0.623623",
"0.60898834",
"0.59344566",
"0.5913107",
"0.58321893",
"0.58204764",
"0.5768636",
"0.5706866",
"0.56495655",
"0.56428224",
"0.5640457",
"0.56308943",
"0.5605227",
"0.5591777",
"0.5584027",
"0.55770105",
"0.5507971",
"0.54849386",
"0.54729... | 0.5483909 | 20 |
Format dict items for insert into database. Add parentheses around strings Convert None values to NULL Format dates to be friendly with SQL | def _format_sql(self, trade, table):
trade = copy(trade)
for key, value in trade.items():
if value is None:
trade[key] = 'NULL'
elif key == 'date':
value = tb.DateConvert(value).date
if isinstance(value, str):
trade[k... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getSQL_insert_ex(table, dict):\n ks = ''\n vs = ''\n for k, v in dict.items():\n ks += k + ','\n if v == None:\n v = 'null'\n if isNumber(v) or v == 'null':\n vs += str(v) + ','\n elif str(type(v)) == \"<type 'datetime.datetime'>\":\n vs += ... | [
"0.6530106",
"0.5916978",
"0.57795197",
"0.57503706",
"0.57258403",
"0.57234854",
"0.5677246",
"0.55689216",
"0.55477214",
"0.55391544",
"0.55193925",
"0.55130184",
"0.5503758",
"0.54752034",
"0.5473884",
"0.5454496",
"0.5451125",
"0.5421715",
"0.5420659",
"0.5408431",
"0.540... | 0.65261436 | 1 |
Constructor of class KernelProfiler. | def __init__(self):
self._profiling_mode = False
self._total_time_ms = 0.0
self._traced_records = []
self._statistical_results = {} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, device, profiler: Profiler, delay, util_level, memory_level):\n super(UtilMonitor, self).__init__()\n self.stopped = False\n self.delay = delay\n self.memory_level = memory_level\n self.util_level = util_level\n self.profiler = profiler\n self.exp... | [
"0.6559333",
"0.6542613",
"0.6542613",
"0.6464899",
"0.63895094",
"0.6375437",
"0.63028336",
"0.6295529",
"0.6295529",
"0.6250019",
"0.62211204",
"0.62184936",
"0.6145511",
"0.6088729",
"0.6069569",
"0.6044071",
"0.6040585",
"0.5972022",
"0.5961061",
"0.592163",
"0.59164476",... | 0.6258154 | 9 |
Return a dictionary of cliques of index numbers | def getSHSCliques():
m = getSHSIDDict()
fin = open("SHSDataset/Chromas/shs_nodup.txt")
cliques = {}
currClique = ""
for l in fin.readlines():
l = l.rstrip()
if l[0] == '%':
currClique = l[1::]
cliques[currClique] = []
else:
cliques[currCliq... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cliques(self):\n if (self.weights < 0).any():\n raise ValueError('cliques definition require a positive graph')\n\n cliques, size = - np.ones(self.V), np.zeros(self.V)\n adj = self.to_coo_matrix()\n\n for k in range(self.V):\n u = cliques < 0\n w = n... | [
"0.63887805",
"0.61562526",
"0.61562526",
"0.60246176",
"0.59754986",
"0.586457",
"0.57800156",
"0.56885934",
"0.5667188",
"0.56545395",
"0.56489956",
"0.5601298",
"0.5590684",
"0.55898494",
"0.55736256",
"0.5551016",
"0.55498683",
"0.55378133",
"0.55335975",
"0.5527648",
"0.... | 0.5903434 | 5 |
Removes stop words. Takes tokenised document as input and returns after removing the stop words. | def remove_stop_words(document):
stop_words = stopwords.words("english")
stop_words = set(stop_words + EXTENDED_STOP_WORDS)
return [token for token in document if token not in stop_words] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_stopwords_fun(self):\n tokens = str(self.doc).split()\n cleaned_tokens = [token for token in tokens\n if token.lower() not in self.stopword_list]\n self.doc = ' '.join(cleaned_tokens)",
"def remove_stopwords(document):\n return list(filter(lambda x:... | [
"0.8235641",
"0.7785829",
"0.75821036",
"0.7564666",
"0.74388725",
"0.7348953",
"0.7327749",
"0.7270899",
"0.7247211",
"0.7221273",
"0.7151942",
"0.7123079",
"0.71175766",
"0.70857203",
"0.70828223",
"0.70740896",
"0.70679337",
"0.7046249",
"0.7023994",
"0.6978203",
"0.696442... | 0.80519545 | 1 |
Updates an existing subnetMode in the subnetMode list | def update(oid, subnetModeDetails):
app.logger.debug(pformat(subnetModeDetails))
if 'id' in subnetModeDetails and subnetModeDetails['id'] != oid:
abort(400, f"Key mismatch in path and body")
existing_subnetMode = SubnetMode.query.filter(SubnetMode.id == oid).one_or_none()
if existing_subn... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fusion_api_edit_ipv4_subnet(self, body, uri, api=None, headers=None):\n return self.ipv4subnet.update(body, uri, api, headers)",
"def update_subnet(\n self,\n name_or_id,\n subnet_name=None,\n enable_dhcp=None,\n gateway_ip=None,\n disable_gateway_ip=None,... | [
"0.6053171",
"0.6015315",
"0.57282734",
"0.5635663",
"0.56010103",
"0.5571232",
"0.5538331",
"0.5336969",
"0.5332859",
"0.5295378",
"0.52160466",
"0.5172271",
"0.5140886",
"0.51292026",
"0.5088743",
"0.50559473",
"0.50502706",
"0.5047121",
"0.4890022",
"0.48803335",
"0.487327... | 0.74095774 | 0 |
Sends the visitor to the homepage | def home(request):
logger.warning('home view: ' + request.META.get('REMOTE_ADDR'))
return render(request, template_name='home.html') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def homepage():\n return redirect('index.html')",
"def homepage():\n if g.user:\n return redirect(f\"/user/{g.user.id}\")\n else:\n return redirect(\"/landing\")",
"def _send_homepage(self, message=''):\n template_filename = self._get_config_template('homepage')\n text = re... | [
"0.77156043",
"0.7713141",
"0.74452454",
"0.74444497",
"0.7326072",
"0.72864467",
"0.7120027",
"0.7120027",
"0.7108005",
"0.70969886",
"0.70969886",
"0.70969886",
"0.70608026",
"0.7043188",
"0.6970738",
"0.6929818",
"0.6921541",
"0.6890987",
"0.6862449",
"0.68463635",
"0.6845... | 0.64584696 | 54 |
Extract a json object string from the file. | def __get_json(self):
buffer = b''
start = self.__descriptor.tell()
for cur_char in iter(lambda: self.__descriptor.read(1), b''):
buffer += cur_char
if cur_char == b'\n' and len(buffer) >= 2:
return buffer, start
return (None, -1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_json_to_object(file_content):\n object = json.loads(file_content)\n print(object)\n return object",
"def get_json_str(self):\n\n with open(self.path, mode='r', encoding='utf-8') as file:\n return file.read()",
"def JSONtoObject(fileName):\n # TODO: ensure file exists f... | [
"0.73219836",
"0.73119885",
"0.6843997",
"0.6795677",
"0.6768826",
"0.6749705",
"0.6742158",
"0.66949815",
"0.6691608",
"0.6677377",
"0.66593885",
"0.6649605",
"0.65960526",
"0.65833884",
"0.6581967",
"0.65183437",
"0.6516782",
"0.6505484",
"0.64995486",
"0.64845383",
"0.6470... | 0.0 | -1 |
Test prometheus metrics for sensors without a unit. | async def test_sensor_without_unit(client, sensor_entities) -> None:
body = await generate_latest_metrics(client)
assert (
'sensor_state{domain="sensor",'
'entity="sensor.trend_gradient",'
'friendly_name="Trend Gradient"} 0.002' in body
)
assert (
'sensor_state{domain="... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_unit_of_measurement(self):\n for name in self.sensor_dict:\n sensor = self.sensor_dict[name][\"sensor\"]\n assert self.sensor_dict[name][\"units\"] == sensor.unit_of_measurement",
"def test_no_source_measurements(self):\n measurement = self.measurement(self.metric())\... | [
"0.6711673",
"0.664968",
"0.65178615",
"0.63803923",
"0.6341762",
"0.6289246",
"0.6220286",
"0.621524",
"0.6179922",
"0.6102839",
"0.61004436",
"0.6090619",
"0.605583",
"0.6029158",
"0.5986393",
"0.59756714",
"0.5906032",
"0.5874322",
"0.5867102",
"0.5855048",
"0.5849202",
... | 0.72450906 | 0 |
Extracts boundingboxes and vehicle position from heatmap. | def extract_vehicles(self):
heatmap_threshed = apply_threshold(self.avg_heatmap, 7)
labels = label(heatmap_threshed)
self.binary_map = labels[0]
self.number_of_found_cars = labels[1] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getBoxFromHeatMap(heatmap):\n boxes_batch = []\n heatmap = heatmap.detach().cpu().numpy().astype(np.uint8)\n for gray in heatmap:\n thresh = cv2.threshold(gray, 0, 255, cv2.THRESH_BINARY + cv2.THRESH_OTSU)[1]\n cnts = cv2.findContours(thresh, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)\n... | [
"0.65263146",
"0.63163286",
"0.62290186",
"0.6218644",
"0.61942416",
"0.61117744",
"0.6044877",
"0.5930842",
"0.59139055",
"0.5901827",
"0.58514345",
"0.5828251",
"0.5824584",
"0.58189094",
"0.578777",
"0.5782589",
"0.5758676",
"0.57479143",
"0.5721279",
"0.5714938",
"0.57029... | 0.6413552 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.