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 |
|---|---|---|---|---|---|---|
Save an origin value to use on queries | def _set_origin_value(self, origin):
self.origin_value = origin | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dd_origin(self, value):\n # type: (Optional[Text]) -> None\n with self._lock:\n if value is None:\n if ORIGIN_KEY in self._meta:\n del self._meta[ORIGIN_KEY]\n return\n self._meta[ORIGIN_KEY] = value",
"def __value_set(self,... | [
"0.6091325",
"0.57357675",
"0.56653804",
"0.56614685",
"0.5618488",
"0.5575527",
"0.556187",
"0.556187",
"0.547338",
"0.5406021",
"0.5370844",
"0.53542197",
"0.5350351",
"0.53096163",
"0.53062284",
"0.5279826",
"0.52372754",
"0.52298355",
"0.52176684",
"0.5217575",
"0.5202827... | 0.6532254 | 0 |
Add a new format spec to the instance format_specs list | def _add_format_spec(self, fmt_name_key: str, fmt_spec : gsfmt.CellFormat):
if not len(fmt_name_key) or not isinstance(fmt_spec, gsfmt.CellFormat):
raise (ValueError, "Invalid format specification data")
else:
self.format_specs[fmt_name_key] = fmt_spec | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def register_format(recipe):\n afr = AFMFormatRecipe(recipe)\n formats_available.append(afr)\n # suffix\n if afr.suffix not in formats_by_suffix:\n formats_by_suffix[afr.suffix] = []\n formats_by_suffix[afr.suffix].append(afr)\n # mode\n if afr.mode not in formats_by_mode:\n form... | [
"0.7146974",
"0.6825445",
"0.663929",
"0.6528774",
"0.6208254",
"0.60689723",
"0.5856289",
"0.57608104",
"0.5734846",
"0.5663578",
"0.5643447",
"0.55337346",
"0.5476939",
"0.5471573",
"0.5464896",
"0.54530036",
"0.54179347",
"0.5405175",
"0.54049385",
"0.5401836",
"0.53868914... | 0.74158067 | 0 |
Establish a connection to the replica RDR database for reading consent validation data | def _connect_to_rdr_replica(self):
self.gcp_env.activate_sql_proxy(replica=True)
self.db_conn = self.gcp_env.make_mysqldb_connection() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def connection():\n return await r.connect(db='main_db')",
"def execute(self):\n\n _logger.info('Setting up database connection and google doc access...')\n self._connect_to_rdr_replica()\n service_key_info = gcp_get_iam_service_key_info(self.gcp_env.service_key_id)\n gs_cred... | [
"0.625442",
"0.58984655",
"0.5780215",
"0.5758768",
"0.5725688",
"0.564928",
"0.5593552",
"0.5577131",
"0.5569192",
"0.5537173",
"0.5492825",
"0.5490403",
"0.54873645",
"0.5455939",
"0.5453139",
"0.54089165",
"0.5391422",
"0.53849643",
"0.5377653",
"0.5363893",
"0.5357962",
... | 0.7150206 | 0 |
Check if the dataframe provided has any records in a NEEDS_CORRECTING state | def _has_needs_correcting(self, dframe):
return (dframe.loc[dframe.sync_status == int(ConsentSyncStatus.NEEDS_CORRECTING)].shape[0] > 0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_data(dataframe):\n if dataframe.iloc[0, 0] == 'No data available':\n return False\n else:\n return True",
"def check_dataframe_valid(self, df, option):\n # display(df)\n if df[option].isna().sum() > df.shape[0]/2:\n print(\"invalid data\")\n retur... | [
"0.71063054",
"0.69644153",
"0.6762941",
"0.64899373",
"0.63022524",
"0.6250076",
"0.62015414",
"0.61442494",
"0.61383057",
"0.61060566",
"0.60005355",
"0.5953498",
"0.5951185",
"0.593924",
"0.5927322",
"0.59184295",
"0.5914099",
"0.589844",
"0.5895525",
"0.5890846",
"0.58906... | 0.73327243 | 0 |
Use the rowcol_to_a1() gspread method to construct an A1 cell range notation string A starting row position is required. A starting col of 1 is the presumed default. If no ending row/col is provided, then assume the ending position is the same row and/or column | def _make_a1_notation(self, start_row, start_col=1, end_row=None, end_col=None):
# Assume single row / single col if no ending coordinate is provided
end_row = end_row or start_row
end_col = end_col or start_col
# Sanity check on row and column values vs. defined spreadsheet dimensions... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_possible_coords(starting,a_range,min_cell_distance): \n a_raw= np.arange(a_range[0]+starting,a_range[1]-starting+1,min_cell_distance)\n \n if len(a_raw) == 0:\n return a_raw\n \n if not check_if_range_filled(a_range,a_raw[-1], min_cell_distance):\n # put one more number on... | [
"0.52832127",
"0.5120392",
"0.5114396",
"0.5079662",
"0.50487936",
"0.49870872",
"0.4861707",
"0.476002",
"0.4741984",
"0.46903348",
"0.4647389",
"0.4612369",
"0.46121863",
"0.45974645",
"0.45276794",
"0.44889247",
"0.4480362",
"0.44429442",
"0.44367123",
"0.43978715",
"0.437... | 0.7627547 | 0 |
Adds an element to a list of formatting spec elements that will be passed to gspreadformatting format_cell_ranges() | def _add_report_formatting(self, cell_range: str, fmt_spec: gsfmt.CellFormat):
self.report_formatting.append((cell_range, fmt_spec)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _add_format_spec(self, fmt_name_key: str, fmt_spec : gsfmt.CellFormat):\n if not len(fmt_name_key) or not isinstance(fmt_spec, gsfmt.CellFormat):\n raise (ValueError, \"Invalid format specification data\")\n else:\n self.format_specs[fmt_name_key] = fmt_spec",
"def _update... | [
"0.59954387",
"0.5444225",
"0.54423445",
"0.5364707",
"0.5140776",
"0.5117938",
"0.50987047",
"0.50954723",
"0.5025292",
"0.49730688",
"0.4888233",
"0.48854625",
"0.48179293",
"0.47838387",
"0.47599486",
"0.47282934",
"0.47228885",
"0.4717877",
"0.46833175",
"0.46764064",
"0.... | 0.7562673 | 0 |
Add a row or rows with the requested text (e.g., Report Date line, Notes, etc.) to the report content | def _add_text_rows(self, text_rows=[], format_spec=None, row_pos=None):
if not row_pos:
row_pos = self.row_pos
end_of_text_pos = row_pos + len(text_rows)
cell_range = self._make_a1_notation(row_pos, end_row=end_of_text_pos)
self._add_report_rows(cell_range, text_rows)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_text(self, text):\n text_template = self.templateEnv.get_template(f'{ReportGenerator.COMPONENTS_FOLDER}/text.html')\n text_output = text_template.render(text=text)\n self.contents.append(text_output)",
"def appendReport(self,text:str) -> None:\n #TODO add colorize text\n ... | [
"0.6856379",
"0.6633162",
"0.6552309",
"0.65370566",
"0.6328708",
"0.6252063",
"0.615803",
"0.5975446",
"0.5934266",
"0.58800566",
"0.5876456",
"0.58623344",
"0.5757502",
"0.5735604",
"0.5705901",
"0.57025427",
"0.5625327",
"0.55931973",
"0.5591919",
"0.5572077",
"0.5539282",... | 0.69938344 | 0 |
Builds a counts section shaded header row with the all the column headers. This section header is used for both the aggregate (all entities) counts, as well as for each section when the error counts are broken down by HPO/Org | def _add_consent_issue_count_header_section(self, row_pos=None, hpo=''):
if not row_pos:
row_pos = self.row_pos
# The column header string is the first element of each tuple in the CONSENT_ERROR_COUNT_COLUMNS tuple list
count_headers = [column_tuple[0] for column_tuple in CONSENT_ER... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_ws_header(work_sheet, max_hits):\n first_header_info = ['Query #', 'Query Sequence',\n 'Top Hit Accession in L.h.', 'E-Value', 'Filename']\n r = 1\n c = 1\n for val in first_header_info:\n c = set_cell(ws, r, c, val)",
"def buildStatsTableHeader(self, table):\n... | [
"0.61085266",
"0.60840535",
"0.59641546",
"0.5954682",
"0.5947853",
"0.5851404",
"0.5846159",
"0.57913685",
"0.5774662",
"0.57106256",
"0.56272405",
"0.5624828",
"0.5602672",
"0.5591791",
"0.5560647",
"0.5553418",
"0.55117494",
"0.55117494",
"0.5486394",
"0.5450867",
"0.54489... | 0.6762367 | 0 |
Builds and populates a subsection of rows, with one row per consent type, indicating its status/error counts | def _add_consent_issue_counts(self, df, row_pos=None, org=None, show_all_counts=False):
if not row_pos:
row_pos = self.row_pos
# Track if we've already generated a row containing the organization name. It's only included with the first
# line / first consent that has associated err... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_consent_validation_dataframe(self, sql_template):\n if not self.db_conn:\n raise (EnvironmentError, 'No active DB connection object')\n\n df = pandas.DataFrame()\n for consent_int in CONSENTS_LIST:\n sql = sql_template\n # The tuple retrieved from the ... | [
"0.5890764",
"0.5368371",
"0.5154031",
"0.51414526",
"0.51323485",
"0.50576174",
"0.50429255",
"0.5026385",
"0.5016203",
"0.49888837",
"0.49404266",
"0.49371797",
"0.49260554",
"0.49223885",
"0.4909809",
"0.48857537",
"0.48711845",
"0.48421708",
"0.48260134",
"0.4819815",
"0.... | 0.59590906 | 0 |
Generate HPO/Organizationspecific breakdowns of the consent error metrics. Only organizations for which there were associated errors will be included in the report output. | def _add_errors_by_org(self, df=None):
if df is None:
df = self.consent_df
# Iterate over list of distinct (pandas: unique() ) HPO names in the dataframe
hpos = df['hpo'].unique()
for hpo in sorted(hpos):
hpo_df = df[df.hpo == hpo] # Yields an HPO-filtered data... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_error_analysis(self, to_stdout = True):\n message = ''\n message += 'Error report for LGH\\n'\n message += '|{:5}|{:20}|{:15}|{:8}|{:8}|{:8}|{:8}|\\n'.format(\n 'Nr','Name','E_DFT','Err_LGH','per_ads','Err_noLI','per_ads')\n\n merr_LGH = 0.0\n sumerrLGH = 0.0... | [
"0.53887427",
"0.5343811",
"0.51258266",
"0.511208",
"0.5065214",
"0.5009235",
"0.49914053",
"0.49873456",
"0.497617",
"0.49706772",
"0.49676389",
"0.49642724",
"0.49553967",
"0.49537438",
"0.49316207",
"0.49288034",
"0.48829147",
"0.48765743",
"0.48681667",
"0.48609066",
"0.... | 0.67877924 | 0 |
Queries the RDR participant summary/consent_file tables for entries of each consent type for which validation has been implemented, and merges the results into a single pandas dataframe | def _get_consent_validation_dataframe(self, sql_template):
if not self.db_conn:
raise (EnvironmentError, 'No active DB connection object')
df = pandas.DataFrame()
for consent_int in CONSENTS_LIST:
sql = sql_template
# The tuple retrieved from the CONSENT_PART... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def execute(self):\n\n _logger.info('Setting up database connection and google doc access...')\n self._connect_to_rdr_replica()\n service_key_info = gcp_get_iam_service_key_info(self.gcp_env.service_key_id)\n gs_creds = gspread.service_account(service_key_info['key_path'])\n gs_f... | [
"0.5781551",
"0.55633926",
"0.55551034",
"0.5343965",
"0.5221478",
"0.52181095",
"0.5183125",
"0.50217754",
"0.50200987",
"0.50143355",
"0.4999556",
"0.499852",
"0.49892178",
"0.4966448",
"0.4957733",
"0.494013",
"0.49327323",
"0.489223",
"0.48719907",
"0.48563895",
"0.483640... | 0.65319884 | 0 |
Make the batch calls to add all the cell data and apply the formatting to the spreadsheet | def _write_report_content(self):
self.worksheet.batch_update(self.report_data)
gsfmt.format_cell_ranges(self.worksheet, self.report_formatting) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _fillinSheet(self,sheet,data,startrow=2):\n i = startrow-1\n for r in data:\n j = 0\n for c in r:\n sheet.write(i,j,c)\n j+=1\n i += 1",
"def post_data(self, data):\n # Check for enough room in spreadsheet\n num_rows =... | [
"0.6308049",
"0.6260671",
"0.6167275",
"0.60716575",
"0.59524393",
"0.59457964",
"0.58237576",
"0.57770276",
"0.5768747",
"0.5759938",
"0.5759938",
"0.5748345",
"0.568211",
"0.5632575",
"0.5629826",
"0.56294364",
"0.56021",
"0.55941623",
"0.5592189",
"0.55533224",
"0.55387837... | 0.6668357 | 0 |
Generate a CSV file with the consent error details (originally just for PTSC). | def create_csv_errors_file(self):
errors_df = self.consent_df[self.consent_df.sync_status == int(ConsentSyncStatus.NEEDS_CORRECTING)]
# Initialize the list of lists which will be passed to CSV writer writerows(), with the first row of headers
output_rows = [PTSC_CSV_COLUMN_HEADERS]
# i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_audit(self, output_path):\n \n with open(output_path, 'wb') as csvfile:\n csvwriter = csv.writer(csvfile, delimiter=',')\n csvwriter.writerow([entry[0] for entry in self.fields])\n for trade, bo_error in self.errors.items():\n values = self... | [
"0.571711",
"0.53938305",
"0.5367853",
"0.5331646",
"0.5310962",
"0.52766144",
"0.5156473",
"0.511546",
"0.5096725",
"0.5091721",
"0.507398",
"0.5056229",
"0.5032548",
"0.5011785",
"0.4997286",
"0.49891025",
"0.4942131",
"0.4925943",
"0.490009",
"0.48773566",
"0.4860152",
"... | 0.7858568 | 0 |
Add content that appears on every daily consent validation report regardless of errors | def add_daily_summary(self):
auth_date = self.report_date.strftime("%b %-d, %Y")
now = datetime.now().strftime("%x %X")
report_title = ' '.join([
f'Report for {self.origin_value} participant consents authored on: {auth_date} 12:00AM-11:59PM UTC',
f'(generated on {now} Cen... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_weekly_recent_errors_section(self):\n start_date = self.start_date.date()\n end_date = self.end_date.date()\n # Created a filtered dataframe from the main unresolved errors dataframe, where the authored dates for the\n # consents with unresolved issues is within the report date ... | [
"0.6360273",
"0.62828994",
"0.5352125",
"0.5352021",
"0.5311068",
"0.5232369",
"0.5189931",
"0.5183707",
"0.50908655",
"0.50711954",
"0.5037153",
"0.5025839",
"0.500487",
"0.49979457",
"0.4994323",
"0.4957642",
"0.49429378",
"0.49423778",
"0.49390593",
"0.48788843",
"0.487505... | 0.6549976 | 0 |
Add a new daily report tab/sheet to the google sheet file, with the validation details for that date | def create_daily_report(self, spreadsheet):
if not self.args.csv_only:
existing_sheets = spreadsheet.worksheets()
# Perform rolling deletion of the oldest reports so we keep a pre-defined maximum number of daily reports
# NOTE: this assumes all the reports in the file were g... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_daily_summary(self):\n auth_date = self.report_date.strftime(\"%b %-d, %Y\")\n now = datetime.now().strftime(\"%x %X\")\n report_title = ' '.join([\n f'Report for {self.origin_value} participant consents authored on: {auth_date} 12:00AM-11:59PM UTC',\n f'(generate... | [
"0.60511535",
"0.59116364",
"0.57340235",
"0.5627186",
"0.56119955",
"0.55683774",
"0.55427915",
"0.55160594",
"0.5477048",
"0.5391133",
"0.53281987",
"0.5328016",
"0.52983695",
"0.52547556",
"0.5236491",
"0.5229354",
"0.5215155",
"0.5194465",
"0.5186149",
"0.5177279",
"0.517... | 0.733173 | 0 |
Execute the DailyConsentReport builder | def execute(self):
# Set up DB and googlesheets doc access
self._connect_to_rdr_replica()
service_key_info = gcp_get_iam_service_key_info(self.gcp_env.service_key_id)
gs_creds = gspread.service_account(service_key_info['key_path'])
gs_file = gs_creds.open_by_key(self.doc_id)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_daily_activity_report(request, ids, index, value, start_date, end_date, stats):\n \n domain = request.user.selected_domain\n \n if request.GET.has_key('chw'): chw = request.GET['chw']\n else: raise Exception(\"This reports requires a CHW parameter\")\n\n if not ids: raise Exception(\"The ... | [
"0.61378366",
"0.59800845",
"0.58895946",
"0.5865762",
"0.5806272",
"0.5623721",
"0.56177044",
"0.5575133",
"0.55383706",
"0.55128735",
"0.5462282",
"0.54442364",
"0.54260707",
"0.54042786",
"0.5386881",
"0.5302559",
"0.5300422",
"0.52808213",
"0.5265332",
"0.5257063",
"0.525... | 0.61008996 | 1 |
Returns a dataframe of all issues marked OBSOLETE up to and including on the report end date. OBSOLETE implies the file which did not pass validation has been superseded by a new/retransmitted consent file which was successfully validated. In some cases, a consent_file entry may be marked OBSOLETE after a manual inspec... | def get_resolved_consent_issues_dataframe(self):
sql = ALL_RESOLVED_SQL + ORIGIN_SQL_FILTER
sql = sql.format_map(SafeDict(validation_end_date=self.validation_end_date.strftime("%Y-%m-%d"),
origin_filter=self.origin_value.lower()))
resolved_df = pandas.read_s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_test_df_complete():\n import requests\n from zipfile import ZipFile\n import StringIO\n zip_to_download = \"https://resources.lendingclub.com/LoanStats3b.csv.zip\"\n r = requests.get(zip_to_download)\n zipfile = ZipFile(StringIO.StringIO(r.content))\n file_csv = zipfile.namelist()[0]\n... | [
"0.5288257",
"0.5189965",
"0.47816607",
"0.47790524",
"0.47657558",
"0.47349474",
"0.47045895",
"0.46155402",
"0.45960194",
"0.45320317",
"0.4521553",
"0.4517648",
"0.45025817",
"0.44897887",
"0.44813117",
"0.44511914",
"0.44510186",
"0.4440711",
"0.44365",
"0.44361082",
"0.4... | 0.54034704 | 0 |
Add a section/subtable that tracks how many consent issues have been resolved, overall and during the date range covered by the report. "Resolved" means consent_file entries that have been marked OBSOLETE as their sync_status, indicating a newer file was received that has passed validation. The modified date of an OBSO... | def add_weekly_file_issue_burndown_section(self):
# Count of all resolved (OBSOLETE) consent files, and all of the oustanding issues (main report data in the
# self.consent_df dataframe). These dataframes were populated at the start of the report execution
total_resolved = self.resolved_df.sha... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_weekly_recent_errors_section(self):\n start_date = self.start_date.date()\n end_date = self.end_date.date()\n # Created a filtered dataframe from the main unresolved errors dataframe, where the authored dates for the\n # consents with unresolved issues is within the report date ... | [
"0.6517565",
"0.54584134",
"0.54540205",
"0.5405387",
"0.5323405",
"0.52332926",
"0.48287955",
"0.4771674",
"0.47545588",
"0.4668555",
"0.45407295",
"0.453359",
"0.45138377",
"0.4476937",
"0.44189847",
"0.43935904",
"0.4371925",
"0.43568125",
"0.43201283",
"0.43186924",
"0.43... | 0.6527052 | 0 |
Provide a breakdown of unresolved issues detected in the report date range, from recently authored consents | def add_weekly_recent_errors_section(self):
start_date = self.start_date.date()
end_date = self.end_date.date()
# Created a filtered dataframe from the main unresolved errors dataframe, where the authored dates for the
# consents with unresolved issues is within the report date range
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _render_reported(self) -> dict:\n logging.debug(f\"Fetching reported bugs for {self.user.display_name}\")\n reported = defaultdict(list)\n tasks = self.user.searchTasks(\n bug_reporter=self.user, status=self.status, created_since=self.since\n )\n tasks = [LPWrap(t)... | [
"0.64599174",
"0.6080665",
"0.6066675",
"0.5808683",
"0.5722426",
"0.5699113",
"0.567251",
"0.5628719",
"0.5605028",
"0.5601962",
"0.5598604",
"0.55594254",
"0.5551096",
"0.54809886",
"0.5478825",
"0.54464185",
"0.5409271",
"0.5406901",
"0.5370287",
"0.53369457",
"0.53171647"... | 0.6192559 | 1 |
Retrieve the number of tables present in the database | def __len__(self):
return self.dbms.getNbTables(self.db) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ntables(self):\n return len(self.__tables)",
"def ntables(self):\n return len(self.__tables)",
"def getNumTables(self):\n return self.numtables",
"def get_table_count(table_name):\n conn = get_connect()\n cursor = conn.execute(\"SELECT COUNT(*) FROM \" + table_name)\n count ... | [
"0.8145447",
"0.8145447",
"0.8114119",
"0.78184915",
"0.75539285",
"0.74147165",
"0.7411709",
"0.72343624",
"0.71927655",
"0.71495163",
"0.7136197",
"0.7130694",
"0.70884126",
"0.70884126",
"0.69879526",
"0.69388527",
"0.691254",
"0.69053406",
"0.6882225",
"0.68218577",
"0.67... | 0.8563305 | 0 |
Similar to interval_query except that only values in the blocks are fetched | def interval_query_blocked(self, chrom, start, end, block_starts, block_sizes):
n_blocks = len(block_starts)
value_starts = np.cumsum([0] + block_sizes)[:-1]
length = np.sum(block_sizes)
values = np.full(length, np.nan, dtype='float64')
for i, block_start, block_size in zip(rang... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def interval_query(cur, table, start, num_rows):\n nresults = cur.execute(\"\"\"SELECT * FROM {} LIMIT {},{}\"\"\".format(table, start, num_rows))\n return nresults, cur",
"def get_sleep_data(start, end):\n cnx, cursor = connect_db()\n query = \"\"\"select \"from\" as _if, \"to\" as _it, delta\n ... | [
"0.59881264",
"0.5713245",
"0.5579311",
"0.55226386",
"0.5499543",
"0.54423344",
"0.5428136",
"0.54183125",
"0.54062074",
"0.53568435",
"0.5352032",
"0.53319144",
"0.53151315",
"0.52991194",
"0.5291896",
"0.5276234",
"0.5272493",
"0.5242434",
"0.52345836",
"0.5231756",
"0.522... | 0.66614926 | 0 |
anticaptcha_key str | anticaptcha com api key gb bool | True default | Show blance on startup | def __init__(self, anticaptcha_key, gb=True):
self.solver = hCaptchaProxyless()
self.solver.set_key(anticaptcha_key)
self.solver.set_website_url("https://2ch.hk/")
# self.solver.set_website_url("https://2ch.pm/")
# self.solver.set_verbose(1) # debug
self.solver.set_websit... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def apikey_bing(self, ctx, key):\n settings = loadauth()\n settings['apikey'] = key\n saveauth(settings)\n return await self.bot.say(\"Bing API key saved.\")",
"def _apikey():\n return __opts__.get(\"bamboohr\", {}).get(\"apikey\", None)",
"def check_av_key(show_output: boo... | [
"0.61280024",
"0.6071189",
"0.5912534",
"0.57820755",
"0.5728642",
"0.56398314",
"0.5534863",
"0.5519876",
"0.55193615",
"0.5507338",
"0.54924357",
"0.5449495",
"0.54443884",
"0.5399823",
"0.5345974",
"0.52975255",
"0.52800316",
"0.52753466",
"0.5256352",
"0.5256352",
"0.5256... | 0.63601124 | 0 |
board int | b/vg/v/s/etc thread int | thread's number comment str | post's text filepath str | path to image filebin bin | binary file email str | post's email field. set to 'sage' as optional | def send_post(self, board, thread, comment='', filepath=None, filebin=None, email=''):
if filepath:
file = {}
file['image'] = open(filepath,'rb').read()
elif filebin:
file = {}
file['image'] = filebin
else:
file = None
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bb_thread(hit):\n try:\n post_id = hit.group(1)\n t = Thread.objects.get(id=post_id)\n return '<a href=\"%s\"><img src=\"%snewspaper.png\" alt=\"forum\" border=\"0\" /> %s</a>' % (t.get_absolute_url(), settings.MEDIA_URL, t)\n except:\n return \"[thread]%s[/thread]\" % (post_i... | [
"0.60348296",
"0.5493888",
"0.5398787",
"0.53939867",
"0.5341845",
"0.52711207",
"0.5220245",
"0.51988024",
"0.5096451",
"0.5081543",
"0.5076789",
"0.50634235",
"0.5000933",
"0.497812",
"0.49768263",
"0.49534184",
"0.4948819",
"0.49009764",
"0.48885053",
"0.48376876",
"0.4760... | 0.6764217 | 0 |
board int | b/vg/v/s thread int | thread number comment str | post text tasks int | posts' quantity delay int | posts' delay | def send_multi_posts(self, board, thread, comment, tasks, delay=15):
threads = []
for i in range(tasks):
task = threading.Thread(target=self.send_post, args=(board, thread, comment,))
threads.append(task)
for i in threads:
i.run()
time.sleep(d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def thread(self, board, t_id):\n OP = self.posts_coll.find_one( {'board' : board, 'thread':0, 'id': t_id } )\n if not OP:\n return None\n replies = self.posts_coll.find( {'board':board, 'thread':t_id} ).sort('id',1)\n OP=self.__process_data(OP)\n replies=map(self.__pro... | [
"0.627123",
"0.5941436",
"0.56813437",
"0.56326663",
"0.5508337",
"0.5468553",
"0.54118234",
"0.53883207",
"0.53716594",
"0.53601426",
"0.53351516",
"0.5287869",
"0.5239106",
"0.5221678",
"0.5197666",
"0.5157866",
"0.51572984",
"0.5136322",
"0.5109492",
"0.5104251",
"0.509326... | 0.61865145 | 1 |
The reservation ID. It must only contain lower case alphanumeric characters or dashes. It must start with a letter and must not end with a dash. Its maximum length is 64 characters. | def reservation_id(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "reservation_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reservation_id(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"reservation_id\")",
"def unique_id() -> str:",
"def generate_id(self):\n unique_id = \"\"\n\n while len(unique_id) < self.id_length:\n ascii_number = self.get_random_bits()\n\n if se... | [
"0.72107565",
"0.6215774",
"0.6115289",
"0.6083968",
"0.59863174",
"0.59438366",
"0.5930669",
"0.5891881",
"0.58874583",
"0.58606213",
"0.5849437",
"0.5844559",
"0.58276296",
"0.58117026",
"0.5800415",
"0.57942986",
"0.57917863",
"0.5784229",
"0.5705065",
"0.56694347",
"0.563... | 0.74987274 | 0 |
Get an existing Reservation resource's state with the given name, id, and optional extra properties used to qualify the lookup. | def get(resource_name: str,
id: pulumi.Input[str],
opts: Optional[pulumi.ResourceOptions] = None) -> 'Reservation':
opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))
__props__ = ReservationArgs.__new__(ReservationArgs)
__props__.__dict__["concurre... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(resource_name: str,\n id: pulumi.Input[str],\n opts: Optional[pulumi.ResourceOptions] = None,\n force: Optional[pulumi.Input[bool]] = None,\n instance_id: Optional[pulumi.Input[str]] = None,\n state: Optional[pulumi.Input[str]] = None) -> 'InstanceStat... | [
"0.6176824",
"0.602813",
"0.59544617",
"0.56524587",
"0.56353015",
"0.5632037",
"0.5619159",
"0.55864173",
"0.55861753",
"0.5582017",
"0.55490166",
"0.5509263",
"0.54934204",
"0.5480631",
"0.54670835",
"0.54576075",
"0.5456151",
"0.5438582",
"0.53831345",
"0.53647673",
"0.534... | 0.6812139 | 0 |
The reservation ID. It must only contain lower case alphanumeric characters or dashes. It must start with a letter and must not end with a dash. Its maximum length is 64 characters. | def reservation_id(self) -> pulumi.Output[Optional[str]]:
return pulumi.get(self, "reservation_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reservation_id(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"reservation_id\")",
"def unique_id() -> str:",
"def generate_id(self):\n unique_id = \"\"\n\n while len(unique_id) < self.id_length:\n ascii_number = self.get_random_bits()\n\n if sel... | [
"0.74986017",
"0.62161773",
"0.6116146",
"0.608253",
"0.5985564",
"0.5942984",
"0.5931948",
"0.5892815",
"0.58871686",
"0.5860729",
"0.58497417",
"0.58447903",
"0.5826856",
"0.58116966",
"0.5800954",
"0.5793821",
"0.5791708",
"0.5784515",
"0.570618",
"0.5668731",
"0.5638348",... | 0.7210698 | 1 |
Reads the first assigned value of the given field in the CSV table. | def read_first_available_value(filename, field_name):
if not os.path.exists(filename):
return None
with open(filename, 'rb') as csvfile:
reader = csv.DictReader(csvfile)
for row in reader:
value = row.get(field_name)
if value:
return value
retu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_value(self, field):\n field = self.find_first(field)\n if field is not None:\n return field.value\n return None",
"def get_raw_value_from_dat_file(self, row, field):\n if len(self.field_map[field]) == 2:\n return row[int(self.field_map[field][0]) - 1:int(... | [
"0.65338564",
"0.6392548",
"0.63200605",
"0.6235137",
"0.62271905",
"0.6227104",
"0.6205975",
"0.61009073",
"0.60299647",
"0.59715605",
"0.5899107",
"0.5786881",
"0.5672882",
"0.5607519",
"0.5607519",
"0.55464906",
"0.54786897",
"0.5478634",
"0.54507464",
"0.5392752",
"0.5363... | 0.78890985 | 0 |
Find feed language based specified feed_info.txt or agency.txt. | def _find_feed_language(self):
self.feed_language = (
read_first_available_value(
os.path.join(self.src_dir, 'feed_info.txt'), 'feed_lang') or
read_first_available_value(
os.path.join(self.src_dir, 'agency.txt'), 'agency_lang'))
if not self.feed_la... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_language_and_script(tracker):\n script = \"latin\"\n language = \"en\"\n for event in reversed(tracker.events):\n if event.get(\"event\") == \"user\":\n parse_data = event['parse_data']\n language = parse_data['language']['name']\n script = parse_data['scrip... | [
"0.5673645",
"0.5647479",
"0.56020105",
"0.5571031",
"0.55647826",
"0.53777194",
"0.5375805",
"0.5362403",
"0.53613967",
"0.53380907",
"0.53045267",
"0.5272867",
"0.52718335",
"0.52285665",
"0.52186567",
"0.5201507",
"0.5196201",
"0.51960766",
"0.5194904",
"0.51707447",
"0.51... | 0.81017715 | 0 |
Read from the old translations.txt. | def _read_translations(self):
print('Reading original translations')
self.translations_map = {}
n_translations = 0
with open(os.path.join(self.src_dir, 'translations.txt'),
'rb') as csvfile:
reader = csv.DictReader(csvfile)
for row in reader:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_po(self, inputfile):\n is_index = False\n lines = inputfile.readlines()\n index = ''\n value = ''\n for line in lines:\n if line.startswith('#'):\n continue\n elif line.startswith('msgid'):\n is_index = True\n self.translations[index] = value\n index = ... | [
"0.7083933",
"0.6732633",
"0.6465155",
"0.6158682",
"0.614888",
"0.60751414",
"0.60555476",
"0.6042317",
"0.6030346",
"0.59518737",
"0.5946687",
"0.59321785",
"0.59061366",
"0.5901937",
"0.5898579",
"0.5871843",
"0.58335376",
"0.5791167",
"0.5780341",
"0.57705474",
"0.5764603... | 0.7820882 | 0 |
Converts translations to the new format and stores at dest_dir. | def convert_translations(self, dest_dir):
if not os.path.isdir(dest_dir):
os.makedirs(dest_dir)
total_translation_rows = 0
with open(os.path.join(dest_dir, 'translations.txt'),
'w+b') as out_file:
writer = csv.DictWriter(
out_file, fieldn... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_templates():\n logging.info(\"Copying english po files to %s\" % POT_PATH)\n\n # post them to exposed URL\n ensure_dir(POT_PATH)\n shutil.copy(get_po_filepath(lang_code=\"en\", filename=\"django.po\"), os.path.join(POT_PATH, \"kalite.pot\"))\n shutil.copy(get_po_filepath(lang_code=\"en\"... | [
"0.61304605",
"0.6127401",
"0.6020109",
"0.59459865",
"0.581514",
"0.5589771",
"0.5569576",
"0.552629",
"0.5501408",
"0.5423337",
"0.533577",
"0.53281415",
"0.5263715",
"0.5257556",
"0.52550787",
"0.5254142",
"0.52385944",
"0.5231954",
"0.5225831",
"0.5178422",
"0.5158825",
... | 0.7616336 | 0 |
Converts translations to the new format for a single table. | def _translate_table(self, dest_dir, table_name, translations_writer):
in_filename = os.path.join(self.src_dir, '%s.txt' % table_name)
if not os.path.exists(in_filename):
raise Exception('No %s' % table_name)
out_filename = os.path.join(dest_dir, '%s.txt' % table_name)
with ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def translation():\r\n class TranslationTable(tables.Table):\r\n normal = tables.Column(verbose_name=ugettext(\"Normal\"))\r\n lazy = tables.Column(verbose_name=ugettext(\"Lazy\"))\r\n\r\n table = TranslationTable([])\r\n assert \"Normal\" == table.columns[\"normal\"].header\r\n assert \"... | [
"0.6492108",
"0.62948155",
"0.5829504",
"0.58167523",
"0.5803534",
"0.5613545",
"0.5610526",
"0.5471775",
"0.5422812",
"0.5409286",
"0.54084456",
"0.5379219",
"0.53635305",
"0.5322141",
"0.5260752",
"0.52510554",
"0.5228141",
"0.521686",
"0.520735",
"0.5196291",
"0.5189624",
... | 0.65805835 | 0 |
update the metadata of reaciton rate coefficient and recalculate the coefficient. | def updateCoeff(self, **args):
for par in args:
self.rateCoeffMeta[par] = args[par]
meta = self.rateCoeffMeta
if self.rateCoeffMeta['type'] =="constant":
self.k = cp.k_const(meta['k'])
elif self.rateCoeffMeta['type'] =="Arrhenius":
self.k = cp.k_arr(me... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculateDataRate(self):\n pass",
"def update_coeff(self, **kwargs: float) -> None:\n for rule_name, coeff in kwargs.items():\n if rule_name not in self.rules:\n raise ValueError(f\"Behavioral rule {rule_name} does not exist\")\n else:\n self.... | [
"0.6021129",
"0.5977792",
"0.593172",
"0.5911446",
"0.5905327",
"0.5833648",
"0.5761443",
"0.5758439",
"0.5653352",
"0.5594094",
"0.5540426",
"0.54591227",
"0.54560506",
"0.54494727",
"0.54402846",
"0.5419622",
"0.5346483",
"0.53449684",
"0.53443253",
"0.53436756",
"0.5327697... | 0.74606794 | 0 |
Build ReactionSystem from a reactionList. | def buildFromList(self, reactionList, species, concs):
if len(species) != len(concs):
raise ValueError("Size of concentration does not match to number of species!")
self.concs = concs
self.reactionList = reactionList
self.nu_react = np.array([r.reactCoeff for r in self.react... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, reactorlist = None):\n self._reactors = []\n self.__reactornet_id = _cantera.reactornet_new()\n if reactorlist:\n for r in reactorlist:\n self.add(r)",
"def FromForm(form, aq_params=None):\n# max_priority = form.cleaned_max_priority\n ... | [
"0.57642335",
"0.5594035",
"0.5534022",
"0.53802794",
"0.5038385",
"0.49163276",
"0.48961812",
"0.48386648",
"0.47642723",
"0.4762929",
"0.4752844",
"0.46874735",
"0.46813458",
"0.46783254",
"0.46762016",
"0.4647771",
"0.4630938",
"0.46187398",
"0.4617532",
"0.46132183",
"0.4... | 0.69428736 | 0 |
Build ReactionSystem from an input file. | def buildFromXml(self, inputFile, concs):
reactionList, species = self.parse(inputFile, self.T, self.R)
if len(species) != len(concs):
raise ValueError("Size of concentration does not match to number of species!")
self.inputFile = inputFile
self.reactionList = reactionList
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_input(cls, input_file=sys.stdin, modify=None, warrior=None):\n\n # Detect the hook type if not given directly\n name = os.path.basename(sys.argv[0])\n modify = name.startswith('on-modify') if modify is None else modify\n\n # Create the TaskWarrior instance if none passed\n ... | [
"0.5643718",
"0.54447263",
"0.5386783",
"0.5302095",
"0.5281155",
"0.5273961",
"0.5240313",
"0.52301544",
"0.5208859",
"0.5202562",
"0.51907516",
"0.5185658",
"0.51715195",
"0.5162889",
"0.51486206",
"0.5140561",
"0.5118267",
"0.5112289",
"0.5088769",
"0.5086506",
"0.5036801"... | 0.6135577 | 0 |
Parse an XML input file and return list of chemkin.Reaction metadata | def parse(cls, inputFile, T, R):
try:
tree = ET.parse(inputFile)
except:
raise ValueError("Must be a valid xml file!")
root = tree.getroot()
species = root.find("phase").find("speciesArray").text.strip().split(" ")
# print(species)
reactionData = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reagent_parser(self, filename, initial_dictlist = dict()):\n results = initial_dictlist\n\n filepath = os.path.join(self.base_dir, filename)\n\n with open(filepath, 'r') as fileobj:\n xml = fileobj.read()\n parsed = BeautifulSoup(xml, \"lxml-xml\")\n\n subs... | [
"0.55100745",
"0.5489309",
"0.54722357",
"0.5407527",
"0.5288679",
"0.5268893",
"0.5266457",
"0.5245639",
"0.51868945",
"0.5186177",
"0.5182797",
"0.5144375",
"0.51268506",
"0.51094276",
"0.50958085",
"0.50695086",
"0.50626713",
"0.5039091",
"0.50373447",
"0.5035115",
"0.5032... | 0.644403 | 0 |
Peek into a file in order to determine the dialect for pandas.read_csv() / csv functions. | def peek_into_file(fname: Path) -> csv.Dialect:
with fname.open(mode='r') as f:
sniffer = csv.Sniffer()
logger.debug("has apikeyheader: %s", sniffer.has_header(f.readline()))
f.seek(0)
dialect = sniffer.sniff(f.readline(50))
logger.debug("delim: '%s'", dialect.delimiter)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_dialect(self):\n\t\tif self.is_single_col:\n\t\t\treturn None\n\n\t\tif self.delimiter and self.quotechar:\n\t\t\treturn Dialect(self.delimiter, self.quotechar,\n\t\t\t\t\t\tTrue if self.escapechar is None else False,\n\t\t\t\t\t\tself.escapechar)\n\n\t\text = os.path.basename(self.file_path).rsplit('.', m... | [
"0.64750993",
"0.60553634",
"0.5903723",
"0.5798548",
"0.5783687",
"0.55635816",
"0.5533242",
"0.5518387",
"0.5514191",
"0.5443149",
"0.54401344",
"0.54215",
"0.542069",
"0.54085094",
"0.5387677",
"0.53742045",
"0.53593",
"0.53567797",
"0.5352909",
"0.5342142",
"0.53392583",
... | 0.76841605 | 0 |
Implements ast.NodeVisitor callback for visiting an Import node. | def visit_Import(self, node: ast.Import) -> None:
self.imports.append(node)
# absolute imports - ignore indentation and just get all module names
for name in node.names:
self.modules.append(name.name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _analyse_stmt_Import(self, statement: ast.Import, *, next: CFNode) -> CFNode:\n return self._ast_node(statement, next=next, error=self._raise)",
"def on_import(self, function_graph, node, reason):",
"def visit_ImportFrom(self, node: Any): # noqa: N802\n # print(\"import from:\", node, dir(no... | [
"0.7020751",
"0.6813387",
"0.67597896",
"0.6668649",
"0.6395997",
"0.5849497",
"0.57580674",
"0.5566559",
"0.53986084",
"0.5389803",
"0.528939",
"0.52362275",
"0.52253616",
"0.52113587",
"0.51956993",
"0.5129135",
"0.51231605",
"0.5045267",
"0.5021895",
"0.5017034",
"0.501119... | 0.7397786 | 0 |
Adds missing module parents to the list of modules. | def add_module_parents(self):
for module in self.modules:
parents = get_module_parents(module)
missing_parents = [p for p in parents if p not in self.modules]
self.modules.extend(missing_parents) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_parent_modules(sys_args):\n script_path = os.path.abspath(os.path.dirname(sys_args))\n parent_path = os.path.dirname(script_path)\n parent_parent_path = os.path.dirname(parent_path)\n sys.path.append(parent_parent_path)",
"def update_parents(self):\n for a_parent in self.parents:\n ... | [
"0.6372351",
"0.58756095",
"0.5685747",
"0.56314063",
"0.55180913",
"0.5501585",
"0.5378181",
"0.527985",
"0.52699894",
"0.5251262",
"0.52456564",
"0.5211704",
"0.52067643",
"0.5206588",
"0.51873064",
"0.51801115",
"0.5132015",
"0.5094421",
"0.5061944",
"0.5025139",
"0.502404... | 0.8959669 | 0 |
Clean representation of a fan state. | def __repr__(self) -> str:
state = 'on' if self.is_on else 'off'
return f'<Fan name="{self.name}" state="{state}">' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return ''.join(str(e) + ' ' for e in self.state)",
"def reset(infr, state='empty'):\n infr.clear_edges()\n infr.clear_feedback()\n if state == 'empty':\n # Remove all edges, and component names\n infr.clear_name_labels()\n elif state ... | [
"0.5555717",
"0.54898363",
"0.54757243",
"0.54697144",
"0.5437679",
"0.5398936",
"0.5378802",
"0.53677917",
"0.52833855",
"0.52752185",
"0.5230421",
"0.52010614",
"0.5178433",
"0.51433074",
"0.5138198",
"0.51314914",
"0.5117417",
"0.5096787",
"0.5052112",
"0.5047071",
"0.5039... | 0.59676397 | 0 |
Add multi wire connectors for the given wires to a layer. | def add_multi_wire_connectors_to_layer(self, wire_indices, decoration_layer):
min_wire = min(wire_indices)
max_wire = max(wire_indices)
decoration_layer[min_wire] = self.charset.TOP_MULTI_LINE_GATE_CONNECTOR
for k in range(min_wire + 1, max_wire):
if k in wire_indices:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_connections(self, connections):\r\n\r\n for node1, node2, w in connections:\r\n self.add(node1, node2, w)",
"def add_connector(self):\n \n no = len(self.connectors)\n state = {}\n state[\"s_pin\"] = no\n state[\"p_pin\"] = no\n state[\"... | [
"0.6413979",
"0.59470165",
"0.59184426",
"0.5854831",
"0.5845237",
"0.57772076",
"0.57639563",
"0.5626985",
"0.5445081",
"0.54335123",
"0.5407809",
"0.53194124",
"0.52960837",
"0.52705294",
"0.520906",
"0.5123842",
"0.509908",
"0.5075686",
"0.5068668",
"0.50616515",
"0.505509... | 0.7365868 | 0 |
Resolve the decorations of the given Grid. If decorations are in conflict, they are automatically spread over multiple layers. | def resolve_decorations(self, grid, representation_grid):
j = 0
inserted_indices = []
for i in range(grid.num_layers):
layer_operators = _remove_duplicates(grid.layer(i))
decoration_layer = [""] * grid.num_wires
for op in layer_operators:
if... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resolve_representation(self, grid, representation_grid):\n for i in range(grid.num_layers):\n representation_layer = [\"\"] * grid.num_wires\n\n for wire_indices, operator in enumerate(grid.layer(i)):\n wire = self.active_wires[wire_indices]\n represen... | [
"0.47118253",
"0.4633364",
"0.4534701",
"0.4530129",
"0.45286912",
"0.4445445",
"0.43929982",
"0.4372573",
"0.43318287",
"0.4319938",
"0.4299635",
"0.4161932",
"0.41544726",
"0.4145012",
"0.4083268",
"0.40820834",
"0.40732133",
"0.40583706",
"0.40203077",
"0.3983133",
"0.3958... | 0.7479033 | 0 |
Pads the given representation so that width inside layers is constant. | def pad_representation(representation_grid, pad_str, prepend_str, suffix_str, skip_indices):
for i in range(representation_grid.num_layers):
layer = representation_grid.layer(i)
max_width = max(map(len, layer))
if i in skip_indices:
continue
# Ta... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def padding_width(self):\n ...",
"def test_pad_8():\n paddle.disable_static()\n x = np.array([[[[1.0, 3.0], [-3.0, 1.0]]]])\n pad = [1, 1, 1, 2]\n mode = \"constant\"\n value = np.array(2.0)\n data_format = \"NCHW\"\n res = np.array(\n [\n [\n [\n ... | [
"0.64046293",
"0.63198614",
"0.62178785",
"0.6117398",
"0.60267115",
"0.602015",
"0.601391",
"0.5978335",
"0.59577334",
"0.5942268",
"0.5940405",
"0.5933795",
"0.5879999",
"0.5859668",
"0.5852089",
"0.5835426",
"0.58300894",
"0.5823334",
"0.58120537",
"0.58116996",
"0.5809343... | 0.6712284 | 0 |
Move multiwire gates so that there are no interlocking multiwire gates in the same layer. | def move_multi_wire_gates(self, operator_grid):
n = operator_grid.num_layers
i = -1
while i < n - 1:
i += 1
this_layer = operator_grid.layer(i)
layer_ops = _remove_duplicates(this_layer)
other_layer = [None] * operator_grid.num_wires
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def memmove(self, grid):\n self.moveList.append((self.x, self.y))\n self.moveList2.append((self.x, self.y))\n waysList = []\n for f in range(4):\n if self.test(grid, f):\n if (self.x+SPEED_X[f], self.y+SPEED_Y[f]) not in self.moveList:\n ways... | [
"0.56898487",
"0.5460127",
"0.54027796",
"0.53337127",
"0.5313423",
"0.5259756",
"0.52481896",
"0.51840276",
"0.5119961",
"0.5119961",
"0.51108724",
"0.5096762",
"0.5095208",
"0.5035045",
"0.5029012",
"0.5027154",
"0.5011251",
"0.5006677",
"0.4994893",
"0.49945703",
"0.498881... | 0.7586023 | 0 |
Copy a pandas DataFrame `df` a certain database table and its columns, specified by `table_name` and `columns` arguments. | def copy_df_to_table(df, db_cursor, table_name, columns=None):
# Save dataframe to an IO buffer in memory
output = io.StringIO()
df.to_csv(output, sep='\t', header=False, index=False)
output.seek(0)
db_cursor.copy_from(output, f'{table_name}', null="", columns=columns) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def insert_df(conn, table_name: str, df: pd.DataFrame):\n # To CSV\n output = StringIO()\n df.to_csv(output, sep='\\t', header=False)\n output.seek(0)\n\n # Insert data\n cursor = conn.cursor()\n\n if isinstance(df.index, pd.MultiIndex):\n columns = list(df.index.names) + list(df.column... | [
"0.6942268",
"0.69030356",
"0.6875941",
"0.6689505",
"0.6604609",
"0.6427184",
"0.6358554",
"0.62708634",
"0.6262794",
"0.6229652",
"0.6163792",
"0.61006767",
"0.60610443",
"0.60594827",
"0.60562676",
"0.60288036",
"0.6024107",
"0.6020413",
"0.6017684",
"0.598997",
"0.5956474... | 0.81153834 | 0 |
Executes a sequence of queries to a database. | def execute_query_sequence(db_cursor, all_queries):
for query in all_queries:
db_cursor.execute(query) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _execute_deferred_queries(self):\n\n assert not self.__is_connected\n\n if not self._deferred_queries:\n return\n\n with Transaction(self.__database_name) as txn:\n while True:\n try:\n query = self._deferred_queries.popleft()\n ... | [
"0.7507602",
"0.73335844",
"0.7172477",
"0.69620657",
"0.690145",
"0.6900349",
"0.68479055",
"0.67416614",
"0.66732895",
"0.66495746",
"0.66418314",
"0.6623034",
"0.6595218",
"0.65877473",
"0.65638393",
"0.6555936",
"0.65309805",
"0.65253013",
"0.6522841",
"0.6517825",
"0.651... | 0.79367286 | 0 |
Testing Q learning performance by observing policy performance over testing period. Plots capital obtained by following the best policy as per Q learning. | def test(test_env, Q):
observation = test_env._reset()
test_cap = []
done = False
while not done:
# Get action with maximum future expected reward
action = action = Q.q_table.loc[str(test_env._get_obs())].idxmax()
# Apply action
observation_, reward, done = test_env._step... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Q_learning_test(env,alpha,gamma,episodes, q_table):\n %time\n \n # For plotting metrics\n all_epochs = []\n all_penalties = []\n rewards = []\n \n total_reward = 0\n \n for i in range(1, episodes+1):\n state = env.reset()\n episode_rewards = []\n\n epochs, pen... | [
"0.6491499",
"0.6087084",
"0.606302",
"0.6023926",
"0.60076874",
"0.5969352",
"0.59233665",
"0.5922331",
"0.5919873",
"0.5821565",
"0.5800628",
"0.57691634",
"0.57546717",
"0.5753235",
"0.5739664",
"0.5719022",
"0.5704644",
"0.5699115",
"0.5670828",
"0.5668197",
"0.56562036",... | 0.70739466 | 0 |
This function will divide each app and relavant APIs among tenants, and write to tenant_details.yaml file | def genMultiTenantPattern():
global tenant_list, app_tenant
tenant_app = {}
tenant_api = {}
# divide apps among tenants
i = 0
for app in app_list:
i += 1
tenant = tenant_list[i%len(tenant_list)]
apis = app_api_subs.get(app)
if tenant['name'] not in tenant_app:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def export_tenants(self):\n print('\\n=== Exporting all tenant data...')\n\n tenant = dict(self.client.tenant)\n\n print('- Exporting tenant:', tenant['name'])\n\n json = {\n 'id': self.get_id(tenant),\n 'href': tenant['href'],\n 'name': tenant['name'],\... | [
"0.6440203",
"0.6173402",
"0.573929",
"0.5548278",
"0.54319125",
"0.54112095",
"0.5392559",
"0.53705734",
"0.53069824",
"0.5283545",
"0.5242149",
"0.5232876",
"0.52054745",
"0.5196191",
"0.51911294",
"0.51776",
"0.5161879",
"0.5114904",
"0.50690067",
"0.5053997",
"0.50515527"... | 0.77912015 | 0 |
This function will generate tenant list for each user and, write to tenant_details.yaml file | def genUserTenant():
global app_tenant
user_tenant = {}
with open(abs_path + '/../../data/scenario/user_details.yaml', 'r') as user_file:
user_data = yaml.load(user_file, Loader=yaml.FullLoader)
for user_record in user_data['users']:
username = user_record['username']
apps = us... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def genMultiTenantPattern():\n global tenant_list, app_tenant\n tenant_app = {}\n tenant_api = {}\n\n # divide apps among tenants\n i = 0\n for app in app_list:\n i += 1\n tenant = tenant_list[i%len(tenant_list)]\n apis = app_api_subs.get(app)\n\n if tenant['name'] not... | [
"0.6866394",
"0.66955155",
"0.590429",
"0.56819826",
"0.5586416",
"0.53937036",
"0.5364383",
"0.53353626",
"0.5214414",
"0.5213576",
"0.52057135",
"0.515147",
"0.51282847",
"0.5099426",
"0.5093276",
"0.5082568",
"0.5040699",
"0.50275576",
"0.5017795",
"0.50038576",
"0.4993551... | 0.80104935 | 0 |
Updates the given task or creates it if the task ID is 0 | def update_task(self, task):
create = task.id == 0
xml = self._serialise_task(task)
method = ['PUT','POST'][create]
if create:
url = "%s/tasks?%s" % \
(self._get_base_url(), self._get_url_params())
else:
url = "%s/tasks/%s?%s" % \
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def updateTask(task):\n # First check to see if task exists\n detailed_ticket = jutdaapi.get_detailed_ticket(task._ticket_id)\n if not detailed_ticket:\n print 'task does not exist yet'\n return False\n # If so, check that things have actually changed (diff edited and orig)\n database_... | [
"0.7439985",
"0.73231685",
"0.725505",
"0.71463996",
"0.7119812",
"0.7118788",
"0.7085468",
"0.708224",
"0.70540684",
"0.70470107",
"0.69217247",
"0.69164205",
"0.6876801",
"0.6858307",
"0.68045104",
"0.6801324",
"0.6789578",
"0.67439306",
"0.6737473",
"0.66541326",
"0.664782... | 0.79600203 | 0 |
Get common URL parameters | def _get_url_params(self):
# These should have been established by _logon
assert self.__apikey
assert self.__token
return "api_key=%s&access_token=%s" % (self.__apikey, self.__token) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def query_params(self):\n return self.request._request.GET",
"def commonParameters(self):\n return self._commonParams",
"def _GetUrlParams(self, query=None):\n params = sum([c_w_c._GetUrlParams() for c_w_c in self.reactants], [])\n params.extend(self.aq_params._GetUrlParams())\n ... | [
"0.6880534",
"0.6709183",
"0.6622055",
"0.65897584",
"0.6588852",
"0.6553217",
"0.6495975",
"0.6489967",
"0.64217377",
"0.64018756",
"0.63853925",
"0.63166445",
"0.62157565",
"0.62102306",
"0.6167436",
"0.6159093",
"0.6083807",
"0.6067213",
"0.60640717",
"0.6062704",
"0.60402... | 0.6789014 | 1 |
Run 'pip hash' through its default behavior. | def test_basic_hash(script: PipTestEnvironment, tmpdir: Path) -> None:
expected = (
"--hash=sha256:2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425"
"e73043362938b9824"
)
result = script.pip("hash", _hello_file(tmpdir))
assert expected in str(result) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_good_algo_option(script: PipTestEnvironment, tmpdir: Path) -> None:\n expected = (\n \"--hash=sha512:9b71d224bd62f3785d96d46ad3ea3d73319bfbc2890caad\"\n \"ae2dff72519673ca72323c3d99ba5c11d7c7acc6e14b8c5da0c4663475c2e\"\n \"5c3adef46f73bcdec043\"\n )\n result = script.pip(\"ha... | [
"0.6371622",
"0.5979089",
"0.59298545",
"0.5901872",
"0.58500236",
"0.58184797",
"0.56237996",
"0.556896",
"0.5531649",
"0.550377",
"0.54743403",
"0.5426228",
"0.5419788",
"0.5412322",
"0.53901064",
"0.5365219",
"0.53489",
"0.5324571",
"0.5309937",
"0.5295333",
"0.5283248",
... | 0.7332538 | 0 |
Return a temp file to hash containing "hello". | def _hello_file(tmpdir: Path) -> Path:
file = tmpdir / "hashable"
file.write_text("hello")
return file | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hashOfTempFile(self):\n if os.path.exists(\"temp.dat\"):\n with open(\"temp.dat\", 'r') as f:\n data = f.read()\n return hashlib.md5(data).hexdigest()\n else:\n return \"noTempFile\"",
"def make_temp_file():\n with tempfile.NamedTemporaryFile()... | [
"0.7206083",
"0.71109575",
"0.6740871",
"0.67075294",
"0.66732055",
"0.6628942",
"0.65662843",
"0.6511242",
"0.6407561",
"0.63199365",
"0.628915",
"0.6258172",
"0.62482387",
"0.6211993",
"0.6194745",
"0.61824936",
"0.6182036",
"0.61687034",
"0.61652434",
"0.6113393",
"0.61022... | 0.82764506 | 0 |
Modify _EVAL_CHUNK to try to keep the amount of time that the eval demon takes between _EVAL_DEMON_MIN and _EVAL_DEMON_MAX. | def _adaptively_modify_eval_chunk(self, t):
if t > self._EVAL_DEMON_MAX and self._EVAL_CHUNK > 5:
self._EVAL_CHUNK = min(
self._EVAL_CHUNK - 1,
max(
int(self._EVAL_CHUNK * (self._EVAL_DEMON_MAX / t)),
self._EVAL_CHUNK - 10,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lab_run_big(character_id, time_step):\n pass",
"def chunk(wb_run,sample_run,ei_guess,rebin,mapingfile,nchunk,**kwargs):\n global reducer,rm_zero,inst_name,van_mass,bleed_switch,rate,pixels\n print 'DGreduce run for ',inst_name,'run number ',sample_run\n try:\n n,r=lhs('both')\n wksp... | [
"0.5178812",
"0.5029172",
"0.5007882",
"0.50052947",
"0.49623895",
"0.49052292",
"0.49052292",
"0.49052292",
"0.48814282",
"0.48812094",
"0.4865753",
"0.4850371",
"0.4850371",
"0.48481414",
"0.4798417",
"0.47675866",
"0.4758317",
"0.47493455",
"0.4725884",
"0.4711818",
"0.469... | 0.72082186 | 0 |
Reply the user who invoked the command with hers/his average message length. | def average_length(_: Bot, update: Update):
average = analytics.average_message_length(
update.message.from_user.id, update.message.chat.id
)
response = f'{average:.3}'
update.message.reply_text(response) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def weight(self, irc, msg, args, channel):\n irc.reply(self._size(channel))",
"def sent_len(self) -> int:\n raise NotImplementedError(\"must be implemented by subclasses\")",
"def get_length(self):\n return self.run_command('get_length')[0]",
"def getLength(msg):\n return len(msg)",
"def sa... | [
"0.5748701",
"0.5605024",
"0.5555418",
"0.55326635",
"0.54580396",
"0.54450387",
"0.5338766",
"0.5322957",
"0.53093225",
"0.5302355",
"0.5291733",
"0.5251069",
"0.5238647",
"0.5234791",
"0.52003247",
"0.51710826",
"0.51690197",
"0.51505494",
"0.5124651",
"0.51059633",
"0.5078... | 0.5796118 | 0 |
Reply the user who invoked the command with hers/his respective karma. | def karma(_: Bot, update: Update):
user_karma = analytics.get_karma(
update.message.from_user.id, update.message.chat.id
)
update.message.reply_text(user_karma) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def karma_point(phenny, input):\n user = input.group(1)\n op = input.group(2)\n if input.nick == user:\n if '+' in op:\n phenny.reply(\"Silly, you can't award yourself karma...\")\n return\n elif '-' in op:\n phenny.reply(\"Wow, you must have really been bad ... | [
"0.6203317",
"0.60181",
"0.5697045",
"0.56385237",
"0.5361998",
"0.5327036",
"0.52953833",
"0.5270314",
"0.5253488",
"0.5234843",
"0.5230779",
"0.52173793",
"0.52110654",
"0.5198637",
"0.5169943",
"0.5166657",
"0.51604426",
"0.5153607",
"0.5140566",
"0.51395947",
"0.5122001",... | 0.6484356 | 0 |
Shows the top 10 karmas in a given group, if the group doesn't have at least 10 users, show the maximum amount | def karmas(_: Bot, update: Update):
top_users = analytics.get_top_n_karmas(update.message.chat.id, 10)
response = '\n'.join(
f'{i} - {user.name} ({user.karma})' for i, user in enumerate(top_users, 1)
)
update.message.reply_text(response) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all_from_top_ten(title,users,max = 3):\n \"\"\" ten prolific users \"\"\"\n \"\"\" max : number of user with related followers \"\"\"\n getAllUsers(users,all_users,users_set,proceeded_users,max,user_cpt,title)\n for data in users_set:\n print(data.id)",
"def get_top_k_items(\n data... | [
"0.60215867",
"0.60107267",
"0.59359956",
"0.58820724",
"0.585288",
"0.58523005",
"0.5816334",
"0.5640699",
"0.5551383",
"0.55489355",
"0.5533259",
"0.55250305",
"0.5408803",
"0.540484",
"0.5393519",
"0.5372351",
"0.5299541",
"0.5277865",
"0.5269924",
"0.5188993",
"0.5185934"... | 0.66216785 | 0 |
1. Constructs the blank matrix for required size 2. Encodes the data for Error correction with "L" level 3. Sets the Finder patterns, Allignment patterns, Timing patterns and saves space for Format information | def __initialize(self):
self.matrix = [None] * self.size
self.__get_log_values()
for row in range(self.size):
self.matrix[row] = [None] * self.size
max_len = self.__get_max_length()
data = self.__get_data(self.text,max_len)
mpoly = self.__get_mpoly(data)
gpoly = self.__get_gploy()
self.final_data = s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __finalize(self,final_data):\n\t\tcopy_input_data = copy.deepcopy(self.matrix)\n\t\tbest_matrix = self.__set_format_info(copy_input_data,0)\n\t\tbest_matrix = self.__fill_data(best_matrix,final_data,0)\n\t\tmin_penalty = lost_point(best_matrix)\n\t\tbest_mask_pattern = 0\n\t\tfor i in range(1,8):\n\t\t\tcopy_i... | [
"0.5960807",
"0.5867869",
"0.56186324",
"0.56065243",
"0.55948704",
"0.5587035",
"0.55769783",
"0.54980093",
"0.54437375",
"0.5429941",
"0.5409406",
"0.5375048",
"0.5364524",
"0.5363902",
"0.53592736",
"0.5354587",
"0.5353531",
"0.5339186",
"0.5338025",
"0.53214985",
"0.53201... | 0.62001777 | 0 |
Returns the maximum size for the given version in number of characters. For bits, multiply by 8 | def __get_max_length(self):
if self.version == 1:
return 19
elif self.version == 2:
return 34
elif self.version == 3:
return 55
elif self.version == 4:
return 80
elif self.version == 5:
return 108
elif self.version == 6:
return 136
else:
return "Version number > 6 not supported" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def maximum_element_size_for_length(length):\n\t\n\treturn (2**(7*length)) - 2",
"def len_max(self):\n return 16 + 16 + 8 + 8 + Tools.bin_to_dec(self.get_data_size()) + Tools.bin_to_dec(self.get_verification_size())",
"def __get_size(self):\n\t\treturn 4*self.version + 17",
"def version_max():\n re... | [
"0.73730594",
"0.7309272",
"0.7061897",
"0.6985782",
"0.6909522",
"0.68217045",
"0.6814024",
"0.6799535",
"0.67086905",
"0.6703293",
"0.67010623",
"0.6667141",
"0.6650425",
"0.6633382",
"0.66165644",
"0.6602329",
"0.6589525",
"0.65325415",
"0.65043825",
"0.64946985",
"0.64837... | 0.76883423 | 0 |
Return the position of AP for the given version | def __get_AP_position(self):
AP_position_table = [
None,#Version 1
18,#Version 2
22,#Version 3
26,#Version 4
30,#Version 5
34,#Version 6
]
return AP_position_table[self.version - 1] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_Version(param):\n\n line = subprocess.check_output(['grep', 'Processed with ASKAPsoft', param])\n str_line = line.decode('utf-8')\n\n askapsoft = re.findall('ASKAPsoft\\ version\\ [0-9].+', str_line)[0].split()[-1]\n\n return askapsoft",
"def apkdownloadmirror_get_apk_version(soup):\n ... | [
"0.60522664",
"0.60463786",
"0.5823735",
"0.5502176",
"0.53582144",
"0.5337849",
"0.53289926",
"0.52942234",
"0.5280628",
"0.52756464",
"0.5263786",
"0.52541924",
"0.52373356",
"0.52273595",
"0.5208802",
"0.51945615",
"0.5193101",
"0.51597446",
"0.5153729",
"0.5130085",
"0.51... | 0.827186 | 0 |
Return the mask function for the given mask pattern. | def __get_mask_func(self,pattern):
if pattern == 0: # Mask pattern : 000
return lambda i, j: (i + j) % 2 == 0
if pattern == 1: # Mask pattern : 001
return lambda i, j: i % 2 == 0
if pattern == 2: # Mask pattern : 010
return lambda i, j: j % 3 == 0
if pattern == 3: ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calcmask(self, *args, **kwargs):\n return _image.image_calcmask(self, *args, **kwargs)",
"def get_mask(fx, fy, ft, mask_exponent=mask_exponent, radius=.5):\n R = frequency_radius(fx, fy, ft, ft_0=np.inf, clean_division=False)\n mask = ((np.cos(np.pi*R/radius)+1)/2 *(R < radius))**(1./mask_expone... | [
"0.63893044",
"0.6309959",
"0.6061104",
"0.6015642",
"0.6000843",
"0.59884965",
"0.59574133",
"0.577539",
"0.5772421",
"0.5751852",
"0.57508767",
"0.57286704",
"0.5692899",
"0.5692899",
"0.5692899",
"0.5692899",
"0.56913775",
"0.5679885",
"0.5674651",
"0.56163156",
"0.5603795... | 0.82741874 | 0 |
Return the size of matrix depending on version | def __get_size(self):
return 4*self.version + 17 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def size(adj_mat):\n return adj_mat.shape[0]",
"def size(matrix):\n size = 0\n for _,row in matrix.items():\n #size += len([r for r in row.values() if r != None])\n for _,v in row.items():\n #print(\"V:\",v)\n size += 1 if v != None else 0\n return size",
"def si... | [
"0.6482722",
"0.6462011",
"0.6381991",
"0.63745326",
"0.6350306",
"0.6277233",
"0.6257547",
"0.6222588",
"0.6208356",
"0.61707294",
"0.6169237",
"0.6149762",
"0.61417735",
"0.6132297",
"0.6124659",
"0.61202615",
"0.6106555",
"0.6099995",
"0.6097335",
"0.60590386",
"0.6054649"... | 0.6746472 | 0 |
FP1FP2 | | | | FP3 Returns the matrix by setting the FIP in required position according to (row,col) | def __set_FIP(self,FP_num):
size = len(self.matrix)
if FP_num == 1:
[row,col] = [0,0]
elif FP_num == 2:
[row,col] = [0,size-7]
elif FP_num == 3:
[row,col] = [size-7,0]
for r in range(7):
for c in range(7):
if (0 <= r and r <= 6 and (c ==0 or c == 6) or (0 <= c and c <= 6 and (r == 0 or r == 6... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def data_matrix_arp_stack(y,p):\n \n T = len(y)\n F = np.zeros([T,p])\n for i in range(p):\n F[:,i] = np.roll(y,i+1,axis = 0)[:,0]\n \n return F[p::,:]",
"def calculateFFBox(qOfFlights):\n\t# if qOfFlights == 2: rows=2; columns=1\n\t# else:\n\tpass",
"def deformar_afin_frontera(self, F... | [
"0.5308291",
"0.5270722",
"0.5022224",
"0.50020593",
"0.49909058",
"0.4939121",
"0.49303982",
"0.4889252",
"0.48675576",
"0.4857202",
"0.48444077",
"0.48342174",
"0.47997975",
"0.47952425",
"0.47651312",
"0.47611514",
"0.47587168",
"0.47393122",
"0.4727332",
"0.47254407",
"0.... | 0.7439608 | 0 |
Finding the best mask pattern by trying out all 8 possibilitiees and keeping the one with minimum penalty | def __finalize(self,final_data):
copy_input_data = copy.deepcopy(self.matrix)
best_matrix = self.__set_format_info(copy_input_data,0)
best_matrix = self.__fill_data(best_matrix,final_data,0)
min_penalty = lost_point(best_matrix)
best_mask_pattern = 0
for i in range(1,8):
copy_input_data = copy.deepcopy(s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _drum_pattern_mask(res, tol):\n if res == 24:\n drum_pattern_mask = np.tile([1.0, tol, 0.0, 0.0, 0.0, tol], pianoroll.shape[0]//6)\n elif res == 12:\n drum_pattern_mask = np.tile([1.0, tol, tol], 4)\n elif res == 6:\n drum_pattern_mask = np.tile([1.0, tol, ... | [
"0.65049106",
"0.6058993",
"0.59197193",
"0.58830374",
"0.5852679",
"0.5794175",
"0.57701045",
"0.57473665",
"0.5728961",
"0.5711243",
"0.56593305",
"0.565106",
"0.5624129",
"0.5617718",
"0.5599425",
"0.55991274",
"0.55696785",
"0.5568943",
"0.5563857",
"0.55591536",
"0.55415... | 0.6188079 | 1 |
Randomly applying given method to image and ground truth boxes. | def randomly_apply_operation(operation, img, gt_boxes):
return tf.cond(
get_random_bool(),
lambda: operation(img, gt_boxes),
lambda: (img, gt_boxes)
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __call__(self, image):\n if random.random() < 0.5:\n image = np.flip(image, 1).copy()\n return image",
"def generate_rand_image(image, groundtruth, noise=True, flip=True):\n # Get the size of the image\n x_size, y_size = image.size\n\n def rotate_augmentation():\n \"\... | [
"0.6015314",
"0.60000014",
"0.57901275",
"0.57800996",
"0.576198",
"0.5664162",
"0.561261",
"0.5595708",
"0.55939484",
"0.5583366",
"0.5555239",
"0.55278254",
"0.5515401",
"0.5496821",
"0.5475269",
"0.54682416",
"0.5465079",
"0.5455729",
"0.54462266",
"0.5412743",
"0.53570974... | 0.63215065 | 0 |
Get tensorflow dataset split and info. | def get_dataset(name, split, data_dir="~/tensorflow_datasets"):
data_dir = os.path.join(os.getcwd(),'data/VOC')
if not os.path.exists(data_dir):
os.makedirs(data_dir)
assert split in ["train", "train+validation", "validation", "test"]
dataset, info = tfds.load(name, split=split, data_dir=data... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_dataset(name, split, data_dir=\"~/tensorflow_datasets\"):\n assert split in [\"train\", \"train+validation\", \"validation\", \"test\"]\n dataset, info = tfds.load(name, split=split, data_dir=data_dir, with_info=True)\n return dataset, info",
"def _read_examples(self, split: base.Split) -> tf.da... | [
"0.7596596",
"0.6922142",
"0.68737435",
"0.68233407",
"0.6779692",
"0.662616",
"0.6616802",
"0.64003676",
"0.6355834",
"0.6349218",
"0.6349152",
"0.6326521",
"0.6323116",
"0.631721",
"0.630968",
"0.630364",
"0.62698114",
"0.62360495",
"0.6232034",
"0.6218028",
"0.6191982",
... | 0.74165493 | 1 |
Generating data types for tensorflow datasets. | def get_data_types():
return tf.float32, tf.float32, tf.int32 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_data_types(self):\n for col in self.all_columns:\n try:\n if float(self.train[col].iloc[-3]):\n self.train[col] = self.train[col].astype(np.float32)\n except:\n pass\n self.d_types = self.train.dtypes",
"def data_type... | [
"0.69367135",
"0.66367215",
"0.64645606",
"0.64479357",
"0.6427216",
"0.6423331",
"0.6419863",
"0.63882196",
"0.6380141",
"0.63446236",
"0.6272475",
"0.62581176",
"0.6214385",
"0.6185716",
"0.6144315",
"0.6140106",
"0.6125391",
"0.6116996",
"0.61043483",
"0.61038756",
"0.6102... | 0.7420742 | 0 |
This encodes any string to a valid file name while ensuring that the original string can still be reconstructed. All characters except 09, AZ, the period and underscore are encoded as "12cd" where "12cd" stands for the hexadecimal representation of the character's ordinal. File names longer than 150 characters will be ... | def filename_encode(name):
result = re.sub(r'[^\w\.]', lambda match: '-%04x' % ord(match.group(0)), name)
if len(result) > 150:
result = result[:150] + '--%s' % hashlib.md5(result[150:]).hexdigest()
return result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def str_to_filename(s: str, maxlen=None) -> str:\n if maxlen is None:\n maxlen = 255 - 16 # 255 FAT - room for extension\n s_no_sub = unicodedata.normalize('NFKD', s)\n s = _re_str_to_filename.sub('_', s_no_sub)\n if len(s) > maxlen:\n h = hashlib.sha256(s_no_sub.encode('utf-8')).hexdige... | [
"0.72010523",
"0.7038548",
"0.6729795",
"0.66579026",
"0.6621475",
"0.6617925",
"0.6617925",
"0.6617925",
"0.6601966",
"0.65996486",
"0.6596172",
"0.6594677",
"0.65843904",
"0.65450156",
"0.6444123",
"0.6386129",
"0.6360765",
"0.63575244",
"0.63537097",
"0.6351821",
"0.635182... | 0.7364742 | 0 |
This reconstructs a string encoded with filename_encode(). | def filename_decode(path):
path = re.sub(r'--[0-9A-Fa-f]{32}', u'\u2026', path)
path = re.sub(r'-([0-9a-f]{4})', lambda match: unichr(int(match.group(1), 16)), path)
return path | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fsencode(filename):\n if isinstance(filename, bytes):\n return filename\n else:\n return filename.encode(encoding, errors)",
"def filename_encode(name):\n result = re.sub(r'[^\\w\\.]', lambda match: '-%04x' % ord(match.group(0)), name)\n if len(result) > 150:\n ... | [
"0.71377546",
"0.6965006",
"0.68265873",
"0.63844126",
"0.6326382",
"0.6227444",
"0.62161034",
"0.6195291",
"0.61629474",
"0.61629474",
"0.61629474",
"0.6161195",
"0.60929245",
"0.60657084",
"0.60174406",
"0.6012597",
"0.599158",
"0.58833504",
"0.5877647",
"0.5863923",
"0.580... | 0.6981981 | 1 |
nondirect imports (not in sys.path) | def test_import_not_in_sys_path(Script):
a = Script(path='module.py', line=5).goto_definitions()
assert a[0].name == 'int'
a = Script(path='module.py', line=6).goto_definitions()
assert a[0].name == 'str'
a = Script(path='module.py', line=7).goto_definitions()
assert a[0].name == 'str' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _isolateImports(mf, f, *a, **kw):\n\n\n oldMetaPath = sys.meta_path\n oldPathHooks = sys.path_hooks\n _PEP302Mapper._oldSysModules = sys.modules.copy()\n oldImport = __builtin__.__import__\n #where is your god now?\n sys.path_hooks = []\n sys.modules.clear()\n sys.meta_path = [mf]\n ... | [
"0.67035365",
"0.6700113",
"0.6623949",
"0.65748125",
"0.65529615",
"0.648883",
"0.64825726",
"0.6460145",
"0.6454453",
"0.6434618",
"0.64059556",
"0.64039737",
"0.63843435",
"0.63533926",
"0.6339769",
"0.63320345",
"0.6328509",
"0.63022965",
"0.62660164",
"0.62599796",
"0.62... | 0.6957585 | 0 |
flask.ext.foo is really imported from flaskext.foo or flask_foo. | def test_flask_ext(Script, code, name):
path = os.path.join(os.path.dirname(__file__), 'flask-site-packages')
completions = Script(code, sys_path=[path]).completions()
assert name in [c.name for c in completions] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _isolateImports(mf, f, *a, **kw):\n\n\n oldMetaPath = sys.meta_path\n oldPathHooks = sys.path_hooks\n _PEP302Mapper._oldSysModules = sys.modules.copy()\n oldImport = __builtin__.__import__\n #where is your god now?\n sys.path_hooks = []\n sys.modules.clear()\n sys.meta_path = [mf]\n ... | [
"0.60482883",
"0.583645",
"0.5815384",
"0.5758056",
"0.57090306",
"0.5667679",
"0.5624578",
"0.5590361",
"0.55475366",
"0.5547178",
"0.5543501",
"0.5532844",
"0.54974246",
"0.54937065",
"0.5471954",
"0.5453957",
"0.5443218",
"0.54173815",
"0.5417083",
"0.53932863",
"0.5379379... | 0.6987331 | 0 |
Step function for computing energy for a single decoder state | def energy_step(inputs, states):
assert_msg = "States must be a list. However states {} is of type {}".format(states, type(states))
assert isinstance(states, list) or isinstance(states, tuple), assert_msg
""" Some parameters required for shaping tensors"""
en_seq_len, e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def step(self, state):",
"def state_step(self) -> float:\n raise NotImplementedError",
"def energy(self, state, action, next_state, no_trans=False):\n\n norm = 0.5 / (self.sigma ** 2)\n\n if no_trans:\n diff = state - next_state\n else:\n pred_trans = self.tran... | [
"0.662566",
"0.628655",
"0.6150054",
"0.61145586",
"0.60980296",
"0.5938008",
"0.5926916",
"0.59074557",
"0.5891019",
"0.5880801",
"0.5870678",
"0.58329195",
"0.5793529",
"0.5775259",
"0.57391167",
"0.57282764",
"0.57238334",
"0.57210577",
"0.5708643",
"0.5705526",
"0.5696653... | 0.65210027 | 1 |
(adventurerSkillEffect) > float takes in a skill effect with attribute exists of "per_each" then parse it and return the extra boosts multiplier | def interpretExtraBoost(skillEffect, adventurer: "Adventurer", enemy: "Enemy") -> float:
extra_boosts_modifier_value = 0.0
temp_list: list = skillEffect.attribute.split("_")
# per each
temp_list = temp_list[2:]
try:
temp_list.remove("skill")
except:
pass
if temp_list[0] == "... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def interpretSkillAdventurerAttack(\n skillEffectsWithName: tuple[str, list], adventurer: \"Adventurer\", enemy: \"Enemy\"\n) -> AdventurerSkill | None:\n # for index_to maybe list {\"modifier\": \"End. & Mag.\", \"target\": \"skill\", \"attribute\": \"indexed_to\",\"speed\": \"None\" }\n\n # test if ski... | [
"0.6795116",
"0.60465384",
"0.60335654",
"0.59514785",
"0.58946097",
"0.58470714",
"0.5835641",
"0.5739321",
"0.563372",
"0.55835634",
"0.5508624",
"0.5495432",
"0.54705167",
"0.54562074",
"0.5451164",
"0.54443383",
"0.54392064",
"0.5383053",
"0.53823906",
"0.53795207",
"0.53... | 0.7955997 | 0 |
(list of skillEffects, Adventurer, Enemy) > AdventurerSkill or None None if there are no damage related effects AdventurerSkill if there is a damage related effect | def interpretSkillAdventurerAttack(
skillEffectsWithName: tuple[str, list], adventurer: "Adventurer", enemy: "Enemy"
) -> AdventurerSkill | None:
# for index_to maybe list {"modifier": "End. & Mag.", "target": "skill", "attribute": "indexed_to","speed": "None" }
# test if skill effects empty
if skillE... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def interpretExtraBoost(skillEffect, adventurer: \"Adventurer\", enemy: \"Enemy\") -> float:\n extra_boosts_modifier_value = 0.0\n temp_list: list = skillEffect.attribute.split(\"_\")\n # per each\n temp_list = temp_list[2:]\n try:\n temp_list.remove(\"skill\")\n except:\n pass\n\n ... | [
"0.6113535",
"0.6016942",
"0.58710575",
"0.57312584",
"0.5592047",
"0.5524038",
"0.5515022",
"0.5500728",
"0.5470107",
"0.5449005",
"0.54434955",
"0.54395187",
"0.5429331",
"0.5414266",
"0.5392733",
"0.5266694",
"0.5265734",
"0.524905",
"0.5220251",
"0.5198495",
"0.51827645",... | 0.74444175 | 0 |
Compute metrics on a subset of data for which anchor applies | def compute_metrics_on_original_data(anchor, d_data, labels, target_label) -> Tuple[float, float]:
data_with_anchor_index = np.apply_along_axis(anchor.check_against_sample, axis=1, arr=d_data) # Candidate for profiling
data_with_anchor = d_data[data_with_anchor_index]
labels_with_anchor = labels[data_with... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_metrics(cfg, model, X_anchor, y_anchor, X_gal, y_gal, annoy_index, vec_dim):\n rank10_acc = 0\n rank5_acc = 0\n rank1_acc = 0\n avg_acc = 0\n vote_res = 0\n\n l2 = []\n for anchor in range(0, len(X_anchor)):\n res = get_result(get_image_features(cfg, model, X_anchor[anchor]), an... | [
"0.6417683",
"0.61409605",
"0.57583237",
"0.5592564",
"0.5521543",
"0.54983836",
"0.5440039",
"0.5401007",
"0.5359247",
"0.5322198",
"0.5260303",
"0.52582616",
"0.5257582",
"0.5249325",
"0.5248671",
"0.5224059",
"0.5216807",
"0.521308",
"0.519075",
"0.51784587",
"0.5166658",
... | 0.62233543 | 1 |
Computes a classifier prediction for a subsample of data. Subsample of data is selected according to an anchor. If no such subsample can be acquired data is augmented, and "reward", or mean label is calculated on augmented data | def compute_reward_on_batch(d_data, batch_size, anchor, d_classifier_fn, target_label):
subsample_indices = np.random.choice(list(range(d_data.shape[0])), size=batch_size, replace=False)
subsampled_data = d_data[subsample_indices]
return batch_size, compute_reward_on_augmented_data(anchor, subsampled_data, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __call__(self, y, pred, sample_weight=None):",
"def _predict(self, classify: np.array, n_preds=1):\r\n tmp = classify.argsort()[:, :n_preds] # Return the index of the best label classification\r\n preds = copy(tmp) # allow to copy tmp\r\n for index, target in enumerate(self.targets):\r... | [
"0.62431145",
"0.6194317",
"0.6176968",
"0.61036134",
"0.60776037",
"0.6062559",
"0.6052891",
"0.603955",
"0.600464",
"0.5984305",
"0.5984305",
"0.5908565",
"0.59002185",
"0.5870748",
"0.586548",
"0.5862143",
"0.5861985",
"0.58605",
"0.58341146",
"0.58295065",
"0.58147436",
... | 0.669956 | 0 |
Convert expectation configuration kwargs to a canonical tuple. | def kwargs_to_tuple(d):
if isinstance(d, list):
return tuple(kwargs_to_tuple(v) for v in sorted(d))
elif isinstance(d, dict):
return tuple(
(k, kwargs_to_tuple(v))
for k, v in sorted(d.items())
if k not in ["result_format", "include_config", "catch_exceptions"... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def config_to_args(config):\n result = []\n\n for key, value in iteritems(config):\n if value is False:\n continue\n\n key = '--{0}'.format(key.replace('_', '-'))\n\n if isinstance(value, (list, set, tuple)):\n for item in value:\n result.extend((key,... | [
"0.6659174",
"0.5745644",
"0.55720395",
"0.55223536",
"0.5498944",
"0.54124206",
"0.53674227",
"0.5306001",
"0.5282772",
"0.52742696",
"0.52623576",
"0.51839817",
"0.5121566",
"0.51107717",
"0.5108896",
"0.51032555",
"0.5060509",
"0.50549054",
"0.50546324",
"0.5041457",
"0.50... | 0.6513344 | 1 |
Evaluate a FIS using the training data in the class states. | def eval_fis(self,fis):
#res = 0.0
#for cl_state in self.classes:
# res += cl_state.eval_fis(fis)
#print "=>",res
#return 1.0/res
try:
correct,count = self.quality_fis(fis)
except Exception as err:
print err
correct = 0
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def feed_forward_fishfinder(image_array, image_dims, n_classes, saved_state):\r\n num_stars = np.size(image_array[:, 0])\r\n output_array = np.zeros((num_stars, 3+n_classes)) # output array: [cent_x, cent_y, scale, prob_nofish, prob_fish]\r\n output_array[:, 0:3] = image_array[:, 0:3]\r\n reshaped_ima... | [
"0.6156615",
"0.6116833",
"0.59802336",
"0.5882609",
"0.5811099",
"0.5811037",
"0.58071524",
"0.58029187",
"0.5779592",
"0.5776002",
"0.5756558",
"0.57373047",
"0.57197535",
"0.5706198",
"0.5690918",
"0.56796634",
"0.56791973",
"0.5671155",
"0.5649012",
"0.56438166",
"0.56277... | 0.70830023 | 0 |
Get a quality estimate for a FIS by counting the correct classifications on the check data. | def quality_fis(self,fis):
correct = 0
count = 0
for cl_state in self.classes:
r,c = cl_state.quality_fis(fis)
print "For",cl_state.name,r,"/",c
correct += r
count += c
return (correct,count) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def quality_fis(self,fis):\n if fis.dimension() == self.training_data.shape[1]:\n last_res = 0.0\n count = 0\n for i in range(self.check_data.shape[0]):\n last_res = fis.evaluate(np.hstack((self.check_data[i],last_res)))\n if abs(last_res - self... | [
"0.7442371",
"0.73869795",
"0.60693264",
"0.58676314",
"0.5833889",
"0.58188605",
"0.56971085",
"0.56838715",
"0.5518932",
"0.545538",
"0.543135",
"0.5416303",
"0.54032844",
"0.5363014",
"0.5346431",
"0.5318766",
"0.53130525",
"0.5218153",
"0.5216749",
"0.5209758",
"0.5204727... | 0.76470643 | 0 |
Use the subclustering algorithm to calculate initial clusters for this class from the training data | def clusters(self,rng):
#clusts = subclust(normalize(self.training_data),0.4,0.5)
if self.extended:
dat = self.training_data / rng
else:
dat = self.training_data[:,0:-1] / rng[0:-1]
clusts = subclust(normalize(dat))
print len(clusts),"initial clusters fo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fit(self):\n self.cluseter_agglomerative(n_clusters=20, linkage='average', iterate=5)\n self.sub_clustering(n_clusters=3, index_cluster=[79], linkage='complete')\n self.merge_clusters([[0,9,53],[1,83],[46,35,67],[88,23],[6,68]])\n self.merge_clusters([[6,33,52],[17,14]])\n se... | [
"0.71161664",
"0.69207186",
"0.67999744",
"0.6661445",
"0.661263",
"0.65482146",
"0.6503476",
"0.6432666",
"0.64109087",
"0.64073277",
"0.6379028",
"0.63511044",
"0.63070285",
"0.630189",
"0.62981737",
"0.6286471",
"0.6275354",
"0.62368757",
"0.6219325",
"0.62104845",
"0.6194... | 0.77156234 | 0 |
Count the correct classifications of a given FIS on the check data. | def quality_fis(self,fis):
if fis.dimension() == self.training_data.shape[1]:
last_res = 0.0
count = 0
for i in range(self.check_data.shape[0]):
last_res = fis.evaluate(np.hstack((self.check_data[i],last_res)))
if abs(last_res - self.id) < 0.5:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def quality_fis(self,fis):\n correct = 0\n count = 0\n for cl_state in self.classes:\n r,c = cl_state.quality_fis(fis)\n print \"For\",cl_state.name,r,\"/\",c\n correct += r\n count += c\n return (correct,count)",
"def eval_fis(self,fis):\n ... | [
"0.6933662",
"0.6664374",
"0.6319334",
"0.6253232",
"0.6219388",
"0.6124897",
"0.60906196",
"0.60430586",
"0.5890268",
"0.58814853",
"0.5876402",
"0.58688635",
"0.5861996",
"0.58550507",
"0.5841874",
"0.58164227",
"0.5803866",
"0.57722044",
"0.57717615",
"0.5769314",
"0.57535... | 0.71802974 | 0 |
Use a FIS to adjust the last dimension of the training data with the results of the evaluation. | def adjust_data(self,fis,start,size,last_res=0.0):
cond = fis.dimension() == self.training_data.shape[1]
for i in range(start,start+size):
if math.isnan(last_res):
last_res = 0.0
self.training_data[i,-1] = last_res
if cond:
last_res = f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _evaluate_during_fit(self, test_loader, epoch):",
"def calibrate(self, Otrain, Ftrain, Feval):\n return Otrain[0] * np.ones(len(Feval))",
"def val_real_eigen_dataset(self):\n self.set_eval()\n\n pred_disps = []\n\n print('Start running monoDEVSNet model on KITTI-Eigen validation... | [
"0.59262145",
"0.590759",
"0.5722502",
"0.5718499",
"0.57169574",
"0.56952",
"0.5625102",
"0.5619705",
"0.5581353",
"0.55126554",
"0.5503287",
"0.5496866",
"0.54851955",
"0.54461217",
"0.54453784",
"0.54409087",
"0.5408733",
"0.537607",
"0.53748375",
"0.5357369",
"0.535208",
... | 0.7036977 | 0 |
Get data from a spell line. | def get_line_data(line):
line_parts = line.split(",")
cast_player = line_parts[2].strip('"').split("-")[0]
target = line_parts[6].strip('"')
if "-" in target:
target = target.split("-")[0]
spell_id = line_parts[9]
spell_name = line_parts[10]
return (spell_id, spell_name, cast_play... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch_data(self, document, line):\n index = self.resolve_ref(document)\n return line[index]",
"def process_line(self, line, data):\n return data",
"def GetLine(line):\r\n pass",
"def getLineInformation(line):\n \n pass",
"def __call__( self, line ):\n return sel... | [
"0.7273888",
"0.67536473",
"0.6700648",
"0.6604186",
"0.6525555",
"0.6525555",
"0.622827",
"0.6167045",
"0.59307945",
"0.5926226",
"0.5924352",
"0.5845933",
"0.58247083",
"0.5797795",
"0.5775519",
"0.57589865",
"0.57081795",
"0.57001454",
"0.56417584",
"0.5638188",
"0.5628176... | 0.7741816 | 0 |
Aggregate buff lines into list of casts for each spell | def aggregate_buff_lines(res_lines, buff_lines, dispel_lines):
res_data = {}
buff_data = {}
dispel_data = {}
for lines, data in zip(
(res_lines, buff_lines, dispel_lines), (res_data, buff_data, dispel_data)
):
for spell_id, spell_name, source, target in lines:
if spell_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _read_spells(self, root):\n output_list = []\n for _, value in enumerate(root[0][7]):\n output_list.append(Spell(value))\n\n # check if attributo is part of spells\n if output_list[-1].name == \"Attributo\":\n output_list = self._add_attributo(outpu... | [
"0.67182595",
"0.5420267",
"0.5419016",
"0.5226137",
"0.5175295",
"0.51211864",
"0.5118044",
"0.49531966",
"0.4928956",
"0.4724977",
"0.46987525",
"0.46356374",
"0.46300656",
"0.4552547",
"0.4547838",
"0.44789964",
"0.44751042",
"0.44738665",
"0.4467947",
"0.44666162",
"0.443... | 0.6721767 | 0 |
no such video exists | def video_no_found(error):
return {'message': 'video does not exist'}, 404 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def watch_movie():\r\n if os.path.isfile('files/final_movie.mp4'): # if the file exists\r\n with open('files/final_movie.mp4', 'rb') as f:\r\n video_data = f.read()\r\n st.video(video_data)\r\n else: # if the file doesn't exist, let the user know\r\n st.header(\"You haven't cr... | [
"0.7131045",
"0.70990825",
"0.6796141",
"0.6740206",
"0.6573952",
"0.6508622",
"0.6507957",
"0.6487271",
"0.6485883",
"0.6480615",
"0.64187884",
"0.6356313",
"0.63472307",
"0.6326684",
"0.63058686",
"0.6289658",
"0.6235598",
"0.6235598",
"0.6235598",
"0.6235598",
"0.6225326",... | 0.72693056 | 0 |
Write our default config to a .py config file | def write_default_config(self):
if self.config_file:
config_file = self.config_file
else:
config_file = os.path.join(self.config_dir, self.config_file_name + '.py')
if os.path.exists(config_file) and not self.answer_yes:
answer = ''
def as... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run(self):\n write_config(self.filename)\n print('Wrote default config to', self.filename)",
"def createConfig():\n\twith open(configPath, 'w', encoding='utf-8') as file:\n\t\tjson.dump(default_config, file, indent=3)",
"def write_default_config():\n # TODO: BROKEN!\n config_path = path... | [
"0.79288006",
"0.7674197",
"0.7424864",
"0.74032784",
"0.7367445",
"0.736743",
"0.7337775",
"0.7279778",
"0.7262157",
"0.72540647",
"0.72337186",
"0.7214238",
"0.7178988",
"0.7161908",
"0.7145923",
"0.70848745",
"0.70756906",
"0.70144254",
"0.6973637",
"0.6967887",
"0.6961221... | 0.77489966 | 1 |
Return whether we are dispatching to another command or running ourselves. | def _dispatching(self):
return bool(self.generate_config or self.subapp or self.subcommand) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_dispatchable(self):\n return self.get_interaction().is_dispatchable()",
"def responds_to(self, command) -> bool:\n return command == self.command and self.active is True and self.command is not None",
"def check_command(self):\n return self.process is not None and self.process.poll() is... | [
"0.7180569",
"0.69137454",
"0.6694284",
"0.6597884",
"0.6505666",
"0.64638233",
"0.62311345",
"0.62283355",
"0.6226598",
"0.6196379",
"0.61912763",
"0.6178908",
"0.6163606",
"0.6147381",
"0.6138466",
"0.60998213",
"0.60878026",
"0.60607004",
"0.60577875",
"0.605684",
"0.60391... | 0.7599447 | 0 |
Launch an instance of a Jupyter Application | def launch_instance(cls, argv=None, **kwargs):
try:
return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
except NoStart:
return | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def launch_new_instance():\n import IPython\n\n IPython.Shell.start().mainloop()",
"def start_notebook_instance(NotebookInstanceName=None):\n pass",
"def jupyter_main(argv):\n # TODO(eric.cousineau): Just use `execv`?\n # N.B. The *appropriate* `jupyter` binary must be first on ${PATH}.\n sys... | [
"0.7901365",
"0.7452859",
"0.718343",
"0.69372797",
"0.68297315",
"0.6493166",
"0.64359236",
"0.64326996",
"0.6319209",
"0.6258749",
"0.62262815",
"0.62011844",
"0.6098384",
"0.60924405",
"0.6062445",
"0.6013436",
"0.59589446",
"0.59519994",
"0.5933313",
"0.5912305",
"0.58972... | 0.81140566 | 0 |
Function to remotely construct an SepVector using the axis object | def call_constr_hyper(axes_in):
return SepVector.getSepVector(axes=axes_in) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def CreateVector(self) -> BaseVector:",
"def generate_vector(self,dim=0,v=None):\n vec = dl.Vector()\n self.init_vector(vec,dim)\n if v is not None:\n vec[:]=v\n return vec",
"def AsVector(self) -> BaseVector:",
"def axisToVector(axis, absolute=False):\n axis = axis.... | [
"0.65261525",
"0.58050007",
"0.5773293",
"0.5647323",
"0.5626317",
"0.5574828",
"0.5511398",
"0.535013",
"0.53323585",
"0.532207",
"0.5263338",
"0.5245509",
"0.52386385",
"0.5176672",
"0.51634485",
"0.5140676",
"0.51357836",
"0.51295835",
"0.51095855",
"0.5104571",
"0.5098344... | 0.6215356 | 1 |
Function to call getNdArray method | def _call_getNdArray(vecObj):
res = vecObj.getNdArray()
return res | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getNdArray(self):\n futures = self.client.map(_call_getNdArray, self.vecDask, pure=False)\n arrays = self.client.gather(futures)\n return arrays",
"def __getitem__(self, *args):\n return _ida_hexrays.fnum_array___getitem__(self, *args)",
"def __call__(self, par_dict: dict) -> np... | [
"0.7046647",
"0.65434086",
"0.65150416",
"0.6423932",
"0.63583416",
"0.6256811",
"0.6099824",
"0.60556656",
"0.60556656",
"0.60505867",
"0.60358465",
"0.5984207",
"0.5922874",
"0.5917395",
"0.5910924",
"0.58909816",
"0.5874694",
"0.58700025",
"0.586737",
"0.5857703",
"0.58361... | 0.7929355 | 0 |
Function to call zero method | def _call_zero(vecObj):
res = vecObj.zero()
return res | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def zero(*_, **__) -> None:\n return",
"def zero(self):\n raise NotImplementedError(\"Not implemented yet.\")",
"def zero(self, value):\n raise NotImplementedError",
"def zero(klass):\n return RatTerm(RatNum(0, 1), 0)",
"def test_special_zero(self):\n x = py_function(0)\n ... | [
"0.77125883",
"0.74885565",
"0.70332116",
"0.6727768",
"0.6661376",
"0.66534805",
"0.6622474",
"0.65610784",
"0.65610784",
"0.6518906",
"0.6518906",
"0.6518906",
"0.6518906",
"0.6515382",
"0.6492568",
"0.64307714",
"0.6397077",
"0.63701916",
"0.63458824",
"0.63170666",
"0.628... | 0.75242466 | 1 |
Function to call max method | def _call_max(vecObj):
res = vecObj.max()
return res | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max(x):\n pass",
"def max_(*args, **kwargs):\n ...",
"def _call_maximum(vecObj, vec2):\n res = vecObj.maximum(vec2)\n return res",
"def produce_max(self, *args, **kwargs):\n raise NotImplementedError('This interaction has no produce_max method yet!')",
"def maximum(x, y):\r\n # see deco... | [
"0.79863125",
"0.7708388",
"0.75423074",
"0.7480599",
"0.74731016",
"0.7447338",
"0.7275313",
"0.7036475",
"0.7031782",
"0.7029877",
"0.6964031",
"0.6953153",
"0.6920789",
"0.6913864",
"0.69051015",
"0.69051015",
"0.6885601",
"0.68784386",
"0.68521833",
"0.6829463",
"0.678338... | 0.79272217 | 1 |
Function to call min method | def _call_min(vecObj):
res = vecObj.min()
return res | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def min(x):\n pass",
"def min_(*args, **kwargs):\n ...",
"def min(self):\n raise NotImplementedError('must be implemented by subclass')",
"def min(self):\n raise NotImplementedError('must be implemented by subclass')",
"def minimum(x, y):\r\n # see decorator for function body\r",
"def get_mi... | [
"0.8112719",
"0.77514035",
"0.7686637",
"0.7686637",
"0.74106723",
"0.73256445",
"0.73149294",
"0.72299445",
"0.7160379",
"0.7160379",
"0.7032379",
"0.69973993",
"0.692636",
"0.6923231",
"0.68949103",
"0.68949103",
"0.68886566",
"0.6815968",
"0.67896754",
"0.677472",
"0.67323... | 0.7779534 | 1 |
Function to call scale method | def _call_scale(vecObj, sc):
res = vecObj.scale(sc)
return res | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scale(self):",
"def __call__(self, scale=1.0, size=None, **kwargs):\n return super().__call__(scale, size=size, **kwargs)",
"def __call__(self, scale=1.0, size=None, **kwargs):\n return super().__call__(scale, size=size, **kwargs)",
"def GetScale(self):\n ...",
"def Scale(*args, **... | [
"0.8370468",
"0.75605696",
"0.75605696",
"0.75037616",
"0.72055596",
"0.720208",
"0.7173363",
"0.71732104",
"0.71393216",
"0.7114321",
"0.70633525",
"0.7062885",
"0.70525235",
"0.70265627",
"0.70203567",
"0.700472",
"0.69480336",
"0.69480336",
"0.6931368",
"0.6920381",
"0.691... | 0.7891822 | 1 |
Function to call addbias method | def _call_addbias(vecObj, bias):
res = vecObj.addbias(bias)
return res | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_bias(self):",
"def addbias(self, bias):\n daskD.wait(self.client.map(_call_addbias, self.vecDask, bias=bias, pure=False))\n return self",
"def update_bias(self):\n self._bias = self._bias + self.update_bias_value",
"def __init__(self, bias):\n self.bias = bias",
"def add... | [
"0.75090724",
"0.74435514",
"0.71909523",
"0.7173905",
"0.70282334",
"0.7021032",
"0.69703406",
"0.68569875",
"0.68350565",
"0.68350565",
"0.68350565",
"0.68216413",
"0.6761182",
"0.6707492",
"0.6413545",
"0.6396714",
"0.62695134",
"0.62075853",
"0.61967933",
"0.61928135",
"0... | 0.7993285 | 0 |
Function to call cloneSpace method | def _call_cloneSpace(vecObj):
res = vecObj.cloneSpace()
return res | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clone(self):",
"def clone(self):\n raise NotImplementedError",
"def GetClone(self, *args, **kwargs):\n pass",
"def cloneSpace(self):\n vectors = self.client.map(_call_cloneSpace, self.vecDask, pure=False)\n daskD.wait(vectors)\n return DaskVector(self.dask_client, dask_... | [
"0.7170831",
"0.66162705",
"0.65156454",
"0.651057",
"0.61613077",
"0.6150192",
"0.60535175",
"0.6036712",
"0.6028289",
"0.6016246",
"0.59904975",
"0.5956581",
"0.59445137",
"0.5925384",
"0.5880336",
"0.58759695",
"0.58571815",
"0.5846105",
"0.58332497",
"0.58322924",
"0.5825... | 0.7366754 | 0 |
Function to call reciprocal method | def _call_reciprocal(vecObj):
res = vecObj.reciprocal()
return res | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reciprocal(self):\n daskD.wait(self.client.map(_call_reciprocal, self.vecDask, pure=False))\n return self",
"def reciprocal(self):\n return Rational(self.denominator, self.numerator)",
"def reciprocal(self):\r\n s, e = self.share\r\n s = 0.5*(1/s) # TODO: no normalization fo... | [
"0.6778051",
"0.66313803",
"0.65590715",
"0.6274902",
"0.6263322",
"0.6089852",
"0.60750335",
"0.60592496",
"0.60240626",
"0.59966516",
"0.59966516",
"0.59966516",
"0.59966516",
"0.59966516",
"0.59966516",
"0.59966516",
"0.59966516",
"0.59966516",
"0.59966516",
"0.59966516",
... | 0.7664457 | 0 |
Function to call scaleAdd method | def _call_scaleAdd(vecObj, vec2, sc1, sc2):
res = vecObj.scaleAdd(vec2, sc1, sc2)
return res | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scale(self):",
"def __call__(self, scale=1.0, size=None, **kwargs):\n return super().__call__(scale, size=size, **kwargs)",
"def __call__(self, scale=1.0, size=None, **kwargs):\n return super().__call__(scale, size=size, **kwargs)",
"def with_scale_op(self, scale):\n\t\tself.variables['scal... | [
"0.76971745",
"0.70430946",
"0.70430946",
"0.69767845",
"0.6845368",
"0.6778404",
"0.6746698",
"0.6660093",
"0.65491796",
"0.65004385",
"0.64820915",
"0.6477366",
"0.6451219",
"0.6430936",
"0.63910425",
"0.63910425",
"0.63156295",
"0.6284086",
"0.6283072",
"0.6283072",
"0.628... | 0.75540984 | 1 |
Function to call isDifferent method | def _call_isDifferent(vecObj, vec2):
res = vecObj.isDifferent(vec2)
return res | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_differentClassesInequality(self):\n self.assertTrue(Record(1, 2) != DifferentRecord(1, 2))",
"def __neq__(self, other): \n return not self == other",
"def test_not_equal(self):\n utils.compare_tracing_methods(\n SimpleCompareOpsModule(\"notEqual\"),\n ... | [
"0.65226984",
"0.6314398",
"0.6312781",
"0.6234182",
"0.6232518",
"0.62164223",
"0.62129956",
"0.6203643",
"0.61775535",
"0.61089134",
"0.609841",
"0.60458374",
"0.6045339",
"0.60423636",
"0.6041607",
"0.60402584",
"0.6023854",
"0.60212564",
"0.60095114",
"0.5998625",
"0.5998... | 0.74344015 | 0 |
Function to check type and chunks of Daskvector objects | def checkVector(vec1, vec2):
if type(vec1) is not DaskVector:
raise TypeError("Self vector is not a DaskVector")
if type(vec2) is not DaskVector:
raise TypeError("Input vector is not a DaskVector")
Nvec1 = len(vec1.vecDask)
Nvec2 = len(vec2.vecDask)
if Nvec1 != Nvec2:
raise V... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_vector_type(obj: _std_typing.Any) -> bool:\n return obj.dtype == sc.DType.vector3",
"def isvect(x):\n return isinstance(x,list) and len(x) == 4 and isgoodnum(x[0]) and isgoodnum(x[1]) and isgoodnum(x[2]) and isgoodnum(x[3])",
"def is_vector(x):\r\n return len(x.shape) == 1",
"def test_is_not... | [
"0.641031",
"0.59843266",
"0.5908289",
"0.57887053",
"0.5773329",
"0.5678094",
"0.5548342",
"0.5530215",
"0.5487358",
"0.54872805",
"0.5434587",
"0.5432529",
"0.54138416",
"0.54050153",
"0.54031986",
"0.53993005",
"0.5358817",
"0.5333191",
"0.5333158",
"0.53207743",
"0.530542... | 0.7082268 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.