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 |
|---|---|---|---|---|---|---|
Get value from data or registers based on address | def get_data(self, addr):
ret_val = None
if addr < 0:
print("FAIL - negative address")
if addr >= len(self.data):
try:
ret_val = self.regs[ addr ]
except:
ret_val = 0
else:
ret_val = self.data[ addr ]
return ret_val | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_value(self, address):\n\n return self.data[address]",
"def _getReg(address):\n return struct.unpack(\"<L\", mem[address:address+4])[0]",
"def read_register(self, address):\n\n return self.register[address]",
"def get_address_value(cls, addr):\n\t\tprint \" Called get_address_value({... | [
"0.7964677",
"0.7391587",
"0.72287935",
"0.7128195",
"0.6796428",
"0.6705089",
"0.6661176",
"0.6637643",
"0.6637581",
"0.65186596",
"0.6502824",
"0.6396661",
"0.63817567",
"0.63555515",
"0.6342883",
"0.6311233",
"0.627899",
"0.627899",
"0.62426364",
"0.62329155",
"0.6205405",... | 0.8028823 | 0 |
Get input data and set it to some address | def input(self, p_addr = 0):
if len(self.input_data):
in_pos = self.get_address(p_addr, 1)
in_val = self.input_data.pop(0)
self.set_data(in_pos, in_val)
self.pos += 2
else:
if self.disp_pause:
print("PAUSED")
self.pause = True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setData(self,address):\n self.data = _pack_address(address)",
"def set_data(self, addr, value):\n\t\tif addr < 0:\n\t\t\tprint(\"FAIL - negative address\")\n\t\tif addr >= len(self.data):\n\t\t\tself.regs[ addr ] = value\n\t\telse:\n\t\t\tself.data[ addr ] = value",
"def fill_host(self, data):\n ... | [
"0.677795",
"0.61024487",
"0.60747546",
"0.60747546",
"0.5995873",
"0.59874356",
"0.5980571",
"0.5855804",
"0.58105445",
"0.5714172",
"0.57112557",
"0.5697777",
"0.56853783",
"0.5671499",
"0.56569827",
"0.56569827",
"0.5614624",
"0.55797696",
"0.55797696",
"0.55589336",
"0.55... | 0.616052 | 1 |
Get output buffer (last `last` positions), if `last` equals 1 flush the buffer | def get_output(self, last = 1):
if last == -1:
tmp = self.out_param[::]
self.out_param = []
return tmp
return self.out_param[-last:] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def flush_output():\n if len(buffered) == 1:\n code.add_line(\"append_result(%s)\" % buffered[0])\n elif len(buffered) > 1:\n code.add_line(\"extend_result([%s])\" % \", \".join(buffered))\n del buffered[:]",
"def getLast(self):\n return self.... | [
"0.6151036",
"0.58266515",
"0.5722285",
"0.5619657",
"0.5505953",
"0.5459501",
"0.5450963",
"0.5439512",
"0.54322183",
"0.54322183",
"0.54322183",
"0.54322183",
"0.5419056",
"0.53555685",
"0.53318954",
"0.5315741",
"0.5314499",
"0.5301618",
"0.53014266",
"0.5296619",
"0.52758... | 0.63626224 | 0 |
Begin a multipart upload | def initiate_multipart_upload(self):
request = self.s3.create_request("OBJECT_POST", uri = self.uri, headers = self.headers_baseline, extra = "?uploads")
response = self.s3.send_request(request)
data = response["data"]
self.upload_id = getTextFromXml(data, "UploadId")
return self... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def upload_all_parts(self):\n if not self.upload_id:\n raise RuntimeError(\"Attempting to use a multipart upload that has not been initiated.\")\n\n if self.file.name != \"<stdin>\":\n size_left = file_size = os.stat(self.file.name)[ST_SIZE]\n nr_parts = file_... | [
"0.7138374",
"0.6898224",
"0.674426",
"0.6724694",
"0.67057806",
"0.65629184",
"0.644504",
"0.64089704",
"0.63789344",
"0.637555",
"0.6371153",
"0.63569987",
"0.63420403",
"0.62841195",
"0.6240211",
"0.6233155",
"0.6224858",
"0.61901563",
"0.61885554",
"0.61602145",
"0.615350... | 0.7357991 | 0 |
Execute a full multipart upload on a file Returns the seq/etag dict TODO use num_processes to thread it | def upload_all_parts(self):
if not self.upload_id:
raise RuntimeError("Attempting to use a multipart upload that has not been initiated.")
if self.file.name != "<stdin>":
size_left = file_size = os.stat(self.file.name)[ST_SIZE]
nr_parts = file_size / self.chu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initiate_multipart_upload(self):\n request = self.s3.create_request(\"OBJECT_POST\", uri = self.uri, headers = self.headers_baseline, extra = \"?uploads\")\n response = self.s3.send_request(request)\n data = response[\"data\"]\n self.upload_id = getTextFromXml(data, \"UploadId\")\n ... | [
"0.67758095",
"0.6575503",
"0.6391231",
"0.6376673",
"0.63235295",
"0.6313379",
"0.6240101",
"0.62331957",
"0.61913866",
"0.6171247",
"0.61689883",
"0.6092085",
"0.6071277",
"0.60122454",
"0.6002311",
"0.5958963",
"0.5948954",
"0.5945641",
"0.5943182",
"0.59146935",
"0.590215... | 0.70243835 | 0 |
Upload a file chunk | def upload_part(self, seq, offset, chunk_size, labels, buffer = ''):
# TODO implement Content-MD5
debug("Uploading part %i of %r (%s bytes)" % (seq, self.upload_id, chunk_size))
headers = { "content-length": chunk_size }
query_string = "?partNumber=%i&uploadId=%s" % (seq, self.upload_id)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def upload_chunk(self, file_obj, length, offset=0, upload_id=None):\n\n params = dict()\n\n if upload_id:\n params['upload_id'] = upload_id\n params['offset'] = offset\n\n url, ignored_params, headers = self.request(\"/chunked_upload\", params,\n ... | [
"0.75966084",
"0.759227",
"0.75214267",
"0.7378558",
"0.73484313",
"0.7311245",
"0.70927095",
"0.70529234",
"0.70486563",
"0.68820477",
"0.6879894",
"0.68237096",
"0.67937803",
"0.67707115",
"0.6742024",
"0.6738623",
"0.6725202",
"0.67084616",
"0.6673101",
"0.6636667",
"0.663... | 0.76274014 | 0 |
Finish a multipart upload | def complete_multipart_upload(self):
debug("MultiPart: Completing upload: %s" % self.upload_id)
parts_xml = []
part_xml = "<Part><PartNumber>%i</PartNumber><ETag>%s</ETag></Part>"
for seq, etag in self.parts.items():
parts_xml.append(part_xml % (seq, etag))
body = "<... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def upload_finish(self, cloud_file):",
"def complete_multipart_upload(Bucket=None, Key=None, MultipartUpload=None, UploadId=None, RequestPayer=None):\n pass",
"def complete_upload(self):\r\n xml = self.to_xml()\r\n return self.bucket.complete_multipart_upload(self.key_name,\r\n ... | [
"0.754383",
"0.7357068",
"0.724577",
"0.6746937",
"0.6701442",
"0.667674",
"0.6626828",
"0.65539736",
"0.6546125",
"0.6496346",
"0.6464488",
"0.64643455",
"0.64143026",
"0.6378168",
"0.6369848",
"0.63605607",
"0.6272264",
"0.6211301",
"0.61743736",
"0.6162679",
"0.6140481",
... | 0.77730435 | 0 |
Return a menu displaying the current state of the playback as well as the commands available to the user. | def _status_menu(self):
title = 'Now Playing: %s' % self._player.get_media_name()
stats = (
('Playback rate', '%1.1fx' % self._player.get_playback_rate()),
('Elapsed', _format_time(self._player.get_position())),
('Total Length', _format_time(self._player.g... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main_menu(self):\n menu_string = \"Main menu\\n\"\n menu_string += \"\\t1. Modify a list\\n\"\n menu_string += \"\\t2. Grade submenu\\n\"\n menu_string += \"\\t3. Search for something\\n\"\n menu_string += \"\\t4. Get a statistic\\n\"\n menu_string += \"\\t5. Undo/Redo... | [
"0.6616436",
"0.65773684",
"0.65322655",
"0.65151155",
"0.6474119",
"0.63803834",
"0.6375771",
"0.63460505",
"0.63337165",
"0.6296742",
"0.629645",
"0.62860733",
"0.6281516",
"0.62407094",
"0.62387776",
"0.62313604",
"0.62286526",
"0.6203076",
"0.618405",
"0.61693865",
"0.615... | 0.7697497 | 0 |
Round x down to a multiple of m. | def round_down(x, m):
return int(m * round(float(x) / m)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def roundup_int(x, m):\n\treturn int(math.ceil(x / float(m))) * m",
"def _round(self, x):\n return x - x % self.minutes_per_step",
"def _round_to_nearest_multiple_down(x, n=5):\n return n * math.floor(float(x) / n)",
"def round_down(x):\n return int(math.floor(x / 10.0)) * 10",
"def downround(... | [
"0.7884007",
"0.7406131",
"0.6921282",
"0.6884489",
"0.6798002",
"0.6689872",
"0.6604047",
"0.6459293",
"0.64234096",
"0.6301848",
"0.62860346",
"0.62750673",
"0.6249495",
"0.6141186",
"0.61311156",
"0.6113276",
"0.6092585",
"0.60622334",
"0.60341126",
"0.60335",
"0.60030574"... | 0.8763403 | 0 |
Log all values in a dict as scalars to TensorBoard. | def _log_scalars(self, scalar_dict, print_to_stdout=True):
for k, v in scalar_dict.items():
if print_to_stdout:
self.write('[{}: {:.3g}]'.format(k, v))
k = k.replace('_', '/') # Group in TensorBoard by phase
self.summary_writer.add_scalar(k, v, self.global_st... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def log_scalars(self, scalars_dict, accum_reduction=None):\n for k, v in scalars_dict.items():\n self.log_scalar(k, v, accum_reduction)",
"def log_scalars(self, scalar_dict,\n iterations, steps_per_epoch=None,\n step_in_epoch=None, cur_epoch=None,\n ... | [
"0.7614835",
"0.73455614",
"0.6878443",
"0.68174237",
"0.6627913",
"0.6470473",
"0.63354903",
"0.62226635",
"0.5921609",
"0.5793472",
"0.57802165",
"0.5715617",
"0.56895524",
"0.56635505",
"0.56635505",
"0.5589343",
"0.5585543",
"0.55748105",
"0.55388325",
"0.5432968",
"0.538... | 0.79419255 | 0 |
Plot all curves in a dict as RGB images to TensorBoard. | def _plot_curves(self, curves_dict):
for name, curve in curves_dict.items():
fig = plt.figure()
ax = plt.gca()
plot_type = name.split('_')[-1]
ax.set_title(plot_type)
if plot_type == 'PRC':
precision, recall, _ = curve
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_curve(epochs, hist, list_of_metrics): \n # list_of_metrics should be one of the names shown in:\n # https://www.tensorflow.org/tutorials/structured_data/imbalanced_data#define_the_model_and_metrics \n\n plt.figure()\n plt.xlabel(\"Epoch\")\n plt.ylabel(\"Value\")\n\n for m in list_of_metrics:\n ... | [
"0.6789922",
"0.66710466",
"0.6281462",
"0.62689495",
"0.61134017",
"0.61091185",
"0.609572",
"0.5982698",
"0.5902102",
"0.58739376",
"0.586099",
"0.5776823",
"0.57448447",
"0.5722574",
"0.57052886",
"0.570347",
"0.56815606",
"0.56657416",
"0.5663962",
"0.5657919",
"0.5642024... | 0.7033957 | 0 |
Write a message to the log. If print_to_stdout is True, also print to stdout. | def write(self, message, print_to_stdout=True):
with open(self.log_path, 'a') as log_file:
log_file.write(message + '\n')
if print_to_stdout:
print(message) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def log(self, message):\n self._logger.write(message)",
"def log(message: str, stdout: bool) -> None:\n if stdout:\n print(message)\n sys.stdout.flush()",
"def log_and_print(self, message):\n self.f.write(message + \"\\n\")\n print message",
"def log(self, msg, alwaysPri... | [
"0.68014693",
"0.67202073",
"0.6549682",
"0.64982516",
"0.64770395",
"0.638645",
"0.63148785",
"0.6288935",
"0.6273223",
"0.6226357",
"0.622524",
"0.62056506",
"0.6170666",
"0.6157295",
"0.6129139",
"0.6129139",
"0.60974735",
"0.60917294",
"0.6054858",
"0.6040961",
"0.6015219... | 0.8373233 | 0 |
Flask decorator to ensure that the user is logged in against FAS. To use this decorator you need to have a function named 'auth_login'. Without that function the redirect if the user is not logged in will not work. | def fas_login_required(function):
@wraps(function)
def decorated_function(*args, **kwargs):
if flask.g.fas_user is None:
return flask.redirect(flask.url_for('auth_login',
next=flask.request.url))
return function(*args, **kwargs)
ret... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def login_required(f):\n @wraps(f)\n def decorated_function(*args, **kwargs):\n # checks is user login\n if session.get(\"user_id\") is None:\n return redirect(url_for(\"login\", next=request.url))\n return f(*args, **kwargs)\n return decorated_function",
"def login_requi... | [
"0.837868",
"0.8279903",
"0.82517165",
"0.81909364",
"0.8137846",
"0.8122242",
"0.8110708",
"0.810528",
"0.8087524",
"0.8087524",
"0.8087524",
"0.8087524",
"0.8087524",
"0.8087524",
"0.8087524",
"0.8087524",
"0.8087524",
"0.8087524",
"0.8087524",
"0.8085632",
"0.80726266",
... | 0.87268835 | 0 |
Return total % CPU utilization (avg % usage per core) | def get_cpu_usage():
return psutil.cpu_percent() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cpu_usage(self):\n usages = []\n for w, info in self.worker_info.items():\n usages.append(info['metrics']['cpu'])\n if len(usages)>0:\n return sum(usages) / len(usages)\n else:\n return 0",
"def get_total_n_cpu(self) -> int:",
"def get_cpu_percen... | [
"0.83504343",
"0.81945914",
"0.8116258",
"0.79455423",
"0.7928484",
"0.78884053",
"0.786604",
"0.77494586",
"0.767282",
"0.7616385",
"0.75324875",
"0.74936175",
"0.748903",
"0.74561995",
"0.7450575",
"0.74457794",
"0.7434709",
"0.7367025",
"0.7358259",
"0.73214525",
"0.729923... | 0.84161854 | 0 |
Returns a dictionary containg the default settings specified in this class. These settings cover global toolbox settings, such as ``enableCExtensions``, as well as the image preprocessing settings (e.g. resampling). Feature class specific are defined in the respective feature classes and and not included here. Similarl... | def _getDefaultSettings(cls):
return {'minimumROIDimensions': 1,
'minimumROISize': None, # Skip testing the ROI size by default
'normalize': False,
'normalizeScale': 1,
'removeOutliers': None,
'resampledPixelSpacing': None, # No resampling by default
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def settings(self) -> Dict[str, Any]:\n settings = {}\n if self.pre_thresholder is not None:\n settings['pre_thresh'] = self.pre_thresholder.threshold\n if self.pre_thresholder.val_low_class != 0.:\n settings['pre_val_low'] = self.pre_thresholder.val_low_class\n ... | [
"0.7154207",
"0.70924383",
"0.6903164",
"0.68919384",
"0.68635166",
"0.68474275",
"0.6748116",
"0.67425704",
"0.672394",
"0.66872275",
"0.66056347",
"0.65817654",
"0.6545441",
"0.65379333",
"0.65102243",
"0.64229476",
"0.6391109",
"0.6390645",
"0.6373113",
"0.6338724",
"0.631... | 0.74119973 | 0 |
Enable or disable reporting of additional information on the extraction. This information includes toolbox version, enabled input images and applied settings. Furthermore, additional information on the image and region of interest (ROI) is also provided, including original image spacing, total number of voxels in the R... | def addProvenance(self, provenance_on=True):
self.kwargs['additionalInfo'] = provenance_on | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getProvenance(self, imageFilepath, maskFilepath, mask):\n self.logger.info('Adding additional extraction information')\n\n provenanceVector = collections.OrderedDict()\n generalinfoClass = generalinfo.GeneralInfo(imageFilepath, maskFilepath, mask, self.kwargs, self.inputImages)\n for k, v in six.it... | [
"0.61324704",
"0.5580118",
"0.5303036",
"0.5202163",
"0.51500565",
"0.50971496",
"0.50424165",
"0.50296223",
"0.5022306",
"0.5014191",
"0.4949853",
"0.4909818",
"0.48938707",
"0.48500672",
"0.4841513",
"0.47821522",
"0.47727352",
"0.4742481",
"0.47420958",
"0.47383097",
"0.47... | 0.5907224 | 1 |
Parse specified parameters file and use it to update settings in kwargs, enabled feature(Classes) and input | def loadParams(self, paramsFile):
dataDir = os.path.abspath(os.path.join(radiomics.__path__[0], 'schemas'))
schemaFile = os.path.join(dataDir, 'paramSchema.yaml')
schemaFuncs = os.path.join(dataDir, 'schemaFuncs.py')
c = pykwalify.core.Core(source_file=paramsFile, schema_files=[schemaFile], extensions=[... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _update_params(self, params_file=None, params_dict=None):\n core = pykwalify.core.Core(source_file=params_file, source_data=params_dict,\n schema_files=[schema_yaml], extensions=[schema_func])\n params = core.validate()\n self.settings = params.get('settin... | [
"0.70521",
"0.6384262",
"0.631315",
"0.61696446",
"0.6099771",
"0.5991575",
"0.59906685",
"0.5986007",
"0.59695005",
"0.59633684",
"0.59365594",
"0.58831966",
"0.5859198",
"0.5771429",
"0.5761396",
"0.5752638",
"0.57498896",
"0.57198375",
"0.57108396",
"0.56926817",
"0.567959... | 0.70090264 | 1 |
Enable all possible input images without any custom settings. | def enableAllInputImages(self):
self.logger.debug('Enabling all input image types')
for imageType in getInputImageTypes():
self.inputImages[imageType] = {}
self.logger.debug('Enabled input images types: %s', self.inputImages) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def disableAllInputImages(self):\n self.logger.debug('Disabling all input image types')\n self.inputImages = {}",
"def enableInputImages(self, **inputImages):\n self.logger.debug('Updating enabled input images types with %s', inputImages)\n self.inputImages.update(inputImages)\n self.logger.debug(... | [
"0.8545291",
"0.7877609",
"0.6650875",
"0.63693947",
"0.60548675",
"0.5960338",
"0.5820554",
"0.5762784",
"0.57597774",
"0.5749555",
"0.5707793",
"0.5700091",
"0.56888616",
"0.5675954",
"0.5668432",
"0.5668432",
"0.5668432",
"0.55423605",
"0.54909945",
"0.5482339",
"0.5470032... | 0.85969824 | 0 |
Disable all input images. | def disableAllInputImages(self):
self.logger.debug('Disabling all input image types')
self.inputImages = {} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enableAllInputImages(self):\n self.logger.debug('Enabling all input image types')\n for imageType in getInputImageTypes():\n self.inputImages[imageType] = {}\n self.logger.debug('Enabled input images types: %s', self.inputImages)",
"def __disableControls(self):\n self.ignoreAll()",
"de... | [
"0.71531355",
"0.69245046",
"0.66767097",
"0.66115755",
"0.6515991",
"0.6458505",
"0.64366573",
"0.64130753",
"0.6400546",
"0.6382839",
"0.6297096",
"0.6286217",
"0.62648803",
"0.6264742",
"0.6259228",
"0.6251675",
"0.624604",
"0.6194302",
"0.61609715",
"0.6100095",
"0.607541... | 0.90328544 | 0 |
r""" Enable or disable specified input image. If enabling input image, optional custom settings can be specified in customArgs. | def enableInputImageByName(self, inputImage, enabled=True, customArgs=None):
if inputImage not in getInputImageTypes():
self.logger.warning('Input image type %s is not recognized', inputImage)
return
if enabled:
if customArgs is None:
customArgs = {}
self.logger.debug('Enablin... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enableInputImages(self, **inputImages):\n self.logger.debug('Updating enabled input images types with %s', inputImages)\n self.inputImages.update(inputImages)\n self.logger.debug('Enabled input images types: %s', self.inputImages)",
"def setEnabled(*args):",
"def setEnabled(*args):",
"def setEna... | [
"0.7061782",
"0.62825954",
"0.62825954",
"0.62825954",
"0.62825954",
"0.62825954",
"0.62825954",
"0.62825954",
"0.62825954",
"0.62825954",
"0.62825954",
"0.62825954",
"0.59351027",
"0.581261",
"0.581261",
"0.581261",
"0.581261",
"0.581261",
"0.581261",
"0.581261",
"0.581261",... | 0.75504714 | 0 |
Enable input images, with optionally custom settings, which are applied to the respective input image. Settings specified here override those in kwargs. | def enableInputImages(self, **inputImages):
self.logger.debug('Updating enabled input images types with %s', inputImages)
self.inputImages.update(inputImages)
self.logger.debug('Enabled input images types: %s', self.inputImages) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enableInputImageByName(self, inputImage, enabled=True, customArgs=None):\n if inputImage not in getInputImageTypes():\n self.logger.warning('Input image type %s is not recognized', inputImage)\n return\n\n if enabled:\n if customArgs is None:\n customArgs = {}\n self.logger.d... | [
"0.75860304",
"0.71119815",
"0.6290015",
"0.59151906",
"0.5834432",
"0.56261206",
"0.560337",
"0.5568557",
"0.5532304",
"0.55164206",
"0.55091166",
"0.5507203",
"0.54913306",
"0.53785723",
"0.5370891",
"0.53520036",
"0.53520036",
"0.53520036",
"0.53520036",
"0.53520036",
"0.5... | 0.8008344 | 0 |
Enable all classes and all features. | def enableAllFeatures(self):
self.logger.debug('Enabling all features in all feature classes')
for featureClassName in self.getFeatureClassNames():
self.enabledFeatures[featureClassName] = []
self.logger.debug('Enabled features: %s', self.enabledFeatures) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enable(self, *args, **kwargs):\n pass",
"def _enable(self):\n self.debug_log(\"Enabling...\")\n self._register_handlers()",
"def enable(cls):\r\n cls.disable()\r\n sys.meta_path.insert(0, cls())",
"def enable(self):\n pass",
"def enable(self):\n self.ena... | [
"0.65616536",
"0.64384973",
"0.63570607",
"0.63292027",
"0.627972",
"0.62389576",
"0.6151444",
"0.61159676",
"0.60977143",
"0.6018554",
"0.5983644",
"0.5950242",
"0.5950242",
"0.5927329",
"0.58994263",
"0.5877411",
"0.58279175",
"0.5823262",
"0.58101696",
"0.57101333",
"0.570... | 0.8068366 | 0 |
Enable or disable all features in given class. | def enableFeatureClassByName(self, featureClass, enabled=True):
if featureClass not in self.getFeatureClassNames():
self.logger.warning('Feature class %s is not recognized', featureClass)
return
if enabled:
self.logger.debug('Enabling all features in class %s', featureClass)
self.enable... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enableAllFeatures(self):\n self.logger.debug('Enabling all features in all feature classes')\n for featureClassName in self.getFeatureClassNames():\n self.enabledFeatures[featureClassName] = []\n self.logger.debug('Enabled features: %s', self.enabledFeatures)",
"def enableFeaturesByName(self, *... | [
"0.7448473",
"0.589912",
"0.57723415",
"0.57723415",
"0.57723415",
"0.57723415",
"0.57723415",
"0.57723415",
"0.57723415",
"0.57723415",
"0.57723415",
"0.57723415",
"0.57723415",
"0.547834",
"0.544477",
"0.53477913",
"0.5314227",
"0.5266131",
"0.5256946",
"0.5222854",
"0.5169... | 0.680213 | 1 |
Specify which features to enable. Key is feature class name, value is a list of enabled feature names. To enable all features for a class, provide the class name with an empty list or None as value. Settings for feature classes specified in enabledFeatures.keys are updated, settings for feature classes not yet present ... | def enableFeaturesByName(self, **enabledFeatures):
self.logger.debug('Updating enabled features with %s', enabledFeatures)
self.enabledFeatures.update(enabledFeatures)
self.logger.debug('Enabled features: %s', self.enabledFeatures) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enableFeatureClassByName(self, featureClass, enabled=True):\n if featureClass not in self.getFeatureClassNames():\n self.logger.warning('Feature class %s is not recognized', featureClass)\n return\n\n if enabled:\n self.logger.debug('Enabling all features in class %s', featureClass)\n ... | [
"0.7588935",
"0.7220157",
"0.6214421",
"0.6084086",
"0.59338534",
"0.59016854",
"0.58781534",
"0.5852401",
"0.5772626",
"0.5720475",
"0.5615681",
"0.5437084",
"0.54323184",
"0.5419842",
"0.5319318",
"0.53126454",
"0.5277723",
"0.5259413",
"0.5245193",
"0.5208251",
"0.5188673"... | 0.7475316 | 1 |
Preprocess the image and labelmap. If ImageFilePath is a string, it is loaded as SimpleITK Image and assigned to image, if it already is a SimpleITK Image, it is just assigned to image. All other cases are ignored (nothing calculated). Equal approach is used for assignment of mask using MaskFilePath. If normalizing is ... | def loadImage(self, ImageFilePath, MaskFilePath):
self.logger.info('Loading image and mask')
if isinstance(ImageFilePath, six.string_types) and os.path.exists(ImageFilePath):
image = sitk.ReadImage(ImageFilePath)
elif isinstance(ImageFilePath, sitk.SimpleITK.Image):
image = ImageFilePath
els... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def preprocess(path, path2 , scale):\n image = imread(path)\n label_ = imread(path2)\n\n #label_ = modcrop(label, scale)\n\n # Must be normalized\n input_ = image / 255.\n label_ = label_ / 255.\n\n #input_ = scipy.ndimage.interpolation.zoom(label_, (1./scale), prefilter=False)\n #input_ = scipy.ndimage.in... | [
"0.65085906",
"0.61711144",
"0.6159926",
"0.61240757",
"0.6091799",
"0.60409606",
"0.59914386",
"0.5914176",
"0.5849112",
"0.58378875",
"0.580039",
"0.5790209",
"0.57787704",
"0.5715158",
"0.5674759",
"0.55987114",
"0.5583947",
"0.55767995",
"0.5576684",
"0.5569302",
"0.55604... | 0.6324117 | 1 |
Generates provenance information for reproducibility. Takes the original image & mask filepath, as well as the resampled mask which is passed to the feature classes. Returns a dictionary with keynames coded as | def getProvenance(self, imageFilepath, maskFilepath, mask):
self.logger.info('Adding additional extraction information')
provenanceVector = collections.OrderedDict()
generalinfoClass = generalinfo.GeneralInfo(imageFilepath, maskFilepath, mask, self.kwargs, self.inputImages)
for k, v in six.iteritems(ge... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def preprocessing(fish_class):\n\n\t# encode fish_class into integer\n\tfish_label = fish_labels[fish_class]\n\t\n\t# return a list of image directories for each image\n\timg_handles = glob.glob(data_dir + fish_class + '/' + '*.jpg')\n\t\n\t# build an empty list to store each img as np.ndarray\n\timgs = []\n\t\... | [
"0.552891",
"0.5448059",
"0.5411503",
"0.5371006",
"0.53595996",
"0.53296924",
"0.53267634",
"0.5300106",
"0.5253858",
"0.51922536",
"0.5189962",
"0.5188522",
"0.511655",
"0.51083356",
"0.50774795",
"0.50622326",
"0.5058947",
"0.5045965",
"0.50381124",
"0.50327414",
"0.502445... | 0.6158426 | 0 |
Returns a list of all possible feature classes. | def getFeatureClassNames(self):
return self.featureClasses.keys() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def classes(self):\n return list(self._classes_generator())",
"def all(cls):\n results = []\n for name in FEATURES:\n feat = cls.get_by_name(name)\n if feat is None:\n feat = cls(name=name)\n cls.query.session.add(feat)\n results... | [
"0.7083753",
"0.7047303",
"0.6986615",
"0.693242",
"0.6733783",
"0.6730487",
"0.67188895",
"0.6682392",
"0.6679798",
"0.66244197",
"0.65775675",
"0.65715474",
"0.65669453",
"0.65622187",
"0.65523064",
"0.65395606",
"0.65354544",
"0.65196466",
"0.65172577",
"0.65092283",
"0.64... | 0.76183635 | 0 |
Returns a list of all possible features in provided featureClass | def getFeatureNames(self, featureClassName):
return self.featureClasses[featureClassName].getFeatureNames() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all_features(self) :\n raise NotImplementedError",
"def all(cls):\n results = []\n for name in FEATURES:\n feat = cls.get_by_name(name)\n if feat is None:\n feat = cls(name=name)\n cls.query.session.add(feat)\n results.ap... | [
"0.6993939",
"0.68624085",
"0.6709082",
"0.669176",
"0.6688182",
"0.6592365",
"0.65730655",
"0.6553046",
"0.64251375",
"0.6407249",
"0.62570727",
"0.62361485",
"0.6235838",
"0.622333",
"0.6219865",
"0.61453277",
"0.609679",
"0.60952693",
"0.6093235",
"0.60358524",
"0.602832",... | 0.700178 | 0 |
Produce figure 1 of the paper. | def fig_1():
epoch = 3
N = 60000
Nr = N
K = 32
n_iter = 256
Nstar = 16
data = 'dr10'
factor = 100.
features = ['psf_mag', 'model_colors', 'psf_minus_model']
filters = ['r', 'ug gr ri iz', 'ugriz']
message = 'pm_mc_pmm_r_all_all'
model = 'xdmodel_%s_%d_%d_%d_%d_%s.pkl' % (... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Figure4Main(self, supplemental1=False):\n if not supplemental1:\n example_cells = [5, 9, 17, 30]\n else:\n example_cells = [2, 6, 10, 11, 13, 18]\n\n start_letter = \"A\"\n parent_figure = None\n\n if not supplemental1:\n sizer = {\n ... | [
"0.6279921",
"0.61718154",
"0.6133319",
"0.5995697",
"0.5886824",
"0.58511084",
"0.5758559",
"0.57020164",
"0.56793135",
"0.5660195",
"0.5649378",
"0.55890405",
"0.5529864",
"0.55229014",
"0.5513478",
"0.55114144",
"0.5506495",
"0.54989177",
"0.5493746",
"0.54935914",
"0.5489... | 0.6285657 | 0 |
Produce figure 2 of the paper. | def fig_2():
epoch = 3
N = 60000
Nr = N
K = 32
n_iter = 256
Nstar = 16
data = 'dr10'
factor = 100.
features = ['psf_mag', 'model_colors', 'psf_minus_model']
filters = ['r', 'ug gr ri iz', 'ugriz']
message = 'pm_mc_pmm_r_all_all'
model = 'xdmodel_%s_%d_%d_%d_%d_%s.pkl' % (... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def eps2(filename1, filename2, npair, ofname=\"output\",nstart=0, showfig=True):\n\n\tofnametex = ofname+\".tex\"\n\t\t\n\tf = open(ofnametex, 'w')\n\t\n\t\n\tf.write('''\\documentclass {article}\n\t\\usepackage{python}\n\t\\usepackage{graphicx}\n\t\\usepackage[top=1cm, bottom=1cm, left=1cm, right=2cm]{geometry}... | [
"0.6445488",
"0.6045485",
"0.59777915",
"0.59749174",
"0.5964026",
"0.5928806",
"0.5914323",
"0.5909216",
"0.5863343",
"0.58378446",
"0.5804495",
"0.5793671",
"0.577509",
"0.5739826",
"0.5738572",
"0.5731333",
"0.5709291",
"0.57086104",
"0.5707525",
"0.5670021",
"0.5585405",
... | 0.64443517 | 1 |
Produce figure 4 of the paper. | def fig_4():
epoch = 3
N = 60000
Nr = N
K = 32
n_iter = 256
Nstar = 16
data = 'dr10'
factor = 100.
features = ['psf_mag', 'model_colors', 'psf_minus_model']
filters = ['r', 'ug gr ri iz', 'ugriz']
message = 'pm_mc_pmm_r_all_all'
model = 'xdmodel_%s_%d_%d_%d_%d_%s.pkl' % (... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def eps4(filename1, filename2, filename3, filename4, nquad, ofname=\"output\",nstart=0, showfig=True):\n\n\tofnametex = ofname+\".tex\"\n\t\t\n\tf = open(ofnametex, 'w')\n\t\n\t\n\tf.write('''\\documentclass{article}\n\t\\usepackage{python}\n\t\\usepackage{graphicx}\n\t\\usepackage[top=1cm, bottom=1cm, left=1cm, r... | [
"0.6742629",
"0.6706074",
"0.66961974",
"0.63015217",
"0.6081837",
"0.60569793",
"0.58787054",
"0.58424",
"0.58161134",
"0.57563984",
"0.56880033",
"0.5668921",
"0.5633899",
"0.56335175",
"0.5615796",
"0.55709904",
"0.5535165",
"0.5531884",
"0.55115294",
"0.5468825",
"0.54641... | 0.68666595 | 0 |
Produce figure 5 of the paper. | def fig_5():
epoch = 3
N = 60000
Nr = N
K = 32
n_iter = 256
Nstar = 16
data = 'dr10'
factor = 100.
features = ['psf_mag', 'model_colors', 'psf_minus_model']
filters = ['r', 'ug gr ri iz', 'ugriz']
message = 'pm_mc_pmm_r_all_all'
model = 'xdmodel_%s_%d_%d_%d_%d_%s.pkl' % (... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def eps5(filename1, filename2, filename3, filename4, filename5, nquad, ofname=\"output\",nstart=0, showfig=True):\n\n\tofnametex = ofname+\".tex\"\n\t\t\n\tf = open(ofnametex, 'w')\n\t\n\t\n\tf.write('''\\documentclass{article}\n\t\\usepackage{python}\n\t\\usepackage{graphicx}\n\t\\usepackage[top=1cm, bottom=1cm, ... | [
"0.71369654",
"0.6271395",
"0.6266325",
"0.62185913",
"0.6215509",
"0.6197117",
"0.6187425",
"0.6151191",
"0.59776217",
"0.5976559",
"0.5971548",
"0.5950157",
"0.59359837",
"0.59034",
"0.58745664",
"0.57873493",
"0.57561326",
"0.5732278",
"0.56726986",
"0.565986",
"0.56571025... | 0.709452 | 1 |
Plot the median error rates for single epoch, dr10, coadd, and posteriors. | def error_rates(epoch, model, features, filters, figname, fgal=0.5,
idx=-1, N=10000):
Xsingle, Xsinglecov = fetch_prepped_s82data(epoch, fgal, features, filters)
Xcoadd, Xcoaddcov = fetch_prepped_s82data(epoch, fgal, features,
filters, use_single=Fa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_errors(self):\n\n plt.title(\"Prediction Error\")\n plt.plot(self.errors)\n plt.ylabel(\"MSE (Mean Squared Error)\")\n plt.xlabel(\"Iteration\")\n plt.show()",
"def plot_train_test_errors(train_errors, test_errors, lambda_str , K , path, rng):\n plt.plot(range(rng),... | [
"0.5919546",
"0.5884253",
"0.58668184",
"0.5824854",
"0.5785445",
"0.57845217",
"0.57657117",
"0.575321",
"0.5747122",
"0.5738861",
"0.5735035",
"0.5716799",
"0.5704525",
"0.56938636",
"0.5692793",
"0.56819844",
"0.5668775",
"0.5664179",
"0.5662615",
"0.5659408",
"0.5657302",... | 0.59027916 | 1 |
get routable IP address of node from it's prefix database | def get_node_ip(self, prefix_db: openr_types.PrefixDatabase) -> Any:
# First look for LOOPBACK prefix
for prefix_entry in prefix_db.prefixEntries:
if prefix_entry.type == network_types.PrefixType.LOOPBACK:
return ipnetwork.sprint_addr(prefix_entry.prefix.prefixAddress.addr)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_rug_address():\n net = netaddr.IPNetwork(ULA_PREFIX)\n return str(netaddr.IPAddress(net.first + 1))",
"def get_node_ip(\n self,\n name,\n ):\n pass",
"def ip(self, prefix = None):\n ip = self._update_ips()\n if prefix is None:\n return self... | [
"0.67512614",
"0.672374",
"0.66232747",
"0.6416445",
"0.6413486",
"0.64080024",
"0.6393339",
"0.63819945",
"0.62922806",
"0.6266255",
"0.61608344",
"0.6154852",
"0.6154319",
"0.61521226",
"0.6094634",
"0.6090791",
"0.6051159",
"0.6035991",
"0.6009145",
"0.59926647",
"0.598004... | 0.76153773 | 0 |
print keys from raw publication from KvStore | def print_kvstore_keys(
self, resp: Dict[str, Publication], ttl: bool, json: bool
) -> None:
# Export in json format if enabled
if json:
all_kv = {}
for _, kv in resp.items():
all_kv.update(kv.keyVals)
# Force set value to None
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_kvstore_values(\n self,\n resp: Publication,\n area: Optional[str] = None,\n ) -> None:\n\n rows = []\n for key, value in sorted(resp.keyVals.items(), key=lambda x: x[0]):\n val = self.deserialize_kvstore_publication(key, value)\n if not val:\n ... | [
"0.65500253",
"0.602648",
"0.602648",
"0.5896136",
"0.5843619",
"0.5818693",
"0.5740994",
"0.57164586",
"0.5690575",
"0.5682321",
"0.564288",
"0.56066865",
"0.5548096",
"0.55289364",
"0.5522452",
"0.5501682",
"0.5500842",
"0.54946166",
"0.5470928",
"0.5458189",
"0.54509246",
... | 0.6805582 | 0 |
Fetch the keyval publication for each area specified in areas via thrift call | async def fetch_keyvals(
self,
client: OpenrCtrlCppClient.Async,
areas: Set[Any],
keyDumpParams: KeyDumpParams,
) -> Dict[str, Publication]:
area_to_publication_dict = {}
for area in areas:
area_to_publication_dict[area] = await client.getKvStoreKeyValsFi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_kvstore_values(\n self,\n resp: Publication,\n area: Optional[str] = None,\n ) -> None:\n\n rows = []\n for key, value in sorted(resp.keyVals.items(), key=lambda x: x[0]):\n val = self.deserialize_kvstore_publication(key, value)\n if not val:\n ... | [
"0.5258662",
"0.50673336",
"0.49245554",
"0.48266882",
"0.48198405",
"0.47868848",
"0.4764812",
"0.47608864",
"0.474016",
"0.4707932",
"0.47043625",
"0.47033048",
"0.46736437",
"0.46550706",
"0.46489",
"0.46427444",
"0.46238628",
"0.46221396",
"0.46108213",
"0.4608701",
"0.46... | 0.7031373 | 0 |
classify kvstore prefix and return the corresponding deserialized obj | def deserialize_kvstore_publication(self, key, value):
options = {
Consts.PREFIX_DB_MARKER: openr_types.PrefixDatabase,
Consts.ADJ_DB_MARKER: openr_types.AdjacencyDatabase,
}
prefix_type = key.split(":")[0] + ":"
if prefix_type in options.keys():
ret... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _extract_immediate_prefix(obj_key:str)->str:\n immed_prefix = \"\"\n if len(obj_key.split(\"/\")) > 1:\n immed_prefix = obj_key.split(\"/\")[-2]\n \n return immed_prefix",
"def _get_prefix_attributes(self, prefix):\n return filter_dict_by_prefix(self.__dict__, prefix)",
"def get_p... | [
"0.5711935",
"0.55419487",
"0.5494264",
"0.54277533",
"0.5371517",
"0.52974343",
"0.52290225",
"0.5219558",
"0.52009475",
"0.5164571",
"0.5137503",
"0.51101",
"0.5093739",
"0.5079489",
"0.506517",
"0.5060772",
"0.5027817",
"0.50255066",
"0.50075495",
"0.5004343",
"0.49997222"... | 0.590767 | 0 |
print values from raw publication from KvStore | def print_kvstore_values(
self,
resp: Publication,
area: Optional[str] = None,
) -> None:
rows = []
for key, value in sorted(resp.keyVals.items(), key=lambda x: x[0]):
val = self.deserialize_kvstore_publication(key, value)
if not val:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_contents(self):\n print self.values",
"def show_vdcs_detail(self):\n for v in self.vdcs:\n print self.vdcs[v]",
"def show_vdcs(self):\n for v in self.vdcs:\n print v",
"def printMixData(self):\n\t\tprint \"OPERATED MIXNODE: Name: %s, address: (%d, %s), Pub... | [
"0.63312674",
"0.6113396",
"0.5822299",
"0.5791831",
"0.5784153",
"0.577308",
"0.5701333",
"0.56527925",
"0.5638593",
"0.561655",
"0.5576552",
"0.5510589",
"0.55091405",
"0.55068046",
"0.55068046",
"0.55062485",
"0.5444003",
"0.54272056",
"0.5409797",
"0.53990006",
"0.5387225... | 0.68602514 | 0 |
Takes StreamSubscriberInfo from thrift and returns list[str] (aka row) representing the subscriber | def get_subscriber_row(self, stream_session_info):
uptime = "unknown"
last_msg_time = "unknown"
if (
stream_session_info.uptime is not None
and stream_session_info.last_msg_sent_time is not None
):
uptime_str = str(
datetime.timedelta(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subscribers(id):\n return core.query(schema.streamBySubscribers, id)",
"def get_subscribers(self) -> Iterator[Any]:\n for subscription in self._subscriptions[self.id]:\n yield subscription.subscriber",
"def test_successful_subscriptions_list_subscribers(self) -> None:\n result =... | [
"0.61119455",
"0.53708094",
"0.51381725",
"0.5079605",
"0.5024306",
"0.49607125",
"0.49371487",
"0.49270263",
"0.4903581",
"0.4871267",
"0.48365107",
"0.48138362",
"0.48064584",
"0.47757068",
"0.4767832",
"0.47622314",
"0.47521242",
"0.47241798",
"0.4713322",
"0.4707597",
"0.... | 0.7634182 | 0 |
Checks if the local node is advertising atleast one adjacency key and one prefix key to the kvstore. Returns a boolean for each key type. | def _validate_local_key_advertisement(
self, area_to_publication_dict: Dict[str, Publication]
) -> Tuple[bool, bool]:
keys = []
for _, publication in area_to_publication_dict.items():
keys.extend(list(publication.keyVals.keys()))
is_adj_advertised = False
is_pre... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _print_local_node_advertising_check(\n self, is_advertising_adj: bool, is_advertising_prefix: bool\n ) -> None:\n\n is_pass = is_advertising_adj and is_advertising_prefix\n click.echo(\n self.validation_result_str(\n \"kvStore\",\n \"prefix and a... | [
"0.6733836",
"0.6396705",
"0.6381344",
"0.62376046",
"0.57620454",
"0.56948906",
"0.55602145",
"0.55404294",
"0.5508798",
"0.5494694",
"0.5464157",
"0.54515123",
"0.5451274",
"0.54367054",
"0.5413227",
"0.540365",
"0.5388373",
"0.53826374",
"0.53594834",
"0.5344876",
"0.53239... | 0.667407 | 1 |
Prints result of the ttl check along with information about keys with too low ttl The ttl printed is the ttl of the key right before the check occured | def _print_key_ttl_check(
self,
area_to_invalid_keys: Dict[str, Publication],
ttl: int,
threshold: float = 0.75,
) -> None:
click.echo(
self.validation_result_str(
"kvStore", "Key TTL Check", len(area_to_invalid_keys) == 0
)
)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ttl(self, key):\n return self._command(b'PTTL', key, handler=lambda ms: .001 * ms)",
"def get_ttl(self, keyword, key):",
"def ttl(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"ttl\")",
"def ttl(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"ttl\")",
"def ttl(se... | [
"0.66567254",
"0.6301414",
"0.6223945",
"0.6223945",
"0.6101219",
"0.5965713",
"0.5690484",
"0.5654071",
"0.56501955",
"0.56454045",
"0.56354886",
"0.5547257",
"0.5547257",
"0.5547257",
"0.5527442",
"0.55273604",
"0.55273604",
"0.549073",
"0.5475836",
"0.5457758",
"0.5383536"... | 0.7880797 | 0 |
Prints the result of the peer state check and a list of peers not in INITIALIZED state if there are any | def _print_peer_state_check(
self,
invalid_peers: Dict[str, Dict[str, PeerSpec]],
host_id: str,
) -> None:
click.echo(
self.validation_result_str(
"kvStore", "peer state check", len(invalid_peers) == 0
)
)
if len(invalid_peers... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_all_peer_status(self):\n statuses = self.pybird.get_peer_status()\n\n self.assertEquals(statuses[0]['name'], \"PS1\")\n self.assertEquals(statuses[0]['state'], \"Passive\")\n self.assertEquals(statuses[1]['name'], \"PS2\")\n self.assertEquals(statuses[1]['state'], \"Esta... | [
"0.6495497",
"0.6251295",
"0.6225992",
"0.6186012",
"0.61554384",
"0.60008013",
"0.57276255",
"0.5577009",
"0.5554054",
"0.55529517",
"0.5551861",
"0.55037373",
"0.5487797",
"0.5483634",
"0.54702264",
"0.54596984",
"0.54097784",
"0.5396765",
"0.5389472",
"0.5365949",
"0.53658... | 0.7865517 | 0 |
returns a generator of degenerated sequences in scrambled order | def degenerate2(s):
from lasagna.utils import base_repr
n = s.count('N')
seed = hash(s) % (2**32 - 1)
rng = random.Random(seed)
random_base_ix = lambda: base_repr(rng.randint(0, 4**(n + 1) - 1), 4, n + 1)[::-1]
while True:
bases = ['ACTG'[int(j)] for j in random_base_ix()]
s2 = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate(self) -> List[str]:\n\n self._reset()\n\n res = self._get_interactions(\n random.randint(self._min_seq_len, self._max_seq_len))\n\n self._add_guarded_first_named_alloc(res)\n\n if random.randint(0, 1):\n # Add some noise between source and destinat... | [
"0.6526458",
"0.6346598",
"0.61941546",
"0.60155445",
"0.5956522",
"0.59486526",
"0.5940059",
"0.5862646",
"0.5813078",
"0.57996607",
"0.5775033",
"0.57735795",
"0.5773163",
"0.5760917",
"0.5757377",
"0.5739533",
"0.57337964",
"0.5724858",
"0.56738037",
"0.5655347",
"0.564458... | 0.67052954 | 0 |
Parse directories holding extracted frames from standard benchmarks | def parse_directory(path, key_func=lambda x: x[-11:],
rgb_prefix='img_',
flow_x_prefix='flow_x_',
flow_y_prefix='flow_y_',
level=1):
print('parse frames under folder {}'.format(path))
if level == 1:
frame_folders = glob.glob... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_directory(path, rgb_prefix='img_', flow_x_prefix='flow_x_', flow_y_prefix='flow_y_'):\n print('parse frames under folder {}'.format(path))\n frame_folders = glob.glob(os.path.join(path, '*'))\n\n def count_files(directory, prefix_list):\n lst = os.listdir(directory)\n cnt_list = [l... | [
"0.6806591",
"0.61956006",
"0.61574477",
"0.60362446",
"0.60252094",
"0.6013178",
"0.6008159",
"0.6006396",
"0.5959281",
"0.59024763",
"0.5896736",
"0.58548516",
"0.58537865",
"0.5809266",
"0.5792813",
"0.57871157",
"0.57588553",
"0.57568353",
"0.5742853",
"0.57063025",
"0.56... | 0.6455126 | 1 |
This function identifies the habitat area of a patch in which an individual is. | def identify_habarea(indiv_xy_position, habarea_map):
row=int(indiv_xy_position[0])
col=int(indiv_xy_position[1])
habarea=habarea_map[row][col]
return habarea | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def patch_areas(patch_ids):\n\n return np.bincount(patch_ids.reshape((-1,)))[1:]",
"def area(self):",
"def get_area(self):\n raise NotImplementedError()",
"def get_area(option_set):\n return option_set & AREA_MASK",
"def area(self, tileID):\n pass",
"def area(self):\n ...",
"... | [
"0.6068956",
"0.60643595",
"0.59910935",
"0.59910876",
"0.5972108",
"0.59208566",
"0.5889996",
"0.58316416",
"0.5813654",
"0.5810717",
"0.5796046",
"0.5765837",
"0.5745804",
"0.5711808",
"0.57045734",
"0.5694406",
"0.5686349",
"0.567481",
"0.56726205",
"0.56686926",
"0.566484... | 0.700036 | 0 |
Generate vectors for year, month, dayofmonth, and dayofyear create vectors of length = `len(t)` for DAY, MONTH, YEAR | def generate_time_vectors(t) -> Tuple:
T = len(t)
year = np.zeros((T))
month = np.zeros((T))
day = np.zeros((T))
doy = np.zeros((T))
for i in range(T):
year[i] = date.fromordinal(t[i]).year
month[i] = date.fromordinal(t[i]).month
day[i] = date.fromordinal(t[i]).day
# ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def arrayofyears(month1,day1,year1,month2,day2,year2):\n return (arrayofdaysmonthsyears(month1,day1,year1,month2,day2,year2))[2]",
"def generate_months(nmonths, year=2022, month=1, day=1):\n return np.asarray([\n f'{year:04d}-{month+i:02d}-{day:02d}T00:00:00.000000'\n for i in range(nmonths)\... | [
"0.6626277",
"0.6265367",
"0.62616616",
"0.61773056",
"0.61604315",
"0.6143473",
"0.60762256",
"0.5977502",
"0.5961502",
"0.5944625",
"0.59250414",
"0.5923237",
"0.58977413",
"0.5889735",
"0.5883183",
"0.5864521",
"0.5854827",
"0.5771225",
"0.57699937",
"0.57558084",
"0.57406... | 0.7770098 | 0 |
Calculate the climatology (mean) for each day and threshold (90pctile) | def calculate_daily_climatology(
pctile,
windowHalfWidth,
lenClimYear,
smoothPercentile,
smoothPercentileWidth,
thresh_climYear, # empty array
seas_climYear, # empty array
clim, # empty dict
feb29,
doyClim,
clim_start,
clim_end,
tempClim,
temp,
):
# Loop ov... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup_percentiles_pediatrics_new():\n df_cdc = pd.read_csv(Path(\"growthviz-data/ext/growthfile_cdc_ext.csv.gz\"))\n df_who = pd.read_csv(Path(\"growthviz-data/ext/growthfile_who.csv.gz\"))\n df = df_cdc.merge(df_who, on=[\"agedays\", \"sex\"], how=\"left\")\n\n # Add weighting columns to support s... | [
"0.5650315",
"0.5634501",
"0.55678546",
"0.55586326",
"0.5522147",
"0.54622644",
"0.53760904",
"0.5370891",
"0.53564376",
"0.5344963",
"0.53288364",
"0.53195065",
"0.5314005",
"0.53047764",
"0.5268559",
"0.52627236",
"0.52579826",
"0.5235522",
"0.5231728",
"0.52182317",
"0.52... | 0.59774745 | 0 |
Set all remaining missing temp values equal to the climatology | def fill_missing_temp_vals_with_climatology(temp: List, clim: Dict):
temp[np.isnan(temp)] = clim["seas"][np.isnan(temp)]
return temp | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def interpolate_none(self):\n\n # Reset processed data\n self.u_processed_mps = np.copy(self.u_mps)\n self.v_processed_mps = np.copy(self.v_mps)\n self.u_processed_mps[self.valid_data[0, :] == False] = np.nan\n self.v_processed_mps[self.valid_data[0, :] == False] = np.nan",
"de... | [
"0.60011417",
"0.5966284",
"0.58717424",
"0.57598615",
"0.56755286",
"0.5633607",
"0.5623653",
"0.5571434",
"0.5541537",
"0.5529372",
"0.55014426",
"0.54828835",
"0.5442271",
"0.5440241",
"0.54358196",
"0.5429773",
"0.5426778",
"0.54202056",
"0.54152465",
"0.54128855",
"0.540... | 0.7074793 | 0 |
Find all MHW events of duration >= minDuration Updates the mhw dictionary object. | def find_consecutive_exceedences_above_threshold(
events, n_events, mhw, joinAcrossGaps, maxGap
):
for ev in range(1, n_events + 1): # for each event
event_duration = (events == ev).sum()
if event_duration < minDuration: # is it longer than threshold?
continue
# extract the... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def duration_filter(ids_and_durations, minute_threshold):\n delta_sec = minute_threshold * 60 # Threshold passed in second to fit 'timedelta'.\n\n short_videos = [video[0] for video in ids_and_durations if video[1] <= timedelta(seconds=delta_sec)]\n long_videos = [video[0] for video in ids_and_durations ... | [
"0.54400396",
"0.4907825",
"0.4809929",
"0.4713698",
"0.4688717",
"0.46803078",
"0.4660191",
"0.46311387",
"0.46072233",
"0.45317474",
"0.45250195",
"0.44913363",
"0.4469598",
"0.44641155",
"0.44362915",
"0.44328907",
"0.44158658",
"0.4409055",
"0.43937212",
"0.43847978",
"0.... | 0.51633 | 1 |
Link heat waves that occur before and after a short gap (gap must be no longer than maxGap) | def join_events_across_gaps(maxGap, mhw):
# Calculate gap length for each consecutive pair of events
# from the start of the NEXT EVENT to the end of the PRIOR EVENT
gaps = np.array(mhw["time_start"][1:]) - np.array(mhw["time_end"][0:-1]) - 1
if len(gaps) > 0:
while gaps.min() <= maxGap:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def SplitGap(data,gapsize,medwin,fluxdiff):\n \n # defining new empty lists and stuff\n pcount=0\n istamps=[]\n outData={}\n \n data['x'].mask = data['UnMasked']\n data['y'].mask = data['UnMasked']\n data['yerr'].mask = data['UnMasked']\n \n # median smoothing the lightcurve\n m... | [
"0.64434713",
"0.5801542",
"0.56155133",
"0.56064266",
"0.55303115",
"0.54668903",
"0.54343146",
"0.53865033",
"0.5327515",
"0.53137743",
"0.5306543",
"0.5272721",
"0.5268985",
"0.52571553",
"0.52498835",
"0.52097887",
"0.51800275",
"0.5167571",
"0.5143609",
"0.51013005",
"0.... | 0.58150005 | 1 |
Return input array [1D numpy array] with all nan values removed | def nonans(array):
return array[~np.isnan(array)] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_nans(arr, nan_rows=None):\n # Remove NaNs\n nconfigs, nt = arr.shape\n if nan_rows is None:\n mask = np.isfinite(arr)\n else:\n mask = np.array([n for n in np.arange(nconfigs) if n not in nan_rows])\n return arr[mask].reshape(-1, nt)",
"def removeNans(data):\n for i in ... | [
"0.77405065",
"0.7408961",
"0.7318458",
"0.72726125",
"0.70151496",
"0.6928957",
"0.6729866",
"0.6716962",
"0.65393853",
"0.65328234",
"0.64841986",
"0.6428685",
"0.6409222",
"0.6259641",
"0.6246225",
"0.62417316",
"0.62114847",
"0.62003404",
"0.61770093",
"0.6146045",
"0.614... | 0.7642145 | 1 |
Performs a running average of an input time series using uniform window of width w. This function assumes that the input time series is periodic. | def runavg(ts, w):
# Original length of ts
N = len(ts)
# make ts three-fold periodic
ts = np.append(ts, np.append(ts, ts))
# smooth by convolution with a window of equal weights
ts_smooth = np.convolve(ts, np.ones(w) / w, mode="same")
# Only output central section, of length equal to the ori... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def moving_average(data, temporal_window=100):\n window = np.ones(temporal_window) / temporal_window\n return np.convolve(data, window, 'valid')",
"def moving_average(data, window_size):\n window= np.ones(int(window_size))/float(window_size)\n return np.convolve(data, window, 'same')",
"def running... | [
"0.72755015",
"0.7019223",
"0.6980032",
"0.69147635",
"0.6886311",
"0.6849971",
"0.67949075",
"0.67820406",
"0.66995203",
"0.66644543",
"0.6640706",
"0.6443174",
"0.6416299",
"0.64145225",
"0.64019024",
"0.6376318",
"0.63155216",
"0.6246977",
"0.6240341",
"0.62263185",
"0.622... | 0.7964289 | 0 |
Assigns a score to the coursePlan based on the rarity of the course, the number of courses this one makes available in the future, and the users need and preference for a particular type of elective | def heuristics(course, suggestedPlan, user):
score = course.score
bonus = 0
return score + bonus | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _score_to_decision(self, score):",
"def scoring(self):\n pass",
"def score(self):\n raise NotImplementedError()",
"def _cost_caught_by_police(self):\n if self.fine_frequency != 0:\n if self.number_of_courses % self.fine_frequency == 0 and self.number_of_courses != 0:\n ... | [
"0.60130614",
"0.58570117",
"0.5749423",
"0.5732798",
"0.56482965",
"0.55836266",
"0.55628306",
"0.5561281",
"0.5544241",
"0.54613525",
"0.54533947",
"0.54433405",
"0.54193467",
"0.5417941",
"0.54135525",
"0.54113394",
"0.5402817",
"0.54014575",
"0.53850657",
"0.538445",
"0.5... | 0.7116717 | 0 |
Takes a user object and generates the shortest path to graduation. | def automated(user):
# Start should be a Plan() and will include any classes the user has already taken to this point. It should have
# accurate counts of its course typesTaken before starting the search. Goal is the end state desired by the user.
# Usually this will be the gradReqs for the users Curriculu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute_pathways(users, job_graph, debug, min_likelihood_thr=0.2):\r\n start_time = time.time()\r\n __print_msg('Computing career pathways...', debug)\r\n user_pathways = {}\r\n tot_users = len(users)\r\n i = 0\r\n for user, user_jobs in users.items():\r\n user_pathway = compute_user_p... | [
"0.584734",
"0.5654354",
"0.55678916",
"0.5486526",
"0.54030484",
"0.538108",
"0.53505796",
"0.5349955",
"0.53403103",
"0.5308392",
"0.5268799",
"0.5247845",
"0.5236312",
"0.5192242",
"0.5121435",
"0.5113122",
"0.51009756",
"0.5100681",
"0.50975037",
"0.5097221",
"0.50766873"... | 0.5956283 | 0 |
graph from the task json with TaskResource named tuples living in nodes | def build_taskgraph(tasks):
global taskgraph
for task in tasks:
if not task['id'] in taskgraph:
taskgraph.add_node(task["id"])
data = str(task["DATA"])
tr = TaskResources(ram=int(task['RAM']), cpu=int(
task['CPU']), hdd=int(task['HDD']))
taskgraph.node[tas... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def task_relation_json(self) -> List[Dict]:\n if not self.tasks:\n return [self.tasks]\n else:\n self._handle_root_relation()\n return [tr.get_define() for tr in self._task_relations]",
"def _subgraph(self):\n return {\n 'type': 'SubgraphTask',\n ... | [
"0.6246238",
"0.6081832",
"0.6065744",
"0.6018206",
"0.6018206",
"0.58417726",
"0.5779049",
"0.5658437",
"0.5583271",
"0.55294436",
"0.55002636",
"0.5468481",
"0.54389864",
"0.53757447",
"0.5373088",
"0.53719306",
"0.53705764",
"0.5357756",
"0.53515995",
"0.5348182",
"0.53369... | 0.71598744 | 0 |
receive and build taskgraph | def tasks_recv():
recv_json = request.get_json()
build_taskgraph(recv_json)
return 'ok' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_taskgraph(tasks):\n global taskgraph\n for task in tasks:\n if not task['id'] in taskgraph:\n taskgraph.add_node(task[\"id\"])\n data = str(task[\"DATA\"])\n tr = TaskResources(ram=int(task['RAM']), cpu=int(\n task['CPU']), hdd=int(task['HDD']))\n t... | [
"0.65182334",
"0.63080335",
"0.6293795",
"0.6204706",
"0.6186549",
"0.61605525",
"0.61220175",
"0.61220175",
"0.61082584",
"0.6104672",
"0.59439194",
"0.591472",
"0.5882329",
"0.5751076",
"0.5699367",
"0.5686174",
"0.5679653",
"0.56747794",
"0.56723875",
"0.5661628",
"0.56508... | 0.72909814 | 0 |
Set the edgenode's resources for debugging | def set_resources():
global available_resources
global EdgenodeResources
recv_json = request.get_json()
for resourcename, value in recv_json.items():
available_resources[resourcename] = value
# TODO make this better
EdgenodeResources = [TaskResources(ram=int(available_resources['RAM']), ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resources(self):",
"def resources(self, resources):\n self._resources = resources",
"def setOptManagerResources(o): # pylint: disable=global-statement\n # pylint: disable=global-statement\n global OPT_MANAGER_RESOURCES_PGAAS\n OPT_MANAGER_RESOURCES_PGAAS = \"{}/pgaas\".format(o)",
"def resource... | [
"0.5880429",
"0.5852034",
"0.57128286",
"0.56084967",
"0.56084967",
"0.56084967",
"0.56084967",
"0.5529932",
"0.5283272",
"0.5241133",
"0.5212937",
"0.5193305",
"0.514852",
"0.51433814",
"0.51408863",
"0.5116762",
"0.50918823",
"0.5086745",
"0.5068364",
"0.5036334",
"0.501060... | 0.6285629 | 0 |
Loads the textual templates of questions and saves them in a list. | def load_templates(self):
self.templates = []
if os.path.exists("question_templates.txt"):
for line in open("question_templates.txt", "r"):
self.templates.append(line.replace("\n", "")) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_questions(self, verbose=True):\n for question in self.question_list:\n question.load_question(self.data)",
"def load_templates(self):\n TemplateHandler.templates = []\n for template in os.listdir(TemplateHandler.templates_path):\n template_config = self.load_te... | [
"0.6505029",
"0.5937621",
"0.5928935",
"0.5910248",
"0.5856114",
"0.5806971",
"0.57281137",
"0.5690211",
"0.56250936",
"0.56000656",
"0.5596543",
"0.55873555",
"0.55826813",
"0.55461633",
"0.5500507",
"0.5485882",
"0.54667103",
"0.5460839",
"0.5444884",
"0.5443755",
"0.544123... | 0.8599687 | 0 |
Generates two random numbers to get a random property about which there is no knowledge yet, which is indicated by 'None'. If there is knowledge, then this will either be indicated by 'True' or 'False'. If no 'None' is found for 5 times in a row, there is done a check to make sure that there are still 'Nones' in the li... | def find_drink_property(self, properties):
split_status = ""
tries = 0
while split_status != "None" and tries <= 5:
random_drink = randint(0, len(properties) - 1)
random_property = randint(1, len(properties[random_drink]) - 1)
drink_property = properties[ran... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random (self, checkfn=None):\n if len(self) == 0:\n return None\n return self.random_pick(checkfn=checkfn)[1]",
"def maybe(self):\n return random.getrandbits(1)",
"def random (self, checkfn=None):\n if len(self) == 0:\n return None\n if checkfn is No... | [
"0.5694869",
"0.5662974",
"0.56016517",
"0.55177194",
"0.544953",
"0.5439609",
"0.53909516",
"0.537335",
"0.5364247",
"0.5350749",
"0.53295314",
"0.5328545",
"0.52704114",
"0.5237583",
"0.5216445",
"0.5216445",
"0.5216065",
"0.5210262",
"0.5208821",
"0.5197762",
"0.5170702",
... | 0.5758818 | 0 |
Finds the first occurrence of 'None' in the list of properties. | def find_first_none(self, properties):
for drink in properties:
iterate_drink = iter(drink)
next(iterate_drink)
for drink_property in iterate_drink:
split_property = drink_property.split(": ")[1].split(" //")[0]
if split_property == "None":
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_property(properties, key):\n matching = [prop.split('=').pop(1) for prop in properties\n if prop.startswith(key + '=')]\n if len(matching) > 1:\n raise ValueError('Property %r should appear only once in %r' %\n (key, properties))\n if '' in matching:\... | [
"0.6420576",
"0.6140944",
"0.56629044",
"0.5504727",
"0.5462736",
"0.5437577",
"0.53297234",
"0.52824485",
"0.5245571",
"0.52292776",
"0.5227138",
"0.5211976",
"0.51856893",
"0.5184328",
"0.5180561",
"0.5177724",
"0.516806",
"0.5162539",
"0.5130421",
"0.5128275",
"0.51195353"... | 0.8134218 | 0 |
Uses the found drink property to generate a sentence from one of the templates. | def generate_sentence(self, complete_property):
drink_property = complete_property.split(": ")[0]
property_type = complete_property.split(": ")[1].split("// ")[1]
template = self.get_template(property_type)
question = template.replace("{" + property_type + "}", drink_property)
r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_sentence(self):",
"def generate_language(self, properties):\n\n drink_property = self.find_drink_property(properties)\n\n if drink_property:\n return self.generate_sentence(drink_property)\n else:\n return \"\"",
"def linkTemplates(self, sentence):\n templa... | [
"0.6083435",
"0.6067856",
"0.60557234",
"0.58162034",
"0.5800545",
"0.57799345",
"0.57570976",
"0.5742893",
"0.5580341",
"0.5577429",
"0.55747986",
"0.5573053",
"0.55707955",
"0.55657536",
"0.5488579",
"0.5484002",
"0.5479624",
"0.54288805",
"0.538444",
"0.5365156",
"0.534202... | 0.66812485 | 0 |
Retrieves the correct template to ask a question with the found drink property and its type. | def get_template(self, property_type):
valid_templates = [s for s in self.templates if "{" + property_type +
"}" in s]
return choice(valid_templates) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def question_generator(self):\n self.status_conv = 'yes_no_question_asked'\n questions = config.questions\n if not self.voyage.get('voyageurs') and 'voyageur_add' not in self.infos_needed:\n self.infos_needed.append('voyageur_add')\n if self.infos_needed:\n if self... | [
"0.55158",
"0.54558504",
"0.53866625",
"0.5272962",
"0.5254931",
"0.5225667",
"0.5201388",
"0.51010674",
"0.50510913",
"0.5043558",
"0.4993756",
"0.49860686",
"0.49789208",
"0.497429",
"0.49692836",
"0.49514955",
"0.49476779",
"0.4947658",
"0.49140137",
"0.49097073",
"0.49053... | 0.5877344 | 0 |
Given a list of list of Results, return a named threetuple with the an item with the name of each function in self.stat_functions. Each of these items is itself a similar threetuple, but each item is, e.g., the maximum of the maximums of the results. | def statistics(self, results):
nt = namedtuple("Statistic", [n.__name__ for n in self.stat_functions])
s = []
for f_one in self.stat_functions:
inside = []
for f_two in self.stat_functions:
inside.append(f_two(f_one(r.results) for r in results))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_func_tuples():\n func_tuples = [\n ('met_gumeJ1_3sopt_tr20', 'Rel-UME J1', 'C1-.'),\n ('met_gumeJ5_3sopt_tr20', 'Rel-UME J5', 'r-^'),\n ('met_gfssdJ1_3sopt_tr20', 'Rel-FSSD J1', 'C4--'),\n ('met_gfssdJ5_3sopt_tr20', 'Rel-FSSD J5', 'b-x'),\n\n ('met_... | [
"0.56247234",
"0.5412346",
"0.52866143",
"0.5263205",
"0.5087793",
"0.50818396",
"0.50043947",
"0.50017667",
"0.49602503",
"0.49288338",
"0.49267918",
"0.48980197",
"0.4889592",
"0.488622",
"0.48502252",
"0.4846984",
"0.4838837",
"0.4835714",
"0.48321322",
"0.4820766",
"0.481... | 0.7310715 | 0 |
Measures voltage with specified range and resolution returns the voltage in float | def hp34401a_read_voltage_rng_res(hp_meter , v_range, v_resolution):
hp_meter.write("MEAS:VOLT:DC? " + str(v_range) + " , " + str(v_resolution))
return float(hp_meter.read()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def meas_voltage(instrument, v_range=10, resolution=0.003):\n return float(instrument.query('MEAS:VOLTage:DC? %s,%s' % (v_range, resolution)))",
"def dmm_measure_voltage(self,range=None,res=None):\n if range is None:\n return self.dmm.measure_voltage()\n elif res is None:\n ... | [
"0.8078823",
"0.7291037",
"0.67395306",
"0.67171156",
"0.63865334",
"0.63084126",
"0.62544125",
"0.6248933",
"0.62172204",
"0.61805737",
"0.6111289",
"0.6101917",
"0.6081985",
"0.60785013",
"0.60742426",
"0.60578114",
"0.6011588",
"0.59588313",
"0.59566176",
"0.59343493",
"0.... | 0.7613944 | 1 |
Connect to the resource manager returns the visa avalable resources | def resource_manager():
return visa.ResourceManager() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resources(self):\n return self.__resources",
"def resources(self):",
"def resources(self):\n return self._resources",
"def resources(self):\n return self._resources",
"def resources(self):\n return self._resources",
"def resources(self) -> pulumi.Output[Sequence['outputs.Machi... | [
"0.67140317",
"0.66184807",
"0.6323841",
"0.6323841",
"0.6323841",
"0.6289765",
"0.6227922",
"0.61894625",
"0.6173168",
"0.61393124",
"0.61299413",
"0.6100624",
"0.60945547",
"0.6082597",
"0.60609436",
"0.6056553",
"0.60070026",
"0.60023284",
"0.5967622",
"0.5967622",
"0.5967... | 0.6919788 | 0 |
r"""Set the rotation encryption angle. | def set_rotation_encryption_angle(self, angle: float = 0.0):
if not isinstance(angle, float):
raise Error.ArgumentError(f"Invalid rotation encryption angle ({angle}) with the type: `{type(angle)}`!\n"
"Only `float` is supported as the type of rotation encryption... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_rotation(self, angle):\n self._rotation = angle\n self._reset_slot_bounds()",
"def set_angle(self, angle=0.0):\n self.angle = angle",
"def setAngle(self,angle = 2.5):\n pass",
"def set_angle(self, angle_key: Union[EKT, str], v: float): # -> None:\n ...",
"def setA... | [
"0.76821864",
"0.7664807",
"0.7623878",
"0.7573403",
"0.73777705",
"0.7322487",
"0.7282922",
"0.72192645",
"0.7204377",
"0.7188211",
"0.7136866",
"0.7116",
"0.70408934",
"0.6965605",
"0.6953462",
"0.68693155",
"0.6801654",
"0.6785144",
"0.6744302",
"0.6738195",
"0.6714269",
... | 0.7831832 | 0 |
r"""Get the rotation encryption angle. | def get_rotation_encryption_angle(self):
return self.__rotation_encryption_angle | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rotation_angle(self):\n return self.container['rotation_angle']",
"def get_angle(self):\n return self.__angle",
"def get_rotation_angle(self, image):\n \n # TODO: Make real functionality\n return 0",
"def getAngle(self):\n return self.articulateEncoder.getDistanc... | [
"0.8083041",
"0.77014714",
"0.7632532",
"0.7602805",
"0.757247",
"0.757247",
"0.757247",
"0.7519369",
"0.7491308",
"0.74265724",
"0.7328161",
"0.7316984",
"0.7316984",
"0.7304388",
"0.7233309",
"0.7233309",
"0.7233309",
"0.7233309",
"0.7233309",
"0.7233309",
"0.7233309",
"0... | 0.8862042 | 0 |
r"""Set the flipping encryption angle. | def set_flipping_encryption_angle(self, angle: float = 0.0):
if not isinstance(angle, float):
raise Error.ArgumentError(f"Invalid flipping encryption angle ({angle}) with the type: `{type(angle)}`!\n"
"Only `float` is supported as the type of flipping encryption... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_flip(self, val):\n self.flip = val",
"def get_flipping_encryption_angle(self):\n return self.__flipping_encryption_angle",
"def change_angle(self, new_angle):\r\n self.angle = new_angle",
"def setAngle(self,angle = 2.5):\n pass",
"def set_angle(self, angle_key: Union[EKT... | [
"0.687286",
"0.6716123",
"0.6335325",
"0.631911",
"0.62229604",
"0.6197563",
"0.61540425",
"0.61160064",
"0.6096172",
"0.6092029",
"0.6060821",
"0.59996134",
"0.5961152",
"0.5952882",
"0.59395134",
"0.5930168",
"0.59186363",
"0.58813536",
"0.5878858",
"0.5869153",
"0.5830182"... | 0.7819768 | 0 |
r"""Get the flipping encryption angle. | def get_flipping_encryption_angle(self):
return self.__flipping_encryption_angle | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def angle(self) -> int:",
"def dec(self):\n return self.dec_angle",
"def get_rotation_encryption_angle(self):\n return self.__rotation_encryption_angle",
"def angle(self):\n return 0",
"def do_altangle(self):\n nave = 10000\n x, y, z, angle = cbp.phidget.main(nave)\n ... | [
"0.69854754",
"0.69019073",
"0.6742186",
"0.67042106",
"0.6651489",
"0.66482645",
"0.6533207",
"0.64979774",
"0.64979774",
"0.64979774",
"0.64794314",
"0.6459664",
"0.6430557",
"0.6385531",
"0.6371917",
"0.6272651",
"0.62631196",
"0.6236495",
"0.6236495",
"0.6233523",
"0.6155... | 0.86466706 | 0 |
r"""Record the commands executed on this vertex. | def record_commands(self, which_command):
name: str = which_command.name
if not {name}.issubset(['M', 'X', 'Z', 'S']):
raise Error.ArgumentError(f"Invalid command name: ({name})!\n"
"Only 'M', 'X', 'Z' and 'S' are supported as the "
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cmd(self):",
"def commands():",
"def getCommands(self):",
"def command(self):\n raise NotImplementedError",
"def send_command(self):\n self.connection.sendline(self.command_string)",
"def commands():\n pass",
"def commands():\n pass",
"def commands():\n pass",
"def comman... | [
"0.61793786",
"0.6094067",
"0.602336",
"0.6007731",
"0.5964867",
"0.5957468",
"0.5957468",
"0.5957468",
"0.5957468",
"0.5948331",
"0.58627695",
"0.5849966",
"0.5788477",
"0.57847494",
"0.5781361",
"0.57724094",
"0.5720134",
"0.570017",
"0.5694064",
"0.56798655",
"0.5619725",
... | 0.7000344 | 0 |
r"""Extract the shape (width and depth) of the brickwork graph. | def __extract_graph_shape(self):
circuit = UbqcClient.pb_to_circuit(self.program)
bw_pattern = transpile_to_brickwork(circuit)
# Get shape
input_ = bw_pattern.input_
c_out, q_out = bw_pattern.output_
output_ = c_out + q_out
width = len(input_)
depth = out... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shape(self):\n return self._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):\r\n return self._shape",
"def get_shap... | [
"0.6799083",
"0.6759419",
"0.6680564",
"0.6645674",
"0.66435516",
"0.65854514",
"0.6585352",
"0.6585352",
"0.6560133",
"0.6560133",
"0.65037256",
"0.65037256",
"0.6470245",
"0.6441111",
"0.64236134",
"0.640771",
"0.6388143",
"0.6370989",
"0.63567615",
"0.63567615",
"0.6356761... | 0.8227789 | 0 |
r"""Unpack the 'jsonrpc'. If it returns 'None', it means that this package is not a valid 'nanojsonrpc'. | def __nanojsonrpc_unpack(self, msg):
try:
pack = json.loads(msg)
if 'method' not in pack:
return None
else:
return pack
except:
traceback.print_exc()
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _to_jsonrpc_obj(self, jsonrpcstr):\n return jsonrpc.JsonRpcData.parse(jsonrpcstr)",
"def unpack(self, obj):\n if obj is None:\n return\n try:\n return json.loads(obj)\n except Exception:\n return obj",
"def deserialize(self, data: bytes) -> Tuple... | [
"0.5803789",
"0.50273216",
"0.4961875",
"0.49459934",
"0.49096018",
"0.481428",
"0.4790738",
"0.47715878",
"0.46917126",
"0.4691092",
"0.46623343",
"0.46461037",
"0.46326864",
"0.46255264",
"0.46226034",
"0.45934814",
"0.45853156",
"0.45608473",
"0.4556774",
"0.45548433",
"0.... | 0.7680492 | 0 |
r"""Build the computational task and wait until the server is ready. | def wait_for_server_ready(self, params):
hub_client = QTask()
hub_client.createBlindTask('ubqc', params)
ret = hub_client.waitBlindTask(1)
if ret is None:
return False
path, secret = ret
self.entry = f"{blindCompAddr}/{path}"
self.secret = secret
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start_task():\n get_results_from_message_queue()\n test_all_servers_connection()",
"def startworking():\r\n #In the future have the manager program or from the website implement this arguments to a route\r\n #the program will download the file from the website\r\n global exe_name\r\n global... | [
"0.6432607",
"0.6246477",
"0.62429965",
"0.61020225",
"0.6083216",
"0.599574",
"0.59782434",
"0.59643835",
"0.5950119",
"0.59165597",
"0.590544",
"0.5857419",
"0.58165723",
"0.5816266",
"0.5778847",
"0.57639843",
"0.5758075",
"0.5744319",
"0.57404524",
"0.57332975",
"0.573329... | 0.65602463 | 0 |
r"""Send back the action and payload messages. | def send_back(self, action, payload):
self.outbox.put({
'action': action,
'payload': payload
}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_actions(self, actions):\n pass",
"def send(self):\n if not self._actions:\n return\n\n res = self.post('send', actions=json.dumps(self._actions))\n\n # post did not throw an error, return results merged into queue.\n actions = self._actions\n self._ac... | [
"0.6587271",
"0.6376593",
"0.6189893",
"0.606109",
"0.59913003",
"0.598595",
"0.59647",
"0.58982563",
"0.589088",
"0.5882102",
"0.5869955",
"0.5846862",
"0.5741166",
"0.5741166",
"0.5728023",
"0.56684166",
"0.5653193",
"0.5647907",
"0.56305677",
"0.5621749",
"0.56120807",
"... | 0.7895519 | 0 |
r"""Send the shape and states to the server. Send the brickwork graph shape (width and depth) and the prepared single qubit states to the server as initializations. | def send_shape_and_states(self):
self.commit()
_init_ = PBUbpcInitState()
_init_.width = self.__width
_init_.depth = self.__depth
for vec in self.__states:
vec_buf = numpyMatrixToProtobufMatrix(vec)
_init_.vector.append(vec_buf)
init_stateBuf: b... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run(self):\n # Wait for the 'shot' message ready\n self.wait_for_messages()\n # Send the initial states to the server\n self.send_shape_and_states()\n # Wait for the 'method' message ready\n self.wait_for_messages()\n\n # Send the measurement angles to the serve... | [
"0.6251751",
"0.59237385",
"0.5545095",
"0.55293036",
"0.5435947",
"0.5407777",
"0.538332",
"0.53825194",
"0.5329985",
"0.5329985",
"0.5231303",
"0.52039856",
"0.5177441",
"0.51554495",
"0.5147407",
"0.5136584",
"0.5127621",
"0.5127243",
"0.5127018",
"0.5119841",
"0.51165813"... | 0.757424 | 0 |
r"""Send the angles in bulks during each sample. These bulks are set according to the circuit width. After sending the angles, this method is waiting to receive the measurement outcomes from the server. | def send_angle_bulks(self, col):
# The client calculates the encrypted angles and sends them in columns to the server
positions = [(row, col) for row in range(self.__width)]
# To obtain the angles, the client firstly calculates the adaptive angles according to the measurement pattern
# T... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sendAngles(initial_points):\r\n global client\r\n data=\"\"\r\n j=0\r\n for i in initial_points:\r\n data=data+str(i)\r\n j=j+1\r\n if j!=8:\r\n data=data+','\r\n data=data.encode('ascii') #utf 8\r\n client.send(data)\r\n GPIO.output(laserPin, False)",
"de... | [
"0.6074328",
"0.56332767",
"0.5486066",
"0.5418358",
"0.53618",
"0.5360894",
"0.53299695",
"0.52647793",
"0.5242403",
"0.5127472",
"0.5093138",
"0.5071435",
"0.5064532",
"0.5063558",
"0.5051008",
"0.5043908",
"0.50359464",
"0.50271934",
"0.5015845",
"0.49971628",
"0.49935338"... | 0.63659155 | 0 |
r"""Commit the quantum circuit program. The client commits the program and send shape and states to the server as initializations. | def commit(self):
# Translate ``PBProgram`` into ``Circuit``
self.__circuit = self.pb_to_circuit(self.program)
# Extract the graph shape and measurement pattern
self.__map_to_graph()
# Randomly generate a quantum state for each vertex on the graph
self.__states = self.p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def commitfunction(self, options=None):\r\n self.commitvalidation()\r\n\r\n self.rdmc.ui.printer(\"Committing changes...\\n\")\r\n\r\n if options:\r\n if options.biospassword:\r\n self.rdmc.app.current_client.bios_password = options.biospassword\r\n try:\r\n ... | [
"0.5821248",
"0.57690954",
"0.56880146",
"0.55607253",
"0.55180085",
"0.5473794",
"0.5459814",
"0.5459814",
"0.5459814",
"0.5459814",
"0.5459814",
"0.544512",
"0.5425148",
"0.54205984",
"0.54001385",
"0.53741693",
"0.53659123",
"0.5359183",
"0.5357696",
"0.53435636",
"0.53407... | 0.63489425 | 0 |
r"""Translate ``PBProgram`` into the ``Circuit`` class. | def pb_to_circuit(program: PBProgram):
pbCircuit = program.body.circuit
# Obtain the circuit width
bit_idxes = set()
for gate in pbCircuit:
bit_idxes.update(gate.qRegList)
width = max(bit_idxes) + 1
if width <= 0:
raise Error.ArgumentError(f"Inval... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def buildProtocol(self, addr):\n return CQCProtocol(self)",
"def create_circuit(self, circuit, database, str_obj, current_date):\r\n if self._circuit_type in (HC, DHW):\r\n return Circuit(self._connector, circuit[ID],\r\n database, str_obj, self._circuit_type,\r... | [
"0.56618744",
"0.5331011",
"0.5187735",
"0.5137056",
"0.50497925",
"0.49721202",
"0.4945648",
"0.49432555",
"0.48914114",
"0.4850682",
"0.4831941",
"0.4802609",
"0.4758475",
"0.47125328",
"0.47111407",
"0.47082394",
"0.4704771",
"0.4680674",
"0.4656181",
"0.4637845",
"0.46318... | 0.74321634 | 0 |
r"""Map the measurement pattern to the brickwork graph. | def __map_to_graph(self):
self.__bw_pattern = transpile_to_brickwork(self.__circuit)
# Get the shape
input_ = self.__bw_pattern.input_
c_out, q_out = self.__bw_pattern.output_
output_ = c_out + q_out
self.__width = len(input_)
self.__depth = output_[0][1] - input... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_band_maps(self):\n band_maps = []\n source_band_index = 1\n target_band_index = self.starting_target_band\n for band in self.image['bands']:\n band_maps.append({\n 'source': source_band_index,\n 'target': target_band_index\n ... | [
"0.5506858",
"0.5360557",
"0.5343412",
"0.52346903",
"0.51700467",
"0.5120323",
"0.5095809",
"0.5073153",
"0.5030257",
"0.5019325",
"0.49883944",
"0.4987375",
"0.49652192",
"0.4945309",
"0.4940075",
"0.4940075",
"0.4939405",
"0.49284822",
"0.49075362",
"0.48590413",
"0.485637... | 0.67906564 | 0 |
r"""Prepare the single qubit quantum states. Randomly generate a single qubit quantum state on each vertex. The rotation angle encryption method is implemented in this step. Record the corresponding rotation encryption angles for later calculations. | def prepare_states(self):
# Prepare random states
multiple_quarter_pi = [(i * pi) / 4 for i in range(8)]
zero_or_pi = [0, pi]
states = []
for pos in self.__client_knowledge.keys():
rand_ang = random.choice(multiple_quarter_pi).item()
rand_flip = random.cho... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def state_prepare(q: List[QRegStorage], i: int):\n\n RX(0.1)(q[i])\n RZ(0.4)(q[i + 1])\n CX(q[i], q[i + 1])\n RY(0.8)(q[i])\n RZ(1.2)(q[i])",
"def initQ(self,states,actions):\r\n \r\n Q = {}\r\n \r\n for a in actions:\r\n for s in states:\r\n Q... | [
"0.6429633",
"0.58192724",
"0.5809514",
"0.5754595",
"0.5748031",
"0.5742176",
"0.5703359",
"0.5695111",
"0.567054",
"0.56625265",
"0.5618352",
"0.55774224",
"0.5503754",
"0.5472713",
"0.54547924",
"0.54502994",
"0.54490477",
"0.54437107",
"0.5413868",
"0.54038066",
"0.540079... | 0.7020206 | 0 |
r"""Calculate and encrypt the angles. Calculate measurement angles of the tagged vertices. Encode the angles with rotation and flipping encryption method to protect the information. | def calculate_and_encrypt_angles(self, positions: List):
angles = []
for pos in positions:
vertex = self.__client_knowledge[pos]
cmds = vertex.get_commands()
for cmd in cmds:
if cmd.name == 'M':
# Calculate the adaptive angle
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _angle(u, v, w, d='+'):\n vu = np.arctan2(u[1] - v[1], u[0] - v[0])\n vw = np.arctan2(w[1] - v[1], w[0] - v[0])\n phi = vw - vu\n if phi < 0:\n phi += 2 * np.pi\n if d == '-':\n phi = 2 * np.pi - phi\n return np.round(phi, 6)",
"def to_angles(self) -> np.ndarray:\n phi ... | [
"0.5641576",
"0.5632437",
"0.55941254",
"0.55205256",
"0.54950446",
"0.54852414",
"0.5463608",
"0.5442967",
"0.5426747",
"0.5424956",
"0.5418363",
"0.54174584",
"0.53968275",
"0.538745",
"0.5375999",
"0.5370995",
"0.537096",
"0.53513694",
"0.53448325",
"0.53343356",
"0.533317... | 0.64447457 | 0 |
r"""Decrypt the measurement outcomes and record them on the corresponding vertices. | def decrypt_outcomes(self, positions: List[Tuple], outcomes: List[int]):
for idx in range(len(positions)):
# Decrypt and record the measurement outcome
pos = positions[idx]
self.__client_knowledge[pos].record_outcome(outcomes[idx]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def decrypt(self, data):",
"def record_outcome(self, outcome: int):\n self.__outcome = outcome if abs(self.__flipping_encryption_angle - 0) < eps else (outcome + 1) % 2",
"def do_android_decryption(self):\r\n self.aes_decryption_key = self.extract_aes_key()\r\n self.decrypt_device_file()\r... | [
"0.5672642",
"0.5539064",
"0.55196214",
"0.5416165",
"0.5363684",
"0.53419197",
"0.5320847",
"0.5291316",
"0.52534115",
"0.51761323",
"0.5121203",
"0.51132315",
"0.51014394",
"0.5088454",
"0.50398886",
"0.5021111",
"0.4992184",
"0.49677727",
"0.49600363",
"0.49541685",
"0.493... | 0.655149 | 0 |
r"""Obtain the result as classical output equivalent to the circuit model. | def get_classical_output(self):
# If the input is a pattern, return the bit string equivalent to the result in circuit model
if self.__circuit is not None:
c_out, q_out = self.__bw_pattern.output_
# Obtain the string
# Mark the classical outputs with their measuremen... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def output(self):\r\n self.logic ( )\r\n return self.output",
"def compute_output(self):\n x, y = self.input_nodes\n print(x.name, y.name)\n self.output_value = backend.dot(x.output_value, y.output_value)\n return self.output_value",
"def output(self):\r\n return self.r... | [
"0.6670716",
"0.66471785",
"0.6574949",
"0.652932",
"0.6307297",
"0.62847286",
"0.6278421",
"0.6181299",
"0.61508435",
"0.612818",
"0.6055076",
"0.60399354",
"0.600359",
"0.59883446",
"0.59669024",
"0.5932735",
"0.5919565",
"0.5910614",
"0.5910614",
"0.5897741",
"0.58919996",... | 0.7678445 | 0 |
Set TCP keepalive on an open socket. It activates after 30 second (after_idle_sec) of idleness, then sends a keepalive ping once every 10 seconds (interval_sec), and closes the connection after 5 failed ping (max_fails). | def _activate_keepalive(self, s, after_idle_sec=30, interval_sec=10,
max_fails=5):
s.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1)
s.setsockopt(socket.IPPROTO_TCP, socket.TCP_KEEPIDLE, after_idle_sec)
s.setsockopt(socket.IPPROTO_TCP, socket.TCP_KEEPINTVL, inte... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_tcp_keepalive(sock, opts):\n if hasattr(socket, \"SO_KEEPALIVE\"):\n if opts.get(\"tcp_keepalive\", False):\n sock.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1)\n if hasattr(socket, \"SOL_TCP\"):\n if hasattr(socket, \"TCP_KEEPIDLE\"):\n ... | [
"0.65047723",
"0.64213765",
"0.64208114",
"0.6031349",
"0.59054095",
"0.58553547",
"0.561841",
"0.5611427",
"0.55305564",
"0.5500599",
"0.5431652",
"0.52326274",
"0.5216221",
"0.51850253",
"0.5074396",
"0.50631684",
"0.5034353",
"0.49896207",
"0.4922601",
"0.4910667",
"0.4899... | 0.7825976 | 0 |
Add a list of initiators to the group | def AddInitiators(self, initiatorList):
# Append the IQNs to the existing list
full_iqn_list = self.initiators
for iqn in initiatorList:
if iqn.lower() in full_iqn_list:
mylog.debug(iqn + " is already in group " + self.name)
else:
full_iqn_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _add_init_walkers(self, init_walkers_grp, init_walkers):\n\n # add the initial walkers to the group by essentially making\n # new trajectories here that will only have one frame\n for walker_idx, walker in enumerate(init_walkers):\n walker_grp = init_walkers_grp.create_group(str... | [
"0.6401538",
"0.6272343",
"0.60600626",
"0.58041793",
"0.5789351",
"0.56194365",
"0.5617065",
"0.5616975",
"0.56085956",
"0.5479124",
"0.54735637",
"0.54340476",
"0.539979",
"0.5384303",
"0.53667593",
"0.53654844",
"0.5350756",
"0.53321654",
"0.53161263",
"0.5315354",
"0.5315... | 0.6818665 | 0 |
Remove a list of initiators from the group | def RemoveInitiators(self, initiatorList):
# Append the IQNs to the existing list
full_iqn_list = self.initiators
for iqn in initiatorList:
if iqn.lower() in full_iqn_list:
full_iqn_list.remove(iqn)
else:
mylog.debug(iqn + " is already not ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clear_Groups(self):\n\n\t\tself.__groups[:] = []",
"def remove_all(self):\n self.initial = None\n self.contour = None\n self.control_points = []",
"def remove_functional_groups(pct_C1A, pct_E1A, pct_H1A, atom_list):\n carboxyl_map = get_carboxyl_map(atom_list)\n epoxy_map = get_e... | [
"0.5837479",
"0.5836093",
"0.57362354",
"0.5716028",
"0.5688496",
"0.5629168",
"0.55928546",
"0.5570317",
"0.5550455",
"0.5475205",
"0.5469125",
"0.5352654",
"0.53408444",
"0.5338788",
"0.5317058",
"0.53153366",
"0.53083235",
"0.52959347",
"0.5294338",
"0.5292525",
"0.5281974... | 0.70759916 | 0 |
Add a list of volumes to the group | def AddVolumes(self, volumeIDList):
volume_ids = self.volumes
for vol_id in volumeIDList:
if vol_id not in volume_ids:
volume_ids.append(vol_id)
else:
mylog.debug("volumeID " + str(vol_id) + " is already in group")
# Add the requested volu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def volumes(self):",
"def add_volume(self, volume: 'Volume'):\n self.volumes.append(volume)",
"def part_volumes_to_part_groups(prefix=None):\r\n \r\n if prefix == None:\r\n prefix = \"part\"\r\n V = cubit.get_entities(\"volume\")\r\n for vid in V:\r\n cubit.cmd(f\"create group '{prefix}_{v... | [
"0.68015206",
"0.67666084",
"0.6716646",
"0.6319991",
"0.6299033",
"0.62065214",
"0.6198266",
"0.61014825",
"0.60651654",
"0.5899944",
"0.5883432",
"0.58666766",
"0.58539766",
"0.58322966",
"0.58215463",
"0.5802459",
"0.57540566",
"0.5698188",
"0.5658451",
"0.5650305",
"0.564... | 0.7598522 | 0 |
Remove a list of volumes from the group | def RemoveVolumes(self, volumeIDList):
volume_ids = self.volumes
for vol_id in volumeIDList:
if vol_id in volume_ids:
volume_ids.remove(vol_id)
else:
mylog.debug("volumeID " + str(vol_id) + " is already not in group")
# Remove the requeste... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete(self):\n for lv in self.logical_volumes:\n self.delete_lv(lv_name=lv)\n\n super().delete()",
"def delete_volumes(volumes):\n if type(volumes) is not list:\n volumes = [volumes]\n for volume in volumes:\n command = 'cinder delete %s' % volume['id']\n ... | [
"0.69334394",
"0.6926036",
"0.6154756",
"0.6030102",
"0.59953517",
"0.59704024",
"0.59559363",
"0.5938539",
"0.5913568",
"0.5806803",
"0.5803843",
"0.57413715",
"0.573327",
"0.57215476",
"0.57006043",
"0.56896573",
"0.5638064",
"0.5632837",
"0.5630152",
"0.56282383",
"0.56273... | 0.74104863 | 0 |
get dict of GA release versions with download url (version,url) | def GetVersions(url, requestedProduct, requestedVersion):
dictValidReleasesSorted = {}
response = requests.get(url)
if response.status_code == 200:
jsonResult = response.json()
jVersions = jsonResult[requestedProduct]["versions"]
dictValidReleases = {}
# do not want pre-relea... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def downloads_per_version(package):\n downloads = {}\n for release in package['files']:\n downloads[release['version']] = release['ndownloads']\n return downloads",
"def get_release_info(self, version):\r\n try:\r\n return self._detail[\"releases\"][version]\r\n except Ke... | [
"0.7447856",
"0.64105517",
"0.64060634",
"0.62913716",
"0.6216165",
"0.6138824",
"0.6128678",
"0.6063825",
"0.6026366",
"0.589802",
"0.58748233",
"0.5865873",
"0.58320105",
"0.58302414",
"0.5803629",
"0.5781473",
"0.5780344",
"0.5748138",
"0.5747969",
"0.5731726",
"0.57004255... | 0.6663025 | 1 |
Sets the member variable face_up to True. | def turn_face_up(self):
self.face_up = True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def flip_faceup(self):\r\n self.faceup = True",
"def flip(self):\n \n if self.faceup:\n self.faceup = False\n else:\n self.faceup = True",
"def turn_face_down(self):\n self.face_up = False",
"def face(self):\n\n return self.faceup",
"def up(se... | [
"0.83173066",
"0.72682965",
"0.7141126",
"0.65644455",
"0.63498414",
"0.6339938",
"0.6237461",
"0.6210182",
"0.6168868",
"0.60779077",
"0.60777",
"0.60500467",
"0.59910303",
"0.5962508",
"0.5962508",
"0.5899924",
"0.585252",
"0.5829014",
"0.5814699",
"0.58134353",
"0.57899606... | 0.8423325 | 0 |
print representation. If Card is face down print "XX", if face up print a string concatenation of the Card's rank and suit. | def __str__(self):
if not self.face_up:
return "XX"
else:
return self.rank + self.suit | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n #Create dictionary for face cards\n translate = {11:'Jack', 12:'Queen', 13:'King', 14: 'Ace'}\n r = self._rank\n #check for face card\n if r in [11, 12, 13, 14]:\n myrank = translate[r]\n else:\n myrank = str(r)\n return my... | [
"0.7931429",
"0.7738406",
"0.75782883",
"0.756145",
"0.7500392",
"0.7440657",
"0.741524",
"0.7385243",
"0.7335026",
"0.7335026",
"0.729739",
"0.72929245",
"0.7251104",
"0.72448933",
"0.7239434",
"0.7191585",
"0.71403146",
"0.7100049",
"0.7093703",
"0.7082051",
"0.70583767",
... | 0.7741225 | 1 |
Represent each Card as a concatenation of its rank and suit. | def __repr__(self):
return self.rank + self.suit | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return str(self.rank) + \" of \" + self.suit",
"def ascii_version_of_card(*cards):\n\n # we will use this to prints the appropriate icons for each card\n name_to_symbol = {\n 'Spades': '♠',\n 'Diamonds': '♦',\n 'Hearts': '♥',\n 'Clubs': '♣',\n ... | [
"0.71933305",
"0.71600074",
"0.71444017",
"0.7140631",
"0.70260257",
"0.70260257",
"0.6997441",
"0.69622666",
"0.6956081",
"0.69310045",
"0.69288784",
"0.6914523",
"0.67576605",
"0.6716822",
"0.66366667",
"0.6612663",
"0.6599204",
"0.6593373",
"0.6528129",
"0.65071744",
"0.65... | 0.7598367 | 0 |
Cards are == when one Card has the same rank or suit of another Card instance. | def __eq__(self, other_card):
if self.rank == other_card.rank or self.suit == other_card.suit:
return True
else:
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, card2):\n return self.suit == card2.suit and self.rank == card2.rank",
"def __eq__(self, other: Card) -> bool:\n return compare_map[self.number] == compare_map[other.number]",
"def __eq__(self, other):\n if isinstance(other, Card):\n return self.color == other.color and... | [
"0.87093216",
"0.78906995",
"0.77700496",
"0.74245775",
"0.7407949",
"0.7117948",
"0.7053784",
"0.70236933",
"0.6877931",
"0.687404",
"0.68026626",
"0.6787577",
"0.6734536",
"0.6732668",
"0.6705773",
"0.66778344",
"0.6657151",
"0.6649128",
"0.6634081",
"0.6603406",
"0.6591542... | 0.8623669 | 1 |
Initialize a new instance of the MalpediaApiClient. Optionally, login data for your useraccount on Malpedia can be provided. This can either be your username/password combination or an apitoken. | def __init__(self, username=None, password=None, apitoken=None):
self.__credentials = None
self.__headers = {}
if apitoken:
self.authenticate_by_token(apitoken)
if username and password:
self.authenticate(username, password) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n self.__client = Client(verify_ssl_cert=True)\n self.__headers = {'Content-Type': 'application/json'}\n self.login()",
"def __init__(self,\n identifier=None,\n password=None,\n silent=False):\n self.data_source = Res... | [
"0.6078029",
"0.60188925",
"0.59386134",
"0.58862054",
"0.5881831",
"0.5866019",
"0.5863781",
"0.5857012",
"0.584912",
"0.58312166",
"0.57963276",
"0.5779763",
"0.5771254",
"0.5763184",
"0.5688634",
"0.5668931",
"0.5654642",
"0.56512344",
"0.56465346",
"0.5640244",
"0.560855"... | 0.6360503 | 0 |
Set apitoken for authentication | def authenticate_by_token(self, apitoken):
self.__headers.update({'Authorization': 'APIToken {}'.format(apitoken)}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setAPIToken(self, APIToken):\n if APIToken == '':\n raise ValueError('WaPOR API ERROR: APIToken must be provided!')\n\n print('WaPOR API: Loading sign-in...')\n\n Token = self._query_accessToken(APIToken)\n if Token is None:\n sys.exit('WaPOR API ERROR: The dat... | [
"0.6807034",
"0.67766017",
"0.67592937",
"0.67153287",
"0.67153287",
"0.6612932",
"0.6571726",
"0.6528972",
"0.6482451",
"0.63543105",
"0.6310855",
"0.6297687",
"0.62971735",
"0.62858135",
"0.6276428",
"0.62476665",
"0.62433904",
"0.62388486",
"0.62260574",
"0.6212664",
"0.61... | 0.70078623 | 0 |
List all family IDs. This is a helper command to enable follow up commands family data. | def list_families(self):
return self.__make_api_call('list/families') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def family_ids(self):\n\n return self._family_ids",
"def get_families(self):\n return self.__make_api_call('get/families')",
"def show_families():\n print(f\"--- {request}\")\n print(f\"--- {user_session}\")\n # Set context by owner and the data selections\n u_context = UserContext(us... | [
"0.6774071",
"0.62483513",
"0.59472007",
"0.5878266",
"0.5858103",
"0.5792659",
"0.56311923",
"0.55710286",
"0.5554745",
"0.5547099",
"0.55317545",
"0.55209243",
"0.5483229",
"0.5455072",
"0.54524887",
"0.54416937",
"0.5433553",
"0.5347597",
"0.53431815",
"0.53423405",
"0.533... | 0.6817886 | 0 |
Provide a list of all samples known for a family, including their packed status and version, if available. | def list_samples(self, family_id):
return self.__make_api_call('list/samples/{}'.format(family_id)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fixture_lims_samples(lims_family: dict) -> List[dict]:\n return lims_family[\"samples\"]",
"def samples(self):\n if self._samples:\n return self._samples\n if SAMPLE_DF_KEY not in self or self[SAMPLE_DF_KEY] is None:\n _LOGGER.debug(\"No samples are defined\")\n ... | [
"0.6974945",
"0.6088159",
"0.60842144",
"0.6034202",
"0.5925121",
"0.58618534",
"0.5810834",
"0.57882965",
"0.57660747",
"0.57252336",
"0.571923",
"0.57102716",
"0.5656722",
"0.5647571",
"0.56275845",
"0.5617002",
"0.5613116",
"0.5583079",
"0.55587715",
"0.554309",
"0.5540035... | 0.75340974 | 0 |
Recursively templateexpand a json dict against itself or other context. The context for string expansion is the json dict itself by default, updated by extra_context, if supplied. | def ExpandJsonTemplate(json_data, extra_context=None, use_self=True):
if use_self:
context = dict(json_data)
else:
context = {}
if extra_context:
context.update(extra_context)
def RecursiveExpand(obj):
if isinstance(obj, list):
return [RecursiveExpand(x) for ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def json_leaf_subst(exp, substitutions):\n def do_subst(e):\n return json_leaf_subst(e, substitutions)\n if isinstance(exp, dict):\n return {do_subst(k): do_subst(v) for k, v in exp.items()}\n elif isinstance(exp, list):\n return [do_subst(e) for e in exp]\n elif exp in substitutio... | [
"0.6263145",
"0.55062026",
"0.54617023",
"0.53140074",
"0.52904445",
"0.5242427",
"0.5238454",
"0.521097",
"0.52007663",
"0.5114993",
"0.5110396",
"0.5087918",
"0.50575686",
"0.501296",
"0.49815476",
"0.4947743",
"0.4945792",
"0.4896503",
"0.48905617",
"0.4872648",
"0.4816023... | 0.8101806 | 0 |
Load strategy class from source code. | def load_strategy_class(self):
path2 = Path(__file__).parent.parent.joinpath("strategies")
self.load_strategy_class_from_folder(path2, "vnpy.app.cta_strategy.strategies") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_strategy_class_from_module(self, module_name: str):\n try:\n module = importlib.import_module(module_name)\n\n for name in dir(module):\n value = getattr(module, name)\n if (isinstance(value, type) and issubclass(value, CtaTemplate) and value is n... | [
"0.6564425",
"0.6439322",
"0.6280344",
"0.62121594",
"0.6048729",
"0.59623754",
"0.59397036",
"0.58810794",
"0.58753276",
"0.58429927",
"0.5803895",
"0.5726347",
"0.57133424",
"0.56495696",
"0.56377566",
"0.56054056",
"0.56054056",
"0.56054056",
"0.56054056",
"0.55943185",
"0... | 0.80725014 | 0 |
Load strategy class from certain folder. | def load_strategy_class_from_folder(self, path: Path, module_name: str = ""):
for dirpath, dirnames, filenames in os.walk(str(path)):
for filename in filenames:
if filename.endswith(".py"):
strategy_module_name = ".".join(
[module_name, fil... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_strategy_class(self):\n path2 = Path(__file__).parent.parent.joinpath(\"strategies\")\n self.load_strategy_class_from_folder(path2, \"vnpy.app.cta_strategy.strategies\")",
"def _load(self, directory):\n pass",
"def load_tactic(dpath, basedir):\n obj = utils.load_class(dpath, ba... | [
"0.8572109",
"0.6336423",
"0.62573045",
"0.60844946",
"0.5959619",
"0.5954883",
"0.59303445",
"0.59303445",
"0.5923612",
"0.5815755",
"0.5802761",
"0.58019274",
"0.57982206",
"0.57422316",
"0.5610737",
"0.55739915",
"0.5502566",
"0.5482146",
"0.5476485",
"0.54692924",
"0.5466... | 0.7651413 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.