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 |
|---|---|---|---|---|---|---|
return a list of daily active user's number from fday to tday list_dau(string, string) > [(date1, number),(date2, number)....] | def list_dau(self, fday=None, tday=None):
dayList = self._list_day(fday, tday)
return zip(dayList, map(self.get_dau,dayList)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_dnu(self, fday=None, tday=None):\n dayList = self._list_day(fday, tday)\n return zip(dayList, map(self.get_dnu,dayList))",
"def list_dru(self, fday=None, tday=None):\n dayList = self._list_day(fday, tday)\n return zip(dayList, map(self.get_dru, dayList))",
"def list_1day_re... | [
"0.6620056",
"0.6309599",
"0.59758997",
"0.5802438",
"0.57956535",
"0.56943685",
"0.5627751",
"0.5469425",
"0.5443203",
"0.5438407",
"0.54146814",
"0.5395156",
"0.5391407",
"0.5387446",
"0.5358644",
"0.53531444",
"0.53524244",
"0.5316009",
"0.53107053",
"0.5288596",
"0.524477... | 0.698419 | 0 |
return a list of daily new user count from fday to tday list_dnu(string, string) > [(date1, number),(date2, number)....] | def list_dnu(self, fday=None, tday=None):
dayList = self._list_day(fday, tday)
return zip(dayList, map(self.get_dnu,dayList)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def daily_nu_retained_list(self, fday, tday):\n dayList = self._list_day(fday, tday)\n nuBitmap = self.get_newuser_bitmap(dayList[0])\n return [[dayList.pop(0),nuBitmap.count()]]+zip(dayList, \n nuBitmap.retained_count(\n (self.make_bitmap(day, 'dau') for day in dayL... | [
"0.6231567",
"0.61673486",
"0.5928323",
"0.59187883",
"0.5866525",
"0.5760048",
"0.569305",
"0.5582512",
"0.5546978",
"0.55460864",
"0.55329823",
"0.54760313",
"0.5469638",
"0.54454017",
"0.5436413",
"0.5415394",
"0.53989375",
"0.53915197",
"0.53609246",
"0.5357363",
"0.53526... | 0.65512604 | 0 |
return a list of daily recharge user from fday to tday list_dru(string, string) > [(date1, number),(date2, number)....] | def list_dru(self, fday=None, tday=None):
dayList = self._list_day(fday, tday)
return zip(dayList, map(self.get_dru, dayList)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_dnu(self, fday=None, tday=None):\n dayList = self._list_day(fday, tday)\n return zip(dayList, map(self.get_dnu,dayList))",
"def list_dau(self, fday=None, tday=None):\n dayList = self._list_day(fday, tday)\n return zip(dayList, map(self.get_dau,dayList))",
"def list_1day_ren... | [
"0.6443582",
"0.64034295",
"0.623009",
"0.56880265",
"0.5655372",
"0.5651866",
"0.564741",
"0.5600894",
"0.5586883",
"0.550893",
"0.5490913",
"0.547018",
"0.54634684",
"0.54476035",
"0.54254186",
"0.5416896",
"0.54100335",
"0.54043245",
"0.5380861",
"0.5378769",
"0.53751934",... | 0.72135675 | 0 |
month active user count list_mau(string, string) > [(datetime1, int),(datetime2,int),....] | def list_mau(self, fday, tday):
lMonth = util.month1stdate(fday, tday)
return zip(lMonth, map(self.get_mau, lMonth)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_list(raw_log, name_trim=3):\n\n from datetime import datetime\n from pylab import bar\n import sys\n\n DATE_LEN = len('2011-07-13')\n USER_OFFSET = len('2011-07-14 11:44:50 +0100 ')\n\n def dt_str(date):\n return datetime.strptime(date, '%Y-%m-%d')\n\n names = set([x[USER_OFFSE... | [
"0.62334853",
"0.57585007",
"0.57420623",
"0.5714853",
"0.5684276",
"0.5655085",
"0.5636379",
"0.5579971",
"0.5564483",
"0.5531851",
"0.55261505",
"0.5498087",
"0.548091",
"0.5462009",
"0.54334414",
"0.54264325",
"0.54099953",
"0.53246653",
"0.53195345",
"0.5298838",
"0.52900... | 0.60527664 | 1 |
monthly retained au count from fday's month to tday's month | def get_month_retained(self, fday, tday):
lMdates1 = util.month1stdate(fday, tday)
return zip(lMdates1,
self.make_bitmap(lMdates1[0],'mau').retained_count(
(self._make_bitmap(date, 'mau') for date in lMdates1)
)
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_month_retained_nu(self, fday, tday):\n lMdates1 = util.month1stdate(fday, tday)\n MnuBitmap = self.get_newuser_bitmap(lMdates1[0], 'mnu')\n # logging.info('Newusers count: %s', MnuBitmap.count())\n return [[lMdates1.pop(0), MnuBitmap.count()]]+zip(lMdates1,\n Mnu... | [
"0.6672569",
"0.62987125",
"0.6180715",
"0.6180715",
"0.6054716",
"0.59777564",
"0.59424865",
"0.59252346",
"0.5888653",
"0.5800436",
"0.56387764",
"0.56354606",
"0.56292087",
"0.5623133",
"0.55945975",
"0.55874336",
"0.55698746",
"0.5569097",
"0.5564449",
"0.5555507",
"0.552... | 0.70685315 | 0 |
the day_list's retained number | def customized_nu_retained_list(self, base_day, day_list=[]):
nuBitmap = self.get_newuser_bitmap(base_day)
return [(base_day, nuBitmap.count())] + zip(day_list,
self._retained_value(base_day, day_list, 'dnu')) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def daily_nu_retained_list(self, fday, tday):\n dayList = self._list_day(fday, tday)\n nuBitmap = self.get_newuser_bitmap(dayList[0])\n return [[dayList.pop(0),nuBitmap.count()]]+zip(dayList, \n nuBitmap.retained_count(\n (self.make_bitmap(day, 'dau') for day in dayL... | [
"0.66599447",
"0.6587821",
"0.65465826",
"0.60205",
"0.6017111",
"0.5969282",
"0.5913317",
"0.58819413",
"0.5875",
"0.5732882",
"0.5592443",
"0.55561525",
"0.55371857",
"0.55371857",
"0.55320287",
"0.55305904",
"0.5509439",
"0.5489703",
"0.54586875",
"0.54564583",
"0.5434691"... | 0.66967237 | 0 |
Monthly newuser retained count from fday's month to tday's month | def get_month_retained_nu(self, fday, tday):
lMdates1 = util.month1stdate(fday, tday)
MnuBitmap = self.get_newuser_bitmap(lMdates1[0], 'mnu')
# logging.info('Newusers count: %s', MnuBitmap.count())
return [[lMdates1.pop(0), MnuBitmap.count()]]+zip(lMdates1,
MnuBitmap.ret... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_month_retained(self, fday, tday):\n lMdates1 = util.month1stdate(fday, tday)\n return zip(lMdates1,\n self.make_bitmap(lMdates1[0],'mau').retained_count(\n (self._make_bitmap(date, 'mau') for date in lMdates1)\n )\n )",
"def time_to_ge... | [
"0.5917517",
"0.5755253",
"0.57312965",
"0.56227034",
"0.5555815",
"0.5555815",
"0.54290843",
"0.5404086",
"0.53951263",
"0.53627604",
"0.53614926",
"0.5321834",
"0.52929085",
"0.52874464",
"0.52690727",
"0.5203386",
"0.51886326",
"0.51726",
"0.51640606",
"0.51446205",
"0.512... | 0.7083434 | 0 |
Save Active userid by bytes | def mapActiveUseridbyByte(self, date, bytes):
sDate = date.strftime(self.config.DATE_FORMAT)
reKey = self.config.dau_keys_conf['dau'].format(date=sDate)
redis_cli = self.get_redis_cli()
logging.debug('Save dau bytes: %s' % reKey)
redis_cli.set(reKey, bytes) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_user_binary(self):\n pass",
"def unique_id() -> bytes:",
"def save_user(username, data):\n\n hashed_username = base64.b64encode(Cryptography.hash(username).digest()).decode()\n\n file = open(getcwd() + Database.__DB_FILENAME, 'a')\n iv, ciphered_data = Cryptography.cipher(Cr... | [
"0.632549",
"0.6178723",
"0.61760354",
"0.58608997",
"0.5841522",
"0.5838396",
"0.573315",
"0.5715681",
"0.5681736",
"0.5624096",
"0.56176466",
"0.55770564",
"0.55703104",
"0.5565958",
"0.5564274",
"0.5561332",
"0.5561151",
"0.5555073",
"0.55295324",
"0.5499177",
"0.5499177",... | 0.66714823 | 0 |
Save new user id to redis | def saveNewUserIndex(self, date, userid):
sdate = date.strftime(self.config.DATE_FORMAT)
rKey = self.config.dau_keys_conf['newuser']
redis_cli = self.get_redis_cli()
rVar = int(userid)
if rVar > 0 and rVar <= self.config.MAX_BITMAP_LENGTH:
redis_cli.hse... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remote_addUsertoROSProxy(self, userID, key):\r\n # TODO: Should this be deferred to a separate thread due to flock,\r\n # which is a blocking call?\r\n with open(self._dbFile, \"a\") as bridgefile:\r\n fcntl.flock(bridgefile.fileno(), fcntl.LOCK_EX)\r\n bridgefi... | [
"0.6545983",
"0.6466247",
"0.6354471",
"0.632592",
"0.6316897",
"0.6177144",
"0.61616695",
"0.6116569",
"0.6108786",
"0.6086028",
"0.6067048",
"0.604179",
"0.60379833",
"0.6036393",
"0.6030325",
"0.6008857",
"0.5990812",
"0.59625053",
"0.5956559",
"0.5944245",
"0.5929398",
... | 0.6724656 | 0 |
Save userid map in filter | def mapFilter(self, filtername, filterclass, userid):
# logging.info('%s, %s, %s' % (filtername, filterclass, userid))
redis_cli = self.get_redis_cli()
f_conf = self.config.filter_keys_conf
rKey = f_conf[filtername].format(**{filtername:filterclass})
if not rKey:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_restriction_filters(self):\n self.restriction_filters[\"pk__exact\"] = self.request.user.pk",
"def put_in_all_user_data(user: dict):\n all_user_data[user.id] = user",
"def build_filters(self, filters = None):\n if filters is None:\n filters = {}\n \n orm_filter... | [
"0.6225589",
"0.6162454",
"0.58281606",
"0.5775371",
"0.55624676",
"0.55434847",
"0.5511031",
"0.5472781",
"0.542796",
"0.54275477",
"0.534353",
"0.53247994",
"0.5315343",
"0.5303231",
"0.5253455",
"0.5246797",
"0.52381027",
"0.5225199",
"0.5207084",
"0.5203287",
"0.5185454",... | 0.6455818 | 0 |
Test a default `OpenGridCalculation`. | def test_open_grid_default(fixture_sandbox, generate_calc_job, generate_inputs, file_regression):
entry_point_name = 'quantumespresso.open_grid'
inputs = generate_inputs()
calc_info = generate_calc_job(fixture_sandbox, entry_point_name, inputs)
retrieve_list = ['aiida.out']
# Check the attributes... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_analytical_vs_numerical():\n pass",
"def test_custom_operators():\n grid = UnitGrid([32])\n field = ScalarField.random_normal(grid)\n eq = PDE({\"u\": \"undefined(u)\"})\n\n with pytest.raises(ValueError):\n eq.evolution_rate(field)\n\n def make_op(state):\n return lambda... | [
"0.62130344",
"0.6079",
"0.5762294",
"0.57156706",
"0.56352454",
"0.56155866",
"0.558737",
"0.55560833",
"0.5538895",
"0.55245835",
"0.55214965",
"0.55104977",
"0.54938227",
"0.5489284",
"0.54879284",
"0.54682434",
"0.54079306",
"0.5377578",
"0.5354522",
"0.533948",
"0.533931... | 0.63426805 | 0 |
Test that launching `OpenGridCalculation` fails for invalid parameters. | def test_open_grid_invalid_parameters(fixture_sandbox, generate_calc_job, generate_inputs, parameters, message):
entry_point_name = 'quantumespresso.open_grid'
with pytest.raises(InputValidationError, match=message) as exception:
inputs = generate_inputs(parameters=parameters)
generate_calc_job... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_call_invalid_input(self):\r\n with self.assertRaises(ValueError):\r\n self.estimator1(42, confidence_level=0)",
"def test_Calc_exceptions(self, start, end):\n with pytest.raises(Exception):\n pycgmCalc.Calc(start, end, self.motion_data, self.cal_SM)",
"def test_work... | [
"0.699974",
"0.68922377",
"0.63716215",
"0.6369087",
"0.6369087",
"0.6369087",
"0.63488936",
"0.63426393",
"0.6314602",
"0.6308382",
"0.6302911",
"0.62998277",
"0.62965184",
"0.62629765",
"0.6258627",
"0.62300926",
"0.62217957",
"0.6191596",
"0.61804235",
"0.61721456",
"0.616... | 0.7746562 | 0 |
Add a new attribute into the node proto. | def add_attribute(node_proto, name, value):
node_proto.attribute.extend([make_attribute(name, value)]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_attribute(self, attr):\n self.attrs.add_attribute(attr)",
"def add_attribute(self, attr):\n self.add(attr)",
"def add_attribute(self, attr):\n self.attrs.add(attr)",
"def addAttr(self, *args):\n return _libsbml.XMLToken_addAttr(self, *args)",
"def add_attribute(a, name, ... | [
"0.7757362",
"0.7753363",
"0.7619156",
"0.74467003",
"0.73821914",
"0.72945756",
"0.7106788",
"0.7060583",
"0.7058705",
"0.6976361",
"0.6976361",
"0.6976361",
"0.69553506",
"0.695338",
"0.6871166",
"0.68544215",
"0.68179667",
"0.6810846",
"0.68059754",
"0.68059754",
"0.680597... | 0.85851234 | 0 |
Make a model from the standalone node proto. | def make_model_from_node(node_proto, inputs, use_weights=True):
output_dtype = 'float32' # Dummy value only
output_shape = [-99] # Dummy value only
graph_inputs = [
make_tensor_value_info(
name,
tensor_type(str(array.dtype)),
array.shape
) for name, arra... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_model(name, input_node):\n # Find the model class from its name\n all_models = models.get_models()\n net_class = [model for model in all_models if model.__name__ == name][0]\n\n # Construct and return the model\n return net_class({'data': input_node})",
"def create_model():\n\n class N... | [
"0.6363661",
"0.61383235",
"0.5979797",
"0.58858687",
"0.5739392",
"0.5698379",
"0.56832916",
"0.5664024",
"0.5632128",
"0.56059337",
"0.55155355",
"0.54902107",
"0.54748416",
"0.5455015",
"0.5433565",
"0.54228634",
"0.5422065",
"0.5415714",
"0.5391193",
"0.5381036",
"0.53736... | 0.7086583 | 0 |
Return the tensor type from a string descriptor. | def tensor_type(type_str):
return mapping.NP_TYPE_TO_TENSOR_TYPE[numpy.dtype(type_str.lower())] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_tf_dtype(dtype_str: str):\n\n return getattr(tf, dtype_str)",
"def GetFillerType(tensor):\n return GetFillerTypeCC(_stringify_tensor(tensor))",
"def find_type(token_string: str):\n if re.compile('\\d+').match(token_string):\n return 'number'\n elif re.compile('[a-zA-Z]').... | [
"0.68332165",
"0.6139723",
"0.5996745",
"0.5993566",
"0.59273565",
"0.5830803",
"0.58058137",
"0.5778419",
"0.57741016",
"0.5751861",
"0.5731568",
"0.56909007",
"0.56876546",
"0.5687581",
"0.5645747",
"0.5643299",
"0.5591748",
"0.5585924",
"0.5573337",
"0.55476564",
"0.554509... | 0.74962753 | 0 |
Send the file at path to the user. | def sendFile(self, path):
# Either guess the mime type or just send it as a binary file.
if self.guessMime:
mimeType = mimetypes.guess_type(path)
else:
mimeType = "application/octet-stream"
# Send the headers.
self.send_response(200)
self.send_header("Content-type", mimeType)
self.send_header("Cont... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_file(self, src: PathLike, dest: PathLike, force: bool = False):",
"def sendFile(self, fullfilename):\n raise NotImplementedError(\"Implement this method in child class\")",
"def send_file(self, model):\n\n fh = get_pdb_file(model)\n file_size = fh.tell()\n fh.seek(0)\n\n ... | [
"0.67026275",
"0.6564854",
"0.6519188",
"0.6504546",
"0.64413834",
"0.6382395",
"0.6359815",
"0.6308762",
"0.6304061",
"0.6292193",
"0.62851876",
"0.625056",
"0.61903024",
"0.61869633",
"0.61842865",
"0.6182969",
"0.6182969",
"0.6182969",
"0.6182969",
"0.6182969",
"0.6182969"... | 0.74117917 | 0 |
Send a 'File not found' message. | def send404(self):
self.send_error(404, "File not found") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_file_notfound(cls, filename):\n print(\n f\"{cls.ERROR_PREFIX} {cls.FILE_NOTFOUND_MESSAGE} '{realpath(filename)}'.\"\n )",
"def no_file():\n return Response(\n content=bytes(\n '%s not found'%(attempted_file or '<nothing>'), 'utf-8'\... | [
"0.78011924",
"0.7169846",
"0.7155913",
"0.7106986",
"0.7058713",
"0.68202394",
"0.6736542",
"0.66430175",
"0.656524",
"0.65633523",
"0.65381354",
"0.6518924",
"0.64828",
"0.64769375",
"0.6471448",
"0.6411573",
"0.63509583",
"0.630457",
"0.6302077",
"0.62958723",
"0.62926847"... | 0.810256 | 0 |
Send a listing of path. | def sendDirectoryListing(self, path):
dirList = os.listdir(path)
# Join the file names to path.
paths = [os.path.join(path, fName) for fName in dirList]
# Add a slash to the directories.
dirList = [(fName + '/') if os.path.isdir(fullPath) else fName
for fName, fullPath in zip(dirList, paths)]
self... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cmd_list (self, line):\r\n try:\r\n dir_list_producer = self.get_dir_list (line, 1)\r\n except os.error as why:\r\n self.respond ('550 Could not list directory: %s' % why)\r\n return\r\n self.respond (\r\n '150 Opening %s mode data connection... | [
"0.70634365",
"0.7022779",
"0.69982606",
"0.6610352",
"0.6605672",
"0.63330674",
"0.6325617",
"0.6307066",
"0.62820035",
"0.6252877",
"0.610724",
"0.60877264",
"0.60432553",
"0.6037773",
"0.5996308",
"0.5981452",
"0.598062",
"0.59574586",
"0.59285086",
"0.59263116",
"0.591517... | 0.7331996 | 0 |
Send a listing by names and paths. | def sendListing(self, names, paths, title=''):
lines = []
lines.append("<html>")
lines.append(" <head>")
lines.append(" <title>%s</title>" % title)
lines.append(" </head>")
lines.append(" <body>")
if title:
lines.append(" <h1>%s</h1>" % title)
lines.append(" <hr/>")
lines.append(" ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_POST_send_list(self):\n\t\tself.POST_list()\n\t\tlist = self.GET_data('/api/list/' + self.list_id)\n\t\tself.POST_data('/api/list/' + self.list_id + '/send', data=list)",
"def list(\n self,\n name,\n ):\n pass",
"def sendDirectoryListing(self, path):\n\t\tdirList = os.l... | [
"0.63623714",
"0.6312483",
"0.6124188",
"0.59823745",
"0.5936868",
"0.5931371",
"0.59255826",
"0.59164095",
"0.58563155",
"0.5842743",
"0.58041847",
"0.55494356",
"0.5503951",
"0.5442194",
"0.5442194",
"0.54312557",
"0.5411753",
"0.5410703",
"0.5400167",
"0.5389843",
"0.53662... | 0.78252655 | 0 |
Defines and returns the protocol value generators | def _define_generators(self):
return {
"transaction_id" : Mgcp._generate_uint32,
"connection_id" : Mgcp._generate_uint32,
"request_id" : Mgcp._generate_uint32,
"timestamp" : Mgcp._generate_timestamp
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generator(self):\n return [None, 1]",
"def gen_values(self):",
"def semigroup_generators(self):",
"def _generators(group):\n gens = []\n for sym in group.symbols:\n elm = ((sym, 1),)\n gens.append(group.dtype(elm))\n return tuple(gens)",
"def gen_python... | [
"0.630191",
"0.62673",
"0.62457466",
"0.6177473",
"0.6140096",
"0.5973871",
"0.5969784",
"0.59614086",
"0.5907352",
"0.590466",
"0.574873",
"0.5698908",
"0.56868297",
"0.5666145",
"0.56592244",
"0.56570387",
"0.56349474",
"0.5632107",
"0.561709",
"0.560073",
"0.55836314",
"... | 0.6762195 | 0 |
Returns a random uint32 value | def _generate_uint32():
return str(randint(1, 4294967295)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_random_value():\n return randint(0, 255) / 256.0",
"def get_random_value():\n return randint(0, 255) / 256.0",
"def generate_random_num():\n return (long(hexlify(urandom(7)), 16) >> 3) * 2**(-53)",
"def get_random_id() -> int:\n return uuid.uuid1().int >> 64",
"def _rand... | [
"0.72648543",
"0.7255254",
"0.70593876",
"0.6857578",
"0.6808352",
"0.6782035",
"0.6782035",
"0.67691225",
"0.66859996",
"0.6656584",
"0.6626043",
"0.65611887",
"0.65611887",
"0.6533535",
"0.6503983",
"0.65000105",
"0.6447885",
"0.6395236",
"0.6367658",
"0.6359026",
"0.635502... | 0.7800026 | 0 |
Generates and returns the requested value of a variable or None | def generate_value(self, variable):
if variable in self._generators:
return self._generators[variable]() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(self, var):\n s = self.eval('{0}'.format(var))\n return self.strip_answer(s)",
"def get(self, var):\n return getattr(self, 'var_%s' % (var,))",
"def _get_value(self, value, context):\n try:\n var_value = template.Variable(value).resolve(context)\n except te... | [
"0.6947986",
"0.6633339",
"0.6539387",
"0.63346124",
"0.6260134",
"0.6240084",
"0.6228276",
"0.6228086",
"0.6160614",
"0.61591256",
"0.61347675",
"0.60706913",
"0.6058947",
"0.60102016",
"0.6004088",
"0.597262",
"0.59364474",
"0.5928341",
"0.59007955",
"0.58775944",
"0.585574... | 0.709515 | 0 |
Connect to PyVideo website and scrape (or try to) PyVideo PK. | def fetch_pyvideo_pk(self):
url = 'http://pyvideo.org/search?models=videos.video&q={0}'.format(self.full_name.replace(" ", "+"))
soup = BeautifulSoup(requests.get(url).content).findAll("a")
if soup:
for link in soup:
if link.string == self.full_name:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_vid(self):\n\n self.driver.get(self.website)",
"def _get_video_from_html(self, results_page, verbose=False):\n d = json.loads(results_page.text)\n for record in d['data']['records']:\n video_url = record['videoUrl']\n if verbose:\n print \"Video u... | [
"0.59518903",
"0.55197555",
"0.5473497",
"0.54715735",
"0.5396383",
"0.53909",
"0.52776754",
"0.5243362",
"0.5238877",
"0.519511",
"0.5167664",
"0.51548046",
"0.51472884",
"0.5141542",
"0.5131429",
"0.51197267",
"0.5096039",
"0.50889367",
"0.5085641",
"0.50751436",
"0.5072419... | 0.6263298 | 0 |
Connects to Django People website and searches and scrapes for people details if nobody by ``full_name`` currently exists. Searches for ``full_name`` and then adds ``people`` username to object. | def fetch_full_name_from_people(self):
url = 'https://people.djangoproject.com/search/?q={0}'.format(self.full_name.replace(" ", "+"))
request = requests.get(url)
soup = BeautifulSoup(request.content)
vcards = soup.findAll("li", { "class" : "vcard" })
if len(vcards) == 1:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_person_to_db(self):\n fullname = self.AddPerson.add_person_to_db(self.sql)\n if fullname:\n self.fullname.setText(fullname)\n # likely same name as before so no triggered search\n self.search_people_by_name()",
"def test_05_get_person_by_name(self):\n ... | [
"0.62304384",
"0.59128976",
"0.58951294",
"0.5783018",
"0.572836",
"0.56885797",
"0.56578445",
"0.5657426",
"0.5539933",
"0.5507447",
"0.5398087",
"0.5374069",
"0.53498113",
"0.5345692",
"0.5321263",
"0.5296362",
"0.5243791",
"0.52363265",
"0.5234286",
"0.5226458",
"0.5225734... | 0.7778408 | 0 |
Connect to Django People website and scrape people details. | def fetch_people_details(self, people):
request = requests.get(self.get_people_url())
soup = BeautifulSoup(request.content)
try:
services = soup.findAll("ul", { "class" : "services" })[0].contents
except IndexError:
return False
links = []
for li i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _deep_data(self, url):\n def _nested_persons(persons):\n _persons = list()\n for person_ in persons:\n person_ = [r.text.split(', ') for r in person_.find_all(class_='default-text')]\n person = {'name': person_[0][0].title()}\n if len(pe... | [
"0.62518626",
"0.6177812",
"0.6150268",
"0.6033819",
"0.59793437",
"0.5970507",
"0.5877717",
"0.5869899",
"0.58593786",
"0.56487674",
"0.5641228",
"0.5625349",
"0.5622908",
"0.562158",
"0.55962384",
"0.55294704",
"0.54713655",
"0.5444292",
"0.54137266",
"0.54136795",
"0.53995... | 0.69490105 | 0 |
Returns the horsepower at full throttle at a given rpm and altitude. | def _hp_at_FT(rpm, altitude):
# get density ratio from the altitude
DR = SA.alt2density_ratio(altitude)
# get power at rpm
hp_sl = HP_FT[rpm]['hp_sl']
hp_23K = HP_FT[rpm]['hp_23K']
hp_at_FT = hp_sl - (1 - DR) * (hp_sl - hp_23K) / (1 - DR_23K)
return hp_at_FT | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _pwr_std_temp(rpm, MP, altitude):\n # get the power at sea level (i.e. point B on the left side of the Lycoming power chart)\n \n # get pwr at two even hundreds of rpm, and then interpolate\n if rpm >= 2600:\n rpm1 = 2600\n elif rpm <= 1800:\n rpm1 = 1800\n else:\n rpm1 =... | [
"0.670079",
"0.6492461",
"0.60579807",
"0.57500625",
"0.5696251",
"0.5591175",
"0.5575474",
"0.5567831",
"0.5548539",
"0.5548411",
"0.5490819",
"0.5474912",
"0.5444569",
"0.54275835",
"0.5416151",
"0.5413709",
"0.5355762",
"0.5347962",
"0.5345135",
"0.5331719",
"0.5326029",
... | 0.70600414 | 0 |
Returns the power and density ratio at a given rpm and MP at full throttle. | def _hp_at_MP_and_altitude(rpm, MP):
# get density ratio for this MP and altitude, at full throttle
DR = _DR_FT_from_MP(rpm, MP)
# get power at this condition
altitude = SA.density_ratio2alt(DR)
hp = _hp_at_FT(rpm, altitude)
return hp, DR | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _pwr_std_temp(rpm, MP, altitude):\n # get the power at sea level (i.e. point B on the left side of the Lycoming power chart)\n \n # get pwr at two even hundreds of rpm, and then interpolate\n if rpm >= 2600:\n rpm1 = 2600\n elif rpm <= 1800:\n rpm1 = 1800\n else:\n rpm1 =... | [
"0.6615068",
"0.6342144",
"0.61372244",
"0.6133213",
"0.60578066",
"0.59942627",
"0.59933364",
"0.5912659",
"0.5883268",
"0.58807445",
"0.58509046",
"0.5815233",
"0.57769156",
"0.5711127",
"0.5676773",
"0.56375843",
"0.5597784",
"0.55970603",
"0.55600506",
"0.5537246",
"0.550... | 0.6720952 | 0 |
Returns the power at a given rpm, MP and altitude, assuming standard temperature. Units are n/mn, inches HG and feet. | def _pwr_std_temp(rpm, MP, altitude):
# get the power at sea level (i.e. point B on the left side of the Lycoming power chart)
# get pwr at two even hundreds of rpm, and then interpolate
if rpm >= 2600:
rpm1 = 2600
elif rpm <= 1800:
rpm1 = 1800
else:
rpm1 = rpm - rpm % 1... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pwr2rpm(pwr_seek, mp, altitude, temp = 'std', alt_units = 'ft', temp_units = 'C'):\n if pwr_seek <= 0:\n raise ValueError('Power input must be positive.')\n \n low = 1000 # initial lower guess\n high = 3500 # initial upper guess\n \n # convert units\n altitude = U.length_conv(altitu... | [
"0.69039404",
"0.6740712",
"0.6738658",
"0.64742",
"0.64158833",
"0.6351504",
"0.6351504",
"0.63121146",
"0.6304462",
"0.62660545",
"0.6239026",
"0.62374496",
"0.6228267",
"0.6183972",
"0.61825836",
"0.61109763",
"0.61054134",
"0.6067542",
"0.6014959",
"0.59840876",
"0.585831... | 0.7703537 | 0 |
Returns rpm for a given power, manifold pressure in inches of mercury, altitude and temperature (temperature input is optional standard temperature is used if no temperature is input). | def pwr2rpm(pwr_seek, mp, altitude, temp = 'std', alt_units = 'ft', temp_units = 'C'):
if pwr_seek <= 0:
raise ValueError('Power input must be positive.')
low = 1000 # initial lower guess
high = 3500 # initial upper guess
# convert units
altitude = U.length_conv(altitude, from_unit... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pp2rpm(percent_power, mp, altitude, temp = 'std', alt_units = 'ft', temp_units = 'C'):\n if percent_power <= 0:\n raise ValueError('Power input must be positive.')\n \n # convert units\n altitude = U.length_conv(altitude, from_units = alt_units, to_units = 'ft')\n if temp == 'std':\n ... | [
"0.71735984",
"0.6596666",
"0.59406704",
"0.56952935",
"0.56731164",
"0.5643142",
"0.56012374",
"0.554671",
"0.5536405",
"0.55148995",
"0.54533124",
"0.54533124",
"0.54484093",
"0.54293174",
"0.5422299",
"0.5390276",
"0.53767127",
"0.53346664",
"0.53286195",
"0.5326111",
"0.5... | 0.69650304 | 1 |
Returns manifold pressure in inches of mercury for a given percent power, rpm, altitude and temperature (temperature input is optional standard temperature is used if no temperature is input). | def pp2mp(percent_power, rpm, altitude, temp = 'std', alt_units = 'ft', temp_units = 'C'):
if percent_power <= 0:
raise ValueError('Power input must be positive.')
# convert units
altitude = U.length_conv(altitude, from_units = alt_units, to_units = 'ft')
if temp == 'std':
temp = SA... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_corrected_ppm(self, temperature, humidity):\n return self.PARA * math.pow((self.get_corrected_resistance(temperature, humidity)/ self.RZERO), -self.PARB)",
"def get_corrected_ppm(self, temperature, humidity):\n return self.PARA * math.pow((self.get_corrected_resistance(temperature, humidity... | [
"0.65014714",
"0.65014714",
"0.63899237",
"0.59763074",
"0.59597296",
"0.5883668",
"0.5803995",
"0.5763793",
"0.57419235",
"0.5715115",
"0.570593",
"0.5679901",
"0.5630766",
"0.5620599",
"0.56155676",
"0.5601011",
"0.555446",
"0.55525005",
"0.55443466",
"0.55443466",
"0.55203... | 0.67535824 | 0 |
Returns rpm for a given percent power, manifold pressure in inches of mercury, altitude and temperature (temperature input is optional standard temperature is used if no temperature is input). | def pp2rpm(percent_power, mp, altitude, temp = 'std', alt_units = 'ft', temp_units = 'C'):
if percent_power <= 0:
raise ValueError('Power input must be positive.')
# convert units
altitude = U.length_conv(altitude, from_units = alt_units, to_units = 'ft')
if temp == 'std':
temp = SA... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pwr2rpm(pwr_seek, mp, altitude, temp = 'std', alt_units = 'ft', temp_units = 'C'):\n if pwr_seek <= 0:\n raise ValueError('Power input must be positive.')\n \n low = 1000 # initial lower guess\n high = 3500 # initial upper guess\n \n # convert units\n altitude = U.length_conv(altitu... | [
"0.68735087",
"0.6423172",
"0.63714904",
"0.6005841",
"0.5990971",
"0.594612",
"0.583089",
"0.57211035",
"0.57211035",
"0.5715193",
"0.57012266",
"0.5642623",
"0.55627835",
"0.5549153",
"0.55039245",
"0.5480494",
"0.54797935",
"0.5476903",
"0.54455596",
"0.542765",
"0.5405806... | 0.78760576 | 0 |
Returns fuel flow at best power, in lb/h From Curve No. 12699B in Lycoming Operator's Manual | def _pwr_ff_best_power(N, pwr):
# validate_rpm(N)
if N == 2700:
return 53.3 + (pwr - 90) * (93.6 - 53.3) / (200. - 90.)
elif N == 2600:
return 51.2 + (pwr - 90) * (90. - 51.2) / (193.3 - 90.)
elif N == 2400:
return 49.7 + (pwr - 90) * (81.7 - 49.7) / (176.7 - 90.)
eli... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calc_lhv(self):\n hf = {}\n hf['hydrogen'] = 0\n hf['methane'] = -74.85\n hf['ethane'] = -84.68\n hf['propane'] = -103.8\n hf['butane'] = -124.51\n hf['O2'] = 0\n hf['CO2'] = -393.5\n # water (gaseous)\n hf['H2O'] = -241.8\n\n lhv = 0... | [
"0.63183665",
"0.629093",
"0.6248991",
"0.624371",
"0.6232027",
"0.60740834",
"0.6030377",
"0.6027853",
"0.60199505",
"0.6013861",
"0.59962744",
"0.599177",
"0.5989713",
"0.5986974",
"0.5937368",
"0.5929905",
"0.591661",
"0.5904691",
"0.585351",
"0.58510935",
"0.58057076",
... | 0.6351001 | 0 |
Combine any number of fits headers such that keywords that have the same values in all input headers are unchanged, while | def _combine_headers(headers, constant_only=False):
# Allowing the function to gracefully handle being given a single header
if len(headers) == 1:
return headers[0]
uniform_cards = []
varying_keywords = []
n_vk = 0
for kwd in headers[0]:
# Skip checksums etc
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_merge_dim_header():\n hdr_in_1 = Hdr_Ext.from_header_ext(\n {'SpectrometerFrequency': [100.0, ],\n 'ResonantNucleus': ['1H', ],\n 'dim_5': 'DIM_DYN',\n 'dim_5_info': 'averages',\n 'dim_5_header': {'p1': [1, 2, 3, 4],\n 'p2': [0.1, 0.2, 0.3... | [
"0.5799495",
"0.5686598",
"0.56252605",
"0.5619651",
"0.5615397",
"0.55856574",
"0.55434674",
"0.54822385",
"0.54761225",
"0.5379256",
"0.53553313",
"0.5330749",
"0.52825344",
"0.52711296",
"0.5252939",
"0.5252573",
"0.5206664",
"0.51434076",
"0.5115514",
"0.5094145",
"0.5069... | 0.733437 | 0 |
Given an x,y coordinates (single or lists) and size, return the bounds of the described area(s) as [[[x_min, x_max],[y_min, y_max]],...]. | def _get_bounds(x, y, size):
x = np.array(np.atleast_1d(x))
y = np.array(np.atleast_1d(y))
lower_x = np.rint(x - size[0]/2)
lower_y = np.rint(y - size[1]/2)
return np.stack((np.stack((lower_x, lower_x + size[0]), axis=1),
np.stack((lower_y, lower_y + size[1]), axis=1)), axis=1... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def board_bounds(live_coords):\n if not live_coords:\n return False\n min_x = live_coords[0][0]\n max_x = live_coords[0][0]\n min_y = live_coords[0][1]\n max_y = live_coords[0][1]\n for i, j in live_coords:\n if min_x > i:\n min_x = i\n if i > max_x:\n m... | [
"0.6869538",
"0.68198854",
"0.6816402",
"0.6756755",
"0.6665868",
"0.65528995",
"0.65258133",
"0.6500829",
"0.64815795",
"0.6465483",
"0.6446766",
"0.63004136",
"0.62841725",
"0.6254205",
"0.62494695",
"0.6247865",
"0.62260747",
"0.6160301",
"0.6155341",
"0.61469406",
"0.6137... | 0.78856486 | 0 |
Given two bounds of the form [[x_min, x_max],[y_min, y_max]], combine them into a new [[x_min, x_max],[y_min, y_max]], that encompasses both initial bounds. | def _combine_bounds(bounds1, bounds2):
bounds_comb = np.zeros((2, 2), dtype=int)
bounds_comb[0, 0] = bounds1[0, 0] if (bounds1[0, 0] < bounds2[0, 0]) else bounds2[0, 0]
bounds_comb[1, 0] = bounds1[1, 0] if (bounds1[1, 0] < bounds2[1, 0]) else bounds2[1, 0]
bounds_comb[0, 1] = bounds1[0, 1] if (boun... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mergeBounds(*bounds):\n\n nbounds = len(bounds)\n bounds = np.array(bounds)\n\n if bounds.shape not in ((nbounds, 3, 2), (nbounds, 2, 3)):\n raise ValueError('Unsupported bounds format')\n\n if bounds.shape == (nbounds, 2, 3):\n return ((bounds[:, 0, 0].min(),\n bound... | [
"0.69966906",
"0.6769878",
"0.6535141",
"0.6497234",
"0.6414492",
"0.6247782",
"0.62471914",
"0.6203231",
"0.6150096",
"0.6117266",
"0.6086078",
"0.6039834",
"0.60175997",
"0.60116065",
"0.59889466",
"0.59405684",
"0.5907305",
"0.5903815",
"0.5848121",
"0.5842611",
"0.5817277... | 0.7729071 | 0 |
Given bounds of the form [[x_min, x_max],[y_min, y_max]] return the area of the described rectangle. | def _area(bounds):
return (bounds[0, 1] - bounds[0, 0]) * (bounds[1, 1] - bounds[1, 0]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rect_area(rect):\n return rect[2] * rect[3]",
"def area_rect(w, h):\n return w * h",
"def rectangle_area(coordinates):\n return (coordinates[2] - coordinates[0]) * (coordinates[3] - coordinates[1])",
"def rectangle_area(base, height):\n return (base * height)",
"def rectArea(base, height):\... | [
"0.76508164",
"0.7607309",
"0.7462141",
"0.73754925",
"0.721451",
"0.71700054",
"0.7097508",
"0.704826",
"0.6900583",
"0.68721724",
"0.683904",
"0.6800166",
"0.67838025",
"0.67597103",
"0.6751761",
"0.6751761",
"0.6746655",
"0.67107785",
"0.6704145",
"0.67017585",
"0.6648099"... | 0.8262736 | 0 |
Given a moving target path (list of RA/Decs) and size, that intersects with the given cutout(s) make a cutout of requested size centered on the moving target given by the path. | def _moving_target_focus(path, size, cutout_fles, verbose=False):
cutout_table_list = list()
tck_tuple, u = splprep([path["position"].ra, path["position"].dec], u=path["time"].jd, s=0)
for fle in cutout_fles:
if verbose:
print(fle)
# Get the stuff we need ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def center_on_path(path, size, cutout_fles, target=None, img_wcs=None,\n target_pixel_file=None, output_path=\".\", verbose=True):\n \n # TODO: add ability to take sizes like in rest of cutout functionality\n\n # Performing the path transformation\n cutout_table = _moving_target_focus... | [
"0.7138738",
"0.63598895",
"0.56742024",
"0.5386771",
"0.5287139",
"0.5232938",
"0.510237",
"0.50108963",
"0.49303722",
"0.48880568",
"0.48866424",
"0.48665816",
"0.48274443",
"0.48237738",
"0.47727922",
"0.47414395",
"0.47374746",
"0.47060817",
"0.46201524",
"0.4613498",
"0.... | 0.6800931 | 1 |
Given a newly created bintable header (as from `~astropy.io.fits.table_to_hdu`) and a list of headers from the tables that went into the new header, add additional common header keywords and more desctiption to the new header. | def _configure_bintable_header(new_header, table_headers):
# Using a single header to get the column descriptions
column_info = {}
for kwd in table_headers[0]:
if "TTYPE" not in kwd:
continue
colname = table_headers[0][kwd]
num = kwd.replace("TTYPE", "")
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prep_hd(header,phi_c,lambda_c,nx,ny,dx,dy):\n header_out = {}\n\n # Keywords to get from original header\n keys_hd = ['TELESCOP', 'INSTRUME', 'WAVELNTH', 'CAMERA','DATE',\n 'DATE_S','DATE-OBS','T_OBS','T_REC','TRECEPOC',\n 'TRECSTEP','TRECUNIT','HARPNUM','DSUN_OBS','DSUN_RE... | [
"0.6774337",
"0.6661465",
"0.665646",
"0.6616434",
"0.64184505",
"0.6383746",
"0.6383746",
"0.6298094",
"0.629399",
"0.62851006",
"0.6249765",
"0.61971784",
"0.6165865",
"0.6146064",
"0.61333174",
"0.61258274",
"0.6120721",
"0.61159694",
"0.6111397",
"0.6100222",
"0.6098012",... | 0.79569393 | 0 |
Given a path that intersects with a wcs footprint, return one or more rectangles that fully contain that intersection (plus padding given by 'size') with each rectangle no more than max_pixels in size. | def path_to_footprints(path, size, img_wcs, max_pixels=10000):
x, y = img_wcs.world_to_pixel(path)
# Removing any coordinates outside of the img wcs
valid_locs = ((x >= 0) & (x < img_wcs.array_shape[0])) & ((y >= 0) & (y < img_wcs.array_shape[1]))
x = x[valid_locs]
y = y[valid_locs]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _find_largest_rects_in_hatch(x, y):\n if x < y: # Swap to iterate over the longest side.\n x, y = y, x\n\n rectangles = []\n for i in range(1, x): # Iterate over lower-edge vertices, ignoring corners\n a0, a1 = i, -i # Slope-intercepts for cross-hatch lines runni... | [
"0.5685092",
"0.5446693",
"0.5385235",
"0.5366063",
"0.52890813",
"0.5228987",
"0.5125484",
"0.51109153",
"0.50914407",
"0.50815177",
"0.50282264",
"0.50261223",
"0.49894777",
"0.4983141",
"0.4979613",
"0.4957106",
"0.49483976",
"0.4947643",
"0.49133795",
"0.4893948",
"0.4852... | 0.62847596 | 0 |
Given a moving target path that crosses through one or more cutout files (as produced by `cube_cut`/tesscut) and size, create a target pixel file containint a cutout of the requested size centered on the moving target given in the providedpath. | def center_on_path(path, size, cutout_fles, target=None, img_wcs=None,
target_pixel_file=None, output_path=".", verbose=True):
# TODO: add ability to take sizes like in rest of cutout functionality
# Performing the path transformation
cutout_table = _moving_target_focus(path, size, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cutout(\n target: str,\n shape: tuple = (5, 5),\n sector: Optional[int] = None,\n author: str = \"spoc\",\n provider: Optional[str] = None,\n images: Optional[int] = None,\n) -> TargetPixelFile:\n locresult = locate(target=target, sector=sector)\n if len(locresult) < 1:\n raise V... | [
"0.6465677",
"0.6090466",
"0.5607592",
"0.55311257",
"0.54175925",
"0.5325717",
"0.52325934",
"0.52054775",
"0.51983786",
"0.51669884",
"0.5157434",
"0.5153647",
"0.5041355",
"0.50405926",
"0.50332725",
"0.5032389",
"0.4993479",
"0.49878263",
"0.49833086",
"0.49400318",
"0.49... | 0.72695094 | 0 |
Combiner function that takes an array of `~astropy.io.fits.ImageHdu` objects and cobines them into a single image. | def combine_function(cutout_hdu_arr):
cutout_imgs = np.array([hdu.data for hdu in cutout_hdu_arr])
nans = np.bitwise_and.reduce(np.isnan(cutout_imgs), axis=0)
cutout_imgs[np.isnan(cutout_imgs)] = 0 # don't want any nans because they mess up multiple/add
combined_img ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _writeCombinedImage(self, array, filename):\n\n _fname = self.assoc.parlist[0]['outsingle']\n _file = pyfits.open(_fname, mode='readonly')\n _prihdu = pyfits.PrimaryHDU(header=_file[0].header,data=array)\n\n _pf = pyfits.HDUList()\n _pf.append(_prihdu)\n _pf.writeto(fi... | [
"0.66800743",
"0.65703183",
"0.62124807",
"0.61349225",
"0.6127995",
"0.6122538",
"0.60522765",
"0.5991412",
"0.59624",
"0.58996296",
"0.58839786",
"0.58113354",
"0.577389",
"0.57605594",
"0.5695682",
"0.56857574",
"0.5676573",
"0.56661475",
"0.5661583",
"0.5636763",
"0.56249... | 0.69602567 | 0 |
Load the input cutouts and select the desired fits extensions. | def load(self, fits_list, exts=None):
if isinstance(fits_list[0], str): # input is filenames
cutout_hdulists = [fits.open(fle) for fle in fits_list]
elif isinstance(fits_list[0], fits.HDUList): # input is HDUList objects
cutout_hdulists = fits_list
else:
ra... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fit_images(f, bands=bands, zoom=2.0,\n extensions=['input', 'model', 'residual']):\n fn = 'fits/%s/fit%s.fits'%(f,f)\n if not os.path.exists(fn):\n fn = fn.replace('.fits', '{}.fits')\n out = []\n # auto-discovery of bands for galfitm files\n multiband = True\n if '{}' no... | [
"0.5548721",
"0.5457686",
"0.5193484",
"0.50661063",
"0.5037558",
"0.50267214",
"0.50122404",
"0.49316445",
"0.48994943",
"0.4880346",
"0.47571608",
"0.4746259",
"0.47419354",
"0.47399956",
"0.47293574",
"0.4728893",
"0.4728349",
"0.4721526",
"0.47063494",
"0.4702031",
"0.468... | 0.5476723 | 1 |
Returns Yeo RSN affiliations for Cammoun parcellation | def get_cammoun2012_yeo(scale, data_dir=None):
# get requested annotation files
cammoun = nndata.fetch_cammoun2012('fsaverage5', data_dir=data_dir)[scale]
# we also need to load in the CSV file with info about the parcellation.
# unlike the Schaefer et al parcellation the labels in our annotation file... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def arns(self) -> Sequence[str]:\n return pulumi.get(self, \"arns\")",
"def RawAffiliations(self, default=None):\n tmp = self.data.get('raw_affiliations', [{}])\n return [[i.get('source',default),i.get('value',default)] for i in tmp]",
"def _get_crl_url(self, distribution_points):\... | [
"0.5300776",
"0.4976884",
"0.4918127",
"0.49168646",
"0.48821262",
"0.4882038",
"0.48264933",
"0.48168346",
"0.47981125",
"0.4761038",
"0.47584298",
"0.47070682",
"0.4689402",
"0.46677297",
"0.4662206",
"0.46612608",
"0.46609518",
"0.46570724",
"0.46453995",
"0.46286044",
"0.... | 0.527365 | 1 |
Uses `parc` to parcellate `vek_annots` via winnertakeall approach | def _parcellate_vek_classes(parc, vek_annots):
vertex_labels, parcel_labels = [], []
for hemi in ('lh', 'rh'):
pl, _, pn = nib.freesurfer.read_annot(getattr(parc, hemi))
vl, *_ = nib.freesurfer.read_annot(getattr(vek_annots, hemi))
vc = _convert_vek_to_classes(vl)
labs = ndimage... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _apply_vek_prob(data_dir=None):\n\n vek = nndata.fetch_voneconomo(data_dir=data_dir)\n\n annots = []\n for hemi in ('lh', 'rh'):\n gcs = Path(getattr(vek['gcs'], hemi))\n ctab = Path(getattr(vek['ctab'], hemi))\n annot = (\n gcs.parent / 'atl-vonEconomoKoskinas_space-fs... | [
"0.5196209",
"0.50831884",
"0.49676114",
"0.49546337",
"0.48586765",
"0.4841096",
"0.4836115",
"0.48319736",
"0.48267365",
"0.47987467",
"0.4796154",
"0.47474626",
"0.4735816",
"0.4724923",
"0.47202983",
"0.4712318",
"0.47090805",
"0.46973974",
"0.46740246",
"0.46687403",
"0.... | 0.6381405 | 0 |
Calculates and returns the progress rate Method is not implemented in this base class, but should be implemented in its subclasses. | def progress_rate (self):
raise NotImplementedError('Subclass must implement this method') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def progress(self) -> float:\n return self._progress",
"def progress(self) -> float:\n return self._progress",
"def progress(self) -> float:\n return self._progress",
"def progress(self) -> float:\n return self._progress",
"def percentage_progress(self):\n\n if self.total... | [
"0.7305258",
"0.7305258",
"0.7305258",
"0.7305258",
"0.7189518",
"0.7189518",
"0.7112887",
"0.70917094",
"0.698546",
"0.68874246",
"0.6809711",
"0.671692",
"0.669788",
"0.66860574",
"0.6683007",
"0.6683007",
"0.6683007",
"0.6683007",
"0.6681039",
"0.6586961",
"0.6552155",
"... | 0.89802533 | 0 |
Calculates and returns the reaction rate Method is not implemented in this base class, but should be implemented in its subclasses. | def reaction_rate (self):
raise NotImplementedError('Subclass must implement this method') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getRate(self) -> int:\n if (self._total_stake.get() + self._daily_reward.get()) == 0:\n rate = DENOMINATOR\n else:\n rate = (self._total_stake.get() + self._daily_reward.get()) * DENOMINATOR // self.sICX_score.totalSupply()\n return rate",
"def _calculate_r0(net):\n... | [
"0.69239306",
"0.69197357",
"0.6893934",
"0.67905974",
"0.66966957",
"0.6659856",
"0.6649312",
"0.656507",
"0.65079105",
"0.64709896",
"0.63654655",
"0.62609947",
"0.6241177",
"0.6239032",
"0.6232654",
"0.62265074",
"0.6209512",
"0.6209466",
"0.6209384",
"0.61632365",
"0.6155... | 0.89377946 | 0 |
Return the list of the species concentration at Temperatrue = T and time = end_t | def species_concentration(self, T, end_t, n_steps=101):
time_steps = np.linspace(0, end_t, n_steps)
# solver = ODE_int_solver(T, self.xi, self.ki, self.b_ki, self.vi_p, self.vi_dp)
solver = ODE_int_solver(T, self)
sol, _, _ = solver.solve(time_steps)
return sol[-1, :] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def species_concentration_evolution(self, T, end_t, n_steps=101):\n time_steps = np.linspace(0, end_t, n_steps)\n # solver = ODE_int_solver(T, self.xi, self.ki, self.b_ki, self.vi_p, self.vi_dp)\n solver = ODE_int_solver(T, self)\n sol, _, _ = solver.solve(time_steps)\n return so... | [
"0.6564248",
"0.5594069",
"0.55604017",
"0.5515499",
"0.5346853",
"0.531207",
"0.52693576",
"0.52243084",
"0.5179312",
"0.51720834",
"0.5155328",
"0.5106476",
"0.5102043",
"0.5037407",
"0.5004259",
"0.5001629",
"0.49995494",
"0.49909422",
"0.4982209",
"0.49761176",
"0.4962704... | 0.75722146 | 0 |
Return the list of the species concentration evolution at Temperatrue = T and from start to end_t | def species_concentration_evolution(self, T, end_t, n_steps=101):
time_steps = np.linspace(0, end_t, n_steps)
# solver = ODE_int_solver(T, self.xi, self.ki, self.b_ki, self.vi_p, self.vi_dp)
solver = ODE_int_solver(T, self)
sol, _, _ = solver.solve(time_steps)
return sol | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def species_concentration(self, T, end_t, n_steps=101):\n time_steps = np.linspace(0, end_t, n_steps)\n # solver = ODE_int_solver(T, self.xi, self.ki, self.b_ki, self.vi_p, self.vi_dp)\n solver = ODE_int_solver(T, self)\n sol, _, _ = solver.solve(time_steps)\n return sol[-1, :]",... | [
"0.7492885",
"0.53836524",
"0.5366263",
"0.5333238",
"0.53211534",
"0.5243222",
"0.52377206",
"0.5229389",
"0.522931",
"0.5205645",
"0.5145173",
"0.5128155",
"0.5124289",
"0.51226866",
"0.51172495",
"0.51149285",
"0.50982606",
"0.50844276",
"0.5083638",
"0.5079455",
"0.506781... | 0.6995203 | 1 |
Perform significance test. One sample ttest, with sample size adjusted for autocorrelation. | def calc_significance(data_subset, data_all, standard_name):
from statsmodels.tsa.stattools import acf
# Data must be three dimensional, with time first
assert len(data_subset.shape) == 3, "Input data must be 3 dimensional"
# Define autocorrelation function
n = data_subset.shape[0]
autoco... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def do_significance_test(tpx_feature, test=\"Wilcoxon Ranksum\"):\n\n\tmd_table = pd.DataFrame.from_csv(os.path.join(wdir, md_csv), header=0)\n\tht_table = pd.DataFrame.from_csv(os.path.join(wdir, \"tpx-corpus-counts.csv\"), header=0)\n\tworking_table = ht_table.join(md_table)\n\n\t# get data points\n\tdata = copy... | [
"0.62536055",
"0.6013744",
"0.5917612",
"0.5822759",
"0.58082634",
"0.57943314",
"0.57716364",
"0.5646693",
"0.5608224",
"0.5585841",
"0.55821127",
"0.5575256",
"0.5569484",
"0.55438215",
"0.5538672",
"0.55324996",
"0.5509133",
"0.5490783",
"0.5484614",
"0.5476234",
"0.546269... | 0.6257916 | 0 |
Collapse a spatial dimension by chunking along time axis. | def chunked_collapse_by_time(cube, collapse_dims, agg_method, weights=None):
assert agg_method in [iris.analysis.SUM, iris.analysis.MEAN]
chunk_list = iris.cube.CubeList([])
coord_names = [coord.name() for coord in cube.dim_coords]
start_indexes, step = get_chunks(cube.shape, coord_names, chunk=True)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def collapse_time_into_batch(x):\n return tf.reshape(x, [-1] + x.shape.as_list()[2:])",
"def collapse_time(cube, ntimes, timestep):\n\n if timestep == None:\n print('Averaging over the %s time points' %(str(ntimes)))\n new_cube = cube.collapsed('time', iris.analysis.MEAN)\n else:\n as... | [
"0.66078174",
"0.63717675",
"0.63075763",
"0.62697273",
"0.605593",
"0.5889879",
"0.57579654",
"0.5428053",
"0.5309814",
"0.5305854",
"0.5181787",
"0.5162951",
"0.51607084",
"0.5150991",
"0.5138858",
"0.5133619",
"0.5075671",
"0.49805307",
"0.496825",
"0.49220675",
"0.4919932... | 0.64244926 | 1 |
Take the latitude and longitude values from given grid axes and produce a flattened lat and lon array, with elementwise pairs corresponding to every grid point. | def coordinate_pairs(lat_axis, lon_axis):
lon_mesh, lat_mesh = numpy.meshgrid(lon_axis, lat_axis) # This is the correct order
return lat_mesh.flatten(), lon_mesh.flatten() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_to_cartesian(grid: List[Tuple[float, float]], radius: float = 1.0) -> List[Tuple[float, float, float]]:\n\n # conversion radians -> degrees\n r2d = 180.0 / np.pi\n\n # calculate x/y/z coordinates, assuming r=1\n return [\n (\n radius * np.cos(lat / ... | [
"0.6624524",
"0.64670986",
"0.61498046",
"0.6139036",
"0.6121652",
"0.61106735",
"0.60799724",
"0.6066847",
"0.60631746",
"0.60382426",
"0.59959024",
"0.59885144",
"0.59634656",
"0.5948974",
"0.594577",
"0.59315026",
"0.59265965",
"0.59241784",
"0.5897038",
"0.58917147",
"0.5... | 0.79724497 | 0 |
Create an ocean basin array. | def create_basin_array(cube):
pacific_bounds = [147, 294]
indian_bounds = [23, 147]
lat_axis = cube.coord('latitude').points
lon_axis = adjust_lon_range(cube.coord('longitude').points, radians=False)
coord_names = [coord.name() for coord in cube.dim_coords]
lat_index = coord_names.index('lati... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _to_array1(self, maps, norb):\n nstate = len(maps[(0, 1)])\n nlt = norb * (norb + 1) // 2\n arrays = numpy.zeros((nlt, nstate, 3), dtype=numpy.int32)\n for i in range(norb):\n for j in range(i + 1, norb):\n ijn = i + j * (j + 1) // 2\n for k,... | [
"0.58565485",
"0.58219194",
"0.56797147",
"0.5659809",
"0.55997115",
"0.5430895",
"0.5376912",
"0.5306864",
"0.5249075",
"0.522973",
"0.5218881",
"0.5177816",
"0.51695436",
"0.5168923",
"0.5163434",
"0.5149411",
"0.5142766",
"0.5123142",
"0.51166755",
"0.5053958",
"0.50485355... | 0.697633 | 0 |
Determine the new highest and lowest value. | def hi_lo(data_series, current_max, current_min):
try:
highest = numpy.max(data_series)
except:
highest = max(data_series)
if highest > current_max:
new_max = highest
else:
new_max = current_max
try:
lowest = numpy.min(data_series)
excep... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def high_and_low(numbers):\n highest = max(numbers)\n lowest = min(numbers)\n return (highest,lowest)",
"def high_and_low(numbers):\n highest = max(numbers)\n lowest = min(numbers)\n return (highest, lowest)",
"def best_value(stock):\n best_sell = sell = stock.pop()\n buy = stock.pop()\... | [
"0.7146609",
"0.71100295",
"0.64367014",
"0.63948923",
"0.63561994",
"0.6258057",
"0.6244779",
"0.6232497",
"0.62221277",
"0.6173533",
"0.61284846",
"0.6121182",
"0.6086216",
"0.6080283",
"0.6035565",
"0.60314",
"0.60269356",
"0.6016944",
"0.6009152",
"0.6007599",
"0.6001726"... | 0.7443534 | 0 |
List keyword arguments of a function. | def list_kwargs(func):
details = inspect.getargspec(func)
nopt = len(details.defaults)
return details.args[-nopt:] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_keyword_args(function):\n argspec = inspect.getargspec(function)\n kwargs = argspec.args[len(argspec.args) - len(argspec.defaults):]\n kwargs = {arg: value for arg, value in zip(kwargs, argspec.defaults)}\n return kwargs",
"def get_kwd_args(func):\n try:\n sig = inspect.signature(fu... | [
"0.7725806",
"0.69074756",
"0.68793905",
"0.67534906",
"0.6662364",
"0.6662364",
"0.6527737",
"0.6521101",
"0.65062964",
"0.64453256",
"0.6431728",
"0.6357949",
"0.63426423",
"0.63280094",
"0.63137114",
"0.6274539",
"0.62359375",
"0.62305164",
"0.6187871",
"0.6185892",
"0.617... | 0.78201747 | 0 |
Mask marginal seas. The marginal seas all have a basin value > 5. | def mask_marginal_seas(data_cube, basin_cube):
data_cube.data = numpy.ma.asarray(data_cube.data)
ndim = data_cube.ndim
basin_array = broadcast_array(basin_cube.data, [ndim - 2, ndim - 1], data_cube.shape)
data_cube.data.mask = numpy.where((data_cube.data.mask == False) & (basin_array <= 5), False, Tr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def maskBySigmas(self, sigma=2):\n\t\t# set up masking criteria\n\t\tself.avgFlux = np.mean(self.flux)\n\t\tself.stdFlux = np.std(self.flux)\n\n\t\tself.smoothFlux = self.flux\n\t\t# set the outliers as the flux below \n\t\tself.smoothFlux[self.smoothFlux <= self.avgFlux - sigma * self.stdFlux] = 0\n\t\t\n\t\tself... | [
"0.5678237",
"0.5512382",
"0.54931366",
"0.517617",
"0.5146793",
"0.5098999",
"0.50875854",
"0.5085883",
"0.50846624",
"0.5081398",
"0.5056079",
"0.5054288",
"0.50401163",
"0.5022963",
"0.5020654",
"0.49855307",
"0.49827224",
"0.49331105",
"0.49254596",
"0.49180612",
"0.49066... | 0.68979365 | 0 |
Take list of datetimes and match with the corresponding datetimes in a time axis. | def match_dates(datetimes, datetime_axis):
dates = list(map(split_dt, datetimes))
date_axis = list(map(split_dt, datetime_axis[:]))
match_datetimes = []
miss_datetimes = []
for i in range(0, len(datetime_axis)):
if date_axis[i] in dates:
match_datetimes.append(datetime_a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_list_of_datetimes(self):\n plot_index = pd.date_range(start=\"2000-1-1\", freq=\"D\", periods=10000)\n freq = 'M'\n\n dates = pd.Series(1, index=plot_index).resample(freq).index\n tl = formatter.TimestampLocator(plot_index, xticks=dates)\n test = tl._process(3, 900)\n\n ... | [
"0.6508027",
"0.6295316",
"0.56726336",
"0.5669794",
"0.5632738",
"0.5595983",
"0.55632967",
"0.54513776",
"0.5449849",
"0.5446788",
"0.54267156",
"0.5412261",
"0.54121053",
"0.5396992",
"0.5393602",
"0.5354854",
"0.5338876",
"0.5323948",
"0.53201497",
"0.5296325",
"0.5282584... | 0.79007524 | 0 |
Split a numpy.datetime64 value so as to just keep the date part. | def split_dt(dt):
return str(dt).split('T')[0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def split_date(X, date_column):\r\n X.copy()\r\n X[date_column] = pd.to_datetime(X[date_column])\r\n X['Month'] = X[date_column].dt.month\r\n X['Day'] = X[date_column].dt.day\r\n X['Year'] = X[date_column].dt.year\r\n X = X.drop(columns=date_column)\r\n return X",
"def datetime64_parts(da_ti... | [
"0.6760642",
"0.64947164",
"0.5996496",
"0.581191",
"0.5745121",
"0.57439566",
"0.57135254",
"0.56675327",
"0.5546525",
"0.5443725",
"0.53971857",
"0.53876364",
"0.5348012",
"0.5337985",
"0.5337985",
"0.5325646",
"0.5298231",
"0.5298067",
"0.5249851",
"0.5247615",
"0.5247615"... | 0.65144104 | 1 |
get all annotations from given cube as a List. | def get_all(self, cube_name: str, **kwargs) -> List[Annotation]:
url = format_url("/api/v1/Cubes('{}')/Annotations?$expand=DimensionalContext($select=Name)", cube_name)
response = self._rest.GET(url, **kwargs)
annotations_as_dict = response.json()['value']
annotations = [Annotation.from... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_annotations(self) -> List[Dict[int, Dict[str, Any]]]:\n annotations = []\n for item in self.collector:\n data_file_type = os.path.basename(item).split(\".\")[-1]\n annotations.append(\n load_annotation_file(\n os.path.join(\n ... | [
"0.64540374",
"0.61120236",
"0.59790856",
"0.5891948",
"0.58833534",
"0.5801941",
"0.5723213",
"0.5713653",
"0.5670874",
"0.56140184",
"0.56039906",
"0.5587549",
"0.5580196",
"0.5565542",
"0.550542",
"0.54932255",
"0.54922146",
"0.5488088",
"0.5473962",
"0.5466375",
"0.546438... | 0.8235057 | 0 |
get an annotation from any cube through its unique id | def get(self, annotation_id: str, **kwargs) -> Annotation:
request = format_url("/api/v1/Annotations('{}')?$expand=DimensionalContext($select=Name)", annotation_id)
response = self._rest.GET(url=request, **kwargs)
return Annotation.from_json(response.text) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(self, image_id: str) -> typing.Dict:\n return self.annotation.get(image_id)",
"def getCube(unique_name):",
"def get_all(self, cube_name: str, **kwargs) -> List[Annotation]:\n url = format_url(\"/api/v1/Cubes('{}')/Annotations?$expand=DimensionalContext($select=Name)\", cube_name)\n ... | [
"0.5717475",
"0.5618922",
"0.56007594",
"0.5581224",
"0.5580307",
"0.54589206",
"0.5399659",
"0.53891283",
"0.5359815",
"0.5355585",
"0.53416234",
"0.53416234",
"0.5335083",
"0.53218603",
"0.53042144",
"0.5268182",
"0.52381194",
"0.521336",
"0.521336",
"0.521336",
"0.521336",... | 0.6035786 | 0 |
Creates block with selected type. Type should be choosen from BlockCreator.types dictionary. | def create_block(type: str, color_key, position):
if type not in BlockCreator.types.keys():
raise BlockCreator.IncorrectBlockType
image_name = BlockCreator.types[type]
return Block(image_name, color_key, position) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def create_block_type(self, block_type: BlockTypeCreate) -> BlockType:\n try:\n response = await self._client.post(\n \"/block_types/\",\n json=block_type.dict(\n json_compatible=True, exclude_unset=True, exclude={\"id\"}\n ),\... | [
"0.7563766",
"0.7411806",
"0.7094636",
"0.69339216",
"0.6740083",
"0.67185766",
"0.667034",
"0.6631848",
"0.65789914",
"0.65525687",
"0.6519272",
"0.6409651",
"0.6392276",
"0.6296279",
"0.6227742",
"0.6226004",
"0.62122965",
"0.6191653",
"0.61864835",
"0.61639386",
"0.6150736... | 0.79074067 | 0 |
r"""Function for displaying expressions generated in the sympy.physics vector package. Returns the output of vprint() as a string. | def vsprint(expr, **settings):
string_printer = VectorStrPrinter(settings)
return string_printer.doprint(expr) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vlatex(expr, **settings):\n latex_printer = VectorLatexPrinter(settings)\n\n return latex_printer.doprint(expr)",
"def vpprint(expr, **settings):\n\n pp = VectorPrettyPrinter(settings)\n\n # Note that this is copied from sympy.printing.pretty.pretty_print:\n\n # XXX: this is an ugly hack, but ... | [
"0.73702085",
"0.7365008",
"0.70163375",
"0.69776547",
"0.65623677",
"0.6534897",
"0.64447355",
"0.6327624",
"0.6311094",
"0.63014126",
"0.62636876",
"0.62398815",
"0.6232736",
"0.6223882",
"0.62042135",
"0.6158204",
"0.61215407",
"0.6106772",
"0.6086005",
"0.6082481",
"0.604... | 0.7504994 | 0 |
r"""Function for pretty printing of expressions generated in the sympy.physics vector package. Mainly used for expressions not inside a vector; the output of running scripts and generating equations of motion. Takes the same options as | def vpprint(expr, **settings):
pp = VectorPrettyPrinter(settings)
# Note that this is copied from sympy.printing.pretty.pretty_print:
# XXX: this is an ugly hack, but at least it works
use_unicode = pp._settings['use_unicode']
from sympy.printing.pretty.pretty_symbology import pretty_use_unicode
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vsprint(expr, **settings):\n\n string_printer = VectorStrPrinter(settings)\n return string_printer.doprint(expr)",
"def vlatex(expr, **settings):\n latex_printer = VectorLatexPrinter(settings)\n\n return latex_printer.doprint(expr)",
"def pretty_print_equation(self):\n\n for n in self.no... | [
"0.7129997",
"0.6889078",
"0.68829197",
"0.66245615",
"0.625491",
"0.5974223",
"0.5948747",
"0.5777486",
"0.5744408",
"0.5741757",
"0.5691713",
"0.5669425",
"0.5655469",
"0.5618247",
"0.56152046",
"0.56060416",
"0.56025875",
"0.5594023",
"0.55906814",
"0.5590166",
"0.55829346... | 0.74194354 | 0 |
r"""Function for printing latex representation of sympy.physics.vector objects. For latex representation of Vectors, Dyadics, and dynamicsymbols. Takes the | def vlatex(expr, **settings):
latex_printer = VectorLatexPrinter(settings)
return latex_printer.doprint(expr) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_vector(self):\n print self.x, self.y, self.z",
"def print_vector(self, name, items=None):\n print(\"* Vector name: %s\" % name)\n for item in items or self.get_vector(name).items:\n print(item.printer(self.dictionary_db))\n print(\"\")",
"def vpprint(expr, *... | [
"0.6471205",
"0.6348659",
"0.6286524",
"0.62535125",
"0.6181567",
"0.6158272",
"0.6097128",
"0.60798156",
"0.60786617",
"0.60527843",
"0.5856173",
"0.5849696",
"0.58488894",
"0.5810228",
"0.57960206",
"0.5788496",
"0.57644194",
"0.5705492",
"0.56901187",
"0.56897026",
"0.5677... | 0.7043583 | 0 |
Get a list of psvm. | def list(self):
return self._list('/os-psvm', 'psvms') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_vm_list(self):\n\t\treturn Job(SDK.PrlSrv_GetVmList(self.handle)[0])",
"def get_vms(self):\n\n raise NotImplementedError",
"def get(self, psvm):\n return self._get('/os-psvm/%s' % (base.getid(psvm)), \"psvm\")",
"def get_vms(self):\n\n vms = [v for v in self.vm_data.keys()]\n ... | [
"0.78553337",
"0.737185",
"0.711825",
"0.70980483",
"0.68404716",
"0.6796993",
"0.6766083",
"0.67439795",
"0.67298",
"0.66431636",
"0.6642863",
"0.66248834",
"0.66166925",
"0.65694946",
"0.6554129",
"0.6513626",
"0.6489884",
"0.6387177",
"0.6352238",
"0.63240814",
"0.6208615"... | 0.8918199 | 0 |
Create a new psvm. | def create(self, ip_addr, switch_cred_id):
body = {'psvm': {'ip': ip_addr,
'switch_cred_id': switch_cred_id}}
return self._create('/os-psvm', body, 'psvm') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_vm(self):\n\t\treturn handle_to_object(call_sdk_function('PrlSrv_CreateVm', self.handle))",
"def _create_vm(self):\n self._create_instance_in_the_db()\n self.type_data = db.instance_type_get_by_name(None, 'm1.large')\n self.conn.spawn(self.context, self.instance, self.network_info... | [
"0.7793902",
"0.7168388",
"0.70694995",
"0.7041161",
"0.70253426",
"0.68848073",
"0.68063086",
"0.6779791",
"0.67714113",
"0.667361",
"0.65786785",
"0.6434629",
"0.6378826",
"0.6324185",
"0.6270708",
"0.62372637",
"0.622905",
"0.6218822",
"0.62145174",
"0.6161365",
"0.6050242... | 0.75135595 | 1 |
Get details of the specified psvm. | def get(self, psvm):
return self._get('/os-psvm/%s' % (base.getid(psvm)), "psvm") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_details(self, psvm):\n return self.get(psvm)",
"def list(self):\n return self._list('/os-psvm', 'psvms')",
"def test_aws_service_api_vm_details_get(self):\n pass",
"def get_vm(**kwargs):\n model = self.db.vm_table_from_provider('openstack')\n vm = self.db.se... | [
"0.8664453",
"0.69446653",
"0.6788016",
"0.6570255",
"0.6397857",
"0.636408",
"0.6297073",
"0.62250626",
"0.61842",
"0.61641854",
"0.60874057",
"0.6023126",
"0.5993875",
"0.5971169",
"0.5953451",
"0.5924121",
"0.59030473",
"0.58990616",
"0.5867773",
"0.58666354",
"0.5858703",... | 0.8547196 | 1 |
Get details of the specified psvm. | def get_details(self, psvm):
return self.get(psvm) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(self, psvm):\n return self._get('/os-psvm/%s' % (base.getid(psvm)), \"psvm\")",
"def list(self):\n return self._list('/os-psvm', 'psvms')",
"def test_aws_service_api_vm_details_get(self):\n pass",
"def get_vm(**kwargs):\n model = self.db.vm_table_from_provider('opensta... | [
"0.8547196",
"0.69446653",
"0.6788016",
"0.6570255",
"0.6397857",
"0.636408",
"0.6297073",
"0.62250626",
"0.61842",
"0.61641854",
"0.60874057",
"0.6023126",
"0.5993875",
"0.5971169",
"0.5953451",
"0.5924121",
"0.59030473",
"0.58990616",
"0.5867773",
"0.58666354",
"0.5858703",... | 0.8664453 | 0 |
Update the details of a psvm. | def update(self, psvm, values):
body = {'psvm': values}
return self._update("/os-psvm/%s" % base.getid(psvm),
body,
"psvm") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_virtual_machine(self, vm):\n self.update_cpu(vm)\n self.update_memory(vm)\n signals.vm_updated.send(self.__class__, vm=vm)",
"def vm_update(args):\n ip1 = args.ip1\n flavor = args.flavor\n numcpus = args.numcpus\n memory = args.memory\n plan = args.plan\n autosta... | [
"0.6923135",
"0.67671525",
"0.6440601",
"0.6007036",
"0.5992397",
"0.59771013",
"0.5972355",
"0.59655595",
"0.5961925",
"0.59583277",
"0.5877768",
"0.5787422",
"0.57291466",
"0.57014173",
"0.5679655",
"0.5632143",
"0.5618975",
"0.56057465",
"0.5582089",
"0.5573669",
"0.550312... | 0.8168369 | 0 |
Delete the specified psvm. | def delete(self, psvm):
self._delete('/os-psvm/%s' % (base.getid(psvm))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_vm(client, resource_group_name, vm_name):\n return client.delete(resource_group_name, vm_name)",
"def delete_vm(self, tenant_id, vm_id):\n self.delete_vm_bulk(tenant_id, [vm_id])",
"def delete_virtual_machine(self, vm):\n try:\n self.client.delete_vm(vm.backend_id)\n ... | [
"0.7781701",
"0.75562704",
"0.7258819",
"0.7249805",
"0.7138378",
"0.70651835",
"0.7044429",
"0.7002989",
"0.69462544",
"0.69021195",
"0.68119144",
"0.67608553",
"0.6589833",
"0.65819335",
"0.6526306",
"0.6486888",
"0.6447878",
"0.63968414",
"0.638068",
"0.6338689",
"0.631569... | 0.907266 | 0 |
run server for api | def run_server(self, _):
if not ENABLE_SERVER:
logger.info('server not enabled, exit')
return
app.run(host=API_HOST, port=API_PORT, threaded=API_THREADED) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def program_api(port):\n server = system.create_server(\"api\")\n server.listen(port=port)",
"def main():\n return run_server(**parse_server_args())",
"def runapiserver(port=None, ddir=None):\n from jsb.drivers.tornado.bot import TornadoBot\n global bot\n bot = TornadoBot(botname=\"api-bot\")... | [
"0.8003911",
"0.77799106",
"0.7743487",
"0.7651824",
"0.75083107",
"0.75083107",
"0.7410097",
"0.73894185",
"0.7356704",
"0.7318422",
"0.7291556",
"0.7226918",
"0.71970576",
"0.7155378",
"0.7093132",
"0.70750064",
"0.7038236",
"0.7034341",
"0.7028366",
"0.6964079",
"0.6952200... | 0.83809125 | 0 |
processes the correct answer based on a given question object if the answer is incorrect, informs the user | def correct_answer_for_all(context, question):
answers = question.get_answers()
incorrect_list = context.get('incorrect_questions', [])
if question.id in incorrect_list:
user_was_incorrect = True
else:
user_was_incorrect = False
return {'previous': {'answers': answers},
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def checkAnswer(questionID):\n questionGuess = request.args.get('questionGuess', 'FORM ERROR')\n print(\"{0} {1}\".format(questionID, questionGuess))\n return prepJSON(cs411_answers.checkAnswer2(questionID, questionGuess))",
"def check_answer():\r\n global choice, answer_choice, tries, submit_button,... | [
"0.6709627",
"0.669876",
"0.6639325",
"0.6610576",
"0.6610084",
"0.6569569",
"0.65325034",
"0.6521109",
"0.65080816",
"0.6492395",
"0.6461075",
"0.64462215",
"0.63957465",
"0.6387021",
"0.6385969",
"0.63773835",
"0.63723737",
"0.63426644",
"0.6331737",
"0.6319977",
"0.6306514... | 0.67987025 | 0 |
Inizializzo il dispositivo > por tipo device (dipende dal S.O.) > par parametri di configurazione > ope stabilisco se deve essere aperta la connessione | def __init__(self, por="/dev/ttyS", par=['1','115200','8','N','1'], ope=True, deb=False):
# referenzio il flag di Debug
self.deb = deb
self.ope = ope
self.par = par
self.por = por+par[0]
# Gestione apertura collegamento
if self.ope:
try:
# provo ad aprire la connessione
self.ser = ser... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _configure(self):\n dconfig = DConfiguration(self._le2mserv.gestionnaire_graphique.screen)\n if dconfig.exec_():\n pms.TEMPS_PARTIE, pms.TREATMENT, pms.GRILLES = dconfig.get_config()\n self._le2mserv.gestionnaire_graphique.infoserv(\n [trans_TC(u\"Part time: {... | [
"0.6549924",
"0.62941635",
"0.6192747",
"0.61422616",
"0.61259097",
"0.6027686",
"0.6021012",
"0.601022",
"0.5988881",
"0.5986326",
"0.5983652",
"0.59757346",
"0.5958312",
"0.5950076",
"0.5925463",
"0.5921469",
"0.59121954",
"0.59062845",
"0.5887932",
"0.5882819",
"0.58782667... | 0.64361036 | 1 |
Calls the sorting algorithm (timed). | def click_timed_sorting_button(self):
self.my_sorted_list = self.sorting.sorting_alg(self.my_list)
self.label_2["text"] = self.set_my_sorted_list_label() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_benchmark_sorted(benchmark, benchmark_items_fixture):\n do_benchmark(benchmark_items_fixture, sorted, benchmark)",
"def start_sorting(sorting_algos):\n for algo in sorting_algos:\n algo.run()",
"def run(self):\n self.model.sort(0)\n self.sort_object.task_complete.emit()",
... | [
"0.68573886",
"0.6816188",
"0.6684217",
"0.66330725",
"0.6601493",
"0.6600227",
"0.6574371",
"0.6552845",
"0.65143967",
"0.6490862",
"0.6460972",
"0.6446163",
"0.6400259",
"0.63670623",
"0.6343033",
"0.63174975",
"0.6258505",
"0.62498707",
"0.62498707",
"0.62476003",
"0.62390... | 0.70049965 | 0 |
Set global mechanism to start multiprocessing processes. | def initialize_multiprocessing() -> None:
global LOCK
try:
multiprocessing.set_start_method("fork")
except AttributeError:
# Unsupported set_start_method (python 2 mainly).
# Use default start method.
pass
except RuntimeError:
# Already initialized
pass
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize_multiprocessing(self):\n if self.multiprocessing_controller is not None:\n MPControl.set_multiprocess_engine(self.multiprocessing_controller)\n MPControl.connect()",
"def setup_manager(self) -> None:\n\n #Clean out the process list.\n self.process_list.clear(... | [
"0.7409246",
"0.66756165",
"0.65711147",
"0.64726144",
"0.6421034",
"0.635704",
"0.6234705",
"0.61560905",
"0.60073465",
"0.5992083",
"0.5911194",
"0.59079754",
"0.59070367",
"0.5897068",
"0.58916247",
"0.5861552",
"0.58483124",
"0.5840347",
"0.5769009",
"0.57330114",
"0.5720... | 0.74680734 | 0 |
Instantiate a new empty process. | def new_process() -> Process:
return multiprocessing.Process() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _spawn_immediate_process(self, process_id, name, module, cls, config, proc_attr):\n process_instance = self._create_process_instance(process_id, name, module, cls, config, proc_attr)\n self._process_init(process_instance)\n self._process_start(process_instance)\n return process_inst... | [
"0.68855417",
"0.6837254",
"0.649374",
"0.6437515",
"0.63896734",
"0.62782043",
"0.62162095",
"0.61796767",
"0.614499",
"0.6099268",
"0.60873365",
"0.6045401",
"0.6045091",
"0.6012644",
"0.59928197",
"0.5970519",
"0.5935555",
"0.5921373",
"0.5904094",
"0.5898356",
"0.58371097... | 0.7545196 | 0 |
Instantiate a new queue. | def new_queue() -> Queue:
return multiprocessing.Queue() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _queue_create(self, **kwargs):\n name = self.generate_random_name()\n return self.clients(\"zaqar\").queue(name, **kwargs)",
"def instantiate_queue(self):\n serialized_queue = self.cache.get('queue')\n queue = ast.literal_eval(serialized_queue.decode('utf-8'))\n return queu... | [
"0.7841289",
"0.75244033",
"0.7522018",
"0.74640113",
"0.7422767",
"0.7313239",
"0.723213",
"0.7230453",
"0.71969986",
"0.7086344",
"0.7086344",
"0.7086344",
"0.7086344",
"0.7086344",
"0.7081707",
"0.706328",
"0.7062478",
"0.7062478",
"0.7062478",
"0.7062478",
"0.7044726",
... | 0.79009104 | 0 |
Create a new process for the given target with the provided arguments. | def create_process(
target: typing.Callable, args: tuple = (), prepend_lock: bool = False
) -> Process:
if prepend_lock:
args = (LOCK,) + tuple(args)
process = multiprocessing.Process(target=target, args=args)
return process | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new_process() -> Process:\n return multiprocessing.Process()",
"def create(cls, original_args, process_args, base_url, host_url, services):\n return cls(original_args, process_args, base_url, host_url, services)",
"def make(self, target=None, args=None):\n make_program = self._conanfile.c... | [
"0.6132465",
"0.60847116",
"0.6034971",
"0.58270144",
"0.582385",
"0.58019465",
"0.5782932",
"0.56453925",
"0.56173766",
"0.5606198",
"0.55452144",
"0.55388427",
"0.5505263",
"0.5504397",
"0.54854804",
"0.5480833",
"0.5474415",
"0.5445436",
"0.54139197",
"0.54038584",
"0.5381... | 0.71007484 | 0 |
Create a new shared memory manager process. At the given address with the provided authkey. | def create_shared_memory_manager(
address: typing.Tuple[str, int], authkey: typing.Optional[bytes]
) -> SharedMemoryManager:
smm = SharedMemoryManager(address=address, authkey=authkey)
return smm | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def register_system_shared_memory(\n self,\n name: str,\n key: str,\n byte_size: int,\n offset: int = ...,\n headers: dict[str, t.Any] = ...,\n ) -> None:",
"def create_process(\n target: typing.Callable, args: tuple = (), prepend_lock: bool = False\n) -> Pro... | [
"0.61313486",
"0.5451885",
"0.53200054",
"0.5264713",
"0.5250318",
"0.5241237",
"0.5229662",
"0.51821584",
"0.51062447",
"0.5087353",
"0.5063973",
"0.5061476",
"0.49625957",
"0.4900358",
"0.48913205",
"0.48632017",
"0.4863138",
"0.4854867",
"0.48466542",
"0.4829984",
"0.48174... | 0.7986713 | 0 |
Create a proxy dictionary. Aimed at sharing the information across workers within the same node. | def create_proxy_dict() -> DictProxy:
manager = new_manager()
cache_ids = manager.dict() # type: DictProxy
return cache_ids | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def proxies(self):\n\n proxies = APIConsumer.get(\"/proxies\").json()\n proxies_dict = {}\n\n for name, values in viewitems(proxies):\n # Lets create a Proxy object to hold all its data\n proxy = Proxy(**values)\n\n # Add the new proxy to the toxiproxy proxies ... | [
"0.65921116",
"0.65142816",
"0.63037497",
"0.60757446",
"0.60355294",
"0.58485126",
"0.57292515",
"0.57060724",
"0.5703932",
"0.55165046",
"0.548642",
"0.5474373",
"0.5470563",
"0.5465343",
"0.5397967",
"0.53900033",
"0.5380679",
"0.53613526",
"0.5358843",
"0.534671",
"0.5329... | 0.763003 | 0 |
Demonstrate the generation of different statistical standard plots. | def simplePlots() -> None:
# Univariate data -------------------------
# Make sure that always the same random numbers are generated
np.random.seed(1234)
# Generate data that are normally distributed
x = np.random.randn(500)
# Other graphics settings
# Set " co... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_mean_std_comparison(evaluators: List):\n nr_plots = len(evaluators)\n fig, ax = plt.subplots(2, nr_plots, figsize=(4 * nr_plots, 7))\n flat_ax = ax.flatten()\n for i in range(nr_plots):\n plot_mean_std(evaluators[i].real, evaluators[i].fake, ax=ax[:, i])\n\n titles = [e.name if e is ... | [
"0.70764756",
"0.66474617",
"0.660197",
"0.64618844",
"0.6431408",
"0.6369018",
"0.6357833",
"0.63154167",
"0.62302023",
"0.61694986",
"0.615105",
"0.61242956",
"0.6116902",
"0.6111676",
"0.60876197",
"0.6068366",
"0.60561645",
"0.60499734",
"0.6047673",
"0.60452557",
"0.6043... | 0.733708 | 0 |
Create new X509_Extension instance. | def new_extension(name, value, critical=0, _pyfree=1):
if name == 'subjectKeyIdentifier' and \
value.strip('0123456789abcdefABCDEF:') is not '':
raise ValueError('value must be precomputed hash')
lhash = m2.x509v3_lhash()
ctx = m2.x509v3_set_conf_lhash(lhash)
x509_ext_ptr = m2.x509v3_ext... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new_cert(self, commonname, extensions=None):\n\n serial = self._get_serial()\n pkey = self._create_pkey(commonname, serial)\n self._create_cert(pkey, commonname, serial, extensions)",
"def install_extensions(self, builder):\n\n # BasicConstraints, critical\n if self.ca:\n ... | [
"0.66290057",
"0.6256711",
"0.59336776",
"0.58764833",
"0.58714145",
"0.5863903",
"0.5804906",
"0.5801067",
"0.57302594",
"0.5633795",
"0.56286585",
"0.5573266",
"0.55304915",
"0.5449552",
"0.5400946",
"0.53762615",
"0.5363765",
"0.53171396",
"0.52971125",
"0.5269982",
"0.525... | 0.76387155 | 0 |
Mark this extension critical or noncritical. By default an extension is not critical. | def set_critical(self, critical=1):
return m2.x509_extension_set_critical(self.x509_ext, critical) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def critical(self, check, *, note=None):\n return await self.mark(check, \"critical\", note=note)",
"def critical(self, *args, **kwargs):",
"def critical_extensions(self):\n\n if not self._processed_extensions:\n self._set_extensions()\n return self._critical_extensions",
... | [
"0.64466435",
"0.6190905",
"0.59482723",
"0.59482723",
"0.58756524",
"0.58511347",
"0.5763521",
"0.5735856",
"0.565526",
"0.56434834",
"0.5517211",
"0.55132896",
"0.55132896",
"0.5486839",
"0.5475243",
"0.54739636",
"0.54409486",
"0.5418222",
"0.5379859",
"0.5370227",
"0.5352... | 0.75363255 | 0 |
Get the extension name, for example 'subjectAltName'. | def get_name(self):
return m2.x509_extension_get_name(self.x509_ext) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extension_name(ext):\n return \"script_extensions::%s\" % \"_\".join([e.upper() for e in ext])",
"def extension(self):\n #type: ()->Text\n return os.path.splitext(os.path.basename(self.fileName))[1]",
"def extension(self):\n return os.path.splitext(self.fname)[1]",
"def get_extens... | [
"0.8041393",
"0.7644912",
"0.7643604",
"0.75774515",
"0.741262",
"0.7354604",
"0.7318701",
"0.7281262",
"0.7190507",
"0.7175484",
"0.71666616",
"0.70786566",
"0.7054815",
"0.70505863",
"0.70434743",
"0.70261323",
"0.70127785",
"0.70060575",
"0.6931666",
"0.6921465",
"0.686053... | 0.82693833 | 0 |
Push X509_Extension object onto the stack. | def push(self, x509_ext):
self.pystack.append(x509_ext)
ret = m2.sk_x509_extension_push(self.stack, x509_ext._ptr())
assert ret == len(self.pystack)
return ret | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def push(self, x509):\n assert isinstance(x509, X509)\n self.pystack.append(x509)\n ret = m2.sk_x509_push(self.stack, x509._ptr())\n assert ret == len(self.pystack)\n return ret",
"def add_extensions(self, ext_stack):\n return m2.x509_req_add_extensions(self.req, ext_sta... | [
"0.711887",
"0.68568796",
"0.63912064",
"0.60706073",
"0.6003764",
"0.5687379",
"0.5545361",
"0.55202824",
"0.54790866",
"0.54533017",
"0.5449719",
"0.5448878",
"0.5448878",
"0.5396399",
"0.53671664",
"0.5363471",
"0.53535664",
"0.5349152",
"0.5344307",
"0.52687585",
"0.52084... | 0.85468376 | 0 |
Pop X509_Extension object from the stack. | def pop(self):
x509_ext_ptr = m2.sk_x509_extension_pop(self.stack)
if x509_ext_ptr is None:
assert len(self.pystack) == 0
return None
return self.pystack.pop() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pop(self):\n x509_ptr = m2.sk_x509_pop(self.stack)\n if x509_ptr is None:\n assert len(self.pystack) == 0\n return None\n return self.pystack.pop()",
"def exp_pop(self) -> Any:\n return self.exp_stack.popleft()",
"def pop():\n stack = _get_stack()\n r... | [
"0.73801106",
"0.63341326",
"0.6222319",
"0.6098972",
"0.6014441",
"0.6001032",
"0.599693",
"0.59717065",
"0.58928394",
"0.58783734",
"0.58682126",
"0.586594",
"0.58441013",
"0.5821486",
"0.5818966",
"0.5806691",
"0.5791382",
"0.5791382",
"0.57841927",
"0.57787967",
"0.575649... | 0.82561576 | 0 |
Add X509 extension to this certificate. | def add_ext(self, ext):
assert m2.x509_type_check(self.x509), "'x509' type error"
return m2.x509_add_ext(self.x509, ext.x509_ext, -1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_extension(self, new_ext):\n if not isinstance(new_ext, extension.X509Extension):\n raise errors.X509Error(\"ext is not an anchor X509Extension\")\n attributes = self.get_attributes()\n ext_attrs = [a for a in attributes\n if a['attrType'] == OID_extension... | [
"0.7436317",
"0.7294856",
"0.7160218",
"0.6991479",
"0.6697689",
"0.6674478",
"0.6604818",
"0.63647217",
"0.6303982",
"0.6215109",
"0.6064066",
"0.6052167",
"0.60025436",
"0.5994879",
"0.57820153",
"0.5776919",
"0.577565",
"0.57727766",
"0.57325774",
"0.57257897",
"0.5696772"... | 0.8278689 | 0 |
Get X509 extension by name. | def get_ext(self, name):
# Optimizations to reduce attribute accesses
m2x509_get_ext = m2.x509_get_ext
m2x509_extension_get_name = m2.x509_extension_get_name
x509 = self.x509
for i in range(m2.x509_get_ext_count(x509)):
extPtr = m2x509_get_ext(x509, i)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(self, name):\n ext = self.extensions.get(name)\n\n if not ext:\n ext = self.builtin(name)\n\n if not ext:\n self.discover()\n\n try:\n ext = self.extensions[name]\n except KeyError:\n raise InternalError(\"Unknow... | [
"0.725364",
"0.7251284",
"0.6725918",
"0.655085",
"0.6532477",
"0.6397859",
"0.63357526",
"0.6309089",
"0.6068045",
"0.6036809",
"0.5958346",
"0.5941542",
"0.5938631",
"0.59370744",
"0.5934726",
"0.5913139",
"0.5875215",
"0.5854142",
"0.5823693",
"0.5805228",
"0.5800115",
"... | 0.8596658 | 0 |
Get X509 extension by index. | def get_ext_at(self, index):
if index < 0 or index >= self.get_ext_count():
raise IndexError
return X509_Extension(m2.x509_get_ext(self.x509, index),
_pyfree=0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_ext(self, name):\n # Optimizations to reduce attribute accesses\n m2x509_get_ext = m2.x509_get_ext\n m2x509_extension_get_name = m2.x509_extension_get_name\n x509 = self.x509\n \n for i in range(m2.x509_get_ext_count(x509)):\n extPtr = m2x509_get_ext(x50... | [
"0.7119378",
"0.6005998",
"0.58912086",
"0.586561",
"0.57999766",
"0.5757982",
"0.5636337",
"0.5633442",
"0.56049776",
"0.54448754",
"0.5418735",
"0.5418527",
"0.54120564",
"0.5398322",
"0.5346632",
"0.53401583",
"0.52707994",
"0.51847595",
"0.51709056",
"0.5169078",
"0.51619... | 0.8898213 | 0 |
Get X509 extension count. | def get_ext_count(self):
return m2.x509_get_ext_count(self.x509) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getNumExtension(self, *args):\n return _libsbml.SBMLExtensionRegistry_getNumExtension(self, *args)",
"def getNumCerts(self):\r\n return len(self.x509List)",
"def unknown_extension_count():\n extensions = []\n for ext in Statistics.all_unknown_extension():\n extensions.append(\n ... | [
"0.70555073",
"0.6305053",
"0.6111253",
"0.600512",
"0.5943954",
"0.58774674",
"0.58276004",
"0.5725417",
"0.5680908",
"0.56491846",
"0.5628155",
"0.56208456",
"0.55440754",
"0.5529577",
"0.5495404",
"0.5487244",
"0.5483188",
"0.5457494",
"0.54472035",
"0.54180956",
"0.541087... | 0.8695183 | 0 |
Check if the certificate is a Certificate Authority (CA) certificate. | def check_ca(self):
return m2.x509_check_ca(self.x509) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_ca_cert(cert):\n # extract \"ca\" value from cert extensions\n is_ca = False\n try:\n basic_constraints = cert.extensions.get_extension_for_oid(\n x509.ExtensionOID.BASIC_CONSTRAINTS)\n value = getattr(basic_constraints, 'value', None)\n if value:\n is_ca ... | [
"0.79473364",
"0.6746422",
"0.6333965",
"0.6193868",
"0.6031874",
"0.59499717",
"0.59434915",
"0.5880407",
"0.57999593",
"0.5768126",
"0.5710618",
"0.57095736",
"0.57095736",
"0.5674547",
"0.5662379",
"0.56183857",
"0.5616243",
"0.5603241",
"0.5550749",
"0.54672384",
"0.54587... | 0.7176993 | 1 |
Check if the certificate's purpose matches the asked purpose. | def check_purpose(self, id, ca):
return m2.x509_check_purpose(self.x509, id, ca) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def purpose(self) -> Optional[pulumi.Input['CryptoKeyPurpose']]:\n return pulumi.get(self, \"purpose\")",
"def is_our_certrequest(spec, **_):\n issuer = spec.get(\"issuerRef\")\n return (issuer is not None) and (issuer.get(\"group\") == GROUP)",
"def purpose(self):\n return self._purpose",
... | [
"0.6453109",
"0.6188199",
"0.5678143",
"0.55549294",
"0.5531188",
"0.5345478",
"0.5321293",
"0.5321293",
"0.52107906",
"0.520771",
"0.5199936",
"0.5185483",
"0.5095041",
"0.50462574",
"0.5029033",
"0.49937677",
"0.4982729",
"0.4977809",
"0.49377352",
"0.49236718",
"0.49146265... | 0.7542637 | 0 |
Load certificate from a bio. | def load_cert_bio(bio, format=FORMAT_PEM):
if format == FORMAT_PEM:
cptr = m2.x509_read_pem(bio._ptr())
elif format == FORMAT_DER:
cptr = m2.d2i_x509(bio._ptr())
else:
raise ValueError("Unknown format. Must be either FORMAT_DER or FORMAT_PEM")
if cptr is None:
raise X509E... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_cert_string(string, format=FORMAT_PEM):\n bio = BIO.MemoryBuffer(string)\n return load_cert_bio(bio, format)",
"def load_cert(file, format=FORMAT_PEM):\n bio = BIO.openfile(file)\n if format == FORMAT_PEM:\n return load_cert_bio(bio)\n elif format == FORMAT_DER:\n cptr = m2.... | [
"0.6570062",
"0.6436852",
"0.64079213",
"0.6261287",
"0.61559683",
"0.60853326",
"0.6066362",
"0.6045058",
"0.584484",
"0.5790494",
"0.5761705",
"0.57193303",
"0.5715752",
"0.56991905",
"0.56699765",
"0.56506586",
"0.55937475",
"0.55919904",
"0.552589",
"0.552589",
"0.5396271... | 0.8033419 | 0 |
Load certificate from a string. | def load_cert_string(string, format=FORMAT_PEM):
bio = BIO.MemoryBuffer(string)
return load_cert_bio(bio, format) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_cert_der_string(string):\n bio = BIO.MemoryBuffer(string)\n cptr = m2.d2i_x509(bio._ptr())\n if cptr is None:\n raise X509Error(Err.get_error())\n return X509(cptr, _pyfree=1)",
"def load_certificate(file_path: str, encoding: Encoding = None) -> Certificate:\n real_encoding = encod... | [
"0.77032244",
"0.6371351",
"0.63290834",
"0.6295211",
"0.6183143",
"0.60612905",
"0.60302645",
"0.60078984",
"0.59199685",
"0.58863515",
"0.5821279",
"0.57771546",
"0.5751106",
"0.5736941",
"0.5672748",
"0.56060594",
"0.55767673",
"0.5497552",
"0.54949236",
"0.5486243",
"0.54... | 0.813308 | 0 |
Load certificate from a string. | def load_cert_der_string(string):
bio = BIO.MemoryBuffer(string)
cptr = m2.d2i_x509(bio._ptr())
if cptr is None:
raise X509Error(Err.get_error())
return X509(cptr, _pyfree=1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_cert_string(string, format=FORMAT_PEM):\n bio = BIO.MemoryBuffer(string)\n return load_cert_bio(bio, format)",
"def load_certificate(file_path: str, encoding: Encoding = None) -> Certificate:\n real_encoding = encoding or _get_encoding_type(file_path)\n\n def solve(certificate_data: bytes) -... | [
"0.8131522",
"0.6373521",
"0.63300943",
"0.62938005",
"0.6184561",
"0.6062755",
"0.60303366",
"0.6006902",
"0.592121",
"0.5886744",
"0.5823161",
"0.5780076",
"0.5751824",
"0.57387066",
"0.56730044",
"0.56037164",
"0.55742764",
"0.54974335",
"0.54946965",
"0.5485356",
"0.54048... | 0.77018785 | 1 |
Get current X.509 certificate. | def get_current_cert(self):
return X509(m2.x509_store_ctx_get_current_cert(self.ctx), _pyfree=0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cert(self):\n return self._cert",
"def fetch_x509_context(self) -> X509Context:",
"def certificate(self) -> str:\n return pulumi.get(self, \"certificate\")",
"def certificate(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"certificate\")",
"def certificate(self) -> pulumi.... | [
"0.7629817",
"0.7381599",
"0.7361088",
"0.7091925",
"0.7091925",
"0.7091925",
"0.7058817",
"0.68946195",
"0.67497784",
"0.6693841",
"0.6693841",
"0.6658615",
"0.66542953",
"0.66542953",
"0.66521853",
"0.66521853",
"0.66521853",
"0.66521853",
"0.66521853",
"0.66521853",
"0.661... | 0.8463701 | 0 |
push an X509 certificate onto the stack. | def push(self, x509):
assert isinstance(x509, X509)
self.pystack.append(x509)
ret = m2.sk_x509_push(self.stack, x509._ptr())
assert ret == len(self.pystack)
return ret | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def push(self, x509_ext):\n self.pystack.append(x509_ext)\n ret = m2.sk_x509_extension_push(self.stack, x509_ext._ptr())\n assert ret == len(self.pystack)\n return ret",
"def add_certificate(self, certificate):\r\n return self.ssl.createObject(certificate)",
"def register(sel... | [
"0.711424",
"0.6362374",
"0.6184611",
"0.59185034",
"0.56562984",
"0.5460327",
"0.5432961",
"0.5294866",
"0.52900386",
"0.52636427",
"0.52636427",
"0.51882684",
"0.5077809",
"0.50609124",
"0.502947",
"0.50003433",
"0.49685544",
"0.49608448",
"0.49596453",
"0.4942769",
"0.4942... | 0.81152195 | 0 |
pop a certificate from the stack. | def pop(self):
x509_ptr = m2.sk_x509_pop(self.stack)
if x509_ptr is None:
assert len(self.pystack) == 0
return None
return self.pystack.pop() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pop(self):\n x509_ext_ptr = m2.sk_x509_extension_pop(self.stack)\n if x509_ext_ptr is None:\n assert len(self.pystack) == 0\n return None\n return self.pystack.pop()",
"def pop():\n stack = _get_stack()\n return _pop(stack)",
"def pop():",
"def stack_pop(s... | [
"0.7018235",
"0.6991799",
"0.6462122",
"0.64123833",
"0.63036233",
"0.6238903",
"0.62157905",
"0.62030643",
"0.6179791",
"0.6173119",
"0.6132166",
"0.61286694",
"0.60969055",
"0.6073704",
"0.6059181",
"0.6051365",
"0.60452116",
"0.60417515",
"0.60417515",
"0.6030065",
"0.6030... | 0.7481763 | 0 |
Create a new X509_Stack from DER string. | def new_stack_from_der(der_string):
stack_ptr = m2.make_stack_from_der_sequence(der_string)
if stack_ptr is None:
raise X509Error(Err.get_error())
return X509_Stack(stack_ptr, 1, 1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_cert_der_string(string):\n bio = BIO.MemoryBuffer(string)\n cptr = m2.d2i_x509(bio._ptr())\n if cptr is None:\n raise X509Error(Err.get_error())\n return X509(cptr, _pyfree=1)",
"def fromstring(cls, str_pkt):\n xml_pkt = lxml.objectify.fromstring(str_pkt)\n layers = [Lay... | [
"0.6396658",
"0.62104034",
"0.5964197",
"0.5823531",
"0.5339977",
"0.5197285",
"0.50741076",
"0.50294",
"0.4995994",
"0.49760744",
"0.4973736",
"0.49241787",
"0.49165922",
"0.4900766",
"0.48876584",
"0.485356",
"0.48518497",
"0.48302698",
"0.48290825",
"0.48279282",
"0.481259... | 0.79981846 | 0 |
Add X509 extensions to this request. | def add_extensions(self, ext_stack):
return m2.x509_req_add_extensions(self.req, ext_stack._ptr()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_ext(self, ext):\n assert m2.x509_type_check(self.x509), \"'x509' type error\"\n return m2.x509_add_ext(self.x509, ext.x509_ext, -1)",
"def install_extensions(self, builder):\n\n # BasicConstraints, critical\n if self.ca:\n ext = x509.BasicConstraints(ca=True, path_l... | [
"0.7356851",
"0.7103848",
"0.6935704",
"0.66757",
"0.6447627",
"0.6353632",
"0.61119014",
"0.60249734",
"0.59481204",
"0.59234005",
"0.5882426",
"0.58432275",
"0.5732172",
"0.56937176",
"0.5688725",
"0.5660926",
"0.56190974",
"0.55561763",
"0.5552475",
"0.5521087",
"0.5510574... | 0.8170804 | 0 |
Load certificate request from file. | def load_request(file, format=FORMAT_PEM):
f=BIO.openfile(file)
if format == FORMAT_PEM:
cptr= m2.x509_req_read_pem(f.bio_ptr())
elif format == FORMAT_DER:
cptr = m2.d2i_x509_req(f.bio_ptr())
else:
raise ValueError("Unknown filetype. Must be either FORMAT_PEM or FORMAT_DER")
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_cert_chain(self, certfile, keyfile: Optional[Any] = ...):\n ...",
"def load_cert(file):\n with open(file, \"r\") as pemfile:\n cert_content = pemfile.read()\n cert_stripped = \"\".join(\n [line for line in cert_content.splitlines() if \"CERTIFICATE\" not in line])\n\n ... | [
"0.7168039",
"0.6544806",
"0.6372282",
"0.6281101",
"0.6213959",
"0.6192097",
"0.61012256",
"0.60993826",
"0.6099269",
"0.60373986",
"0.5991677",
"0.5984801",
"0.5959469",
"0.5892691",
"0.5884498",
"0.5854931",
"0.57536876",
"0.5711324",
"0.56208885",
"0.5616491",
"0.5604466"... | 0.70600647 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.