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 |
|---|---|---|---|---|---|---|
Test personalized ads for a specific user | def test_personalized_ads(self):
user_id = 0
sentence = "Today we went to a Chinese food restaurant, 10/10!"
with self.client:
# Add categories
for category in [{'category': 'sport'}, {'category': 'food'}, {'category': 'games'}]:
data = category
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_func(self, user, **kwargs):\n return self.get_object().authorized_user(user)",
"def test_user(self):\n return True",
"def test_serve_user(self):\n pass",
"def test_privacy_mode_user_queries(self):\r\n admin = UserFactory.create()\r\n user = UserFactory.create()\r\n... | [
"0.60276634",
"0.58874404",
"0.5808809",
"0.5769596",
"0.5752524",
"0.5652933",
"0.56403106",
"0.5634998",
"0.5632043",
"0.5629308",
"0.5612492",
"0.5593957",
"0.5585318",
"0.55130357",
"0.551265",
"0.5506874",
"0.55034786",
"0.5502933",
"0.54540265",
"0.54358405",
"0.5428313... | 0.67656696 | 0 |
Converts a CLSID to a humanreadable string. | def _clsid(clsid):
#print((i32(clsid, 0), i16(clsid, 4), i16(clsid, 6)) +
# tuple(map(i8, clsid[8:16])))
assert len(clsid) == 16
# if clsid is only made of null bytes, return an empty string:
# (PL: why not simply return the string with zeroes?)
if not clsid.strip(b"\0"):
return "... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return str(self._id())",
"def gnss2str(gnss_id: int) -> str:\r\n\r\n try:\r\n return GNSSLIST[gnss_id]\r\n except KeyError:\r\n return str(gnss_id)",
"def name_from_iid(self, iid):\n retVal = iid.replace(\"_IID\", \"\")\n retVal = retVal.replace(\"_... | [
"0.5686846",
"0.5632872",
"0.5632235",
"0.5557221",
"0.5540661",
"0.55315214",
"0.5506275",
"0.5506275",
"0.5503998",
"0.5499865",
"0.54622096",
"0.5455138",
"0.5448502",
"0.54391575",
"0.5433763",
"0.54231495",
"0.54208994",
"0.54208994",
"0.54208994",
"0.54164714",
"0.54105... | 0.61222583 | 0 |
Set the target elf. Command gui to display appropriate messages. | def set_elf(self, elf):
self.logger.info('set elf ' + elf)
rc = self.debugger.set_elf(elf)
self.elf_set_status_sig.emit(rc)
# Console message
if rc is False:
self.write_console_output_sig.emit(
"[%s] Could not set elf target." % DEBUG)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_as_target(remote):\n cmd = mmapi.StoredCommands()\n cmd.AppendSceneCommand_SetAsTarget();\n remote.runCommand(cmd)",
"def target(self, target) :\n\t\ttry :\n\t\t\tself._target = target\n\t\texcept Exception as e:\n\t\t\traise e",
"def target(self, target) :\n\t\ttry :\n\t\t\tself._target = tar... | [
"0.5943852",
"0.5757368",
"0.5757368",
"0.5587151",
"0.55685425",
"0.54642373",
"0.53972536",
"0.5349878",
"0.5287665",
"0.52774537",
"0.52675635",
"0.52495927",
"0.5248468",
"0.5198822",
"0.5191",
"0.5172493",
"0.5166517",
"0.51387966",
"0.51304656",
"0.50817466",
"0.5067476... | 0.7210098 | 0 |
Run the current target. Read info from the dynlldb module. Command the gui to display appropriate messages. | def run_target(self):
self.logger.info('run_target')
# Clear all fields in GUI
self.clear_gui_sig.emit()
# Stop a previous target if it had a process running
self.debugger.stop_target()
if self.mode == self.AppMode.DYN_LINK:
self.run_target_dynlink()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def debug(target=None):\n logger.verbose(True)\n man = Manager()\n man.mode_dbg = True\n man.init_components(target)\n man.start_app()",
"def main_dbg():\n app.config[\"HC_CONFIG\"] = config_lexer.read_configuration()\n app.run(debug=True)",
"def launch(**kwargs):\n logger.info('launch ... | [
"0.6011515",
"0.57732916",
"0.56017584",
"0.5538934",
"0.5529202",
"0.5523344",
"0.5520598",
"0.5465162",
"0.54635024",
"0.5441076",
"0.5438848",
"0.5428619",
"0.5425364",
"0.54115456",
"0.5389536",
"0.5377345",
"0.5371123",
"0.5368664",
"0.53429914",
"0.5314549",
"0.52839917... | 0.7154867 | 0 |
Continue running the target elf. Depending on the execution point we can either step to the next instruction (eg. when in the .plt) or skip right to the next breakpoint (eg. after the loader was invoked). Each case interacts differently with the gui, thus the separate cases. Kind of too long... | def continue_target_dynlink(self):
self.logger.info('continue target')
func_info = self.debugger.get_func_info(self.bp_func)
if self.state == self.ExecStates.ON_BP_SHOW_PREV_FRAME:
self.logger.info("on bp show prev frame")
b = self.debugger.continue_target()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run(ep=None):\n global simulator, program, startpoint, recorder\n if program is None:\n print \"no program is loaded\"\n return\n\n if ep is None:\n ep = startpoint\n\n __record(ep, run, ep, True)\n simulator.run(ep)\n startpoint = ep\n exec_hooks(run)\n arrows()",
... | [
"0.6172254",
"0.6165628",
"0.61526763",
"0.602599",
"0.5967147",
"0.59364754",
"0.59097576",
"0.5838621",
"0.582645",
"0.5814536",
"0.57758534",
"0.5774662",
"0.5759358",
"0.57322663",
"0.5692507",
"0.5674979",
"0.5649082",
"0.56418395",
"0.5625641",
"0.56217676",
"0.5616213"... | 0.6210844 | 0 |
Sets the program brakpoint on a function from the .plt. Only one breakpoint can be active at a time. | def set_breakpoint(self, func):
if func == "":
return
if self.bp_func is not None:
self.debugger.set_breakpoint(self.bp_func, False)
self.bp_func = func
self.debugger.set_breakpoint(self.bp_func, True)
# Console output
self.write_console_output... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setPlotFocus(pt): \n if pt not in [None]+plotFocusList:\n return None\n simuConfig[\"PLOT.FOCUS\"] = pt",
"def gdb_breakpoint():\n _gdb_python_call_gen('gdb_breakpoint')()",
"def add_breakpoint():\n raise NotImplementedError()",
"def add_breakpoint(self, xval: XValue[T], yval: float... | [
"0.61337763",
"0.6113226",
"0.5969169",
"0.5782515",
"0.56517506",
"0.5552478",
"0.5546822",
"0.55010086",
"0.54666513",
"0.5458041",
"0.543125",
"0.5384502",
"0.5365627",
"0.53161836",
"0.5307523",
"0.5299782",
"0.526307",
"0.52618855",
"0.5233789",
"0.52099806",
"0.51932144... | 0.69599974 | 0 |
Return information for the report header. This will log the version of Django. | def pytest_report_header(config):
return [
'Review Board: %s' % reviewboard.get_version_string(),
'Djblets: %s' % djblets.get_version_string(),
'Django: %s' % django.get_version(),
] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format_report_header(self):",
"def report_header(self):\n pass",
"def print_header(now):\n global config\n date_time = datetime.datetime.fromtimestamp(now).strftime('%Y-%m-%d %H:%M:%S')\n\n print('*************************************')\n print(f'HTTP LOGS STATISTICS - {date_time}')",
... | [
"0.6692958",
"0.66845846",
"0.62322825",
"0.6163915",
"0.61100334",
"0.60979885",
"0.6077019",
"0.6075871",
"0.6027458",
"0.5977496",
"0.5883575",
"0.58397204",
"0.5827408",
"0.58064747",
"0.5786082",
"0.57771754",
"0.577142",
"0.57537293",
"0.5743186",
"0.57258576",
"0.57162... | 0.6862508 | 0 |
Calculates Solute Holding capacities and mass transfer between water column and benthic regions | def solute_holding_capacity(depth, surface_area, koc):
from .parameters import benthic, water_column
# Aqueous volumes in each region
vol1 = depth * surface_area # total volume in water column, approximately equal to water volume alone
vol2a = benthic.depth * surface_area # total benthic volume
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate_supply(self):\r\n \r\n for cell in self.cells:\r\n cell.supply = min(self.max_volume,\r\n self.wave_speed / self.free_speed *\r\n (self.cell_length * self.jam_density -\r\n cell.volume)) /... | [
"0.608622",
"0.60012114",
"0.594731",
"0.59393346",
"0.5821249",
"0.57903147",
"0.57896745",
"0.5781386",
"0.5734402",
"0.5715079",
"0.5700938",
"0.56962377",
"0.5663472",
"0.5657742",
"0.5637102",
"0.56316656",
"0.5601282",
"0.55997276",
"0.559913",
"0.5581938",
"0.55706596"... | 0.6378866 | 0 |
Get local package repository and load index | def get_local_repo():
repo = waptpackage.WaptLocalRepo(os.environ.get('WAPT_PATH', '/var/www/wapt'))
repo.update()
return repo | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_repository_data():\n return get_path(get_repository_dir(), 'data')",
"def from_pypi(request, fpkgs='/find-packages'):\n name = request.matchdict['name']\n version = request.matchdict['version']\n dists = PyPi.release_urls(name, version)\n flash = request.session.flash\n if not dists:\n ... | [
"0.63175863",
"0.5793165",
"0.57322735",
"0.5730594",
"0.57100123",
"0.5708537",
"0.56909645",
"0.56887746",
"0.56315064",
"0.5626757",
"0.5604025",
"0.5595059",
"0.55638266",
"0.5511984",
"0.54721504",
"0.54635847",
"0.54618615",
"0.5434367",
"0.5422501",
"0.54106534",
"0.54... | 0.60137826 | 1 |
Get remote package repositories and init connection | def get_remote_repos():
for name, rep in REPOS.items():
rep['repo'] = waptpackage.WaptRemoteRepo(name=name, url=rep['url'], timeout=4, http_proxy=os.environ.get('https_proxy'))
rep['repo'].verify_cert = True
return REPOS | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_repos():\n\n return __do_get_repos()",
"def fetch_repos(connection):\n\n try:\n response = connection.get_json('repository')\n except HTTPRequestError as ex:\n raise exception_from_http_error(ex) from ex\n\n result = response.get('result', [])\n return [Repository(connection,... | [
"0.67714405",
"0.6428206",
"0.64100236",
"0.6398346",
"0.63662636",
"0.63218576",
"0.62382454",
"0.6215522",
"0.6191209",
"0.6157868",
"0.61560416",
"0.6143169",
"0.60493475",
"0.6043746",
"0.603668",
"0.6034644",
"0.6033196",
"0.60269827",
"0.59894955",
"0.5956776",
"0.59520... | 0.7052851 | 0 |
refreshs all keys in the local DBM from the URL manager | def _refresh(self):
# if we have all the values we need to hookup to the URL
for key in self.DBMSettings.keys():
if not key.startswith(LOCALCHAR):
self.DBMSettings[key] = self._urldict()[key] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def refresh():\n DB.drop_all()\n DB.create_all()\n # TODO Get data from OpenAQ, make Record objects with it, and add to db\n DB.session.commit()\n return 'Data refreshed!'",
"def refresh():\n DB.drop_all()\n DB.create_all()\n # TODO Get data from OpenAQ, make Record objects with it, and a... | [
"0.6296809",
"0.6296809",
"0.6296809",
"0.6066129",
"0.5936563",
"0.5837777",
"0.58133763",
"0.5808752",
"0.5795443",
"0.57576764",
"0.57356316",
"0.5698441",
"0.56671965",
"0.5608904",
"0.5603211",
"0.56010777",
"0.55998415",
"0.55997735",
"0.55946946",
"0.55946946",
"0.5588... | 0.7377639 | 0 |
a semifactory type method, return the URLSettings pointer if we have one otherwise, create it and return it | def _urldict(self):
if not self.URLSettings == None:
return self.URLSettings
else:
if self._urlcheck():
# setup URLSettings as a URLDict with the proper settings
self.URLSettings = URLDict( self['.managerhost'],
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def settings() -> Settings:\n return Settings()",
"def create_settings(self, url_data, service_id, service_version):\n request_dict = {k: v[0] for k, v in url_data}\n\n create_settings = {\n \"service_id\": service_id,\n \"version\": service_version,\n \"general.... | [
"0.67936754",
"0.6352808",
"0.6148519",
"0.6014198",
"0.591363",
"0.5906574",
"0.579633",
"0.5784871",
"0.57689714",
"0.5745364",
"0.5705677",
"0.564058",
"0.56106263",
"0.55547",
"0.5525358",
"0.5521332",
"0.5489513",
"0.54853565",
"0.54306614",
"0.5398284",
"0.53974384",
... | 0.66541946 | 1 |
return the value of key, either from the local settings file, the local DB or the URL, and then cache it locally in the DB | def __getitem__(self,key):
# if it's a 'setting.' then check the DBM, the settings.txt
if key.startswith(LOCALCHAR):
if self.DBMSettings.has_key(key):
return self.DBMSettings[key]
else:
# it's a setting, check the local file and then p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(self, key):\n value = self.driftwood.cache.download(\"DB:\"+key) # Check if the value is cached.\n\n if not value:\n value = self.__scaffydb.get(key)\n\n if not value:\n self.driftwood.log.msg(\"ERROR\", \"Database\", \"no such key\", \"\\\"{0}\\\"\".format(key))... | [
"0.7395383",
"0.7132307",
"0.70726836",
"0.694112",
"0.6909824",
"0.69028544",
"0.6895652",
"0.68743736",
"0.68743736",
"0.6857283",
"0.67826277",
"0.6689936",
"0.6467178",
"0.6436643",
"0.64245534",
"0.64106065",
"0.6406629",
"0.63987476",
"0.63665956",
"0.63638204",
"0.6340... | 0.7282901 | 1 |
set the value in the DB or URL or settings file. if key starts with "setting." then it is stored locally only in the settings file | def __setitem__(self,key, value):
if key.startswith(LOCALCHAR):
# if we are putting a local setting, store it in the DB and settings file.
self.LocalSettings[key] = value
self.DBMSettings[key] = value
else:
# it's not something local only, so setup the DBM... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __setitem__(self, key, value):\n self.settings.set(key, value)",
"def set_setting(key, value):\n with sublime_haskell_settings as settings:\n settings[key] = value\n get_settings().set(key, value)\n save_settings()",
"def saveSetting(self,section,key,value):\n settings = {sect... | [
"0.7329032",
"0.7146673",
"0.69366264",
"0.6838875",
"0.67573595",
"0.6753256",
"0.6696445",
"0.66858053",
"0.6665462",
"0.6643887",
"0.6613387",
"0.6603649",
"0.65655106",
"0.6550104",
"0.65258586",
"0.65246373",
"0.64861524",
"0.64697444",
"0.6469338",
"0.6427714",
"0.64001... | 0.7936225 | 0 |
cast(itkLightObject obj) > itkThresholdSegmentationLevelSetImageFilterID2ID2D | def cast(*args):
return _itkThresholdSegmentationLevelSetImageFilterPython.itkThresholdSegmentationLevelSetImageFilterID2ID2D_cast(*args) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def itkThresholdSegmentationLevelSetImageFilterID2ID2D_cast(*args):\n return _itkThresholdSegmentationLevelSetImageFilterPython.itkThresholdSegmentationLevelSetImageFilterID2ID2D_cast(*args)",
"def itkThresholdSegmentationLevelSetImageFilterIF2IF2F_cast(*args):\n return _itkThresholdSegmentationLevelSetImageFi... | [
"0.7317763",
"0.69602925",
"0.67005634",
"0.654515",
"0.65173227",
"0.6511917",
"0.64960444",
"0.6478478",
"0.64703274",
"0.6445255",
"0.6444223",
"0.6410898",
"0.63994706",
"0.6398797",
"0.63909125",
"0.63687414",
"0.6348721",
"0.632899",
"0.6326499",
"0.6326468",
"0.6312569... | 0.7054719 | 1 |
New() > itkThresholdSegmentationLevelSetImageFilterID2ID2D Create a new object of the class itkThresholdSegmentationLevelSetImageFilterID2ID2D and set the input and the parameters if some named or nonnamed arguments are passed to that method. New() tries to assign all the non named parameters to the input of the new ob... | def New(*args, **kargs):
obj = itkThresholdSegmentationLevelSetImageFilterID2ID2D.__New_orig__()
import itkTemplate
itkTemplate.New(obj, *args, **kargs)
return obj | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def New(*args, **kargs):\n obj = itkThresholdSegmentationLevelSetImageFilterIF2IF2F.__New_orig__()\n import itkTemplate\n itkTemplate.New(obj, *args, **kargs)\n return obj",
"def New(*args, **kargs):\n obj = itkContourDirectedMeanDistanceImageFilterID2ID2.__New_orig__()\n ... | [
"0.76449573",
"0.6972659",
"0.6953555",
"0.69390565",
"0.6938342",
"0.68854594",
"0.68711585",
"0.67835695",
"0.6757741",
"0.6740783",
"0.6740581",
"0.6735739",
"0.67284083",
"0.6723157",
"0.6708133",
"0.6677817",
"0.66719407",
"0.66626775",
"0.66591215",
"0.66462713",
"0.663... | 0.8383676 | 0 |
itkThresholdSegmentationLevelSetImageFilterID2ID2D_cast(itkLightObject obj) > itkThresholdSegmentationLevelSetImageFilterID2ID2D | def itkThresholdSegmentationLevelSetImageFilterID2ID2D_cast(*args):
return _itkThresholdSegmentationLevelSetImageFilterPython.itkThresholdSegmentationLevelSetImageFilterID2ID2D_cast(*args) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cast(*args):\n return _itkThresholdSegmentationLevelSetImageFilterPython.itkThresholdSegmentationLevelSetImageFilterID2ID2D_cast(*args)",
"def itkThresholdSegmentationLevelSetImageFilterIF2IF2F_cast(*args):\n return _itkThresholdSegmentationLevelSetImageFilterPython.itkThresholdSegmentationLevelSetIm... | [
"0.7294599",
"0.70769775",
"0.6743314",
"0.6553998",
"0.65133744",
"0.6460269",
"0.6445589",
"0.64438605",
"0.6434699",
"0.6419761",
"0.64042693",
"0.64037067",
"0.6375267",
"0.63676065",
"0.636465",
"0.6340213",
"0.6332837",
"0.63279384",
"0.63178873",
"0.6315206",
"0.629502... | 0.77298045 | 0 |
cast(itkLightObject obj) > itkThresholdSegmentationLevelSetImageFilterID3ID3D | def cast(*args):
return _itkThresholdSegmentationLevelSetImageFilterPython.itkThresholdSegmentationLevelSetImageFilterID3ID3D_cast(*args) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def itkThresholdSegmentationLevelSetImageFilterID3ID3D_cast(*args):\n return _itkThresholdSegmentationLevelSetImageFilterPython.itkThresholdSegmentationLevelSetImageFilterID3ID3D_cast(*args)",
"def itkThresholdSegmentationLevelSetImageFilterIF3IF3F_cast(*args):\n return _itkThresholdSegmentationLevelSetImageFi... | [
"0.7209301",
"0.68689644",
"0.6615143",
"0.6600894",
"0.651897",
"0.65104765",
"0.64990205",
"0.6474515",
"0.64730364",
"0.6470683",
"0.64666504",
"0.64618325",
"0.6459481",
"0.64516294",
"0.64422476",
"0.6437559",
"0.63825923",
"0.63612485",
"0.6354498",
"0.63529867",
"0.635... | 0.6889926 | 1 |
New() > itkThresholdSegmentationLevelSetImageFilterID3ID3D Create a new object of the class itkThresholdSegmentationLevelSetImageFilterID3ID3D and set the input and the parameters if some named or nonnamed arguments are passed to that method. New() tries to assign all the non named parameters to the input of the new ob... | def New(*args, **kargs):
obj = itkThresholdSegmentationLevelSetImageFilterID3ID3D.__New_orig__()
import itkTemplate
itkTemplate.New(obj, *args, **kargs)
return obj | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def New(*args, **kargs):\n obj = itkThresholdSegmentationLevelSetImageFilterIF3IF3F.__New_orig__()\n import itkTemplate\n itkTemplate.New(obj, *args, **kargs)\n return obj",
"def New(*args, **kargs):\n obj = itkReinitializeLevelSetImageFilterIF3.__New_orig__()\n import i... | [
"0.78972745",
"0.71143615",
"0.70890355",
"0.6992841",
"0.69659144",
"0.69288987",
"0.6889642",
"0.68776995",
"0.6869911",
"0.6847723",
"0.6847122",
"0.6831883",
"0.6824473",
"0.6822326",
"0.68186426",
"0.681508",
"0.68134487",
"0.681233",
"0.68105024",
"0.6805832",
"0.679231... | 0.8504184 | 0 |
itkThresholdSegmentationLevelSetImageFilterID3ID3D_cast(itkLightObject obj) > itkThresholdSegmentationLevelSetImageFilterID3ID3D | def itkThresholdSegmentationLevelSetImageFilterID3ID3D_cast(*args):
return _itkThresholdSegmentationLevelSetImageFilterPython.itkThresholdSegmentationLevelSetImageFilterID3ID3D_cast(*args) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cast(*args):\n return _itkThresholdSegmentationLevelSetImageFilterPython.itkThresholdSegmentationLevelSetImageFilterID3ID3D_cast(*args)",
"def itkThresholdSegmentationLevelSetImageFilterIF3IF3F_cast(*args):\n return _itkThresholdSegmentationLevelSetImageFilterPython.itkThresholdSegmentationLevelSetIm... | [
"0.719463",
"0.7146745",
"0.6782238",
"0.67221576",
"0.66516876",
"0.6632296",
"0.661204",
"0.6539844",
"0.65397674",
"0.6532192",
"0.652296",
"0.65126014",
"0.65101147",
"0.65098053",
"0.6495247",
"0.6489122",
"0.6486863",
"0.64809346",
"0.6472191",
"0.64660865",
"0.6464932"... | 0.7688943 | 0 |
cast(itkLightObject obj) > itkThresholdSegmentationLevelSetImageFilterIF2IF2F | def cast(*args):
return _itkThresholdSegmentationLevelSetImageFilterPython.itkThresholdSegmentationLevelSetImageFilterIF2IF2F_cast(*args) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def itkThresholdSegmentationLevelSetImageFilterIF2IF2F_cast(*args):\n return _itkThresholdSegmentationLevelSetImageFilterPython.itkThresholdSegmentationLevelSetImageFilterIF2IF2F_cast(*args)",
"def itkBinaryContourImageFilterIF2IF2_cast(obj: 'itkLightObject') -> \"itkBinaryContourImageFilterIF2IF2 *\":\n ret... | [
"0.76542753",
"0.68155116",
"0.6797408",
"0.6748474",
"0.6747602",
"0.67378294",
"0.67185706",
"0.66765267",
"0.66664845",
"0.6659888",
"0.6634118",
"0.6613836",
"0.66097015",
"0.65771776",
"0.65644",
"0.65612817",
"0.6527321",
"0.652634",
"0.65179163",
"0.65167093",
"0.64896... | 0.72226197 | 1 |
New() > itkThresholdSegmentationLevelSetImageFilterIF2IF2F Create a new object of the class itkThresholdSegmentationLevelSetImageFilterIF2IF2F and set the input and the parameters if some named or nonnamed arguments are passed to that method. New() tries to assign all the non named parameters to the input of the new ob... | def New(*args, **kargs):
obj = itkThresholdSegmentationLevelSetImageFilterIF2IF2F.__New_orig__()
import itkTemplate
itkTemplate.New(obj, *args, **kargs)
return obj | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def New(*args, **kargs):\n obj = itkThresholdSegmentationLevelSetImageFilterID2ID2D.__New_orig__()\n import itkTemplate\n itkTemplate.New(obj, *args, **kargs)\n return obj",
"def New(*args, **kargs):\n obj = itkHuangThresholdImageFilterIF2ISS2.__New_orig__()\n import itk... | [
"0.74795395",
"0.72359747",
"0.7172076",
"0.71413183",
"0.7139767",
"0.7006789",
"0.6972409",
"0.6958476",
"0.69502664",
"0.69376004",
"0.6931795",
"0.6912964",
"0.69100153",
"0.6900817",
"0.6892454",
"0.68917257",
"0.68663836",
"0.68546194",
"0.6843664",
"0.6824719",
"0.6803... | 0.8467628 | 0 |
itkThresholdSegmentationLevelSetImageFilterIF2IF2F_cast(itkLightObject obj) > itkThresholdSegmentationLevelSetImageFilterIF2IF2F | def itkThresholdSegmentationLevelSetImageFilterIF2IF2F_cast(*args):
return _itkThresholdSegmentationLevelSetImageFilterPython.itkThresholdSegmentationLevelSetImageFilterIF2IF2F_cast(*args) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cast(*args):\n return _itkThresholdSegmentationLevelSetImageFilterPython.itkThresholdSegmentationLevelSetImageFilterIF2IF2F_cast(*args)",
"def itkBinaryContourImageFilterIF2IF2_cast(obj: 'itkLightObject') -> \"itkBinaryContourImageFilterIF2IF2 *\":\n return _itkBinaryContourImageFilterPython.itkBin... | [
"0.7546829",
"0.70317763",
"0.6924223",
"0.69231355",
"0.6912477",
"0.6891269",
"0.6876223",
"0.6874975",
"0.6874549",
"0.6867892",
"0.6814128",
"0.67884517",
"0.6784134",
"0.67438495",
"0.6678557",
"0.6656256",
"0.6651595",
"0.6644246",
"0.6642174",
"0.6632778",
"0.6630479",... | 0.80827314 | 0 |
cast(itkLightObject obj) > itkThresholdSegmentationLevelSetImageFilterIF3IF3F | def cast(*args):
return _itkThresholdSegmentationLevelSetImageFilterPython.itkThresholdSegmentationLevelSetImageFilterIF3IF3F_cast(*args) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def itkThresholdSegmentationLevelSetImageFilterIF3IF3F_cast(*args):\n return _itkThresholdSegmentationLevelSetImageFilterPython.itkThresholdSegmentationLevelSetImageFilterIF3IF3F_cast(*args)",
"def cast(obj: 'itkLightObject') -> \"itkHuangThresholdImageFilterIF3IUS3 *\":\n return _itkHuangThresholdImageF... | [
"0.7473776",
"0.6951387",
"0.69450647",
"0.6919215",
"0.6896403",
"0.68893766",
"0.68640095",
"0.6810401",
"0.6806885",
"0.67720574",
"0.6750099",
"0.670569",
"0.6699713",
"0.6681266",
"0.6679633",
"0.66769445",
"0.66750157",
"0.6673079",
"0.6664501",
"0.6662498",
"0.6658105"... | 0.70774716 | 1 |
New() > itkThresholdSegmentationLevelSetImageFilterIF3IF3F Create a new object of the class itkThresholdSegmentationLevelSetImageFilterIF3IF3F and set the input and the parameters if some named or nonnamed arguments are passed to that method. New() tries to assign all the non named parameters to the input of the new ob... | def New(*args, **kargs):
obj = itkThresholdSegmentationLevelSetImageFilterIF3IF3F.__New_orig__()
import itkTemplate
itkTemplate.New(obj, *args, **kargs)
return obj | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def New(*args, **kargs):\n obj = itkThresholdSegmentationLevelSetImageFilterID3ID3D.__New_orig__()\n import itkTemplate\n itkTemplate.New(obj, *args, **kargs)\n return obj",
"def New(*args, **kargs):\n obj = itkHuangThresholdImageFilterIF3ISS3.__New_orig__()\n import itk... | [
"0.7859565",
"0.7401686",
"0.73201567",
"0.7261661",
"0.72541434",
"0.7216809",
"0.7158068",
"0.71521986",
"0.71271557",
"0.71151334",
"0.7108641",
"0.71076304",
"0.7092853",
"0.70817626",
"0.70721686",
"0.70538735",
"0.7051881",
"0.7002831",
"0.69878745",
"0.69857913",
"0.69... | 0.86294013 | 0 |
itkThresholdSegmentationLevelSetImageFilterIF3IF3F_cast(itkLightObject obj) > itkThresholdSegmentationLevelSetImageFilterIF3IF3F | def itkThresholdSegmentationLevelSetImageFilterIF3IF3F_cast(*args):
return _itkThresholdSegmentationLevelSetImageFilterPython.itkThresholdSegmentationLevelSetImageFilterIF3IF3F_cast(*args) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cast(*args):\n return _itkThresholdSegmentationLevelSetImageFilterPython.itkThresholdSegmentationLevelSetImageFilterIF3IF3F_cast(*args)",
"def itkHuangThresholdImageFilterIF3ISS3_cast(obj: 'itkLightObject') -> \"itkHuangThresholdImageFilterIF3ISS3 *\":\n return _itkHuangThresholdImageFilterPython.i... | [
"0.7516081",
"0.72488433",
"0.7213387",
"0.7206106",
"0.71808314",
"0.71590215",
"0.7137719",
"0.7125754",
"0.7115165",
"0.7052657",
"0.7004331",
"0.6959764",
"0.6950602",
"0.6944445",
"0.693499",
"0.6925875",
"0.69155777",
"0.6906629",
"0.68950164",
"0.6867126",
"0.686403",
... | 0.8021722 | 0 |
Generate a `DDPGAgent` instance that represents an agent learned using | def get_agent(env) -> DDPGAgent:
assert len(env.action_space.shape) == 1
nb_actions = env.action_space.shape[0]
action_input = Input(shape=(nb_actions,), name='action_input')
observation_input = Input(shape=(1,) + env.observation_space.shape, name='observation_input')
range_action_input = 0.5 * (en... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_agent(cls, feature_dim: int):\n params = LinUCBTrainerParameters()\n policy_network = LinearRegressionUCB(input_dim=feature_dim)\n policy = Policy(scorer=policy_network, sampler=GreedyActionSampler())\n # pyre-ignore\n trainer = LinUCBTrainer(policy, **params.asdict())\n... | [
"0.66879374",
"0.66290796",
"0.6546695",
"0.6366063",
"0.63282555",
"0.627354",
"0.62347776",
"0.6154088",
"0.6118832",
"0.6109801",
"0.61085314",
"0.6076112",
"0.60550135",
"0.60518867",
"0.6044887",
"0.60417926",
"0.6011257",
"0.6006178",
"0.5980342",
"0.5949185",
"0.592954... | 0.6995858 | 0 |
The YAML version of a newly created simulation should be equivalent to the configuration file used | def test_yaml(self):
with utils.timer('loading'):
config = serialization.load_file(join(EXAMPLES, 'complete.yml'))[0]
s = simulation.from_config(config)
with utils.timer('serializing'):
serial = s.to_yaml()
with utils.timer('recovering'):
recovered... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _dump_config_to_yaml_file(self,\n sim_config_params = None,\n sim_inputs = None,\n sim_outputs = None,\n sim_other_vars = None,\n is_aux_yaml = Fa... | [
"0.68480617",
"0.68386084",
"0.6588354",
"0.6482147",
"0.64627534",
"0.6446826",
"0.63399523",
"0.63123226",
"0.61987096",
"0.6137657",
"0.61308897",
"0.61026585",
"0.60724115",
"0.60687405",
"0.60627127",
"0.60525686",
"0.5998133",
"0.5993056",
"0.59904075",
"0.5979543",
"0.... | 0.72631 | 0 |
The configuration should not change after running the simulation. | def test_configuration_changes(self):
config = serialization.load_file(join(EXAMPLES, 'complete.yml'))[0]
s = simulation.from_config(config)
for i in range(5):
s.run_simulation(dry_run=True)
nconfig = s.to_dict()
del nconfig['topology']
assert conf... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_configuration(self):\n raise NotImplementedError",
"def configuration():",
"def config(self):\n\t\tsys.stderr.write(\"Base class method called: config() This souldn't happen.\\n\")",
"def configure(self, conf):\n return False",
"async def reset_config(self):\n self.config = ... | [
"0.73851746",
"0.7247599",
"0.7052301",
"0.672358",
"0.6689056",
"0.66811365",
"0.66811365",
"0.6680261",
"0.6680261",
"0.6659512",
"0.66126525",
"0.66097623",
"0.6609724",
"0.6608305",
"0.65957993",
"0.65612483",
"0.65466076",
"0.6541588",
"0.6485782",
"0.6468905",
"0.646333... | 0.73098975 | 1 |
There is a bug in networkx that prevents it from creating a GEXF file from geometric models. We should work around it. | def test_save_geometric(self):
G = nx.random_geometric_graph(20, 0.1)
env = Environment(topology=G)
f = io.BytesIO()
env.dump_gexf(f) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gexf_graph():\n # you must replace these lines and supply your own graph\n \n \n \n my_gexf = Gexf(\"JiajiaXie\", \"My awesome graph\")\n graph=my_gexf.addGraph(\"undirected\", \"static\", \"My awesome networks\")\n \n atr1=graph.addNodeAttribute('Type',type='string')\n\n\n for set i... | [
"0.68025506",
"0.65145785",
"0.6502526",
"0.6079972",
"0.6053928",
"0.6021151",
"0.6005889",
"0.594116",
"0.59306437",
"0.5879413",
"0.5875649",
"0.5751876",
"0.5678024",
"0.5677547",
"0.565046",
"0.5624308",
"0.56178105",
"0.560601",
"0.5546288",
"0.55363846",
"0.55355895",
... | 0.72836775 | 0 |
Use espresso to minimize a truth table. | def minimize(table):
with TemporaryDirectory(prefix="truthtables_minimize") as d:
d = Path(d)
input_file = d / "in.pla"
output_file = d / "out.pla"
to_file(table, input_file)
with open(output_file, "w+") as f:
try:
subprocess.run(["espresso", str(i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def boolean_func(experiment):",
"def simple_using_boolean_constant():\n examples = [\n benchmark.Example(\n inputs=[\n tf.SparseTensor(indices=[[0, 0], [0, 1], [1, 1]],\n values=[12, 34, 56],\n dense_shape=[2, 2]),\n ]... | [
"0.5557359",
"0.5364931",
"0.5326105",
"0.5235777",
"0.5178643",
"0.5002223",
"0.49831763",
"0.4936247",
"0.49298984",
"0.4925215",
"0.49223292",
"0.49084207",
"0.48835245",
"0.4863027",
"0.48294064",
"0.48248395",
"0.4823919",
"0.4821429",
"0.48036745",
"0.48036483",
"0.4785... | 0.5378468 | 1 |
Save instance to a pickle file. Saves the instance to a pickle file. If not specified by argument outputdir, the location of the pickle is given by the location of the first index file associated. | def pickle(self, outputdir=None, verbose=True):
# the associated pickle file does not exist
if not getattr(self, 'pickleFile', False):
if outputdir is None:
outputdir = os.path.split(self.indexFiles[0])[0] + '-pickle'
if not os.path.isdir(outputdir):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save(self):\n pickle_save(self.results, 'results', self.main_dir)",
"def save_outputs(self):\n write_pickled(join(self.output_folder, \"results.pkl\"), self.get_results())",
"def save(self, output_path):\n with open(output_path, \"wb\") as file:\n dill.dump(self, file)",
"... | [
"0.66714746",
"0.6618241",
"0.6508773",
"0.6403314",
"0.6312957",
"0.6310538",
"0.6208602",
"0.6206865",
"0.61265486",
"0.6103836",
"0.6096983",
"0.6087026",
"0.60865366",
"0.60724443",
"0.6067969",
"0.6033665",
"0.6030118",
"0.6018466",
"0.6018346",
"0.6007477",
"0.6006252",... | 0.7522189 | 0 |
Generates dictionary of best algorithm data set. | def generate(dictalg):
# dsList, sortedAlgs, dictAlg = processInputArgs(args, verbose=verbose)
res = {}
for f, i in pproc.dictAlgByFun(dictalg).iteritems():
for d, j in pproc.dictAlgByDim(i).iteritems():
tmp = BestAlgSet(j)
res[(d, f)] = tmp
return res | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extractBestAlgorithms(args = algs2009, f_factor=2,\n target_lb=1e-8, target_ub=1e22):\n\n # TODO: use pproc.TargetValues class as input target values\n # default target values:\n targets = pproc.TargetValues(\n 10**np.arange(np.log10(max((1e-8, target_lb))),\n ... | [
"0.66301125",
"0.64245284",
"0.61742115",
"0.6002606",
"0.5943174",
"0.57709193",
"0.57338953",
"0.57084924",
"0.56668943",
"0.5653029",
"0.556942",
"0.55543864",
"0.5527972",
"0.5499146",
"0.5474559",
"0.5455179",
"0.5449456",
"0.54153854",
"0.54153854",
"0.5393002",
"0.5390... | 0.7331211 | 0 |
Generates best algorithm data set. It will create a folder bestAlg in the current working directory with a pickle file corresponding to the bestalg dataSet of the algorithms listed in variable args. This method is called from the python command line from a directory | def customgenerate(args = algs2009):
outputdir = 'bestCustomAlg'
verbose = True
dsList, sortedAlgs, dictAlg = pproc.processInputArgs(args, verbose=verbose)
if not os.path.exists(outputdir):
os.mkdir(outputdir)
if verbose:
print 'Folder %s was created.' % (outputdir)
r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main(dir_models='/Volumes/ext_ssd/jlab/data_imi_10games/saved_models', dir_out='best_models'):\n random.seed(1234)\n\n subdirs = [f for f in os.listdir(dir_models) if os.path.isdir(os.path.join(dir_models, f))]\n\n path_best_models = []\n for subdir in subdirs:\n trial_num = str(random.randi... | [
"0.67348516",
"0.657638",
"0.6346821",
"0.62950116",
"0.6232055",
"0.6131713",
"0.6130831",
"0.59383625",
"0.587787",
"0.58466244",
"0.58225167",
"0.5812448",
"0.57541144",
"0.5732498",
"0.57011443",
"0.56977975",
"0.5695094",
"0.567267",
"0.56643",
"0.565623",
"0.5649886",
... | 0.7497031 | 0 |
Computes first the artificial best algorithm from given algorithm list algnamelist, constructed by extracting for each target/function pair the algorithm with best ERT among the given ones. Returns then the list of algorithms that are contributing to the definition of the best algorithm, separated by dimension, and sor... | def getAllContributingAlgorithmsToBest(algnamelist, target_lb=1e-8,
target_ub=1e2):
print "Generating best algorithm data from given algorithm list...\n",
customgenerate(algnamelist)
bestalgfilepath = 'bestCustomAlg'
picklefilename = os.path.join(besta... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extractBestAlgorithms(args = algs2009, f_factor=2,\n target_lb=1e-8, target_ub=1e22):\n\n # TODO: use pproc.TargetValues class as input target values\n # default target values:\n targets = pproc.TargetValues(\n 10**np.arange(np.log10(max((1e-8, target_lb))),\n ... | [
"0.780423",
"0.6240606",
"0.613762",
"0.58589613",
"0.58589613",
"0.558103",
"0.55471444",
"0.55081564",
"0.54677",
"0.5384782",
"0.5276059",
"0.52733636",
"0.5254752",
"0.5194547",
"0.5175983",
"0.5173295",
"0.5147905",
"0.51121175",
"0.51110125",
"0.5110374",
"0.50805795",
... | 0.79801625 | 0 |
Assume d is a dictionary of dataset where d[domain] = another dataset class Assume labeled domain = train set, unlabeled = test | def prepare_data(self,d):
train_loaders, train_iters = {}, {}
unlabeled_loaders, unlabeled_iters = {}, {}
for domain in opt.domains:
#CONVERT TO FLOAT32
features, target = torch.from_numpy(d[domain].X.todense().astype('float32')), torch.from_numpy(d[domain].y)#.reshape((-... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def classify_test(classifier, test_data):\n for d in test_data:\n test(d[\"name\"], d[\"attribute\"], classifier)",
"def provide_domained_dataset(tfds_name,\n batch_size,\n patch_size,\n split='train',\n ... | [
"0.6009962",
"0.5992759",
"0.59629697",
"0.5872429",
"0.58517283",
"0.58084655",
"0.57736",
"0.57624894",
"0.5711926",
"0.570965",
"0.5695993",
"0.5682845",
"0.56567293",
"0.56492436",
"0.5612608",
"0.5611446",
"0.5593163",
"0.55872667",
"0.5579704",
"0.5578066",
"0.55715686"... | 0.68281597 | 0 |
ISMEMBER Returns an array containing logical 1 (true) where the data in A is found in B. | def ismember(A,B):
return [np.sum(a==B) for a in A] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ismember(a, b):\n bind = {}\n for i, elt in enumerate(b):\n if elt not in bind:\n bind[elt] = True\n return np.array([bind.get(itm, False) for itm in a]) # None can be replaced by any other \"not in b\" value",
"def where_in(a, b):\n return torch.nonzero((a[..., None] == b).any... | [
"0.7621462",
"0.6476544",
"0.6180507",
"0.61512595",
"0.5905726",
"0.55650175",
"0.54953325",
"0.543418",
"0.54205424",
"0.5332937",
"0.53080714",
"0.5252398",
"0.52393883",
"0.5237298",
"0.52249694",
"0.52166164",
"0.52119595",
"0.5182715",
"0.5173036",
"0.51680595",
"0.5144... | 0.7688378 | 0 |
Read NORAD twoline element (TLE) file. Adapted from Mr. Brett Pantalone's MATLAB function. | def readtle(file, catalog=np.zeros(1)):
# Adapted from Mr. Brett Pantalone's MATLAB readtle function.
# INPUTS:
# file - Path to any standard two-line element file.
# catalog - Optional array of NORAD catalog numbers for the satellites of
# interest. The default action is to di... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_tle_bytes(f):\n lines=f.splitlines()\n\n tles=[]\n ctle=None\n state=\"none\"\n for l in lines:\n m_name=re.fullmatch(b\"^\\s*((\\S.*)?\\S)\\s*$\",l)\n m_line1=re.fullmatch(\"^\\s*(1)\\s+(\\d{1,5})(\\w)\\s+\"\\\n \"(\\d{2})(\\d{3})(\\w{0,3})\\s+(\\d{2})(\\s{0,2... | [
"0.5525374",
"0.533525",
"0.53021777",
"0.5299794",
"0.5260334",
"0.5188205",
"0.51339114",
"0.51277614",
"0.51071644",
"0.5056691",
"0.5053498",
"0.50009197",
"0.49483347",
"0.49390408",
"0.48836797",
"0.48821932",
"0.48321483",
"0.48246655",
"0.48012182",
"0.47815126",
"0.4... | 0.59436417 | 0 |
Retrieve all the cfdi attachments generated for this payment. | def l10n_mx_edi_retrieve_attachments(self):
self.ensure_one()
if not self.l10n_mx_edi_cfdi_name:
return []
domain = [
('res_id', '=', self.id),
('res_model', '=', self._name),
('name', '=', self.l10n_mx_edi_cfdi_name )]
return self.env['ir.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_attachments(self, expense_id):\n return self._get_request({}, Expenses.GET_EXPENSE_ATTACHMENTS.format(expense_id))",
"def attachments(self):\n return self._attachments",
"def attachments(self):\n return self.properties.get('attachments',\n Attachme... | [
"0.66538346",
"0.66209143",
"0.6503404",
"0.6252655",
"0.6223502",
"0.6133023",
"0.61154896",
"0.6057783",
"0.60495985",
"0.5935897",
"0.58950007",
"0.58665025",
"0.5858167",
"0.58529776",
"0.58314985",
"0.5795391",
"0.57729983",
"0.5695954",
"0.56882167",
"0.56687754",
"0.56... | 0.7527679 | 0 |
Post process the results of the sign service. | def _l10n_mx_edi_post_sign_process(self, xml_signed, code=None, msg=None):
# TODO - Duplicated
self.ensure_one()
if xml_signed:
body_msg = _('The sign service has been called with success')
# Update the pac status
self.l10n_mx_edi_pac_status = 'signed'
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post(self):\n self.finish(self.register())",
"def on_signature_response(self, messages):\n for message in messages:\n # get cache object linked to this request and stop timeout from occurring\n cache = self._request_cache.pop(message.payload.identifier, SignatureRequestCac... | [
"0.61417335",
"0.5882148",
"0.5713939",
"0.57018983",
"0.56794953",
"0.56527174",
"0.55807704",
"0.55655295",
"0.5533435",
"0.5479674",
"0.5458378",
"0.54515034",
"0.54219514",
"0.5392945",
"0.5371521",
"0.53646356",
"0.5357836",
"0.5357836",
"0.5357836",
"0.5357836",
"0.5357... | 0.6568863 | 0 |
Call the right method according to the pac_na me, it's info returned by the '_l10n_mx_edi_%s_info' % pac_name' method and the service_type passed as parameter. | def _l10n_mx_edi_call_service(self, service_type):
invoice_obj = self.env['account.invoice']
pac_name = self.company_id.l10n_mx_edi_pac
pac_info_func = '_l10n_mx_edi_%s_info' % pac_name
service_func = '_l10n_mx_edi_%s_%s' % (pac_name, service_type)
pac_info = getattr(self, pac_in... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pacMare(date, estac):\n monthList = [\"JAN\", \"FEV\", \"MAR\", \"ABR\", \"MAI\", \"JUN\", \"JUL\",\n \"AGO\", \"SET\", \"OUT\", \"NOV\", \"DEZ\"]\n an = date.year\n Mesl = date.month\n strmes = monthList[Mesl-1]\n di = date.day\n data1 = \"%s/%s/%s\" %(di, Mesl, an... | [
"0.5456215",
"0.5309164",
"0.521962",
"0.49598265",
"0.49081552",
"0.47303948",
"0.46571442",
"0.4593991",
"0.45910516",
"0.45841748",
"0.4570612",
"0.45479184",
"0.45107764",
"0.45079437",
"0.44972292",
"0.44065884",
"0.43972406",
"0.43823063",
"0.43771026",
"0.43571168",
"0... | 0.60715353 | 0 |
This gets the Celery configuration file as a module that Celery uses | def get_celery_config_file():
return importlib.import_module("security_monkey.{}".format(os.environ.get("SM_CELERY_CONFIG", "celeryconfig")),
"security_monkey") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def celery_config() -> Dict:\n with open(script_dir + 'config.yml', 'r') as yamlfile:\n cfg = yaml.load(yamlfile, Loader=yaml.SafeLoader)\n celery_cfg = cfg['celery']\n result = {\n 'main': celery_cfg['main'],\n 'broker': celery_cfg['broker_url'],\n 'backend... | [
"0.7556319",
"0.65990853",
"0.6598581",
"0.65776646",
"0.6507785",
"0.64971656",
"0.6481209",
"0.6431267",
"0.6364437",
"0.6346748",
"0.63448423",
"0.63100564",
"0.6299827",
"0.6193067",
"0.6181969",
"0.61579156",
"0.61440384",
"0.613805",
"0.6112308",
"0.6106426",
"0.6100490... | 0.8334067 | 0 |
This returns a celery configuration value of a given type back. If it's not set, it will return None. | def get_sm_celery_config_value(celery_config, variable_name, variable_type):
try:
# Directly load the config that Celery is configured to use:
value = getattr(celery_config, variable_name, None)
if value is None:
return
if not isinstance(value, variable_type):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_config_value(config_parser, section, option, required=True, get_type=str, default=None):\n if get_type is int:\n getter = config_parser.getint\n elif get_type is bool:\n getter = config_parser.getboolean\n else:\n getter = config_parser.get\n\n try:\n value = getter(... | [
"0.6528778",
"0.6523631",
"0.63878417",
"0.6293228",
"0.6193853",
"0.6183516",
"0.61019826",
"0.5999511",
"0.5988352",
"0.59503144",
"0.5898795",
"0.5883137",
"0.58804286",
"0.58637154",
"0.5854756",
"0.58423555",
"0.584183",
"0.58186024",
"0.58021766",
"0.57643515",
"0.57604... | 0.7946718 | 0 |
Generates a histogram based on the given HSV image. The histogram contains 20 bins for different hue values and 8 bins for greyscale. | def HsvHistogram(self):
if not self._hsvHistogram is 0:
return self._hsvHistogram
if not self._bicHistogram is 0:
self._hsvHistogram = self._bicHistogram[:28] + self._bicHistogram[28:]
return self._hsvHistogram
hsvimg = self.HsvImage()
#Note that in Op... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_hsv_hist(img):\n hsv = cv2.cvtColor(img.data, cv2.COLOR_BGR2HSV)\n\n hue_counts = {}\n hue_pixels = {}\n\n for rnum, row in enumerate(hsv):\n for cnum, pix in enumerate(row):\n hue = pix[0]\n val = pix[2]\n sat = pix[1]\n #ignore white\n ... | [
"0.781732",
"0.7759669",
"0.7682055",
"0.71941257",
"0.7113105",
"0.7102163",
"0.70853996",
"0.70363617",
"0.66779506",
"0.64649224",
"0.6461487",
"0.6449467",
"0.63386065",
"0.6330202",
"0.6277198",
"0.62452763",
"0.61892104",
"0.6140188",
"0.6135483",
"0.61206156",
"0.61167... | 0.78685606 | 0 |
r""" Constructs the hilbert space for spin`s` fermions on `n_orbitals`. Samples of this hilbert space represent occupation numbers (0,1) of the orbitals. The number of fermions may be fixed to `n_fermions`. If the spin is different from 0 or None, n_fermions can also be a list to fix the number of fermions per spin com... | def __init__(
self,
n_orbitals: int,
s: float = None,
n_fermions: Optional[Union[int, list[int]]] = None,
):
if s is None:
total_size = n_orbitals
else:
spin_size = round(2 * s + 1)
total_size = n_orbitals * spin_size
if n_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def U_QFT(n):\n dim = 2**n # Hilbert space dimensionality\n Gate= [[np.exp(2 * np.pi * 1j * x * y / dim) for x in range(dim)] for y in range(dim)]\n Gate = np.array(Gate)/np.sqrt(dim)\n return Gate",
"def hilbertPlot(f):\n order = getOrder(f)\n img = np.zeros(shape=(2 ** order, 2 ** order))\n ... | [
"0.5797988",
"0.54930645",
"0.53868264",
"0.5104891",
"0.5072298",
"0.5044574",
"0.49317515",
"0.4926007",
"0.48620248",
"0.48265824",
"0.47589272",
"0.47150907",
"0.47147918",
"0.47004667",
"0.4646693",
"0.463587",
"0.46063593",
"0.46057776",
"0.45946452",
"0.45736915",
"0.4... | 0.7087839 | 0 |
Returns the spin of the fermions | def spin(self) -> float:
return self._s | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def spin(mult):\n return mult - 1",
"def get_spin(self, i):\n \n return 1 if self.spins[i] else -1",
"def Spin(phi,theta):\n return 1/2*(cos(phi)*sin(theta)*xhat + sin(phi)*sin(theta)*yhat + cos(theta)*zhat)",
"def comp_angle_opening_magnet(self):\n\n if self.W1 > 0:\n Rbo = sel... | [
"0.69950026",
"0.6225161",
"0.61911976",
"0.5883944",
"0.58079344",
"0.5803219",
"0.57843196",
"0.57279974",
"0.5684222",
"0.5680404",
"0.56784093",
"0.5668666",
"0.55882263",
"0.55768055",
"0.5551046",
"0.55394095",
"0.5529852",
"0.5526801",
"0.5511344",
"0.5499542",
"0.5495... | 0.7203596 | 0 |
return the index of the Fock block corresponding to the sz projection | def _spin_index(self, sz: float) -> int:
if self.spin is None:
if sz is not None or not np.isclose(sz, 0):
raise Exception("cannot request spin index of spinless fermions")
return 0
else:
return round(sz + self.spin) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ccIdx(self):\n return self.loc[self.depth]",
"def _get_cindex(circ, name, index):\n ret = 0\n for reg in circ.cregs:\n if name != reg.name:\n ret += reg.size\n else:\n return ret + index\n return ret + index",
"def _get_qindex(circ, name, index):\n ret... | [
"0.6346142",
"0.6193742",
"0.6180611",
"0.61689997",
"0.6059895",
"0.60430384",
"0.5988083",
"0.5949405",
"0.59110194",
"0.59091663",
"0.58903694",
"0.58106893",
"0.5804498",
"0.57914215",
"0.57558274",
"0.5735431",
"0.57280296",
"0.5703352",
"0.5703245",
"0.5676842",
"0.5642... | 0.6547991 | 0 |
Make prediction based on majority class of train dataset | def majority_class(self, test_size):
prediction = self.train.label.mode()[0]
y_pred = [prediction] * test_size
return y_pred | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def predict(x):\n\n scores = np.zeros(shape=(len(classes_def), len(x)))\n\n for idx, c in enumerate(classes_def):\n\n model_name = model_name_pre + c + model_name_post\n print('Loading model', model_name, 'and making predictions..')\n model = load_model(model_name)\n\n scores[idx]... | [
"0.73248214",
"0.72118586",
"0.72032154",
"0.7151489",
"0.7144038",
"0.7085198",
"0.70493674",
"0.6971675",
"0.6971675",
"0.6971675",
"0.69387907",
"0.692446",
"0.6898707",
"0.68845385",
"0.68832576",
"0.688309",
"0.6876379",
"0.6802405",
"0.67383075",
"0.6720341",
"0.6713019... | 0.76265967 | 0 |
Create schema or namespace if does not exist | def create_schema(self, schema: str):
return | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_schema(schema): \n\n query = \"CREATE SCHEMA IF NOT EXISTS {}\".format(schema)\n qdb.execute(query)",
"def create_schemas():\n\n for name in get_schemas():\n create_schema(name)\n\n print(green('ALL SCHEMAS CREATED'))",
"def createSchema(schema):\n return \"CREATE SCHEMA \\\"{n... | [
"0.7071613",
"0.6876257",
"0.6863398",
"0.6835801",
"0.66813534",
"0.6387472",
"0.6294934",
"0.62870246",
"0.62810874",
"0.62351745",
"0.6088327",
"0.60840434",
"0.6057339",
"0.6019758",
"0.60077435",
"0.599771",
"0.5971816",
"0.59522057",
"0.5924838",
"0.59207916",
"0.587637... | 0.70882416 | 0 |
Create misfits table if does not exist | def create_misfits_table(self, schema: str):
return | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def insert_misfits(self, schema: str, misfits: List[dict]):\n return",
"def _create_table_if_not_exists(self) -> bigquery.Table:\n table = self.client.create_table(\n table=bigquery.Table(table_ref=self._table_ref, schema=Schema),\n exists_ok=True,\n )\n logging.... | [
"0.65010846",
"0.6255917",
"0.6072083",
"0.6061742",
"0.6058533",
"0.5989394",
"0.5968818",
"0.5918865",
"0.58964455",
"0.587468",
"0.5776405",
"0.5760882",
"0.57527506",
"0.57400507",
"0.5721688",
"0.5705203",
"0.56743723",
"0.56445485",
"0.56305426",
"0.5610155",
"0.5609625... | 0.77973133 | 0 |
Create misfits table if does not exist | def insert_misfits(self, schema: str, misfits: List[dict]):
return | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_misfits_table(self, schema: str):\n return",
"def _create_table_if_not_exists(self) -> bigquery.Table:\n table = self.client.create_table(\n table=bigquery.Table(table_ref=self._table_ref, schema=Schema),\n exists_ok=True,\n )\n logging.info(\"table %s... | [
"0.779613",
"0.6259269",
"0.6074648",
"0.6065671",
"0.6060536",
"0.5993914",
"0.59707904",
"0.5923863",
"0.59006983",
"0.5877432",
"0.5780372",
"0.57664883",
"0.57570076",
"0.57453257",
"0.5725309",
"0.5710089",
"0.5679856",
"0.56471354",
"0.5635639",
"0.5615736",
"0.5612979"... | 0.64983237 | 1 |
Teradata Extended Holdings ETL application, inherit common functionalities from GenericETL class. | def __init__(
self,
db_host: str,
db_port: int,
db_name: str,
db_user: str,
db_password: str,
mdc_schema: str,
audit_schema: str,
etl_step: str,
job_scheduler: str,
support_email_address: ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main():\n # start Spark application and get Spark session, logger and config\n spark = SparkSession \\\n .builder \\\n .appName(\"PokemonBasicETLOperations\") \\\n .config(\"spark.eventLog.enabled\", True) \\\n .enableHiveSupport() \\\n .getOrCreate()\n\n print('PokemonBasicETLOperation... | [
"0.56756043",
"0.56122077",
"0.54967594",
"0.5257007",
"0.51087713",
"0.5085518",
"0.5048178",
"0.50299954",
"0.49611324",
"0.4949085",
"0.4934532",
"0.49273327",
"0.4893496",
"0.48927677",
"0.48924962",
"0.48795712",
"0.4853256",
"0.48444578",
"0.48290846",
"0.48287162",
"0.... | 0.7330357 | 0 |
Execute the ETL step. | def run(self):
with self.get_connection() as conn:
#self._create_new_batch_and_step_audit(conn)
"""Kick off the transformation job."""
if self.run_all_steps:
self.run_all()
else:
self.skipped_steps = []
self.skipped_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def execute(self):\n # Put your execute step code here before calling the '_doneExecution' method.\n self._doneExecution()",
"def execute(self, context):\n # Validate the input parameters\n self.validate_input_params()\n\n # Identify the execution environment\n self.get_... | [
"0.7143932",
"0.66826534",
"0.65917426",
"0.6515676",
"0.63193166",
"0.6214851",
"0.61614645",
"0.6035541",
"0.6005204",
"0.59819424",
"0.59819424",
"0.59819424",
"0.59819424",
"0.5942145",
"0.592847",
"0.592847",
"0.592847",
"0.592847",
"0.592847",
"0.592847",
"0.59029555",
... | 0.69802505 | 1 |
Creates the encoding Hamiltonian. | def encoder_hamiltonian_simple(nqubits, ncompress):
m0 = hamiltonians.Z(ncompress).matrix
m1 = np.eye(2 ** (nqubits - ncompress), dtype=m0.dtype)
ham = hamiltonians.Hamiltonian(nqubits, np.kron(m1, m0))
return 0.5 * (ham + ncompress) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def HamiltonianMatrix(self):\n self.Inter = sp.Matrix([[0,self.t],[self.t,0]])\n self.Intra1 = sp.Matrix([[0,v],[w,0]])\n self.Intra2 = sp.Matrix([[0,w],[v,0]])\n H = sp.Matrix([])\n for i in range(1, self.N+1):\n fila = sp.Matrix([])\n for j in range(1, sel... | [
"0.6941491",
"0.6920931",
"0.6350676",
"0.62835497",
"0.6219655",
"0.6188532",
"0.6182802",
"0.616554",
"0.6149488",
"0.6113485",
"0.60669327",
"0.60391814",
"0.6025256",
"0.59840715",
"0.5845566",
"0.584216",
"0.583124",
"0.5821917",
"0.5758647",
"0.57522625",
"0.5709468",
... | 0.71989995 | 0 |
Make the zones, and initiates their demand matrix. Updates the self.zones attribute inplace. | def _create_zones(self, output_path):
for z_id in self.zone_ids:
Z = Zone(z_id, self.operator, output_path, rs=self.rs1)
Z.read_daily_demand(self.daily_OD_demand) # , self.daily_pickup_demand
self.zones.append(Z) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def zones(self, zones):\n\n self._zones = zones",
"def zones(self, zones):\n\n self._zones = zones",
"def assign_zone_veh(self, t, warmup_phase, penalty, operator):\n for z in self.zones:\n z.assign(self.zones, t, warmup_phase, penalty, operator)",
"def ZoneBuilder():\n\n #... | [
"0.6597357",
"0.6597357",
"0.61654705",
"0.608163",
"0.5657627",
"0.55448735",
"0.55435044",
"0.5542872",
"0.54235804",
"0.5404898",
"0.53658164",
"0.53380954",
"0.5334711",
"0.5311318",
"0.5238962",
"0.5230855",
"0.52011704",
"0.51957196",
"0.518204",
"0.51748765",
"0.513198... | 0.6956961 | 0 |
Creates list of Vehicles and assigns random sets of them to be pro, deceived, fareaware, and AV. | def _create_vehicles(self, data_obj, output_path, beta=1):
# self.vehicles = [
# Veh(self.rs1, self.operator, beta) for i in range(self.FLEET_SIZE)
# ]
# self.vehicles = [
# AvDriver(self.rs1, self.operator, beta) for _ in range(2500)
# ]
self.vehicles = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUp(self):\n\n self.veh = Vehicle(0, 0)\n self.R = Random(seed)",
"def __init__(self, vehicles):\n self.vehicles = vehicles",
"def run():\n step = 0\n vehicles = []\n # persons = []\n while traci.simulation.getMinExpectedNumber() > 0:\n\t\n\n # Adding the new vehic... | [
"0.6544059",
"0.6228037",
"0.6033748",
"0.5973883",
"0.5852283",
"0.5781712",
"0.5754023",
"0.5696351",
"0.5669336",
"0.5664515",
"0.5651519",
"0.5632544",
"0.56240225",
"0.5618014",
"0.5563407",
"0.5527453",
"0.5500666",
"0.5458766",
"0.53936803",
"0.5391712",
"0.53515416",
... | 0.6464466 | 1 |
Sets the demand rate per zone given an hour of day. | def set_analysis_time(self, t):
for z in self.zones:
z.set_demand_rate_per_t(t) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_zonal_demand(self, t):\n t_hour = (t / 3600)\n t_15_min = convert_seconds_to_15_min(t)\n\n # this needs to be double checked\n if self.WARMUP_PHASE and t >= self.ANALYSIS_TIME_SECONDS:\n # print(\"changing demand rate from warm up to analysis\")\n # se... | [
"0.6100384",
"0.56484896",
"0.55665255",
"0.5557684",
"0.5469699",
"0.5349603",
"0.5319937",
"0.5220121",
"0.5186424",
"0.5180276",
"0.51649946",
"0.51355964",
"0.51277345",
"0.5051228",
"0.5033395",
"0.50235575",
"0.50127864",
"0.4989776",
"0.49656284",
"0.495929",
"0.494547... | 0.6759535 | 0 |
First checks to see if should change the demand rates, then generates demand for each zone. this is called every ASSIGN seconds. Need not generate demand each time (?) | def generate_zonal_demand(self, t):
t_hour = (t / 3600)
t_15_min = convert_seconds_to_15_min(t)
# this needs to be double checked
if self.WARMUP_PHASE and t >= self.ANALYSIS_TIME_SECONDS:
# print("changing demand rate from warm up to analysis")
# self.set_analysi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assign_demand(self, demand, pattern_prefix='ResetDemand'):\n for junc_name in demand.columns:\n \n # Extract the node demand pattern and resample to match the pattern timestep\n demand_pattern = demand.loc[:, junc_name]\n demand_pattern.index = pd.TimedeltaInd... | [
"0.61956024",
"0.5926726",
"0.5885478",
"0.5798715",
"0.57432085",
"0.570556",
"0.56344527",
"0.563335",
"0.5555163",
"0.5552043",
"0.54899377",
"0.54333526",
"0.5419752",
"0.5414277",
"0.5407989",
"0.53699857",
"0.5361721",
"0.53311574",
"0.5284272",
"0.52707005",
"0.5178539... | 0.71082747 | 0 |
Applies action to each vehicle. An improvement could be to filter out veh based on their status, then run those that have to move in parallel | def move_fleet(self, t, warmup_phase, action):
for veh in self.vehicles:
_ = veh.act(t, self.zones, warmup_phase)
# if not veh.is_AV: # AV is already being moved by the engine
# _ = veh.act(t, self.zones, WARMUP_PHASE)
# if veh.is_AV:
# # if veh.should_move... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _step(self, rl_actions):\n self.timer += 1\n # pdb.set_trace()\n # perform acceleration and (optionally) lane change actions for\n # traci-controlled human-driven vehicles\n if len(self.controlled_ids) > 0:\n accel = []\n for veh_id in self.controlled_id... | [
"0.6588163",
"0.58777547",
"0.57271653",
"0.57047975",
"0.553227",
"0.55241203",
"0.5465102",
"0.5445465",
"0.54085654",
"0.5407473",
"0.5404845",
"0.5396907",
"0.5395431",
"0.53895587",
"0.5385162",
"0.53761584",
"0.53420454",
"0.53420454",
"0.53411967",
"0.53333956",
"0.533... | 0.680932 | 0 |
Assigns zone to each vehicle.this_t_demand | def assign_zone_veh(self, t, warmup_phase, penalty, operator):
for z in self.zones:
z.assign(self.zones, t, warmup_phase, penalty, operator) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _create_zones(self, output_path):\n for z_id in self.zone_ids:\n Z = Zone(z_id, self.operator, output_path, rs=self.rs1)\n Z.read_daily_demand(self.daily_OD_demand) # , self.daily_pickup_demand\n self.zones.append(Z)",
"def _get_demand_per_zone(self, t):\n a = ... | [
"0.61349016",
"0.6042197",
"0.5971158",
"0.5919825",
"0.5810015",
"0.5572706",
"0.55091125",
"0.5484845",
"0.5460081",
"0.5410041",
"0.5410041",
"0.5383754",
"0.52649534",
"0.5200213",
"0.516716",
"0.51594514",
"0.5088925",
"0.5082407",
"0.5051754",
"0.49951208",
"0.4980607",... | 0.7793545 | 0 |
Gets demand per zone. | def _get_demand_per_zone(self, t):
a = {z.id: len(z.demand) for z in self.zones}
demand_df = pd.DataFrame.from_dict(a, orient="index", columns=["demand"])
# normalize it
demand_df["demand"] = demand_df["demand"] / (demand_df["demand"].max() + 1)
# print ("normalized demand ", de... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_demand(self):\n return self.df_demand",
"def scale_demand(self, zone_name=None, zone_id=None):\n if bool(zone_name) or bool(zone_id) is True:\n if \"demand\" not in self.ct:\n self.ct[\"demand\"] = {}\n if \"zone_id\" not in self.ct[\"demand\"]:\n ... | [
"0.62915665",
"0.6076426",
"0.60531384",
"0.5772092",
"0.55382586",
"0.539438",
"0.5356246",
"0.52658224",
"0.5262847",
"0.5170033",
"0.50641596",
"0.5050302",
"0.502881",
"0.5024901",
"0.5010458",
"0.4972451",
"0.4945866",
"0.48927528",
"0.48709497",
"0.48636517",
"0.4861673... | 0.745379 | 0 |
Gets supply per zone. | def _get_supply_per_zone(self, t):
b = {z.id: len(z.idle_vehicles) for z in self.zones}
supply_df = pd.DataFrame.from_dict(b, orient="index", columns=["supply"])
# I shouldn't have cast it as df. dicts are much more efficient
# normalize it
supply_df["supply"] = supply_df["suppl... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_demand_per_zone(self, t):\n a = {z.id: len(z.demand) for z in self.zones}\n demand_df = pd.DataFrame.from_dict(a, orient=\"index\", columns=[\"demand\"])\n # normalize it \n demand_df[\"demand\"] = demand_df[\"demand\"] / (demand_df[\"demand\"].max() + 1)\n # print (\"no... | [
"0.59698856",
"0.59555465",
"0.58446",
"0.58072203",
"0.56959426",
"0.5515072",
"0.5427641",
"0.5367154",
"0.52897626",
"0.52463764",
"0.5206447",
"0.5195225",
"0.5162395",
"0.5137291",
"0.5128658",
"0.5066615",
"0.50612944",
"0.50195336",
"0.4995374",
"0.497812",
"0.49637252... | 0.74225634 | 0 |
Returns the critical angle if it exists for a ball moving from a medium with velocity `s0` to a medium with velocity `s1`. If the critical angle does not exist, returns None. | def get_critical_angle(s0: float, s1: float) -> Union[float, None]:
if s0 < s1:
critical_angle = math.asin(s0 / s1)
else:
critical_angle = None
return critical_angle | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _exceeds_critical_angle(angle: float, s0: float, s1: float) -> bool:\n if s1 > s0: # if the second speed is faster, there is a critical angle\n critical_angle = get_critical_angle(s0, s1)\n if abs(angle) >= critical_angle:\n return True\n return False",
"de... | [
"0.6010786",
"0.579282",
"0.539038",
"0.530186",
"0.5274534",
"0.52288604",
"0.5030306",
"0.4990997",
"0.4958949",
"0.49580598",
"0.49514675",
"0.49347538",
"0.49278605",
"0.49215996",
"0.49145883",
"0.4881637",
"0.48812023",
"0.4877278",
"0.4851266",
"0.48504397",
"0.4849300... | 0.7503091 | 0 |
Only return the fieldside edge | def _get_edges(self) -> Tuple[Line]:
if self.side == 'right':
return Line((self.left_bound, self.bottom_bound), (self.left_bound, self.top_bound)),
elif self.side == 'left':
return Line((self.right_bound, self.bottom_bound), (self.right_bound, self.top_bound)), | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __filterEdges(self):",
"def edges_right(self):\n return self._edges_right",
"def edge(self, which='inner'):\n def edge_shape(site):\n def in_shape(x): return self.shape(Site(site.family, site.tag + x))\n sites = [in_shape(x) for x in self._directions]\n if whi... | [
"0.5963058",
"0.5917959",
"0.58682823",
"0.5862825",
"0.5845404",
"0.5826389",
"0.5805638",
"0.57993376",
"0.575567",
"0.575157",
"0.5721823",
"0.5697808",
"0.5676228",
"0.56311166",
"0.56122196",
"0.56020737",
"0.55974483",
"0.55747265",
"0.55559725",
"0.5548714",
"0.5522019... | 0.60327727 | 0 |
Computes the fractional distance from the middle of the paddle, normalized by the paddle's height. Asserts if the ball was not on the paddle. | def get_fraction_of_paddle(self, point: Point):
fraction = (point.y - self.y) / self.height
fraction = max(min(fraction, 0.5), -0.5) # clamp to +/- 0.5
return fraction | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hit_paddle(self):\n pass\n\n #Implement if collision with paddle is detected\n\n #Add randomness to how ball direction will change and return value",
"def check_point_height(start, end, test_bottles):\n return round(((end - start)**(test_bottles - 1))**(1 / test_bottles))",
"def bal... | [
"0.6123754",
"0.5935661",
"0.5823138",
"0.5738868",
"0.5623894",
"0.55170155",
"0.55122274",
"0.547126",
"0.5339954",
"0.53247905",
"0.5304228",
"0.5247123",
"0.516755",
"0.51607805",
"0.5159597",
"0.5099749",
"0.50925815",
"0.5087354",
"0.5064778",
"0.5062167",
"0.5052686",
... | 0.7337538 | 0 |
Step the Snell speed using a bounded Gaussian random walk. step with mean 0, standard deviation `self.speed` Clip the speed at `0.5 self._initial_speed <= self.speed <= 2.0 self._initial_speed` | def step(self):
if self.change_rate != 0:
self.speed += stats.norm(loc=0, scale=self.change_rate).rvs()
if self.speed < 0.5 * self._initial_speed:
self.speed = 0.5 * self._initial_speed
if self.speed > 2.0 * self._initial_speed:
self.speed = 2... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def moveStep(self):\n\t\tif self.pos[0] <= self.boundsX[0] or \\\n\t\t(self.pos[0]+ 2*(self.radius)) >= self.boundsX[1]:\n\t\t\tself.dir[0] *= -1\n\t\t\t\n\t\tself.pos[0] += self.dir[0]*self.speed\n\t\tself.pos[1] += self.dir[1]*self.speed",
"def _step_snell(self) -> None:\n self.snell.step()",
"def mov... | [
"0.6232809",
"0.6182479",
"0.59714043",
"0.5944232",
"0.593122",
"0.5835036",
"0.58030057",
"0.5765516",
"0.5716762",
"0.568511",
"0.5661887",
"0.56523377",
"0.56518894",
"0.56274927",
"0.5624595",
"0.55835456",
"0.55775446",
"0.55728686",
"0.55728686",
"0.55643064",
"0.55526... | 0.7044735 | 0 |
Get the new center of `self.shape` given that it moved along `intersected_trajectory` to `intersection` | def get_center_at_intersection(self) -> Point:
return self._reference + (self.intersection - self.intersected_trajectory.start) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_arc_center(self):\n # First two anchors and handles\n a1, h1, h2, a2 = self.points[:4]\n # Tangent vectors\n t1 = h1 - a1\n t2 = h2 - a2\n # Normals\n n1 = rotate_vector(t1, TAU / 4)\n n2 = rotate_vector(t2, TAU / 4)\n try:\n return ... | [
"0.63750815",
"0.63332224",
"0.63039184",
"0.62753254",
"0.62234765",
"0.6177357",
"0.61509854",
"0.614645",
"0.6120481",
"0.61169904",
"0.60962564",
"0.60668796",
"0.6025694",
"0.60228324",
"0.60126793",
"0.6008668",
"0.59633374",
"0.59632355",
"0.5960461",
"0.5949887",
"0.5... | 0.7748842 | 0 |
Line representing the trajectory of the center of the rectangle | def center(self) -> Line:
return Line(self.shape.pos, self.shape.pos + self.velocity) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def linecenter(l):\n return scale3(add(l[0],l[1]),0.5)",
"def process_laneOffset(self):\n center_line = np.poly1d(np.mean([self.line_l.get_LinePoly().coeffs, self.line_r.get_LinePoly().coeffs], axis=0))\n # store the center line polynomial\n self.center_poly = center_line\n center_... | [
"0.6671033",
"0.66388696",
"0.6547845",
"0.65411705",
"0.6436573",
"0.64274913",
"0.63992375",
"0.6397063",
"0.63848",
"0.63320243",
"0.62949157",
"0.6241075",
"0.62300974",
"0.62076354",
"0.6202545",
"0.6159428",
"0.6132871",
"0.612322",
"0.61149746",
"0.6113991",
"0.6103718... | 0.7276671 | 0 |
Line representing the trajectory of the point on the top right corner of the rectangle | def top_right(self) -> Line:
start = Point(self.shape.right_bound, self.shape.top_bound)
return Line(start, start + self.velocity) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def line():\n tt.left(90)\n tt.down()\n tt.forward(50)\n tt.up()\n tt.right(90)\n tt.forward(10)\n tt.right(90)\n tt.forward(50)\n tt.left(90)",
"def get_walking_line(self):\n\t\treturn self._bottom_rect.move(0,1)",
"def ortho_line_cut(self):\n x_mid_left, y_mid_left = self.mi... | [
"0.69126624",
"0.6677289",
"0.6500462",
"0.6499103",
"0.64612305",
"0.64405686",
"0.64076847",
"0.639501",
"0.6381326",
"0.6339662",
"0.6304812",
"0.6296001",
"0.6231341",
"0.61784625",
"0.61339736",
"0.6084219",
"0.60773045",
"0.6074784",
"0.60732234",
"0.6068617",
"0.602019... | 0.70159036 | 0 |
Line representing the trajectory of the point on the bottom right corner of the rectangle | def bottom_right(self) -> Line:
start = Point(self.shape.right_bound, self.shape.bottom_bound)
return Line(start, start + self.velocity) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_walking_line(self):\n\t\treturn self._bottom_rect.move(0,1)",
"def line():\n tt.left(90)\n tt.down()\n tt.forward(50)\n tt.up()\n tt.right(90)\n tt.forward(10)\n tt.right(90)\n tt.forward(50)\n tt.left(90)",
"def bottom_left(self) -> Line:\n start = Point(self.shape.le... | [
"0.70809007",
"0.68511844",
"0.66570073",
"0.66522264",
"0.63814306",
"0.6367143",
"0.6353308",
"0.6326941",
"0.62217885",
"0.6182864",
"0.6161414",
"0.61573404",
"0.6155028",
"0.61501205",
"0.6149612",
"0.61307883",
"0.6123404",
"0.61039734",
"0.60611546",
"0.60571724",
"0.6... | 0.6944726 | 1 |
Line representing the trajectory of the point on the bottom left corner of the rectangle | def bottom_left(self) -> Line:
start = Point(self.shape.left_bound, self.shape.bottom_bound)
return Line(start, start + self.velocity) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_walking_line(self):\n\t\treturn self._bottom_rect.move(0,1)",
"def line():\n tt.left(90)\n tt.down()\n tt.forward(50)\n tt.up()\n tt.right(90)\n tt.forward(10)\n tt.right(90)\n tt.forward(50)\n tt.left(90)",
"def lineTo(self, pt: Tuple[float, float]) -> None:\n raise N... | [
"0.72978294",
"0.689214",
"0.66303694",
"0.6532441",
"0.65251946",
"0.6418947",
"0.63123465",
"0.6311407",
"0.6309154",
"0.6299914",
"0.6283975",
"0.62830764",
"0.62715065",
"0.6270752",
"0.62453437",
"0.62370527",
"0.62170684",
"0.6192569",
"0.6184179",
"0.61698914",
"0.6151... | 0.6892858 | 1 |
Step the snell layer | def _step_snell(self) -> None:
self.snell.step() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def step(self):\n self.latent.step()",
"def step(self, state):",
"def step(self, move):",
"def _step(self) -> None:",
"def step(self):\n for layer in self.layers:\n layer.step()",
"def _step(self):\n pass",
"def step_forward(self):",
"def step(self):\n self.turn... | [
"0.73195446",
"0.72716635",
"0.7269798",
"0.7169496",
"0.7036799",
"0.7029862",
"0.6987591",
"0.6816891",
"0.6744525",
"0.6699831",
"0.66457427",
"0.6598306",
"0.65578103",
"0.6469328",
"0.6437729",
"0.64287686",
"0.64105487",
"0.63998324",
"0.63794404",
"0.63794404",
"0.6379... | 0.84099066 | 0 |
Move our paddle according to the provided action | def _move_our_paddle(self, action) -> None:
if not isinstance(action, int):
action = action.item() # pops the item if the action is a single tensor
assert action in [a for a in self.action_meanings.keys()], f"{action} is not a valid action"
if action == self.actions['UP']:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move(self, action): # Good\n if action == 0:\n dx, dy = 0, 1\n elif action == 1:\n dx, dy = 1, 0\n elif action == 2:\n dx, dy = 0, -1\n elif action == 3:\n dx, dy = -1, 0\n else:\n dx, dy = 0, 0\n\n # Check for ma... | [
"0.7872756",
"0.7575142",
"0.7355714",
"0.73409414",
"0.728534",
"0.71694964",
"0.70727396",
"0.695363",
"0.6951434",
"0.69386613",
"0.69076127",
"0.69034314",
"0.6900295",
"0.6885839",
"0.68503755",
"0.68349856",
"0.6800864",
"0.67994756",
"0.6655875",
"0.6652583",
"0.662730... | 0.8321614 | 0 |
Get the ball's trajectory | def _get_trajectory(self, speed) -> TrajectoryBase:
if speed is None:
speed = self._get_ball_speed()
if self.ball.has_volume:
trajectory = Trajectory(self.ball, self.ball.get_velocity(speed))
else:
trajectory = Trajectory(self.ball.pos, self.ball.get_velocity(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def velocity_trajectory(self):\n return self._read(MX_VELOCITY_TRAJECTORY)",
"def trajectory(self):\n return Trajectory.createFromTuples(self.points)",
"def compute_trajectory():\n pass",
"def get_trajectory(self) -> Tuple:\n # Ensure index is in an allowable range\n assert sel... | [
"0.6522522",
"0.6501632",
"0.6486845",
"0.64087766",
"0.6372202",
"0.62591267",
"0.6071708",
"0.5993876",
"0.59933424",
"0.59438807",
"0.5855975",
"0.5815467",
"0.58059293",
"0.5801262",
"0.57899225",
"0.5750407",
"0.5734261",
"0.5734236",
"0.5725707",
"0.5725183",
"0.5718258... | 0.6618583 | 0 |
Test if the angle exceeds the critical angle | def _exceeds_critical_angle(angle: float, s0: float, s1: float) -> bool:
if s1 > s0: # if the second speed is faster, there is a critical angle
critical_angle = get_critical_angle(s0, s1)
if abs(angle) >= critical_angle:
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assertAngle(self, angle: float):\n assert isinstance(angle, float), f\"bad angle instance, type of angle is {type(angle)}\"\n assert -180 <= angle <= 180",
"def reached_angle(self, angle, tol):\n if self.ros_node.get_data(\"/auto/turret/current/angle\") is None:\n rospy.logerr... | [
"0.66772497",
"0.66135794",
"0.64485186",
"0.62993383",
"0.610907",
"0.60740596",
"0.59498024",
"0.59441805",
"0.5883828",
"0.5866966",
"0.5858517",
"0.58271027",
"0.5797528",
"0.57278055",
"0.5672237",
"0.5668866",
"0.5637607",
"0.56345373",
"0.5609922",
"0.55781657",
"0.555... | 0.74296075 | 0 |
If the direction of incidence was from the right of the boundary, reflect `new_angle`, otherwise, return `new_angle` without modification. | def _adjust_refraction_to_direction_of_incidence(boundary_angle: float, new_angle: float,
trajectory: TrajectoryBase) -> float:
angle = trajectory.center.angle
assert -math.pi / 2 <= boundary_angle <= math.pi / 2, "boundary_angle should be in first or... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _adjust_refraction_to_boundary_angle(boundary: Line, new_angle: float) -> Tuple[float, float]:\n # TODO: verify this works with a non-vertical interface\n\n boundary_angle = boundary.angle % (2 * math.pi)\n if 0 <= boundary_angle < math.pi / 2: # in the first quadrant\n boundar... | [
"0.7131424",
"0.6346449",
"0.6314746",
"0.62681365",
"0.6202396",
"0.6154974",
"0.61481524",
"0.61018366",
"0.60641396",
"0.6053132",
"0.6040652",
"0.60396427",
"0.6029524",
"0.6011463",
"0.60113543",
"0.5964354",
"0.5952231",
"0.5885328",
"0.588162",
"0.5878843",
"0.58727217... | 0.75706065 | 0 |
Get the speed at the start of the trajectory and the speed at the end of the trajectory. | def _get_start_and_end_speed(self, trajectory: TrajectoryBase) -> Tuple[float, float]:
snell = trajectory.intersected_object
# todo: detect if start is in some other snell layer
if snell.is_in(trajectory.center.start):
s0 = snell.speed
s1 = self.default_ball_speed
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_speed(self):\r\n return self.__x_speed, self.__y_speed",
"def speed_get_between(self, start, end):\n\n return self.__get_between(Speed, start, end)",
"def get_speed(self):\n return self.__corrds[self.X_SPEED], self.__corrds[self.Y_SPEED]",
"def get_speed(self):\n raise Not... | [
"0.741218",
"0.7000722",
"0.6874635",
"0.6790877",
"0.6790877",
"0.67530245",
"0.6625338",
"0.6604247",
"0.6597466",
"0.65884495",
"0.65148586",
"0.64933175",
"0.6481466",
"0.648066",
"0.64750993",
"0.645933",
"0.6453968",
"0.64438754",
"0.6442153",
"0.6383442",
"0.6383442",
... | 0.79775745 | 0 |
Multiplies the velocity of the ball by `direction`, continues the path of the ball by calculating the remaining speed using trajectory and point. | def _reflect(self, direction: Point, trajectory: TrajectoryBase):
self.ball.unit_velocity *= direction
return self._finish_step_ball(trajectory) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def step_to(self, direction):\n s = self\n s.steps += s.speed\n s.physics.move_bomberman(self, direction)\n s.update_pos()",
"def move(self, direction):\r\n dx = direction[0]\r\n dy = direction[1]\r\n\r\n self.head[0] += dx * 10\r\n self.head[1] += dy * 10\... | [
"0.64460254",
"0.6421539",
"0.6390834",
"0.6368928",
"0.6318491",
"0.6283658",
"0.62379014",
"0.62239254",
"0.6122417",
"0.60023004",
"0.5999252",
"0.597263",
"0.5969131",
"0.5958619",
"0.5931148",
"0.58888817",
"0.58804244",
"0.58747435",
"0.5874586",
"0.5853984",
"0.5842917... | 0.7208114 | 0 |
Move the opponents paddle. Override this in a subclass to change the behavior. | def _step_their_paddle(self):
if random.random() < self.their_update_probability:
if self.paddle_l.y < self.ball.y:
if self.paddle_l.top_bound < self.top_bound:
self.paddle_l.up()
else:
if self.paddle_l.bottom_bound > self.bottom_bound:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _movePaddle(self):\n self._click()\n self._game.updatePaddle(self._touch)\n self._last = self._touch",
"def handle_pygame_event(self, event):\n if event.type != MOUSEMOTION:\n # nothing to do\n return\n self.model.paddle.x = event.pos[0]-self.model.pad... | [
"0.8007342",
"0.6943312",
"0.6936347",
"0.6791555",
"0.67737293",
"0.6761425",
"0.6698105",
"0.6677713",
"0.66727185",
"0.65992385",
"0.6528709",
"0.65159357",
"0.6471348",
"0.6469189",
"0.64408696",
"0.6418822",
"0.64146775",
"0.6413087",
"0.6349004",
"0.63349617",
"0.631874... | 0.69600636 | 1 |
The base environment for a request. | def _base_environ(self, **request):
# This is a minimal valid WSGI environ dictionary, plus:
# - HTTP_COOKIE: for cookie support,
# - REMOTE_ADDR: often useful, see #8551.
# See http://www.python.org/dev/peps/pep-3333/#environ-variables
environ = {
'HTTP_COOKIE': ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getEnvironment(self):\n pass",
"def environment(self):\n return self._environ",
"def environ(self):\n return dict(environment=request.environ)",
"def environ(self):\n return dict(environment=request.environ)",
"def environ(self):\n return dict(environment=request.envi... | [
"0.7345197",
"0.699421",
"0.6946309",
"0.6946309",
"0.6946309",
"0.69037884",
"0.68540996",
"0.68515205",
"0.68186307",
"0.67872745",
"0.6749734",
"0.6749734",
"0.6582044",
"0.65642875",
"0.65597266",
"0.65487874",
"0.65224063",
"0.65125674",
"0.64652604",
"0.64478445",
"0.64... | 0.72719526 | 1 |
Test endpoints.post_pull_request_review with a review where the status is not approved. | def test_post_pull_request_review_unapproved(
self,
validate_config,
handler_class,
conn,
verify_signature
):
conn.request.data.return_value = ''
conn.request.headers.get.return_value = 'sha1=signature'
verify_signature.return_value... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_non_github_review_request(self):\n repository = self._create_repository(github=False)\n review_request = self.create_review_request(repository=repository)\n diffset = self.create_diffset(review_request=review_request)\n diffset.base_commit_id = '8fd69d70f07b57c21ad8733c1c04ae60... | [
"0.7244904",
"0.6799727",
"0.6410097",
"0.63275385",
"0.62668633",
"0.6181843",
"0.6135359",
"0.61055267",
"0.6100361",
"0.60646296",
"0.60627526",
"0.6056421",
"0.60262567",
"0.6004002",
"0.60027504",
"0.5983102",
"0.59518236",
"0.59465826",
"0.59391",
"0.5935864",
"0.59177"... | 0.75268304 | 0 |
Test endpoints.post_pull_request_review with a bad config file | def test_post_pull_request_review_bad_config(
self,
validate_config,
handler_class,
conn,
verify_signature
):
conn.request.data.return_value = ''
conn.request.headers.get.return_value = 'sha1=signature'
verify_signature.return_valu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_post_pull_request_review_unapproved(\n self,\n validate_config,\n handler_class,\n conn,\n verify_signature\n ):\n conn.request.data.return_value = ''\n conn.request.headers.get.return_value = 'sha1=signature'\n verify_signatur... | [
"0.71223134",
"0.6770655",
"0.63719267",
"0.61392397",
"0.6102798",
"0.6059791",
"0.6037443",
"0.602915",
"0.59873384",
"0.5968829",
"0.59042585",
"0.58828056",
"0.5846803",
"0.5841738",
"0.5820489",
"0.5751044",
"0.5733971",
"0.568596",
"0.5668569",
"0.56645566",
"0.5644468"... | 0.717059 | 0 |
Gets the file list of all files that end in .conf | def get_file_list(start):
valid_files = []
for root, dirs, files in os.walk(start):
for name in files:
if name[-5:] == ".conf":
valid_files.append(os.path.join(root,name))
return valid_files | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_config_files(self):\n self.clear_lists()\n print self.abs_directory\n for file in os.listdir(self.abs_directory):\n print file\n if file.endswith('.json') and \"qemii\" in file:\n self.txt_files.append(file)",
"def _configFiles(self):\n import ... | [
"0.7399433",
"0.7188236",
"0.7122012",
"0.68966484",
"0.6885478",
"0.6877722",
"0.68294895",
"0.6803023",
"0.6782171",
"0.6720354",
"0.6661358",
"0.6616944",
"0.65967095",
"0.6564532",
"0.65644133",
"0.65434635",
"0.6536705",
"0.6527965",
"0.6521118",
"0.65059805",
"0.6495335... | 0.8059774 | 0 |
Test to ensure that there is no line with trailing whitespace | def test_trailing_whitespace():
test_failed = False
files = get_file_list(".")
for fname in files:
with open(fname,'r') as fp:
for i,line in enumerate(fp):
if len(line) > 1 and line[-2] == ' ':
print("Line", i+1, "in", fname, "has trailing whitespace."... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _is_blank_line(self):\n pattern = re.compile(r\"^(\\s)*$\")\n return pattern.search(self._line)",
"def is_blank(line):\n return line.strip(\" \\t\") == \"\\n\"",
"def no_blank_line_after_last_section(): # noqa: D416",
"def is_eof(line):\n return line == \"\"",
"def is_blank(line):\... | [
"0.7775136",
"0.7398199",
"0.73541254",
"0.73265284",
"0.7305549",
"0.7181788",
"0.717481",
"0.71215916",
"0.70665777",
"0.7066252",
"0.70400673",
"0.7039549",
"0.7004764",
"0.6986831",
"0.69415396",
"0.69415396",
"0.69415396",
"0.69415396",
"0.69415396",
"0.69415396",
"0.694... | 0.7739176 | 1 |
return the string for the city based on numbers(from 1 to 6) | def return_city(n):
if n == 1:
return "San Francisco"
elif n == 2:
return "Los Angeles"
elif n == 3:
return "Las Vegas"
elif n == 4:
return "Portland"
elif n == 5:
return "San Diego"
else:
return "Seattle" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_city_country(city, country, population=''):\n if population:\n location = city + ' ' + country + ' ' + str(population)\n return location.title()\n\n else:\n location = city + ' ' + country\n return location.title()",
"def country() -> str:",
"def city_country(city, country):\n return(city + ', '... | [
"0.7157107",
"0.678751",
"0.67826706",
"0.668883",
"0.6670766",
"0.6665512",
"0.6659949",
"0.66322637",
"0.65917933",
"0.6588581",
"0.65821546",
"0.6545235",
"0.6460717",
"0.6460717",
"0.64229757",
"0.64201367",
"0.6374007",
"0.6359004",
"0.6358721",
"0.63520765",
"0.6344888"... | 0.8094228 | 0 |
Return the route from route_list with correct start city and end city | def return_route(start, end, r_list):
for i in range(len(r_list)):
if r_list[i].get_startcity() == start and r_list[i].get_endcity() == end:
return r_list[i]
return "Error" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_cities_of_route(network, route):\n result = []\n if len(route) >= 1:\n road_id = route[0]\n result.append( get_start(network,road_id) )\n result.append( get_end(network,road_id) )\n for i in range(1,len(route)):\n road_id = route[i]\n result.append( get_end(network,road_id) )\n return re... | [
"0.7073928",
"0.6430574",
"0.62372965",
"0.6180158",
"0.61482686",
"0.60656065",
"0.5992861",
"0.5899816",
"0.58838457",
"0.5784456",
"0.57759476",
"0.5741343",
"0.573972",
"0.5690127",
"0.56700885",
"0.56469387",
"0.5631458",
"0.5627042",
"0.5563091",
"0.55488926",
"0.554486... | 0.8011541 | 0 |
calculate new budget after user has chosen his/her hotel and car rental | def budget_for_necessities():
print("========== Displaying hotel options ==========")
for i in range(len(hotel_list)):
print(" -- Enter", i+1, "to choose -- ")
hotel_list[i].print_hotel()
print(" ")
while True:
try:
hotel_num = int(input("Please choose your ho... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def declare_new_budget(date, exp_data):\n\n exp_list = exp_data[env.EXPENSE_DATA_KEY]\n local_budget = {}\n month_total = util.get_float_input(\n f\"Please input your total for the month ending {date}: \", force_pos=True)\n budg_remaining = month_total\n\n for i, exp in enumerate(exp_list):\n... | [
"0.65375125",
"0.64131814",
"0.6159649",
"0.6108596",
"0.6090275",
"0.596295",
"0.59443724",
"0.5937326",
"0.5927133",
"0.5882155",
"0.58536524",
"0.5784477",
"0.5772519",
"0.5768703",
"0.5768117",
"0.57595724",
"0.5695208",
"0.561452",
"0.560901",
"0.5601293",
"0.55700314",
... | 0.76039195 | 0 |
Calculate user's new budget after user has chosen his/her choices of activities in the destination | def budget_for_activities(endcity, activity_list, num_traveler): # calculate new budget
# displaying activity list based on endcity
print("====== Displaying", endcity, "activities options =====")
for i in range(len(activity_list)):
print(" -- Enter", i+1, "to choose -- ")
activity_list[... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate(self):\n if self.lineEdit.text() and self.lineEdit_2.text():\n try:\n amount_per_month = float(self.lineEdit.text())\n saving_goal = float(self.lineEdit_2.text())\n self.customer.budget.set_saving_goal(saving_goal)\n DB.upd... | [
"0.62127125",
"0.58741826",
"0.58345795",
"0.5799635",
"0.57525086",
"0.57321143",
"0.5650853",
"0.56081635",
"0.556366",
"0.5559017",
"0.55533886",
"0.5538425",
"0.55188465",
"0.55125",
"0.54867697",
"0.54794145",
"0.54696155",
"0.5458071",
"0.5445467",
"0.54335076",
"0.5404... | 0.7396493 | 0 |
Return entries form regression dataset. Returns the line number, smiles, molecule, and the value found in column col | def _regressionData(filename, col):
with open(os.path.join(RDConfig.RDCodeDir, 'Chem', 'test_data', filename), 'r') as inF:
for lineNum, line in enumerate(inF, 1):
if line[0] == '#':
continue
splitL = line.split(',')
smi = splitL[0]
mol = Chem.MolFromSmiles(smi)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def regression_results(filename):\n regression_df = pd.read_csv(filename)\n intercept = regression_df.loc[regression_df.term == '(Intercept)', 'estimate'][0]\n exportness = _exportness(regression_df)\n coefficients = _coefficients(regression_df)\n return intercept, exportness, coefficients",
"def ... | [
"0.5657919",
"0.5543888",
"0.5415182",
"0.5392047",
"0.53403986",
"0.5297101",
"0.5269848",
"0.5205856",
"0.5090809",
"0.5079602",
"0.5055786",
"0.50489676",
"0.5043683",
"0.5031673",
"0.50143003",
"0.50005764",
"0.4969909",
"0.49538836",
"0.49317765",
"0.4923969",
"0.4887051... | 0.6922318 | 0 |
Check Oracle Tablespace size dbhost port user password service_name | def main(dbhost, port, user, password, service_name, excluded_tables=None,
warning_level=85, critical_level=95, check_autoextensible="false", min_space=0.0):
try:
dsn_string = cx_Oracle.makedsn(host=dbhost, port=port, service_name=service_name)
connection = cx_Oracle.connect(user=user, pas... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search_space_size(self):",
"def get_table_size(self, table):\n sql = f''' SELECT COUNT(*) FROM {table}'''\n connection = self.__create_connection()\n cur = connection.cursor()\n cur.execute(sql)\n return cur.fetchone()[0]",
"def sys_service_memory():\n sort_cmd = [\"so... | [
"0.62148315",
"0.5979753",
"0.59543115",
"0.58475757",
"0.5842946",
"0.58283126",
"0.57599765",
"0.57271993",
"0.5698311",
"0.5640847",
"0.56404173",
"0.5600639",
"0.5586263",
"0.55711985",
"0.5538199",
"0.55173945",
"0.551149",
"0.55014944",
"0.5491084",
"0.5483466",
"0.5482... | 0.64113325 | 0 |
Adds several different TA indicators to the given DataFrame | def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
dataframe['ema6'] = ta.EMA(dataframe, timeperiod=9)
dataframe['ema24'] = ta.EMA(dataframe, timeperiod=18)
dataframe['ema11'] = ta.EMA(dataframe, timeperiod=32)
dataframe['ema25'] = ta.EMA(dataframe, timep... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_all_features(df):\n df.reset_index(drop=True, inplace=True)\n df = target_indicators(df)\n df = momentum_indicators(df)\n df = trend_indicators(df)\n df = volatility_indicators(df)\n df = volume_indicators(df)\n df = special_indicators(df)\n return df",
"def compute_indicators(dat... | [
"0.63175184",
"0.61932194",
"0.59242016",
"0.57579154",
"0.57167786",
"0.55783266",
"0.5441853",
"0.5295948",
"0.52750206",
"0.5273258",
"0.5247545",
"0.52009755",
"0.51560396",
"0.5100445",
"0.5094348",
"0.5069075",
"0.502073",
"0.5003859",
"0.49756485",
"0.4963309",
"0.4914... | 0.6659227 | 0 |
Based on TA indicators, populates the buy signal for the given dataframe | def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
dataframe.loc[
(
(qtpylib.crossed_above(dataframe['ema'],dataframe['ema2']))
),'buy'] = 1
return dataframe | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def populate_buy_trend(dataframe: DataFrame, metadata: dict) -> DataFrame:\n conditions = []\n\n conditions.append(\n ((dataframe['bull'] > 0) & qtpylib.crossed_below(dataframe['rsi'], params['bull-buy-rsi-value'])) |\n (~(dataframe['bull'] > 0) & qtpylib.crossed... | [
"0.68424237",
"0.64744025",
"0.634877",
"0.63304603",
"0.6301081",
"0.62108445",
"0.6201535",
"0.6142331",
"0.60618615",
"0.5942784",
"0.5921008",
"0.59151185",
"0.58783567",
"0.5878143",
"0.58729225",
"0.5825762",
"0.5788938",
"0.57862324",
"0.5723639",
"0.5694107",
"0.56679... | 0.6737011 | 1 |
Read index page and extract file list to download (URL, file name) | def download_index(gaia_index):
# Create regex to extract URL and file name
reFile = re.compile(r'<a href="(.*(GaiaSource.*gz))"\>')
# Open Gaia HTML index file
response = urllib.request.urlopen(gaia_index)
# Read content
files = []
page = response.readlines()
# Extract URLs from the pag... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def download_files(path):\n return edgar.download_index(path,2019,skip_all_present_except_last=False)",
"def index_files(self) -> List[str]:\n return self.get(\"index_files\", [\"index.html\", \"index.htm\"])",
"def download_files(self):",
"def get_files_to_download(self):\n\n self.logger.lo... | [
"0.6809696",
"0.6704706",
"0.6575322",
"0.65395737",
"0.6408207",
"0.6396758",
"0.637042",
"0.63070786",
"0.61939526",
"0.61688375",
"0.60817",
"0.60438424",
"0.60402185",
"0.6040202",
"0.60116416",
"0.5955451",
"0.59328437",
"0.59266585",
"0.5911613",
"0.58849955",
"0.588447... | 0.7895295 | 0 |
Install a plugin Plugin is added to the engine plugins list. Then the engine tries to resolve the plugin (importing module). The plugin is RESOLVED if this operation succeed, INSTALLED otherwise. | def install_plugin(self, name, path=None):
with self._plugins_lock:
plugin_id = self._next_plugin_id
new_plugin = Plugin(self, plugin_id, name)
self._plugins[plugin_id] = new_plugin
self._next_plugin_id += 1
for plugin in self._plugins:
if plu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def PluginInstall(self, pluginName, pluginPath):\n pass",
"def install(ctx, plugins, **kwargs):\n global logger\n logger = ctx.logger\n\n for plugin in plugins:\n ctx.logger.info(\"Installing plugin {0}\".format(plugin['name']))\n\n if plugin['name'] == 'default_workflows':\n ... | [
"0.71990967",
"0.68065387",
"0.66163504",
"0.65149003",
"0.62231964",
"0.61627376",
"0.6109652",
"0.60606134",
"0.6040886",
"0.59743637",
"0.5972481",
"0.59356636",
"0.5927221",
"0.59211504",
"0.5920364",
"0.5878593",
"0.58557916",
"0.5827109",
"0.58263415",
"0.58043444",
"0.... | 0.6951491 | 1 |
Compute the leaky ReLU activation function. | def leaky_relu(x, alpha=0.01):
return tf.maximum(x,alpha*x) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def leaky_relu(x, alpha=0.01):\n return tf.maximum(x, tf.multiply(x, alpha))",
"def test_leaky_relu_activation(self):\n self.assertEqual(\n [-0.0050, 0.5000], list(af.LeakyRelu(0.01).output(np.array([-0.5, 0.5]))))\n self.assertEqual([0.01, 1], list(af.LeakyRelu(\n 0.01).de... | [
"0.72324014",
"0.7216286",
"0.70243454",
"0.70038503",
"0.6969655",
"0.6929563",
"0.6864869",
"0.6849147",
"0.68292725",
"0.68021005",
"0.67519647",
"0.67474496",
"0.6747445",
"0.6747445",
"0.670609",
"0.668123",
"0.6672017",
"0.66471547",
"0.66453314",
"0.6642755",
"0.659231... | 0.7314766 | 0 |
Create solvers for GAN training. | def get_solvers(learning_rate=1e-3, beta1=0.5):
D_solver = tf.train.AdamOptimizer(learning_rate=learning_rate,beta1=beta1)
G_solver = tf.train.AdamOptimizer(learning_rate=learning_rate,beta1=beta1)
return D_solver, G_solver | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_solvers(learning_rate=1e-3, beta1=0.5):\n\n D_solver = tf.train.AdamOptimizer(learning_rate=learning_rate, beta1=beta1)\n G_solver = tf.train.AdamOptimizer(learning_rate=learning_rate, beta1=beta1)\n return D_solver, G_solver",
"def integrator_system(self):\n\n xd, xa, u, ODEeq, Aeq, stat... | [
"0.6215958",
"0.602851",
"0.5942521",
"0.5942521",
"0.5942521",
"0.5942521",
"0.5819618",
"0.57361937",
"0.57251227",
"0.56227094",
"0.54411334",
"0.5438495",
"0.5397888",
"0.53784186",
"0.5371194",
"0.5365405",
"0.53417784",
"0.52902067",
"0.52568537",
"0.52387786",
"0.52346... | 0.6209423 | 1 |
Find a SkinCluster from a transform Returns the skinCluster node | def getSkinCluster(_transform):
result = []
if not (pm.objExists(_transform)):
return result
validList = mel.eval('findRelatedDeformer("' + str(_transform) + '")')
if validList is None:
return result
for elem in validList:
if pm.nodeType(elem) ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_skincluster_node(input_object):\n history_list = input_object.listHistory(pruneDagObjects = True, interestLevel = True)\n skin_node = None\n for o in history_list:\n if o.nodeType() == 'skinCluster':\n skin_node = o\n\n return skin_node",
"def getSkinCluster(src):\n\n if ... | [
"0.74091965",
"0.737909",
"0.6886152",
"0.6136984",
"0.593469",
"0.5895198",
"0.5813873",
"0.55221546",
"0.5483886",
"0.5436325",
"0.5336005",
"0.53319734",
"0.5304073",
"0.53024757",
"0.53019595",
"0.52759105",
"0.5273542",
"0.52067465",
"0.5194725",
"0.5185826",
"0.5185826"... | 0.84422725 | 0 |
Takes keyword arguments kwargs, splits them into two separate dictionaries depending on their content, and returns them in a tuple. The first one will contain arguments related to potential remote file operations (e.g. ``"cache"`` or ``"retries"``), while the second one will contain all remaining arguments. This functi... | def split_remote_kwargs(cls, kwargs, include=None, skip=None):
include = make_list(include) if include else []
skip = make_list(skip) if skip else []
transfer_kwargs = {
name: kwargs.pop(name)
for name in ["cache", "prefer_cache", "retries", "retry_delay"] + include
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def split_transfer_kwargs(kwargs, skip=None):\n skip = make_list(skip) if skip else []\n transfer_kwargs = {\n name: kwargs.pop(name)\n for name in [\"cache\", \"prefer_cache\", \"retries\", \"retry_delay\"]\n if name in kwargs and name not in skip\n }\n return transfer_kwargs, kwa... | [
"0.7005303",
"0.6280482",
"0.6122765",
"0.6029355",
"0.59396434",
"0.58369195",
"0.5827949",
"0.5807987",
"0.5793665",
"0.57791525",
"0.573956",
"0.5710769",
"0.5686444",
"0.55811507",
"0.5555436",
"0.5529148",
"0.5494767",
"0.5494737",
"0.5490739",
"0.5477408",
"0.5450337",
... | 0.72957057 | 0 |
Prepares the directory of a target located at dst for copying and returns its full location as specified below. src can be the location of a source file target, which is (e.g.) used by a file copy or move operation. When dst is already a directory, calling this method has no effect and the dst path is returned, optiona... | def _prepare_dst_dir(self, dst, src=None, perm=None, **kwargs):
rstat = self.exists(dst, stat=True)
if rstat:
if self.file_interface.isdir(dst, stat=rstat) and src:
full_dst = os.path.join(dst, os.path.basename(src))
else:
full_dst = dst
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _prepare_dst_dir(self, dst, src=None, perm=None, **kwargs):\n if self.isdir(dst):\n full_dst = os.path.join(dst, os.path.basename(src)) if src else dst\n\n elif self.isfile(dst):\n full_dst = dst\n\n else:\n # interpret dst as a file name, create missing di... | [
"0.7807104",
"0.6556088",
"0.6495587",
"0.64078027",
"0.6379539",
"0.63349783",
"0.6235858",
"0.6206832",
"0.619432",
"0.61874044",
"0.618449",
"0.6143695",
"0.6143695",
"0.61247367",
"0.608597",
"0.6068637",
"0.6057749",
"0.6022156",
"0.60114926",
"0.5988563",
"0.5928638",
... | 0.77669203 | 1 |
Create the LaTeX for include a figure in a document | def _make_tex_figure(self, filename, caption, position="hb", clearpage=True):
if clearpage:
clrpage = " \\clearpage\n"
else:
clrpage = "\n"
figurestring = r"""
\begin{figure}[%s] %% FIGURE
\centering
\includegraphics[scale=1.00]... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def makeTexFigure(figFile, caption, pos=\"hb\", clearpage=True):\n if clearpage:\n clearpagetext = r\"\\clearpage\"\n else:\n clearpagetext = \"\"\n\n figurestring = (\n dedent(\n r\"\"\"\n \\begin{figure}[%s] %% FIGURE\n \\centering\n \\includegraphics[s... | [
"0.70339066",
"0.6608634",
"0.65558684",
"0.6535982",
"0.64250636",
"0.63366157",
"0.6298987",
"0.6296538",
"0.6281124",
"0.6262215",
"0.621831",
"0.61870915",
"0.61622065",
"0.61430717",
"0.61300915",
"0.6109291",
"0.6106042",
"0.6099445",
"0.6055513",
"0.6025987",
"0.601426... | 0.75428796 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.