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 |
|---|---|---|---|---|---|---|
Returns halo (row of data) given a ``nodeIndex`` | def get_halo(self, index):
try:
halo = self.data.loc[index]
except KeyError:
raise IndexError(
"Halo id %d not found in %s" % (index, self.filename)
)
return halo | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_node(self, index):\r\n\t\tself._validate_index(index)\r\n\t\treturn self._traverse(lambda i, list: i < index)[\"node\"]",
"def halo_host(self, index):\n halo = self.get_halo(index)\n return (\n halo\n if halo.name == halo[\"hostIndex\"]\n else self.halo_hos... | [
"0.5902977",
"0.5608498",
"0.5608498",
"0.5394057",
"0.5361975",
"0.53427607",
"0.5313705",
"0.52938735",
"0.526928",
"0.5263665",
"0.5258102",
"0.5251677",
"0.5238716",
"0.52234507",
"0.52188444",
"0.52096754",
"0.51846796",
"0.51694787",
"0.51663357",
"0.516497",
"0.5148196... | 0.6535571 | 1 |
Finds indices of all progenitors of a halo, recursively. | def halo_progenitor_ids(self, index):
_progenitors = []
def rec(i):
_progenitor_ids = self.data[self.data["descendantHost"] == i][
"hostIndex"
].unique()
logging.debug("Progenitors recursion: %d > %d (%d progenitors)",
index... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def halo_progenitor_ids(self, index):\n _progenitors = []\n\n def rec(i):\n _progenitor_ids = self.data[self.data[\"descendantHost\"] == i][\n \"hostIndex\"\n ].unique()\n logging.debug(\n \"Progenitors recursion: %d > %d (%d progenitors)... | [
"0.6863077",
"0.5833046",
"0.5638713",
"0.5561099",
"0.5542297",
"0.5519623",
"0.54976434",
"0.54312",
"0.537776",
"0.53390366",
"0.53045774",
"0.5278391",
"0.5255487",
"0.52501196",
"0.5239766",
"0.522312",
"0.52182275",
"0.5186579",
"0.5170028",
"0.51365596",
"0.5129794",
... | 0.6898143 | 0 |
Finds host of halo. Recursively continues until hits the main halo, in case of multiply embedded subhaloes. | def halo_host(self, index):
halo = self.get_halo(index)
return (
halo
if halo.name == halo["hostIndex"]
else self.halo_host(self.get_halo(halo["hostIndex"]).name)
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def updateSubhalos(host,file, host2sub):\n if not (host.ID in host2sub):\n return\n g = open(file,'r')\n for posn in host2sub[host.ID]:\n g.seek(posn)\n line = g.readline()\n sub = MTH.MTHalo(line)\n if sub.pid != host.ID:\n print 'WARNING: ERROR: halo not sub... | [
"0.56107956",
"0.54044807",
"0.53122574",
"0.52616286",
"0.524105",
"0.51986015",
"0.5194676",
"0.5027002",
"0.49752408",
"0.49468756",
"0.49244332",
"0.49071574",
"0.48990795",
"0.4883024",
"0.48149812",
"0.47726056",
"0.47632203",
"0.47600392",
"0.47526672",
"0.47278097",
"... | 0.63591355 | 1 |
Finds mass of central halo and all subhaloes. | def halo_mass(self, index):
return self.data[self.data["hostIndex"] == index][
"particleNumber"
].sum() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_center_of_mass_allies(self,obs):",
"def center_of_mass(self, entity, geometric=False):\n\n # Structure, Model, Chain, Residue\n if isinstance(entity, Entity.Entity):\n atom_list = entity.get_atoms()\n # List of Atoms\n elif hasattr(entity, \"__iter__\") and [x for x... | [
"0.62661475",
"0.61996317",
"0.618251",
"0.6090707",
"0.60871905",
"0.5922938",
"0.5916971",
"0.5912088",
"0.59059227",
"0.5891885",
"0.5858639",
"0.5802172",
"0.5787271",
"0.578331",
"0.57702184",
"0.5754956",
"0.5754098",
"0.57494813",
"0.5742618",
"0.5713476",
"0.5711955",... | 0.6344772 | 1 |
Calculates mass assembly history for a given halo. Treebased approach has been abandoned for performace reasons. | def collapsed_mass_history(self, index, nfw_f):
logging.debug("Looking for halo %d", index)
halo = self.get_halo(index)
if halo["hostIndex"] != halo.name:
raise ValueError("Not a host halo!")
m_0 = self.halo_mass(index)
progenitors = pd.concat(
[
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def collapsed_mass_history(self, index, nfw_f):\n\n logging.debug(\"Looking for halo %d\", index)\n halo = self.get_halo(index)\n if halo[\"hostIndex\"] != halo.name:\n raise ValueError(\"Not a host halo!\")\n m_0 = self.halo_mass(index)\n\n progenitors = pd.concat(\n ... | [
"0.5746956",
"0.53531224",
"0.51111126",
"0.5078",
"0.5021775",
"0.49615657",
"0.4913952",
"0.48098966",
"0.4727419",
"0.4717308",
"0.46857807",
"0.4666251",
"0.46613628",
"0.46605286",
"0.46548498",
"0.46313113",
"0.4621329",
"0.45925197",
"0.45755017",
"0.4556348",
"0.45549... | 0.565708 | 1 |
Number of progenitors at one given snapshot z1 | def find_progenitors_at_z(self, SH, mtree, z1, z2):
for ss in range(z1, z2):
# nodes at redshift ss
ss_indx = np.where(mtree.data.snapshotNumber.values == ss)
nodeID = mtree.data.index.values[ss_indx]
nodeID_desc = mtree.data.descendantIndex.values[ss_ind... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tot_num_of_progenitors_at_z(self, SH, mtree, z1, z2):\n \n for ss in range(z1, z2+1):\n print('redshift:', ss)\n # nodes at redshift ss\n ss_indx = np.where(mtree.data.snapshotNumber.values == ss)\n nodeID = mtree.data.index.values[ss_indx]\n ... | [
"0.7110273",
"0.6287449",
"0.5909766",
"0.57706916",
"0.57402396",
"0.5601302",
"0.55882317",
"0.5510065",
"0.5481831",
"0.54731274",
"0.54057765",
"0.5389035",
"0.53697664",
"0.53530174",
"0.5347362",
"0.53414553",
"0.5321019",
"0.53112924",
"0.53112924",
"0.53112924",
"0.53... | 0.6796147 | 1 |
Schedule WB category export on Scrapinghub. | def category_export(url: str, chat_id: int, spider='wb', priority=2) -> str:
logger.info(f'Export {url} for chat #{chat_id}')
client, project = init_scrapinghub()
scheduled_jobs = scheduled_jobs_count(project, spider)
max_scheduled_jobs = env('SCHEDULED_JOBS_THRESHOLD', cast=int, default=1)
if pri... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def daily_task():\n global CATEGORIES_PAGES\n global BROWSER\n global DATE\n global OBSERVATION\n log.info('Scraper started')\n # Refresh date\n DATE = str(datetime.date.today())\n OBSERVATION = 0\n # Initiate headless web browser\n log.info('Initializing browser')\n BROWSER = webd... | [
"0.62322336",
"0.5496554",
"0.5323388",
"0.5212413",
"0.51680547",
"0.5047314",
"0.50356627",
"0.5001191",
"0.4996804",
"0.4940439",
"0.49359438",
"0.48962823",
"0.48792583",
"0.48306614",
"0.47664198",
"0.47485566",
"0.4733813",
"0.47102794",
"0.46897477",
"0.4680858",
"0.46... | 0.5811483 | 1 |
Train a simple conv net img_h = sentence length (padded where necessary) img_w = word vector length (300 for word2vec) filter_hs = filter window sizes hidden_units = [x,y] x is the number of feature maps (per filter window), and y is the penultimate layer sqr_norm_lim = s^2 in the paper lr_decay = adadelta decay parame... | def train_conv_net(datasets,datasets_weights,
U, U_Topical,
img_w=300,
filter_hs=[3,4,5],
hidden_units=[100,2],
dropout_rate=[0.5],
shuffle_batch=True,
n_epochs=25,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_cnn_for_text(input_data, conv_window, filter_num, pooling_window, activation_fn=tf.nn.relu,\n padding_vec=None, use_batch_norm=False, bias_initializer=tf.zeros_initializer,\n keep_prob=1, is_training=False):\n # Do padding\n input_shape = tf.shape(input_data)\n... | [
"0.6291026",
"0.61072165",
"0.6082616",
"0.59387344",
"0.59314805",
"0.5919466",
"0.5789336",
"0.5736913",
"0.5708138",
"0.5659221",
"0.5653504",
"0.5638298",
"0.5631338",
"0.5591712",
"0.55789256",
"0.55471337",
"0.5543536",
"0.5524808",
"0.550148",
"0.54923403",
"0.5481331"... | 0.6283863 | 1 |
Return the absolute path to a valid plugins.cfg file. Copied from sf_OIS.py | def getPluginPath():
import sys
import os
import os.path
paths = [os.path.join(os.getcwd(), 'plugins.cfg'),
'/etc/OGRE/plugins.cfg',
os.path.join(os.path.dirname(os.path.abspath(__file__)),
'plugins.cfg')]
for path in paths:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_config_file_location():\n\n return './' + CONFIG_FILE_NAME",
"def config_file_and_path():\n return str(rmfriend_dir() / 'config.cfg')",
"def config_path(self):\n if os.path.exists(self._config_path):\n if pyhocon.ConfigFactory.parse_file(self._config_path):\n retu... | [
"0.7101111",
"0.7079233",
"0.70316",
"0.691988",
"0.6856361",
"0.6809086",
"0.67529494",
"0.6713169",
"0.6694192",
"0.6685862",
"0.6680839",
"0.6547461",
"0.64858216",
"0.6481523",
"0.6454455",
"0.64139074",
"0.6406523",
"0.64045656",
"0.6398177",
"0.63761204",
"0.635552",
... | 0.82794327 | 0 |
This shows the config dialog and returns the renderWindow. | def configure(ogre_root):
user_confirmation = ogre_root.showConfigDialog()
if user_confirmation:
return ogre_root.initialise(True, "OGRE Render Window")
else:
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def openRocConfig(self):\n self.rocConfig_Window = QtWidgets.QDialog()\n self.rocConfig_ui = Ui_rocConfigure()\n self.rocConfig_ui.setupUi(self.rocConfig_Window)\n self.rocConfig_Window.show()",
"def display_window(self):\n frame = tk.Frame(master=self.param_window)\n fr... | [
"0.6363973",
"0.6353406",
"0.62993693",
"0.6273288",
"0.62459344",
"0.62194985",
"0.6168433",
"0.61429256",
"0.6130523",
"0.6106466",
"0.60738796",
"0.6022143",
"0.59356743",
"0.5909631",
"0.58671",
"0.5833457",
"0.58322257",
"0.57948744",
"0.5749032",
"0.5740846",
"0.570118"... | 0.6725343 | 0 |
Read a DICOM file, raising an exception if the 'DICM' marker is not present at byte 128. dicom.read_file() does this as of pydicom 0.9.5. | def read_dicom_file(fname):
fo = open(fname)
try:
preamble = fo.read(128)
magic = fo.read(4)
if len(preamble) != 128 or magic != 'DICM':
raise InvalidDicomError
fo.seek(0)
do = dicom.read_file(fo)
finally:
fo.close()
return do | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _read(path, desired_size):\n \n dcm = pydicom.dcmread(path)\n\n slope, intercept = dcm.RescaleSlope, dcm.RescaleIntercept\n \n try:\n img = (dcm.pixel_array * slope + intercept)\n except:\n img = np.zeros(desired_size[:2])-1\n \n if img.shape != desired_size[:2]:\n ... | [
"0.5621899",
"0.54997045",
"0.54964674",
"0.5454611",
"0.53653544",
"0.5280224",
"0.52707344",
"0.5212712",
"0.52099603",
"0.5170325",
"0.516826",
"0.51599985",
"0.51240665",
"0.51210904",
"0.5107606",
"0.51000935",
"0.50604916",
"0.5044146",
"0.5007753",
"0.5000708",
"0.4984... | 0.7051324 | 0 |
given our dicom_files and studies records and a patient ID, return a list of (datetime, study instance UID) ordered by date+time | def patient_studies(dicom_files, studies, patient_id):
ps = []
for uid in dicom_files[patient_id]:
datetime = '%s%s' % studies[uid]
ps.append([datetime, uid])
ps.sort(lambda a, b: cmp(a[0], b[0]))
for el in ps:
date_time_parts = (el[0][0:4],
el[0][4:6]... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_all_dicom_images(self, verbose=True):\n if verbose: print(\"Loading dicom files ... This may take a moment.\")\n\n path = self.get_path_to_dicom_files()\n fnames = [fname for fname in os.listdir(path)\n if fname.endswith('.dcm') and not fname.startswith(\".\... | [
"0.60390854",
"0.5873085",
"0.5861059",
"0.5460806",
"0.5381554",
"0.53764325",
"0.5292173",
"0.52161545",
"0.5200111",
"0.51963425",
"0.5172361",
"0.516292",
"0.5146686",
"0.5142398",
"0.51141894",
"0.511357",
"0.5112972",
"0.510411",
"0.5102937",
"0.5091951",
"0.5091913",
... | 0.82577133 | 0 |
Check if a project/subject/session identifier is valid. Identifiers can only contain alphanumeric characters and underscores. | def _validate_identifier(self, identifier):
for c in identifier:
if c not in string.letters + string.digits + '_':
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def IsProjectIDValid(project):\n if len(project) < 6 or len(project) > 30:\n return False\n return bool(re.match('^[a-z][a-z0-9\\\\-]*[a-z0-9]$', project))",
"def IsValidIdentifier(string):\n counter = 0\n if string in keyword.kwlist:\n feedback = (False, \"Invalid: can't use a keyword as your ... | [
"0.7817043",
"0.7263203",
"0.71657807",
"0.6915533",
"0.6915533",
"0.6901704",
"0.68005633",
"0.6792642",
"0.67050254",
"0.6685971",
"0.6454717",
"0.64318484",
"0.6427234",
"0.64037365",
"0.6375381",
"0.6367689",
"0.6350279",
"0.6343211",
"0.6312446",
"0.63092995",
"0.6287927... | 0.7744844 | 1 |
Normalizes USD price with thousand separator into float value | def normalize_price(price: str) -> float:
return float(price.strip().replace(',', '')) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_price(str_val):\n return float(str_val.replace('.', '').replace(',', '.'))",
"def clean_dollar_to_float(value):\n return (value.replace('$', '').replace(',', ''))",
"def convert_currency(val):\n new_val = val.replace(',','').replace('$', '')\n return float(new_val)",
"def clean_value(self... | [
"0.72919416",
"0.7071461",
"0.6978202",
"0.6896954",
"0.68778527",
"0.6861502",
"0.668687",
"0.66791004",
"0.6679073",
"0.6679073",
"0.6679073",
"0.6679073",
"0.6679073",
"0.6636291",
"0.6459509",
"0.64089173",
"0.64083546",
"0.63997513",
"0.6395582",
"0.6393109",
"0.6388328"... | 0.80026025 | 0 |
Reads the csv file CSV file should contain ['Question', 'Answer'] columns Remove NaN values Throw error if format is bad or file does not exist | def parse_csv_file(self, csv_file: str):
try:
df = pd.read_csv(csv_file)
if not set(['Question', 'Answer']).issubset(df.columns):
raise BadCSVFile(
"CSV file does not contain ['Question', 'Answer'] columns.")
df.dropna(inplace=True)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_csv():",
"def read_csv_file(self):\n pass",
"def test_csv(self, input_file_path: str, answer_file_path: List[Dict]):\n with open(attach_path(answer_file_path), 'r') as answer_file:\n csv_file = open(attach_path(input_file_path))\n assert str(read_csv(csv_file)) == a... | [
"0.7320947",
"0.6934107",
"0.6727932",
"0.6726128",
"0.6720706",
"0.6720139",
"0.67085135",
"0.66700244",
"0.65878505",
"0.6561937",
"0.64199805",
"0.64198834",
"0.6413396",
"0.6406278",
"0.64025426",
"0.63658756",
"0.63533485",
"0.63505536",
"0.63503546",
"0.63334334",
"0.63... | 0.77133363 | 0 |
Returns a vector for a given query | def get_vector(self, query: list):
if len(query) == 0:
raise BadQueryParameter("Query (list) can not be empty.")
return self.vectorizer.transform(query) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _to_full_vector(self, query_vector: List[Tuple[str, float]]) -> np.array:\n terms = list(self.index.get_terms())\n terms.sort()\n vector = np.zeros(len(terms))\n\n for (term, weight) in query_vector:\n index = terms.index(term)\n vector[index] = weight\n\n ... | [
"0.710231",
"0.6852143",
"0.6806123",
"0.6790017",
"0.65516216",
"0.6484472",
"0.6346682",
"0.62224436",
"0.62009585",
"0.61882883",
"0.6144658",
"0.6134512",
"0.61188674",
"0.6103813",
"0.6086374",
"0.6070219",
"0.60688305",
"0.5987167",
"0.59024227",
"0.5888981",
"0.5858321... | 0.7983144 | 0 |
Groups data in SimulationReport's by the value of alpha or gamma2 | def group_data(simulation_reports: List[SimulationReport]) -> Dict[float, SimulationTable]:
heat_maps: OrderedDict[float, SimulationTable] = OrderedDict()
for report in simulation_reports:
if report.param not in heat_maps:
param_name = "alpha" if report.growth_type == GrowthType.Polynomial e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute_data_gamma_(idx2_daid, wx2_rvecs, wx2_aids, wx2_idf,\n alpha=3, thresh=0):\n if utool.DEBUG2:\n from ibeis.model.hots.smk import smk_debug\n smk_debug.rrr()\n smk_debug.check_wx2(wx2_rvecs=wx2_rvecs, wx2_aids=wx2_aids)\n wx_sublist = pdh.ensure_values(p... | [
"0.5615865",
"0.5525419",
"0.5523908",
"0.54661447",
"0.536697",
"0.53608376",
"0.5330283",
"0.52438",
"0.5227983",
"0.5227983",
"0.5154076",
"0.5146968",
"0.51379746",
"0.51017696",
"0.5098285",
"0.50540596",
"0.5026247",
"0.5020847",
"0.50154185",
"0.49952942",
"0.4989816",... | 0.6480124 | 0 |
Abstract method invoked when a trial is completed or terminated. Do nothing by default. | def trial_end(self, parameter_id, success, **kwargs): | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_trial_complete(self, trial_runner, trial, result):\n\n raise NotImplementedError",
"def on_trial_complete(self, trial: Trial, result: Dict[str, Any]):\n pass",
"def trial(self):\n pass",
"def on_trial_complete(self,\r\n trial_id: str,\r\n ... | [
"0.7465205",
"0.7200161",
"0.68019694",
"0.6782522",
"0.66770226",
"0.66569257",
"0.6578445",
"0.6572621",
"0.6555807",
"0.65140676",
"0.64149064",
"0.6342137",
"0.63419366",
"0.63419366",
"0.6279795",
"0.62722665",
"0.62639666",
"0.62104183",
"0.6204361",
"0.6177283",
"0.616... | 0.7370623 | 1 |
Abstract method for updating the search space. Must override. Tuners are advised to support updating search space at runtime. If a tuner can only set search space once before generating first hyperparameters, it should explicitly document this behaviour. | def update_search_space(self, search_space):
raise NotImplementedError('Tuner: update_search_space not implemented') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def updateSearch(self, authenticationToken, search):\r\n pass",
"def set_search_space(self,\n search_space_size: int):\n self.search_space = np.linspace(0, 1, search_space_size)",
"def _update_search_info(self):\n page_size = int(self._search_data['pageSize'])\n ... | [
"0.6237321",
"0.61739534",
"0.6061544",
"0.57943547",
"0.57356995",
"0.5705272",
"0.56967473",
"0.5678522",
"0.5660615",
"0.5633325",
"0.562737",
"0.5563",
"0.55493927",
"0.5500955",
"0.54821765",
"0.545939",
"0.545895",
"0.5434083",
"0.542714",
"0.5413401",
"0.5410262",
"0... | 0.78161246 | 0 |
By default the nested modules are not imported automatically. Call this function if you would like to import them all. This may be useful for autocompletion in interactive mode. | def import_all():
import theory | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def import_sub_modules(self):\n try:\n for package in self.package_list:\n Utils.import_utils.import_submodules(package)\n except ImportError, err:\n print_error(\"{0} : \\n\".format(str(err)))\n print_error('unexpected error: {0}'.format(traceback.form... | [
"0.7020762",
"0.6595134",
"0.63510954",
"0.62685543",
"0.6243627",
"0.62241906",
"0.617775",
"0.61071664",
"0.61007714",
"0.6059917",
"0.60515565",
"0.6002455",
"0.59896797",
"0.5956948",
"0.595397",
"0.5918022",
"0.591676",
"0.59048396",
"0.5900739",
"0.587304",
"0.5872894",... | 0.6882997 | 1 |
Reset domain_list, origin_list, caching_list, service_name and flavor_id to its default value. | def reset_defaults(self):
self.domain_list = [{"domain": "mywebsite%s.com" % uuid.uuid1()}]
self.origin_list = [{"origin": "mywebsite1.com",
"port": 443,
"ssl": False}]
self.caching_list = [{"name": "default", "ttl": 3600},
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset(self):\n self.manager.delete_all()\n for name, val in DEFAULT_SETTINGS.items():\n val['name'] = name\n val['default_value'] = val['value']\n self.manager.from_dict(val)",
"def reset(self):\n for var in self.var_list:\n var.value = None\n ... | [
"0.6844756",
"0.6752497",
"0.65349716",
"0.6512155",
"0.6489538",
"0.6362991",
"0.614943",
"0.6136506",
"0.610388",
"0.59980386",
"0.5987554",
"0.59747857",
"0.59503067",
"0.59085506",
"0.59052765",
"0.58961785",
"0.5888273",
"0.5880857",
"0.58757615",
"0.58709276",
"0.586754... | 0.8584799 | 0 |
Create invalid_json like [[[[[[[[[[[[[test]]]]]]]]]]]]] | def create_invalid_json(self, length):
str = ""
str += "[" * length
str += "\"test\""
str += "]" * length
return str | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_circular_nested(self):\n obj = {}\n obj[\"list\"] = [{\"obj\": obj}]\n with self.assertRaises(orjson.JSONEncodeError):\n orjson.dumps(obj)",
"def test_schema_invalid_json(self):\n schema_0_input = schema_nested_2_invalid_JSON\n\n # if you uncomment this line... | [
"0.6324935",
"0.62803555",
"0.6237883",
"0.615935",
"0.5985762",
"0.597395",
"0.5954119",
"0.5931266",
"0.5930603",
"0.5907497",
"0.5892029",
"0.588324",
"0.5859376",
"0.5838681",
"0.582026",
"0.5753517",
"0.57280266",
"0.5629437",
"0.56058764",
"0.5550728",
"0.5540297",
"0... | 0.6898037 | 0 |
zip the data using gzip format | def data_zip(self, data):
stringio = StringIO.StringIO()
gzip_file = gzip.GzipFile(fileobj=stringio, mode='wb')
gzip_file.write(data)
gzip_file.close()
return stringio.getvalue() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __unzip(self, data):\n compressed = StringIO.StringIO(data)\n gzipper = gzip.GzipFile(fileobj=compressed)\n return gzipper.read()",
"def save_to_gzip(data,fname):\n with gzip.open(fname + '.gz', 'wb',compresslevel = 9) as f:\n f.write(data.tobytes())",
"def gzip_compress(... | [
"0.6996331",
"0.67672616",
"0.67579013",
"0.6729529",
"0.65639186",
"0.65639186",
"0.6514379",
"0.63974094",
"0.6345399",
"0.61934805",
"0.61905354",
"0.61457014",
"0.61027217",
"0.6101483",
"0.6070386",
"0.60639983",
"0.6051844",
"0.604895",
"0.6003619",
"0.5999707",
"0.5944... | 0.7971304 | 0 |
Check whether it is possible to kill the application by creating a big malicious json blob. | def test_malicious_json_create_service(self):
# create a payload with malicous json blob
attack_string = self.create_malicious_json(900)
headers = {"X-Auth-Token": self.client.auth_token,
"X-Project-Id": self.client.project_id}
kwargs = {"headers": headers, "data": att... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _metadata_too_large(self):\n # currently the entire POST JSON request body is limited by default to 100kb\n return sys.getsizeof(self.metadata) > 10000",
"def can_process(dict_data: dict) -> bool:\n return dict_data[\"experiment\"] in [_023_EXPERIMENT]",
"def is_private(self, info):\n ... | [
"0.53570426",
"0.5039716",
"0.498842",
"0.4982407",
"0.4946164",
"0.49423128",
"0.49222663",
"0.49024215",
"0.49024215",
"0.48760965",
"0.48653737",
"0.48636398",
"0.4819188",
"0.48098838",
"0.48077267",
"0.48038307",
"0.48038307",
"0.4798679",
"0.47941115",
"0.47817224",
"0.... | 0.5133456 | 1 |
Check whether it is possible to kill the application by creating a big malicious json blob with utf8 encoding. | def test_malicious_json_utf_8_create_service(self):
# create a payload with malicous json blob
attack_string = self.create_malicious_json(800)
headers = {"X-Auth-Token": self.client.auth_token,
"X-Project-Id": self.client.project_id}
kwargs = {"headers": headers, "data... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_bad_encoding(self, app, data_queues):\n body = b'{\"comment\": \"R\\xe9sum\\xe9 from 1990\", \"items\": []}'\n assert \"Résumé\" in body.decode(\"iso8859-1\")\n with pytest.raises(UnicodeDecodeError):\n body.decode(\"utf-8\")\n headers = {\"Content-Type\": \"applicat... | [
"0.57005584",
"0.5268216",
"0.5156061",
"0.51394224",
"0.5138233",
"0.5138233",
"0.50800556",
"0.5001988",
"0.49770227",
"0.4972004",
"0.48682755",
"0.4838062",
"0.48076913",
"0.48053455",
"0.47852117",
"0.47045177",
"0.47016084",
"0.4695853",
"0.46840426",
"0.46781862",
"0.4... | 0.54639024 | 1 |
Check whether it is possible to kill the application by creating a big malicious json blob with utf16 encoding. | def test_malicious_json_utf_16_create_service(self):
# create a payload with malicous json blob
attack_string = self.create_malicious_json(400)
headers = {"X-Auth-Token": self.client.auth_token,
"X-Project-Id": self.client.project_id}
kwargs = {"headers": headers, "dat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_bad_encoding(self, app, data_queues):\n body = b'{\"comment\": \"R\\xe9sum\\xe9 from 1990\", \"items\": []}'\n assert \"Résumé\" in body.decode(\"iso8859-1\")\n with pytest.raises(UnicodeDecodeError):\n body.decode(\"utf-8\")\n headers = {\"Content-Type\": \"applicat... | [
"0.5257188",
"0.5233604",
"0.50461715",
"0.5023485",
"0.5023485",
"0.4973716",
"0.48788738",
"0.4845623",
"0.48314884",
"0.48003462",
"0.47874525",
"0.47507095",
"0.4736719",
"0.4718207",
"0.47097185",
"0.47041085",
"0.46827826",
"0.46773538",
"0.46709177",
"0.4652283",
"0.46... | 0.5806415 | 0 |
Check whether it is possible to kill the application by creating a big malicious json blob with gzip. | def test_malicious_json_gzip_create_service(self):
# create a payload with malicious json blob
attack_string = self.create_malicious_json(2500)
headers = {"X-Auth-Token": self.client.auth_token,
"X-Project-Id": self.client.project_id,
"Content-Encoding": "gz... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_gzip(handler,config):\r\n if not config.gzip:\r\n return False\r\n if not gzip_support:\r\n return False\r\n accept_encoding = handler.headers.get('accept-encoding','').split(',')\r\n accept_encoding = [ x.strip() for x in accept_encoding ]\r\n ctype = handler.resp_headers[\"C... | [
"0.53313565",
"0.5310692",
"0.5241604",
"0.51391083",
"0.50379765",
"0.5004744",
"0.50042313",
"0.4998042",
"0.4920025",
"0.49113283",
"0.49000984",
"0.48996288",
"0.48760656",
"0.48497862",
"0.4841596",
"0.48019674",
"0.48009473",
"0.47862568",
"0.47672084",
"0.47561482",
"0... | 0.58686054 | 0 |
Check whether it is possible to kill the application by creating a service with huge list of domains. | def test_dos_create_service_domain_list(self):
# create a huge list of domain
self.reset_defaults()
for k in range(1, 30000):
self.domain_list.append({"domain": "w.t%s.com" % k})
# send MAX_ATTEMPTS requests
for k in range(1, self.MAX_ATTEMPTS):
self.serv... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_dos_list_service_huge_junk(self):\n # create a huge list of domain\n attack_string = \"1\" * 3500\n params = {\"junk\": attack_string}\n resp = self.client.list_services(param=params)\n self.assertTrue(resp.status_code < 503)",
"def test_dos_list_service_huge_limit(sel... | [
"0.6063095",
"0.6022489",
"0.56425107",
"0.5547615",
"0.54923004",
"0.54674953",
"0.5434379",
"0.54335403",
"0.54237306",
"0.5372089",
"0.53475595",
"0.5319241",
"0.52755827",
"0.5261143",
"0.525039",
"0.52496856",
"0.5240958",
"0.52227604",
"0.52175325",
"0.5212614",
"0.5209... | 0.6728664 | 0 |
Check whether it is possible to kill the application by creating a service with huge list of origins. | def test_dos_create_service_origin_list(self):
# create a huge list of domain
self.reset_defaults()
for k in range(1, 9000):
self.origin_list.append({"origin": "m%s.com" % k,
"port": 443,
"ssl": False,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def killAll(controller=False):",
"def remote_kill():",
"def issuer_liveness_check():\n global app_config\n\n if app_config[\"running\"]:\n # return True until we get a shutdown request\n return True\n\n # return True until the work queue is cleared\n return tob_connection_active()",
... | [
"0.541091",
"0.54013634",
"0.5319908",
"0.5259425",
"0.5252269",
"0.5223949",
"0.52037764",
"0.51941264",
"0.51511925",
"0.51103085",
"0.5099697",
"0.5097654",
"0.50843334",
"0.5061235",
"0.5056471",
"0.5046156",
"0.501708",
"0.5002467",
"0.49952114",
"0.4995023",
"0.497257",... | 0.5795615 | 0 |
Check whether it is possible to kill the application by creating a service with huge list rules within caching list. | def test_dos_create_service_caching_list_rules(self):
# create a huge list of domain
self.reset_defaults()
for k in range(1, 15000):
self.caching_list[1]["rules"].append(
{"name": "i%s" % k,
"request_url": "/index.htm"})
# send MAX_ATTEMPTS r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_stop_flag(con):\n k, v = con.kv.get(\"service/rebootmgr/stop\")\n if v:\n return True\n return False",
"def test_dos_create_service_caching_list(self):\n # create a huge list of domain\n self.reset_defaults()\n for k in range(1, 16000):\n self.caching_lis... | [
"0.58728933",
"0.57062775",
"0.5591448",
"0.55198026",
"0.5498804",
"0.54034287",
"0.5393193",
"0.5377958",
"0.53490484",
"0.5301769",
"0.5300462",
"0.5272994",
"0.52642924",
"0.52431273",
"0.52165616",
"0.5213221",
"0.5209753",
"0.5188523",
"0.5138128",
"0.5119553",
"0.51152... | 0.6129817 | 0 |
Check whether it is possible to kill the application by listing all services with a huge limit | def test_dos_list_service_huge_limit(self):
# create a huge list of domain
attack_string = "1" * 3500
params = {"limit": attack_string, "marker": attack_string}
resp = self.client.list_services(param=params)
self.assertTrue(resp.status_code < 503) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_dos_list_service_huge_junk(self):\n # create a huge list of domain\n attack_string = \"1\" * 3500\n params = {\"junk\": attack_string}\n resp = self.client.list_services(param=params)\n self.assertTrue(resp.status_code < 503)",
"def checkProcess(process_id, time_limit)... | [
"0.6190547",
"0.6119105",
"0.60541016",
"0.6032116",
"0.60296106",
"0.6005415",
"0.5905079",
"0.5887385",
"0.5848494",
"0.57247454",
"0.571023",
"0.5692282",
"0.5672176",
"0.56716925",
"0.5535039",
"0.5512738",
"0.550317",
"0.5502144",
"0.54839885",
"0.5466932",
"0.5466897",
... | 0.67318535 | 0 |
Given the key of the external_issue return the external issue link. | def get_issue_url(self, key):
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def external_key_uri(self) -> str:\n return pulumi.get(self, \"external_key_uri\")",
"def get_link_issue_config(self, group, **kwargs):\n return [\n {\n 'name': 'externalIssue',\n 'label': 'Issue',\n 'default': '',\n 'type': 'st... | [
"0.65414643",
"0.6026105",
"0.6026105",
"0.5845039",
"0.5555224",
"0.554478",
"0.5533305",
"0.5504559",
"0.5486554",
"0.5481756",
"0.5427769",
"0.5370131",
"0.532764",
"0.532764",
"0.532104",
"0.5304017",
"0.5276933",
"0.5276933",
"0.5267372",
"0.52666265",
"0.524295",
"0.5... | 0.75889593 | 0 |
Stores the last used field defaults on a perproject basis. This accepts a dict of values that will be filtered to keys returned by ``get_persisted_default_config_fields`` which will automatically be merged into the associated field config object as the default. | def store_issue_last_defaults(self, project_id, data):
persisted_fields = self.get_persisted_default_config_fields()
if not persisted_fields:
return
defaults = {k: v for k, v in six.iteritems(data) if k in persisted_fields}
self.org_integration.config.update({
'... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _update_fields_with_default(annotation_fields, defaults_dict):\n all_fields = OrderedDict()\n all_filed_keys = _merge_field_keys(annotation_fields, defaults_dict)\n for name in all_filed_keys:\n # Get or create annotation\n annotation = (\n annotation_f... | [
"0.6671097",
"0.64907825",
"0.6364141",
"0.6281838",
"0.62724817",
"0.6210134",
"0.6145344",
"0.60783255",
"0.6055254",
"0.6043969",
"0.60429865",
"0.5975377",
"0.5955533",
"0.5933369",
"0.58850956",
"0.585415",
"0.56757694",
"0.5667322",
"0.5656256",
"0.5634078",
"0.56188464... | 0.7270465 | 0 |
Create an issue via the provider's API and return the issue key, title and description. Should also handle API client exceptions and reraise as an IntegrationError (using the `message_from_error` helper). | def create_issue(self, data, **kwargs):
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _create_issue(*, image: str, repo: str, run: str, stacktrace: str) -> Issue:\n title = f\"Automatic error report from {repo}\"\n body = _report_body(image=image, repo=repo, run=run, stacktrace=stacktrace)\n return TAGBOT_ISSUES_REPO.create_issue(title, body)",
"def test_issue_create_issue(self):\n ... | [
"0.62188655",
"0.61720526",
"0.61446583",
"0.61345875",
"0.6107727",
"0.6092078",
"0.59738606",
"0.5907364",
"0.58103263",
"0.5800523",
"0.5772324",
"0.5594634",
"0.55728924",
"0.5495695",
"0.5421277",
"0.54186255",
"0.53647876",
"0.5340007",
"0.5340007",
"0.52912503",
"0.528... | 0.6616591 | 1 |
Takes the external issue that has been linked via `get_issue`. Does anything needed after an issue has been linked, i.e. creating a comment for a linked issue. | def after_link_issue(self, external_issue, **kwargs):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_issue_create_comment(self):\n pass",
"def create_issue_link(self, link_type, inwardissue,\r\n outwardissue, comment=None):\r\n self.jira.create_issue_link(type=link_type,\r\n inwardIssue=str(inwardissue),\r\n ... | [
"0.6610581",
"0.64180446",
"0.63382167",
"0.6309767",
"0.62233156",
"0.6104971",
"0.60037994",
"0.59019923",
"0.58587396",
"0.5726099",
"0.5722433",
"0.5694132",
"0.56749576",
"0.56747717",
"0.5665945",
"0.5628418",
"0.56239235",
"0.5613582",
"0.5613582",
"0.55969155",
"0.557... | 0.6989102 | 0 |
Returns the display name of the issue. This is not required but helpful for integrations whose external issue key does not match the disired display name. | def get_issue_display_name(self, external_issue):
return '' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def display_name(self) -> Optional[str]:\n return pulumi.get(self, \"display_name\")",
"def display_name(self) -> Optional[str]:\n return pulumi.get(self, \"display_name\")",
"def display_name(self) -> Optional[str]:\n return pulumi.get(self, \"display_name\")",
"def display_name(self) -... | [
"0.71604306",
"0.71604306",
"0.71604306",
"0.7145177",
"0.7145177",
"0.7145177",
"0.7145177",
"0.7145177",
"0.7145177",
"0.7145177",
"0.7145177",
"0.7145177",
"0.7145177",
"0.7145177",
"0.7145177",
"0.70821923",
"0.69916433",
"0.69874066",
"0.69397634",
"0.69397634",
"0.69397... | 0.8553241 | 0 |
Helper method for get_repository_choices Returns the choice for the default repo in a tuple to be added to the list of repository choices | def create_default_repo_choice(self, default_repo):
return (default_repo, default_repo) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_repository_choices(self, group, **kwargs):\n try:\n repos = self.get_repositories()\n except ApiError:\n raise IntegrationError(\n 'Unable to retrive repositories. Please try again later.'\n )\n else:\n repo_choices = [(repo['i... | [
"0.7996344",
"0.6400903",
"0.6090768",
"0.604242",
"0.60069907",
"0.56722534",
"0.56320244",
"0.557179",
"0.55387455",
"0.54395264",
"0.5438947",
"0.5407968",
"0.5386718",
"0.535366",
"0.5341311",
"0.53403133",
"0.5228114",
"0.5218312",
"0.5218312",
"0.5218312",
"0.52169466",... | 0.8641376 | 0 |
Propagate a sentry issue's assignee to a linked issue's assignee. If assign=True, we're assigning the issue. Otherwise, deassign. | def sync_assignee_outbound(self, external_issue, user, assign=True, **kwargs):
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_assignment(self, updates, original=None):\n if not original:\n original = {}\n\n self.set_type(updates, original)\n\n if not updates.get('assigned_to'):\n if updates.get('priority'):\n # Priority was edited - nothing to set here\n ret... | [
"0.6341137",
"0.6102024",
"0.59917015",
"0.59198666",
"0.5881656",
"0.5821527",
"0.5817272",
"0.57891667",
"0.57301235",
"0.5691763",
"0.56128204",
"0.55561805",
"0.55232775",
"0.528361",
"0.52553594",
"0.52330756",
"0.5215624",
"0.51927084",
"0.5185444",
"0.5087694",
"0.5084... | 0.7126472 | 1 |
return the current position in axis x | def get_pos_x(self):
return self.__pos_x | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_x(self):\n return self.position.x",
"def get_x(self):\n return self.posX",
"def get_x_position(self):\n return self.rect.x",
"def get_axis_x(self):\r\n return self.__x_axis",
"def get_x_position(self):\n return self.actual_coordinates[0]",
"def xaxis ( self ) :... | [
"0.84356475",
"0.8302575",
"0.825707",
"0.8191136",
"0.81628805",
"0.809894",
"0.808944",
"0.808944",
"0.8071701",
"0.79766065",
"0.7853635",
"0.7823813",
"0.77839094",
"0.7724001",
"0.7704104",
"0.7700276",
"0.76920474",
"0.76795393",
"0.7627869",
"0.7589636",
"0.75225663",
... | 0.8329716 | 1 |
return the current speed in axis x | def get_speed_x(self):
return self.__speed_x | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_speed_x(self):\r\n return self.__X_speed",
"def speedup_x(self):\r\n new_speed = math.cos((self.__direction*math.pi)/180) + self.__X_speed\r\n self.__X_speed = new_speed",
"def getXVelocity(self):\n return self.xvelocity",
"def get_speed(self):\r\n return self.__x_s... | [
"0.8555267",
"0.7207319",
"0.71035296",
"0.68359816",
"0.6763808",
"0.67338073",
"0.6704949",
"0.66456616",
"0.65846103",
"0.6549981",
"0.6549981",
"0.651929",
"0.6485276",
"0.6482039",
"0.6412599",
"0.63956916",
"0.63956916",
"0.6384349",
"0.6323819",
"0.63225263",
"0.631968... | 0.84871364 | 1 |
return the current speed in axis y | def get_speed_y(self):
return self.__speed_y | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_speed_y(self):\r\n return self.__y_speed",
"def speedup_y(self):\r\n new_speed = math.sin((self.__direction*math.pi)/180) + self.__y_speed\r\n self.__y_speed = new_speed",
"def verticalspeed(self):\n return self.__vertspeed.value",
"def get_axis_y(self):\r\n return ... | [
"0.8572007",
"0.7324329",
"0.7246045",
"0.7071657",
"0.70214754",
"0.69910544",
"0.6868786",
"0.681344",
"0.680576",
"0.67981166",
"0.67907566",
"0.6772865",
"0.6765004",
"0.67371374",
"0.6736603",
"0.6687959",
"0.6687255",
"0.6685152",
"0.6685152",
"0.66710705",
"0.66710705"... | 0.8426076 | 1 |
set new speed (new_speed) in axis x for the torpedo | def set_speed_x(self, new_speed):
self.__speed_x = new_speed | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def speedup_x(self):\r\n new_speed = math.cos((self.__direction*math.pi)/180) + self.__X_speed\r\n self.__X_speed = new_speed",
"def set_speed(self, axis, speed):\n #log.info(f\"set speed {axis} {speed}\")\n self.cmd_axis_speed[axis] = speed",
"def set_speed(self, new_speed):\n ... | [
"0.7153202",
"0.69229406",
"0.6859478",
"0.6688785",
"0.66181517",
"0.6542605",
"0.6542605",
"0.6542605",
"0.65331244",
"0.64134264",
"0.6341696",
"0.62807065",
"0.6228572",
"0.6213521",
"0.61853576",
"0.617665",
"0.61610395",
"0.6149115",
"0.6138381",
"0.6097479",
"0.6094318... | 0.79879344 | 0 |
set new speed (new_speed) in axis y for the torpedo | def set_speed_y(self, new_speed):
self.__speed_y = new_speed | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def speedup_y(self):\r\n new_speed = math.sin((self.__direction*math.pi)/180) + self.__y_speed\r\n self.__y_speed = new_speed",
"def customize_torpedo_speed(self, current_gameboard, turn, new_speed):\n current_gameboard['torpedo_speed'][turn] = new_speed",
"def set_speed(self, new_speed):\... | [
"0.74478376",
"0.7266299",
"0.6885508",
"0.68010527",
"0.67818487",
"0.65538603",
"0.64874476",
"0.6445851",
"0.6438389",
"0.64053863",
"0.6376815",
"0.6363942",
"0.63039124",
"0.63012075",
"0.62974465",
"0.62974465",
"0.62974465",
"0.62857443",
"0.6271287",
"0.62608033",
"0.... | 0.8085644 | 0 |
set new position (new_pos) in axis x for the torpedo | def set_new_pos_in_x(self, new_pos):
self.__pos_x = new_pos | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setXPos(self,newXPos):\n self.xPos=newXPos",
"def set_axis_x(self, new_axis_point):\r\n self.__x_axis = new_axis_point",
"def setX(self, value):\n self.position[0] = value",
"def set_pos(self, x):\n self._pos = x",
"def set_x(self, new_x):\r\n self.x = new_x",
"def ... | [
"0.7246535",
"0.7111097",
"0.70392",
"0.6978868",
"0.6963708",
"0.6886643",
"0.68568933",
"0.6825037",
"0.6757608",
"0.6701941",
"0.6696527",
"0.6664855",
"0.6620675",
"0.6489275",
"0.64415085",
"0.63936675",
"0.63880914",
"0.634943",
"0.6321042",
"0.6301134",
"0.62831503",
... | 0.7426567 | 0 |
set new position (new_pos) in axis y for the torpedo | def set_new_pos_in_y(self, new_pos):
self.__pos_y = new_pos | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_axis_y(self, new_axis_point):\r\n self.__y_axis = new_axis_point",
"def set_y(self, new_y):\r\n self.y = new_y",
"def set_ypos(self, deg):\n if deg < -10:\n deg = -10\n elif deg > 10:\n deg = 10\n deg += 10\n self.kit.servo[8].angle = deg"... | [
"0.7400605",
"0.7042508",
"0.70301294",
"0.70165414",
"0.69808483",
"0.67663985",
"0.66854906",
"0.6540774",
"0.6528592",
"0.65152085",
"0.64745337",
"0.64745337",
"0.6468849",
"0.64469284",
"0.6417484",
"0.6325399",
"0.6307254",
"0.6282218",
"0.62483877",
"0.6222319",
"0.621... | 0.7415262 | 0 |
set the new number of lives (new_number_of_lives) of the torpedo | def set_lives(self, new_number_of_lives):
self.__lives = new_number_of_lives | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setLives(self, lives):\n assert type(lives) == int\n self._lives = lives",
"def set_lives(self, lives):\n self._lives = lives",
"def update_lives(self, amount):\n self.lives += amount",
"def setNbLives(self, nb_lives: int) -> None:\n self._nbLives = nb_lives\n if... | [
"0.7700371",
"0.7667687",
"0.7629367",
"0.73052084",
"0.72219425",
"0.7182382",
"0.6548997",
"0.6420976",
"0.6353151",
"0.6246695",
"0.62098116",
"0.5965814",
"0.5958923",
"0.58790517",
"0.5875401",
"0.56700194",
"0.5605648",
"0.55878407",
"0.5576551",
"0.5528152",
"0.5494097... | 0.8256307 | 0 |
Initialize the object with a placeholder value of 1. | def __init__(self) -> None:
super().__init__()
self.placeholder = 1.0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, value=1.0):\n self.value = value",
"def __init__(self,value = 0):\n\n self.value = value",
"def __init__(self):\n super().__init__()\n self._value = 0",
"def __init__(self, BLANK=0):\n self.BLANK = BLANK",
"def __init__(self, number=0):\n pass",
... | [
"0.69245744",
"0.6914013",
"0.68501645",
"0.6800856",
"0.6740337",
"0.6642504",
"0.65677077",
"0.65439326",
"0.6520527",
"0.64555895",
"0.6452134",
"0.64311016",
"0.64110297",
"0.6386236",
"0.6386236",
"0.6364008",
"0.6297296",
"0.6297296",
"0.6297296",
"0.6297296",
"0.629729... | 0.7242961 | 0 |
Return an empty RequiredParameters object. | def _required_parameters(self) -> RequiredParameters:
return RequiredParameters([]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_required_params():\n return {}",
"def get_empty_required_fields(self):\n empty_fields = self.get_empty_fields()\n return [f for f in empty_fields if f in self.REQUIRED_FIELDS]",
"def get_required_parameters(self) -> list:\n results = []\n if self.no_params or self.par... | [
"0.7562365",
"0.6865271",
"0.6684548",
"0.6580648",
"0.642038",
"0.6418872",
"0.63192177",
"0.6319068",
"0.6306489",
"0.6298723",
"0.623854",
"0.62329423",
"0.6214493",
"0.61800486",
"0.61040115",
"0.6102065",
"0.6099858",
"0.6063706",
"0.60514194",
"0.6025997",
"0.6002806",
... | 0.86397606 | 0 |
Return an empty DerivedParameterCollection. | def _get_derived_parameters(self) -> DerivedParameterCollection:
return DerivedParameterCollection([]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clear(self) -> None:\n super().clear()\n self._parameters = np.array([], dtype=object)",
"def get_parameters(self):\n self.unimpl_base_class()",
"def get_parameters(self):\n d = super().get_parameters()\n d.pop('population_size', None)\n return d",
"def empty_col... | [
"0.60794294",
"0.60395926",
"0.59694386",
"0.59527194",
"0.5874923",
"0.5814086",
"0.57916915",
"0.57306236",
"0.5725052",
"0.56777626",
"0.5676922",
"0.56153905",
"0.5593001",
"0.5562131",
"0.5517442",
"0.5513053",
"0.5445878",
"0.5444455",
"0.5426895",
"0.5397799",
"0.53526... | 0.8430621 | 1 |
Return an EmptyLikelihood object. | def empty_likelihood() -> EmptyLikelihood:
return EmptyLikelihood() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getNoData(self):\n #---+----|----+----|----+----|----+----|----+----|----+----|----+----|\n return TreeLikelihoodBase.getNoData(self)",
"def mempty(self):\n return identity",
"def empty() -> ObservableBase:\n from ..operators.observable.empty import empty\n return empty()... | [
"0.68557054",
"0.63254637",
"0.62527746",
"0.61421937",
"0.6079142",
"0.6053957",
"0.6017173",
"0.6011714",
"0.5980676",
"0.59661746",
"0.59467256",
"0.5892879",
"0.5858775",
"0.584163",
"0.5826427",
"0.58017796",
"0.5760485",
"0.5741958",
"0.56936145",
"0.56328344",
"0.56234... | 0.89379823 | 0 |
Initialize the ParameterizedLikelihood by reading the specificed sacc_filename value. | def __init__(self, params: NamedParameters):
super().__init__()
self.sacc_filename = params.get_string("sacc_filename") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, initial_param_file, fasta_file):\n self.sequences = read_fasta_sequences_to_str(fasta_file)\n self.obs = observe_differences(self.sequences[0], self.sequences[1])\n self.theta = parse_params(initial_param_file)\n self.estimate = None\n self.likelihood = None\n ... | [
"0.6211385",
"0.5966141",
"0.5762728",
"0.5676559",
"0.5669715",
"0.5662447",
"0.55601126",
"0.5527512",
"0.5518656",
"0.54877645",
"0.5482554",
"0.5455407",
"0.54435134",
"0.5440038",
"0.54361457",
"0.54338324",
"0.54028064",
"0.5392907",
"0.5386685",
"0.53818727",
"0.537700... | 0.72975916 | 0 |
Return an empty RequiredParameters object. | def _required_parameters(self) -> RequiredParameters:
return RequiredParameters([]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_required_params():\n return {}",
"def get_empty_required_fields(self):\n empty_fields = self.get_empty_fields()\n return [f for f in empty_fields if f in self.REQUIRED_FIELDS]",
"def get_required_parameters(self) -> list:\n results = []\n if self.no_params or self.par... | [
"0.7562365",
"0.6865271",
"0.6684548",
"0.6580648",
"0.642038",
"0.6418872",
"0.63192177",
"0.6319068",
"0.6306489",
"0.6298723",
"0.623854",
"0.62329423",
"0.6214493",
"0.61800486",
"0.61040115",
"0.6102065",
"0.6099858",
"0.6063706",
"0.60514194",
"0.6025997",
"0.6002806",
... | 0.86397606 | 1 |
Return an empty DerivedParameterCollection. | def _get_derived_parameters(self) -> DerivedParameterCollection:
return DerivedParameterCollection([]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clear(self) -> None:\n super().clear()\n self._parameters = np.array([], dtype=object)",
"def get_parameters(self):\n self.unimpl_base_class()",
"def get_parameters(self):\n d = super().get_parameters()\n d.pop('population_size', None)\n return d",
"def empty_col... | [
"0.6081113",
"0.6039337",
"0.59705603",
"0.5954725",
"0.5876655",
"0.58154607",
"0.5792134",
"0.5731025",
"0.5725712",
"0.56782943",
"0.56777143",
"0.56163365",
"0.5595286",
"0.5563155",
"0.551771",
"0.55127925",
"0.54450375",
"0.5443118",
"0.5427724",
"0.5399277",
"0.5354234... | 0.84288347 | 0 |
Return a ParameterizedLikelihood object. | def parameterized_likelihood(params: NamedParameters):
return ParamaterizedLikelihood(params) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_likelihood(self, discretized=False, state=None):\n if not hasattr(self, 'softmax'):\n self.generate_softmax()\n\n if self.softmax is not None:\n if state is not None:\n return self.softmax.probability(class_=self.softmax_class_label,\n ... | [
"0.6216977",
"0.6201429",
"0.59271574",
"0.5916395",
"0.59147215",
"0.5894737",
"0.5885555",
"0.57895315",
"0.5743663",
"0.5680548",
"0.5580204",
"0.5562542",
"0.55499244",
"0.5537347",
"0.5528815",
"0.552764",
"0.55163604",
"0.549442",
"0.54925627",
"0.5490574",
"0.5468335",... | 0.75006866 | 0 |
Return an email Message object. This works like mboxutils.get_message, except it doesn't junk the headers if there's an error. Doing so would cause a headerless message to be written back out! | def get_message(obj):
if isinstance(obj, email.Message.Message):
return obj
if hasattr(obj, "read"):
obj = obj.read()
try:
msg = email.message_from_string(obj)
except email.Errors.MessageParseError:
msg = None
return msg | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pop_message(self):\n try:\n result = self.messages.get()\n except Queue.Empty:\n return None\n else:\n return Message(body=result.getBody(), subject=result.getBody(), sender=result.getFrom())",
"def get_message(self, **kwargs):\n message = Mail()\n... | [
"0.695734",
"0.6895103",
"0.6767101",
"0.6699613",
"0.6677977",
"0.65786904",
"0.6405224",
"0.63856715",
"0.637261",
"0.6364298",
"0.6361784",
"0.63502926",
"0.62194216",
"0.62027186",
"0.6197121",
"0.6094284",
"0.6087418",
"0.60842526",
"0.60625416",
"0.6039069",
"0.6022497"... | 0.7487364 | 0 |
Train bayes with all messages from a maildir. | def maildir_train(h, path, is_spam, force, removetrained):
if loud:
print(" Reading %s as Maildir" % (path,))
import time
import socket
pid = os.getpid()
host = socket.gethostname()
counter = 0
trained = 0
for fn in os.listdir(path):
cfn = os.path.join(path, fn)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mhdir_train(h, path, is_spam, force):\n if loud:\n print(\" Reading as MH mailbox\")\n import glob\n counter = 0\n trained = 0\n for fn in glob.glob(os.path.join(path, \"[0-9]*\")):\n counter += 1\n cfn = fn\n tfn = os.path.join(path, \"spambayes.tmp\")\n if l... | [
"0.6355704",
"0.59449077",
"0.58821434",
"0.57554334",
"0.5644402",
"0.56377137",
"0.563683",
"0.55812377",
"0.5577881",
"0.55669934",
"0.55518764",
"0.5542003",
"0.5526991",
"0.5500925",
"0.54829085",
"0.54665416",
"0.5462842",
"0.5462842",
"0.5462842",
"0.5462842",
"0.54628... | 0.6894524 | 0 |
Train bayes with a Unix mbox | def mbox_train(h, path, is_spam, force):
if loud:
print(" Reading as Unix mbox")
import mailbox
import fcntl
f = file(path, "r+b")
fcntl.flock(f, fcntl.LOCK_EX)
mbox = mailbox.PortableUnixMailbox(f, get_message)
outf = os.tmpfile()
counter = 0
trained = 0
for msg in mbox... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mhdir_train(h, path, is_spam, force):\n if loud:\n print(\" Reading as MH mailbox\")\n import glob\n counter = 0\n trained = 0\n for fn in glob.glob(os.path.join(path, \"[0-9]*\")):\n counter += 1\n cfn = fn\n tfn = os.path.join(path, \"spambayes.tmp\")\n if l... | [
"0.64364576",
"0.5568894",
"0.5551472",
"0.5536631",
"0.55087847",
"0.5448178",
"0.5402387",
"0.5222322",
"0.5197107",
"0.5109843",
"0.5092976",
"0.5084856",
"0.5042653",
"0.49968976",
"0.49160054",
"0.48901597",
"0.48886093",
"0.48782876",
"0.48486832",
"0.4847762",
"0.48258... | 0.7277786 | 0 |
Train bayes with an mh directory | def mhdir_train(h, path, is_spam, force):
if loud:
print(" Reading as MH mailbox")
import glob
counter = 0
trained = 0
for fn in glob.glob(os.path.join(path, "[0-9]*")):
counter += 1
cfn = fn
tfn = os.path.join(path, "spambayes.tmp")
if loud and counter % 10 ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def train(self, trainfile):",
"def maildir_train(h, path, is_spam, force, removetrained):\n if loud:\n print(\" Reading %s as Maildir\" % (path,))\n import time\n import socket\n pid = os.getpid()\n host = socket.gethostname()\n counter = 0\n trained = 0\n for fn in os.listdir(pat... | [
"0.6380039",
"0.6258465",
"0.61761475",
"0.61341226",
"0.61309236",
"0.6125414",
"0.5975877",
"0.5948309",
"0.593305",
"0.593305",
"0.593305",
"0.593305",
"0.593305",
"0.59213877",
"0.59187734",
"0.59036076",
"0.5867951",
"0.5858581",
"0.5823942",
"0.5820531",
"0.5797346",
... | 0.6462255 | 0 |
Runt 1x de pool, dus alle combinaties van teams worden gespeeld. Na 1x spelen van de pool komt er een huidige score uit met welke teams welke punten hebben. | def run_one_pool(curr_pool, goals=False):
curr_score = {
"Ajax": 0,
"Feyenoord": 0,
"PSV": 0,
"FC Utrecht": 0,
"Willem II": 0
}
for match in curr_pool:
if curr_pool[match]:
teamvsteam, chance = match, curr_pool[match]
if not goals:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scoreTeams(curTeams, oppTeam, pokedex, league, minDistWanted):\n battleData, htmlData = loadBattleData(league)\n similarities = loadSims() \n \n #If not given an opponent team then simply randomly choose losers from the dataset to compare to.\n if len(oppTeam) == 0:\n picks = set([])\n ... | [
"0.6253384",
"0.6129651",
"0.6121192",
"0.58671147",
"0.56712914",
"0.56542623",
"0.5605723",
"0.55911577",
"0.5516436",
"0.5502499",
"0.5497719",
"0.5487439",
"0.5475032",
"0.5417539",
"0.5398502",
"0.53883797",
"0.5378638",
"0.53657436",
"0.5356736",
"0.53533053",
"0.531976... | 0.6507316 | 0 |
Het draaien van de monte carlo machine speelt gewoon heel veel pools (de hoeveelheid runs). Na het spelen van een pool wordt de ranking van die partij toegevoegd aan de totale ranking. Als bijvoorbeeld ajax 10x eerste wordt, dan staat die 10x in de lijst van total_ranking[1] | def run_monte_carlo(runs, pool, goals=False):
total_ranking = {
1: [],
2: [],
3: [],
4: [],
5: []
}
for run in range(runs):
if goals:
curr_score = run_one_pool(pool, True)
else:
curr_score = run_one_pool(pool)
total_rank... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mlbpowerrankings(self, irc, msg, args):\n \n url = self._b64decode('aHR0cDovL2VzcG4uZ28uY29tL21sYi9wb3dlcnJhbmtpbmdz')\n\n try:\n req = urllib2.Request(url)\n html = (urllib2.urlopen(req)).read()\n except:\n irc.reply(\"Failed to fetch: %s\" % url)\n... | [
"0.6204498",
"0.6093356",
"0.5933787",
"0.58172834",
"0.57272923",
"0.5666633",
"0.5657551",
"0.5655824",
"0.5565564",
"0.55135745",
"0.54635066",
"0.5455027",
"0.5450292",
"0.54313564",
"0.5428389",
"0.54252523",
"0.5423509",
"0.54218894",
"0.5421884",
"0.5414211",
"0.541161... | 0.6112421 | 1 |
compute truncate_div calculating data's truncate_div, res = floor(x / y) if x/y>0 else ceil(x/y) | def truncate_div_compute(input_x, input_y, output_x,
kernel_name="truncate_div"):
shape_list = broadcast_shapes(
te.lang.cce.util.shape_to_list(input_x.shape),
te.lang.cce.util.shape_to_list(input_y.shape),
param_name_input1="input_x", param_name_input2="input_y")
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def trunc_divide(lhs, rhs):\n return _make.trunc_divide(lhs, rhs)",
"def ceildiv(a, b):\n return - (-a // b)",
"def floor_div(a, b):\r\n # see decorator for function body\r",
"def division(x, y, val = 0.0):\n if y != 0.0:\n val = float(x)/y\n return val",
"def ceil_division(left_numbe... | [
"0.72226495",
"0.6773521",
"0.67653507",
"0.65383255",
"0.6387221",
"0.63650364",
"0.63168216",
"0.63073",
"0.62371224",
"0.61715484",
"0.6150904",
"0.61437595",
"0.6043365",
"0.6009371",
"0.6003909",
"0.598048",
"0.597958",
"0.5978322",
"0.5967595",
"0.5960188",
"0.5945854",... | 0.73679143 | 0 |
Test alert policies .create() calls put with correct parameters | def test_create_success(self, mock_post):
self.policies.create(
name=self.policy_single_response['policy']['name'],
incident_preference=self.policy_single_response['policy']['incident_preference']
)
mock_post.assert_called_once_with(
url='https://api.newrelic... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_update(self, mock_put):\n self.policies.update(id=333114, policy_update=self.policy_show_response)\n\n mock_put.assert_called_once_with(\n url='https://api.newrelic.com/v2/alert_policies/333114.json',\n headers=self.policies.headers,\n data=json.dumps(self.po... | [
"0.68285656",
"0.6772421",
"0.67621154",
"0.64469576",
"0.6395389",
"0.63586205",
"0.6352661",
"0.6176362",
"0.60673046",
"0.6066516",
"0.60473686",
"0.60405195",
"0.59732294",
"0.5936393",
"0.59167117",
"0.5909094",
"0.5891978",
"0.58826816",
"0.5856741",
"0.58251625",
"0.58... | 0.67850477 | 1 |
Test alert policies .update() calls put with correct parameters | def test_update_success(self, mock_put):
self.policies.update(
id=self.policy_single_response['policy']['id'],
name=self.policy_single_response['policy']['name'],
incident_preference=self.policy_single_response['policy']['incident_preference']
)
mock_put.asse... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_update(self, mock_put):\n self.policies.update(id=333114, policy_update=self.policy_show_response)\n\n mock_put.assert_called_once_with(\n url='https://api.newrelic.com/v2/alert_policies/333114.json',\n headers=self.policies.headers,\n data=json.dumps(self.po... | [
"0.79217553",
"0.71475583",
"0.709934",
"0.6928383",
"0.6687903",
"0.66773266",
"0.6663834",
"0.6655021",
"0.66526735",
"0.65455186",
"0.6470367",
"0.6439922",
"0.6429988",
"0.6426166",
"0.641693",
"0.63938844",
"0.63904506",
"0.6387737",
"0.63814616",
"0.6356233",
"0.6352678... | 0.77502126 | 1 |
Test alert policies .delete() success | def test_delete_success(self, mock_delete):
self.policies.delete(id=self.policy_single_response['policy']['id'])
mock_delete.assert_called_once_with(
url='https://api.newrelic.com/v2/alerts_policies/{0}.json'.format(
self.policy_single_response['policy']['id']
)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_delete_alert_by_id(self):\n pass",
"def test_delete_success_alert():\n app = HelperApp(server.message_app)\n app.post('/login/', {'username': 'jessie', 'password': 'frog'})\n\n # Add a an message\n app.post('/compose/', {'to': 'james', 'subject': 's', 'body': 'S'})\n app.get('/') ... | [
"0.7788935",
"0.74828786",
"0.7098903",
"0.70895654",
"0.70789915",
"0.7048444",
"0.7027411",
"0.69928205",
"0.69801384",
"0.6939634",
"0.6917779",
"0.69133645",
"0.69022495",
"0.6870939",
"0.68659055",
"0.68542594",
"0.68441856",
"0.6840614",
"0.67858964",
"0.67836225",
"0.6... | 0.7756372 | 1 |
Test alert policies .associate_with_notification_channel() calls put with correct parameters | def test_associate_with_notification_channel_success(self, mock_put):
self.policies.associate_with_notification_channel(
id=self.policy_single_response['policy']['id'],
channel_id=self.channel_single_response['channel']['id'],
)
mock_put.assert_called_once_with(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_dissociate_from_notification_channel(self, mock_put):\n self.policies.associate_with_notification_channel(\n id=self.policy_single_response['policy']['id'],\n channel_id=self.channel_single_response['channel']['id'],\n )\n\n mock_put.assert_called_once_with(\n ... | [
"0.73635596",
"0.6459767",
"0.60581565",
"0.6028323",
"0.60136247",
"0.57947695",
"0.5774505",
"0.57623434",
"0.5741606",
"0.57012004",
"0.5592528",
"0.5584041",
"0.55792534",
"0.5516984",
"0.55149835",
"0.54886246",
"0.5476943",
"0.5455049",
"0.5427881",
"0.53757334",
"0.534... | 0.7614871 | 0 |
Test alert policies .associate_with_notification_channel() calls put with correct parameters | def test_dissociate_from_notification_channel(self, mock_put):
self.policies.associate_with_notification_channel(
id=self.policy_single_response['policy']['id'],
channel_id=self.channel_single_response['channel']['id'],
)
mock_put.assert_called_once_with(
url... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_associate_with_notification_channel_success(self, mock_put):\n self.policies.associate_with_notification_channel(\n id=self.policy_single_response['policy']['id'],\n channel_id=self.channel_single_response['channel']['id'],\n )\n\n mock_put.assert_called_once_wit... | [
"0.7613531",
"0.64621556",
"0.6059576",
"0.60289395",
"0.6013516",
"0.57984847",
"0.57735455",
"0.57597476",
"0.5742299",
"0.570157",
"0.5592619",
"0.55849236",
"0.5579137",
"0.55171704",
"0.5513387",
"0.54899305",
"0.54773784",
"0.5452856",
"0.54276377",
"0.5375686",
"0.5347... | 0.7362509 | 1 |
Add a contact representing a publication coauthored by the ego to the ego network. | def add_publication(self, pub_id: int, timestamp: int, title: str, coauthors: List[str], contact_type="__all__"):
if self.min_pub_date is None or timestamp >= self.min_pub_date:
# standardize names, remove possible duplicates and wrong names, and remove ego if present
std_coauth_names = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def AddContact(self, contact):\n\t\tcontact.group_membership_info = [gdata.contacts.data.GroupMembershipInfo(href=self.GetFirstGroupId())]\n\t\ttry:\n\t\t\tself.client.CreateContact(contact)\n\t\texcept gdata.client.RequestError:\n\t\t\tpass",
"def add_contact(self, contact):\n\t\tclient_log.debug(f'Создание кон... | [
"0.64493227",
"0.6373825",
"0.62784225",
"0.6231083",
"0.60652024",
"0.59836507",
"0.59490603",
"0.579805",
"0.5783082",
"0.5768027",
"0.5641641",
"0.5640455",
"0.56229985",
"0.56229985",
"0.5609489",
"0.55984056",
"0.54995424",
"0.54777515",
"0.5452757",
"0.5432362",
"0.5429... | 0.6801305 | 0 |
Reset the function call count to zero. | def reset_count(self):
self.count = 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset_counter(self) -> None:",
"def reset_calls(self) -> None:\n self.logger.info(\"Reset calls\")\n\n self._has_bob = False\n self._has_single = False",
"def reset (self):\n self.counter = 0",
"def reset(self):\n self.counter = 0",
"def reset(self):\n # self.c... | [
"0.7342854",
"0.7133632",
"0.7101041",
"0.7076571",
"0.6986588",
"0.6887243",
"0.68343556",
"0.6833832",
"0.6802058",
"0.6802058",
"0.68014395",
"0.68014395",
"0.68014395",
"0.6790398",
"0.67423177",
"0.6730629",
"0.6721631",
"0.6674541",
"0.6674541",
"0.6674541",
"0.6646674"... | 0.7426931 | 0 |
Test the average execution time of a given function. | def time_function(function, runs=1, average=min):
results = [None] * runs
for i in range(runs):
t0 = time.perf_counter()
function()
t1 = time.perf_counter()
results[i] = t1 - t0
return average(results) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculateRunTime(function, *args):\n startTime = time.time()\n result = function(*args)\n return time.time() - startTime, result",
"def execution_time(function: Callable, args=tuple(), kwargs=dict()):\n start_time = time.time()\n function(*args, **kwargs)\n end_time = time.time()\n retur... | [
"0.72246695",
"0.7189616",
"0.69638824",
"0.69256145",
"0.68879926",
"0.6848878",
"0.6752755",
"0.6739705",
"0.67355597",
"0.6723226",
"0.67124665",
"0.6660492",
"0.66482943",
"0.6646599",
"0.66432923",
"0.66369736",
"0.66163874",
"0.6569194",
"0.6540607",
"0.6531069",
"0.652... | 0.73044527 | 0 |
Query if a value is in an array via iterative linear search. | def linear_search_iterative(array, value):
for elt in array:
if compare(elt, value) == 0:
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def linear_search_foundornot(arr: IntList, query: int) -> bool:\n position: int = 0\n found: bool = False\n while position < len(arr) and not found:\n if arr[position] == query:\n found = True\n position += 1\n return found",
"def linear_search_recursive(array, value):\n #... | [
"0.7187239",
"0.7014195",
"0.68994564",
"0.68296456",
"0.6682872",
"0.65983593",
"0.6571656",
"0.65281767",
"0.6450205",
"0.6415358",
"0.6367779",
"0.6351479",
"0.6338945",
"0.6338945",
"0.6338945",
"0.6338945",
"0.63235927",
"0.6252645",
"0.6220145",
"0.6189393",
"0.6184134"... | 0.7844321 | 0 |
Query if a value is in an array via recursive linear search. | def linear_search_recursive(array, value):
# Base case for empty list
n = len(array)
if n == 0:
return False
# Recursive case
if compare(array[0], value) == 0:
return True
else:
return linear_search_recursive(array[1:], value) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def binary_search_recursive(array, value):\n # Base cases for empty or singular list\n n = len(array)\n if n == 0:\n return False\n elif n == 1:\n return compare(array[0], value) == 0\n\n # Recursive case\n middle = n // 2\n if compare(array[middle], value) == 0:\n return ... | [
"0.69967544",
"0.69195235",
"0.6862056",
"0.67465794",
"0.65924174",
"0.65537065",
"0.64034545",
"0.6274502",
"0.6266495",
"0.62526584",
"0.6248882",
"0.6248882",
"0.6248882",
"0.6248882",
"0.6202555",
"0.6176431",
"0.6166238",
"0.6148709",
"0.60954624",
"0.6085641",
"0.60850... | 0.7844012 | 0 |
Query if a value is in an array via recursive binary search. | def binary_search_recursive(array, value):
# Base cases for empty or singular list
n = len(array)
if n == 0:
return False
elif n == 1:
return compare(array[0], value) == 0
# Recursive case
middle = n // 2
if compare(array[middle], value) == 0:
return True
elif co... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def linear_search_recursive(array, value):\n # Base case for empty list\n n = len(array)\n if n == 0:\n return False\n\n # Recursive case\n if compare(array[0], value) == 0:\n return True\n else:\n return linear_search_recursive(array[1:], value)",
"def Search(array, value)... | [
"0.75950164",
"0.72089994",
"0.6862112",
"0.6780811",
"0.6759658",
"0.6693581",
"0.6673692",
"0.6622626",
"0.6622626",
"0.6622626",
"0.66219646",
"0.66128653",
"0.65874904",
"0.65533173",
"0.65308404",
"0.6481852",
"0.6433637",
"0.64171046",
"0.64025944",
"0.63988364",
"0.629... | 0.7462939 | 1 |
Sort a list via hybrid recursive (topdown) mergesort. Delegates to insertion sort when n is less than or equal to some threshold. | def mergesort_recursive_hybrid(array, threshold=37):
# Base case delegates to insertion sort
n = len(array)
if n <= threshold:
return insertion_sort(array)
# Recur on two halves of array and merge results
mid = n // 2
return merge(
mergesort_recursive(array[:mid]),
merge... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def merge_sort(L):\n n = len(L)\n if n < 2:\n return L\n mid = n // 2\n left = L[:mid]\n right = L[mid:]\n merge_sort(left)\n merge_sort(right)\n merge(L, left, right)",
"def merge_sort(unsorted, threshold, reverse):\r\n length = len(unsorted)\r\n if length < 2:\r\n re... | [
"0.7029845",
"0.696164",
"0.68413234",
"0.68319064",
"0.6830567",
"0.6794161",
"0.6786466",
"0.6744685",
"0.66700613",
"0.66018665",
"0.65889466",
"0.6586275",
"0.6528771",
"0.65160424",
"0.65155774",
"0.6514788",
"0.650817",
"0.65026766",
"0.6501337",
"0.6469715",
"0.6448953... | 0.7173727 | 0 |
Sort a list via hybrid iterative (bottomup) mergesort. Delegates to insertion sort when n is less than or equal to some threshold. | def mergesort_iterative_hybrid(array, threshold=37):
n = len(array)
result = array.copy()
# Initial insertion sort pass
for i in range(0, n, threshold):
result[i:i+threshold] = insertion_sort(result[i:i+threshold])
# Merge runs of length threshold, 2*threshold, ...
length = threshold
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mergesort_recursive_hybrid(array, threshold=37):\n # Base case delegates to insertion sort\n n = len(array)\n if n <= threshold:\n return insertion_sort(array)\n\n # Recur on two halves of array and merge results\n mid = n // 2\n return merge(\n mergesort_recursive(array[:mid]),... | [
"0.7101632",
"0.6605162",
"0.6547044",
"0.6530211",
"0.6487875",
"0.64746773",
"0.64605856",
"0.64375854",
"0.64229447",
"0.6305018",
"0.62946403",
"0.6249969",
"0.62481827",
"0.62260824",
"0.621573",
"0.6202988",
"0.61955655",
"0.61911744",
"0.61827713",
"0.6164877",
"0.6157... | 0.70031637 | 1 |
Siftup the last node (end1) in the given max heap. | def sift_up(heap, start, end):
# Swap last node with parents until no longer greater.
i = end - 1
heaped = False
while i > start and not heaped:
parent = (i - 1) // 2
if compare(heap[i], heap[parent]) > 0:
heap[i], heap[parent] = heap[parent], heap[i]
i = parent
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sift_down(heap, start, end):\n # Swap first node with children until no longer smaller.\n i = start\n heaped = False\n while not heaped:\n left = i * 2 + 1\n right = i * 2 + 2\n largest = i\n\n # Find largest of i, left and right\n if left < end and compare(heap[l... | [
"0.71801686",
"0.7001086",
"0.6813224",
"0.65404683",
"0.6508815",
"0.6496566",
"0.6474151",
"0.63565713",
"0.63440263",
"0.6343961",
"0.6335834",
"0.63289756",
"0.63112545",
"0.6272625",
"0.62513417",
"0.6242469",
"0.6241716",
"0.61991626",
"0.6170931",
"0.6164732",
"0.61421... | 0.73906344 | 0 |
Shuffle a list by recursively pileshuffling each pile. | def recursive_pile_shuffle(array, n):
# Base case for empty or singular list
if len(array) < 2:
return array
# Pile-shuffle and recur on each of n piles
piles = [array[i::n] for i in reversed(range(n))]
result = []
for pile in piles:
result += recursive_pile_shuffle(pile, n)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shuffle_list(self, tour_list, pop_size):\n x = np.array(tour_list)\n while len(self.pop_group) < self.shuffle_population:\n y = np.random.permutation(x)\n if not any((y == x).all() for x in self.pop_group):\n self.pop_group.append(y.tolist())",
"def shuffle_... | [
"0.680971",
"0.6636288",
"0.6632501",
"0.66021633",
"0.6471498",
"0.64384234",
"0.64200294",
"0.632114",
"0.630535",
"0.62996954",
"0.62684",
"0.61987203",
"0.6188611",
"0.61510146",
"0.6112788",
"0.6100381",
"0.6089439",
"0.60330445",
"0.60330445",
"0.60076684",
"0.5993398",... | 0.7225837 | 0 |
OAuth2 compatible token login, get an access token for future requests | async def login_access_token(
form_data: OAuth2PasswordRequestForm = Depends()
):
user = await crud.user.authenticate(
username=form_data.username, password=form_data.password
)
if not user:
raise HTTPException(status_code=HTTP_404_NOT_FOUND, detail="Incorrect credentials")
elif ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def login_access_token(form_data: OAuth2PasswordRequestForm = Depends()):\n user = auth_handler.authenticate_user(\n username=form_data.username, password=form_data.password\n )\n if user is None:\n raise HTTPException(\n detail=\"Incorrect username and/or password\", status_code=... | [
"0.7499437",
"0.7365008",
"0.7298682",
"0.72800106",
"0.72585416",
"0.7221305",
"0.71564126",
"0.7155743",
"0.71516013",
"0.7135813",
"0.70970845",
"0.70884335",
"0.705156",
"0.7044395",
"0.70353854",
"0.7016695",
"0.70149344",
"0.7002961",
"0.70015967",
"0.69658285",
"0.6939... | 0.74189544 | 1 |
Verify account using token. | async def verify_account(
token: str = Form(...)
):
email = await verify_register_token(token)
if not email:
raise HTTPException(status_code=400, detail="Invalid email verify token")
record = await crud.user.get_by_email(email)
if not record:
raise HTTPException(
stat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def verify(token: TextData, background_tasks: BackgroundTasks):\n token_data = token.data\n mail, subject, body = await AccountProcessor.confirm_email(token_data)\n background_tasks.add_task(Utility.validate_and_send_mail, email=mail, subject=subject, body=body)\n return {\"message\": \"Account V... | [
"0.73761034",
"0.71671677",
"0.7066079",
"0.6981067",
"0.6979663",
"0.68349594",
"0.68256533",
"0.6713865",
"0.67072505",
"0.6704424",
"0.6683784",
"0.66674215",
"0.6619582",
"0.66139793",
"0.65695435",
"0.65394056",
"0.6536171",
"0.6521967",
"0.6393953",
"0.6376964",
"0.6354... | 0.7953528 | 0 |
Returns the number of frames in the trajectory in universe u, using teq as equilibration time and tsample as sampling time | def traj_nslice (u,teq,tsample) :
# get the number of frames in the slice (http://stackoverflow.com/a/7223557)
traj_slice = u.trajectory[teq::tsample]
return sum(1 for _ in traj_slice) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def num_tracked_samples(self, u=None):\n u = self.virtual_root if u is None else u\n return self._ll_tree.get_num_tracked_samples(u)",
"def frameTimes(self):\n sr = self.sampleRate\n offset = self.activeOffset\n stride = self.activeStride\n nf = self.numFrames\n t... | [
"0.5920934",
"0.5774861",
"0.5752458",
"0.54901206",
"0.5386585",
"0.53777325",
"0.53337634",
"0.53329504",
"0.52839094",
"0.52773035",
"0.5194862",
"0.51744634",
"0.5169164",
"0.51685876",
"0.51301676",
"0.51198584",
"0.5106076",
"0.51057935",
"0.50803345",
"0.50795835",
"0.... | 0.69339037 | 1 |
Calculate the Pearson correlation coefficient between the row sum of the given HiC matrix and the given ChIPseq profile. | def hic_chipseq_r2 (hic, chipseq) :
hic_rowsum = np.sum(hic,axis=1)/float(np.sum(hic))
return np.corrcoef(hic_rowsum,chipseq)[0,1]**2 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _pearsons_contingency_coefficient_compute(confmat: Tensor) ->Tensor:\n confmat = _drop_empty_rows_and_cols(confmat)\n cm_sum = confmat.sum()\n chi_squared = _compute_chi_squared(confmat, bias_correction=False)\n phi_squared = chi_squared / cm_sum\n tschuprows_t_value = torch.sqrt(phi_squared / (... | [
"0.65713036",
"0.60864913",
"0.6080404",
"0.6041075",
"0.5945653",
"0.5941",
"0.5863057",
"0.57821524",
"0.5782027",
"0.5723004",
"0.5652084",
"0.5646357",
"0.5644976",
"0.56440914",
"0.5639138",
"0.5633804",
"0.56248856",
"0.5624098",
"0.5592133",
"0.5590622",
"0.5569893",
... | 0.62098205 | 1 |
Calculate the relative proportion of contacts of the tracers with binding sites compared with nonbinding sites. As usual user should supply equilibration time, sampling time, and contact threshold value. | def contacts_with (sim,polymer_text,tracers_text,bindingsites_text,teq,tsample,threshold) :
# select polymer, tracers, and binding sites
polymer = sim.u.select_atoms (polymer_text)
tracers = sim.u.select_atoms (tracers_text)
bss = sim.u.select_atoms (bindingsites_text)
# select binding site indices
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def contact_probability(summary, results, contacts, bins, feature):\r\n\r\n # prepare sampling interval size\r\n bin_width = bins[2]\r\n n_bins = int(np.ceil(bins[1]/bin_width))\r\n # bin bounds\r\n end_bins = np.arange(bin_width,bin_width*(n_bins+1), bin_width)\r\n # prepare arrays\r\n # two ... | [
"0.596737",
"0.547867",
"0.54080415",
"0.5299857",
"0.5124064",
"0.5097309",
"0.5068922",
"0.50371313",
"0.5016846",
"0.4988263",
"0.4936729",
"0.49304453",
"0.49304453",
"0.48953757",
"0.48854768",
"0.4878589",
"0.4844149",
"0.48417434",
"0.48266906",
"0.48197976",
"0.480789... | 0.6338657 | 0 |
Perform a simple fit of the supplied timedependent MSD, using a linear regression of the logarithms of the values. User must supply the conversion factor from time to real time and from length to real length. Also, user | def fit_msd (msd,cutoff,delta_t,scale_l) :
# prepare the values to fit: exclude the first value because it is zero
t = np.arange(msd.size)*delta_t
x = np.log(t[cutoff:])
y = np.log(msd[cutoff:]*scale_l**2)
# perform fit to y = ax + b with their errors
b,a,db,da = mbt.linear_regression (x,y,0.99)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fit_model(train_ts_dis, data, init_prior = [.5,.5], bias = True, mode = \"biasmodel\"):\r\n if mode == \"biasmodel\":\r\n #Fitting Functions\r\n def bias_fitfunc(rp, tsb, df):\r\n init_prior = [.5,.5]\r\n model = BiasPredModel(train_ts_dis, init_prior, ts_bias = tsb, recu... | [
"0.6344083",
"0.59664893",
"0.5950108",
"0.58820957",
"0.57336086",
"0.5699005",
"0.56805956",
"0.5650658",
"0.5647881",
"0.5618573",
"0.5590892",
"0.55860865",
"0.5570882",
"0.556389",
"0.5562849",
"0.55571467",
"0.55424637",
"0.547708",
"0.5467977",
"0.54346925",
"0.5430097... | 0.668302 | 0 |
Calculate the mean square displacement of the particles defined by 'particles_text' in simulation sim, using sampling tsample and equilibration time teq. Returns the matrix corresponding to the mean square displacement of each particle, along with a matrix corresponding to the variance in the estimate of this quantity. | def msd_t (sim,particles_text,teq,tsample) :
u = sim.u
particles = u.select_atoms (particles_text)
nparticles = particles.n_atoms
nslice = traj_nslice (u,teq,tsample)
# initialize the matrix containing all the positions
# of the particles at all the sampling frames
particles_pos = np.zeros (... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def msd_t(sim,particles_text,teq,tsample) :\n u = sim.u\n particles = u.select_atoms(particles_text)\n nparticles = particles.n_atoms\n nslice = traj_nslice (u,teq,tsample)\n # initialize the matrix containing all the positions\n # of the particles at all the sampling frames\n particles_pos = ... | [
"0.7488713",
"0.5663224",
"0.5223949",
"0.51519114",
"0.5096424",
"0.5066858",
"0.5066858",
"0.5045784",
"0.5026792",
"0.50021636",
"0.50003314",
"0.49920407",
"0.49362248",
"0.4934721",
"0.4924958",
"0.49151853",
"0.4903255",
"0.48586112",
"0.48389977",
"0.4803725",
"0.47902... | 0.7475914 | 1 |
Calculate the minimum distance between the atoms defined in sel1 and the atoms defined in sel2, as a function of time. Returns a matrix that contains the minimum distance for each atom defined in sel1. As usual user should supply equilibration time, sampling time, and contact threshold value. | def dmin_sel (sim,sel1_text,sel2_text,teq,tsample) :
# define atom selections
sel1 = sim.u.select_atoms (sel1_text)
sel2 = sim.u.select_atoms (sel2_text)
# get number of atoms in selection 1
natoms = sel1.n_atoms
nslice = traj_nslice (sim.u,teq,tsample)
dmin = np.zeros((natoms,nslice))
f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def minimum_subset_distance(D, limits1, limits2):\n score = numpy.ones( (limits1[1]) )\n for i in xrange(limits1[1]):\n for j in xrange(limits2[1]-limits2[0]):\n score[i] = min(score[i], D[i,j+limits2[0]-1])\n #print i, j, D[i,j+limits2[0]-1], score[i], min(score[i], D[i,j+limits... | [
"0.5895745",
"0.5762979",
"0.57414365",
"0.5732029",
"0.54276377",
"0.5345767",
"0.5334685",
"0.5314768",
"0.5237118",
"0.51300615",
"0.51152414",
"0.50853014",
"0.5079385",
"0.50745434",
"0.5033808",
"0.50107294",
"0.5001764",
"0.49995542",
"0.4967053",
"0.49510542",
"0.4891... | 0.76610744 | 0 |
Get the image index of all particles in simulation, at the frame 'frame_id' | def particle_images (sim,frame_id) :
# get positions of all particles: define first the atom selection, then jump to
# the user-requested trajectory frame, get the box dimensions (currently works
# only for orthorhombic boxes, then calculate the image indices
atoms = sim.u.select_atoms ('all')
ts = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def image_id_at(self, i):\n return i",
"def _get_frame_index(self, frame):\n if isinstance(frame, cf.CoordinateFrame):\n frame = frame.name\n #frame_names = [getattr(item[0], \"name\", item[0]) for item in self._pipeline]\n frame_names = [step.frame if isinstance(step.frame... | [
"0.64790046",
"0.6461773",
"0.63308996",
"0.60192746",
"0.5952561",
"0.5895804",
"0.58919054",
"0.5886345",
"0.5864442",
"0.5850456",
"0.58418465",
"0.5816864",
"0.57517457",
"0.57352793",
"0.5733944",
"0.5714067",
"0.56858724",
"0.5682771",
"0.5660249",
"0.5656632",
"0.56062... | 0.82224417 | 0 |
For the simulation 'sim', calculate the matrix of binding events of the polymer and the tracers. Returns a contacts matrix of the shape (ntracers,nslice,npolymer). | def contacts_t (sim,polymer_text,tracer_text,teq,tsample,threshold) :
u = sim.u
polymer = u.select_atoms (polymer_text)
tracers = u.select_atoms (tracer_text)
ntracers = tracers.n_atoms
npolymer = polymer.n_atoms
nslice = mbt.traj_nslice(u,teq,tsample)
C = np.zeros((ntracers,nslice,npolymer)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def contacts_with (sim,polymer_text,tracers_text,bindingsites_text,teq,tsample,threshold) :\n # select polymer, tracers, and binding sites\n polymer = sim.u.select_atoms (polymer_text)\n tracers = sim.u.select_atoms (tracers_text)\n bss = sim.u.select_atoms (bindingsites_text)\n # select binding sit... | [
"0.64249676",
"0.56675434",
"0.5327914",
"0.5293578",
"0.5202153",
"0.5148195",
"0.51123756",
"0.504556",
"0.5030026",
"0.50254846",
"0.49442828",
"0.48849455",
"0.48715222",
"0.47897685",
"0.47662282",
"0.472734",
"0.47106746",
"0.47045848",
"0.46944386",
"0.46944386",
"0.46... | 0.58174694 | 1 |
Calculate the matrix of average intrapolymer distances. User must supply the parameters teq, tsample and threshold. | def distance_matrix (sim,polymer_text,teq,tsample,threshold=2.5) :
u = sim.u
polymer = u.select_atoms (polymer_text)
N = polymer.n_atoms
nslice = mbt.traj_nslice (u,teq,tsample)
d = np.zeros((N,N))
for i,ts in enumerate(u.trajectory[teq::tsample]) :
this_d = distance_array(polymer.positi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calc_qavg(self, TRANGE = []):\n #put some variables in this namespace\n nebins=self.nebins\n nqbins=self.nqbins\n binenergy=self.binenergy\n binq=self.binq\n visits2d=self.visits2d\n logn_Eq=self.logn_Eq\n \n if len(TRANGE) == 0:\n NTEMP = 1... | [
"0.5694141",
"0.5119244",
"0.5017542",
"0.49339455",
"0.49261585",
"0.48504174",
"0.4848955",
"0.48481247",
"0.48393378",
"0.4766152",
"0.47565967",
"0.47392762",
"0.4727343",
"0.47033104",
"0.46980202",
"0.46610996",
"0.46503145",
"0.4611686",
"0.46015757",
"0.45886338",
"0.... | 0.66201276 | 0 |
This function does the complete analysis of the tracers in the simulation. It calculates the virtual HiC, virtual ChIPseq, KullbackLeibler divergence between the two profiles as a function of time, and coverage of the tracers. | def tracers_analysis (sim,polymer_text,tracer_text,teq,tsample,t_threshold,p_threshold) :
# define DKL(t) vector
nframes = traj_nslice(sim.u,teq,tsample)
DKL_t = np.zeros(nframes)
# define polymer and tracers
polymer = sim.u.select_atoms(polymer_text)
tracers = sim.u.select_atoms(tracer_text)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tracers_analysis (sim,polymer_text,tracer_text,teq,tsample,t_threshold,p_threshold) :\n # define DKL(t) vector\n nframes = traj_nslice(sim.u,teq,tsample)\n DKL_t = np.zeros(nframes)\n # define polymer and tracers\n polymer = sim.u.select_atoms(polymer_text)\n tracers = sim.u.select_atoms(trac... | [
"0.63561374",
"0.5775331",
"0.5715415",
"0.5611014",
"0.5607633",
"0.55742955",
"0.54829526",
"0.5457336",
"0.54125506",
"0.5397806",
"0.5258343",
"0.5246536",
"0.52320576",
"0.5230727",
"0.5224489",
"0.5222911",
"0.52141297",
"0.52132136",
"0.52128506",
"0.52064836",
"0.5187... | 0.6349215 | 1 |
Initalize name and age attibutes. | def __init__(self, name, age):
self.name = name
self.age = age | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, first_name, last_name, age):\n self.first_name = first_name\n self.last_name = last_name\n self.age = age",
"def __init__(self, first_name, last_name, age):\n self.first_name = first_name\n self.last_name = last_name\n self.age = age",
"def __init__(... | [
"0.74732316",
"0.74732316",
"0.74732316",
"0.74732316",
"0.74732316",
"0.74732316",
"0.74732316",
"0.74732316",
"0.7472384",
"0.736729",
"0.7351724",
"0.7351724",
"0.7351724",
"0.7351724",
"0.72921795",
"0.7189177",
"0.7124933",
"0.711583",
"0.6997387",
"0.6881059",
"0.686831... | 0.75609356 | 1 |
Get the shape of an element x. If it is an element with a shape attribute, return it. If it is a list with more than one element, compute the shape by checking the len, and the shape of internal elements. In that case, the shape must be consistent. Finally, in other case return () as shape. | def get_shape(x):
if isinstance(x, list) and len(x) > 0:
shapes = [get_shape(subx) for subx in x]
if any([s != shapes[0] for s in shapes[1:]]):
raise ValueError('Parameter dimension not consistent: {}'.format(x))
return (len(x), ) + shapes[0]
else:
if hasattr(x, '_sha... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_shape(x):\n\n return None if jnp.isscalar(x) else x.shape",
"def shape(self):\n for component in ('x', 'y', 'z', 'r', 't'):\n arr = getattr(self, component)\n if arr is not None:\n return arr.shape\n return ()",
"def shape(self) -> Optional[tuple]:\... | [
"0.7307297",
"0.71993625",
"0.69666064",
"0.6919222",
"0.6845282",
"0.68373024",
"0.6807176",
"0.6639613",
"0.6614478",
"0.65794605",
"0.65702397",
"0.6511562",
"0.6511562",
"0.64650935",
"0.64642006",
"0.64271873",
"0.6416693",
"0.6414622",
"0.6394792",
"0.637807",
"0.637807... | 0.824383 | 0 |
Get the signatures results of the teacher in the given career for all the active exams. | def get_teacher_career_results(self, teacher, career):
data = []
# Get the active exams of the career.
exams = EvaluationsExam.objects.filter(
type__exact=career.type, status="ACTIVE")
# Get the results for each exam.
for exam in exams:
# Get the signat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def career_teachers_excel(self, request):\n\n # Get the career to be processed their results.\n career_id = request.GET.get('career_id', '')\n career = EvaluationsCareer.objects.get(pk__exact=career_id)\n\n # Get the results for each esignature of the carrer en each exam.\n data ... | [
"0.59553725",
"0.5373946",
"0.5306007",
"0.5172902",
"0.5093456",
"0.4992784",
"0.49038228",
"0.49021885",
"0.48847973",
"0.48658186",
"0.4847523",
"0.4831599",
"0.48291838",
"0.4825473",
"0.47478107",
"0.4725367",
"0.47177714",
"0.4660074",
"0.46355888",
"0.46003297",
"0.459... | 0.7810591 | 0 |
Gets the count for the current tab and the count for the conversations in all 4 tabs | def get_all_conversation_type_counts(survey_id, conversation_tab, business_id, category):
logger.info(
"Retrieving count of threads for all conversation tabs",
survey_id=survey_id,
conversation_tab=conversation_tab,
business_id=business_id,
category=category,
)
respo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_conversation_counts(business_id, conversation_tab, survey_id, category, all_conversation_types):\n params = _get_secure_message_threads_params(\n survey_id, business_id, conversation_tab, category, all_conversation_types\n )\n url = f'{current_app.config[\"SECURE_MESSAGE_URL\"]}/messages/c... | [
"0.70647997",
"0.5977005",
"0.58980954",
"0.5830759",
"0.58140135",
"0.5813447",
"0.57283854",
"0.5707127",
"0.56924605",
"0.56898373",
"0.5689461",
"0.56750286",
"0.5671644",
"0.5657192",
"0.56248367",
"0.56144553",
"0.5568868",
"0.5568868",
"0.5531278",
"0.55113405",
"0.547... | 0.6258583 | 1 |
Gets the count of conversations based on the params | def _get_conversation_counts(business_id, conversation_tab, survey_id, category, all_conversation_types):
params = _get_secure_message_threads_params(
survey_id, business_id, conversation_tab, category, all_conversation_types
)
url = f'{current_app.config["SECURE_MESSAGE_URL"]}/messages/count'
r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getNumberOfConversations(node, catalog=None):\n if catalog is None:\n catalog = getToolByName(node, 'portal_catalog')\n return len(catalog(\n object_provides=IConversation.__identifier__,\n path='/'.join(node.getPhysicalPath())))",
"def count_chat_with(self, actor_label):\n ... | [
"0.6763089",
"0.6620903",
"0.64600253",
"0.6158435",
"0.61192197",
"0.6113174",
"0.60978407",
"0.60919636",
"0.6040849",
"0.6025221",
"0.59833664",
"0.59689814",
"0.5946903",
"0.5919529",
"0.59178835",
"0.5917685",
"0.59037703",
"0.5818629",
"0.58184177",
"0.5817921",
"0.5766... | 0.71310955 | 0 |
Check if message contains correct checksum | def _validate_checksum(self, msg: bytes) -> bool:
return self._checksum(msg) == msg[8] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def verify_checksum(message, previous_csum=0):\n if message.message_type in CHECKSUM_MSG_TYPES:\n csum = compute_checksum(\n message.checksum[0],\n message.args,\n previous_csum,\n )\n\n if csum == message.checksum[1]:\n return True\n else:... | [
"0.7705907",
"0.7587994",
"0.752931",
"0.7426855",
"0.7415338",
"0.73797804",
"0.7367894",
"0.73633546",
"0.72925925",
"0.72435987",
"0.7102735",
"0.70819044",
"0.702974",
"0.70258206",
"0.70078015",
"0.70042783",
"0.6903123",
"0.6886536",
"0.68748033",
"0.68244356",
"0.67954... | 0.81222075 | 0 |
Trigger zero calibration (0PPM for Z14, 400 PPM for Z19) | def zero_calibrationn(self):
self.link.write(self._calibrateZeroSequence) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calibration(self, cal: int, /) -> None:",
"async def calibrate_zero(self):\n await self.hw_device.set_signal(self.channel)",
"def _doCalibration(self):\n self._cmdCalibration(2)",
"def photometric_calibration():\n pass",
"def calibration(self) -> int:",
"def calibration(self, pul... | [
"0.6423298",
"0.631655",
"0.6298982",
"0.6260567",
"0.6258085",
"0.62078565",
"0.6157141",
"0.5990511",
"0.59166145",
"0.5912427",
"0.5871232",
"0.5840601",
"0.5815842",
"0.5784849",
"0.5768754",
"0.5756073",
"0.5748982",
"0.5732277",
"0.57183784",
"0.5714611",
"0.5675555",
... | 0.6548889 | 0 |
The function finds the most common seeds for several lengths and calculated the emissions and transitions matrices for each seed. | def get_seeds(seqs):
k_lengths = list(range(6, 20))
final_tuples = {}
motifs_dic = {}
# find most common seeds
seeds = [find_motifs(seqs, k) for k in k_lengths]
for i in k_lengths:
motifs_dic[i] = seeds[i - 6][0:5]
# calculate emissions and transitions
global_possible_occurrenc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clusterSeeds(seeds, l): \n \n # Code to complete - you are free to define other functions as you like\n \n # The function will work like this,\n # first change all the (x( y1, y2, .., yn)) tuples into (x, y) tuples.\n # then from that point make the adj matrix so that ... | [
"0.5693699",
"0.5550675",
"0.54997873",
"0.5431754",
"0.5406691",
"0.5335756",
"0.53210217",
"0.53132635",
"0.53088075",
"0.53014505",
"0.5280768",
"0.5259172",
"0.5255134",
"0.5245243",
"0.51910627",
"0.5185651",
"0.51382864",
"0.5113323",
"0.5112537",
"0.5112202",
"0.509078... | 0.66207594 | 0 |
Return if x == y, if eps is not None, return if abs(xy) <= eps | def all_equal(x, y, eps=None):
if eps:
return all([abs(i - j) <= eps
for i, j in zip(x, y)
if i is not None and j is not None])
return all([i == j for i, j in zip(x, y)]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def realEqual(x,y,eps=10e-10):\n return abs(x-y) < eps",
"def approx_eq(x, y, tolerance = 0.000001):\n\treturn abs(x - y) < tolerance",
"def approx_eq(x, y, tolerance=1e-15):\n return abs(x - y) < tolerance",
"def is_almost_equal(self, x ,y ,epsilon=1*10**(-8)):\n \treturn abs(x-y) <= epsilon",
"d... | [
"0.78858256",
"0.7044861",
"0.6952725",
"0.69114923",
"0.6853465",
"0.6734588",
"0.66924584",
"0.6683078",
"0.66429543",
"0.6590756",
"0.6590756",
"0.64673287",
"0.6461987",
"0.6440452",
"0.64339805",
"0.6417307",
"0.6406655",
"0.6328267",
"0.63227063",
"0.6311484",
"0.622861... | 0.7315098 | 1 |
Reduce product of x. | def product(x):
return functools.reduce(lambda x, y: x * y, x) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prod(x):\n return functools.reduce(lambda a, b: a * b, x, 1)",
"def prod(self, x, y):\n return self.reduce(x + y)",
"def prod(l):\n return reduce(lambda a, b: a*b, l)",
"def prod(lst):\n return reduce(mul, lst, 1)",
"def _prod(seq):\n return reduce(lambda x, y: x*y, seq, 1)",
"def ... | [
"0.8485899",
"0.75339127",
"0.71145695",
"0.70959675",
"0.7030964",
"0.70278287",
"0.70278287",
"0.70278287",
"0.7009414",
"0.69021314",
"0.6851268",
"0.6762479",
"0.6750255",
"0.67320514",
"0.6707632",
"0.66387403",
"0.6615138",
"0.6581234",
"0.6580697",
"0.65709585",
"0.656... | 0.8354631 | 1 |
Return a `list` of `int` that represents a range of axes. | def ranged_axes(shape):
return (-np.arange(1, len(shape) + 1)[::-1]).tolist() or -1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def range() -> List[int]:\n pass",
"def limits(self):\n\n\t\treturn [\n\t\t\tmin(self.xvalues),\n\t\t\tmax(self.xvalues),\n\t\t\tmin(self.yvalues),\n\t\t\tmax(self.yvalues)]",
"def range(self):\n lows, highs = [], []\n for graph in self._graphs.values():\n low, high = graph.range()\n ... | [
"0.7072757",
"0.698906",
"0.6808658",
"0.6788123",
"0.6770003",
"0.6667891",
"0.6639482",
"0.6613244",
"0.6563589",
"0.65074825",
"0.6391037",
"0.6376127",
"0.63659567",
"0.63645595",
"0.635271",
"0.6344882",
"0.63376725",
"0.6322412",
"0.6316687",
"0.630669",
"0.6293695",
... | 0.6999914 | 1 |
Partition `zipped` into `num_steps`. | def partition(zipped, num_steps, allow_overflow=True):
size = len(zipped)
parts = []
for i in range(0, size, num_steps):
end = i + num_steps
if end >= size:
parts.append(zip(*zipped[i:]))
break
elif allow_overflow:
parts.append(zip(*zipped[i:end]))
return parts | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_chunks(num_items, num_steps):\n chunk_sizes = np.zeros(num_steps, dtype=int)\n chunk_sizes[:] = num_items // num_steps\n chunk_sizes[:num_items % num_steps] += 1\n\n chunk_offsets = np.roll(np.cumsum(chunk_sizes), 1)\n chunk_offsets[0] = 0\n return chunk_sizes, chunk_offsets",
"def test... | [
"0.56117743",
"0.5296957",
"0.528687",
"0.52073896",
"0.5157775",
"0.51236594",
"0.51106584",
"0.5107272",
"0.5092671",
"0.5070655",
"0.5070408",
"0.5062972",
"0.5044236",
"0.5033536",
"0.50270873",
"0.50222856",
"0.5005889",
"0.5004188",
"0.49633753",
"0.48935226",
"0.487203... | 0.80619586 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.