query stringlengths 9 9.05k | document stringlengths 10 222k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 4 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
Creates Payment object and inserts it into payments and calendar_dict dictionaries | def insert_payment(pd, p_d, v):
# if the payment comes on Saturday or Sunday it needs to be moved to the following Monday
# print(p_d.strftime("%a"), v[2])
if p_d.strftime("%a") == "Sat":
if v[0] != "income":
p_d += timedelta(days=2)
else:
p_d += timedelta(days=-1)
elif p_d.strftime("%a") == "... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __create_payment_object(self, data, direction):\n\n from_account = self.__fetch_user_account(guid=data.get(\"from_account\"))\n to_account = self.__fetch_user_account(guid=data.get(\"to_account\"))\n payment_obj = Payment.objects.create(\n from_account=from_account,\n ... | [
"0.6879426",
"0.6773166",
"0.6654871",
"0.6633026",
"0.6507683",
"0.6451418",
"0.63807976",
"0.6169329",
"0.6025975",
"0.5998034",
"0.59671605",
"0.59548116",
"0.58228517",
"0.5809443",
"0.5796723",
"0.5771216",
"0.57690984",
"0.57283247",
"0.56926143",
"0.56863284",
"0.56641... | 0.6948596 | 0 |
Calculates the date of next payment | def calculate_next_payment(frequency, payment_date, payment_month):
if frequency == 1 or frequency == 4: # weekly or four-weekly
next_payment = payment_date + timedelta(weeks=frequency)
elif frequency == 2: # monthly
next_payment = payment_date.replace(month=payment_month + 1)
else:
next_payment = date... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next_payment_date(ddates,clo_idx):\n dd = ddates.loc[ddates['Fund']==clo_idx,'Payment Date'].dropna()\n next_date = min(dd.loc[dd>pd.Timestamp.today()], key=lambda s: (s-pd.Timestamp.today()))\n return next_date",
"def get_next_day(self):\n pass",
"def getNextDate(self, currentDate, startDa... | [
"0.7433205",
"0.6795298",
"0.65877426",
"0.6489073",
"0.6465959",
"0.62965876",
"0.62965876",
"0.6240347",
"0.61208355",
"0.6090303",
"0.6084158",
"0.60668296",
"0.5978853",
"0.59466577",
"0.59328806",
"0.5930606",
"0.586793",
"0.58227724",
"0.58226556",
"0.5747989",
"0.57298... | 0.7759085 | 0 |
Returns all currently active WETH, DAI trading pairs from RadarRelay, sorted by volume in descending order. | async def get_active_exchange_markets(cls) -> pd.DataFrame:
async with aiohttp.ClientSession() as client:
async with client.get("https://api.radarrelay.com/v2/markets?include=ticker,stats") as response:
response: aiohttp.ClientResponse = response
if response.status !=... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def orderPairs(self):\n pairsByTickers = {}\n for asset in self.availableTickers:\n holder = []\n for pair in self.allPairs:\n if asset in pair:\n holder.append(pair)\n if asset == \"XBT\":\n asset = \"BTC\"\n pairsByTickers[asset] = holder\n return pairsByTicker... | [
"0.6020138",
"0.5931645",
"0.5886478",
"0.58822364",
"0.587491",
"0.587491",
"0.5840516",
"0.57838076",
"0.5733189",
"0.5724331",
"0.5704242",
"0.5565261",
"0.5549689",
"0.54871327",
"0.54514384",
"0.5447653",
"0.5447653",
"0.5440922",
"0.5426503",
"0.5414961",
"0.5390926",
... | 0.6141562 | 0 |
Shortcut to get the timestamp of creation from the associated viztrail. Returns datetime.datetime | def created_at(self):
return self.viztrail.created_at | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"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 return pulumi.get(self, \"creation_timestamp\")",
"def creation_times... | [
"0.7309031",
"0.7309031",
"0.7309031",
"0.71911854",
"0.7139708",
"0.71332854",
"0.6996609",
"0.69703984",
"0.6948962",
"0.69043696",
"0.69043696",
"0.69043696",
"0.68927425",
"0.68557465",
"0.6842769",
"0.6820319",
"0.68012255",
"0.68012255",
"0.67999786",
"0.67955315",
"0.6... | 0.768497 | 0 |
Shortcut to access the handle for the default branch of the viztrail. Returns vizier.viztrail.branch.BranchHandle | def get_default_branch(self) -> Optional[BranchHandle]:
return self.viztrail.get_default_branch() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def default_branch(self) -> str:\n return pulumi.get(self, \"default_branch\")",
"def _branch(self):\n printer = Printer(None)\n ci_manager = CIManager(printer)\n return ci_manager.get_branch()",
"def annotate_default_branch(self) -> Optional[str]:\n return pulumi.get(self, \... | [
"0.7352948",
"0.65347147",
"0.6534301",
"0.6531816",
"0.6475084",
"0.6403101",
"0.6373743",
"0.6373743",
"0.63670087",
"0.63385564",
"0.6294638",
"0.61008275",
"0.5968854",
"0.59148514",
"0.58313274",
"0.5797417",
"0.57678205",
"0.56777203",
"0.5628537",
"0.5589919",
"0.55791... | 0.85824406 | 0 |
Shortcut to get the last modified timestamp from the associated viztrail. Returns datetime.datetime | def last_modified_at(self):
return self.viztrail.last_modified_at | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def last_modified_date_time(self):\n if \"lastModifiedDateTime\" in self._prop_dict:\n return datetime.strptime(self._prop_dict[\"lastModifiedDateTime\"].replace(\"Z\", \"\"), \"%Y-%m-%dT%H:%M:%S.%f\")\n else:\n return None",
"def last_modified_at(self) -> str:\n return... | [
"0.7255543",
"0.70873946",
"0.70873946",
"0.70550275",
"0.70550275",
"0.70550275",
"0.70550275",
"0.70550275",
"0.70550275",
"0.7025244",
"0.69686234",
"0.69440866",
"0.69170964",
"0.69170964",
"0.6856861",
"0.6835724",
"0.68223417",
"0.673016",
"0.6713541",
"0.6686191",
"0.6... | 0.8063814 | 0 |
Shortcut to get the name of the associated viztrail. Returns string | def name(self):
return self.viztrail.name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def identifier(self):\n return self.viztrail.identifier",
"def name(self) -> str:",
"def name(self) -> str:",
"def name(self) -> str:",
"def name(self) -> str:",
"def name(self) -> str:",
"def chain_name(self) -> str:\n return pulumi.get(self, \"chain_name\")",
"def _getName(self):\n ... | [
"0.68889725",
"0.6315612",
"0.6315612",
"0.6315612",
"0.6315612",
"0.6315612",
"0.6269133",
"0.6245069",
"0.62348735",
"0.6233859",
"0.61770207",
"0.6174089",
"0.6174089",
"0.6174089",
"0.6174089",
"0.6174089",
"0.6174089",
"0.61231196",
"0.6110759",
"0.6110759",
"0.6104985",... | 0.8530185 | 0 |
iround(number) > integer Round a number to the nearest integer. | def iround(x):
return int(round(x) - .5) + (x > 0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def iround(x):\n return ipart(x + 0.5)",
"def py3round(number):\n if abs(round(number) - number) == 0.5:\n return int(2.0 * round(number / 2.0))\n\n return int(round(number))",
"def intround(value):\n\n return int(decimal.Decimal.from_float(\n value).to_integral_value(decimal.ROUND_HA... | [
"0.7389933",
"0.72023886",
"0.7078816",
"0.69114375",
"0.67931277",
"0.67241484",
"0.66976315",
"0.6692895",
"0.6591573",
"0.6540665",
"0.6437459",
"0.63457483",
"0.63309073",
"0.6326138",
"0.6252926",
"0.62305367",
"0.622852",
"0.6227941",
"0.6171477",
"0.61236835",
"0.61197... | 0.76166797 | 0 |
Returns True iff we're running 3 or above. | def is_running_py3():
return sys.version_info >= (3, 0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Is3State(self):\r\n\r\n return self._is3State",
"def is_version_3_or_newer() -> bool:\n if is_apptainer_1_or_newer():\n return True # this is equivalent to singularity-ce > 3.9.5\n v = get_version()\n return v[0][0] >= 3",
"def is_py3() -> bool:\n return sys.version_info[0] == 3"... | [
"0.68199235",
"0.67762226",
"0.64582723",
"0.64229655",
"0.63732725",
"0.63422996",
"0.62496734",
"0.6238763",
"0.61897165",
"0.6138985",
"0.6088507",
"0.59867245",
"0.59689456",
"0.5873395",
"0.5867916",
"0.583585",
"0.5751196",
"0.5714794",
"0.57140267",
"0.5696568",
"0.569... | 0.713675 | 0 |
Cleans scene AND image | def clean_all(self):
self.scene.clear()
self.image.fill(Qt.color0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def applyMorphologicalCleaning(self, image):",
"def clean(img):\n\n label_img = label(img, connectivity=2)\n props = sorted(regionprops(label_img), key=lambda x: x.area)\n clean = morphology.binary_closing(img)\n\n clean = morphology.remove_small_holes(clean)\n return morphology.remove_small_objec... | [
"0.7333336",
"0.6844621",
"0.6532143",
"0.6379618",
"0.62751454",
"0.6244243",
"0.61098284",
"0.6098652",
"0.6041597",
"0.6019457",
"0.60042465",
"0.60027266",
"0.58839554",
"0.58726555",
"0.5869433",
"0.5842643",
"0.5825123",
"0.5821873",
"0.5818286",
"0.5785087",
"0.5776219... | 0.7452942 | 0 |
Checks data of all "Circle" lineEdits | def check_circle(self) -> list or None:
x_text = self.ui.lineEditCX.text()
xc = float(x_text) if checker.check_float(x_text) else None
y_text = self.ui.lineEditCY.text()
yc = float(y_text) if checker.check_float(y_text) else None
radius_text = self.ui.lineEditRad.text()
r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate(self):\n self.pltw.blklst[self.blkno][self.ypos] = self.data[2]\n self.pltw.updatePlot()\n self.pltw.dirty = True\n self.pltw.activecurv = self.cpos\n self.parent.updateUI()\n self.hide()",
"def validate(self):\n self.pltw.blklst[self.blkno][self.ypos... | [
"0.59188396",
"0.59188396",
"0.58268094",
"0.5669372",
"0.5626912",
"0.5613902",
"0.5582208",
"0.54520327",
"0.54148126",
"0.5408726",
"0.5390036",
"0.5306971",
"0.5292457",
"0.52674073",
"0.5255503",
"0.52450013",
"0.52442425",
"0.5240309",
"0.52016306",
"0.5183017",
"0.5182... | 0.6901295 | 0 |
Checks data of all "Ellipse" lineEdits | def check_ellipse(self) -> list or None:
x_text = self.ui.lineEditEX.text()
xc = float(x_text) if checker.check_float(x_text) else None
y_text = self.ui.lineEditEY.text()
yc = float(y_text) if checker.check_float(y_text) else None
a_text = self.ui.lineEditEA.text()
a = fl... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def onMouseEdit(self, event):\n\n data = self.app.data\n axes = self.hemisphereMat.figure.axes[0].axes\n\n if not event.inaxes:\n return False\n if event.dblclick:\n return False\n\n if self.ui.checkEditHorizonMask.isChecked():\n suc = self.editHo... | [
"0.6150473",
"0.6135208",
"0.6135208",
"0.6127888",
"0.586455",
"0.5858253",
"0.5804009",
"0.56632715",
"0.5594191",
"0.55856705",
"0.5563253",
"0.55094945",
"0.5487261",
"0.5434579",
"0.5420667",
"0.53788364",
"0.5312586",
"0.5274789",
"0.5227319",
"0.51999813",
"0.5199439",... | 0.6878594 | 0 |
User chooses colour in QColorDialog. Colour of frame sets chosen colour. | def choose_colour(self) -> None:
self.chosen_colour = QtWidgets.QColorDialog.getColor(Qt.white, self, "Выберите цвет")
self.pen_colour = self.chosen_colour
self.palette.setColor(QPalette.Background, self.chosen_colour)
self.ui.frame.setPalette(self.palette) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pickColour(self):\n colour = QColorDialog.getColor()\n if colour.isValid():\n self.user[\"Colour\"] = colour.name()\n self.ui.l_colour.setText(self.user[\"Colour\"])",
"def set_color(self):\n new_color = QColorDialog.getColor(QColor(self.config['color']))\n i... | [
"0.7701105",
"0.72356415",
"0.7098552",
"0.70294017",
"0.67967963",
"0.6747656",
"0.67393136",
"0.670938",
"0.642972",
"0.635842",
"0.63369894",
"0.62803185",
"0.6257249",
"0.6150854",
"0.6150525",
"0.61227363",
"0.6103477",
"0.60686284",
"0.60277545",
"0.6026457",
"0.600809"... | 0.7752894 | 0 |
Changes colour of pen (using radio buttons) | def change_colour(self) -> None:
if self.ui.radioButtonWhite.isChecked():
self.pen_colour = QColor(Qt.white)
elif self.ui.radioButtonColour.isChecked():
self.pen_colour = self.chosen_colour
else: # Impossible but better to control
message.show_error(config.PR... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_ctrl_color(self):\n for shape in self.ctrl.getShapes():\n if self.color == \"yellow\":\n shape.overrideEnabled.set(True)\n shape.overrideColor.set(17)\n elif self.color == \"blue\":\n if self.side == \"l\":\n shap... | [
"0.67311746",
"0.6471926",
"0.63548684",
"0.61140573",
"0.60964775",
"0.6093778",
"0.60788023",
"0.6017284",
"0.6007782",
"0.59987",
"0.5988689",
"0.59858084",
"0.5963216",
"0.59543246",
"0.59498775",
"0.5940508",
"0.59368354",
"0.59144765",
"0.59009916",
"0.5892124",
"0.5877... | 0.78907454 | 0 |
Return the Pants binary name, e.g. './pants'. | def bin_name() -> str:
# NB: This will be called at import-time in several files to define static help strings
# (e.g. "help=f'run `{bin_name()} fmt`").
#
# Ideally, we'd assert this is set unconditionally before Pants imports any of the files which
# use it, to give us complete confidence we won't ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_binary_name():\n return os.path.basename(inspect.stack()[-1][1])[:16]",
"def _compute_program_name():\n program_path = os.path.abspath(sys.argv[0])\n if os.path.exists(program_path):\n return os.path.basename(program_path)\n else:\n match = re.match(r\"^.*(?:\\.egg|\\.tar|\\.tar... | [
"0.69405246",
"0.6692868",
"0.64254904",
"0.6358298",
"0.63058317",
"0.6304578",
"0.62618613",
"0.61928815",
"0.6177648",
"0.6075139",
"0.6065504",
"0.60604537",
"0.59751827",
"0.5969322",
"0.59558976",
"0.59449834",
"0.5916541",
"0.5888735",
"0.588248",
"0.5875634",
"0.58539... | 0.85247946 | 0 |
Determine if evolution is positive or negative. From trend type determined in config.toml for each KPIs, picking right color to return | def get_color(val, trendType):
if(val > 0):
if(trendType == 'normal'):
color = 'red'
else:
color = 'green'
elif(val < 0):
if(trendType == 'normal'):
color = 'green'
else:
color = 'red'
else:
color = 'blue'
return col... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def color_negative_red(val):\n if val == 'k':\n color = 'red' \n else:\n color = 'yellow'\n return ['color: %s' % color]*3",
"def mode(v_o, Vcc):\n if v_o == Vcc:\n return \"positive saturation\"\n if v_o >= -Vcc and v_o <= Vcc:\n return \"linear region\"\n if v_o == -V... | [
"0.60399747",
"0.5877519",
"0.5805606",
"0.56389576",
"0.563034",
"0.56299514",
"0.56106067",
"0.5582483",
"0.5578254",
"0.5539337",
"0.5500503",
"0.5496759",
"0.5471038",
"0.5451227",
"0.54348415",
"0.5384863",
"0.53809255",
"0.53338456",
"0.5333428",
"0.53224057",
"0.532228... | 0.64136356 | 0 |
Calculate rolling average from a column. We apply mean for each values of a specific column within the range of last week date and date itself | def get_rolling_average(date, df, column):
lowestDate = datetime.strftime(
datetime.strptime(date, "%Y-%m-%d") - timedelta(days=6), "%Y-%m-%d"
)
return df[
(df['date'] >= lowestDate)
&
(df['date'] <= date)
].mean()[column].mean().round(0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_rolling_average(df, level, code_level, trendType, column):\n df = df.sort_values(by=['date'])\n df = df.reset_index(drop=True)\n\n df['date_7days_ago'] = df['date'].apply(lambda x: datetime.strftime(\n datetime.strptime(x, \"%Y-%m-%d\") - timedelta(days=7), \"%Y-%m-%d\"\n ))\n df[... | [
"0.7191205",
"0.7113405",
"0.7069829",
"0.69824106",
"0.6897152",
"0.67890257",
"0.6559756",
"0.64659315",
"0.6439951",
"0.64124846",
"0.64092994",
"0.6393626",
"0.6359574",
"0.61933124",
"0.61762893",
"0.6158098",
"0.6112367",
"0.6096859",
"0.6073577",
"0.5938104",
"0.586631... | 0.79241586 | 0 |
Enrich dataframe for KPIs that need to be calculated. | def enrich_dataframe(df, name):
if(name == 'taux_incidence'):
df['taux_incidence'] = df['P']*100000/df['pop']
if(name == 'taux_positivite'):
df['taux_positivite'] = df['P']/df['T'] * 100
if(name == 'taux_occupation'):
df['TO'] = df['TO']*100
if(name == 'vaccins_vaccines_couv_maje... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def augment_dataframe(self, df: pd.DataFrame) -> pd.DataFrame:",
"def compute_KPIs(global_data): \r\n cols = ['energy_ratio', 'peak_ratio', 'peak_increase', 'coincident_peak_ratio']\r\n energy_ratio = global_data.Tot_ev_charge_MWh / global_data.Base_load_MWh\r\n peak_ratio = global_data.Max_ev_load_MW... | [
"0.60041434",
"0.5945469",
"0.5752134",
"0.5715605",
"0.56584",
"0.5653557",
"0.56351376",
"0.5605897",
"0.55825084",
"0.55776066",
"0.55460554",
"0.5431908",
"0.539235",
"0.5385006",
"0.5332642",
"0.5295038",
"0.5284044",
"0.5279578",
"0.52715886",
"0.5269781",
"0.52678436",... | 0.613295 | 0 |
Redirect to good function depending of type of KPI needed. If mean param is set to True, we need to calculate the mean of kpis, if not, we calculate the stock. | def get_kpi_by_type(df, level, code_level, trendType, column, mean):
if(mean):
res = process_rolling_average(df, level, code_level, trendType, column)
else:
res = process_stock(df, level, code_level, trendType, column)
return res | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def do(self, x, typ):\n try:\n mean,stddev = self.mean_stddev()\n except StdDevFilterException:\n self.insert_value(x)\n return x,True\n\n self.insert_value(x)\n\n # limit dispersion, refuse new value when too far away from mean\n e = abs(x-mean)\... | [
"0.532095",
"0.52209705",
"0.50066227",
"0.49225327",
"0.47823226",
"0.4671258",
"0.4651064",
"0.46501303",
"0.46489456",
"0.4619085",
"0.4607537",
"0.4603706",
"0.45960405",
"0.4590251",
"0.4583828",
"0.4579666",
"0.45673484",
"0.45615372",
"0.45444584",
"0.45282876",
"0.452... | 0.6064281 | 0 |
Print statistics about a set of samples and associated values | def print_statistics(samples, values=None, sample_labels=None, value_labels=None):
num_vars, nsamples = samples.shape
if values is None:
values = np.empty((nsamples, 0))
if values.ndim == 1:
values = values[:, np.newaxis]
num_qoi = values.shape[1]
assert nsamples == values.shape[0]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def statistics(self, **kwargs) -> None:\n print(\n tabulate.tabulate(\n list(self._iter_statistics(**kwargs)),\n headers=[\"path\", \"type\", \"occurences\", \"%\"],\n floatfmt=\".3f\",\n )\n )",
"def report_univariate_statistics(\n... | [
"0.6835751",
"0.6819233",
"0.67857766",
"0.67386353",
"0.6711829",
"0.6711829",
"0.6588999",
"0.6486744",
"0.64457613",
"0.64344406",
"0.64229375",
"0.64184666",
"0.6393423",
"0.6386702",
"0.63683987",
"0.6355621",
"0.63401276",
"0.6311194",
"0.62842155",
"0.6282713",
"0.6280... | 0.7330248 | 0 |
r""" discrete_sampling samples iid from a discrete probability measure x = discrete_sampling(N, prob, states) Generates N iid samples from a random variable X whose probability mass function is prob(X = states[j]) = prob[j], 1 <= j <= length(prob). If states is not given, the states are gives by 1 <= state <= length(pr... | def discrete_sampling(N, probs, states=None):
p = probs.squeeze()/np.sum(probs)
bins = np.digitize(
np.random.uniform(0., 1., (N, 1)), np.hstack((0, np.cumsum(p))))-1
if states is None:
x = bins
else:
assert(states.shape[0] == probs.shape[0])
x = states[bins]
retu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sample_discrete(probs):\r\n q = np.random.rand()\r\n i = 0\r\n p_sum = 0.0\r\n while p_sum < q:\r\n p_sum += probs[i]\r\n i += 1\r\n return i - 1",
"def discrete_sample(p, n_samples=None, rng=np.random):\n\n # check distribution\n # assert isdistribution(p), 'Probabilities ... | [
"0.6683602",
"0.6489076",
"0.61889535",
"0.61316246",
"0.6102204",
"0.6102204",
"0.60995114",
"0.6087327",
"0.60820955",
"0.6061561",
"0.5963863",
"0.595059",
"0.59159184",
"0.5915189",
"0.58750856",
"0.583664",
"0.5833728",
"0.5701178",
"0.56925476",
"0.5681384",
"0.5664307"... | 0.76086926 | 0 |
Print all values present in Elements of LinkedList | def printlist(self):
current_element = self.head
items = []
while current_element:
items.append(current_element.value)
current_element = current_element.next
return items | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def display(self):\r\n elems = [] #create a list of elements we've seen\r\n current_node = self.head\r\n while current_node.next!=None:\r\n current_node = current_node.next\r\n elems.append(current_node.data)\r\n print(elems)",
"def printList(head) :\n \n #... | [
"0.7255951",
"0.6938815",
"0.69017535",
"0.68561095",
"0.683809",
"0.68377066",
"0.68253607",
"0.6793233",
"0.663563",
"0.6634199",
"0.6616951",
"0.6602275",
"0.65114534",
"0.6479362",
"0.63025665",
"0.6300113",
"0.6282193",
"0.6250229",
"0.61935717",
"0.6148698",
"0.6092107"... | 0.70002204 | 1 |
Gets the appropriate input form for the inference procedure. | def _get_encoding_form(self, input):
if self.inference_procedure == 'direct':
return input
else:
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_input_spec(self):\r\n return self.input_spec",
"def infer(self, input):\n input = self._get_encoding_form(input)\n input = self.inference_model(input)\n self.latent.infer(input)",
"def _get_input_type(self):\n return self.__input_type",
"def _get_input_type(self):\n ... | [
"0.6392555",
"0.6370036",
"0.6303012",
"0.6303012",
"0.6303012",
"0.6303012",
"0.6303012",
"0.6303012",
"0.62150043",
"0.62150043",
"0.62150043",
"0.62150043",
"0.62150043",
"0.62150043",
"0.62150043",
"0.6213218",
"0.6213218",
"0.6154365",
"0.6144052",
"0.5930271",
"0.591819... | 0.6727498 | 0 |
Method to step the latent level forward in the sequence. | def step(self):
self.latent.step() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def step_forward(self):",
"def _step(self) -> None:",
"def _step(self):\n pass",
"def step(self, state):",
"def Step(self, *args):\n return _gmat_py.Propagator_Step(self, *args)",
"def forward(self, x):\n #delete all cts\n #self.cts = [self.cts[-1]]\n \n #forward... | [
"0.7531539",
"0.6935163",
"0.66754544",
"0.6579459",
"0.65188086",
"0.6499142",
"0.6437524",
"0.6417273",
"0.63902676",
"0.63867617",
"0.6366798",
"0.6366798",
"0.6366798",
"0.6322307",
"0.6297307",
"0.62945026",
"0.6283755",
"0.6281825",
"0.6279097",
"0.6246451",
"0.62265515... | 0.76447576 | 0 |
Method to reinitialize the latent level (latent variable and any state variables in the generative / inference procedures). | def re_init(self):
self.latent.re_init()
if 're_init' in dir(self.inference_model):
self.inference_model.re_init()
if 're_init' in dir(self.generative_model):
self.generative_model.re_init() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize_state(self):\n # Initialize everything to zero\n self.stateC = self.initializer((self.nSym, 1))\n self.stateC_prev = self.initializer((self.nSym, 1))\n self.state = self.toNeural(self.stateC)\n self.state_prev = self.toNeural(matrix=self.stateC_prev)\n self.... | [
"0.65100133",
"0.62601316",
"0.61615443",
"0.6153782",
"0.61478114",
"0.6141605",
"0.6097956",
"0.60701734",
"0.60573614",
"0.6051342",
"0.600862",
"0.6008001",
"0.5994804",
"0.59624213",
"0.59519863",
"0.5937408",
"0.5918468",
"0.58859736",
"0.5878467",
"0.5875771",
"0.58685... | 0.7167877 | 0 |
Method to obtain inference parameters. | def inference_parameters(self):
params = nn.ParameterList()
if 'parameters' in dir(self.inference_model):
params.extend(list(self.inference_model.parameters()))
params.extend(list(self.latent.inference_parameters()))
return params | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inference(self):\n raise NotImplementedError",
"def inference_step(self, batch: Any, **kwargs) -> Dict[str, Any]:\n return self.model.inference_step(batch, **kwargs)",
"def inference_preprocess(self):\n return",
"def inference(model, data, diagnostics, seed, extra_fitting_args):\n ... | [
"0.6983472",
"0.6261584",
"0.62586355",
"0.6230433",
"0.60727566",
"0.6020049",
"0.5915736",
"0.59034073",
"0.5896967",
"0.5839413",
"0.58256936",
"0.58104825",
"0.58099115",
"0.58036804",
"0.579567",
"0.577649",
"0.57525986",
"0.57341915",
"0.5728228",
"0.5728228",
"0.572822... | 0.7889634 | 0 |
Method to obtain generative parameters. | def generative_parameters(self):
params = nn.ParameterList()
if 'parameters' in dir(self.generative_model):
params.extend(list(self.generative_model.parameters()))
params.extend(list(self.latent.generative_parameters()))
return params | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __parameters__(self) -> tuple[TypeVar, ...]:\n return super().__getattribute__(\"_parameters\")",
"def get_params(self):",
"def get_params(self, deep=...):\n ...",
"def params(self) -> Tuple[Parameter, ...]:\n raise NotImplementedError()",
"def get_params(self):\n raise NotI... | [
"0.70768934",
"0.7074074",
"0.70397735",
"0.6965139",
"0.69088066",
"0.68825054",
"0.6806639",
"0.6784682",
"0.6748244",
"0.673298",
"0.6629831",
"0.6622723",
"0.656692",
"0.6548635",
"0.6516121",
"0.6502947",
"0.6490068",
"0.6452259",
"0.6438281",
"0.6438281",
"0.6438281",
... | 0.74628377 | 0 |
Filter this queryset to select status objects as of status_date. | def filter_status_as_of(self, status_date: datetime.date) -> QuerySet:
return self.model._filter_queryset_status_as_of(self, status_date) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _filter_queryset_status_as_of(cls, queryset: QuerySet, status_date: datetime.date, \n status_model_path: str = '', return_type: Literal(['queryset', 'q_obj']) = 'queryset') -> QuerySet:\n if status_model_path != '':\n status_model_path += '__' # append thi... | [
"0.664834",
"0.6547365",
"0.63360095",
"0.6248208",
"0.584044",
"0.57783943",
"0.57516164",
"0.566526",
"0.55965686",
"0.55448085",
"0.55358857",
"0.5526163",
"0.54578",
"0.5449902",
"0.5433801",
"0.5403676",
"0.53997964",
"0.5394545",
"0.5364103",
"0.5323609",
"0.5303084",
... | 0.8398093 | 0 |
Filter queryset to select status objects as of status_date. Can be used on querysets where the base object is not a subclass of StatusModel, in which case the django model path to the relevant StatusModel subclass should be provided in 'status_model_path'. e.g. StatusModel._filter_queryset_status_as_of(queryset = Invoi... | def _filter_queryset_status_as_of(cls, queryset: QuerySet, status_date: datetime.date,
status_model_path: str = '', return_type: Literal(['queryset', 'q_obj']) = 'queryset') -> QuerySet:
if status_model_path != '':
status_model_path += '__' # append this to get... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filter_status_as_of(self, status_date: datetime.date) -> QuerySet:\n return self.model._filter_queryset_status_as_of(self, status_date)",
"def filter_status(self, queryset, name, value):\n\n return queryset.filter(status=value)",
"def get_queryset(self):\n kwargs = {}\n if self.... | [
"0.74970436",
"0.6207123",
"0.60850483",
"0.5749448",
"0.5747517",
"0.5700742",
"0.563528",
"0.55883414",
"0.5555127",
"0.5464583",
"0.54423386",
"0.5425324",
"0.5415296",
"0.5364315",
"0.53392094",
"0.5288445",
"0.52402896",
"0.5209048",
"0.51790655",
"0.5161116",
"0.5143606... | 0.87326074 | 0 |
Add a new StatusModel record for an observed object. Any previously 'current' status (if one exists) is marked as ending the day prior to the new status, and the new status is added with no end date. If the prior status starts on the same day as the new status, the prior status is removed completely. | def add_status(cls, new_status: StatusModel):
# start or ensure we're in a transaction
transaction_context = db_transaction.atomic if not in_db_transaction() else nullcontext
with transaction_context():
if new_status.applies_to is not None:
raise StatusCreati... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_to_timeline(new_status):\n timeline = CacheManager.get_timeline()\n index = [timeline.index(status) for status in timeline \\\n if parse(status['pubdate']) < parse(new_status['pubdate'])]\n if len(index) == 0:\n timeline.insert(0, new_status)\n else:\n ... | [
"0.58432233",
"0.53649807",
"0.52297235",
"0.5140238",
"0.50651693",
"0.50297964",
"0.50025034",
"0.49827248",
"0.49414158",
"0.49335182",
"0.49262938",
"0.49026427",
"0.4882126",
"0.48527563",
"0.48283255",
"0.48227394",
"0.47830966",
"0.4775569",
"0.4770164",
"0.47696376",
... | 0.76023984 | 0 |
Empty all of the output labels. Empty the list string too. | def __clear(self):
for i in range(len(self.buttons_list)):
self.labels_strvar[i].set("")
if self.buttons_list[i]["state"] == DISABLED:
self.buttons_list[i]["state"] = NORMAL
self.entered_list = []
return | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clear_all(cls):\n del cls.text_labels[:]",
"def clear_outputs(self):\n self.outputs = []",
"def clear_lines(self):\r\n\r\n # iterate through the stored labels\r\n for cur_label in self.list_labels:\r\n # make sure label exists\r\n if cur_label is not None:\... | [
"0.72471994",
"0.67522174",
"0.666423",
"0.6579318",
"0.65392077",
"0.646694",
"0.64291465",
"0.63643193",
"0.6332624",
"0.6232511",
"0.6210303",
"0.6210121",
"0.61734235",
"0.61614037",
"0.61400795",
"0.61336225",
"0.61050755",
"0.61046726",
"0.6098654",
"0.6070144",
"0.6045... | 0.6838701 | 1 |
Write settings to a new config file | def write(self, fn):
with open(fn, 'w') as f:
self.config.write(f) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_config(self, filename):\n self.config.filename = filename\n self.config.write()",
"def write_config_file():\n\tif not config_parser:\n\t\tprint \"Config module not loaded. I don't save anything.\"\n\t\treturn\n\n\tf = file(config_file, \"w\")\n\tconfig_parser.write(f)\n\tf.close()",
"de... | [
"0.7637649",
"0.7414865",
"0.7362331",
"0.7346967",
"0.73300964",
"0.7277268",
"0.72695476",
"0.72344255",
"0.72106224",
"0.7192648",
"0.71630806",
"0.7127233",
"0.709871",
"0.70837814",
"0.7070496",
"0.7070496",
"0.7066356",
"0.7031323",
"0.7029472",
"0.69925374",
"0.6984668... | 0.7759633 | 0 |
Menemukan bilangan bulat x di dalam suatu deret fibonacci. Apabila x ada di dalam suatu deret fibonacci, maka kembalikan True. Jika tidak ada, maka kembalikan False | def find_fibonacci(x: int) -> bool:
# write your code here
a = 1
b = 1
while True: #Looping sampai ketemu return
if x == 0:
return True
elif b <= x:
if b == x:
return True
else:
temp = b
b = b + a
a = temp
el... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_fibonacci_number(x):\n a = math.sqrt(5 * x ** 2 + 4)\n b = math.sqrt(5 * x ** 2 - 4)\n return a.is_integer() or b.is_integer()",
"def isfib(number):\n\n num1 = 1\n num2 = 1\n while True:\n if num2 < number:\n tempnum = num2\n num2 += num1\n num1 = ... | [
"0.6773726",
"0.66438717",
"0.64886326",
"0.6484923",
"0.6450023",
"0.63658667",
"0.61969197",
"0.6188278",
"0.61717904",
"0.6157984",
"0.6135582",
"0.6134199",
"0.6124059",
"0.6075314",
"0.6073772",
"0.60251606",
"0.601169",
"0.6008477",
"0.60062265",
"0.5995043",
"0.5966465... | 0.772915 | 0 |
Parses a text by ignoring non ascii characters and replacing \\n with \n. | def parse_text(text):
return str(str(text).encode("ascii", "ignore")).replace("\\n","\n").replace("b'","") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalize_newlines(text):\n return re.sub(\"\\r\\n|\\r\", \"\\n\", text)",
"def normalize_newlines(text):\n # text = force_text(text)\n re_newlines = re.compile(r'\\r\\n|\\r') # Used in normalize_newlines\n return re_newlines.sub('\\n', text)",
"def clean_text(text):\n return text.replace('... | [
"0.72709805",
"0.683744",
"0.6565974",
"0.6490705",
"0.63671625",
"0.63486904",
"0.631569",
"0.6252674",
"0.62386334",
"0.62154794",
"0.61893815",
"0.61893815",
"0.61893815",
"0.61893815",
"0.61893815",
"0.61893815",
"0.61852145",
"0.6136685",
"0.61190623",
"0.61102164",
"0.6... | 0.7255734 | 1 |
Saves an exception to the local folder storage. | def save_exception(exc):
LOG.error("Error - %s", str(exc))
hour = time.strftime("_%H_%M_%S")
today = time.strftime("_%d_%m_%Y")
data = (str(exc)+traceback.format_exc())
file = open("./logs/ERROR_"+threading.currentThread().getName()+today+".log",'a+') #Replace to fix OSError
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save(self):\r\n if self._storage:\r\n self._storage.store(self, *self._storage_args)\r\n else:\r\n raise StorageNotSetError()",
"def do_exception_save(self):\n Save(self.nodeMgr.nodeList, self.nodeMgr.connections, True)",
"def save(self, path):\n pass",
"... | [
"0.63679516",
"0.63551867",
"0.595852",
"0.595852",
"0.595852",
"0.590701",
"0.58703774",
"0.58697665",
"0.58316517",
"0.58208746",
"0.5717012",
"0.56758845",
"0.5625118",
"0.56044745",
"0.56033856",
"0.55884606",
"0.5565005",
"0.5562717",
"0.5560496",
"0.55541915",
"0.555350... | 0.6624213 | 0 |
Returns a list of sentences from a paragraph This is a rather naive implementation; there are probably better ones out there Assumes that the paragraph has proper punctuation. | def get_sentences(paragraph):
punctuation = re.compile(r'[\.!?]')
sentences = [sentence.strip() for sentence in punctuation.split(paragraph)]
sentences = filter(lambda x: x, sentences)
return sentences | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sentences(self) -> List[str]:\n\t\treturn [sentence for sentence in re.split('(?<=[.!?])', self.text)]",
"def get_sentences(text):\n \n return text.split('.')",
"def split(text):\n doc = nlp(text)\n sentences = [x.text_with_ws for x in doc.sents]\n return sentences",
"def sente... | [
"0.76229024",
"0.74522465",
"0.73308635",
"0.72472256",
"0.72472256",
"0.71657723",
"0.7106902",
"0.70726115",
"0.70445025",
"0.70266235",
"0.69980454",
"0.6881847",
"0.68521893",
"0.6851337",
"0.6841656",
"0.6837825",
"0.67499644",
"0.67206156",
"0.6693907",
"0.66668844",
"0... | 0.88997257 | 0 |
Returns a summary of a paragraph This is a naive implementation and does not use advanced NLP techniques `paragraph` is one big long string `num_sentences` the number of sentences desired in the summary | def summarize(paragraph, num_sentences=SUMMARY_NUM_SENTENCES):
sentences = get_sentences(paragraph)
paragraph_num_sentences = len(sentences)
limit = min(paragraph_num_sentences, num_sentences)
summary_sentences = sentences[:limit]
if paragraph_num_sentences < num_sentences:
# the original wa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def createParagraph(self, nsentences=0, words=[]):\n ww = []\n for w in words:\n w_ = w.lower()\n if w_ in self.plain_words:\n ww.append(w_)\n words = ww\n if not nsentences:\n nsentences = n.random.randint(3,10)\n sentences = []\n ... | [
"0.6380963",
"0.6186139",
"0.6160248",
"0.6042697",
"0.5974226",
"0.5955492",
"0.587184",
"0.58413273",
"0.5806373",
"0.57460016",
"0.57202417",
"0.57109237",
"0.5684887",
"0.5634316",
"0.5632613",
"0.5515592",
"0.5508101",
"0.5494737",
"0.54683626",
"0.5408686",
"0.5395066",... | 0.84240276 | 0 |
Add value in trie In each trie node check the given key present if its not present then create the object do same for remaining key and store metadata at end of key object | def add(self,root,key,value):
node = root
for digit in key:
child = node.children[ord(digit)-ord('0')]
if(child==None):
node.children[ord(digit)-ord('0')] = TrieNode(digit)
node = node.children[ord(digit)-ord('0')]
node.value = ValueMe... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_insert_string_has_correct_key_value_pairs(empty_trie):\n empty_trie.insert(\"hey\")\n start = empty_trie.root.children\n assert empty_trie.root.value is None\n assert list(start.keys()) == [\"h\"]\n assert list(start[\"h\"].children[\"e\"].children.keys()) == [\"y\"]",
"def __setitem__(se... | [
"0.66101074",
"0.64195794",
"0.63546604",
"0.6149169",
"0.6146637",
"0.61031646",
"0.5971571",
"0.5909779",
"0.5852657",
"0.5818702",
"0.5790691",
"0.57357454",
"0.5735496",
"0.57227457",
"0.5714701",
"0.57058567",
"0.5698414",
"0.5698414",
"0.5698414",
"0.5698414",
"0.568935... | 0.77542037 | 0 |
Return list of key value pair recursively return [(key,value)] | def getAllKeyValuePair(self,root,key):
if root==None:
return []
node = root
result = []
for index,child in enumerate(node.children):
if(child!=None):
if(child.value!=None):
result.append((key+str(index),child.value.va... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def items(self):\n return [(kvp.key, kvp.value) for kvp in self.keyvaluepair_set.all()]",
"def key_value_list(d):\n if not isinstance(d, dict) and not isinstance(d, list):\n return []\n\n key_values = []\n\n if isinstance(d, list):\n for entry in d:\n if isinstance(entry,... | [
"0.6404273",
"0.63662153",
"0.63662153",
"0.6223112",
"0.61406916",
"0.60757846",
"0.59174085",
"0.58834624",
"0.5832713",
"0.5824085",
"0.5821025",
"0.5817983",
"0.5775529",
"0.57676864",
"0.5742903",
"0.5669361",
"0.565074",
"0.56389517",
"0.5631543",
"0.5627777",
"0.562081... | 0.6658975 | 0 |
Check that all primers are ok | def check_primers(self):
primer_keys=['sequence','description']
if self.data.has_key('primer_dict'):
for primer in self.data['primer_dict'].keys():
for key in primer_keys:
if not self.data['primer_dict'][primer].has_key(key):
self.d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_pm_Completeness(self):\n pass",
"def check(self):\r\n self.check_probabilities()\r\n self.check_sum()",
"def test_ok_mm_primer(self):\r\n primers = ['AAAA', 'GGGG']\r\n self.assertEqual(ok_mm_primer('AAAA', primers, 0), True)\r\n self.assertEqual(ok_mm_primer(... | [
"0.633182",
"0.6266236",
"0.6255396",
"0.62254816",
"0.60022736",
"0.60022736",
"0.60022736",
"0.59565866",
"0.5955756",
"0.5954387",
"0.5953573",
"0.5930386",
"0.5916017",
"0.5902774",
"0.5885363",
"0.5866004",
"0.5854486",
"0.5810339",
"0.5807289",
"0.57743055",
"0.57235587... | 0.66852635 | 0 |
Initialise the Tk variables | def init_tkvars(self):
for key in self.defaultprefs:
value = self.defaultprefs[key]
if type(value) is types.IntType:
var = self.__dict__[key] = IntVar()
elif type(value) is types.StringType:
var = self.__dict__[key] = StringVar()
v... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n self.window = Tk() # The main window\n self.__initialize_variables__() # Initialize the variables\n self.__initialize_menu__() # Initialize the Menu\n self.__initialize_status_bar__()\n self.__initialize_gui__() # Initialize the GUI widgets",... | [
"0.7828618",
"0.73511934",
"0.70263606",
"0.68905014",
"0.6849175",
"0.67281103",
"0.67270833",
"0.6677684",
"0.66641164",
"0.6612032",
"0.65703213",
"0.65675956",
"0.65637386",
"0.65635824",
"0.6536778",
"0.65182644",
"0.6461675",
"0.6456069",
"0.6454784",
"0.6452495",
"0.64... | 0.77355164 | 1 |
handle shift left click for seq selection | def handle_left_shift_click(self, event):
#placeholder to prevent handle_left_click being called
return | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def handle_left_click(self,event):\n\n c = self.seqframe\n if 'textlabel' in c.gettags(CURRENT):\n self.show_item(event)\n elif 'comparison_seq' in c.gettags(CURRENT):\n self.show_sequence_label(event)\n else:\n self.start_selection(event)\n retur... | [
"0.7238187",
"0.6752789",
"0.6733228",
"0.6685465",
"0.6664917",
"0.66138613",
"0.65593445",
"0.64423484",
"0.6421524",
"0.6398179",
"0.63848567",
"0.62853086",
"0.6271796",
"0.6222442",
"0.6195946",
"0.61791694",
"0.6131969",
"0.61159587",
"0.60718894",
"0.6046545",
"0.60461... | 0.76220495 | 0 |
Write a single aa sequence in the sequence window | def print_aa_seq(self,sequence,y,position=0,frame=0,font=None):
for letter in sequence:
position=position+1
x,y_junk=self.get_aa_pos_on_screen(position,frame)
self.seq_win_objs[self.seqframe.create_text(x,y,text=letter,font=font,anchor='w')]=1
return | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def writeseq(afile, seq):\n print(seq, file=afile)",
"def generate_aa_sequence_for_disp(aa_seq):\n return re.sub(\"(.{50})\", \"\\\\1\\n\", aa_seq, 0, re.DOTALL)",
"def write_sequence(self):\n\n staves = self.get_sequence()\n\n with open(self.output_file, 'w') as out_file:\n\n pr... | [
"0.74965686",
"0.7230852",
"0.70416033",
"0.69417787",
"0.6935472",
"0.6807856",
"0.6635204",
"0.6606275",
"0.6483282",
"0.6468294",
"0.64670664",
"0.63573694",
"0.6357229",
"0.6327611",
"0.6317145",
"0.62903893",
"0.6285191",
"0.6240838",
"0.6222865",
"0.61998606",
"0.608092... | 0.764844 | 0 |
From X and Y coordinate, return the DNA base number | def get_DNApos_fromcoords(self,x,y):
# Are we close to the DNA sequence?
if abs(y-self.seq_row)>10:
return None
# ok, DNA it is
pos=int(float(x-self.seq_xstart+4.0)/self.base_scale.get())
return pos | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dna_digit(bp):\r\n # You must use the following dictionary:\r\n bp_map = {'a': 0, 'c': 1, 'g': 2, 't': 3}\r\n\r\n # YOUR CODE HERE\r",
"def dna_number(bp_seq):\r\n # Hint: use dna_digit\r\n\r\n # YOUR CODE HERE\r",
"def pattern_to_number(dna):\n assert (is_dna(dna))\n idx = 'ACGT'\n ... | [
"0.63716716",
"0.63179934",
"0.63169825",
"0.6208208",
"0.6122812",
"0.59831357",
"0.591232",
"0.5889175",
"0.58721143",
"0.58370376",
"0.5760365",
"0.57418334",
"0.5680142",
"0.5658188",
"0.5643968",
"0.56373876",
"0.56118417",
"0.5559136",
"0.54945374",
"0.5489688",
"0.5479... | 0.6691583 | 0 |
return the x and y position of the aa on the screen frame is 0, 1 or 2 | def get_aa_pos_on_screen(self,position,frame):
position=position*3+float(frame)-1
x,y=self.get_base_pos_on_screen(position)
y=y+20.0+float(frame)*15.0
return x,y | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_pix_pos(self):\r\n return vec((self.grid_pos[0]*self.app.cell_width)+TOP_BOTTOM_BUFFER//2+self.app.cell_width//2,\r\n (self.grid_pos[1]*self.app.cell_height) +\r\n TOP_BOTTOM_BUFFER//2+self.app.cell_height//2)\r\n # where Pac-Man starts relative to the boar... | [
"0.66858596",
"0.66490066",
"0.6567765",
"0.6565777",
"0.6537806",
"0.6512099",
"0.645452",
"0.6437419",
"0.64275867",
"0.6421219",
"0.63888687",
"0.6384282",
"0.63799846",
"0.63799846",
"0.6378369",
"0.63586813",
"0.63470423",
"0.63464385",
"0.63444793",
"0.633785",
"0.63342... | 0.8782493 | 0 |
Invert the DNA sequence | def invert_seq(self):
if not self.data['DNAseq']:
self.invert_seq_var.set(0)
self.warning('No DNA sequence loaded','You have to load a DNA sequence first')
return
inverted=''
for count in range(len(self.data['DNAseq'])):
pos=-count-1
in... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def revcomp(self, seq):\n tab = self.maketrans(b'ACNGT', b'TGNCA')\n return seq.translate(tab)[::-1]",
"def __invert__(self) -> Seq:\n return self.reverse_complement()",
"def invert_inplace(a):",
"def reverse_rna_complement(seq):\n\n seq_upper = seq.isupper()\n\n seq = seq[::-1]\n\... | [
"0.6803452",
"0.68022174",
"0.6779436",
"0.668893",
"0.6503129",
"0.6490111",
"0.6487396",
"0.64321727",
"0.6381576",
"0.63771176",
"0.6364751",
"0.63455945",
"0.6345534",
"0.63444453",
"0.630975",
"0.6297897",
"0.6289071",
"0.62652427",
"0.62485635",
"0.6226693",
"0.62260413... | 0.8079035 | 0 |
Get the complementary DNA sequence | def complementary_seq(self):
if not self.data['DNAseq']:
self.complement_seq_var.set(0)
self.warning('No DNA sequence loaded','You have to load a DNA sequence first')
return
compl={'A':'T','T':'A','C':'G','G':'C'}
comDNA=''
for base in self.data['DNAse... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_complementary_sequence(sequence):\n\n complementary_sequence = ''\n for char in sequence:\n complementary_sequence = complementary_sequence + get_complement(char)\n return complementary_sequence",
"def get_complement(sequence):\n #Convert all rna_sequence to upper case:\n sequence=s... | [
"0.74186146",
"0.68743026",
"0.68185055",
"0.67913824",
"0.6651007",
"0.66333926",
"0.66196287",
"0.6609147",
"0.65593815",
"0.653605",
"0.65231305",
"0.649583",
"0.6426687",
"0.64078426",
"0.64071935",
"0.6397027",
"0.6384807",
"0.6364642",
"0.63620883",
"0.6356675",
"0.6356... | 0.79638183 | 0 |
Exit or return to DB_Main. If going to DB_Main, make sure that we save the primer_dict in the Database. Make sure that we close the primer database window. | def quit(self,event=None):
#Make sure that we close the primer database window if open
if self.pDB_open:
self.pDB_open.close_pDB()
self.pDB_open=None
if self.sequ_win:
self.sequ_win.close()
self.sequ_win=None
# Close the design_mutagenic ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_before_close(self):\n if self.db_window:\n self.db_window.destroy()\n self.destroy()",
"def main() -> None:\n\n # TODO - Gather this from whatever mechanism is needed\n data = {\n \"family_members\": \"\",\n \"social_status\": \"\",\n \"gender\": \"\",... | [
"0.591604",
"0.58587605",
"0.58536",
"0.5853494",
"0.58141786",
"0.57868403",
"0.5764085",
"0.57433546",
"0.57325643",
"0.5730627",
"0.5639659",
"0.5611261",
"0.5609587",
"0.55938673",
"0.55673844",
"0.556287",
"0.5542407",
"0.55350184",
"0.5523076",
"0.5515303",
"0.5467519",... | 0.71389824 | 0 |
Dialog to change sequence display settings | def seq_display_settings(self):
# Open a new window for setting the restriction enzymes
self.seq_display_setupwin=Toplevel()
self.seq_display_setupwin.geometry('+300+450')
self.seq_display_setupwin.title('Sequence Display Setup')
# Spacing between bases
row=1
lb... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Show_Sequences( self ):\r\n self.system.Change_Seq( \"Sequence\" )",
"def setDisplayChoice(self, settings: ghidra.docking.settings.Settings, choice: unicode) -> None:\n ...",
"def update_window_formatting(self):\n self.update_sequence_window()\n if self.pDB_open:\n sel... | [
"0.71161026",
"0.6436498",
"0.6341738",
"0.6290809",
"0.62729007",
"0.62307507",
"0.6067106",
"0.60627604",
"0.5858878",
"0.5776548",
"0.5774984",
"0.5648055",
"0.5637582",
"0.56118906",
"0.5587708",
"0.5561553",
"0.5554063",
"0.55514157",
"0.5542747",
"0.55190957",
"0.550719... | 0.6909994 | 1 |
Saves the sequence display settings to prefs file | def save_preferences(self):
print 'Saving DNAtool preferences'
self.preferences.set('seqfont',self.seqfont.get())
self.preferences.set('seqfontsize',self.seqfontsize.get())
self.preferences.set('fontstyle',self.fontstyle.get())
self.preferences.set('base_scale',self.base_scale.g... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_prefs(self):\n prefs_file = open(expanduser(self.prefs_path), 'w')\n pickle.dump(self.prefs, prefs_file)",
"def save( self ):\n ini = codecs.open(self.filename,\"w\",\"utf-8\",errors=\"replace\",buffering=0)\n for (name,value) in self.conf.items():\n print >>ini, n... | [
"0.7310781",
"0.6909804",
"0.6810998",
"0.66844296",
"0.6484897",
"0.63713944",
"0.63663805",
"0.6360978",
"0.63415796",
"0.6329639",
"0.6319689",
"0.6311248",
"0.631056",
"0.63006353",
"0.62831",
"0.6273021",
"0.626525",
"0.625944",
"0.6253987",
"0.6240697",
"0.62008435",
... | 0.76287246 | 0 |
Loads the sequence display settings from prefs file, if present | def load_preferences(self):
print 'Loading current DNAtool preferences'
self.preferences = Preferences('DNAtool',{'canvas_height':600})
for key in self.defaultprefs:
if key in self.preferences.prefs:
self.__dict__[key].set(self.preferences.get(key))
else... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def settings_load(self):\n self.ui.spinBox_ATSP.setValue(self.default['ATSP'])\n\n if self.default['serialLabel'] == 'bt':\n self.ui.btRadio.setChecked(True)\n try:\n os.system(\"blueman-manager\")\n except:\n print \"Please install 'blue... | [
"0.6247562",
"0.60635585",
"0.59657943",
"0.58914506",
"0.58850735",
"0.585662",
"0.58083504",
"0.57212687",
"0.56143105",
"0.561023",
"0.5570764",
"0.5553634",
"0.5530509",
"0.5462818",
"0.5435047",
"0.543316",
"0.54071176",
"0.53720284",
"0.53387815",
"0.53375584",
"0.53361... | 0.6510066 | 0 |
Do this only when display setup changes are applied. Ensures all objects, including applied primers are updated with the new formatting. | def update_window_formatting(self):
self.update_sequence_window()
if self.pDB_open:
self.pDB_open.refresh_primer()
if self.show_comp_sequence.get==1:
self.sequ_win.refresh_DNAseq()
return | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prepare_to_visualize(self):\n self.system.hold_structure_changes()\n for surface in self.inactive_surfaces:\n surface.activate_constraint()\n self.system.resume_structure_changes()",
"def on_finalize_figure_format_config(self):\n # Called when figure_format_config is up... | [
"0.58809215",
"0.57634264",
"0.5699254",
"0.5681959",
"0.5621546",
"0.561559",
"0.55860627",
"0.5527805",
"0.5412095",
"0.5395852",
"0.53952205",
"0.53361183",
"0.53317124",
"0.5294499",
"0.5286109",
"0.52841675",
"0.5264888",
"0.52524686",
"0.52483284",
"0.52431774",
"0.5241... | 0.5857576 | 1 |
Turn the over view window on and off | def overview_on_off(self):
if self.overview_win:
self.overview_button.deselect()
self.overview_win.destroy()
self.overview_win=None
else:
self.overview_button.select()
if not self.data.has_key('AA_seqs1'):
self.warning('No DNA ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def interaction_door(self) -> None:\n self.grid.win = True",
"def toggleWindowVisibility(*args, **kwargs)->None:\n pass",
"def switch_state():\n\tDmg.OpenWindow()",
"def on_show_view(self):\n self.window.background_color = arcade.color.BLACK",
"def on_show_view(self):\n self.window.... | [
"0.65015507",
"0.63867354",
"0.63686633",
"0.62598336",
"0.62174183",
"0.6124168",
"0.6057488",
"0.5994566",
"0.5991074",
"0.588853",
"0.5878562",
"0.5842309",
"0.58342725",
"0.5823281",
"0.58189803",
"0.58144164",
"0.5813247",
"0.58089495",
"0.5800184",
"0.57985246",
"0.5796... | 0.65535307 | 0 |
Finds the entropy of a distribution. Its default unit is 'bit'. | def entropy(distribution, unit=2):
frequencies = distribution.frequencies(normalised=True)
# check to see if it is a deterministic case (all but one are zero)
zeros_size = frequencies[frequencies == 0].size
if zeros_size + 1 == frequencies.size:
return 0
else:
return np.sum(-frequenc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def entropy(n_bits):\n return n_bits and random.getrandbits(n_bits)",
"def entropy(self):\n ent = 0.0\n for f in self.byte_freq:\n if f > 0:\n freq = float(f) / self.byte_total\n ent = ent + freq * math.log(freq, 2)\n return -ent",
"def entropy(s... | [
"0.7216493",
"0.7178199",
"0.70871305",
"0.70376706",
"0.7022288",
"0.70078677",
"0.6982438",
"0.69689983",
"0.6949414",
"0.6947141",
"0.6847315",
"0.6842488",
"0.6828988",
"0.68046504",
"0.67967844",
"0.67961335",
"0.6793621",
"0.6785424",
"0.67736644",
"0.67153466",
"0.6712... | 0.77416825 | 0 |
...Test serialization of solvers | def test_serializing_solvers(self):
ratio = 0.5
l_enet = 1e-2
sd = ratio * l_enet
proxes = [
ProxZero(),
ProxTV(2),
ProxL1(2),
ProxGroupL1(strength=1, blocks_start=[0, 3, 8],
blocks_length=[3, 5, 2])
]
so... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_serialization(valid_data):\n project: Project = Project.build(valid_data)\n serialized = project.dump()\n assert serialized == valid_data",
"def _write_solvr(parameters):\n from ._common import solver\n\n data = deepcopy(solver)\n data.update(parameters[\"solver\"])\n\n # Formats\n ... | [
"0.6019722",
"0.6004972",
"0.5957249",
"0.581807",
"0.5720124",
"0.56757474",
"0.56500006",
"0.56106883",
"0.55766976",
"0.55719376",
"0.5566034",
"0.5562399",
"0.5559807",
"0.5557388",
"0.55541795",
"0.55541795",
"0.5544929",
"0.55441064",
"0.5537589",
"0.55364114",
"0.55364... | 0.7052799 | 0 |
return True if the operation is an ORM statement. This indicates that the select(), insert(), update(), or delete() being invoked contains ORM entities as subjects. For a statement that does not have ORM entities and instead refers only to | def is_orm_statement(self) -> bool:
return self._compile_state_cls is not None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_insert(self) -> bool:\n return self.statement.is_dml and self.statement.is_insert",
"def is_statement(self):\r\n return conf.lib.clang_isStatement(self)",
"def is_update(self) -> bool:\n return self.statement.is_dml and self.statement.is_update",
"def is_model(thing):\n return ... | [
"0.5620951",
"0.5605101",
"0.5569091",
"0.5535606",
"0.55173063",
"0.54741484",
"0.5460691",
"0.5445436",
"0.54006004",
"0.53627884",
"0.53473574",
"0.53176814",
"0.52671725",
"0.52306247",
"0.52170306",
"0.5203307",
"0.51841104",
"0.5166248",
"0.5157136",
"0.51497704",
"0.51... | 0.75601155 | 0 |
return True if this is a SELECT operation. | def is_select(self) -> bool:
return self.statement.is_select | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_select_type(self) -> bool:\n row_type = self.get_type()\n return row_type.startswith('select')",
"def is_in_cmd(self):\r\n return self.select_cmd is not None",
"def _exists (self):\n cursor = self._exec (self.select)\n return bool (cursor.fetchall ())",
"def select(s... | [
"0.6934209",
"0.68529755",
"0.6847728",
"0.63923866",
"0.621679",
"0.58990353",
"0.5838623",
"0.578304",
"0.57714564",
"0.57119703",
"0.5705815",
"0.57026494",
"0.56816274",
"0.56427234",
"0.56264937",
"0.56148696",
"0.5607124",
"0.5575995",
"0.5573314",
"0.5541137",
"0.55370... | 0.814965 | 0 |
return True if this is an INSERT operation. | def is_insert(self) -> bool:
return self.statement.is_dml and self.statement.is_insert | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_insert(self, shape):\n for insert in self.inserts:\n if insert.shape == shape:\n return True\n return False",
"def can_insert(self):\r\n return self.query._sort == [desc('_date')]",
"def can_insert(data):\n return hasattr(data, 'read')",
"def IsIn... | [
"0.7236789",
"0.720977",
"0.7177859",
"0.7171903",
"0.7058934",
"0.70026946",
"0.69773436",
"0.6917151",
"0.67439586",
"0.6603974",
"0.6467352",
"0.638372",
"0.6379659",
"0.6304227",
"0.6188328",
"0.6173998",
"0.61620456",
"0.61289746",
"0.60593355",
"0.60367316",
"0.60352165... | 0.8743085 | 0 |
return True if this is an UPDATE operation. | def is_update(self) -> bool:
return self.statement.is_dml and self.statement.is_update | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_update(self):\n return self.action in [\"update\", \"partial_update\"]",
"def is_update_active(self):\n return self._update_action",
"def _is_valid_update_operation(session, row):\n # Check if there are older updates in the queue\n if db.check_for_older_ops(session, row):\n re... | [
"0.80514944",
"0.68959904",
"0.68557453",
"0.6854025",
"0.68472934",
"0.6791104",
"0.6708837",
"0.6699989",
"0.65150803",
"0.6434282",
"0.63465744",
"0.6344334",
"0.6336636",
"0.632303",
"0.6250073",
"0.6207",
"0.62066543",
"0.6184201",
"0.613155",
"0.6125278",
"0.6116963",
... | 0.8240323 | 0 |
return True if this is a DELETE operation. | def is_delete(self) -> bool:
return self.statement.is_dml and self.statement.is_delete | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete(self) -> bool:\n return False",
"def has_delete(self) -> bool:\n return \"delete_item\" not in self.__abstractmethods__",
"def can_delete(self):\r\n return True",
"def do_delete(self, arg):\n \treturn False",
"def _is_valid_delete_operation(session, row):\n # Check for... | [
"0.7687547",
"0.7653898",
"0.7509395",
"0.7229885",
"0.72057503",
"0.7202528",
"0.71998924",
"0.71913713",
"0.71911025",
"0.71911025",
"0.71676165",
"0.70334107",
"0.69871783",
"0.6916825",
"0.68878883",
"0.6835651",
"0.68331",
"0.6760819",
"0.6750353",
"0.6745418",
"0.672026... | 0.7867445 | 0 |
Update the local execution options with new values. | def update_execution_options(self, **opts: Any) -> None:
self.local_execution_options = self.local_execution_options.union(opts) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_local_options(self):\r\n new_values = options.Values()\r\n for opt in self._main_options:\r\n if opt.dest:\r\n setattr(new_values, opt.dest, getattr(self._option_values, opt.dest))\r\n return new_values",
"def _update_params(self):\n _load = not self.san_interface.runmode\n ... | [
"0.6481104",
"0.56911206",
"0.5650938",
"0.55899227",
"0.5581682",
"0.5571514",
"0.5517237",
"0.54907024",
"0.5486535",
"0.5478594",
"0.54666066",
"0.54468286",
"0.5445308",
"0.54437333",
"0.54417115",
"0.53987086",
"0.53602314",
"0.53602314",
"0.53488886",
"0.53472656",
"0.5... | 0.84011483 | 0 |
Return True if the operation is refreshing columnoriented attributes on an existing ORM object. | def is_column_load(self) -> bool:
opts = self._orm_compile_options()
return opts is not None and opts._for_refresh_state | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_update(self) -> bool:\n return self.statement.is_dml and self.statement.is_update",
"def is_modified(\n self, instance: object, include_collections: bool = True\n ) -> bool:\n state = object_state(instance)\n\n if not state.modified:\n return False\n\n dict... | [
"0.6629238",
"0.62679005",
"0.62371886",
"0.60928726",
"0.6065252",
"0.5895536",
"0.5853559",
"0.5758199",
"0.5731893",
"0.5689342",
"0.5689342",
"0.56879103",
"0.56879103",
"0.56705713",
"0.56613517",
"0.5660778",
"0.5656837",
"0.5642546",
"0.5632726",
"0.562552",
"0.5582123... | 0.72165644 | 0 |
Return True if this load is loading objects on behalf of a relationship. This means, the loader in effect is either a LazyLoader, SelectInLoader, SubqueryLoader, or similar, and the entire SELECT statement being emitted is on behalf of a relationship load. Handlers will very likely not want to add any options to querie... | def is_relationship_load(self) -> bool:
opts = self._orm_compile_options()
if opts is None:
return False
path = self.loader_strategy_path
return path is not None and not path.is_root | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def canLoad(self):\n #xxx should be corrected to work on all subclass hierarchy\n return 'load' in self.__class__.__dict__",
"def requires_model_loading(self):\n return self.requires_loaded_models",
"def is_loaded(self):\n return (\n self._momentary_follow_sense_prop.is_l... | [
"0.61518866",
"0.6142196",
"0.5921451",
"0.59201634",
"0.58543783",
"0.58315754",
"0.581896",
"0.5817962",
"0.57505995",
"0.57488155",
"0.574867",
"0.57023674",
"0.567425",
"0.5661016",
"0.5628691",
"0.5619242",
"0.5564777",
"0.55491865",
"0.55205286",
"0.5505779",
"0.5499632... | 0.80417824 | 0 |
Return the update_delete_options that will be used for this execution. | def update_delete_options(
self,
) -> Union[
bulk_persistence.BulkUDCompileState.default_update_options,
Type[bulk_persistence.BulkUDCompileState.default_update_options],
]:
if not self._is_crud:
raise sa_exc.InvalidRequestError(
"This ORM execution i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_delete(self, *args, **kw):\n return dict(args=args)",
"def configure_deletes(conf):\n print()\n if conf.get('purge', None) is None:\n conf['purge'] = yes_no(\n 'Would you like the sync to be able to delete files between devices?', default=False)\n if conf['purge'] and co... | [
"0.58794296",
"0.5645013",
"0.5604556",
"0.54765266",
"0.54765266",
"0.54765266",
"0.54765266",
"0.54765266",
"0.54604733",
"0.54186773",
"0.53884065",
"0.5376289",
"0.5365019",
"0.53238785",
"0.53067887",
"0.52989715",
"0.52653384",
"0.5255195",
"0.5251834",
"0.5250532",
"0.... | 0.8105867 | 0 |
Return the current root transaction in progress, if any. | def get_transaction(self) -> Optional[SessionTransaction]:
trans = self._transaction
while trans is not None and trans._parent is not None:
trans = trans._parent
return trans | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def root_tx_local(self):\n stack = getattr(self.session(), \"_tx_stack\", None)\n if stack:\n return stack[0]",
"def tx_local(self):\n stack = getattr(self.session(), \"_tx_stack\", None)\n if stack:\n return stack[-1]",
"def getProgressParent():\n return _p... | [
"0.66363037",
"0.6138595",
"0.612571",
"0.61041003",
"0.5954205",
"0.57974815",
"0.5661701",
"0.5660577",
"0.5647248",
"0.5617924",
"0.5585083",
"0.5564173",
"0.55289537",
"0.552577",
"0.55245143",
"0.5510328",
"0.5453268",
"0.543526",
"0.5425537",
"0.54148847",
"0.5405478",
... | 0.68122065 | 0 |
Return the current nested transaction in progress, if any. | def get_nested_transaction(self) -> Optional[SessionTransaction]:
return self._nested_transaction | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_transaction(self) -> Optional[SessionTransaction]:\n trans = self._transaction\n while trans is not None and trans._parent is not None:\n trans = trans._parent\n return trans",
"def getProgressParent():\n return _progressParent",
"def get_transaction(self, clear=False... | [
"0.67401797",
"0.6056988",
"0.60165954",
"0.5932255",
"0.5897816",
"0.58612126",
"0.56666183",
"0.56493026",
"0.562704",
"0.56064427",
"0.5594629",
"0.5590598",
"0.5590598",
"0.55596983",
"0.5538084",
"0.5526674",
"0.5507392",
"0.548702",
"0.5481458",
"0.5468658",
"0.5460486"... | 0.7040794 | 0 |
Rollback the current transaction in progress. If no transaction is in progress, this method is a passthrough. The method always rolls back the topmost database transaction, discarding any nested transactions that may be in progress. | def rollback(self) -> None:
if self._transaction is None:
pass
else:
self._transaction.rollback(_to_root=True) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rollback(self):\n\n if not self.is_active:\n return\n\n if self.is_context_active:\n raise states.RolledBack(self)\n else:\n self.__do_rollback()\n self._cleanup()",
"def rollback(self):\n raise TransactionRollback('rollback called outsi... | [
"0.7786708",
"0.7773577",
"0.76120657",
"0.7605159",
"0.7547883",
"0.7520105",
"0.7430992",
"0.7362959",
"0.7278305",
"0.7218237",
"0.7169921",
"0.71581686",
"0.7144366",
"0.71281993",
"0.7109936",
"0.7100678",
"0.70823306",
"0.6868285",
"0.6868285",
"0.6845792",
"0.67550856"... | 0.8003199 | 0 |
Prepare the current transaction in progress for two phase commit. If no transaction is in progress, this method raises an | def prepare(self) -> None:
trans = self._transaction
if trans is None:
trans = self._autobegin_t()
trans.prepare() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prepare_for_commit(self):",
"def begin_commit(self, _stacklevel=1):\n if self.commit_phase:\n warnings.warn('the transaction already is on commit phase; '\n 'begin_commit() method seems called twice or more' +\n self.format_commit_stack(),\n... | [
"0.73203504",
"0.69659245",
"0.65819055",
"0.63009214",
"0.6300132",
"0.62584126",
"0.62414455",
"0.6208081",
"0.6174551",
"0.60611206",
"0.6038356",
"0.6002872",
"0.5994216",
"0.5993803",
"0.59707713",
"0.5966046",
"0.5945835",
"0.5940921",
"0.59385127",
"0.59064895",
"0.589... | 0.7208384 | 1 |
Execute a statement and return a scalar result. Usage and parameters are the same as that of | def scalar(
self,
statement: Executable,
params: Optional[_CoreSingleExecuteParams] = None,
*,
execution_options: OrmExecuteOptionsParameter = util.EMPTY_DICT,
bind_arguments: Optional[_BindArguments] = None,
**kw: Any,
) -> Any:
return self._execute_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def execute_sql_scalar(self, sql):\n msg_type, msg = self.protocol.build_execute_statement(\"sql\", sql)\n self.protocol.send_msg(msg_type, msg)\n result = RowResult(self)\n result.fetch_all()\n if result.count == 0:\n raise InterfaceError(\"No data found\")\n r... | [
"0.7262659",
"0.72582173",
"0.7195019",
"0.7092941",
"0.69576734",
"0.6773122",
"0.6773122",
"0.66207325",
"0.65791655",
"0.6472804",
"0.64375955",
"0.6431014",
"0.6430046",
"0.64058274",
"0.63766044",
"0.63511795",
"0.62933385",
"0.62395656",
"0.62360847",
"0.6189605",
"0.61... | 0.74563414 | 0 |
Execute a statement and return the results as scalars. Usage and parameters are the same as that of | def scalars(
self,
statement: Executable,
params: Optional[_CoreAnyExecuteParams] = None,
*,
execution_options: OrmExecuteOptionsParameter = util.EMPTY_DICT,
bind_arguments: Optional[_BindArguments] = None,
**kw: Any,
) -> ScalarResult[Any]:
return se... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def execute(self, statement):\n return self._engine.connect().execute(statement)",
"def scalar(\n self,\n statement: Executable,\n params: Optional[_CoreSingleExecuteParams] = None,\n *,\n execution_options: OrmExecuteOptionsParameter = util.EMPTY_DICT,\n bind_arg... | [
"0.69107455",
"0.68924737",
"0.6673068",
"0.6654816",
"0.6654816",
"0.6613166",
"0.6485034",
"0.6423494",
"0.6371676",
"0.62444776",
"0.6184023",
"0.61837876",
"0.6134386",
"0.6112976",
"0.61121",
"0.60934305",
"0.6015609",
"0.5998466",
"0.5981103",
"0.5977332",
"0.59649783",... | 0.7433938 | 0 |
Locate an object in the identity map. Given a primary key identity, constructs an identity key and then looks in the session's identity map. If present, the object may be run through unexpiration rules (e.g. load unloaded attributes, check if was deleted). | def _identity_lookup(
self,
mapper: Mapper[_O],
primary_key_identity: Union[Any, Tuple[Any, ...]],
identity_token: Any = None,
passive: PassiveFlag = PassiveFlag.PASSIVE_OFF,
lazy_loaded_from: Optional[InstanceState[Any]] = None,
execution_options: OrmExecuteOptio... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_object_by_path(cls, object_path):\n # XXX: ideally this would be per-connection method.\n with cls._object_path_map_lock:\n return cls._object_path_to_object_map[object_path]",
"def _load_on_pk_identity(self, session, query, primary_key_identity, **kw):\n\n mapper = query... | [
"0.5641228",
"0.56295544",
"0.54748803",
"0.54526913",
"0.53290385",
"0.52673686",
"0.5263269",
"0.5251364",
"0.5139565",
"0.51389414",
"0.51330894",
"0.5119751",
"0.5109796",
"0.50925773",
"0.5090804",
"0.50693923",
"0.5065732",
"0.5062427",
"0.5014758",
"0.50137717",
"0.499... | 0.6323087 | 0 |
Return a context manager that disables autoflush. | def no_autoflush(self) -> Iterator[Session]:
autoflush = self.autoflush
self.autoflush = False
try:
yield self
finally:
self.autoflush = autoflush | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def blocking_context():\n block()\n try:\n yield\n finally:\n # an error could happen somewhere else when this ctx manager is on `yield`\n unblock()",
"def neutralContextManager():\n yield",
"def suppress_stdout():\n original_stdout = sys.stdout\n sys.stdout = open(os.dev... | [
"0.5947338",
"0.5785686",
"0.56690145",
"0.5655659",
"0.55809915",
"0.55809915",
"0.54419637",
"0.54419637",
"0.5378264",
"0.53223234",
"0.5313555",
"0.5280601",
"0.5236138",
"0.5153333",
"0.51391315",
"0.5038426",
"0.5028266",
"0.49885315",
"0.49812415",
"0.4921074",
"0.4914... | 0.66846687 | 0 |
Expires all persistent instances within this Session. When any attributes on a persistent instance is next accessed, a query will be issued using the | def expire_all(self) -> None:
for state in self.identity_map.all_states():
state._expire(state.dict, self.identity_map._modified) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __delete__(self, instance):\n self.session.close()",
"def expire(\n self, instance: object, attribute_names: Optional[Iterable[str]] = None\n ) -> None:\n try:\n state = attributes.instance_state(instance)\n except exc.NO_STATE as err:\n raise exc.Unmapped... | [
"0.6310313",
"0.61592484",
"0.614986",
"0.6091683",
"0.6068203",
"0.60227185",
"0.60092515",
"0.5988842",
"0.59794366",
"0.5976368",
"0.597172",
"0.5968349",
"0.5959245",
"0.5948027",
"0.5940777",
"0.5940777",
"0.5936207",
"0.58993286",
"0.58989984",
"0.5879965",
"0.58789164"... | 0.63190055 | 0 |
Expire the attributes on an instance. Marks the attributes of an instance as out of date. When an expired attribute is next accessed, a query will be issued to the | def expire(
self, instance: object, attribute_names: Optional[Iterable[str]] = None
) -> None:
try:
state = attributes.instance_state(instance)
except exc.NO_STATE as err:
raise exc.UnmappedInstanceError(instance) from err
self._expire_state(state, attribute_n... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_expired(self):\n check_time = datetime.now()\n if self.can_expire and self.duration:\n exp_times = deepcopy(self.exp_times)\n for key in exp_times:\n if exp_times[key] < check_time:\n self.delete(key)",
"def clear_expired(self):\n ... | [
"0.62043554",
"0.6114011",
"0.6059246",
"0.6022418",
"0.5910123",
"0.5903011",
"0.5878274",
"0.58577037",
"0.5812216",
"0.5770009",
"0.57515955",
"0.57362247",
"0.5668539",
"0.55960435",
"0.5589814",
"0.55493623",
"0.5517906",
"0.5512695",
"0.5508956",
"0.5507022",
"0.5506667... | 0.75844115 | 0 |
Expire a state if persistent, else expunge if pending | def _conditional_expire(
self, state: InstanceState[Any], autoflush: Optional[bool] = None
) -> None:
if state.key:
state._expire(state.dict, self.identity_map._modified)
elif state in self._new:
self._new.pop(state)
state._detach(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _do_expire(self):\n t = time.time()\n\n # Expire probes\n for ip, expire_at in self.outstanding_probes.items():\n if t > expire_at:\n self.outstanding_probes.pop(ip, None)\n if ip in self.live_servers:\n self.log.warn(\"Server %s ... | [
"0.61053425",
"0.59026915",
"0.59002656",
"0.5868698",
"0.58640045",
"0.5800564",
"0.57705843",
"0.56191915",
"0.55974066",
"0.55217576",
"0.5512243",
"0.5512243",
"0.5508846",
"0.54588914",
"0.53256446",
"0.5324058",
"0.52797496",
"0.52797496",
"0.5261262",
"0.5249432",
"0.5... | 0.76652145 | 0 |
Return True if the instance is associated with this session. The instance may be pending or persistent within the Session for a result of True. | def __contains__(self, instance: object) -> bool:
try:
state = attributes.instance_state(instance)
except exc.NO_STATE as err:
raise exc.UnmappedInstanceError(instance) from err
return self._contains_state(state) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_is_active(self, instance):\n return instance.check_finish()",
"def is_alive(self):\n return hasattr(self, 'alive') and self.alive",
"def is_alive(self):\n return hasattr(self, 'alive') and self.alive",
"def exists(self):\n return bool(self.get())",
"def isActive(self):\n... | [
"0.71296966",
"0.711561",
"0.711561",
"0.69939",
"0.69163525",
"0.69042426",
"0.69042426",
"0.6874575",
"0.68734944",
"0.6873477",
"0.68728256",
"0.6857216",
"0.6847948",
"0.6803387",
"0.6794422",
"0.6786746",
"0.67760664",
"0.67328304",
"0.6715661",
"0.6715623",
"0.6715623",... | 0.71557206 | 0 |
Perform a bulk insert of the given list of mapping dictionaries. | def bulk_insert_mappings(
self,
mapper: Mapper[Any],
mappings: Iterable[Dict[str, Any]],
return_defaults: bool = False,
render_nulls: bool = False,
) -> None:
self._bulk_save_mappings(
mapper,
mappings,
False,
False,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bulk_insert(objects, model, session):\n session.bulk_insert_mappings(model, objects)",
"def bulk_insert(engine, model, entries):\n with session_scope(engine) as session:\n session.bulk_insert_mappings(model, entries)\n session.commit()",
"def _insert_bulk(self, iterable):\n self.... | [
"0.76637733",
"0.73179156",
"0.70731163",
"0.6933272",
"0.68700224",
"0.66605884",
"0.6591244",
"0.65103036",
"0.6452632",
"0.6387288",
"0.6356567",
"0.6338901",
"0.6190419",
"0.6190258",
"0.61604494",
"0.614516",
"0.6129337",
"0.6115299",
"0.6070643",
"0.60685056",
"0.606083... | 0.744695 | 1 |
Perform a bulk update of the given list of mapping dictionaries. | def bulk_update_mappings(
self, mapper: Mapper[Any], mappings: Iterable[Dict[str, Any]]
) -> None:
self._bulk_save_mappings(
mapper, mappings, True, False, False, False, False
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _update_bulk(self, iterable):\n self.cursor.executemany(self.UPDATE, iterable)",
"def set_many(self, update_dict):\n for key, value in update_dict.items():\n # We just call `set` directly here, because this is an in-memory representation\n # thus we don't concern ourselves... | [
"0.7412699",
"0.7369574",
"0.72004443",
"0.6581362",
"0.6526478",
"0.65238154",
"0.6501325",
"0.63785195",
"0.6260597",
"0.61610323",
"0.615257",
"0.60794675",
"0.6056801",
"0.6053463",
"0.6029827",
"0.59988",
"0.59915173",
"0.59783655",
"0.5926189",
"0.5915307",
"0.5887184",... | 0.79650426 | 0 |
r"""Return ``True`` if the given instance has locally modified attributes. This method retrieves the history for each instrumented attribute on the instance and performs a comparison of the current value to its previously committed value, if any. It is in effect a more expensive and accurate version of checking for the... | def is_modified(
self, instance: object, include_collections: bool = True
) -> bool:
state = object_state(instance)
if not state.modified:
return False
dict_ = state.dict
for attr in state.manager.attributes:
if (
not include_collect... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hasChanged(self):\r\n if self.is_updated:\r\n self.is_updated = False\r\n return True\r\n else:\r\n return False\r\n\r\n # if not self.hasBeenUpdatedOnce:\r\n # self.hasBeenUpdatedOnce = True\r\n # return True\r\n # else:\r\n ... | [
"0.64107597",
"0.6254577",
"0.62269163",
"0.6163767",
"0.61632025",
"0.61595416",
"0.61566997",
"0.6122455",
"0.6072217",
"0.60623765",
"0.605791",
"0.5978782",
"0.593994",
"0.5871274",
"0.5849725",
"0.58435565",
"0.5841909",
"0.5841733",
"0.5841733",
"0.58275187",
"0.5809281... | 0.7068734 | 0 |
The set of all persistent states considered dirty. This method returns all states that were modified including those that were possibly deleted. | def _dirty_states(self) -> Iterable[InstanceState[Any]]:
return self.identity_map._dirty_states() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dirty(self) -> IdentitySet:\n return IdentitySet(\n [\n state.obj()\n for state in self._dirty_states\n if state not in self._deleted\n ]\n )",
"def states(self):\n from copy import copy\n return copy(self._states_... | [
"0.81482345",
"0.70150477",
"0.6917673",
"0.68806714",
"0.68650913",
"0.6763983",
"0.648369",
"0.6442556",
"0.6442415",
"0.6415415",
"0.6394742",
"0.6382415",
"0.6304089",
"0.62843317",
"0.6263013",
"0.6244383",
"0.6112895",
"0.60938674",
"0.6065263",
"0.60623515",
"0.6061572... | 0.8290956 | 0 |
The set of all persistent instances considered dirty. | def dirty(self) -> IdentitySet:
return IdentitySet(
[
state.obj()
for state in self._dirty_states
if state not in self._deleted
]
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _dirty_states(self) -> Iterable[InstanceState[Any]]:\n return self.identity_map._dirty_states()",
"def objects_in_use(self):\n return set()",
"def is_dirty(self):\n return True in [n.is_dirty for n in self.nodes]",
"def persisted_values(self):\n return []",
"def get_dirty_proper... | [
"0.7383943",
"0.642375",
"0.6398122",
"0.63735354",
"0.6362377",
"0.61284876",
"0.60679007",
"0.60633314",
"0.60006493",
"0.5981661",
"0.59665096",
"0.5963429",
"0.5932468",
"0.5932468",
"0.5932468",
"0.5932468",
"0.5932468",
"0.5932468",
"0.59288013",
"0.591709",
"0.5893051"... | 0.7940066 | 0 |
Produce a context manager that both provides a new | def begin(self) -> contextlib.AbstractContextManager[_S]:
session = self()
return session._maker_context_manager() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def context_local(context=None):\n class manager(object):\n def __init__(self, ctx):\n \"\"\"\n :type ctx: Context\n \"\"\"\n self.context = ctx.copy()\n\n def __enter__(self):\n self.orig_context = context_get()\n context_set(self.... | [
"0.7276113",
"0.63708234",
"0.63038796",
"0.62839925",
"0.62626195",
"0.6260205",
"0.6260205",
"0.62351215",
"0.62077916",
"0.61970305",
"0.6193575",
"0.61873907",
"0.616942",
"0.616942",
"0.616942",
"0.616942",
"0.616942",
"0.616942",
"0.616942",
"0.616942",
"0.616942",
"0... | 0.7084803 | 1 |
Close all sessions in memory. | def close_all_sessions() -> None:
for sess in _sessions.values():
sess.close() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close_all(cls):\n for sess in cls._session_registry.values():\n sess.close()",
"def close_all(cls) -> None:\n\n close_all_sessions()",
"def close(self):\n for session in self.sessions.copy().values():\n session.close(SessionCloseErrorCode.SESSION_DIED)",
"def cl... | [
"0.88021153",
"0.8724699",
"0.84613067",
"0.796673",
"0.79080045",
"0.78205776",
"0.7804007",
"0.7456333",
"0.7271152",
"0.72674537",
"0.71485376",
"0.7060573",
"0.70525986",
"0.70525986",
"0.70525986",
"0.70037293",
"0.6987723",
"0.6987723",
"0.6987723",
"0.6987723",
"0.6987... | 0.90481013 | 0 |
Load a scattering file with a, b and c coefficients in the columns provided. | def load_scattering_file(filename, a_inds, b_inds, c_ind):
import numpy as np
with open(filename, "r", encoding="utf-8") as f:
flines = [line for line in f.readlines() if not line.startswith("#")]
atomic_scattering_coeffs = {}
for line in flines:
x = line.split()
label = x[0]... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def csv_file_read(filename, a, b, c):\n dataframe = pd.read_csv(file_path + os.sep + filename, delimiter=None,\n header=None, names=None, index_col=None,\n usecols=[a, b, c], skiprows=1, skipfooter=0,\n nrows=None)\n x1 = datafr... | [
"0.59529346",
"0.5832236",
"0.5687942",
"0.5640774",
"0.55869424",
"0.55675036",
"0.5558638",
"0.5484824",
"0.5432669",
"0.53991276",
"0.5369861",
"0.53399974",
"0.530095",
"0.5274386",
"0.5265497",
"0.5258562",
"0.5226662",
"0.521383",
"0.52081376",
"0.51954705",
"0.51762325... | 0.7307161 | 0 |
Tests initialisation of Aquarius objects. | def test_init():
aqua = Aquarius("http://something/api/v1/aquarius/assets")
assert (
aqua.url == "http://something/api/v1/aquarius/assets/ddo"
), "Different URL from the specified one."
assert (
aqua.root_url == "http://something"
), "Different root URL from the specified one." | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test___init__(self):\n copula = GammaUnivariate()\n assert copula.a is None\n assert copula.loc is None\n assert copula.scale is None",
"def test_init(self):\n self.assertIsNotNone(DatabaseIntermediary(), self.ec.db)",
"def test_init(self):\n rachio = Rachio(AUTHTO... | [
"0.70525175",
"0.69626737",
"0.68798745",
"0.68673795",
"0.6812885",
"0.6807057",
"0.6797245",
"0.67916226",
"0.6714089",
"0.6689329",
"0.6682552",
"0.66112345",
"0.6610447",
"0.65597427",
"0.65076184",
"0.649798",
"0.6455297",
"0.64524794",
"0.6437213",
"0.6428168",
"0.63993... | 0.76929474 | 0 |
Tests against singleddo functions of Aquarius. | def test_aqua_functions_for_single_ddo(
publisher_ocean_instance, metadata, aquarius_instance
):
publisher = get_publisher_wallet()
metadata_copy = metadata.copy()
ddo = publisher_ocean_instance.assets.create(metadata_copy, publisher)
wait_for_ddo(publisher_ocean_instance, ddo.did)
aqua_metadat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_aqua_function_for_multiple_ddos(aquarius_instance):\n assert aquarius_instance.list_assets()\n assert aquarius_instance.list_assets_ddo()",
"def test_taxa_chao1(self):\n table_factory = DataTableFactory(PACKET_DIR)\n chao1 = table_factory.taxa_alpha_diversity(metric='chao1', rarefy=1... | [
"0.638956",
"0.6081418",
"0.5692888",
"0.56389284",
"0.5614791",
"0.5580623",
"0.5523267",
"0.54797804",
"0.5477931",
"0.5475353",
"0.54706347",
"0.54609174",
"0.5419413",
"0.53601706",
"0.5350104",
"0.53316724",
"0.53113824",
"0.53113824",
"0.53037006",
"0.5300601",
"0.52833... | 0.675679 | 0 |
Tests against multipleddo functions of Aquarius. | def test_aqua_function_for_multiple_ddos(aquarius_instance):
assert aquarius_instance.list_assets()
assert aquarius_instance.list_assets_ddo() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_aqua_functions_for_single_ddo(\n publisher_ocean_instance, metadata, aquarius_instance\n):\n publisher = get_publisher_wallet()\n metadata_copy = metadata.copy()\n\n ddo = publisher_ocean_instance.assets.create(metadata_copy, publisher)\n wait_for_ddo(publisher_ocean_instance, ddo.did)\n ... | [
"0.59869045",
"0.59685695",
"0.57699084",
"0.55988395",
"0.55986613",
"0.55678463",
"0.55673444",
"0.554788",
"0.5542672",
"0.5525649",
"0.55063117",
"0.5464037",
"0.54574937",
"0.5457471",
"0.5438049",
"0.542991",
"0.54258776",
"0.5416063",
"0.5390783",
"0.53817135",
"0.5352... | 0.7384039 | 0 |
Tests metadata validation failure. | def test_metadata_invalid(aquarius_instance):
result, errors = aquarius_instance.validate_metadata(
{"some_dict": "that is invalid"}
)
assert result is False
assert errors[0]["message"] == "'main' is a required property" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _validate(self):\n if not self._contents.has_key('type'):\n raise ValidationFailed(\"Metadata file %s contains no type field\" % (self._filename))\n \n if not self._contents.has_key('version'):\n raise ValidationFailed(\"Metadata file %s contains no version field\" %\... | [
"0.75597596",
"0.701566",
"0.69618696",
"0.693021",
"0.69266003",
"0.6891616",
"0.68451726",
"0.681799",
"0.6811423",
"0.67585623",
"0.6753354",
"0.6746496",
"0.6717099",
"0.6708003",
"0.67052484",
"0.670427",
"0.67034584",
"0.67031956",
"0.6700609",
"0.6700406",
"0.66814774"... | 0.82937527 | 0 |
Tests text search with an invalid text. | def test_invalid_text_search(aquarius_instance):
text = "foo_text"
with pytest.raises(ValueError):
aquarius_instance.text_search(text=text, sort="foo_sort") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_non_existent_term_search(self):\n\n expected_results = []\n results = self.searcher.search(\"asdasdasdas\")\n\n self.assertListEqual(results, expected_results)",
"def test_get_texts_ignores():\n file_map = sd.get_file_map(\".\")\n texts = sd.get_texts(file_map)\n ingnores =... | [
"0.6853061",
"0.67395306",
"0.6729183",
"0.66989034",
"0.6610108",
"0.62915605",
"0.62732273",
"0.6252033",
"0.6237632",
"0.6236851",
"0.6173948",
"0.61734813",
"0.61181164",
"0.61149514",
"0.6083541",
"0.60826635",
"0.6080239",
"0.60655",
"0.6060025",
"0.6046781",
"0.6046596... | 0.7938886 | 0 |
Tests query search with an invalid query. | def test_invalid_search_query(aquarius_instance):
search_query = dict()
search_query["sort"] = "foo_sort"
with pytest.raises(ValueError):
aquarius_instance.query_search(search_query=search_query, sort="foo_sort") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_query_search_wrongfield(self):\r\n # Test first a non-existant field for all end-points\r\n for endpoint in self.endpoints:\r\n res = self.app.get(\"/api/%s?wrongfield=value\" % endpoint)\r\n err = json.loads(res.data)\r\n assert res.status_code == 415, err\r... | [
"0.7463945",
"0.73862934",
"0.7294621",
"0.7236369",
"0.72287714",
"0.71919495",
"0.7167107",
"0.7147223",
"0.7132126",
"0.70846224",
"0.7081743",
"0.7079348",
"0.70627487",
"0.7033699",
"0.702306",
"0.69042057",
"0.68690693",
"0.6863569",
"0.6847299",
"0.6805821",
"0.6796804... | 0.8103058 | 0 |
Helper method to make a `ValidationError` with an error message from ``self.error_messages``. | def make_error(self, key: str, **kwargs) -> ValidationError:
try:
msg = self.error_messages[key]
except KeyError as error:
class_name = self.__class__.__name__
message = (
"ValidationError raised by `{class_name}`, but error key `{key}` does "
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, message=\"\"):\n super(ValidationError, self).__init__(message)",
"def message_error_validator():\n\n return validator.MessageErrorSchema()",
"def __init__(self, message, code=None, params=None):\n super().__init__(message, code, params)\n\n if isinstance(message, Val... | [
"0.7087418",
"0.7046672",
"0.65143126",
"0.61244714",
"0.6077658",
"0.5990751",
"0.59044415",
"0.58713067",
"0.5865902",
"0.5841163",
"0.579239",
"0.5790322",
"0.5790322",
"0.5790322",
"0.5790322",
"0.5790322",
"0.576437",
"0.5758176",
"0.5727742",
"0.57048655",
"0.5692221",
... | 0.7143566 | 0 |
Update field with values from its parent schema. Called by | def _bind_to_schema(self, field_name, schema):
self.parent = self.parent or schema
self.name = self.name or field_name
self.root = self.root or (
self.parent.root if isinstance(self.parent, FieldABC) else self.parent
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _populate(self, fields):\n schema = self.schema\n for k, v in fields.items():\n fields[k] = schema.fields[k].iget(self, v)\n\n self.modify(fields)\n self.reset_modified()",
"def save(self, force_insert=False, force_update=False, using=None, update_fields=None):\n\n ... | [
"0.6299542",
"0.6057109",
"0.6021248",
"0.6002498",
"0.59442854",
"0.5868224",
"0.5866876",
"0.580259",
"0.57914436",
"0.5787847",
"0.57775307",
"0.5776756",
"0.57097965",
"0.5690907",
"0.5687777",
"0.56186974",
"0.5616425",
"0.56141406",
"0.56136394",
"0.5589981",
"0.5559479... | 0.6322555 | 0 |
The nested Schema object. | def schema(self):
if not self._schema:
# Inherit context from parent.
context = getattr(self.parent, "context", {})
if callable(self.nested) and not isinstance(self.nested, type):
nested = self.nested()
else:
nested = self.nested
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_schema(self) -> dict:\n return schemas.get_object_schema(self.schema)",
"def schema(self):\n # type: () -> object\n return self._schema",
"def schema(self):\n # NOTE This is exactly the same as the other thing.\n return {\n \"$id\": f\"{self.request.resourc... | [
"0.7417938",
"0.73433465",
"0.721164",
"0.72089213",
"0.7207553",
"0.7015725",
"0.694689",
"0.6910731",
"0.69078165",
"0.6868696",
"0.68673867",
"0.6841997",
"0.6806168",
"0.6793",
"0.67813885",
"0.6707959",
"0.66917336",
"0.66870177",
"0.6638969",
"0.6627835",
"0.66006446",
... | 0.78904915 | 0 |
Return the number value for value, given this field's `num_type`. | def _format_num(self, value) -> typing.Any:
return self.num_type(value) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def number_value(self) -> typing.Optional[jsii.Number]:\n return self._values.get('number_value')",
"def visit_Num(self, node):\n token = node.token\n if token.type in (INTEGER, FLOAT):\n return token.value",
"def _format_num(self, value):\n if value is None or value == \... | [
"0.6996921",
"0.67933404",
"0.677056",
"0.664107",
"0.6566424",
"0.65062356",
"0.6478344",
"0.6429557",
"0.6425134",
"0.63639134",
"0.6341995",
"0.63223517",
"0.63132674",
"0.6310797",
"0.6210259",
"0.61934984",
"0.6181933",
"0.61805826",
"0.61581624",
"0.6155139",
"0.6155139... | 0.7014416 | 0 |
Compute the signed difference between two ticks values assuming that they are within 228 ticks | def ticks_diff(ticks1: int, ticks2: int) -> int:
diff = (ticks1 - ticks2) & _TICKS_MAX
diff = ((diff + _TICKS_HALFPERIOD) & _TICKS_MAX) - _TICKS_HALFPERIOD
return diff | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tickDiff(tStart, tEnd):\n tDiff = tEnd - tStart\n if tDiff < 0:\n tDiff += (1 << 32)\n return tDiff",
"def _diff(rankx, ranky):\n shift = int64(32)\n mask = int64((1 << 32) - 1)\n scale = float64(mask + 1)\n hi = ranky >> shift\n hi -= rankx >> shift\n lo = ranky & mask\n lo -... | [
"0.7096044",
"0.6290616",
"0.6263322",
"0.61980844",
"0.61457634",
"0.6103989",
"0.6056919",
"0.6032005",
"0.60110533",
"0.60090894",
"0.5928087",
"0.5863945",
"0.58502585",
"0.5842739",
"0.584219",
"0.5827527",
"0.5783207",
"0.5779781",
"0.5697657",
"0.5665296",
"0.56532973"... | 0.72678226 | 0 |
Set preamp boost if needed. | def set_boost(self, setting: int) -> None:
if self._tx_power >= 18:
self._write_u8(_REG_TEST_PA1, setting)
self._write_u8(_REG_TEST_PA2, setting) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_boost(self, boost):\r\n self._boost = float(boost)\r\n return self",
"def preprocessing(self, preprocessing):\n\n self._preprocessing = preprocessing",
"def pre(self, pre):\n\n self._pre = pre",
"def set_prior(self,field):\n self.observation_thresholds = [i/self.obs... | [
"0.71698284",
"0.6057049",
"0.6045289",
"0.58805627",
"0.5823753",
"0.5799059",
"0.57005906",
"0.5687448",
"0.5652487",
"0.5550836",
"0.552348",
"0.54762197",
"0.54762197",
"0.54762197",
"0.54762197",
"0.54762197",
"0.5455941",
"0.5445621",
"0.54303837",
"0.5372213",
"0.53587... | 0.6206088 | 1 |
Transmit a packet which is queued in the FIFO. This is a low level function for entering transmit mode and more. For generating and transmitting a packet of data use | def transmit(self) -> None:
# Like RadioHead library, turn on high power boost if enabled.
self.set_boost(_TEST_PA1_BOOST)
# Enable packet sent interrupt for D0 line.
self.dio_0_mapping = 0b00
# Enter TX mode (will clear FIFO!).
self.operation_mode = TX_MODE | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_packet(self, pk):\n try:\n self.out_queue.put(pk, True, 2)\n except queue.Full:\n if self.link_error_callback:\n self.link_error_callback('RadioDriver: Could not send packet'\n ' to copter')",
"def enqueue(self, p... | [
"0.6799317",
"0.66607165",
"0.65970594",
"0.6526778",
"0.6524702",
"0.65026426",
"0.6370544",
"0.634084",
"0.63251054",
"0.63249505",
"0.63087344",
"0.6308734",
"0.6300572",
"0.62969637",
"0.6152878",
"0.6143387",
"0.61157775",
"0.6081174",
"0.60724217",
"0.605968",
"0.602739... | 0.690187 | 0 |
The operation mode value. Unless you're manually controlling the chip you shouldn't change the operation_mode with this property as other sideeffects are required for | def operation_mode(self) -> int:
op_mode = self._read_u8(_REG_OP_MODE)
return (op_mode >> 2) & 0b111 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def operation_mode(self):\n return self._operation_mode",
"def set_current_operation_mode(self, operation_mode):\n self._current_operation_mode = operation_mode\n \"\"\"Retrieve from textual representation\"\"\"\n if self._current_operation_mode == 'Off':\n self._api._opmod... | [
"0.85864955",
"0.7999506",
"0.79475164",
"0.7782337",
"0.74315965",
"0.71875495",
"0.7183625",
"0.7183625",
"0.7183625",
"0.718244",
"0.71808684",
"0.7176511",
"0.714119",
"0.71347487",
"0.71347487",
"0.71347487",
"0.7125456",
"0.70654106",
"0.7055795",
"0.7030046",
"0.702806... | 0.8443302 | 1 |
The synchronization word value. This is a byte string up to 8 bytes long (64 bits) which indicates the synchronization word for transmitted and received packets. Any received packet which does not include this sync word will be ignored. The default value is 0x2D, 0xD4 which matches the RadioHead RFM69 library. Setting ... | def sync_word(self) -> bytearray:
# Handle when sync word is disabled..
if not self.sync_on:
return None
# Sync word is not disabled so read the current value.
sync_word_length = self.sync_size + 1 # Sync word size is offset by 1
# according to datasheet.
syn... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_sync_word(self, value):\n # Check format\n if value > 0xFFFF:\n raise StationException(\"Synchronization words must be 2-byte length\")\n # Switch to command mode if necessary\n if self._sermode == SerialModem.Mode.DATA:\n self.enter_command_mode()\n ... | [
"0.7068167",
"0.498962",
"0.48821336",
"0.4796987",
"0.47242036",
"0.46907207",
"0.46847713",
"0.4683065",
"0.46232405",
"0.45894292",
"0.4573134",
"0.4545878",
"0.45093986",
"0.44993213",
"0.44934466",
"0.44657746",
"0.44532517",
"0.44433114",
"0.4422662",
"0.44034413",
"0.4... | 0.75501835 | 0 |
The length of the preamble for sent and received packets, an unsigned 16bit value. Received packets must match this length or they are ignored! Set to 4 to match the RadioHead RFM69 library. | def preamble_length(self) -> int:
msb = self._read_u8(_REG_PREAMBLE_MSB)
lsb = self._read_u8(_REG_PREAMBLE_LSB)
return ((msb << 8) | lsb) & 0xFFFF | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def PreambleFrameSizeMode(self):\n return self._get_attribute('preambleFrameSizeMode')",
"def get_payload_length(packet):\n adaptation_field_len = TS.get_adaptation_field_length(packet)\n return 188 - 4 - adaptation_field_len",
"def length(self):\n return struct.unpack('<H', self.pkt.payloa... | [
"0.65294045",
"0.62315285",
"0.6224753",
"0.62194717",
"0.6160026",
"0.5999125",
"0.58515507",
"0.58515507",
"0.58335",
"0.58311546",
"0.5754709",
"0.56870145",
"0.5678905",
"0.5671021",
"0.5615769",
"0.5606113",
"0.56047",
"0.5557328",
"0.5555257",
"0.55510217",
"0.5550402",... | 0.729363 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.